Blame SOURCES/glibc-rh711987.patch

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