]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - logprint/log_misc.c
xfs_scrub: clean out the nproc global variable
[thirdparty/xfsprogs-dev.git] / logprint / log_misc.c
index 640c00ef2b67bae32c03dc8bd6189ac9023ee4a1..c325f046069af178029a869642134bb519bf84fb 100644 (file)
@@ -24,7 +24,7 @@ typedef struct xlog_split_item {
        int                     si_skip;
 } xlog_split_item_t;
 
-xlog_split_item_t *split_list = NULL;
+static xlog_split_item_t *split_list = NULL;
 
 void
 print_xlog_op_line(void)
@@ -33,7 +33,7 @@ print_xlog_op_line(void)
           "--------------------------------------\n");
 }      /* print_xlog_op_line */
 
-void
+static void
 print_xlog_xhdr_line(void)
 {
     printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
@@ -58,7 +58,7 @@ print_stars(void)
  * Given a pointer to a data segment, print out the data as if it were
  * a log operation header.
  */
-void
+static void
 xlog_print_op_header(xlog_op_header_t  *op_head,
                     int                i,
                     char               **ptr)
@@ -98,7 +98,7 @@ xlog_print_op_header(xlog_op_header_t *op_head,
 }      /* xlog_print_op_header */
 
 
-void
+static void
 xlog_print_add_to_trans(xlog_tid_t     tid,
                        int             skip)
 {
@@ -115,7 +115,7 @@ xlog_print_add_to_trans(xlog_tid_t  tid,
 }      /* xlog_print_add_to_trans */
 
 
-int
+static int
 xlog_print_find_tid(xlog_tid_t tid, uint was_cont)
 {
     xlog_split_item_t *listp = split_list;
@@ -149,7 +149,7 @@ xlog_print_find_tid(xlog_tid_t tid, uint was_cont)
     return 1;
 }      /* xlog_print_find_tid */
 
-int
+static int
 xlog_print_trans_header(char **ptr, int len)
 {
     xfs_trans_header_t  *h;
@@ -181,7 +181,7 @@ xlog_print_trans_header(char **ptr, int len)
 }      /* xlog_print_trans_header */
 
 
-int
+static int
 xlog_print_trans_buffer(char **ptr, int len, int *i, int num_ops)
 {
     xfs_buf_log_format_t *f;
@@ -192,7 +192,6 @@ xlog_print_trans_buffer(char **ptr, int len, int *i, int num_ops)
     int64_t                     blkno;
     xfs_buf_log_format_t lbuf;
     int                         size, blen, map_size, struct_size;
-    __be64              x, y;
     unsigned short      flags;
 
     /*
@@ -247,20 +246,22 @@ xlog_print_trans_buffer(char **ptr, int len, int *i, int num_ops)
                if (be32_to_cpu(head->oh_len) < 4*8) {
                        printf(_("Out of space\n"));
                } else {
+                       __be64           a, b;
+
                        printf("\n");
                        /*
                         * memmove because *ptr may not be 8-byte aligned
                         */
-                       memmove(&x, *ptr, sizeof(__be64));
-                       memmove(&y, *ptr+8, sizeof(__be64));
-                      printf(_("icount: %llu  ifree: %llu  "),
-                              (unsigned long long) be64_to_cpu(x),
-                              (unsigned long long) be64_to_cpu(y));
-                       memmove(&x, *ptr+16, sizeof(__be64));
-                       memmove(&y, *ptr+24, sizeof(__be64));
-                      printf(_("fdblks: %llu  frext: %llu\n"),
-                              (unsigned long long) be64_to_cpu(x),
-                              (unsigned long long) be64_to_cpu(y));
+                       memmove(&a, *ptr, sizeof(__be64));
+                       memmove(&b, *ptr+8, sizeof(__be64));
+                       printf(_("icount: %llu  ifree: %llu  "),
+                              (unsigned long long) be64_to_cpu(a),
+                              (unsigned long long) be64_to_cpu(b));
+                       memmove(&a, *ptr+16, sizeof(__be64));
+                       memmove(&b, *ptr+24, sizeof(__be64));
+                       printf(_("fdblks: %llu  frext: %llu\n"),
+                              (unsigned long long) be64_to_cpu(a),
+                              (unsigned long long) be64_to_cpu(b));
                }
                super_block = 0;
        } else if (be32_to_cpu(*(__be32 *)(*ptr)) == XFS_AGI_MAGIC) {
@@ -394,15 +395,15 @@ xlog_print_trans_buffer(char **ptr, int len, int *i, int num_ops)
                if (print_data) {
                        uint *dp  = (uint *)*ptr;
                        int  nums = be32_to_cpu(head->oh_len) >> 2;
-                       int  i = 0;
+                       int  byte = 0;
 
-                       while (i < nums) {
-                               if ((i % 8) == 0)
-                                       printf("%2x ", i);
+                       while (byte < nums) {
+                               if ((byte % 8) == 0)
+                                       printf("%2x ", byte);
                                printf("%8x ", *dp);
                                dp++;
-                               i++;
-                               if ((i % 8) == 0)
+                               byte++;
+                               if ((byte % 8) == 0)
                                        printf("\n");
                        }
                        printf("\n");
@@ -416,7 +417,7 @@ xlog_print_trans_buffer(char **ptr, int len, int *i, int num_ops)
 }      /* xlog_print_trans_buffer */
 
 
-int
+static int
 xlog_print_trans_qoff(char **ptr, uint len)
 {
     xfs_qoff_logformat_t *f;
@@ -435,7 +436,7 @@ xlog_print_trans_qoff(char **ptr, uint len)
 }      /* xlog_print_trans_qoff */
 
 
-void
+static void
 xlog_print_trans_inode_core(
        struct xfs_log_dinode   *ip)
 {
@@ -461,12 +462,13 @@ xlog_print_trans_inode_core(
     }
 }
 
-void
+static void
 xlog_print_dir2_sf(
        struct xlog     *log,
        xfs_dir2_sf_hdr_t *sfp,
        int             size)
 {
+       __be64          pino;   /* parent inode nr */
        xfs_ino_t       ino;
        int             count;
        int             i;
@@ -481,8 +483,8 @@ xlog_print_dir2_sf(
 
        printf(_("SHORTFORM DIRECTORY size %d count %d\n"),
               size, sfp->count);
-       memmove(&ino, &(sfp->parent), sizeof(ino));
-       printf(_(".. ino 0x%llx\n"), (unsigned long long) be64_to_cpu(ino));
+       memmove(&pino, &(sfp->parent), sizeof(pino));
+       printf(_(".. ino 0x%llx\n"), (unsigned long long) be64_to_cpu(pino));
 
        count = sfp->count;
        sfep = xfs_dir2_sf_firstentry(sfp);
@@ -496,7 +498,7 @@ xlog_print_dir2_sf(
        }
 }
 
-int
+static int
 xlog_print_trans_inode(
        struct xlog             *log,
        char                    **ptr,
@@ -647,7 +649,7 @@ xlog_print_trans_inode(
 }      /* xlog_print_trans_inode */
 
 
-int
+static int
 xlog_print_trans_dquot(char **ptr, int len, int *i, int num_ops)
 {
     xfs_dq_logformat_t *f;
@@ -755,7 +757,7 @@ xlog_print_lseek(struct xlog *log, int fd, xfs_daddr_t blkno, int whence)
 }      /* xlog_print_lseek */
 
 
-void
+static void
 print_lsn(char         *string,
          __be64        *lsn)
 {
@@ -764,7 +766,7 @@ print_lsn(char              *string,
 }
 
 
-int
+static int
 xlog_print_record(
        struct xlog             *log,
        int                     fd,
@@ -1019,7 +1021,7 @@ xlog_print_record(
 }      /* xlog_print_record */
 
 
-int
+static int
 xlog_print_rec_head(xlog_rec_header_t *head, int *len, int bad_hdr_warn)
 {
     int i;
@@ -1093,7 +1095,7 @@ xlog_print_rec_head(xlog_rec_header_t *head, int *len, int bad_hdr_warn)
     return(be32_to_cpu(head->h_num_logops));
 }      /* xlog_print_rec_head */
 
-void
+static void
 xlog_print_rec_xhead(xlog_rec_ext_header_t *head, int coverage)
 {
     int i;
@@ -1133,7 +1135,7 @@ print_xlog_bad_header(xfs_daddr_t blkno, char *buf)
            xlog_exit("Bad log record header");
 }      /* print_xlog_bad_header */
 
-void
+static void
 print_xlog_bad_data(xfs_daddr_t blkno)
 {
        print_stars();
@@ -1184,7 +1186,7 @@ xlog_print_extended_headers(
        int                     num_hdrs;
        int                     num_required;
        char                    xhbuf[XLOG_HEADER_SIZE];
-       xlog_rec_ext_header_t   *x;
+       xlog_rec_ext_header_t   *xhdr;
 
        num_required = howmany(len, XLOG_HEADER_CYCLE_SIZE);
        num_hdrs = be32_to_cpu(hdr->h_size) / XLOG_HEADER_CYCLE_SIZE;
@@ -1209,7 +1211,7 @@ xlog_print_extended_headers(
        *ret_num_hdrs = num_hdrs;
 
        /* don't include 1st header */
-       for (i = 1, x = *ret_xhdrs; i < num_hdrs; i++, (*blkno)++, x++) {
+       for (i = 1, xhdr = *ret_xhdrs; i < num_hdrs; i++, (*blkno)++, xhdr++) {
            /* read one extra header blk */
            if (read(fd, xhbuf, 512) == 0) {
                printf(_("%s: physical end of log\n"), progname);
@@ -1239,9 +1241,9 @@ xlog_print_extended_headers(
             * will look asymmetric with the 1 hdr normal case
             * which does endian coversion on access.
             */
-           x->xh_cycle = ((xlog_rec_ext_header_t*)xhbuf)->xh_cycle;
+           xhdr->xh_cycle = ((xlog_rec_ext_header_t*)xhbuf)->xh_cycle;
            for (j = 0; j < XLOG_HEADER_CYCLE_SIZE / BBSIZE; j++) {
-               x->xh_cycle_data[j] =
+               xhdr->xh_cycle_data[j] =
                    ((xlog_rec_ext_header_t*)xhbuf)->xh_cycle_data[j];
            }
        }