]>
Commit | Line | Data |
---|---|---|
12788f63 MT |
1 | 2010-08-11 Ulrich Drepper <drepper@redhat.com> |
2 | ||
3 | * sysdeps/unix/sysv/linux/bits/statfs.h (struct statfs): Add f_flags | |
4 | field. | |
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. | |
15 | ||
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 | |
21 | __fsid_t f_fsid; | |
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]; | |
27 | }; | |
28 | ||
29 | #ifdef __USE_LARGEFILE64 | |
30 | @@ -58,10 +59,12 @@ struct statfs64 | |
31 | __fsid_t f_fsid; | |
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]; | |
37 | }; | |
38 | #endif | |
39 | ||
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 | |
48 | @@ -29,6 +29,11 @@ | |
49 | #include <sys/statfs.h> | |
50 | #include <sys/statvfs.h> | |
51 | #include "linux_fsinfo.h" | |
52 | +#include "kernel-features.h" | |
53 | + | |
54 | + | |
55 | +/* Special internal-only bit value. */ | |
56 | +#define ST_VALID 0x0020 | |
57 | ||
58 | ||
59 | #ifndef STATFS | |
60 | @@ -37,6 +42,7 @@ | |
61 | # define INTERNAL_STATVFS __internal_statvfs | |
62 | ||
63 | ||
64 | +# ifndef __ASSUME_STATFS_F_FLAGS | |
65 | int | |
66 | __statvfs_getflags (const char *name, int fstype, struct stat64 *st) | |
67 | { | |
68 | @@ -200,6 +206,7 @@ __statvfs_getflags (const char *name, in | |
69 | ||
70 | return result; | |
71 | } | |
72 | +# endif | |
73 | #else | |
74 | extern int __statvfs_getflags (const char *name, int fstype, | |
75 | struct stat64 *st); | |
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; | |
79 | ||
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 | |
83 | - device number. */ | |
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 | |
90 | + device number. */ | |
91 | + buf->f_flag = __statvfs_getflags (name, fsbuf->f_type, st); | |
92 | + else | |
93 | +#endif | |
94 | + buf->f_flag = fsbuf->f_flags ^ ST_VALID; | |
95 | } | |
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 | |
100 | @@ -552,3 +552,8 @@ | |
101 | #if __LINUX_KERNEL_VERSION >= 0x020621 | |
102 | # define __ASSUME_RECVMMSG 1 | |
103 | #endif | |
104 | + | |
105 | +/* statfs fills in f_flags since 2.6.36. */ | |
106 | +#if __LINUX_KERNEL_VERSION >= 0x020624 | |
107 | +# define __ASSUME_STATFS_F_FLAGS 1 | |
108 | +#endif | |
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 | |
114 | __fsid_t f_fsid; | |
115 | int f_namelen; | |
116 | int f_frsize; | |
117 | - int f_spare[5]; | |
118 | + int f_flags; | |
119 | + int f_spare[4]; | |
120 | }; | |
121 | ||
122 | #ifdef __USE_LARGEFILE64 | |
123 | @@ -58,10 +59,12 @@ struct statfs64 | |
124 | __fsid_t f_fsid; | |
125 | int f_namelen; | |
126 | int f_frsize; | |
127 | - int f_spare[5]; | |
128 | + int f_flags; | |
129 | + int f_spare[4]; | |
130 | }; | |
131 | #endif | |
132 | ||
133 | /* Tell code we have this member. */ | |
134 | #define _STATFS_F_NAMELEN | |
135 | #define _STATFS_F_FRSIZE | |
136 | +#define _STATFS_F_FLAGS |