General modernization of coda:
- Ditch NVCODA - Don't use a static major - Don't declare functions extern Reviewed by: peter
This commit is contained in:
parent
77972e1ec2
commit
eeddbfb0fa
@ -109,7 +109,7 @@ struct cnode {
|
||||
struct vattr c_vattr; /* attributes */
|
||||
char *c_symlink; /* pointer to symbolic link */
|
||||
u_short c_symlen; /* length of symbolic link */
|
||||
struct cdev *c_device; /* associated vnode device */
|
||||
struct cdev *c_device; /* associated vnode device */
|
||||
ino_t c_inode; /* associated vnode inode */
|
||||
struct cnode *c_next; /* links if on NetBSD machine */
|
||||
};
|
||||
@ -153,10 +153,11 @@ struct coda_mntinfo {
|
||||
struct vnode *mi_rootvp;
|
||||
struct mount *mi_vfsp;
|
||||
struct vcomm mi_vcomm;
|
||||
struct cdev *dev;
|
||||
struct cdev *dev;
|
||||
int mi_started;
|
||||
LIST_ENTRY(coda_mntinfo) mi_list;
|
||||
};
|
||||
extern struct coda_mntinfo coda_mnttbl[]; /* indexed by minor device number */
|
||||
struct coda_mntinfo *dev2coda_mntinfo(struct cdev *dev);
|
||||
|
||||
/*
|
||||
* vfs pointer to mount info
|
||||
@ -188,20 +189,20 @@ enum dc_status {
|
||||
};
|
||||
|
||||
/* cfs_psdev.h */
|
||||
extern int coda_call(struct coda_mntinfo *mntinfo, int inSize, int *outSize, caddr_t buffer);
|
||||
int coda_call(struct coda_mntinfo *mntinfo, int inSize, int *outSize, caddr_t buffer);
|
||||
extern int coda_kernel_version;
|
||||
|
||||
/* cfs_subr.h */
|
||||
extern int handleDownCall(int opcode, union outputArgs *out);
|
||||
extern void coda_unmounting(struct mount *whoIam);
|
||||
extern int coda_vmflush(struct cnode *cp);
|
||||
int handleDownCall(int opcode, union outputArgs *out);
|
||||
void coda_unmounting(struct mount *whoIam);
|
||||
int coda_vmflush(struct cnode *cp);
|
||||
|
||||
/* cfs_vnodeops.h */
|
||||
extern struct cnode *make_coda_node(CodaFid *fid, struct mount *vfsp, short type);
|
||||
extern int coda_vnodeopstats_init(void);
|
||||
struct cnode *make_coda_node(CodaFid *fid, struct mount *vfsp, short type);
|
||||
int coda_vnodeopstats_init(void);
|
||||
|
||||
/* coda_vfsops.h */
|
||||
extern struct mount *devtomp(struct cdev *dev);
|
||||
struct mount *devtomp(struct cdev *dev);
|
||||
|
||||
/* sigh */
|
||||
#define CODA_RDWR ((u_long) 31)
|
||||
|
@ -31,8 +31,6 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "opt_coda.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/conf.h>
|
||||
@ -52,20 +50,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <coda/coda_vnops.h>
|
||||
#include <coda/coda_psdev.h>
|
||||
|
||||
/*
|
||||
From: "Jordan K. Hubbard" <jkh@time.cdrom.com>
|
||||
Subject: Re: New 3.0 SNAPshot CDROM about ready for production..
|
||||
To: "Robert.V.Baron" <rvb@GLUCK.CODA.CS.CMU.EDU>
|
||||
Date: Fri, 20 Feb 1998 15:57:01 -0800
|
||||
|
||||
> Also I need a character device major number. (and might want to reserve
|
||||
> a block of 10 syscalls.)
|
||||
|
||||
Just one char device number? No block devices? Very well, cdev 93 is yours!
|
||||
*/
|
||||
|
||||
#define VC_DEV_NO 93
|
||||
|
||||
static struct cdevsw codadevsw = {
|
||||
.d_version = D_VERSION,
|
||||
.d_flags = D_NEEDGIANT,
|
||||
@ -76,21 +60,39 @@ static struct cdevsw codadevsw = {
|
||||
.d_ioctl = vc_nb_ioctl,
|
||||
.d_poll = vc_nb_poll,
|
||||
.d_name = "Coda",
|
||||
.d_maj = VC_DEV_NO,
|
||||
};
|
||||
|
||||
static eventhandler_tag clonetag;
|
||||
|
||||
static LIST_HEAD(, coda_mntinfo) coda_mnttbl;
|
||||
|
||||
int vcdebug = 1;
|
||||
#define VCDEBUG if (vcdebug) printf
|
||||
|
||||
/* for DEVFS, using bpf & tun drivers as examples*/
|
||||
static void coda_fbsd_clone(void *arg, char *name, int namelen,
|
||||
struct cdev **dev);
|
||||
|
||||
static int
|
||||
codadev_modevent(module_t mod, int type, void *data)
|
||||
{
|
||||
struct coda_mntinfo *mnt;
|
||||
|
||||
switch (type) {
|
||||
case MOD_LOAD:
|
||||
LIST_INIT(&coda_mnttbl);
|
||||
clonetag = EVENTHANDLER_REGISTER(dev_clone, coda_fbsd_clone,
|
||||
0, 1000);
|
||||
break;
|
||||
case MOD_UNLOAD:
|
||||
return (EBUSY);
|
||||
EVENTHANDLER_DEREGISTER(dev_clone, clonetag);
|
||||
while ((mnt = LIST_FIRST(&coda_mnttbl)) != NULL) {
|
||||
LIST_REMOVE(mnt, mi_list);
|
||||
destroy_dev(mnt->dev);
|
||||
free(mnt, M_CODA);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
@ -101,7 +103,7 @@ static moduledata_t codadev_mod = {
|
||||
codadev_modevent,
|
||||
NULL
|
||||
};
|
||||
DECLARE_MODULE(codadev, codadev_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+VC_DEV_NO);
|
||||
DECLARE_MODULE(codadev, codadev_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
|
||||
|
||||
int
|
||||
coda_fbsd_getpages(v)
|
||||
@ -170,14 +172,6 @@ printf("error = %d\n", error);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* for DEVFS, using bpf & tun drivers as examples*/
|
||||
static void coda_fbsd_drvinit(void *unused);
|
||||
static void coda_fbsd_drvuninit(void *unused);
|
||||
static void coda_fbsd_clone(void *arg, char *name, int namelen, struct cdev **dev);
|
||||
|
||||
static eventhandler_tag clonetag;
|
||||
|
||||
static void coda_fbsd_clone(arg, name, namelen, dev)
|
||||
void *arg;
|
||||
char *name;
|
||||
@ -185,6 +179,7 @@ static void coda_fbsd_clone(arg, name, namelen, dev)
|
||||
struct cdev **dev;
|
||||
{
|
||||
int u;
|
||||
struct coda_mntinfo *mnt;
|
||||
|
||||
if (*dev != NULL)
|
||||
return;
|
||||
@ -192,31 +187,19 @@ static void coda_fbsd_clone(arg, name, namelen, dev)
|
||||
return;
|
||||
|
||||
*dev = make_dev(&codadevsw,unit2minor(u),UID_ROOT,GID_WHEEL,0600,"cfs%d",u);
|
||||
coda_mnttbl[unit2minor(u)].dev = *dev;
|
||||
|
||||
mnt = malloc(sizeof(struct coda_mntinfo), M_CODA, M_WAITOK|M_ZERO);
|
||||
LIST_INSERT_HEAD(&coda_mnttbl, mnt, mi_list);
|
||||
}
|
||||
|
||||
static void coda_fbsd_drvinit(unused)
|
||||
void *unused;
|
||||
struct coda_mntinfo *
|
||||
dev2coda_mntinfo(struct cdev *dev)
|
||||
{
|
||||
int i;
|
||||
struct coda_mntinfo *mnt;
|
||||
|
||||
clonetag = EVENTHANDLER_REGISTER(dev_clone,coda_fbsd_clone,0,1000);
|
||||
for(i=0;i<NVCODA;i++)
|
||||
coda_mnttbl[i].dev = NULL;
|
||||
LIST_FOREACH(mnt, &coda_mnttbl, mi_list) {
|
||||
if (mnt->dev == dev)
|
||||
break;
|
||||
}
|
||||
|
||||
return mnt;
|
||||
}
|
||||
|
||||
static void coda_fbsd_drvuninit(unused)
|
||||
void *unused;
|
||||
{
|
||||
int i;
|
||||
|
||||
EVENTHANDLER_DEREGISTER(dev_clone,clonetag);
|
||||
for(i=0;i<NVCODA;i++)
|
||||
if(coda_mnttbl[i].dev)
|
||||
destroy_dev(coda_mnttbl[i].dev);
|
||||
}
|
||||
|
||||
SYSINIT(coda_fbsd_dev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+VC_DEV_NO,coda_fbsd_drvinit,NULL);
|
||||
|
||||
SYSUNINIT(coda_fbsd_dev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+VC_DEV_NO,coda_fbsd_drvuninit,NULL);
|
||||
|
@ -54,8 +54,6 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
extern int coda_nc_initialized; /* Set if cache has been initialized */
|
||||
|
||||
#include "opt_coda.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/ioccom.h>
|
||||
@ -122,17 +120,16 @@ vc_nb_open(dev, flag, mode, td)
|
||||
int mode;
|
||||
struct thread *td; /* NetBSD only */
|
||||
{
|
||||
register struct vcomm *vcp;
|
||||
struct vcomm *vcp;
|
||||
struct coda_mntinfo *mnt;
|
||||
|
||||
ENTRY;
|
||||
|
||||
if (minor(dev) >= NVCODA || minor(dev) < 0)
|
||||
return(ENXIO);
|
||||
|
||||
if (!coda_nc_initialized)
|
||||
coda_nc_init();
|
||||
|
||||
vcp = &coda_mnttbl[minor(dev)].mi_vcomm;
|
||||
mnt = dev2coda_mntinfo(dev);
|
||||
vcp = &mnt->mi_vcomm;
|
||||
if (VC_OPEN(vcp))
|
||||
return(EBUSY);
|
||||
|
||||
@ -141,8 +138,8 @@ vc_nb_open(dev, flag, mode, td)
|
||||
INIT_QUEUE(vcp->vc_replys);
|
||||
MARK_VC_OPEN(vcp);
|
||||
|
||||
coda_mnttbl[minor(dev)].mi_vfsp = NULL;
|
||||
coda_mnttbl[minor(dev)].mi_rootvp = NULL;
|
||||
mnt->mi_vfsp = NULL;
|
||||
mnt->mi_rootvp = NULL;
|
||||
|
||||
return(0);
|
||||
}
|
||||
@ -161,10 +158,7 @@ vc_nb_close (dev, flag, mode, td)
|
||||
|
||||
ENTRY;
|
||||
|
||||
if (minor(dev) >= NVCODA || minor(dev) < 0)
|
||||
return(ENXIO);
|
||||
|
||||
mi = &coda_mnttbl[minor(dev)];
|
||||
mi = dev2coda_mntinfo(dev);
|
||||
vcp = &(mi->mi_vcomm);
|
||||
|
||||
if (!VC_OPEN(vcp))
|
||||
@ -243,10 +237,7 @@ vc_nb_read(dev, uiop, flag)
|
||||
|
||||
ENTRY;
|
||||
|
||||
if (minor(dev) >= NVCODA || minor(dev) < 0)
|
||||
return(ENXIO);
|
||||
|
||||
vcp = &coda_mnttbl[minor(dev)].mi_vcomm;
|
||||
vcp = &dev2coda_mntinfo(dev)->mi_vcomm;
|
||||
/* Get message at head of request queue. */
|
||||
if (EMPTY(vcp->vc_requests))
|
||||
return(0); /* Nothing to read */
|
||||
@ -301,10 +292,7 @@ vc_nb_write(dev, uiop, flag)
|
||||
|
||||
ENTRY;
|
||||
|
||||
if (minor(dev) >= NVCODA || minor(dev) < 0)
|
||||
return(ENXIO);
|
||||
|
||||
vcp = &coda_mnttbl[minor(dev)].mi_vcomm;
|
||||
vcp = &dev2coda_mntinfo(dev)->mi_vcomm;
|
||||
|
||||
/* Peek at the opcode, unique without transfering the data. */
|
||||
uiop->uio_rw = UIO_WRITE;
|
||||
@ -450,10 +438,7 @@ vc_nb_poll(dev, events, td)
|
||||
|
||||
ENTRY;
|
||||
|
||||
if (minor(dev) >= NVCODA || minor(dev) < 0)
|
||||
return(ENXIO);
|
||||
|
||||
vcp = &coda_mnttbl[minor(dev)].mi_vcomm;
|
||||
vcp = &dev2coda_mntinfo(dev)->mi_vcomm;
|
||||
|
||||
event_msk = events & (POLLIN|POLLRDNORM);
|
||||
if (!event_msk)
|
||||
|
@ -43,8 +43,6 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "opt_coda.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/conf.h>
|
||||
@ -69,7 +67,6 @@ int coda_vfsop_print_entry = 0;
|
||||
#define ENTRY if(coda_vfsop_print_entry) myprintf(("Entered %s\n",__func__))
|
||||
|
||||
struct vnode *coda_ctlvp;
|
||||
struct coda_mntinfo coda_mnttbl[NVCODA]; /* indexed by minor device number */
|
||||
|
||||
/* structure to keep statistics of internally generated/satisfied calls */
|
||||
|
||||
@ -161,15 +158,10 @@ coda_omount(vfsp, path, data, td)
|
||||
return(ENXIO);
|
||||
}
|
||||
|
||||
if (minor(dev) >= NVCODA || minor(dev) < 0) {
|
||||
MARK_INT_FAIL(CODA_MOUNT_STATS);
|
||||
return(ENXIO);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the mount record and link it to the vfs struct
|
||||
*/
|
||||
mi = &coda_mnttbl[minor(dev)];
|
||||
mi = dev2coda_mntinfo(dev);
|
||||
|
||||
if (!VC_OPEN(&mi->mi_vcomm)) {
|
||||
MARK_INT_FAIL(CODA_MOUNT_STATS);
|
||||
|
@ -821,7 +821,6 @@ device vcoda #coda minicache <-> venus comm.
|
||||
# Use the old Coda 5.x venus<->kernel interface instead of the new
|
||||
# realms-aware 6.x protocol.
|
||||
#options CODA_COMPAT_5
|
||||
options NVCODA=4
|
||||
|
||||
#
|
||||
# Add support for the EXT2FS filesystem of Linux fame. Be a bit
|
||||
|
@ -56,7 +56,7 @@
|
||||
87 wfd ATAPI floppy client of "wd"
|
||||
90 wst ATAPI tape client of "wd"
|
||||
92 *bktr Bt848 video capture driver (hasty@star-gate.com)
|
||||
93 *coda CODA filesystem.
|
||||
93 coda CODA filesystem.
|
||||
96 altq alternate queueing (including cbq, red, wfq)
|
||||
98 loe Loopback pseudo-ethernet (sbabkin@dcn.att.com)
|
||||
99 *ct Cronyx Tau-ISA serial adapters (driver name "ctau")
|
||||
|
@ -60,7 +60,6 @@ ADAPTIVE_GIANT opt_adaptive_mutexes.h
|
||||
NO_ADAPTIVE_MUTEXES opt_adaptive_mutexes.h
|
||||
ALQ
|
||||
CODA_COMPAT_5 opt_coda.h
|
||||
NVCODA opt_coda.h
|
||||
COMPAT_43 opt_compat.h
|
||||
COMPAT_FREEBSD4 opt_compat.h
|
||||
COMPILING_LINT opt_global.h
|
||||
|
@ -109,7 +109,7 @@ struct cnode {
|
||||
struct vattr c_vattr; /* attributes */
|
||||
char *c_symlink; /* pointer to symbolic link */
|
||||
u_short c_symlen; /* length of symbolic link */
|
||||
struct cdev *c_device; /* associated vnode device */
|
||||
struct cdev *c_device; /* associated vnode device */
|
||||
ino_t c_inode; /* associated vnode inode */
|
||||
struct cnode *c_next; /* links if on NetBSD machine */
|
||||
};
|
||||
@ -153,10 +153,11 @@ struct coda_mntinfo {
|
||||
struct vnode *mi_rootvp;
|
||||
struct mount *mi_vfsp;
|
||||
struct vcomm mi_vcomm;
|
||||
struct cdev *dev;
|
||||
struct cdev *dev;
|
||||
int mi_started;
|
||||
LIST_ENTRY(coda_mntinfo) mi_list;
|
||||
};
|
||||
extern struct coda_mntinfo coda_mnttbl[]; /* indexed by minor device number */
|
||||
struct coda_mntinfo *dev2coda_mntinfo(struct cdev *dev);
|
||||
|
||||
/*
|
||||
* vfs pointer to mount info
|
||||
@ -188,20 +189,20 @@ enum dc_status {
|
||||
};
|
||||
|
||||
/* cfs_psdev.h */
|
||||
extern int coda_call(struct coda_mntinfo *mntinfo, int inSize, int *outSize, caddr_t buffer);
|
||||
int coda_call(struct coda_mntinfo *mntinfo, int inSize, int *outSize, caddr_t buffer);
|
||||
extern int coda_kernel_version;
|
||||
|
||||
/* cfs_subr.h */
|
||||
extern int handleDownCall(int opcode, union outputArgs *out);
|
||||
extern void coda_unmounting(struct mount *whoIam);
|
||||
extern int coda_vmflush(struct cnode *cp);
|
||||
int handleDownCall(int opcode, union outputArgs *out);
|
||||
void coda_unmounting(struct mount *whoIam);
|
||||
int coda_vmflush(struct cnode *cp);
|
||||
|
||||
/* cfs_vnodeops.h */
|
||||
extern struct cnode *make_coda_node(CodaFid *fid, struct mount *vfsp, short type);
|
||||
extern int coda_vnodeopstats_init(void);
|
||||
struct cnode *make_coda_node(CodaFid *fid, struct mount *vfsp, short type);
|
||||
int coda_vnodeopstats_init(void);
|
||||
|
||||
/* coda_vfsops.h */
|
||||
extern struct mount *devtomp(struct cdev *dev);
|
||||
struct mount *devtomp(struct cdev *dev);
|
||||
|
||||
/* sigh */
|
||||
#define CODA_RDWR ((u_long) 31)
|
||||
|
@ -31,8 +31,6 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "opt_coda.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/conf.h>
|
||||
@ -52,20 +50,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <coda/coda_vnops.h>
|
||||
#include <coda/coda_psdev.h>
|
||||
|
||||
/*
|
||||
From: "Jordan K. Hubbard" <jkh@time.cdrom.com>
|
||||
Subject: Re: New 3.0 SNAPshot CDROM about ready for production..
|
||||
To: "Robert.V.Baron" <rvb@GLUCK.CODA.CS.CMU.EDU>
|
||||
Date: Fri, 20 Feb 1998 15:57:01 -0800
|
||||
|
||||
> Also I need a character device major number. (and might want to reserve
|
||||
> a block of 10 syscalls.)
|
||||
|
||||
Just one char device number? No block devices? Very well, cdev 93 is yours!
|
||||
*/
|
||||
|
||||
#define VC_DEV_NO 93
|
||||
|
||||
static struct cdevsw codadevsw = {
|
||||
.d_version = D_VERSION,
|
||||
.d_flags = D_NEEDGIANT,
|
||||
@ -76,21 +60,39 @@ static struct cdevsw codadevsw = {
|
||||
.d_ioctl = vc_nb_ioctl,
|
||||
.d_poll = vc_nb_poll,
|
||||
.d_name = "Coda",
|
||||
.d_maj = VC_DEV_NO,
|
||||
};
|
||||
|
||||
static eventhandler_tag clonetag;
|
||||
|
||||
static LIST_HEAD(, coda_mntinfo) coda_mnttbl;
|
||||
|
||||
int vcdebug = 1;
|
||||
#define VCDEBUG if (vcdebug) printf
|
||||
|
||||
/* for DEVFS, using bpf & tun drivers as examples*/
|
||||
static void coda_fbsd_clone(void *arg, char *name, int namelen,
|
||||
struct cdev **dev);
|
||||
|
||||
static int
|
||||
codadev_modevent(module_t mod, int type, void *data)
|
||||
{
|
||||
struct coda_mntinfo *mnt;
|
||||
|
||||
switch (type) {
|
||||
case MOD_LOAD:
|
||||
LIST_INIT(&coda_mnttbl);
|
||||
clonetag = EVENTHANDLER_REGISTER(dev_clone, coda_fbsd_clone,
|
||||
0, 1000);
|
||||
break;
|
||||
case MOD_UNLOAD:
|
||||
return (EBUSY);
|
||||
EVENTHANDLER_DEREGISTER(dev_clone, clonetag);
|
||||
while ((mnt = LIST_FIRST(&coda_mnttbl)) != NULL) {
|
||||
LIST_REMOVE(mnt, mi_list);
|
||||
destroy_dev(mnt->dev);
|
||||
free(mnt, M_CODA);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
@ -101,7 +103,7 @@ static moduledata_t codadev_mod = {
|
||||
codadev_modevent,
|
||||
NULL
|
||||
};
|
||||
DECLARE_MODULE(codadev, codadev_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+VC_DEV_NO);
|
||||
DECLARE_MODULE(codadev, codadev_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
|
||||
|
||||
int
|
||||
coda_fbsd_getpages(v)
|
||||
@ -170,14 +172,6 @@ printf("error = %d\n", error);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* for DEVFS, using bpf & tun drivers as examples*/
|
||||
static void coda_fbsd_drvinit(void *unused);
|
||||
static void coda_fbsd_drvuninit(void *unused);
|
||||
static void coda_fbsd_clone(void *arg, char *name, int namelen, struct cdev **dev);
|
||||
|
||||
static eventhandler_tag clonetag;
|
||||
|
||||
static void coda_fbsd_clone(arg, name, namelen, dev)
|
||||
void *arg;
|
||||
char *name;
|
||||
@ -185,6 +179,7 @@ static void coda_fbsd_clone(arg, name, namelen, dev)
|
||||
struct cdev **dev;
|
||||
{
|
||||
int u;
|
||||
struct coda_mntinfo *mnt;
|
||||
|
||||
if (*dev != NULL)
|
||||
return;
|
||||
@ -192,31 +187,19 @@ static void coda_fbsd_clone(arg, name, namelen, dev)
|
||||
return;
|
||||
|
||||
*dev = make_dev(&codadevsw,unit2minor(u),UID_ROOT,GID_WHEEL,0600,"cfs%d",u);
|
||||
coda_mnttbl[unit2minor(u)].dev = *dev;
|
||||
|
||||
mnt = malloc(sizeof(struct coda_mntinfo), M_CODA, M_WAITOK|M_ZERO);
|
||||
LIST_INSERT_HEAD(&coda_mnttbl, mnt, mi_list);
|
||||
}
|
||||
|
||||
static void coda_fbsd_drvinit(unused)
|
||||
void *unused;
|
||||
struct coda_mntinfo *
|
||||
dev2coda_mntinfo(struct cdev *dev)
|
||||
{
|
||||
int i;
|
||||
struct coda_mntinfo *mnt;
|
||||
|
||||
clonetag = EVENTHANDLER_REGISTER(dev_clone,coda_fbsd_clone,0,1000);
|
||||
for(i=0;i<NVCODA;i++)
|
||||
coda_mnttbl[i].dev = NULL;
|
||||
LIST_FOREACH(mnt, &coda_mnttbl, mi_list) {
|
||||
if (mnt->dev == dev)
|
||||
break;
|
||||
}
|
||||
|
||||
return mnt;
|
||||
}
|
||||
|
||||
static void coda_fbsd_drvuninit(unused)
|
||||
void *unused;
|
||||
{
|
||||
int i;
|
||||
|
||||
EVENTHANDLER_DEREGISTER(dev_clone,clonetag);
|
||||
for(i=0;i<NVCODA;i++)
|
||||
if(coda_mnttbl[i].dev)
|
||||
destroy_dev(coda_mnttbl[i].dev);
|
||||
}
|
||||
|
||||
SYSINIT(coda_fbsd_dev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+VC_DEV_NO,coda_fbsd_drvinit,NULL);
|
||||
|
||||
SYSUNINIT(coda_fbsd_dev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+VC_DEV_NO,coda_fbsd_drvuninit,NULL);
|
||||
|
@ -54,8 +54,6 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
extern int coda_nc_initialized; /* Set if cache has been initialized */
|
||||
|
||||
#include "opt_coda.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/ioccom.h>
|
||||
@ -122,17 +120,16 @@ vc_nb_open(dev, flag, mode, td)
|
||||
int mode;
|
||||
struct thread *td; /* NetBSD only */
|
||||
{
|
||||
register struct vcomm *vcp;
|
||||
struct vcomm *vcp;
|
||||
struct coda_mntinfo *mnt;
|
||||
|
||||
ENTRY;
|
||||
|
||||
if (minor(dev) >= NVCODA || minor(dev) < 0)
|
||||
return(ENXIO);
|
||||
|
||||
if (!coda_nc_initialized)
|
||||
coda_nc_init();
|
||||
|
||||
vcp = &coda_mnttbl[minor(dev)].mi_vcomm;
|
||||
mnt = dev2coda_mntinfo(dev);
|
||||
vcp = &mnt->mi_vcomm;
|
||||
if (VC_OPEN(vcp))
|
||||
return(EBUSY);
|
||||
|
||||
@ -141,8 +138,8 @@ vc_nb_open(dev, flag, mode, td)
|
||||
INIT_QUEUE(vcp->vc_replys);
|
||||
MARK_VC_OPEN(vcp);
|
||||
|
||||
coda_mnttbl[minor(dev)].mi_vfsp = NULL;
|
||||
coda_mnttbl[minor(dev)].mi_rootvp = NULL;
|
||||
mnt->mi_vfsp = NULL;
|
||||
mnt->mi_rootvp = NULL;
|
||||
|
||||
return(0);
|
||||
}
|
||||
@ -161,10 +158,7 @@ vc_nb_close (dev, flag, mode, td)
|
||||
|
||||
ENTRY;
|
||||
|
||||
if (minor(dev) >= NVCODA || minor(dev) < 0)
|
||||
return(ENXIO);
|
||||
|
||||
mi = &coda_mnttbl[minor(dev)];
|
||||
mi = dev2coda_mntinfo(dev);
|
||||
vcp = &(mi->mi_vcomm);
|
||||
|
||||
if (!VC_OPEN(vcp))
|
||||
@ -243,10 +237,7 @@ vc_nb_read(dev, uiop, flag)
|
||||
|
||||
ENTRY;
|
||||
|
||||
if (minor(dev) >= NVCODA || minor(dev) < 0)
|
||||
return(ENXIO);
|
||||
|
||||
vcp = &coda_mnttbl[minor(dev)].mi_vcomm;
|
||||
vcp = &dev2coda_mntinfo(dev)->mi_vcomm;
|
||||
/* Get message at head of request queue. */
|
||||
if (EMPTY(vcp->vc_requests))
|
||||
return(0); /* Nothing to read */
|
||||
@ -301,10 +292,7 @@ vc_nb_write(dev, uiop, flag)
|
||||
|
||||
ENTRY;
|
||||
|
||||
if (minor(dev) >= NVCODA || minor(dev) < 0)
|
||||
return(ENXIO);
|
||||
|
||||
vcp = &coda_mnttbl[minor(dev)].mi_vcomm;
|
||||
vcp = &dev2coda_mntinfo(dev)->mi_vcomm;
|
||||
|
||||
/* Peek at the opcode, unique without transfering the data. */
|
||||
uiop->uio_rw = UIO_WRITE;
|
||||
@ -450,10 +438,7 @@ vc_nb_poll(dev, events, td)
|
||||
|
||||
ENTRY;
|
||||
|
||||
if (minor(dev) >= NVCODA || minor(dev) < 0)
|
||||
return(ENXIO);
|
||||
|
||||
vcp = &coda_mnttbl[minor(dev)].mi_vcomm;
|
||||
vcp = &dev2coda_mntinfo(dev)->mi_vcomm;
|
||||
|
||||
event_msk = events & (POLLIN|POLLRDNORM);
|
||||
if (!event_msk)
|
||||
|
@ -43,8 +43,6 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "opt_coda.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/conf.h>
|
||||
@ -69,7 +67,6 @@ int coda_vfsop_print_entry = 0;
|
||||
#define ENTRY if(coda_vfsop_print_entry) myprintf(("Entered %s\n",__func__))
|
||||
|
||||
struct vnode *coda_ctlvp;
|
||||
struct coda_mntinfo coda_mnttbl[NVCODA]; /* indexed by minor device number */
|
||||
|
||||
/* structure to keep statistics of internally generated/satisfied calls */
|
||||
|
||||
@ -161,15 +158,10 @@ coda_omount(vfsp, path, data, td)
|
||||
return(ENXIO);
|
||||
}
|
||||
|
||||
if (minor(dev) >= NVCODA || minor(dev) < 0) {
|
||||
MARK_INT_FAIL(CODA_MOUNT_STATS);
|
||||
return(ENXIO);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the mount record and link it to the vfs struct
|
||||
*/
|
||||
mi = &coda_mnttbl[minor(dev)];
|
||||
mi = dev2coda_mntinfo(dev);
|
||||
|
||||
if (!VC_OPEN(&mi->mi_vcomm)) {
|
||||
MARK_INT_FAIL(CODA_MOUNT_STATS);
|
||||
|
@ -11,6 +11,6 @@ SRCS= vnode_if.h \
|
||||
CLEANFILES= opt_coda.h
|
||||
|
||||
opt_coda.h:
|
||||
echo "#define NVCODA 4" > ${.TARGET}
|
||||
echo > ${.TARGET}
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -11,7 +11,6 @@ SRCS= vnode_if.h \
|
||||
CLEANFILES= opt_coda.h
|
||||
|
||||
opt_coda.h:
|
||||
echo "#define NVCODA 4" > ${.TARGET}
|
||||
echo "#define CODA_COMPAT_5" >> ${.TARGET}
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
Loading…
x
Reference in New Issue
Block a user