1 2010-08-11 Ulrich Drepper <drepper@redhat.com>
3 * sysdeps/unix/sysv/linux/bits/statfs.h (struct statfs): Add f_flags
5 (struct statfs64): Likewise.
6 (_STATFS_F_FLAGS): Define.
7 * sysdeps/unix/sysv/linux/s390/bits/statfs.h: Likewise.
8 * sysdeps/unix/sysv/linux/internal_statvfs.c (__statvfs_getflags):
9 Don't define if __ASSUME_STATFS_F_FLAGS is defined.
10 (ST_VALID): Define locally.
11 (INTERNAL_STATVFS): If f_flags has ST_VALID set don't call
12 __statvfs_getflags, use the provided value.
13 * sysdeps/unix/sysv/linux/kernel-features.h: Define
14 __ASSUME_STATFS_F_FLAGS.
16 Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/bits/statfs.h
17 ===================================================================
18 --- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/bits/statfs.h
19 +++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/bits/statfs.h
20 @@ -42,7 +42,8 @@ struct statfs
22 __SWORD_TYPE f_namelen;
23 __SWORD_TYPE f_frsize;
24 - __SWORD_TYPE f_spare[5];
25 + __SWORD_TYPE f_flags;
26 + __SWORD_TYPE f_spare[4];
29 #ifdef __USE_LARGEFILE64
30 @@ -58,10 +59,12 @@ struct statfs64
32 __SWORD_TYPE f_namelen;
33 __SWORD_TYPE f_frsize;
34 - __SWORD_TYPE f_spare[5];
35 + __SWORD_TYPE f_flags;
36 + __SWORD_TYPE f_spare[4];
40 /* Tell code we have these members. */
41 #define _STATFS_F_NAMELEN
42 #define _STATFS_F_FRSIZE
43 +#define _STATFS_F_FLAGS
44 Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/internal_statvfs.c
45 ===================================================================
46 --- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/internal_statvfs.c
47 +++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/internal_statvfs.c
49 #include <sys/statfs.h>
50 #include <sys/statvfs.h>
51 #include "linux_fsinfo.h"
52 +#include "kernel-features.h"
55 +/* Special internal-only bit value. */
56 +#define ST_VALID 0x0020
61 # define INTERNAL_STATVFS __internal_statvfs
64 +# ifndef __ASSUME_STATFS_F_FLAGS
66 __statvfs_getflags (const char *name, int fstype, struct stat64 *st)
68 @@ -200,6 +206,7 @@ __statvfs_getflags (const char *name, in
74 extern int __statvfs_getflags (const char *name, int fstype,
76 @@ -240,9 +247,14 @@ INTERNAL_STATVFS (const char *name, stru
77 /* XXX I have no idea how to compute f_favail. Any idea??? */
78 buf->f_favail = buf->f_ffree;
80 - /* Determining the flags is tricky. We have to read /proc/mounts or
81 - the /etc/mtab file and search for the entry which matches the given
82 - file. The way we can test for matching filesystem is using the
84 - buf->f_flag = __statvfs_getflags (name, fsbuf->f_type, st);
85 +#ifndef __ASSUME_STATFS_F_FLAGS
86 + if ((fsbuf->f_flags & ST_VALID) == 0)
87 + /* Determining the flags is tricky. We have to read /proc/mounts or
88 + the /etc/mtab file and search for the entry which matches the given
89 + file. The way we can test for matching filesystem is using the
91 + buf->f_flag = __statvfs_getflags (name, fsbuf->f_type, st);
94 + buf->f_flag = fsbuf->f_flags ^ ST_VALID;
96 Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/kernel-features.h
97 ===================================================================
98 --- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/kernel-features.h
99 +++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/kernel-features.h
101 #if __LINUX_KERNEL_VERSION >= 0x020621
102 # define __ASSUME_RECVMMSG 1
105 +/* statfs fills in f_flags since 2.6.36. */
106 +#if __LINUX_KERNEL_VERSION >= 0x020624
107 +# define __ASSUME_STATFS_F_FLAGS 1
109 Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/s390/bits/statfs.h
110 ===================================================================
111 --- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/s390/bits/statfs.h
112 +++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/s390/bits/statfs.h
113 @@ -42,7 +42,8 @@ struct statfs
122 #ifdef __USE_LARGEFILE64
123 @@ -58,10 +59,12 @@ struct statfs64
133 /* Tell code we have this member. */
134 #define _STATFS_F_NAMELEN
135 #define _STATFS_F_FRSIZE
136 +#define _STATFS_F_FLAGS