#include <afsconfig.h>
#include <afs/param.h>
-RCSID
- ("$Header$");
#include <stdio.h>
#include <errno.h>
byte cb_valid;
} cb_cursor;
-static struct {
- void ** cursor;
-} cb_cache;
-
static void
usage(char * prog)
{
- fprintf(stderr, "usage: %s [<state dump file>]\n");
+ fprintf(stderr, "usage: %s [<state dump file>]\n", prog);
}
int
main(int argc, char ** argv)
{
banner();
-
if (argc > 2 || (argc == 2 && !strcmp(argv[1], "-h"))) {
usage(argv[0]);
return 1;
if (openFile(argv[1]))
return 1;
} else {
- if (openFile(AFSDIR_SERVER_FSSTATE_FILEPATH))
+ if (openFile((char *)AFSDIR_SERVER_FSSTATE_FILEPATH))
return 1;
}
goto done;
}
- printf("mapped %d bytes at 0x%x\n", map_len, map);
+ printf("mapped %lu bytes at %"AFS_PTR_FMT"\n", (unsigned long)map_len, map);
done:
if (ret) {
fprintf(stderr, "prompt state broken; aborting\n");
return;
}
- gets(input);
+ fgets(input, 256, stdin);
if (!strcmp(input, "")) {
/* repeat last command */
do { \
char * _p = (char *)addr; \
char * _m = (char *)map; \
- printf("loading structure from address 0x%x (offset %u)\n", \
- addr, _p-_m); \
+ printf("loading structure from address %"AFS_PTR_FMT" (offset %ld)\n", \
+ addr, (long)(_p-_m)); \
} while (0)
/* structs */
/* time */
#define DPFT(T, name, var) \
do { \
- char * last; \
- printf(T "%s = \"%s\"\n", name, strtok_r(ctime(&(var)), "\r\n", &last)); \
+ time_t t = var; \
+ printf(T "%s = \"%.24s\"\n", name, ctime(&t)); \
} while(0)
#define DPFT1(name, var) DPFT(DPFTB1, name, var)
#define DPFT2(name, var) DPFT(DPFTB2, name, var)
static void
dump_he_entry(void)
{
+ char hoststr[16];
DPFSO0("hostDiskEntry");
- DPFS1("host", afs_inet_ntoa(he_cursor.he.host));
+ DPFS1("host", afs_inet_ntoa_r(he_cursor.he.host, hoststr));
DPFV1("port", "u", he_cursor.he.port);
DPFX1("hostFlags", he_cursor.he.hostFlags);
DPFV1("Console", "u", he_cursor.he.Console);
char temp_str[40];
struct Interface * ifp;
int len, i;
+ char hoststr[16];
if (!he_cursor.hdr.interfaces)
return;
for (i = 0; i < he_cursor.hdr.interfaces; i++) {
snprintf(temp_str, sizeof(temp_str), "interface[%d]", i);
DPFSO1(temp_str);
- DPFS2("addr", afs_inet_ntoa(ifp->interface[i].addr));
+ DPFS2("addr", afs_inet_ntoa_r(ifp->interface[i].addr, hoststr));
DPFV2("port", "u", ifp->interface[i].port);
DPFSC1;
}
static void
dump_he_hcps(void)
{
- char temp_str[40];
afs_int32 * hcps;
int len, i;
{
int i;
unsigned char * p = (unsigned char *)map;
- afs_uint32 c32;
if (!len)
return;
if ((offset + len) > map_len) {
- fprintf(stderr, "offset + length exceeds memory map size (%u > %u)\n",
- offset+len, map_len);
+ fprintf(stderr, "offset + length exceeds memory map size (%u > %lu)\n",
+ offset+len, (unsigned long)map_len);
return;
}
static int
get_cb_timeout(void)
{
- char * buf;
-
if (hdrs.timeout)
return 0;
static int
get_cb_fehash(void)
{
- char * buf;
-
if (hdrs.fehash)
return 0;
static int
get_fe_hdr(void)
{
+ if (!fe_cursor.cursor) {
+ if(get_fe(fe_cursor.idx)) {
+ return 1;
+ }
+ }
+
memcpy(&fe_cursor.hdr, fe_cursor.cursor, sizeof(struct callback_state_entry_header));
fe_cursor.hdr_valid = 1;
return 0;
static int
get_cb(afs_uint32 idx)
{
- int i;
char * p;
if (get_fe(fe_cursor.idx))
return 0;
}
+#if 0
static int
find_he_by_index(afs_uint32 idx)
{
}
return 1;
}
+#endif
static int
find_fe_by_index(afs_uint32 idx)