Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/linux/common Adjust struct statfs content to flag...
details: https://anonhg.NetBSD.org/src/rev/cd2eceecbc0f
branches: trunk
changeset: 570052:cd2eceecbc0f
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Sun Sep 19 16:50:11 2004 +0000
description:
Adjust struct statfs content to flag that the newer Linux kernel do
provide f_frsize. It cannot be actually used to GNU C statvfs() bug
in f_frsize != f_bsize case, so just keep pretending we don't support it.
Update comments and explain the situation in detail there.
diffstat:
sys/compat/linux/common/linux_misc.c | 24 ++++++++++++++++++------
sys/compat/linux/common/linux_types.h | 5 +++--
2 files changed, 21 insertions(+), 8 deletions(-)
diffs (72 lines):
diff -r 695fa8a854c4 -r cd2eceecbc0f sys/compat/linux/common/linux_misc.c
--- a/sys/compat/linux/common/linux_misc.c Sun Sep 19 15:06:32 2004 +0000
+++ b/sys/compat/linux/common/linux_misc.c Sun Sep 19 16:50:11 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_misc.c,v 1.130 2004/09/17 14:11:24 skrll Exp $ */
+/* $NetBSD: linux_misc.c,v 1.131 2004/09/19 16:50:11 jdolecek Exp $ */
/*-
* Copyright (c) 1995, 1998, 1999 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.130 2004/09/17 14:11:24 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.131 2004/09/19 16:50:11 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -296,10 +296,9 @@
}
/*
- * Convert BSD statfs structure to Linux statfs structure.
- * The Linux structure has less fields, and it also wants
- * the length of a name in a dir entry in a field, which
- * we fake (probably the wrong way).
+ * Convert NetBSD statvfs structure to Linux statfs structure.
+ * Linux doesn't have f_flag, and we can't set f_frsize due
+ * to glibc statvfs() bug (see below).
*/
static void
bsd_to_linux_statfs(bsp, lsp)
@@ -320,7 +319,20 @@
lsp->l_ftype = fstypes[i].linux;
}
+ /*
+ * The sizes are expressed in number of blocks. The block
+ * size used for the size is f_frsize for POSIX-compliant
+ * statvfs. Linux statfs uses f_bsize as the block size
+ * (f_frsize used to not be available in Linux struct statfs).
+ * However, glibc 2.3.3 statvfs() wrapper fails to adjust the block
+ * counts for different f_frsize if f_frsize is provided by the kernel.
+ * POSIX conforming apps thus get wrong size if f_frsize
+ * is different to f_bsize. Thus, we just pretend we don't
+ * support f_frsize.
+ */
+
lsp->l_fbsize = bsp->f_frsize;
+ lsp->l_ffrsize = 0; /* compat */
lsp->l_fblocks = bsp->f_blocks;
lsp->l_fbfree = bsp->f_bfree;
lsp->l_fbavail = bsp->f_bavail;
diff -r 695fa8a854c4 -r cd2eceecbc0f sys/compat/linux/common/linux_types.h
--- a/sys/compat/linux/common/linux_types.h Sun Sep 19 15:06:32 2004 +0000
+++ b/sys/compat/linux/common/linux_types.h Sun Sep 19 16:50:11 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_types.h,v 1.16 2004/09/19 15:06:32 jdolecek Exp $ */
+/* $NetBSD: linux_types.h,v 1.17 2004/09/19 16:50:11 jdolecek Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -112,7 +112,8 @@
u_int32_t l_fffree;
linux_fsid_t l_ffsid;
u_int32_t l_fnamelen;
- u_int32_t l_fspare[6];
+ u_int32_t l_ffrsize;
+ u_int32_t l_fspare[5];
};
#endif /* !__sparc64__ */
Home |
Main Index |
Thread Index |
Old Index