bug-coreutils
[Top][All Lists]
Advanced

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

Re: rm: don't waste time preprocessing on tmpfs or nfs


From: Jim Meyering
Subject: Re: rm: don't waste time preprocessing on tmpfs or nfs
Date: Wed, 01 Oct 2008 22:42:07 +0200

Eric Blake <address@hidden> wrote:

> Jim Meyering <jim <at> meyering.net> writes:
>
>>
>> I'll probably be using this change:
>>
>> From ebb424314a577c0b8ccaf3ef79c3c9a3379b31a5 Mon Sep 17 00:00:00 2001
>> From: Jim Meyering <meyering <at> redhat.com>
>> Date: Wed, 1 Oct 2008 12:21:58 +0200
>> Subject: [PATCH] remove.c: combine two helper functions, to avoid sign-
> extension
>
> Even with that, the build is still failing on cygwin:
>
> remove.c: In function `dirent_inode_sort_may_be_useful':
> remove.c:1306: error: `S_MAGIC_TMPFS' undeclared (first use in this function)
> remove.c:1306: error: (Each undeclared identifier is reported only once
> remove.c:1306: error: for each function it appears in.)
> remove.c:1307: error: `S_MAGIC_NFS' undeclared (first use in this function)
> remove.c: At top level:
> remove.c:1290: warning: 'dirent_inode_sort_may_be_useful' defined but not used
>
> Since we've already applied 58aaf71 to silence other functions when d_type is
> unavailable (and sorting is useless), it seems like that needs to be repeated
> here.  The constants from "fs.h" are not defined, since that file is valid 
> only
> for Linux and Hurd, but commenting out the entire function bypasses that
> problem.

Hi Eric,

Thanks for reporting that.

In looking into it, I spotted a minor problem:
the code was including sys/statfs.h, yet testing-for/guarding-with
sys/vfs.h (as is documented for fstatfs on gnu/linux).
I've fixed that and removed an unnecessary "defined".

To address your immediate problem, I've copied the constants for now,
and will sync up fts.c tomorrow.  Or get tired enough of this
duplication and make a module out of it.  Eventually I'll make
it more portable (like for the Hurd).

diff --git a/src/remove.c b/src/remove.c
index 30931b0..f2ac14d 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -1277,9 +1277,11 @@ dirent_count (struct stat const *st)
 }
 #endif /* HAVE_STRUCT_DIRENT_D_TYPE */

-#if defined HAVE_SYS_VFS_H && HAVE_FSTATFS && HAVE_STRUCT_STATFS_F_TYPE
-# include <sys/statfs.h>
-# include "fs.h"
+#if HAVE_SYS_VFS_H && HAVE_FSTATFS && HAVE_STRUCT_STATFS_F_TYPE
+# include <sys/vfs.h>
+/* From coreutils' src/fs.h */
+# define S_MAGIC_TMPFS 0x1021994
+# define S_MAGIC_NFS 0x6969

 /* Return false if it is easy to determine the file system type of
    the directory on which DIR_FD is open, and sorting dirents on




reply via email to

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