PR/42246: NAKAJIMA Yoshihiro: provide COMPAT_50 for LFS
This commit is contained in:
parent
66f67ed664
commit
fc0e85c95e
@ -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 @@ struct lfs_fcntl_markv {
|
||||
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 @@ struct lfs_fhandle {
|
||||
# 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 */
|
||||
|
@ -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 @@ lfs_fcntl(void *v)
|
||||
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 @@ lfs_fcntl(void *v)
|
||||
|
||||
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_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:
|
||||
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 @@ lfs_fcntl(void *v)
|
||||
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 @@ lfs_fcntl(void *v)
|
||||
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 @@ lfs_fcntl(void *v)
|
||||
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 @@ lfs_fcntl(void *v)
|
||||
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 @@ lfs_fcntl(void *v)
|
||||
*/
|
||||
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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user