Make NFS loadable.

This commit is contained in:
Garrett Wollman 1994-09-22 22:10:49 +00:00
parent d475634fe5
commit e21fa31a8e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=2997
7 changed files with 124 additions and 8 deletions

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_init.c 8.3 (Berkeley) 1/4/94
* $Id: vfs_init.c,v 1.5 1994/09/21 03:46:48 wollman Exp $
* $Id: vfs_init.c,v 1.6 1994/09/22 01:05:09 wollman Exp $
*/
@ -326,3 +326,11 @@ fs_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
/* NOTREACHED */
}
/*
* This goop is here to support a loadable NFS module... grumble...
*/
void (*lease_check) __P((struct vnode *, struct proc *, struct ucred *, int))
= 0;
void (*lease_updatetime) __P((int))
= 0;

View File

@ -52,6 +52,10 @@
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/stat.h>
#ifdef VFS_LKM
#include <sys/sysent.h>
#include <sys/syscall.h>
#endif
#include <nfs/rpcv2.h>
#include <nfs/nfsv2.h>
@ -97,6 +101,13 @@ extern int nqsrv_clockskew;
extern int nqsrv_writeslack;
extern int nqsrv_maxlease;
#ifdef VFS_LKM
struct getfh_args;
extern int getfh(struct proc *, struct getfh_args *, int *);
struct nfssvc_args;
extern int nfssvc(struct proc *, struct nfssvc_args *, int *);
#endif
/*
* Create the header for an rpc request packet
* The hsiz is the size of the rest of the nfs request header.
@ -634,6 +645,20 @@ nfs_init()
nfsreqh.r_prev = nfsreqh.r_next = &nfsreqh;
nfs_timer();
/*
* Set up lease_check and lease_updatetime so that other parts
* of the system can call us, if we are loadable.
*/
lease_check = nfs_lease_check;
lease_updatetime = nfs_lease_updatetime;
vfsconf[MOUNT_NFS]->vfc_refcount++; /* make us non-unloadable */
#ifdef VFS_LKM
sysent[SYS_nfssvc].sy_narg = 2;
sysent[SYS_nfssvc].sy_call = nfssvc;
sysent[SYS_getfh].sy_narg = 2;
sysent[SYS_getfh].sy_call = getfh;
#endif
return (0);
}

View File

@ -52,6 +52,10 @@
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/stat.h>
#ifdef VFS_LKM
#include <sys/sysent.h>
#include <sys/syscall.h>
#endif
#include <nfs/rpcv2.h>
#include <nfs/nfsv2.h>
@ -97,6 +101,13 @@ extern int nqsrv_clockskew;
extern int nqsrv_writeslack;
extern int nqsrv_maxlease;
#ifdef VFS_LKM
struct getfh_args;
extern int getfh(struct proc *, struct getfh_args *, int *);
struct nfssvc_args;
extern int nfssvc(struct proc *, struct nfssvc_args *, int *);
#endif
/*
* Create the header for an rpc request packet
* The hsiz is the size of the rest of the nfs request header.
@ -634,6 +645,20 @@ nfs_init()
nfsreqh.r_prev = nfsreqh.r_next = &nfsreqh;
nfs_timer();
/*
* Set up lease_check and lease_updatetime so that other parts
* of the system can call us, if we are loadable.
*/
lease_check = nfs_lease_check;
lease_updatetime = nfs_lease_updatetime;
vfsconf[MOUNT_NFS]->vfc_refcount++; /* make us non-unloadable */
#ifdef VFS_LKM
sysent[SYS_nfssvc].sy_narg = 2;
sysent[SYS_nfssvc].sy_call = nfssvc;
sysent[SYS_getfh].sy_narg = 2;
sysent[SYS_getfh].sy_call = getfh;
#endif
return (0);
}

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nqnfs.h 8.1 (Berkeley) 6/10/93
* $Id: nqnfs.h,v 1.2 1994/08/02 07:52:28 davidg Exp $
* $Id: nqnfs.h,v 1.3 1994/08/21 06:50:14 paul Exp $
*/
#ifndef _NFS_NQNFS_H_
@ -201,4 +201,9 @@ extern u_long nqfheadhash;
#define NQNFS_TRYLATER 501
#define NQNFS_AUTHERR 502
#ifdef KERNEL
void nfs_lease_check __P((struct vnode *, struct proc *, struct ucred *, int));
void nfs_lease_updatetime __P((int));
#endif
#endif

View File

@ -52,6 +52,10 @@
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/stat.h>
#ifdef VFS_LKM
#include <sys/sysent.h>
#include <sys/syscall.h>
#endif
#include <nfs/rpcv2.h>
#include <nfs/nfsv2.h>
@ -97,6 +101,13 @@ extern int nqsrv_clockskew;
extern int nqsrv_writeslack;
extern int nqsrv_maxlease;
#ifdef VFS_LKM
struct getfh_args;
extern int getfh(struct proc *, struct getfh_args *, int *);
struct nfssvc_args;
extern int nfssvc(struct proc *, struct nfssvc_args *, int *);
#endif
/*
* Create the header for an rpc request packet
* The hsiz is the size of the rest of the nfs request header.
@ -634,6 +645,20 @@ nfs_init()
nfsreqh.r_prev = nfsreqh.r_next = &nfsreqh;
nfs_timer();
/*
* Set up lease_check and lease_updatetime so that other parts
* of the system can call us, if we are loadable.
*/
lease_check = nfs_lease_check;
lease_updatetime = nfs_lease_updatetime;
vfsconf[MOUNT_NFS]->vfc_refcount++; /* make us non-unloadable */
#ifdef VFS_LKM
sysent[SYS_nfssvc].sy_narg = 2;
sysent[SYS_nfssvc].sy_call = nfssvc;
sysent[SYS_getfh].sy_narg = 2;
sysent[SYS_getfh].sy_call = getfh;
#endif
return (0);
}

View File

@ -52,6 +52,10 @@
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/stat.h>
#ifdef VFS_LKM
#include <sys/sysent.h>
#include <sys/syscall.h>
#endif
#include <nfs/rpcv2.h>
#include <nfs/nfsv2.h>
@ -97,6 +101,13 @@ extern int nqsrv_clockskew;
extern int nqsrv_writeslack;
extern int nqsrv_maxlease;
#ifdef VFS_LKM
struct getfh_args;
extern int getfh(struct proc *, struct getfh_args *, int *);
struct nfssvc_args;
extern int nfssvc(struct proc *, struct nfssvc_args *, int *);
#endif
/*
* Create the header for an rpc request packet
* The hsiz is the size of the rest of the nfs request header.
@ -634,6 +645,20 @@ nfs_init()
nfsreqh.r_prev = nfsreqh.r_next = &nfsreqh;
nfs_timer();
/*
* Set up lease_check and lease_updatetime so that other parts
* of the system can call us, if we are loadable.
*/
lease_check = nfs_lease_check;
lease_updatetime = nfs_lease_updatetime;
vfsconf[MOUNT_NFS]->vfc_refcount++; /* make us non-unloadable */
#ifdef VFS_LKM
sysent[SYS_nfssvc].sy_narg = 2;
sysent[SYS_nfssvc].sy_call = nfssvc;
sysent[SYS_getfh].sy_narg = 2;
sysent[SYS_getfh].sy_call = getfh;
#endif
return (0);
}

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)vnode.h 8.7 (Berkeley) 2/4/94
* $Id: vnode.h,v 1.6 1994/09/19 15:41:57 dfr Exp $
* $Id: vnode.h,v 1.7 1994/09/21 03:47:34 wollman Exp $
*/
#ifndef _SYS_VNODE_H_
@ -230,15 +230,18 @@ extern struct vattr va_null; /* predefined null vattr structure */
#define LEASE_READ 0x1 /* Check lease for readers */
#define LEASE_WRITE 0x2 /* Check lease for modifiers */
extern void (*lease_check) __P((struct vnode *vp, struct proc *p,
struct ucred *ucred, int flag));
extern void (*lease_updatetime) __P((int deltat));
#ifdef NFS
void lease_check __P((struct vnode *vp, struct proc *p,
struct ucred *ucred, int flag));
void lease_updatetime __P((int deltat));
#define LEASE_CHECK(vp, p, cred, flag) lease_check((vp), (p), (cred), (flag))
#define LEASE_UPDATETIME(dt) lease_updatetime(dt)
#else
#define LEASE_CHECK(vp, p, cred, flag)
#define LEASE_UPDATETIME(dt)
#define LEASE_CHECK(vp, p, cred, flag) \
do { if(lease_check) lease_check((vp), (p), (cred), (flag)); } while(0)
#define LEASE_UPDATETIME(dt) \
do { if(lease_updatetime) lease_updatetime(dt); } while(0)
#endif /* NFS */
#endif /* KERNEL */