Blame SOURCES/glibc-rh711987.patch

b40826
2010-08-11  Ulrich Drepper  <drepper@redhat.com>
b40826
b40826
	* sysdeps/unix/sysv/linux/bits/statfs.h (struct statfs): Add f_flags
b40826
	field.
b40826
	(struct statfs64): Likewise.
b40826
	(_STATFS_F_FLAGS): Define.
b40826
	* sysdeps/unix/sysv/linux/s390/bits/statfs.h: Likewise.
b40826
	* sysdeps/unix/sysv/linux/internal_statvfs.c (__statvfs_getflags):
b40826
	Don't define if __ASSUME_STATFS_F_FLAGS is defined.
b40826
	(ST_VALID): Define locally.
b40826
	(INTERNAL_STATVFS): If f_flags has ST_VALID set don't call
b40826
	__statvfs_getflags, use the provided value.
b40826
	* sysdeps/unix/sysv/linux/kernel-features.h: Define
b40826
	__ASSUME_STATFS_F_FLAGS.
b40826
b40826
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/bits/statfs.h
b40826
===================================================================
b40826
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/bits/statfs.h
b40826
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/bits/statfs.h
b40826
@@ -42,7 +42,8 @@ struct statfs
b40826
     __fsid_t f_fsid;
b40826
     __SWORD_TYPE f_namelen;
b40826
     __SWORD_TYPE f_frsize;
b40826
-    __SWORD_TYPE f_spare[5];
b40826
+    __SWORD_TYPE f_flags;
b40826
+    __SWORD_TYPE f_spare[4];
b40826
   };
b40826
 
b40826
 #ifdef __USE_LARGEFILE64
b40826
@@ -58,10 +59,12 @@ struct statfs64
b40826
     __fsid_t f_fsid;
b40826
     __SWORD_TYPE f_namelen;
b40826
     __SWORD_TYPE f_frsize;
b40826
-    __SWORD_TYPE f_spare[5];
b40826
+    __SWORD_TYPE f_flags;
b40826
+    __SWORD_TYPE f_spare[4];
b40826
   };
b40826
 #endif
b40826
 
b40826
 /* Tell code we have these members.  */
b40826
 #define _STATFS_F_NAMELEN
b40826
 #define _STATFS_F_FRSIZE
b40826
+#define _STATFS_F_FLAGS
b40826
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/internal_statvfs.c
b40826
===================================================================
b40826
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/internal_statvfs.c
b40826
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/internal_statvfs.c
b40826
@@ -29,6 +29,11 @@
b40826
 #include <sys/statfs.h>
b40826
 #include <sys/statvfs.h>
b40826
 #include "linux_fsinfo.h"
b40826
+#include "kernel-features.h"
b40826
+
b40826
+
b40826
+/* Special internal-only bit value.  */
b40826
+#define ST_VALID 0x0020
b40826
 
b40826
 
b40826
 #ifndef STATFS
b40826
@@ -37,6 +42,7 @@
b40826
 # define INTERNAL_STATVFS __internal_statvfs
b40826
 
b40826
 
b40826
+# ifndef __ASSUME_STATFS_F_FLAGS
b40826
 int
b40826
 __statvfs_getflags (const char *name, int fstype, struct stat64 *st)
b40826
 {
b40826
@@ -200,6 +206,7 @@ __statvfs_getflags (const char *name, in
b40826
 
b40826
   return result;
b40826
 }
b40826
+# endif
b40826
 #else
b40826
 extern int __statvfs_getflags (const char *name, int fstype,
b40826
 			       struct stat64 *st);
b40826
@@ -240,9 +247,14 @@ INTERNAL_STATVFS (const char *name, stru
b40826
   /* XXX I have no idea how to compute f_favail.  Any idea???  */
b40826
   buf->f_favail = buf->f_ffree;
b40826
 
b40826
-  /* Determining the flags is tricky.  We have to read /proc/mounts or
b40826
-     the /etc/mtab file and search for the entry which matches the given
b40826
-     file.  The way we can test for matching filesystem is using the
b40826
-     device number.  */
b40826
-  buf->f_flag = __statvfs_getflags (name, fsbuf->f_type, st);
b40826
+#ifndef __ASSUME_STATFS_F_FLAGS
b40826
+  if ((fsbuf->f_flags & ST_VALID) == 0)
b40826
+    /* Determining the flags is tricky.  We have to read /proc/mounts or
b40826
+       the /etc/mtab file and search for the entry which matches the given
b40826
+       file.  The way we can test for matching filesystem is using the
b40826
+       device number.  */
b40826
+    buf->f_flag = __statvfs_getflags (name, fsbuf->f_type, st);
b40826
+  else
b40826
+#endif
b40826
+    buf->f_flag = fsbuf->f_flags ^ ST_VALID;
b40826
 }
b40826
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/kernel-features.h
b40826
===================================================================
b40826
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/kernel-features.h
b40826
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/kernel-features.h
b40826
@@ -552,3 +552,8 @@
b40826
 #if __LINUX_KERNEL_VERSION >= 0x020621
b40826
 # define __ASSUME_RECVMMSG	1
b40826
 #endif
b40826
+
b40826
+/* statfs fills in f_flags since 2.6.36.  */
b40826
+#if __LINUX_KERNEL_VERSION >= 0x020624
b40826
+# define __ASSUME_STATFS_F_FLAGS	1
b40826
+#endif
b40826
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/s390/bits/statfs.h
b40826
===================================================================
b40826
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/s390/bits/statfs.h
b40826
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/s390/bits/statfs.h
b40826
@@ -42,7 +42,8 @@ struct statfs
b40826
     __fsid_t f_fsid;
b40826
     int f_namelen;
b40826
     int f_frsize;
b40826
-    int f_spare[5];
b40826
+    int f_flags;
b40826
+    int f_spare[4];
b40826
   };
b40826
 
b40826
 #ifdef __USE_LARGEFILE64
b40826
@@ -58,10 +59,12 @@ struct statfs64
b40826
     __fsid_t f_fsid;
b40826
     int f_namelen;
b40826
     int f_frsize;
b40826
-    int f_spare[5];
b40826
+    int f_flags;
b40826
+    int f_spare[4];
b40826
   };
b40826
 #endif
b40826
 
b40826
 /* Tell code we have this member.  */
b40826
 #define _STATFS_F_NAMELEN
b40826
 #define _STATFS_F_FRSIZE
b40826
+#define _STATFS_F_FLAGS