Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/lfs PR/42246: NAKAJIMA Yoshihiro: provide COMPAT_50 ...



details:   https://anonhg.NetBSD.org/src/rev/74001d8ecce0
branches:  trunk
changeset: 748643:74001d8ecce0
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Oct 29 17:10:32 2009 +0000

description:
PR/42246: NAKAJIMA Yoshihiro: provide COMPAT_50 for LFS

diffstat:

 sys/ufs/lfs/lfs.h       |  23 ++++++++++++++++++-----
 sys/ufs/lfs/lfs_vnops.c |  48 ++++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 58 insertions(+), 13 deletions(-)

diffs (174 lines):

diff -r b9c6c70d6a26 -r 74001d8ecce0 sys/ufs/lfs/lfs.h
--- a/sys/ufs/lfs/lfs.h Thu Oct 29 14:49:40 2009 +0000
+++ b/sys/ufs/lfs/lfs.h Thu Oct 29 17:10:32 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs.h,v 1.128 2009/07/19 03:39:14 dholland Exp $       */
+/*     $NetBSD: lfs.h,v 1.129 2009/10/29 17:10:32 christos Exp $       */
 
 /*-
  * 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 -r b9c6c70d6a26 -r 74001d8ecce0 sys/ufs/lfs/lfs_vnops.c
--- a/sys/ufs/lfs/lfs_vnops.c   Thu Oct 29 14:49:40 2009 +0000
+++ b/sys/ufs/lfs/lfs_vnops.c   Thu Oct 29 17:10:32 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_vnops.c,v 1.221 2009/05/07 20:32:51 elad Exp $     */
+/*     $NetBSD: lfs_vnops.c,v 1.222 2009/10/29 17:10:32 christos Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.221 2009/05/07 20:32:51 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.222 2009/10/29 17:10:32 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -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) {
+#ifdef COMPAT_50
+           case LFCNSEGWAITALL_COMPAT_50:
+#ifdef COMPAT_20
+           case LFCNSEGWAITALL_COMPAT:
+#endif
+               fsidp = NULL;
+               /* FALLSTHROUGH */
+           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:
-           case LFCNSEGWAITALL_COMPAT:
                fsidp = NULL;
                /* FALLSTHROUGH */
            case LFCNSEGWAIT:
-           case LFCNSEGWAIT_COMPAT:
                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