bug#9140: fsusage: add large volume support on AIX

2011-07-24 Thread Bruno Haible
Paul Eggert wrote:
 Your patches look good to me too.

Thanks for the review. I've pushed the 3 patches now.

You can add a coreutils/NEWS entry that says:

'df' now supports volumes larger than 4 TiB on MacOS X 10.5 or newer
and on AIX 5.2 or newer.

Bruno
-- 
In memoriam Ezechiele Ramin http://en.wikipedia.org/wiki/Ezechiele_Ramin





bug#9140: fsusage: add large volume support on AIX

2011-07-24 Thread Jim Meyering
Bruno Haible wrote:
 Paul Eggert wrote:
 Your patches look good to me too.

 Thanks for the review. I've pushed the 3 patches now.

 You can add a coreutils/NEWS entry that says:

 'df' now supports volumes larger than 4 TiB on MacOS X 10.5 or newer
 and on AIX 5.2 or newer.

Thanks.  I've done this:

From c29cb31b7ff536d2367dad1dcb19c554a8752233 Mon Sep 17 00:00:00 2001
From: Jim Meyering meyer...@redhat.com
Date: Sun, 24 Jul 2011 22:52:34 +0200
Subject: [PATCH] df: support partitions larger than 4 TiB on MacOS = 10.5 
 AIX =5.2

This change derives from improvements to gnulib's fsusage module.
* NEWS (Improvements): df now supports disk partitions larger than
4 TiB on MacOS X 10.5 or newer and on AIX 5.2 or newer.
Alphabetize entries.
* gnulib: Update to latest.
---
 NEWS   |   17 ++---
 gnulib |2 +-
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/NEWS b/NEWS
index 2952dc9..0720719 100644
--- a/NEWS
+++ b/NEWS
@@ -30,6 +30,10 @@ GNU coreutils NEWS-*- 
outline -*-

 ** New features

+  md5sum accepts the new --strict option.  With --check, it makes the
+  tool exit non-zero for any invalid input line, rather than just warning.
+  This also affects sha1sum, sha224sum, sha384sum and sha512sum.
+
   split accepts a new --filter=CMD option.  With it, split filters output
   through CMD.  CMD may use the $FILE environment variable, which is set to
   the nominal output file name for each invocation of CMD.  For example, to
@@ -38,22 +42,21 @@ GNU coreutils NEWS-*- 
outline -*-
   Note the use of single quotes, not double quotes.
   That creates files named xaa.xz, xab.xz and xac.xz.

-  md5sum accepts the new --strict option.  With --check, it makes the
-  tool exit non-zero for any invalid input line, rather than just warning.
-  This also affects sha1sum, sha224sum, sha384sum and sha512sum.
-
   timeout accepts a new --foreground option, to support commands not started
   directly from a shell prompt, where the command is interactive or needs to
   receive signals initiated from the terminal.

 ** Improvements

-  shuf outputs small subsets of large permutations much more efficiently.
-  For example `shuf -i1-$((2**32-1)) -n2` no longer exhausts memory.
-
   cp and ls now support HP-UX 11.11's ACLs, thanks to improved support
   in gnulib.

+  df now supports disk partitions larger than 4 TiB on MacOS X 10.5
+  or newer and on AIX 5.2 or newer.
+
+  shuf outputs small subsets of large permutations much more efficiently.
+  For example `shuf -i1-$((2**32-1)) -n2` no longer exhausts memory.
+
   stat -f now recognizes the GPFS, MQUEUE and PSTOREFS file system types.

 ** Build-related
diff --git a/gnulib b/gnulib
index bd399f0..bac9647 16
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit bd399f07ee4f383fad038efad25a659fcdc0bbb0
+Subproject commit bac964725a412c590498aba68f6b9a8e723ae474
--
1.7.6.609.gbf6a9





bug#9140: fsusage: add large volume support on AIX

2011-07-23 Thread Bruno Haible
 3) To make use of statvfs64 on AIX.

Here's the proposed patch for it. As expected we get:
  - On AIX 5.2, 6.1, 7.1:
checking whether to use statvfs64... yes
  - On AIX 5.1, HP-UX, IRIX, Solaris:
checking whether to use statvfs64... no


2011-07-23  Bruno Haible  br...@clisp.org

fsusage: Enable large volume support on AIX = 5.2.
* m4/fsusage.m4 (gl_FILE_SYSTEM_USAGE): If 'struct statvfs64' has a 
larger
f_blocks field than 'struct statvfs', define STAT_STATVFS64 instead of
STAT_STATVFS.
* lib/fsusage.c (get_fs_usage) [STAT_STATVFS64]: Use statvfs64.

--- lib/fsusage.c.orig  Sat Jul 23 17:15:05 2011
+++ lib/fsusage.c   Sat Jul 23 17:13:38 2011
@@ -23,7 +23,7 @@
 #include limits.h
 #include sys/types.h
 
-#if STAT_STATVFS/* POSIX 1003.1-2001 (and later) with XSI */
+#if STAT_STATVFS || STAT_STATVFS64 /* POSIX 1003.1-2001 (and later) with XSI */
 # include sys/statvfs.h
 #else
 /* Don't include backward-compatibility files unless they're needed.
@@ -106,6 +106,18 @@
 ? PROPAGATE_ALL_ONES (fsd.f_frsize)
 : PROPAGATE_ALL_ONES (fsd.f_bsize));
 
+#elif defined STAT_STATVFS64/* AIX */
+
+  struct statvfs64 fsd;
+
+  if (statvfs64 (file, fsd)  0)
+return -1;
+
+  /* f_frsize isn't guaranteed to be supported.  */
+  fsp-fsu_blocksize = (fsd.f_frsize
+? PROPAGATE_ALL_ONES (fsd.f_frsize)
+: PROPAGATE_ALL_ONES (fsd.f_bsize));
+
 #elif defined STAT_STATFS2_FS_DATA  /* Ultrix */
 
   struct fs_data fsd;
@@ -223,7 +235,7 @@
 
 #endif
 
-#if (defined STAT_STATVFS \
+#if (defined STAT_STATVFS || defined STAT_STATVFS64 \
  || (!defined STAT_STATFS2_FS_DATA  !defined STAT_READ_FILSYS))
 
   fsp-fsu_blocks = PROPAGATE_ALL_ONES (fsd.f_blocks);
--- m4/fsusage.m4.orig  Sat Jul 23 17:15:05 2011
+++ m4/fsusage.m4   Sat Jul 23 17:12:20 2011
@@ -1,4 +1,4 @@
-# serial 29
+# serial 30
 # Obtaining file system usage information.
 
 # Copyright (C) 1997-1998, 2000-2001, 2003-2011 Free Software Foundation, Inc.
@@ -81,8 +81,32 @@
  [fu_cv_sys_stat_statvfs=no])])
   if test $fu_cv_sys_stat_statvfs = yes; then
 ac_fsusage_space=yes
-AC_DEFINE([STAT_STATVFS], [1],
-  [  Define if there is a function named statvfs.  (SVR4)])
+# AIX = 5.2 has statvfs64 that has a wider f_blocks field than statvfs.
+# glibc, HP-UX, IRIX, Solaris have statvfs64 as well, but on these systems
+# statvfs with large-file support is already equivalent to statvfs64.
+AC_CACHE_CHECK([whether to use statvfs64],
+  [fu_cv_sys_stat_statvfs64],
+  [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+[[#include sys/types.h
+  #include sys/statvfs.h
+  struct statvfs64 fsd;
+  int check_f_blocks_larger_in_statvfs64
+[sizeof (((struct statvfs64 *) 0)-f_blocks)
+  sizeof (((struct statvfs *) 0)-f_blocks)
+ ? 1 : -1];
+]],
+[[statvfs64 (0, fsd);]])],
+ [fu_cv_sys_stat_statvfs64=yes],
+ [fu_cv_sys_stat_statvfs64=no])
+  ])
+if test $fu_cv_sys_stat_statvfs64 = yes; then
+  AC_DEFINE([STAT_STATVFS64], [1],
+[  Define if statvfs64 should be preferred over statvfs.])
+else
+  AC_DEFINE([STAT_STATVFS], [1],
+[  Define if there is a function named statvfs.  (SVR4)])
+fi
   fi
 fi
 
-- 
In memoriam Adam Czerniaków http://en.wikipedia.org/wiki/Adam_Czerniaków





bug#9140: fsusage: add large volume support on AIX

2011-07-23 Thread Paul Eggert
Thanks for all that work in analysis, and porting checking, for
statvfs etc.  Your patches look good to me too.