bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] fsusage: remove SVR2 support


From: Paul Eggert
Subject: [PATCH] fsusage: remove SVR2 support
Date: Sun, 1 Oct 2017 20:36:53 -0700

SVR2 was obsolete by 1986 and is no longer supported by anybody,
and its code was getting in the way of use of this module by
Emacs, which has its own ‘read’ function anyway.
* lib/fsusage.c: Do not include sys/filsys.h.
(get_fs_usage): Remove SVR2-specific code.
* m4/fsusage.m4 (gl_FILE_SYSTEM_USAGE):
Do not test for sys/filsys.h or set STAT_READ_FILSYS.
* modules/fsusage (Depends-on): Do not depend on full-read.
---
 ChangeLog       | 10 ++++++++++
 lib/fsusage.c   | 38 --------------------------------------
 m4/fsusage.m4   | 15 ++-------------
 modules/fsusage |  1 -
 4 files changed, 12 insertions(+), 52 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 454a87733..23d1b64a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2017-10-01  Paul Eggert  <address@hidden>
 
+       fsusage: remove SVR2 support
+       SVR2 was obsolete by 1986 and is no longer supported by anybody,
+       and its code was getting in the way of use of this module by
+       Emacs, which has its own ‘read’ function anyway.
+       * lib/fsusage.c: Do not include sys/filsys.h.
+       (get_fs_usage): Remove SVR2-specific code.
+       * m4/fsusage.m4 (gl_FILE_SYSTEM_USAGE):
+       Do not test for sys/filsys.h or set STAT_READ_FILSYS.
+       * modules/fsusage (Depends-on): Do not depend on full-read.
+
        Simplify autoupdate of licenses
        * config/srclistvars.sh (GNUWWWLICENSES): Move to a more-typical
        place.
diff --git a/lib/fsusage.c b/lib/fsusage.c
index 4513367f8..a0f763be0 100644
--- a/lib/fsusage.c
+++ b/lib/fsusage.c
@@ -43,9 +43,6 @@
 # if HAVE_SYS_FS_S5PARAM_H      /* Fujitsu UXP/V */
 #  include <sys/fs/s5param.h>
 # endif
-# if defined HAVE_SYS_FILSYS_H && !defined _CRAY
-#  include <sys/filsys.h>       /* SVR2 */
-# endif
 # if HAVE_SYS_STATFS_H
 #  include <sys/statfs.h>
 # endif
@@ -170,41 +167,6 @@ get_fs_usage (char const *file, char const *disk, struct 
fs_usage *fsp)
   fsp->fsu_files = PROPAGATE_ALL_ONES (fsd.fd_req.gtot);
   fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.fd_req.gfree);
 
-#elif defined STAT_READ_FILSYS          /* SVR2 */
-# ifndef SUPERBOFF
-#  define SUPERBOFF (SUPERB * 512)
-# endif
-
-  struct filsys fsd;
-  int fd;
-
-  if (! disk)
-    {
-      errno = 0;
-      return -1;
-    }
-
-  fd = open (disk, O_RDONLY);
-  if (fd < 0)
-    return -1;
-  lseek (fd, (off_t) SUPERBOFF, 0);
-  if (full_read (fd, (char *) &fsd, sizeof fsd) != sizeof fsd)
-    {
-      close (fd);
-      return -1;
-    }
-  close (fd);
-
-  fsp->fsu_blocksize = (fsd.s_type == Fs2b ? 1024 : 512);
-  fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.s_fsize);
-  fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.s_tfree);
-  fsp->fsu_bavail = PROPAGATE_TOP_BIT (fsd.s_tfree);
-  fsp->fsu_bavail_top_bit_set = EXTRACT_TOP_BIT (fsd.s_tfree) != 0;
-  fsp->fsu_files = (fsd.s_isize == -1
-                    ? UINTMAX_MAX
-                    : (fsd.s_isize - 2) * INOPB * (fsd.s_type == Fs2b ? 2 : 
1));
-  fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.s_tinode);
-
 #elif defined STAT_STATFS3_OSF1         /* OSF/1 */
 
   struct statfs fsd;
diff --git a/m4/fsusage.m4 b/m4/fsusage.m4
index 526723ab6..1d6ad41cd 100644
--- a/m4/fsusage.m4
+++ b/m4/fsusage.m4
@@ -1,4 +1,4 @@
-# serial 31
+# serial 32
 # Obtaining file system usage information.
 
 # Copyright (C) 1997-1998, 2000-2001, 2003-2017 Free Software Foundation, Inc.
@@ -295,17 +295,6 @@ if test $ac_fsusage_space = no; then
   fi
 fi
 
-if test $ac_fsusage_space = no; then
-  # SVR2
-  # (AIX, HP-UX, OSF/1 already handled above.)
-  AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <sys/filsys.h>
-        ]])],
-    [AC_DEFINE([STAT_READ_FILSYS], [1],
-      [Define if there is no specific function for reading file systems usage
-       information and you have the <sys/filsys.h> header file.  (SVR2)])
-     ac_fsusage_space=yes])
-fi
-
 AS_IF([test $ac_fsusage_space = yes], [$1], [$2])
 
 ])
@@ -342,6 +331,6 @@ choke -- this is a workaround for a Sun-specific problem
 # Prerequisites of lib/fsusage.c not done by gl_FILE_SYSTEM_USAGE.
 AC_DEFUN([gl_PREREQ_FSUSAGE_EXTRA],
 [
-  AC_CHECK_HEADERS([dustat.h sys/fs/s5param.h sys/filsys.h sys/statfs.h])
+  AC_CHECK_HEADERS([dustat.h sys/fs/s5param.h sys/statfs.h])
   gl_STATFS_TRUNCATES
 ])
diff --git a/modules/fsusage b/modules/fsusage
index b44752546..ba8519616 100644
--- a/modules/fsusage
+++ b/modules/fsusage
@@ -10,7 +10,6 @@ Depends-on:
 largefile
 stdbool
 stdint
-full-read       [test $gl_cv_fs_space = yes]
 
 configure.ac:
 gl_FSUSAGE
-- 
2.13.5




reply via email to

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