NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/42246: COMPAT_50 for LFS
>Number: 42246
>Category: kern
>Synopsis: COMPAT_50 for LFS
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Oct 29 16:25:00 +0000 2009
>Originator: NAKAJIMA Yoshihiro
>Release: NetBSD-current/20091023
>Organization:
>Environment:
System: NetBSD vajra 5.99.21 NetBSD 5.99.21 (VAJRA) #3: Thu Oct 29 00:21:13 JST
2009 nakayosh@vajra:/usr/src/sys/arch/i386/compile/VAJRA i386
Architecture: i386
Machine: i386
>Description:
NetBSD-current doesn't support COMPAT_50 for LFS.
>How-To-Repeat:
>Fix:
This provides COMPAT_50 for LFS,
allows disabling COMPAT_[2-4]0,
and doesn't provide COMPAT_1*.
Date: Thu Oct 29 23:08:29 JST 2009
diff -u src/sys/ufs/lfs/lfs.h.ORIG src/sys/ufs/lfs/lfs.h
--- src/sys/ufs/lfs/lfs.h.ORIG 2009-07-19 12:39:14.000000000 +0900
+++ src/sys/ufs/lfs/lfs.h 2009-10-29 23:01:27.000000000 +0900
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs.h,v 1.128 2009/07/19 03:39:14 dholland Exp $ */
+/* $NetBSD$ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -66,6 +66,9 @@
#include <sys/mutex.h>
#include <sys/queue.h>
#include <sys/condvar.h>
+#ifdef COMPAT_50
+#include <compat/sys/time.h>
+#endif
/*
* Compile-time options for LFS.
@@ -1081,8 +1084,8 @@
int blkcnt; /* number of blocks */
};
-#define LFCNSEGWAITALL _FCNR_FSPRIV('L', 0, struct timeval)
-#define LFCNSEGWAIT _FCNR_FSPRIV('L', 1, struct timeval)
+#define LFCNSEGWAITALL _FCNR_FSPRIV('L', 14, struct timeval)
+#define LFCNSEGWAIT _FCNR_FSPRIV('L', 15, struct timeval)
#define LFCNBMAPV _FCNRW_FSPRIV('L', 2, struct lfs_fcntl_markv)
#define LFCNMARKV _FCNRW_FSPRIV('L', 3, struct lfs_fcntl_markv)
#define LFCNRECLAIM _FCNO_FSPRIV('L', 4)
@@ -1101,12 +1104,22 @@
# define LFS_WRAP_WAITING 0x1
#define LFCNWRAPSTATUS _FCNW_FSPRIV('L', 13, int)
/* Compat */
-#define LFCNSEGWAITALL_COMPAT _FCNW_FSPRIV('L', 0, struct timeval)
-#define LFCNSEGWAIT_COMPAT _FCNW_FSPRIV('L', 1, struct timeval)
+#ifdef COMPAT_20
+#define LFCNSEGWAITALL_COMPAT _FCNW_FSPRIV('L', 0, struct timeval50)
+#define LFCNSEGWAIT_COMPAT _FCNW_FSPRIV('L', 1, struct timeval50)
+#endif
+#ifdef COMPAT_30
#define LFCNIFILEFH_COMPAT _FCNW_FSPRIV('L', 5, struct lfs_fhandle)
+#endif
+#ifdef COMPAT_40
#define LFCNIFILEFH_COMPAT2 _FCN_FSPRIV(F_FSOUT, 'L', 11, 32)
#define LFCNWRAPSTOP_COMPAT _FCNO_FSPRIV('L', 9)
#define LFCNWRAPGO_COMPAT _FCNO_FSPRIV('L', 10)
+#endif
+#ifdef COMPAT_50
+#define LFCNSEGWAITALL_COMPAT_50 _FCNR_FSPRIV('L', 0, struct timeval50)
+#define LFCNSEGWAIT_COMPAT_50 _FCNR_FSPRIV('L', 1, struct timeval50)
+#endif
#ifdef _KERNEL
/* XXX MP */
diff -u src/sys/ufs/lfs/lfs_vnops.c.ORIG src/sys/ufs/lfs/lfs_vnops.c
--- src/sys/ufs/lfs/lfs_vnops.c.ORIG 2009-05-08 05:32:51.000000000 +0900
+++ src/sys/ufs/lfs/lfs_vnops.c 2009-10-29 23:04:38.000000000 +0900
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_vnops.c,v 1.221 2009/05/07 20:32:51 elad Exp $ */
+/* $NetBSD$ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -1426,6 +1426,9 @@
int a_fflag;
kauth_cred_t a_cred;
} */ *ap = v;
+#ifdef COMPAT_50
+ struct timeval tv;
+#endif
struct timeval *tvp;
BLOCK_INFO *blkiov;
CLEANERINFO *cip;
@@ -1463,13 +1466,31 @@
error = 0;
switch ((int)ap->a_command) {
- case LFCNSEGWAITALL:
+#ifdef COMPAT_50
+ case LFCNSEGWAITALL_COMPAT_50:
+#ifdef COMPAT_20
case LFCNSEGWAITALL_COMPAT:
+#endif
fsidp = NULL;
/* FALLSTHROUGH */
- case LFCNSEGWAIT:
+ case LFCNSEGWAIT_COMPAT_50:
+#ifdef COMPAT_20
case LFCNSEGWAIT_COMPAT:
+#endif
+ {
+ struct timeval50 *tvp50
+ = (struct timeval50 *)ap->a_data;
+ timeval50_to_timeval(tvp50, &tv);
+ tvp = &tv;
+ }
+ goto segwait_common;
+#endif /* COMPAT_50 */
+ case LFCNSEGWAITALL:
+ fsidp = NULL;
+ /* FALLSTHROUGH */
+ case LFCNSEGWAIT:
tvp = (struct timeval *)ap->a_data;
+segwait_common:
mutex_enter(&lfs_lock);
++fs->lfs_sleepers;
mutex_exit(&lfs_lock);
@@ -1553,7 +1574,9 @@
return lfs_vptofh(fs->lfs_ivnode, &(fhp->fh_fid), &fh_size);
#endif
+#ifdef COMPAT_40
case LFCNIFILEFH_COMPAT2:
+#endif
case LFCNIFILEFH:
/* Return the filehandle of the Ifile */
fhp = (struct fhandle *)ap->a_data;
@@ -1583,7 +1606,9 @@
return lfs_resize_fs(fs, *(int *)ap->a_data);
case LFCNWRAPSTOP:
+#ifdef COMPAT_40
case LFCNWRAPSTOP_COMPAT:
+#endif
/*
* Hold lfs_newseg at segment 0; if requested, sleep until
* the filesystem wraps around. To support external agents
@@ -1601,8 +1626,11 @@
if (fs->lfs_nowrap == 0)
log(LOG_NOTICE, "%s: disabled log wrap\n",
fs->lfs_fsmnt);
++fs->lfs_nowrap;
- if (*(int *)ap->a_data == 1 ||
- ap->a_command == LFCNWRAPSTOP_COMPAT) {
+ if (*(int *)ap->a_data == 1
+#ifdef COMPAT_40
+ || ap->a_command == LFCNWRAPSTOP_COMPAT
+#endif
+ ) {
log(LOG_NOTICE, "LFCNSTOPWRAP waiting for log wrap\n");
error = mtsleep(&fs->lfs_nowrap, PCATCH | PUSER,
"segwrap", 0, &lfs_lock);
@@ -1615,7 +1643,9 @@
return 0;
case LFCNWRAPGO:
+#ifdef COMPAT_40
case LFCNWRAPGO_COMPAT:
+#endif
/*
* Having done its work, the agent wakes up the writer.
* If the argument is 1, it sleeps until a new segment
@@ -1623,8 +1653,10 @@
*/
mutex_enter(&lfs_lock);
error = lfs_wrapgo(fs, VTOI(ap->a_vp),
- (ap->a_command == LFCNWRAPGO_COMPAT ? 1 :
- *((int *)ap->a_data)));
+#ifdef COMPAT_40
+ ap->a_command == LFCNWRAPGO_COMPAT ? 1 :
+#endif
+ *((int *)ap->a_data));
mutex_exit(&lfs_lock);
return error;
Home |
Main Index |
Thread Index |
Old Index