Whamcloud - gitweb
LU-871 build: change %L printk format to %ll
authorAndreas Dilger <adilger@whamcloud.com>
Wed, 23 Nov 2011 19:16:25 +0000 (12:16 -0700)
committerOleg Drokin <green@whamcloud.com>
Mon, 12 Dec 2011 21:34:42 +0000 (16:34 -0500)
The clang-analyzer static code analysis flagged %L format specifiers
for printf/printk as deprecated, so change all of their uses to %ll.

In a couple of files (checkstat.c and truncate.c) there are existing
code style issues that need to be fixed before landing, in order to
get a clean bill of health from checkpatch.pl.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I1bc75a0f43b25de112f5ae8f2273b3dc46081d09
Reviewed-on: http://review.whamcloud.com/1734
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Niu Yawei <niu@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
12 files changed:
libcfs/include/libcfs/linux/kp30.h
libcfs/include/libcfs/posix/posix-wordsize.h
lnet/utils/routerstat.c
lustre/fid/lproc_fid.c
lustre/include/lustre_debug.h
lustre/liblustre/super.c
lustre/llite/file.c
lustre/llite/rw.c
lustre/tests/checkstat.c
lustre/tests/truncate.c
lustre/utils/gss/lgss_keyring.c
lustre/utils/gss/lgss_utils.c

index ff19b55..52acaa4 100644 (file)
@@ -301,11 +301,11 @@ extern int  lwt_snapshot (cfs_cycles_t *now, int *ncpu, int *total_size,
 
 #if (defined(__KERNEL__) && defined(HAVE_KERN__U64_LONG_LONG)) || \
     (!defined(__KERNEL__) && defined(HAVE_USER__U64_LONG_LONG))
 
 #if (defined(__KERNEL__) && defined(HAVE_KERN__U64_LONG_LONG)) || \
     (!defined(__KERNEL__) && defined(HAVE_USER__U64_LONG_LONG))
-# define LPU64 "%Lu"
-# define LPD64 "%Ld"
-# define LPX64 "%#Lx"
-# define LPX64i "%Lx"
-# define LPO64 "%#Lo"
+# define LPU64 "%llu"
+# define LPD64 "%lld"
+# define LPX64 "%#llx"
+# define LPX64i "%llx"
+# define LPO64 "%#llo"
 # define LPF64 "L"
 #else
 # define LPU64 "%lu"
 # define LPF64 "L"
 #else
 # define LPU64 "%lu"
index e6730cd..4c80923 100644 (file)
@@ -115,18 +115,18 @@ typedef struct {
 #if (defined(__KERNEL__) && defined(HAVE_KERN__U64_LONG_LONG)) || \
     (!defined(__KERNEL__) && defined(HAVE_USER__U64_LONG_LONG))
 /* x86_64 defines __u64 as "long" in userspace, but "long long" in the kernel */
 #if (defined(__KERNEL__) && defined(HAVE_KERN__U64_LONG_LONG)) || \
     (!defined(__KERNEL__) && defined(HAVE_USER__U64_LONG_LONG))
 /* x86_64 defines __u64 as "long" in userspace, but "long long" in the kernel */
-# define LPU64 "%Lu"
-# define LPD64 "%Ld"
-# define LPX64 "%#Lx"
-# define LPX64i "%Lx"
-# define LPO64 "%#Lo"
-# define LPF64 "L"
+# define LPU64 "%llu"
+# define LPD64 "%lld"
+# define LPX64 "%#llx"
+# define LPX64i "%llx"
+# define LPO64 "%#llo"
+# define LPF64 "ll"
 #elif (BITS_PER_LONG == 32)
 #elif (BITS_PER_LONG == 32)
-# define LPU64 "%Lu"
-# define LPD64 "%Ld"
-# define LPX64 "%#Lx"
-# define LPX64i "%Lx"
-# define LPO64 "%#Lo"
+# define LPU64 "%llu"
+# define LPD64 "%lld"
+# define LPX64 "%#llx"
+# define LPX64i "%llx"
+# define LPO64 "%#llo"
 # define LPF64 "L"
 #elif (BITS_PER_LONG == 64)
 # define LPU64 "%lu"
 # define LPF64 "L"
 #elif (BITS_PER_LONG == 64)
 # define LPU64 "%lu"
index 2f3474b..61d152c 100644 (file)
@@ -47,7 +47,7 @@ double
 timenow ()
 {
    struct timeval tv;
 timenow ()
 {
    struct timeval tv;
-   
+
    gettimeofday (&tv, NULL);
    return (tv.tv_sec + tv.tv_usec / 1000000.0);
 }
    gettimeofday (&tv, NULL);
    return (tv.tv_sec + tv.tv_usec / 1000000.0);
 }
@@ -70,7 +70,7 @@ unsigned long long subull(unsigned long long a, unsigned long long b)
 {
        if (a < b)
                return -1ULL - b + a + 1;
 {
        if (a < b)
                return -1ULL - b + a + 1;
-       
+
        return a - b;
 }
 
        return a - b;
 }
 
@@ -78,7 +78,7 @@ unsigned long long subul(unsigned long a, unsigned long b)
 {
        if (a < b)
                return -1UL - b + a + 1;
 {
        if (a < b)
                return -1UL - b + a + 1;
-       
+
        return a - b;
 }
 
        return a - b;
 }
 
@@ -103,7 +103,7 @@ do_stat (int fd)
    counters_t new_counter;
    counters_t counter;
    int    n;
    counters_t new_counter;
    counters_t counter;
    int    n;
-   
+
    lseek (fd, 0, SEEK_SET);
    now = timenow();
    n = read (fd, buffer, sizeof (buffer));
    lseek (fd, 0, SEEK_SET);
    now = timenow();
    n = read (fd, buffer, sizeof (buffer));
@@ -111,10 +111,10 @@ do_stat (int fd)
    {
       fprintf (stderr, "Can't read statfile\n");
       exit (1);
    {
       fprintf (stderr, "Can't read statfile\n");
       exit (1);
-   }    
+   }
    buffer[n] = 0;
    buffer[n] = 0;
-   
-   n = sscanf (buffer, "%lu %lu %lu %lu %lu %lu %lu %Lu %Lu %Lu %Lu",
+
+   n = sscanf(buffer, "%lu %lu %lu %lu %lu %lu %lu %llu %llu %llu %llu",
               &new_counter.msgs_alloc, &new_counter.msgs_max,
               &new_counter.errors, 
               &new_counter.send_count, &new_counter.recv_count,
               &new_counter.msgs_alloc, &new_counter.msgs_max,
               &new_counter.errors, 
               &new_counter.send_count, &new_counter.recv_count,
@@ -126,9 +126,10 @@ do_stat (int fd)
       fprintf (stderr, "Can't parse statfile\n");
       exit (1);
    }
       fprintf (stderr, "Can't parse statfile\n");
       exit (1);
    }
-   
+
    if (last == 0.0) {
    if (last == 0.0) {
-          printf ("M %lu(%lu) E %lu S %llu/%lu R %llu/%lu F %llu/%lu D %llu/%lu\n",
+                printf("M %lu(%lu) E %lu S %llu/%lu R %llu/%lu F %llu/%lu "
+                       "D %llu/%lu\n",
                   new_counter.msgs_alloc, new_counter.msgs_max,
                   new_counter.errors,
                   new_counter.send_length, new_counter.send_count,
                   new_counter.msgs_alloc, new_counter.msgs_max,
                   new_counter.errors,
                   new_counter.send_length, new_counter.send_count,
@@ -140,7 +141,7 @@ do_stat (int fd)
 
           counter.msgs_alloc = new_counter.msgs_alloc;
           counter.msgs_max = new_counter.msgs_max;
 
           counter.msgs_alloc = new_counter.msgs_alloc;
           counter.msgs_max = new_counter.msgs_max;
-          
+
           counter.errors = subul(new_counter.errors, old_counter.errors);
           counter.send_count = subul(new_counter.send_count, old_counter.send_count);
           counter.recv_count = subul(new_counter.recv_count, old_counter.recv_count);
           counter.errors = subul(new_counter.errors, old_counter.errors);
           counter.send_count = subul(new_counter.send_count, old_counter.send_count);
           counter.recv_count = subul(new_counter.recv_count, old_counter.recv_count);
@@ -162,7 +163,7 @@ do_stat (int fd)
 
    old_counter = new_counter;
    fflush (stdout);
 
    old_counter = new_counter;
    fflush (stdout);
-   
+
    lseek (fd, 0, SEEK_SET);
    last = timenow();
 }
    lseek (fd, 0, SEEK_SET);
    last = timenow();
 }
@@ -171,7 +172,7 @@ int main (int argc, char **argv)
 {
    int  interval = 0;
    int  fd;
 {
    int  interval = 0;
    int  fd;
-   
+
    if (argc > 1)
       interval = atoi (argv[1]);
 
    if (argc > 1)
       interval = atoi (argv[1]);
 
@@ -181,11 +182,11 @@ int main (int argc, char **argv)
       fprintf (stderr, "Can't open stat: %s\n", strerror (errno));
       return (1);
    }
       fprintf (stderr, "Can't open stat: %s\n", strerror (errno));
       return (1);
    }
-   
+
    do_stat (fd);
    if (interval == 0)
       return (0);
    do_stat (fd);
    if (interval == 0)
       return (0);
-   
+
    for (;;)
    {
       sleep (interval);
    for (;;)
    {
       sleep (interval);
index 633607d..cf70a68 100644 (file)
@@ -77,7 +77,8 @@ seq_proc_write_common(struct file *file, const char *buffer,
 
        LASSERT(range != NULL);
 
 
        LASSERT(range != NULL);
 
-        rc = sscanf(buffer, "[%Lx - %Lx]\n",(long long unsigned *)&tmp.lsr_start,
+        rc = sscanf(buffer, "[%llx - %llx]\n",
+                    (long long unsigned *)&tmp.lsr_start,
                     (long long unsigned *)&tmp.lsr_end);
        if (rc != 2 || !range_is_sane(&tmp) || range_is_zero(&tmp))
                RETURN(-EINVAL);
                     (long long unsigned *)&tmp.lsr_end);
        if (rc != 2 || !range_is_sane(&tmp) || range_is_zero(&tmp))
                RETURN(-EINVAL);
index 6662f48..ea988c0 100644 (file)
@@ -58,7 +58,7 @@
 #define ASSERT_MAX_SIZE_MB 60000ULL
 #define ASSERT_PAGE_INDEX(index, OP)                                    \
 do { if (index > ASSERT_MAX_SIZE_MB << (20 - CFS_PAGE_SHIFT)) {         \
 #define ASSERT_MAX_SIZE_MB 60000ULL
 #define ASSERT_PAGE_INDEX(index, OP)                                    \
 do { if (index > ASSERT_MAX_SIZE_MB << (20 - CFS_PAGE_SHIFT)) {         \
-        CERROR("bad page index %lu > %Lu\n", index,                     \
+        CERROR("bad page index %lu > %llu\n", index,                    \
                ASSERT_MAX_SIZE_MB << (20 - CFS_PAGE_SHIFT));            \
         libcfs_debug = ~0UL;                                            \
         OP;                                                             \
                ASSERT_MAX_SIZE_MB << (20 - CFS_PAGE_SHIFT));            \
         libcfs_debug = ~0UL;                                            \
         OP;                                                             \
@@ -66,7 +66,7 @@ do { if (index > ASSERT_MAX_SIZE_MB << (20 - CFS_PAGE_SHIFT)) {         \
 
 #define ASSERT_FILE_OFFSET(offset, OP)                                  \
 do { if (offset > ASSERT_MAX_SIZE_MB << 20) {                           \
 
 #define ASSERT_FILE_OFFSET(offset, OP)                                  \
 do { if (offset > ASSERT_MAX_SIZE_MB << 20) {                           \
-        CERROR("bad file offset %Lu > %Lu\n", offset,                   \
+        CERROR("bad file offset %llu > %llu\n", offset,                 \
                ASSERT_MAX_SIZE_MB << 20);                               \
         libcfs_debug = ~0UL;                                            \
         OP;                                                             \
                ASSERT_MAX_SIZE_MB << 20);                               \
         libcfs_debug = ~0UL;                                            \
         OP;                                                             \
index 447481e..5bf3558 100644 (file)
@@ -314,8 +314,8 @@ int llu_inode_getattr(struct inode *inode, struct obdo *obdo,
                                OBD_MD_FLSIZE;
 
         obdo_refresh_inode(inode, oinfo.oi_oa, oinfo.oi_oa->o_valid);
                                OBD_MD_FLSIZE;
 
         obdo_refresh_inode(inode, oinfo.oi_oa, oinfo.oi_oa->o_valid);
-        CDEBUG(D_INODE, "objid "LPX64" size %Lu, blocks %Lu, "
-               "blksize %Lu\n", lli->lli_smd->lsm_object_id,
+        CDEBUG(D_INODE, "objid "LPX64" size %llu, blocks %llu, "
+               "blksize %llu\n", lli->lli_smd->lsm_object_id,
                (long long unsigned)llu_i2stat(inode)->st_size,
                (long long unsigned)llu_i2stat(inode)->st_blocks,
                (long long unsigned)llu_i2stat(inode)->st_blksize);
                (long long unsigned)llu_i2stat(inode)->st_size,
                (long long unsigned)llu_i2stat(inode)->st_blocks,
                (long long unsigned)llu_i2stat(inode)->st_blksize);
index eefa640..bcff3e6 100644 (file)
@@ -748,7 +748,7 @@ int ll_inode_getattr(struct inode *inode, struct obdo *obdo,
         if (rc == 0) {
                 obdo_refresh_inode(inode, obdo, obdo->o_valid);
                 CDEBUG(D_INODE,
         if (rc == 0) {
                 obdo_refresh_inode(inode, obdo, obdo->o_valid);
                 CDEBUG(D_INODE,
-                       "objid "LPX64" size %Lu, blocks %llu, blksize %lu\n",
+                       "objid "LPX64" size %llu, blocks %llu, blksize %lu\n",
                        lli->lli_smd->lsm_object_id, i_size_read(inode),
                        (unsigned long long)inode->i_blocks,
                        (unsigned long)ll_inode_blksize(inode));
                        lli->lli_smd->lsm_object_id, i_size_read(inode),
                        (unsigned long long)inode->i_blocks,
                        (unsigned long)ll_inode_blksize(inode));
@@ -1867,7 +1867,7 @@ loff_t ll_file_seek(struct file *file, loff_t offset, int origin)
         ENTRY;
         retval = offset + ((origin == 2) ? i_size_read(inode) :
                            (origin == 1) ? file->f_pos : 0);
         ENTRY;
         retval = offset + ((origin == 2) ? i_size_read(inode) :
                            (origin == 1) ? file->f_pos : 0);
-        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), to=%Lu=%#Lx(%s)\n",
+        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), to=%llu=%#llx(%s)\n",
                inode->i_ino, inode->i_generation, inode, retval, retval,
                origin == 2 ? "SEEK_END": origin == 1 ? "SEEK_CUR" : "SEEK_SET");
         ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_LLSEEK, 1);
                inode->i_ino, inode->i_generation, inode, retval, retval,
                origin == 2 ? "SEEK_END": origin == 1 ? "SEEK_CUR" : "SEEK_SET");
         ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_LLSEEK, 1);
index 93fb344..065fbc7 100644 (file)
@@ -76,7 +76,7 @@ void ll_truncate(struct inode *inode)
         struct ll_inode_info *lli = ll_i2info(inode);
         ENTRY;
 
         struct ll_inode_info *lli = ll_i2info(inode);
         ENTRY;
 
-        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p) to %Lu\n",inode->i_ino,
+        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p) to %llu\n", inode->i_ino,
                inode->i_generation, inode, i_size_read(inode));
 
         ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_TRUNC, 1);
                inode->i_generation, inode, i_size_read(inode));
 
         ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_TRUNC, 1);
index 4980b05..5975efa 100644 (file)
  * Use is subject to license terms.
  */
 /*
  * Use is subject to license terms.
  */
 /*
+ * Test program to compare the attributes of a files to verify that it
+ * desired file attributes are present.  This file predates availability
+ * of the stat(3) utility and is deprecated.  Either test(3) ([ ]) or
+ * stat(3) should be used in all new tests.
+ *
  * This file is part of Lustre, http://www.lustre.org/
  * Lustre is a trademark of Sun Microsystems, Inc.
  */
  * This file is part of Lustre, http://www.lustre.org/
  * Lustre is a trademark of Sun Microsystems, Inc.
  */
@@ -276,20 +281,18 @@ main (int argc, char **argv)
                                        fname, perms);
                }
 
                                        fname, perms);
                }
 
-               if (size != -1)
-               {
-                       if (buf.st_size != size)
-                       {
-                               if (verbose)
-                                       printf ("%s has size %Ld, not %Ld\n",
-                                               fname, (long long)buf.st_size,
-                                               size);
-                               return (1);
-                       }
-
-                       if (verbose)
-                               printf ("%s has size %Ld OK\n", fname, size);
-               }
+                if (size != -1) {
+                        if (buf.st_size != size) {
+                                if (verbose)
+                                        printf("%s has size %lld, not %lld\n",
+                                               fname, (long long)buf.st_size,
+                                               size);
+                                return 1;
+                        }
+
+                        if (verbose)
+                                printf("%s has size %lld OK\n", fname, size);
+                }
 
                if (checklink != NULL)
                {
 
                if (checklink != NULL)
                {
index 910f870..1339686 100644 (file)
 
 int main(int argc, char **argv)
 {
 
 int main(int argc, char **argv)
 {
-       unsigned long long off;
-       int err;
+        unsigned long long off;
+        int err;
 
 
-       if (argc != 3) {
-               printf("usage %s file bytes\n", argv[0]);
-               return 1;
-       }
+        if (argc != 3) {
+                printf("usage %s file bytes\n", argv[0]);
+                return 1;
+        }
 
 
-       off = strtoull(argv[2], NULL, 0);
-       err = truncate64(argv[1], off);
-       if ( err )
-               printf("Error truncating %s to %Ld: %s\n", argv[1], off,
-                      strerror(errno));
+        off = strtoull(argv[2], NULL, 0);
+        err = truncate64(argv[1], off);
+        if (err)
+                printf("Error truncating %s to %lld: %s\n", argv[1], off,
+                       strerror(errno));
 
 
-       return err;
+        return err;
 }
 }
index 2677776..5414694 100644 (file)
@@ -474,7 +474,7 @@ static int lgssc_kr_negotiate(key_serial_t keyid, struct lgss_cred *cred,
         int                     rc = -1;
 
         logmsg(LL_TRACE, "child start on behalf of key %08x: "
         int                     rc = -1;
 
         logmsg(LL_TRACE, "child start on behalf of key %08x: "
-               "cred %p, uid %u, svc %u, nid %Lx, uids: %u:%u/%u:%u\n",
+               "cred %p, uid %u, svc %u, nid %llx, uids: %u:%u/%u:%u\n",
                keyid, cred, cred->lc_uid, cred->lc_tgt_svc, cred->lc_tgt_nid,
                kup->kup_uid, kup->kup_gid, kup->kup_fsuid, kup->kup_fsgid);
 
                keyid, cred, cred->lc_uid, cred->lc_tgt_svc, cred->lc_tgt_nid,
                kup->kup_uid, kup->kup_gid, kup->kup_fsuid, kup->kup_fsgid);
 
@@ -590,7 +590,7 @@ static int parse_callout_info(const char *coinfo,
         strncpy(uparam->kup_tgt, data[7], sizeof(uparam->kup_tgt));
 
         logmsg(LL_DEBUG, "parse call out info: secid %d, mech %s, ugid %u:%u "
         strncpy(uparam->kup_tgt, data[7], sizeof(uparam->kup_tgt));
 
         logmsg(LL_DEBUG, "parse call out info: secid %d, mech %s, ugid %u:%u "
-               "is_root %d, is_mdt %d, is_ost %d, svc %d, nid 0x%Lx, tgt %s\n",
+               "is_root %d, is_mdt %d, is_ost %d, svc %d, nid 0x%llx, tgt %s\n",
                uparam->kup_secid, uparam->kup_mech,
                uparam->kup_uid, uparam->kup_gid,
                uparam->kup_is_root, uparam->kup_is_mdt, uparam->kup_is_ost,
                uparam->kup_secid, uparam->kup_mech,
                uparam->kup_uid, uparam->kup_gid,
                uparam->kup_is_root, uparam->kup_is_mdt, uparam->kup_is_ost,
index c611218..ef9839d 100644 (file)
@@ -430,7 +430,7 @@ int lgss_get_service_str(char **string, uint32_t lsvc, uint64_t tgt_nid)
         }
 
         if (lnet_nid2hostname(tgt_nid, namebuf, max_namelen)) {
         }
 
         if (lnet_nid2hostname(tgt_nid, namebuf, max_namelen)) {
-                logmsg(LL_ERR, "can't resolve hostname from nid %Lx\n",tgt_nid);
+                logmsg(LL_ERR,"can't resolve hostname from nid %llx\n",tgt_nid);
                 return -1;
         }
 
                 return -1;
         }