PERFORCE change 125822 for review

Xin LI delphij at FreeBSD.org
Wed Aug 29 08:52:03 PDT 2007


http://perforce.freebsd.org/chv.cgi?CH=125822

Change 125822 by delphij at charlie on 2007/08/29 15:51:50

	IFC

Affected files ...

.. //depot/projects/delphij_fork/share/man/man5/src.conf.5#3 integrate
.. //depot/projects/delphij_fork/sys/amd64/linux32/linux32_proto.h#2 integrate
.. //depot/projects/delphij_fork/sys/amd64/linux32/linux32_syscall.h#2 integrate
.. //depot/projects/delphij_fork/sys/amd64/linux32/linux32_sysent.c#2 integrate
.. //depot/projects/delphij_fork/sys/amd64/linux32/syscalls.master#2 integrate
.. //depot/projects/delphij_fork/sys/compat/freebsd32/freebsd32_misc.c#3 integrate
.. //depot/projects/delphij_fork/sys/compat/linux/linux_misc.c#2 integrate
.. //depot/projects/delphij_fork/sys/dev/isp/isp_freebsd.h#2 integrate
.. //depot/projects/delphij_fork/sys/i386/linux/linux_proto.h#2 integrate
.. //depot/projects/delphij_fork/sys/i386/linux/linux_syscall.h#2 integrate
.. //depot/projects/delphij_fork/sys/i386/linux/linux_sysent.c#2 integrate
.. //depot/projects/delphij_fork/sys/i386/linux/syscalls.master#2 integrate
.. //depot/projects/delphij_fork/sys/kern/vfs_syscalls.c#3 integrate
.. //depot/projects/delphij_fork/sys/sys/mount.h#2 integrate
.. //depot/projects/delphij_fork/tools/build/options/WITHOUT_ZONEINFO#1 branch
.. //depot/projects/delphij_fork/usr.sbin/kbdmap/kbdmap.c#2 integrate

Differences ...

==== //depot/projects/delphij_fork/share/man/man5/src.conf.5#3 (text) ====

@@ -1,7 +1,7 @@
 .\" DO NOT EDIT-- this file is automatically generated.
 .\" from FreeBSD: src/tools/build/options/makeman,v 1.6 2006/09/11 13:39:44 ru Exp
-.\" $FreeBSD: src/share/man/man5/src.conf.5,v 1.13 2007/07/19 17:02:24 bz Exp $
-.Dd July 19, 2007
+.\" $FreeBSD: src/share/man/man5/src.conf.5,v 1.15 2007/08/27 20:22:59 remko Exp $
+.Dd August 27, 2007
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -564,6 +564,9 @@
 .It Va WITHOUT_ZFS
 .\" from FreeBSD: src/tools/build/options/WITHOUT_ZFS,v 1.1 2007/04/06 02:13:30 pjd Exp
 Set to not build ZFS file system.
+.It Va WITHOUT_ZONEINFO
+.\" from FreeBSD: src/tools/build/options/WITHOUT_ZONEINFO,v 1.1 2007/08/27 20:01:08 remko Exp
+Set to not build the timezone database
 .El
 .Sh FILES
 .Bl -tag -compact

==== //depot/projects/delphij_fork/sys/amd64/linux32/linux32_proto.h#2 (text+ko) ====

@@ -2,8 +2,8 @@
  * System call prototypes.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/amd64/linux32/linux32_proto.h,v 1.31 2007/03/30 00:08:21 jkim Exp $
- * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.28 2007/03/30 00:06:21 jkim Exp 
+ * $FreeBSD: src/sys/amd64/linux32/linux32_proto.h,v 1.32 2007/08/28 12:36:23 kib Exp $
+ * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.29 2007/08/28 12:26:34 kib Exp 
  */
 
 #ifndef _LINUX_SYSPROTO_H_
@@ -734,6 +734,11 @@
 	char uaddr2_l_[PADL_(void *)]; void * uaddr2; char uaddr2_r_[PADR_(void *)];
 	char val3_l_[PADL_(int)]; int val3; char val3_r_[PADR_(int)];
 };
+struct linux_sched_getaffinity_args {
+	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
+	char len_l_[PADL_(l_uint)]; l_uint len; char len_r_[PADR_(l_uint)];
+	char user_mask_ptr_l_[PADL_(l_ulong *)]; l_ulong * user_mask_ptr; char user_mask_ptr_r_[PADR_(l_ulong *)];
+};
 struct linux_set_thread_area_args {
 	char desc_l_[PADL_(struct l_user_desc *)]; struct l_user_desc * desc; char desc_r_[PADR_(struct l_user_desc *)];
 };
@@ -1099,6 +1104,7 @@
 int	linux_fremovexattr(struct thread *, struct linux_fremovexattr_args *);
 int	linux_tkill(struct thread *, struct linux_tkill_args *);
 int	linux_sys_futex(struct thread *, struct linux_sys_futex_args *);
+int	linux_sched_getaffinity(struct thread *, struct linux_sched_getaffinity_args *);
 int	linux_set_thread_area(struct thread *, struct linux_set_thread_area_args *);
 int	linux_fadvise64(struct thread *, struct linux_fadvise64_args *);
 int	linux_exit_group(struct thread *, struct linux_exit_group_args *);
@@ -1172,6 +1178,13 @@
 
 #endif /* COMPAT_FREEBSD4 */
 
+
+#ifdef COMPAT_FREEBSD6
+
+#define	nosys	linux_nosys
+
+#endif /* COMPAT_FREEBSD6 */
+
 #define	LINUX_SYS_AUE_linux_fork	AUE_FORK
 #define	LINUX_SYS_AUE_linux_open	AUE_OPEN_RWTC
 #define	LINUX_SYS_AUE_linux_waitpid	AUE_WAIT4
@@ -1346,6 +1359,7 @@
 #define	LINUX_SYS_AUE_linux_fremovexattr	AUE_NULL
 #define	LINUX_SYS_AUE_linux_tkill	AUE_NULL
 #define	LINUX_SYS_AUE_linux_sys_futex	AUE_NULL
+#define	LINUX_SYS_AUE_linux_sched_getaffinity	AUE_NULL
 #define	LINUX_SYS_AUE_linux_set_thread_area	AUE_NULL
 #define	LINUX_SYS_AUE_linux_fadvise64	AUE_NULL
 #define	LINUX_SYS_AUE_linux_exit_group	AUE_EXIT

==== //depot/projects/delphij_fork/sys/amd64/linux32/linux32_syscall.h#2 (text+ko) ====

@@ -2,8 +2,8 @@
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/amd64/linux32/linux32_syscall.h,v 1.31 2007/03/30 00:08:21 jkim Exp $
- * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.28 2007/03/30 00:06:21 jkim Exp 
+ * $FreeBSD: src/sys/amd64/linux32/linux32_syscall.h,v 1.32 2007/08/28 12:36:23 kib Exp $
+ * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.29 2007/08/28 12:26:34 kib Exp 
  */
 
 #define	LINUX_SYS_exit	1
@@ -222,6 +222,7 @@
 #define	LINUX_SYS_linux_fremovexattr	237
 #define	LINUX_SYS_linux_tkill	238
 #define	LINUX_SYS_linux_sys_futex	240
+#define	LINUX_SYS_linux_sched_getaffinity	242
 #define	LINUX_SYS_linux_set_thread_area	243
 #define	LINUX_SYS_linux_fadvise64	250
 #define	LINUX_SYS_linux_exit_group	252

==== //depot/projects/delphij_fork/sys/amd64/linux32/linux32_sysent.c#2 (text+ko) ====

@@ -2,8 +2,8 @@
  * System call switch table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/amd64/linux32/linux32_sysent.c,v 1.31 2007/03/30 00:08:21 jkim Exp $
- * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.28 2007/03/30 00:06:21 jkim Exp 
+ * $FreeBSD: src/sys/amd64/linux32/linux32_sysent.c,v 1.32 2007/08/28 12:36:23 kib Exp $
+ * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.29 2007/08/28 12:26:34 kib Exp 
  */
 
 #include <bsm/audit_kevents.h>
@@ -262,7 +262,7 @@
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 239 = linux_sendfile64 */
 	{ AS(linux_sys_futex_args), (sy_call_t *)linux_sys_futex, AUE_NULL, NULL, 0, 0 },	/* 240 = linux_sys_futex */
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 241 = linux_sched_setaffinity */
-	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 242 = linux_sched_getaffinity */
+	{ AS(linux_sched_getaffinity_args), (sy_call_t *)linux_sched_getaffinity, AUE_NULL, NULL, 0, 0 },	/* 242 = linux_sched_getaffinity */
 	{ AS(linux_set_thread_area_args), (sy_call_t *)linux_set_thread_area, AUE_NULL, NULL, 0, 0 },	/* 243 = linux_set_thread_area */
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 244 = linux_get_thread_area */
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 245 = linux_io_setup */

==== //depot/projects/delphij_fork/sys/amd64/linux32/syscalls.master#2 (text+ko) ====

@@ -1,4 +1,4 @@
- $FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.28 2007/03/30 00:06:21 jkim Exp $
+ $FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.29 2007/08/28 12:26:34 kib Exp $
 
 ;	@(#)syscalls.master	8.1 (Berkeley) 7/19/93
 ; System call name/number master file (or rather, slave, from LINUX).
@@ -408,7 +408,8 @@
 240	AUE_NULL	STD	{ int linux_sys_futex(void *uaddr, int op, int val, \
 					struct l_timespec *timeout, void *uaddr2, int val3); }
 241	AUE_NULL	UNIMPL	linux_sched_setaffinity
-242	AUE_NULL	UNIMPL	linux_sched_getaffinity
+242	AUE_NULL	STD	{ int linux_sched_getaffinity(l_pid_t pid, l_uint len, \
+					l_ulong *user_mask_ptr); }
 243	AUE_NULL	STD	{ int linux_set_thread_area(struct l_user_desc *desc); }
 244	AUE_NULL	UNIMPL	linux_get_thread_area
 245	AUE_NULL	UNIMPL	linux_io_setup

==== //depot/projects/delphij_fork/sys/compat/freebsd32/freebsd32_misc.c#3 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/freebsd32/freebsd32_misc.c,v 1.66 2007/07/04 23:04:41 peter Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/freebsd32/freebsd32_misc.c,v 1.67 2007/08/28 20:28:11 jhb Exp $");
 
 #include "opt_compat.h"
 
@@ -135,28 +135,28 @@
 static void
 copy_statfs(struct statfs *in, struct statfs32 *out)
 {
-	
+
+	statfs_scale_blocks(in, INT32_MAX);
 	bzero(out, sizeof(*out));
 	CP(*in, *out, f_bsize);
-	CP(*in, *out, f_iosize);
+	out->f_iosize = MIN(in->f_iosize, INT32_MAX);
 	CP(*in, *out, f_blocks);
 	CP(*in, *out, f_bfree);
 	CP(*in, *out, f_bavail);
-	CP(*in, *out, f_files);
-	CP(*in, *out, f_ffree);
+	out->f_files = MIN(in->f_files, INT32_MAX);
+	out->f_ffree = MIN(in->f_ffree, INT32_MAX);
 	CP(*in, *out, f_fsid);
 	CP(*in, *out, f_owner);
 	CP(*in, *out, f_type);
 	CP(*in, *out, f_flags);
-	CP(*in, *out, f_flags);
-	CP(*in, *out, f_syncwrites);
-	CP(*in, *out, f_asyncwrites);
+	out->f_syncwrites = MIN(in->f_syncwrites, INT32_MAX);
+	out->f_asyncwrites = MIN(in->f_asyncwrites, INT32_MAX);
 	strlcpy(out->f_fstypename,
 	      in->f_fstypename, MFSNAMELEN);
 	strlcpy(out->f_mntonname,
 	      in->f_mntonname, min(MNAMELEN, FREEBSD4_MNAMELEN));
-	CP(*in, *out, f_syncreads);
-	CP(*in, *out, f_asyncreads);
+	out->f_syncreads = MIN(in->f_syncreads, INT32_MAX);
+	out->f_asyncreads = MIN(in->f_asyncreads, INT32_MAX);
 	strlcpy(out->f_mntfromname,
 	      in->f_mntfromname, min(MNAMELEN, FREEBSD4_MNAMELEN));
 }

==== //depot/projects/delphij_fork/sys/compat/linux/linux_misc.c#2 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.213 2007/06/12 00:11:57 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.214 2007/08/28 12:26:35 kib Exp $");
 
 #include "opt_compat.h"
 #include "opt_mac.h"
@@ -1713,3 +1713,24 @@
 
 	return (error);
 }
+
+/*
+ * XXX: fake one.. waiting for real implementation of affinity mask.
+ */
+int
+linux_sched_getaffinity(struct thread *td,
+    struct linux_sched_getaffinity_args *args)
+{
+	int error;
+	cpumask_t i = ~0;
+
+	if (args->len < sizeof(cpumask_t))
+		return (EINVAL);
+
+	error = copyout(&i, args->user_mask_ptr, sizeof(cpumask_t));
+	if (error)
+		return (EFAULT);
+
+	td->td_retval[0] = sizeof(cpumask_t);
+	return (0);
+}

==== //depot/projects/delphij_fork/sys/dev/isp/isp_freebsd.h#2 (text+ko) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/isp/isp_freebsd.h,v 1.106 2007/07/02 20:08:20 mjacob Exp $ */
+/* $FreeBSD: src/sys/dev/isp/isp_freebsd.h,v 1.107 2007/08/28 00:09:12 jkim Exp $ */
 /*-
  * Qlogic ISP SCSI Host Adapter FreeBSD Wrapper Definitions
  *
@@ -184,8 +184,8 @@
 	const struct firmware *	fw;
 	union {
 		struct {
-			char wwnn[17];
-			char wwpn[17];
+			char wwnn[19];
+			char wwpn[19];
 		} fc;
 	} sysctl_info;
 #endif

==== //depot/projects/delphij_fork/sys/i386/linux/linux_proto.h#2 (text+ko) ====

@@ -2,8 +2,8 @@
  * System call prototypes.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/i386/linux/linux_proto.h,v 1.92 2007/03/29 02:11:46 julian Exp $
- * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.86 2007/02/15 00:54:40 jkim Exp 
+ * $FreeBSD: src/sys/i386/linux/linux_proto.h,v 1.93 2007/08/28 12:32:01 kib Exp $
+ * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.88 2007/08/28 12:26:35 kib Exp 
  */
 
 #ifndef _LINUX_SYSPROTO_H_
@@ -731,6 +731,11 @@
 	char uaddr2_l_[PADL_(void *)]; void * uaddr2; char uaddr2_r_[PADR_(void *)];
 	char val3_l_[PADL_(int)]; int val3; char val3_r_[PADR_(int)];
 };
+struct linux_sched_getaffinity_args {
+	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
+	char len_l_[PADL_(l_uint)]; l_uint len; char len_r_[PADR_(l_uint)];
+	char user_mask_ptr_l_[PADL_(l_ulong *)]; l_ulong * user_mask_ptr; char user_mask_ptr_r_[PADR_(l_ulong *)];
+};
 struct linux_set_thread_area_args {
 	char desc_l_[PADL_(struct l_user_desc *)]; struct l_user_desc * desc; char desc_r_[PADR_(struct l_user_desc *)];
 };
@@ -1118,6 +1123,7 @@
 int	linux_fremovexattr(struct thread *, struct linux_fremovexattr_args *);
 int	linux_tkill(struct thread *, struct linux_tkill_args *);
 int	linux_sys_futex(struct thread *, struct linux_sys_futex_args *);
+int	linux_sched_getaffinity(struct thread *, struct linux_sched_getaffinity_args *);
 int	linux_set_thread_area(struct thread *, struct linux_set_thread_area_args *);
 int	linux_get_thread_area(struct thread *, struct linux_get_thread_area_args *);
 int	linux_fadvise64(struct thread *, struct linux_fadvise64_args *);
@@ -1192,6 +1198,13 @@
 
 #endif /* COMPAT_FREEBSD4 */
 
+
+#ifdef COMPAT_FREEBSD6
+
+#define	nosys	linux_nosys
+
+#endif /* COMPAT_FREEBSD6 */
+
 #define	LINUX_SYS_AUE_linux_fork	AUE_FORK
 #define	LINUX_SYS_AUE_linux_open	AUE_OPEN_RWTC
 #define	LINUX_SYS_AUE_linux_waitpid	AUE_WAIT4
@@ -1366,6 +1379,7 @@
 #define	LINUX_SYS_AUE_linux_fremovexattr	AUE_NULL
 #define	LINUX_SYS_AUE_linux_tkill	AUE_NULL
 #define	LINUX_SYS_AUE_linux_sys_futex	AUE_NULL
+#define	LINUX_SYS_AUE_linux_sched_getaffinity	AUE_NULL
 #define	LINUX_SYS_AUE_linux_set_thread_area	AUE_NULL
 #define	LINUX_SYS_AUE_linux_get_thread_area	AUE_NULL
 #define	LINUX_SYS_AUE_linux_fadvise64	AUE_NULL

==== //depot/projects/delphij_fork/sys/i386/linux/linux_syscall.h#2 (text+ko) ====

@@ -2,8 +2,8 @@
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/i386/linux/linux_syscall.h,v 1.85 2007/03/29 02:11:46 julian Exp $
- * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.86 2007/02/15 00:54:40 jkim Exp 
+ * $FreeBSD: src/sys/i386/linux/linux_syscall.h,v 1.86 2007/08/28 12:32:01 kib Exp $
+ * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.88 2007/08/28 12:26:35 kib Exp 
  */
 
 #define	LINUX_SYS_exit	1
@@ -228,6 +228,7 @@
 #define	LINUX_SYS_linux_fremovexattr	237
 #define	LINUX_SYS_linux_tkill	238
 #define	LINUX_SYS_linux_sys_futex	240
+#define	LINUX_SYS_linux_sched_getaffinity	242
 #define	LINUX_SYS_linux_set_thread_area	243
 #define	LINUX_SYS_linux_get_thread_area	244
 #define	LINUX_SYS_linux_fadvise64	250

==== //depot/projects/delphij_fork/sys/i386/linux/linux_sysent.c#2 (text+ko) ====

@@ -2,8 +2,8 @@
  * System call switch table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/i386/linux/linux_sysent.c,v 1.92 2007/03/29 02:11:46 julian Exp $
- * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.86 2007/02/15 00:54:40 jkim Exp 
+ * $FreeBSD: src/sys/i386/linux/linux_sysent.c,v 1.93 2007/08/28 12:32:01 kib Exp $
+ * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.88 2007/08/28 12:26:35 kib Exp 
  */
 
 #include <bsm/audit_kevents.h>
@@ -261,7 +261,7 @@
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 239 = linux_sendfile64 */
 	{ AS(linux_sys_futex_args), (sy_call_t *)linux_sys_futex, AUE_NULL, NULL, 0, 0 },	/* 240 = linux_sys_futex */
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 241 = linux_sched_setaffinity */
-	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 242 = linux_sched_getaffinity */
+	{ AS(linux_sched_getaffinity_args), (sy_call_t *)linux_sched_getaffinity, AUE_NULL, NULL, 0, 0 },	/* 242 = linux_sched_getaffinity */
 	{ AS(linux_set_thread_area_args), (sy_call_t *)linux_set_thread_area, AUE_NULL, NULL, 0, 0 },	/* 243 = linux_set_thread_area */
 	{ AS(linux_get_thread_area_args), (sy_call_t *)linux_get_thread_area, AUE_NULL, NULL, 0, 0 },	/* 244 = linux_get_thread_area */
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 245 = linux_io_setup */

==== //depot/projects/delphij_fork/sys/i386/linux/syscalls.master#2 (text+ko) ====

@@ -1,4 +1,4 @@
- $FreeBSD: src/sys/i386/linux/syscalls.master,v 1.87 2007/03/29 02:11:46 julian Exp $
+ $FreeBSD: src/sys/i386/linux/syscalls.master,v 1.88 2007/08/28 12:26:35 kib Exp $
 
 ;	@(#)syscalls.master	8.1 (Berkeley) 7/19/93
 ; System call name/number master file (or rather, slave, from LINUX).
@@ -410,7 +410,8 @@
 240	AUE_NULL	STD	{ int linux_sys_futex(void *uaddr, int op, int val, \
 					struct l_timespec *timeout, void *uaddr2, int val3); }
 241	AUE_NULL	UNIMPL	linux_sched_setaffinity
-242	AUE_NULL	UNIMPL	linux_sched_getaffinity
+242	AUE_NULL	STD	{ int linux_sched_getaffinity(l_pid_t pid, l_uint len, \
+					l_ulong *user_mask_ptr); }
 243	AUE_NULL	STD	{ int linux_set_thread_area(struct l_user_desc *desc); }
 244	AUE_NULL	STD	{ int linux_get_thread_area(struct l_user_desc *desc); }
 245	AUE_NULL	UNIMPL	linux_io_setup

==== //depot/projects/delphij_fork/sys/kern/vfs_syscalls.c#3 (text+ko) ====

@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/vfs_syscalls.c,v 1.441 2007/07/04 22:57:21 peter Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/vfs_syscalls.c,v 1.442 2007/08/28 20:28:11 jhb Exp $");
 
 #include "opt_compat.h"
 #include "opt_mac.h"
@@ -206,6 +206,47 @@
 }
 
 /*
+ * Used by statfs conversion routines to scale the block size up if
+ * necessary so that all of the block counts are <= 'max_size'.  Note
+ * that 'max_size' should be a bitmask, i.e. 2^n - 1 for some non-zero
+ * value of 'n'.
+ */
+void
+statfs_scale_blocks(struct statfs *sf, long max_size)
+{
+	uint64_t count;
+	int shift;
+
+	KASSERT(powerof2(max_size + 1), ("%s: invalid max_size", __func__));
+
+	/*
+	 * Attempt to scale the block counts to give a more accurate
+	 * overview to userland of the ratio of free space to used
+	 * space.  To do this, find the largest block count and compute
+	 * a divisor that lets it fit into a signed integer <= max_size.
+	 */
+	if (sf->f_bavail < 0)
+		count = -sf->f_bavail;
+	else
+		count = sf->f_bavail;
+	count = MAX(sf->f_blocks, MAX(sf->f_bfree, count));
+	if (count <= max_size)
+		return;
+
+	count >>= flsl(max_size);
+	shift = 0;
+	while (count > 0) {
+		shift++;
+		count >>=1;
+	}
+
+	sf->f_bsize <<= shift;
+	sf->f_blocks >>= shift;
+	sf->f_bfree >>= shift;
+	sf->f_bavail >>= shift;
+}
+
+/*
  * Get filesystem statistics.
  */
 #ifndef _SYS_SYSPROTO_H_
@@ -636,12 +677,13 @@
 	struct ostatfs *osp;
 {
 
+	statfs_scale_blocks(nsp, LONG_MAX);
 	bzero(osp, sizeof(*osp));
-	osp->f_bsize = MIN(nsp->f_bsize, LONG_MAX);
+	osp->f_bsize = nsp->f_bsize;
 	osp->f_iosize = MIN(nsp->f_iosize, LONG_MAX);
-	osp->f_blocks = MIN(nsp->f_blocks, LONG_MAX);
-	osp->f_bfree = MIN(nsp->f_bfree, LONG_MAX);
-	osp->f_bavail = MIN(nsp->f_bavail, LONG_MAX);
+	osp->f_blocks = nsp->f_blocks;
+	osp->f_bfree = nsp->f_bfree;
+	osp->f_bavail = nsp->f_bavail;
 	osp->f_files = MIN(nsp->f_files, LONG_MAX);
 	osp->f_ffree = MIN(nsp->f_ffree, LONG_MAX);
 	osp->f_owner = nsp->f_owner;

==== //depot/projects/delphij_fork/sys/sys/mount.h#2 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)mount.h	8.21 (Berkeley) 5/20/95
- * $FreeBSD: src/sys/sys/mount.h,v 1.226 2007/04/22 16:18:10 rwatson Exp $
+ * $FreeBSD: src/sys/sys/mount.h,v 1.227 2007/08/28 20:28:12 jhb Exp $
  */
 
 #ifndef _SYS_MOUNT_H_
@@ -653,6 +653,7 @@
 struct mntarg *mount_argb(struct mntarg *ma, int flag, const char *name);
 struct mntarg *mount_argf(struct mntarg *ma, const char *name, const char *fmt, ...);
 struct mntarg *mount_argsu(struct mntarg *ma, const char *name, const void *val, int len);
+void	statfs_scale_blocks(struct statfs *sf, long max_size);
 struct vfsconf *vfs_byname(const char *);
 struct vfsconf *vfs_byname_kld(const char *, struct thread *td, int *);
 void	vfs_mount_destroy(struct mount *);

==== //depot/projects/delphij_fork/usr.sbin/kbdmap/kbdmap.c#2 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/usr.sbin/kbdmap/kbdmap.c,v 1.5 2007/03/06 09:32:40 kevlo Exp $");
+__FBSDID("$FreeBSD: src/usr.sbin/kbdmap/kbdmap.c,v 1.6 2007/08/27 21:56:42 murray Exp $");
 
 #include <sys/types.h>
 #include <sys/queue.h>
@@ -288,7 +288,7 @@
 	if (!x11)
 		system(kbd_cmd);
 
-	printf("keymap=%s\n", km->keym);
+	fprintf(stderr, "keymap=%s\n", km->keym);
 	free(kbd_cmd);
 }
 


More information about the p4-projects mailing list