Whamcloud - gitweb
b=22729 Remove LPSZ & LPSSZ 55/255/3
authorNiu Yawei <niu@whamcloud.com>
Sat, 19 Feb 2011 07:18:46 +0000 (23:18 -0800)
committerTerry Rutledge <terry.rutledge@oracle.com>
Wed, 30 Mar 2011 15:05:11 +0000 (08:05 -0700)
Code cleanup patch for 1.8 which removes the use of LPSZ/LPSSZ to
improve the build portability.

Issue: LU-54
Change-Id: I04d8446564bf36d0806ff3ee9abf8950a33eb170
Signed-off-by: Niu Yawei <niu@whamcloud.com>
13 files changed:
lnet/autoconf/lustre-lnet.m4
lnet/include/libcfs/darwin/kp30.h
lnet/include/libcfs/linux/kp30.h
lnet/include/libcfs/winnt/kp30.h
lnet/klnds/gmlnd/gmlnd_comm.c
lustre/include/darwin/lustre_user.h
lustre/llite/file.c
lustre/llite/lproc_llite.c
lustre/llite/rw26.c
lustre/lvfs/fsfilt_ext3.c
lustre/mds/mds_join.c
lustre/obdclass/class_obd.c
lustre/obdclass/obd_mount.c

index 805e7bf..ba5af00 100644 (file)
@@ -1128,58 +1128,6 @@ AC_COMPILE_IFELSE([
 CFLAGS="$tmp_flags"
 ])
 
-# check userland size_t type
-AC_DEFUN([LN_SIZE_T_LONG],
-[AC_MSG_CHECKING([size_t is unsigned long type])
-tmp_flags="$CFLAGS"
-CFLAGS="$CFLAGS -Werror"
-AC_COMPILE_IFELSE([
-       #include <stdio.h>
-       #include <linux/types.h>
-       #include <linux/stddef.h>
-       int main(void) {
-               unsigned long *data1;
-               size_t *data2 = NULL;
-               
-               data1 = data2;
-               return 0;
-       }
-],[
-       AC_MSG_RESULT([yes])
-        AC_DEFINE(HAVE_SIZE_T_LONG, 1,
-                  [size_t is long type])
-],[
-       AC_MSG_RESULT([no])
-])
-CFLAGS="$tmp_flags"
-])
-
-AC_DEFUN([LN_SSIZE_T_LONG],
-[AC_MSG_CHECKING([ssize_t is signed long type])
-tmp_flags="$CFLAGS"
-CFLAGS="$CFLAGS -Werror"
-AC_COMPILE_IFELSE([
-       #include <stdio.h>
-       #include <linux/types.h>
-       #include <linux/stddef.h>
-       int main(void) {
-               long *data1;
-               ssize_t *data2 = NULL;
-               
-               data1 = data2;
-               return 0;
-       }
-],[
-       AC_MSG_RESULT([yes])
-        AC_DEFINE(HAVE_SSIZE_T_LONG, 1,
-                  [ssize_t is long type])
-],[
-       AC_MSG_RESULT([no])
-])
-CFLAGS="$tmp_flags"
-])
-
-
 # check kernel __le16, __le32 types
 AC_DEFUN([LN_LE_TYPES],
 [AC_MSG_CHECKING([__le16 and __le32 types are defined])
@@ -1590,8 +1538,6 @@ LN_STRUCT_PAGE_LIST
 LN_STRUCT_SIGHAND
 LN_FUNC_SHOW_TASK
 LN_KERN__U64_LONG_LONG
-LN_SSIZE_T_LONG
-LN_SIZE_T_LONG
 LN_LE_TYPES
 LN_TASK_RCU
 # 2.6.18
index 01a9f60..6bd40b6 100644 (file)
@@ -123,8 +123,6 @@ typedef struct {
 #define LPU64 "%llu"
 #define LPD64 "%lld"
 #define LPX64 "%#llx"
-#define LPSZ  "%lu"
-#define LPSSZ "%ld"
 # define LI_POISON ((int)0x5a5a5a5a)
 # define LL_POISON ((long)0x5a5a5a5a)
 # define LP_POISON ((void *)(long)0x5a5a5a5a)
index ec5713d..8a02f7e 100644 (file)
@@ -386,18 +386,6 @@ extern int  lwt_snapshot (cycles_t *now, int *ncpu, int *total_size,
 # define LPF64 "l"
 #endif
 
-#ifdef HAVE_SIZE_T_LONG
-# define LPSZ  "%lu"
-#else
-# define LPSZ  "%u"
-#endif
-
-#ifdef HAVE_SSIZE_T_LONG
-# define LPSSZ "%ld"
-#else
-# define LPSSZ "%d"
-#endif
-
 #ifndef LPU64
 # error "No word size defined"
 #endif
index fd12f19..83143f6 100644 (file)
@@ -143,20 +143,14 @@ typedef struct {
 # define LPU64 "%I64u"
 # define LPD64 "%I64d"
 # define LPX64 "%I64x"
-# define LPSZ  "%lu"
-# define LPSSZ "%ld"
 #elif (BITS_PER_LONG == 32 || __WORDSIZE == 32)
 # define LPU64 "%I64u"
 # define LPD64 "%I64d"
 # define LPX64 "%I64x"
-# define LPSZ  "%u"
-# define LPSSZ "%d"
 #elif (BITS_PER_LONG == 64 || __WORDSIZE == 64)
 # define LPU64 "%I64u"
 # define LPD64 "%I64d"
 # define LPX64 "%I64x"
-# define LPSZ  "%u"
-# define LPSSZ "%d"
 #endif
 #ifndef LPU64
 # error "No word size defined"
index 6be69a4..b625e48 100644 (file)
@@ -141,7 +141,7 @@ gmnal_unpack_msg(gmnal_ni_t *gmni, gmnal_rx_t *rx)
 
         case GMNAL_MSG_IMMEDIATE:
                 if (rx->rx_recv_nob < offsetof(gmnal_msg_t, gmm_u.immediate.gmim_payload[0])) {
-                        CERROR("Short IMMEDIATE from %u: %d("LPSZ")\n",
+                        CERROR("Short IMMEDIATE from %u: %d(%lu)\n",
                                rx->rx_recv_gmid, rx->rx_recv_nob,
                                offsetof(gmnal_msg_t, gmm_u.immediate.gmim_payload[0]));
                         return -EPROTO;
index 3e5c5e1..a599673 100644 (file)
@@ -65,14 +65,10 @@ typedef struct stat     lstat_t;
 # define LPU64 "%llu"
 # define LPD64 "%lld"
 # define LPX64 "%#llx"
-# define LPSZ  "%u"
-# define LPSSZ "%d"
 #elif (BITS_PER_LONG == 64 || __WORDSIZE == 64)
 # define LPU64 "%lu"
 # define LPD64 "%ld"
 # define LPX64 "%#lx"
-# define LPSZ  "%lu"
-# define LPSSZ "%ld"
 #endif
 #endif /* !LPU64 */
 
index 4b48565..4858a16 100644 (file)
@@ -1429,8 +1429,9 @@ static ssize_t ll_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
         ENTRY;
 
         count = ll_file_get_iov_count(iov, &nr_segs);
-        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),size="LPSZ",offset=%Ld\n",
-               inode->i_ino, inode->i_generation, inode, count, *ppos);
+        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),size=%lu,offset=%lld\n",
+               inode->i_ino, inode->i_generation, inode, (unsigned long)count,
+               *ppos);
         /* "If nbyte is 0, read() will return 0 and have no other results."
          *                      -- Single Unix Spec */
         if (count == 0)
@@ -1599,8 +1600,8 @@ repeat:
         }
 
         chunk = end - *ppos + 1;
-        CDEBUG(D_INODE,"Read ino %lu, "LPSZ" bytes, offset %lld, i_size %llu\n",
-               inode->i_ino, chunk, *ppos, i_size_read(inode));
+        CDEBUG(D_INODE,"Read ino %lu, %ld bytes, offset %lld, i_size %llu\n",
+               inode->i_ino, (long)chunk, *ppos, i_size_read(inode));
 
         /* turn off the kernel's read-ahead */
         if (ltd.lock_style != LL_LOCK_STYLE_NOLOCK) {
@@ -1779,8 +1780,9 @@ static ssize_t ll_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
 
         count = ll_file_get_iov_count(iov, &nr_segs);
 
-        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),size="LPSZ",offset=%Ld\n",
-               inode->i_ino, inode->i_generation, inode, count, *ppos);
+        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),size=%lu,offset=%Ld\n",
+               inode->i_ino, inode->i_generation, inode, (unsigned long)count,
+               *ppos);
 
         SIGNAL_MASK_ASSERT(); /* XXX BUG 1511 */
 
@@ -1882,8 +1884,8 @@ repeat:
 
         /* generic_file_write handles O_APPEND after getting i_mutex */
         chunk = end - *ppos + 1;
-        CDEBUG(D_INFO, "Writing inode %lu, "LPSZ" bytes, offset %Lu\n",
-               inode->i_ino, chunk, *ppos);
+        CDEBUG(D_INFO, "Writing inode %lu, %ld bytes, offset %Lu\n",
+               inode->i_ino, (long)chunk, *ppos);
         if (tree_locked) {
                 struct ost_lvb *xtimes;
                 /* write under locks
@@ -2018,8 +2020,9 @@ static ssize_t ll_file_sendfile(struct file *in_file, loff_t *ppos,
         __u64 kms;
         ENTRY;
 
-        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),size="LPSZ",offset=%Ld\n",
-               inode->i_ino, inode->i_generation, inode, count, *ppos);
+        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),size=%lu,offset=%Ld\n",
+               inode->i_ino, inode->i_generation, inode, (unsigned long)count,
+               *ppos);
 
         /* "If nbyte is 0, read() will return 0 and have no other results."
          *                      -- Single Unix Spec */
@@ -2083,8 +2086,8 @@ static ssize_t ll_file_sendfile(struct file *in_file, loff_t *ppos,
                 ll_inode_size_unlock(inode, 1);
         }
 
-        CDEBUG(D_INFO, "Send ino %lu, "LPSZ" bytes, offset %lld, i_size %llu\n",
-               inode->i_ino, count, *ppos, i_size_read(inode));
+        CDEBUG(D_INFO, "Send ino %lu, %lu bytes, offset %lld, i_size %llu\n",
+               inode->i_ino, (unsigned long)count, *ppos, i_size_read(inode));
 
         ll_ra_read_init(in_file, &bead, *ppos, count);
         /* BUG: 5972 */
@@ -2117,8 +2120,9 @@ static ssize_t ll_file_splice_read(struct file *in_file, loff_t *ppos,
         __u64 kms;
         ENTRY;
 
-        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),size="LPSZ",offset=%Ld\n",
-               inode->i_ino, inode->i_generation, inode, count, *ppos);
+        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),size=%lu,offset=%Ld\n",
+               inode->i_ino, inode->i_generation, inode, (unsigned long)count,
+               *ppos);
 
         /* "If nbyte is 0, read() will return 0 and have no other results."
          *                      -- Single Unix Spec */
@@ -2182,8 +2186,8 @@ static ssize_t ll_file_splice_read(struct file *in_file, loff_t *ppos,
                 ll_inode_size_unlock(inode, 1);
         }
 
-        CDEBUG(D_INFO, "Send ino %lu, "LPSZ" bytes, offset %lld, i_size %llu\n",
-               inode->i_ino, count, *ppos, i_size_read(inode));
+        CDEBUG(D_INFO, "Send ino %lu, %lu bytes, offset %lld, i_size %llu\n",
+               inode->i_ino, (unsigned long)count, *ppos, i_size_read(inode));
 
         ll_ra_read_init(in_file, &bead, *ppos, count);
         /* BUG: 5972 */
index c6f280b..63e0c7a 100644 (file)
@@ -1455,8 +1455,6 @@ void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid, struct file
         spin_unlock(&sbi->ll_process_lock);
 }
 
-char lpszt[] = LPSZ;
-
 static int ll_rw_offset_stats_seq_show(struct seq_file *seq, void *v)
 {
         struct timeval now;
@@ -1481,19 +1479,17 @@ static int ll_rw_offset_stats_seq_show(struct seq_file *seq, void *v)
         seq_printf(seq, "%3s %10s %14s %14s %17s %17s %14s\n",
                    "R/W", "PID", "RANGE START", "RANGE END",
                    "SMALLEST EXTENT", "LARGEST EXTENT", "OFFSET");
-        sprintf(format, "%s%s%s%s%s\n",
-                "%3c %10d %14Lu %14Lu %17", lpszt+1, " %17", lpszt+1, " %14Ld");
+        sprintf(format, "%s\n", "%3c %10d %14Lu %14Lu %17lu %17lu %14Ld");
         /* We stored the discontiguous offsets here; print them first */
         for(i = 0; i < LL_OFFSET_HIST_MAX; i++) {
                 if (offset[i].rw_pid != 0)
-                        /* Is there a way to snip the '%' off of LPSZ? */
                         seq_printf(seq, format,
                                    offset[i].rw_op ? 'W' : 'R',
                                    offset[i].rw_pid,
                                    offset[i].rw_range_start,
                                    offset[i].rw_range_end,
-                                   offset[i].rw_smallest_extent,
-                                   offset[i].rw_largest_extent,
+                                   (unsigned long)offset[i].rw_smallest_extent,
+                                   (unsigned long)offset[i].rw_largest_extent,
                                    offset[i].rw_offset);
         }
         /* Then print the current offsets for each process */
@@ -1504,8 +1500,8 @@ static int ll_rw_offset_stats_seq_show(struct seq_file *seq, void *v)
                                    process[i].rw_pid,
                                    process[i].rw_range_start,
                                    process[i].rw_last_file_pos,
-                                   process[i].rw_smallest_extent,
-                                   process[i].rw_largest_extent,
+                                   (unsigned long)process[i].rw_smallest_extent,
+                                   (unsigned long)process[i].rw_largest_extent,
                                    process[i].rw_offset);
         }
         spin_unlock(&sbi->ll_process_lock);
index 5f7a0c8..baf6ade 100644 (file)
@@ -240,10 +240,11 @@ ssize_t ll_direct_IO(int rw, struct file *file,
         if (!lli->lli_smd || !lli->lli_smd->lsm_object_id)
                 RETURN(-EBADF);
 
-        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), size="LPSZ" (max %lu), "
-               "offset=%lld=%llx, pages "LPSZ" (max %lu)\n",
-               inode->i_ino, inode->i_generation, inode, count, MAX_DIO_SIZE,
-               file_offset, file_offset, count >> CFS_PAGE_SHIFT,
+        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), size=%lu (max %lu), "
+               "offset=%lld=%llx, pages %lu (max %lu)\n",
+               inode->i_ino, inode->i_generation, inode, (unsigned long)count,
+               MAX_DIO_SIZE, file_offset, file_offset,
+               (unsigned long)count >> CFS_PAGE_SHIFT,
                MAX_DIO_SIZE >> CFS_PAGE_SHIFT);
 
         if (rw == WRITE)
index c963882..ce8af52 100644 (file)
@@ -744,8 +744,8 @@ static ssize_t fsfilt_ext3_readpage(struct file *file, char *buf, size_t count,
                 const int blkbits = inode->i_sb->s_blocksize_bits;
                 const int blksize = inode->i_sb->s_blocksize;
 
-                CDEBUG(D_EXT2, "reading "LPSZ" at dir %lu+%llu\n",
-                       count, inode->i_ino, *off);
+                CDEBUG(D_EXT2, "reading %lu at dir %lu+%llu\n",
+                       (unsigned long)count, inode->i_ino, *off);
                 while (count > 0) {
                         struct buffer_head *bh;
 
index d5578f6..792031a 100644 (file)
@@ -240,8 +240,8 @@ static void mds_finish_join(struct mds_obd *mds, struct ptlrpc_request *req,
                                 sizeof(struct llog_cookie);
         int max_easize = sizeof(*lmmj);
 
-        CDEBUG(D_INFO, "change the max md size from %d to "LPSZ"\n",
-               mds->mds_max_mdsize, sizeof(*lmmj));
+        CDEBUG(D_INFO, "change the max md size from %d to %lu\n",
+               mds->mds_max_mdsize, (unsigned long)sizeof(*lmmj));
 
         if (mds->mds_max_mdsize < max_easize ||
             mds->mds_max_cookiesize < max_cookiesize) {
index 9601d2c..0d07d79 100644 (file)
@@ -436,8 +436,7 @@ int obd_init_checks(void)
         char buf[64];
         int len, ret = 0;
 
-        CDEBUG(D_INFO, "LPU64=%s, LPD64=%s, LPX64=%s, LPSZ=%s, LPSSZ=%s\n",
-               LPU64, LPD64, LPX64, LPSZ, LPSSZ);
+        CDEBUG(D_INFO, "LPU64=%s, LPD64=%s, LPX64=%s\n", LPU64, LPD64, LPX64);
 
         CDEBUG(D_INFO, "OBD_OBJECT_EOF = "LPX64"\n", (__u64)OBD_OBJECT_EOF);
 
index f34dcdd..3654456 100644 (file)
@@ -278,8 +278,8 @@ static int ldd_parse(struct lvfs_run_ctxt *mount_ctxt,
         len = i_size_read(file->f_dentry->d_inode);
         CDEBUG(D_MOUNT, "Have %s, size %lu\n", MOUNT_DATA_FILE, len);
         if (len != sizeof(*ldd)) {
-                CERROR("disk data size does not match: see %lu expect "LPSZ"\n",
-                       len, sizeof(*ldd));
+                CERROR("disk data size does not match: see %lu expect %lu\n",
+                       len, (unsigned long)sizeof(*ldd));
                 GOTO(out_close, rc = -EINVAL);
         }