bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Adopt the new gnulib module stat-size. * lib/listfile.c: Include


From: James Youngman
Subject: [PATCH] Adopt the new gnulib module stat-size. * lib/listfile.c: Include "stat-size.h". Delete the DEV_BSIZE, ST_BLKSIZE, ST_NBLOCKS, ST_NBLOCKSIZE macros which are now in stat-size.h. * gnulib: Update to latest. * import-gnulib.config (modules): Add stat-size.
Date: Sat, 11 Jun 2011 17:00:43 +0100

---
 ChangeLog            |    9 +++++++
 gnulib               |    2 +-
 import-gnulib.config |    1 +
 lib/listfile.c       |   65 +-------------------------------------------------
 4 files changed, 12 insertions(+), 65 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 70d8cd4..3b23122 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-06-11  James Youngman  <address@hidden>
+
+       Adopt the new gnulib module stat-size.
+       * lib/listfile.c: Include "stat-size.h".  Delete the DEV_BSIZE,
+       ST_BLKSIZE, ST_NBLOCKS, ST_NBLOCKSIZE macros which are now in
+       stat-size.h.
+       * gnulib: Update to latest.
+       * import-gnulib.config (modules): Add stat-size.
+
 2011-06-05  James Youngman  <address@hidden>
 
        Don't include sys/param.h where we don't need it.
diff --git a/gnulib b/gnulib
index 23b1824..9fc77bc 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 23b18247253c80345d5fcf7173c5b734b0b8f434
+Subproject commit 9fc77bc59374e21e1174742df416af186a368e14
diff --git a/import-gnulib.config b/import-gnulib.config
index 3c37ed4..5fb46c2 100644
--- a/import-gnulib.config
+++ b/import-gnulib.config
@@ -119,6 +119,7 @@ selinux-at
 snprintf
 stat
 stat-macros
+stat-size
 stat-time
 stdarg
 stdbool
diff --git a/lib/listfile.c b/lib/listfile.c
index e7780c9..2e94bf6 100644
--- a/lib/listfile.c
+++ b/lib/listfile.c
@@ -40,6 +40,7 @@
 #include "filemode.h"
 #include "idcache.h"
 #include "areadlink.h"
+#include "stat-size.h"
 
 #include "listfile.h"
 
@@ -53,70 +54,6 @@
 #define HAVE_MAJOR
 #endif
 
-
-
-/* Get or fake the disk device blocksize.
-   Usually defined by sys/param.h (if at all).  */
-#include <sys/param.h>
-#ifndef DEV_BSIZE
-# ifdef BSIZE
-#  define DEV_BSIZE BSIZE
-# else /* !BSIZE */
-#  define DEV_BSIZE 4096
-# endif /* !BSIZE */
-#endif /* !DEV_BSIZE */
-
-/* Extract or fake data from a `struct stat'.
-   ST_BLKSIZE: Preferred I/O blocksize for the file, in bytes.
-   ST_NBLOCKS: Number of blocks in the file, including indirect blocks.
-   ST_NBLOCKSIZE: Size of blocks used when calculating ST_NBLOCKS.  */
-#ifndef HAVE_STRUCT_STAT_ST_BLOCKS
-# define ST_BLKSIZE(statbuf) DEV_BSIZE
-# if defined _POSIX_SOURCE || !defined BSIZE /* fileblocks.c uses BSIZE.  */
-#  define ST_NBLOCKS(statbuf) \
-  (S_ISREG ((statbuf).st_mode) \
-   || S_ISDIR ((statbuf).st_mode) \
-   ? (statbuf).st_size / ST_NBLOCKSIZE + ((statbuf).st_size % ST_NBLOCKSIZE != 
0) : 0)
-# else /* !_POSIX_SOURCE && BSIZE */
-#  define ST_NBLOCKS(statbuf) \
-  (S_ISREG ((statbuf).st_mode) \
-   || S_ISDIR ((statbuf).st_mode) \
-   ? st_blocks ((statbuf).st_size) : 0)
-# endif /* !_POSIX_SOURCE && BSIZE */
-#else /* HAVE_STRUCT_STAT_ST_BLOCKS */
-/* Some systems, like Sequents, return st_blksize of 0 on pipes. */
-# define ST_BLKSIZE(statbuf) ((statbuf).st_blksize > 0 \
-                              ? (statbuf).st_blksize : DEV_BSIZE)
-# if defined hpux || defined __hpux__ || defined __hpux
-/* HP-UX counts st_blocks in 1024-byte units.
-   This loses when mixing HP-UX and BSD filesystems with NFS.  */
-#  define ST_NBLOCKSIZE 1024
-# else /* !hpux */
-#  if defined _AIX && defined _I386
-/* AIX PS/2 counts st_blocks in 4K units.  */
-#   define ST_NBLOCKSIZE (4 * 1024)
-#  else /* not AIX PS/2 */
-#   if defined _CRAY
-#    define ST_NBLOCKS(statbuf) \
-  (S_ISREG ((statbuf).st_mode) \
-   || S_ISDIR ((statbuf).st_mode) \
-   ? (statbuf).st_blocks * ST_BLKSIZE(statbuf)/ST_NBLOCKSIZE : 0)
-#   endif /* _CRAY */
-#  endif /* not AIX PS/2 */
-# endif /* !hpux */
-#endif /* HAVE_STRUCT_STAT_ST_BLOCKS */
-
-#ifndef ST_NBLOCKS
-# define ST_NBLOCKS(statbuf) \
-  (S_ISREG ((statbuf).st_mode) \
-   || S_ISDIR ((statbuf).st_mode) \
-   ? (statbuf).st_blocks : 0)
-#endif
-
-#ifndef ST_NBLOCKSIZE
-# define ST_NBLOCKSIZE 512
-#endif
-
 #ifdef major                   /* Might be defined in sys/types.h.  */
 #define HAVE_MAJOR
 #endif
-- 
1.7.2.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]