gcc-warnings-cleanup-20030701
[openafs.git] / src / venus / kdump.c
index 4b60827..304cb3c 100644 (file)
@@ -13,6 +13,7 @@
 RCSID("$Header$");
 
 #include <stdio.h>
+#include <errno.h>
 #include <stdlib.h>    /* for malloc() */
 
 #ifdef AFS_LINUX24_ENV
@@ -54,7 +55,7 @@ struct ncp_sb_info{};
 #define u16 unsigned short
 #include <features.h>
 #if __GLIBC_MINOR__ >= 2
-#define _SYS_TYPES_H
+#define _SYS_TYPES_H 1
 #endif
 #define __KERNEL__
 #endif
@@ -402,8 +403,8 @@ typedef struct {
 #endif
 
 #include <afs/afsint.h>
-#include "../vlserver/vldbint.h"
-#include "../afs/lock.h"
+#include "vlserver/vldbint.h"
+#include "afs/lock.h"
 
 #define        KERNEL
 
@@ -423,8 +424,8 @@ extern off64_t lseek64();
 #define KDUMP_SIZE_T int
 #endif /* AFS_SGI61_ENV */
 
-#include "../afs/afs.h"                /* XXXX Getting it from the obj tree XXX */
-#include "../afs/afs_axscache.h" /* XXXX Getting it from the obj tree XXX */
+#include "afs/afs.h"           /* XXXX Getting it from the obj tree XXX */
+#include "afs/afs_axscache.h" /* XXXX Getting it from the obj tree XXX */
 #include <afs/afs_stats.h>
 
 #include <afs/cmd.h>
@@ -518,7 +519,6 @@ void print_cmstats();
 #ifndef AFS_KDUMP_LIB
 extern struct cmd_syndesc *cmd_CreateSyntax();
 #endif
-extern int errno;
 int opencore();
 
 #if    defined(AFS_HPUX_ENV) && defined(__LP64__)
@@ -1028,6 +1028,8 @@ kdump()
 
     if (Dcells || Dall) {
        print_cells(1); /* Handle the afs_cells structures */
+       print_cellaliases(1);
+       print_cellnames(1);
     }
 
     if (Dusers || Dall) {
@@ -1145,6 +1147,7 @@ kdump()
 #if !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
 int Sum_cellnames=0, Sum_userstp=0, Sum_volnames=0, Sum_exps=0, Sum_nfssysnames=0;
 int Sum_vcachemvids=0, Sum_vcachelinkData=0, Sum_vcacheacc=0, Sum_vcachelocks=0;
+int Sum_cellaliases=0, Sum_cellname_names=0;
 
 int print_cells(pnt)
 int pnt;
@@ -1168,6 +1171,64 @@ int pnt;
        j++;
     }
     if (pnt) printf("... found %d 'afs_cells' entries\n", j);
+
+    return j;
+}
+
+int print_cellaliases(int pnt)
+{
+    off_t symoff;
+    struct cell_alias *ca, cae;
+    long j = 0;
+
+    if (pnt) printf("\n\nPrinting cell_alias list...\n");
+    findsym( "afs_cellalias_head", &symoff);
+    kread(kmem, symoff, (char *) &ca, sizeof ca);
+    while (ca) {
+       char alias[100], cell[100];
+
+       kread(kmem, (off_t) ca, (char *) &cae, sizeof cae);
+       kread(kmem, (off_t) cae.alias, alias, (KDUMP_SIZE_T)40);
+       alias[40] = '\0';
+       Sum_cellaliases += strlen(alias) + 1;
+       kread(kmem, (off_t) cae.cell, cell, (KDUMP_SIZE_T)40);
+       cell[40] = '\0';
+       Sum_cellaliases += strlen(cell) + 1;
+       if (pnt)
+           printf("%x: alias=%s cell=%s index=%d\n",
+                  ca, alias, cell, cae.index);
+       ca = cae.next;
+       j++;
+    }
+    if (pnt) printf("... found %d 'cell_alias' entries\n", j);
+
+    return j;
+}
+
+int print_cellnames(int pnt)
+{
+    off_t symoff;
+    struct cell_name *cn, cne;
+    long j = 0;
+
+    if (pnt) printf("\n\nPrinting cell_name list...\n");
+    findsym( "afs_cellname_head", &symoff);
+    kread(kmem, symoff, (char *) &cn, sizeof cn);
+    while (cn) {
+       char cellname[100];
+
+       kread(kmem, (off_t) cn, (char *) &cne, sizeof cne);
+       kread(kmem, (off_t) cne.cellname, cellname, (KDUMP_SIZE_T)40);
+       cellname[40] = '\0';
+       Sum_cellname_names += strlen(cellname) + 1;
+       if (pnt)
+           printf("%x: cellnum=%d cellname=%s used=%d\n",
+                  cn, cne.cellnum, cellname, cne.used);
+       cn = cne.next;
+       j++;
+    }
+    if (pnt) printf("... found %d 'cell_name' entries\n", j);
+
     return j;
 }
 
@@ -1736,6 +1797,18 @@ int pnt;
     T += j;
     printf("%20s:\t%8d bytes\t[%d cells/%d bytes each + %d bytes for cell names]\n", "Cell package", j, i, sizeof(struct cell), Sum_cellnames);
 
+    Sum_cellaliases=0;
+    i = print_cellaliases(0);
+    j = (i * sizeof(struct cell_alias)) + Sum_cellaliases;
+    T += j;
+    printf("%20s:\t%8d bytes\t[%d cell_aliases/%d bytes each + %d bytes for cell names]\n", "Cell package", j, i, sizeof(struct cell_alias), Sum_cellaliases);
+
+    Sum_cellname_names=0;
+    i = print_cellnames(0);
+    j = (i * sizeof(struct cell_name)) + Sum_cellname_names;
+    T += j;
+    printf("%20s:\t%8d bytes\t[%d cell_names/%d bytes each + %d bytes for cell name strings]\n", "Cell package", j, i, sizeof(struct cell_name), Sum_cellname_names);
+
     Sum_userstp=0;
     i = print_users(0);
     j = (i * sizeof(struct unixuser)) + Sum_userstp;
@@ -2243,9 +2316,9 @@ void print_cell(kmem, clep, ptr, pnt)
     cellName[40] = 0;
     Sum_cellnames += strlen(cellName)+1;
     if (pnt) {
-       printf("%lx: cell=%s, cellname=%s, states=%x, cindex=%d fsport=%d vlport=%d timeout=%d\n", ptr,
-              PrintIPAddr(clep->cell), cellName, clep->states, clep->cellIndex,
-              clep->fsport, clep->vlport, clep->timeout);
+       printf("%lx: cellname=%s, states=%x, cnum=%d, cindex=%d fsport=%d vlport=%d timeout=%d cnamep=%x\n", ptr,
+              cellName, clep->states, clep->cellNum, clep->cellIndex,
+              clep->fsport, clep->vlport, clep->timeout, clep->cnamep);
 #ifdef AFS33
        if (clep->lcellp)
            printf("\tlinked cellp %lx\n", clep->lcellp);
@@ -2467,8 +2540,13 @@ void print_vnode(kmem, vep, ptr, pnt)
     printf("\ti_op=0x%x, i_dev=0x%x, i_rdev=0x%x, i_sb=0x%x\n",
           vep->i_op, vep->i_dev, vep->i_rdev, vep->i_sb);
 #ifdef AFS_LINUX24_ENV
+#ifdef AFS_PARISC_LINUX24_ENV
+    printf("\ti_sem: count=%d, wait=0x%x\n",
+          vep->i_sem.count, vep->i_sem.wait);
+#else
     printf("\ti_sem: count=%d, sleepers=%d, wait=0x%x\n",
           vep->i_sem.count, vep->i_sem.sleepers, vep->i_sem.wait);
+#endif
 #else
     printf("\ti_sem: count=%d, waking=%d, wait=0x%x\n",
           vep->i_sem.count, vep->i_sem.waking, vep->i_sem.wait);
@@ -2665,7 +2743,7 @@ void print_bkg(kmem)
        uentry = &afs_brs[i];
        if (uentry->refCount == 0) break;
        printf("[%d] vcache=0x%lx, cred=0x%lx, code=%d, refCount=%d, opcode=%d, flags=%x [%lx, %lx, %lx, %lx]\n",
-              i, uentry->vnode, uentry->cred, uentry->code, uentry->refCount, uentry->opcode, uentry->flags,
+              i, uentry->vc, uentry->cred, uentry->code, uentry->refCount, uentry->opcode, uentry->flags,
               uentry->size_parm[0], uentry->size_parm[1], uentry->ptr_parm[0], uentry->ptr_parm[1]);
 
     }