diff options
Diffstat (limited to 'sys/coda')
-rw-r--r-- | sys/coda/00READ | 11 | ||||
-rw-r--r-- | sys/coda/cnode.h | 20 | ||||
-rw-r--r-- | sys/coda/coda.h | 194 | ||||
-rw-r--r-- | sys/coda/coda_fbsd.c | 137 | ||||
-rw-r--r-- | sys/coda/coda_namecache.c | 7 | ||||
-rw-r--r-- | sys/coda/coda_psdev.c | 112 | ||||
-rw-r--r-- | sys/coda/coda_subr.c | 33 | ||||
-rw-r--r-- | sys/coda/coda_venus.c | 15 | ||||
-rw-r--r-- | sys/coda/coda_vfsops.c | 51 | ||||
-rw-r--r-- | sys/coda/coda_vnops.c | 58 |
10 files changed, 247 insertions, 391 deletions
diff --git a/sys/coda/00READ b/sys/coda/00READ index ef554177daf07..29e45b1a008f5 100644 --- a/sys/coda/00READ +++ b/sys/coda/00READ @@ -1,3 +1,14 @@ +NOTE: The matching user level code has not been released + yet. It will be available soon. The existing released + Coda code is not quite ready for current. We'll + have some patches out soon. + +BUG: There is a bug in file mapping/executing. When a file is + first created in Coda, it can not be executed. But after + you restart Coda (unmount/mount -- actually vutil -shutdown), + you can run the file just fine. I haven't had time to look + for this problem yet. + WARNING: A version of this code has run on stable for a while now. The code has been recently ported to current. It is mostly diff --git a/sys/coda/cnode.h b/sys/coda/cnode.h index bf6f632b8b7c2..bd93389c7502a 100644 --- a/sys/coda/cnode.h +++ b/sys/coda/cnode.h @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/coda/cnode.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: cnode.h,v 1.4 1998/09/13 13:57:59 rvb Exp $ + * $Id: cnode.h,v 1.3 1998/09/11 18:50:17 rvb Exp $ * */ @@ -47,9 +47,6 @@ /* * HISTORY * $Log: cnode.h,v $ - * Revision 1.4 1998/09/13 13:57:59 rvb - * Finish conversion of cfs -> coda - * * Revision 1.3 1998/09/11 18:50:17 rvb * All the references to cfs, in symbols, structs, and strings * have been changed to coda. (Same for CFS.) @@ -297,20 +294,19 @@ enum dc_status { }; /* cfs_psdev.h */ -extern int coda_call(struct coda_mntinfo *mntinfo, int inSize, int *outSize, caddr_t buffer); -extern int coda_kernel_version; +int coda_call(struct coda_mntinfo *mntinfo, int inSize, int *outSize, caddr_t buffer); /* 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(ViceFid *fid, struct mount *vfsp, short type); -extern int coda_vnodeopstats_init(void); +struct cnode *make_coda_node(ViceFid *fid, struct mount *vfsp, short type); +int coda_vnodeopstats_init(void); /* coda_vfsops.h */ -extern struct mount *devtomp(dev_t dev); +struct mount *devtomp(dev_t dev); /* sigh */ #define CODA_RDWR ((u_long) 31) diff --git a/sys/coda/coda.h b/sys/coda/coda.h index 7b67ea9245bd7..8e77c20d230f9 100644 --- a/sys/coda/coda.h +++ b/sys/coda/coda.h @@ -27,11 +27,10 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/coda/coda.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: coda.h,v 1.5 1998/10/28 19:33:49 rvb Exp $ + * $Id: coda.h,v 1.3 1998/09/11 18:50:17 rvb Exp $ * */ - /* * * Based on cfs.h from Mach, but revamped for increased simplicity. @@ -41,51 +40,17 @@ #ifndef _CODA_HEADER_ #define _CODA_HEADER_ - - /* Catch new _KERNEL defn for NetBSD */ #ifdef __NetBSD__ #include <sys/types.h> #endif -#ifndef CODA_MAXSYMLINKS -#define CODA_MAXSYMLINKS 10 -#endif - -#if defined(DJGPP) || defined(__CYGWIN32__) -#ifdef KERNEL -typedef unsigned long u_long; -typedef unsigned int u_int; -typedef unsigned short u_short; -typedef u_long ino_t; -typedef u_long dev_t; -typedef void * caddr_t; -#ifdef DOS -typedef unsigned __int64 u_quad_t; -#else -typedef unsigned long long u_quad_t; -#endif - -#define inline - -struct timespec { - long ts_sec; - long ts_nsec; -}; -#else /* DJGPP but not KERNEL */ -#include <sys/types.h> -#include <sys/time.h> -typedef unsigned long long u_quad_t; -#endif /* !KERNEL */ -#endif /* !DJGPP */ - - -#if defined(__linux__) +#if defined(__linux__) || defined(__CYGWIN32__) #define cdev_t u_quad_t #if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2) #define _UQUAD_T_ 1 typedef unsigned long long u_quad_t; -#endif +#endif #else #define cdev_t dev_t #endif @@ -100,7 +65,7 @@ struct timespec { /* - * Cfs constants + * Coda constants */ #define CODA_MAXNAMLEN 255 #define CODA_MAXPATHLEN 1024 @@ -113,14 +78,12 @@ struct timespec { #define C_O_WRITE 0x002 #define C_O_TRUNC 0x010 #define C_O_EXCL 0x100 -#define C_O_CREAT 0x200 /* these are to find mode bits in Venus */ #define C_M_READ 00400 #define C_M_WRITE 00200 /* for access Venus will use */ -#define C_A_C_OK 8 /* Test for writing upon create. */ #define C_A_R_OK 4 /* Test for read permission. */ #define C_A_W_OK 2 /* Test for write permission. */ #define C_A_X_OK 1 /* Test for execute permission. */ @@ -145,13 +108,13 @@ struct venus_dirent { * File types */ #define CDT_UNKNOWN 0 -#define CDT_FIFO 1 +#define CDT_FIFO 1 #define CDT_CHR 2 #define CDT_DIR 4 #define CDT_BLK 6 #define CDT_REG 8 #define CDT_LNK 10 -#define CDT_SOCK 12 +#define CDT_SOCK 12 #define CDT_WHT 14 /* @@ -179,40 +142,32 @@ typedef struct ViceFid { } ViceFid; #endif /* VICEFID */ - -#ifdef __linux__ -static __inline__ ino_t coda_f2i(struct ViceFid *fid) +#ifdef __linux__ +static inline ino_t coda_f2i(struct ViceFid *fid) { - if ( ! fid ) - return 0; - if (fid->Vnode == 0xfffffffe || fid->Vnode == 0xffffffff) - return ((fid->Volume << 20) | (fid->Unique & 0xfffff)); - else - return (fid->Unique + (fid->Vnode<<10) + (fid->Volume<<20)); + if ( fid ) { + return (fid->Unique + (fid->Vnode << 10) + (fid->Volume << 20)); + } else { + return 0; + } } - -#else -#define coda_f2i(fid)\ - ((fid) ? ((fid)->Unique + ((fid)->Vnode<<10) + ((fid)->Volume<<20)) : 0) -#endif - - -#ifndef __BIT_TYPES_DEFINED__ -#define u_int32_t unsigned int #endif - #ifndef _VUID_T_ #define _VUID_T_ -typedef u_int32_t vuid_t; -typedef u_int32_t vgid_t; +typedef u_long vuid_t; +typedef u_long vgid_t; #endif /*_VUID_T_ */ #ifndef _CODACRED_T_ #define _CODACRED_T_ struct coda_cred { vuid_t cr_uid, cr_euid, cr_suid, cr_fsuid; /* Real, efftve, set, fs uid*/ - vgid_t cr_groupid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */ +#if defined(__NetBSD__) || defined(__FreeBSD__) + vgid_t cr_groupid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */ +#else + vgid_t cr_gid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */ +#endif }; #endif @@ -224,7 +179,7 @@ struct coda_cred { enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD }; struct coda_vattr { - int va_type; /* vnode type (for create) */ + enum coda_vtype va_type; /* vnode type (for create) */ u_short va_mode; /* files access mode and type */ short va_nlink; /* number of references to file */ vuid_t va_uid; /* owner user id */ @@ -248,38 +203,36 @@ struct coda_vattr { * Kernel <--> Venus communications. */ -#define CODA_ROOT 2 -#define CODA_SYNC 3 -#define CODA_OPEN 4 -#define CODA_CLOSE 5 -#define CODA_IOCTL 6 -#define CODA_GETATTR 7 -#define CODA_SETATTR 8 -#define CODA_ACCESS 9 -#define CODA_LOOKUP 10 -#define CODA_CREATE 11 -#define CODA_REMOVE 12 -#define CODA_LINK 13 -#define CODA_RENAME 14 -#define CODA_MKDIR 15 -#define CODA_RMDIR 16 -#define CODA_READDIR 17 -#define CODA_SYMLINK 18 -#define CODA_READLINK 19 -#define CODA_FSYNC 20 -#define CODA_INACTIVE 21 -#define CODA_VGET 22 -#define CODA_SIGNAL 23 -#define CODA_REPLACE 24 -#define CODA_FLUSH 25 -#define CODA_PURGEUSER 26 -#define CODA_ZAPFILE 27 -#define CODA_ZAPDIR 28 -#define CODA_PURGEFID 30 -#define CODA_OPEN_BY_PATH 31 -#define CODA_RESOLVE 32 -#define CODA_REINTEGRATE 33 -#define CODA_NCALLS 34 +#define CODA_ROOT ((u_long) 2) +#define CODA_SYNC ((u_long) 3) +#define CODA_OPEN ((u_long) 4) +#define CODA_CLOSE ((u_long) 5) +#define CODA_IOCTL ((u_long) 6) +#define CODA_GETATTR ((u_long) 7) +#define CODA_SETATTR ((u_long) 8) +#define CODA_ACCESS ((u_long) 9) +#define CODA_LOOKUP ((u_long) 10) +#define CODA_CREATE ((u_long) 11) +#define CODA_REMOVE ((u_long) 12) +#define CODA_LINK ((u_long) 13) +#define CODA_RENAME ((u_long) 14) +#define CODA_MKDIR ((u_long) 15) +#define CODA_RMDIR ((u_long) 16) +#define CODA_READDIR ((u_long) 17) +#define CODA_SYMLINK ((u_long) 18) +#define CODA_READLINK ((u_long) 19) +#define CODA_FSYNC ((u_long) 20) +#define CODA_INACTIVE ((u_long) 21) +#define CODA_VGET ((u_long) 22) +#define CODA_SIGNAL ((u_long) 23) +#define CODA_REPLACE ((u_long) 24) +#define CODA_FLUSH ((u_long) 25) +#define CODA_PURGEUSER ((u_long) 26) +#define CODA_ZAPFILE ((u_long) 27) +#define CODA_ZAPDIR ((u_long) 28) +#define CODA_ZAPVNODE ((u_long) 29) +#define CODA_PURGEFID ((u_long) 30) +#define CODA_NCALLS 31 #define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID) @@ -287,15 +240,7 @@ struct coda_vattr { #define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) +\ VC_MAXDATASIZE -#define CIOC_KERNEL_VERSION _IOWR('c', 10, sizeof (int)) -#if 0 - /* don't care about kernel version number */ -#define CODA_KERNEL_VERSION 0 - /* The old venus 4.6 compatible interface */ -#define CODA_KERNEL_VERSION 1 -#endif - /* venus_lookup gets an extra parameter to aid windows.*/ -#define CODA_KERNEL_VERSION 2 + /* * Venus <-> Coda RPC arguments @@ -405,17 +350,11 @@ struct coda_access_out { struct coda_out_hdr out; }; - -/* lookup flags */ -#define CLU_CASE_SENSITIVE 0x01 -#define CLU_CASE_INSENSITIVE 0x02 - /* coda_lookup: */ struct coda_lookup_in { struct coda_in_hdr ih; ViceFid VFid; int name; /* Place holder for data. */ - int flags; }; struct coda_lookup_out { @@ -641,22 +580,10 @@ struct coda_replace_out { /* coda_replace is a venus->kernel call */ ViceFid OldFid; }; -/* coda_open_by_path: */ -struct coda_open_by_path_in { - struct coda_in_hdr ih; - ViceFid VFid; - int flags; -}; - -struct coda_open_by_path_out { - struct coda_out_hdr oh; - int path; -}; - /* - * Occasionally, we don't cache the fid returned by CODA_LOOKUP. - * For instance, if the fid is inconsistent. - * This case is handled by setting the top bit of the type result parameter. + * Occasionally, don't cache the fid returned by CODA_LOOKUP. For instance, if + * the fid is inconsistent. This case is handled by setting the top bit of the + * return result parameter. */ #define CODA_NOCACHE 0x80000000 @@ -682,7 +609,6 @@ union inputArgs { struct coda_inactive_in coda_inactive; struct coda_vget_in coda_vget; struct coda_rdwr_in coda_rdwr; - struct coda_open_by_path_in coda_open_by_path; }; union outputArgs { @@ -704,7 +630,6 @@ union outputArgs { struct coda_purgefid_out coda_purgefid; struct coda_rdwr_out coda_rdwr; struct coda_replace_out coda_replace; - struct coda_open_by_path_out coda_open_by_path; }; union coda_downcalls { @@ -730,20 +655,11 @@ struct ViceIoctl { short out_size; /* Maximum size of output buffer, <= 2K */ }; -#if defined(__CYGWIN32__) || defined(DJGPP) struct PioctlData { - unsigned long cmd; const char *path; int follow; struct ViceIoctl vi; }; -#else -struct PioctlData { - const char *path; - int follow; - struct ViceIoctl vi; -}; -#endif #define CODA_CONTROL ".CONTROL" #define CODA_CONTROLLEN 8 diff --git a/sys/coda/coda_fbsd.c b/sys/coda/coda_fbsd.c index 66bfe07f6299d..8d407ae5e6968 100644 --- a/sys/coda/coda_fbsd.c +++ b/sys/coda/coda_fbsd.c @@ -27,12 +27,16 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/coda/coda_fbsd.cr,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: coda_fbsd.c,v 1.10 1999/01/05 18:49:49 eivind Exp $ + * $Id: coda_fbsd.c,v 1.6 1998/09/28 20:52:57 rvb Exp $ * */ +#ifdef VFS_LKM +#define NVCODA 4 +#else #include "vcoda.h" #include "opt_devfs.h" +#endif #include <sys/param.h> #include <sys/systm.h> @@ -80,58 +84,59 @@ static struct cdevsw codadevsw = vc_nb_poll, nommap, NULL, "Coda", NULL, -1 }; +void vcattach __P((void)); +static dev_t codadev; + int vcdebug = 1; #define VCDEBUG if (vcdebug) printf -static int -codadev_modevent(module_t mod, int type, void *data) +void +vcattach(void) +{ + /* + * In case we are an LKM, set up device switch. + */ + if (0 == (codadev = makedev(VC_DEV_NO, 0))) + VCDEBUG("makedev returned null\n"); + else + VCDEBUG("makedev OK.\n"); + + cdevsw_add(&codadev, &codadevsw, NULL); + VCDEBUG("coda: codadevsw entry installed at %d.\n", major(codadev)); +} + +static vc_devsw_installed = 0; +static void vc_drvinit __P((void *unused)); + +static void +vc_drvinit(void *unused) { dev_t dev; #ifdef DEVFS int i; #endif - static struct cdevsw *oldcdevsw; - switch (type) { - case MOD_LOAD: + if( ! vc_devsw_installed ) { dev = makedev(VC_DEV_NO, 0); - cdevsw_add(&dev,&codadevsw, &oldcdevsw); + cdevsw_add(&dev,&codadevsw, NULL); + vc_devsw_installed = 1; + } #ifdef DEVFS - /* tmp */ + /* tmp */ #undef NVCODA #define NVCODA 1 - for (i = 0; i < NVCODA; i++) { - cfs_devfs_token[i] = - devfs_add_devswf(&codadevsw, i, - DV_CHR, UID_ROOT, GID_WHEEL, 0666, - "cfs%d", i); - coda_devfs_token[i] = - devfs_add_devswf(&codadevsw, i, - DV_CHR, UID_ROOT, GID_WHEEL, 0666, - "coda%d", i); - } -#endif - break; - case MOD_UNLOAD: -#ifdef DEVFS - for (i = 0; i < NVCODA; i++) { - devfs_remove_dev(cfs_devfs_token[i]); - devfs_remove_dev(coda_devfs_token[i]); - } -#endif - cdevsw_add(&dev, oldcdevsw, NULL); - break; - default: - break; + for (i = 0; i < NVCODA; i++) { + cfs_devfs_token[i] = + devfs_add_devswf(&codadevsw, i, + DV_CHR, UID_ROOT, GID_WHEEL, 0666, + "cfs%d", i); + coda_devfs_token[i] = + devfs_add_devswf(&codadevsw, i, + DV_CHR, UID_ROOT, GID_WHEEL, 0666, + "coda%d", i); } - return 0; +#endif } -static moduledata_t codadev_mod = { - "codadev", - codadev_modevent, - NULL -}; -DECLARE_MODULE(codadev, codadev_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+VC_DEV_NO); int coda_fbsd_getpages(v) @@ -172,7 +177,7 @@ printf("coda_getp: Internally Opening %p\n", vp); return (error); } if (vp->v_type == VREG) { - error = vfs_object_create(vp, p, cred); + error = vfs_object_create(vp, p, cred, 1); if (error != 0) { printf("coda_getpage: vfs_object_create() returns %d\n", error); vput(vp); @@ -214,3 +219,57 @@ coda_fbsd_putpages(v) return vnode_pager_generic_putpages(ap->a_vp, ap->a_m, ap->a_count, ap->a_sync, ap->a_rtvals); } + + +SYSINIT(codadev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+VC_DEV_NO,vc_drvinit,NULL) + +#ifdef VFS_LKM + +#include <sys/mount.h> +#include <sys/lkm.h> + +extern struct vfsops coda_vfsops; + +static struct vfsconf _fs_vfsconf = { &coda_vfsops, "coda", -1, 0, 0 }; + +extern struct linker_set coda_modvnops ; + +static struct lkm_vfs coda_mod_vfs = { + LM_VFS, LKM_VERSION, "coda", 0, &coda_modvnops, &_fs_vfsconf }; + +static struct lkm_dev coda_mod_dev = { + LM_DEV, LKM_VERSION, "codadev", VC_DEV_NO, LM_DT_CHAR, (void *) &codadevsw}; + +int coda_mod(struct lkm_table *, int, int); +int +coda_mod(struct lkm_table *lkmtp, int cmd, int ver) +{ + int error = 0; + + if (ver != LKM_VERSION) + return EINVAL; + + switch (cmd) { + case LKM_E_LOAD: + lkmtp->private.lkm_any = (struct lkm_any *) &coda_mod_dev; + error = lkmdispatch(lkmtp, cmd); + if (error) + break; + lkmtp->private.lkm_any = (struct lkm_any *) &coda_mod_vfs ; + error = lkmdispatch(lkmtp, cmd); + break; + case LKM_E_UNLOAD: + lkmtp->private.lkm_any = (struct lkm_any *) &coda_mod_vfs ; + error = lkmdispatch(lkmtp, cmd); + if (error) + break; + lkmtp->private.lkm_any = (struct lkm_any *) &coda_mod_dev; + error = lkmdispatch(lkmtp, cmd); + break; + case LKM_E_STAT: + error = lkmdispatch(lkmtp, cmd); + break; + } + return error; +} +#endif diff --git a/sys/coda/coda_namecache.c b/sys/coda/coda_namecache.c index 2da7b096896de..d66f1151a63d9 100644 --- a/sys/coda/coda_namecache.c +++ b/sys/coda/coda_namecache.c @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/coda/coda_namecache.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: coda_namecache.c,v 1.7 1998/09/28 20:52:58 rvb Exp $ + * $Id: coda_namecache.c,v 1.6 1998/09/25 17:38:31 rvb Exp $ * */ @@ -47,9 +47,6 @@ /* * HISTORY * $Log: coda_namecache.c,v $ - * Revision 1.7 1998/09/28 20:52:58 rvb - * Cleanup and fix THE bug - * * Revision 1.6 1998/09/25 17:38:31 rvb * Put "stray" printouts under DIAGNOSTIC. Make everything build * with DEBUG on. Add support for lkm. (The macro's don't work @@ -705,7 +702,7 @@ coda_nc_purge_user(uid, dcstat) return; CODA_NC_DEBUG(CODA_NC_PURGEUSER, - myprintf(("ZapDude: uid %x\n", uid)); ) + myprintf(("ZapDude: uid %lx\n", uid)); ) coda_nc_stat.zapUsers++; for (cncp = CODA_NC_LRUGET(coda_nc_lru); diff --git a/sys/coda/coda_psdev.c b/sys/coda/coda_psdev.c index 0d29f6e1d7371..3abbff04878af 100644 --- a/sys/coda/coda_psdev.c +++ b/sys/coda/coda_psdev.c @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/coda/coda_psdev.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: coda_psdev.c,v 1.9 1998/11/11 20:32:20 rvb Exp $ + * $Id: coda_psdev.c,v 1.6 1998/09/28 20:52:58 rvb Exp $ * */ @@ -53,25 +53,6 @@ /* * HISTORY * $Log: coda_psdev.c,v $ - * Revision 1.9 1998/11/11 20:32:20 rvb - * coda_lookup now passes up an extra flag. But old veni will - * be ok; new veni will check /dev/cfs0 to make sure that a new - * kernel is running. - * Also, a bug in vc_nb_close iff CODA_SIGNAL's were seen has been - * fixed. - * - * Revision 1.8 1998/10/28 20:31:13 rvb - * Change the way unmounting happens to guarantee that the - * client programs are allowed to finish up (coda_call is - * forced to complete) and release their locks. Thus there - * is a reasonable chance that the vflush implicit in the - * unmount will not get hung on held locks. - * - * Revision 1.7 1998/09/29 20:19:45 rvb - * Fixes for lkm: - * 1. use VFS_LKM vs ACTUALLY_LKM_NOT_KERNEL - * 2. don't pass -DCODA to lkm build - * * Revision 1.6 1998/09/28 20:52:58 rvb * Cleanup and fix THE bug * @@ -188,7 +169,11 @@ extern int coda_nc_initialized; /* Set if cache has been initialized */ +#ifdef VFS_LKM +#define NVCODA 4 +#else #include <vcoda.h> +#endif #include <sys/param.h> #include <sys/systm.h> @@ -210,13 +195,6 @@ extern int coda_nc_initialized; /* Set if cache has been initialized */ #define CTL_C int coda_psdev_print_entry = 0; -static -int outstanding_upcalls = 0; -int coda_call_sleep = PZERO - 1; -#ifdef CTL_C -int coda_pcatch = PCATCH; -#else -#endif #define ENTRY if(coda_psdev_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) @@ -284,7 +262,7 @@ vc_nb_close (dev, flag, mode, p) struct proc *p; { register struct vcomm *vcp; - register struct vmsg *vmp, *nvmp = NULL; + register struct vmsg *vmp; struct coda_mntinfo *mi; int err; @@ -305,23 +283,21 @@ vc_nb_close (dev, flag, mode, p) * Put this before WAKEUPs to avoid queuing new messages between * the WAKEUP and the unmount (which can happen if we're unlucky) */ - if (!mi->mi_rootvp) { - /* just a simple open/close w no mount */ - MARK_VC_CLOSED(vcp); - return 0; + if (mi->mi_rootvp) { + /* Let unmount know this is for real */ + VTOC(mi->mi_rootvp)->c_flags |= C_UNMOUNTING; + coda_unmounting(mi->mi_vfsp); + err = dounmount(mi->mi_vfsp, flag, p); + if (err) + myprintf(("Error %d unmounting vfs in vcclose(%d)\n", + err, minor(dev))); } - - /* Let unmount know this is for real */ - VTOC(mi->mi_rootvp)->c_flags |= C_UNMOUNTING; - coda_unmounting(mi->mi_vfsp); - - outstanding_upcalls = 0; + /* Wakeup clients so they can return. */ for (vmp = (struct vmsg *)GETNEXT(vcp->vc_requests); !EOQ(vmp, vcp->vc_requests); - vmp = nvmp) - { - nvmp = (struct vmsg *)GETNEXT(vmp->vm_chain); + vmp = (struct vmsg *)GETNEXT(vmp->vm_chain)) + { /* Free signal request messages and don't wakeup cause no one is waiting. */ if (vmp->vm_opcode == CODA_SIGNAL) { @@ -329,34 +305,18 @@ vc_nb_close (dev, flag, mode, p) CODA_FREE((caddr_t)vmp, (u_int)sizeof(struct vmsg)); continue; } - outstanding_upcalls++; + wakeup(&vmp->vm_sleep); } - + for (vmp = (struct vmsg *)GETNEXT(vcp->vc_replys); !EOQ(vmp, vcp->vc_replys); vmp = (struct vmsg *)GETNEXT(vmp->vm_chain)) { - outstanding_upcalls++; wakeup(&vmp->vm_sleep); } - + MARK_VC_CLOSED(vcp); - - if (outstanding_upcalls) { -#ifdef CODA_VERBOSE - printf("presleep: outstanding_upcalls = %d\n", outstanding_upcalls); - (void) tsleep(&outstanding_upcalls, coda_call_sleep, "coda_umount", 0); - printf("postsleep: outstanding_upcalls = %d\n", outstanding_upcalls); -#else - (void) tsleep(&outstanding_upcalls, coda_call_sleep, "coda_umount", 0); -#endif - } - - err = dounmount(mi->mi_vfsp, flag, p); - if (err) - myprintf(("Error %d unmounting vfs in vcclose(%d)\n", - err, minor(dev))); return 0; } @@ -546,22 +506,6 @@ vc_nb_ioctl(dev, cmd, addr, flag, p) return(ENODEV); } break; - case CIOC_KERNEL_VERSION: - switch (*(u_int *)addr) { - case 0: - *(u_int *)addr = coda_kernel_version; - return 0; - break; - case 1: - case 2: - if (coda_kernel_version != *(u_int *)addr) - return ENOENT; - else - return 0; - default: - return ENOENT; - } - break; default : return(EINVAL); break; @@ -610,6 +554,12 @@ struct coda_clstat coda_clstat; * (e.g. kill -9). */ +int coda_call_sleep = PZERO - 1; +#ifdef CTL_C +int coda_pcatch = PCATCH; +#else +#endif + int coda_call(mntinfo, inSize, outSize, buffer) struct coda_mntinfo *mntinfo; int inSize; int *outSize; caddr_t buffer; @@ -687,11 +637,6 @@ coda_call(mntinfo, inSize, outSize, buffer) #ifdef CODA_VERBOSE printf("coda_call: tsleep returns %d SIGIO, cnt %d\n", error, i); #endif - } else if (p->p_siglist == sigmask(SIGALRM)) { - p->p_sigmask |= p->p_siglist; -#ifdef CODA_VERBOSE - printf("coda_call: tsleep returns %d SIGALRM, cnt %d\n", error, i); -#endif } else { printf("coda_call: tsleep returns %d, cnt %d\n", error, i); printf("coda_call: siglist = %x, sigmask = %x, mask %x\n", @@ -705,7 +650,7 @@ coda_call(mntinfo, inSize, outSize, buffer) p->p_siglist & ~p->p_sigmask); #endif } - } while (error && i++ < 128 && VC_OPEN(vcp)); + } while (error && i++ < 128); p->p_sigmask = psig_omask; #else (void) tsleep(&vmp->vm_sleep, coda_call_sleep, "coda_call", 0); @@ -779,9 +724,6 @@ coda_call(mntinfo, inSize, outSize, buffer) CODA_FREE(vmp, sizeof(struct vmsg)); - if (outstanding_upcalls > 0 && (--outstanding_upcalls == 0)) - wakeup(&outstanding_upcalls); - if (!error) error = ((struct coda_out_hdr *)buffer)->result; return(error); diff --git a/sys/coda/coda_subr.c b/sys/coda/coda_subr.c index 40d2d0b0b1a46..d24b5d602e2e9 100644 --- a/sys/coda/coda_subr.c +++ b/sys/coda/coda_subr.c @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/coda/coda_subr.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: coda_subr.c,v 1.8 1998/10/28 19:33:50 rvb Exp $ + * $Id: coda_subr.c,v 1.6 1998/09/25 17:38:31 rvb Exp $ * */ @@ -46,17 +46,6 @@ /* * HISTORY * $Log: coda_subr.c,v $ - * Revision 1.8 1998/10/28 19:33:50 rvb - * Venus must be passed O_CREAT flag on VOP_OPEN iff this is - * a creat so that we can will allow a mode 444 file to be - * written into. Sync with the latest coda.h and deal with - * collateral damage. - * - * Revision 1.7 1998/09/29 20:19:45 rvb - * Fixes for lkm: - * 1. use VFS_LKM vs ACTUALLY_LKM_NOT_KERNEL - * 2. don't pass -DCODA to lkm build - * * Revision 1.6 1998/09/25 17:38:31 rvb * Put "stray" printouts under DIAGNOSTIC. Make everything build * with DEBUG on. Add support for lkm. (The macro's don't work @@ -229,7 +218,11 @@ * 4. coda_cacheprint (under DEBUG) prints names with vnode/cnode address */ +#ifdef VFS_LKM +#define NVCODA 4 +#else #include <vcoda.h> +#endif #include <sys/param.h> #include <sys/systm.h> @@ -632,6 +625,22 @@ int handleDownCall(opcode, out) return(0); } + case CODA_ZAPVNODE : { + coda_clstat.ncalls++; + coda_clstat.reqs[CODA_ZAPVNODE]++; + + myprintf(("CODA_ZAPVNODE: Called, but uniplemented\n")); + /* + * Not that below we must really translate the returned coda_cred to + * a netbsd cred. This is a bit muddled at present and the cfsnc_zapnode + * is further unimplemented, so punt! + * I suppose we could use just the uid. + */ + /* coda_nc_zapvnode(&out->coda_zapvnode.VFid, &out->coda_zapvnode.cred, + IS_DOWNCALL); */ + return(0); + } + case CODA_PURGEFID : { struct cnode *cp; diff --git a/sys/coda/coda_venus.c b/sys/coda/coda_venus.c index 96228f1737aad..25dceeb1af761 100644 --- a/sys/coda/coda_venus.c +++ b/sys/coda/coda_venus.c @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/coda_venus.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: coda_venus.c,v 1.5 1998/10/28 19:33:50 rvb Exp $ + * $Id: coda_venus.c,v 1.3 1998/09/11 18:50:17 rvb Exp $ * */ @@ -112,7 +112,6 @@ if (from & FWRITE) to |= C_O_WRITE; \ if (from & O_TRUNC) to |= C_O_TRUNC; \ if (from & O_EXCL) to |= C_O_EXCL; \ - if (from & O_CREAT) to |= C_O_CREAT; \ } while (0) #define CNV_VV2V_ATTR(top, fromp) \ @@ -159,8 +158,6 @@ } while (0) -int coda_kernel_version = CODA_KERNEL_VERSION; - int venus_root(void *mdp, struct ucred *cred, struct proc *p, @@ -410,17 +407,7 @@ venus_lookup(void *mdp, ViceFid *fid, INIT_IN(&inp->ih, CODA_LOOKUP, cred, p); inp->VFid = *fid; - /* NOTE: - * Between version 1 and version 2 we have added an extra flag field - * to this structure. But because the string was at the end and because - * of the wierd way we represent strings by having the slot point to - * where the string characters are in the "heap", we can just slip the - * flag parameter in after the string slot pointer and veni that don't - * know better won't see this new flag field ... - * Otherwise we'd need two different venus_lookup functions. - */ inp->name = Isize; - inp->flags = CLU_CASE_SENSITIVE; /* doesn't really matter for BSD */ STRCPY(name, nm, len); /* increments Isize */ error = coda_call(mdp, Isize, &Osize, (char *)inp); diff --git a/sys/coda/coda_vfsops.c b/sys/coda/coda_vfsops.c index 8f6befec3e938..835af3763e2fb 100644 --- a/sys/coda/coda_vfsops.c +++ b/sys/coda/coda_vfsops.c @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/coda_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: coda_vfsops.c,v 1.10 1998/12/04 22:54:43 archie Exp $ + * $Id: coda_vfsops.c,v 1.6 1998/09/25 17:38:32 rvb Exp $ * */ @@ -47,37 +47,6 @@ /* * HISTORY * $Log: coda_vfsops.c,v $ - * Revision 1.10 1998/12/04 22:54:43 archie - * Examine all occurrences of sprintf(), strcat(), and str[n]cpy() - * for possible buffer overflow problems. Replaced most sprintf()'s - * with snprintf(); for others cases, added terminating NUL bytes where - * appropriate, replaced constants like "16" with sizeof(), etc. - * - * These changes include several bug fixes, but most changes are for - * maintainability's sake. Any instance where it wasn't "immediately - * obvious" that a buffer overflow could not occur was made safer. - * - * Reviewed by: Bruce Evans <bde@zeta.org.au> - * Reviewed by: Matthew Dillon <dillon@apollo.backplane.com> - * Reviewed by: Mike Spengler <mks@networkcs.com> - * - * Revision 1.9 1998/11/16 19:48:26 rvb - * A few bug fixes for Robert Watson - * - * Revision 1.8 1998/11/03 08:55:06 peter - * Support KLD. We register and unregister two modules. "coda" (the vfs) - * via VFS_SET(), and "codadev" for the cdevsw entry. From kldstat -v: - * 3 1 0xf02c5000 115d8 coda.ko - * Contains modules: - * Id Name - * 2 codadev - * 3 coda - * - * Revision 1.7 1998/09/29 20:19:45 rvb - * Fixes for lkm: - * 1. use VFS_LKM vs ACTUALLY_LKM_NOT_KERNEL - * 2. don't pass -DCODA to lkm build - * * Revision 1.6 1998/09/25 17:38:32 rvb * Put "stray" printouts under DIAGNOSTIC. Make everything build * with DEBUG on. Add support for lkm. (The macro's don't work @@ -221,7 +190,11 @@ * */ +#ifdef VFS_LKM +#define NVCODA 4 +#else #include <vcoda.h> +#endif #include <sys/param.h> #include <sys/systm.h> @@ -449,7 +422,6 @@ coda_unmount(vfsp, mntflags, p) vrele(mi->mi_rootvp); active = coda_kill(vfsp, NOT_DOWNCALL); - mi->mi_rootvp->v_flag &= ~VROOT; error = vflush(mi->mi_vfsp, NULLVP, FORCECLOSE); printf("coda_unmount: active = %d, vflush active %d\n", active, error); error = 0; @@ -529,7 +501,7 @@ coda_root(vfsp, vpp) MARK_INT_SAT(CODA_ROOT_STATS); goto exit; - } else if (error == ENODEV || error == EINTR) { + } else if (error == ENODEV) { /* Gross hack here! */ /* * If Venus fails to respond to the CODA_ROOT call, coda_call returns @@ -605,8 +577,8 @@ coda_nb_statfs(vfsp, sbp, p) sbp->f_files = NB_SFS_SIZ; sbp->f_ffree = NB_SFS_SIZ; bcopy((caddr_t)&(vfsp->mnt_stat.f_fsid), (caddr_t)&(sbp->f_fsid), sizeof (fsid_t)); - snprintf(sbp->f_mntonname, sizeof(sbp->f_mntonname), "/coda"); - snprintf(sbp->f_mntfromname, sizeof(sbp->f_mntfromname), "CODA"); + strcpy(sbp->f_mntonname, "/coda"); + strcpy(sbp->f_mntfromname, "CODA"); /* MARK_INT_SAT(CODA_STATFS_STATS); */ return(0); } @@ -767,4 +739,11 @@ struct vfsops coda_vfsops = { coda_init, }; +#ifdef VFS_LKM +/* + * This case is being handled in coda_fbsd.c + * What we want is too hairy for VFS_SET to get right! + */ +#else VFS_SET(coda_vfsops, coda, VFCF_NETWORK); +#endif diff --git a/sys/coda/coda_vnops.c b/sys/coda/coda_vnops.c index c0cfa5e00f921..420ef3c515b86 100644 --- a/sys/coda/coda_vnops.c +++ b/sys/coda/coda_vnops.c @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/coda/coda_vnops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: coda_vnops.c,v 1.12 1999/01/07 16:14:12 bde Exp $ + * $Id: coda_vnops.c,v 1.5 1998/09/25 17:38:32 rvb Exp $ * */ @@ -48,34 +48,6 @@ /* * HISTORY * $Log: coda_vnops.c,v $ - * Revision 1.12 1999/01/07 16:14:12 bde - * Don't pass unused unused timestamp args to UFS_UPDATE() or waste - * time initializing them. This almost finishes centralizing (in-core) - * timestamp updates in ufs_itimes(). - * - * Revision 1.11 1999/01/05 18:49:51 eivind - * Remove the 'waslocked' parameter to vfs_object_create(). - * - * Revision 1.10 1998/12/04 18:44:21 rvb - * Don't print diagnostic anymore - * - * Revision 1.9 1998/11/16 19:48:26 rvb - * A few bug fixes for Robert Watson - * - * Revision 1.8 1998/10/28 20:31:13 rvb - * Change the way unmounting happens to guarantee that the - * client programs are allowed to finish up (coda_call is - * forced to complete) and release their locks. Thus there - * is a reasonable chance that the vflush implicit in the - * unmount will not get hung on held locks. - * - * Revision 1.7 1998/10/25 17:44:41 phk - * Nitpicking and dusting performed on a train. Removes trivial warnings - * about unused variables, labels and other lint. - * - * Revision 1.6 1998/09/28 20:52:58 rvb - * Cleanup and fix THE bug - * * Revision 1.5 1998/09/25 17:38:32 rvb * Put "stray" printouts under DIAGNOSTIC. Make everything build * with DEBUG on. Add support for lkm. (The macro's don't work @@ -370,7 +342,7 @@ struct vnodeopv_entry_desc coda_vnodeop_entries[] = { #define UFS_VALLOC(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_valloc(aa, bb, cc, dd) #define UFS_VFREE(aa, bb, cc) VFSTOUFS((aa)->v_mount)->um_vfree(aa, bb, cc) #define UFS_TRUNCATE(aa, bb, cc, dd, ee) VFSTOUFS((aa)->v_mount)->um_truncate(aa, bb, cc, dd, ee) -#define UFS_UPDATE(aa, bb) VFSTOUFS((aa)->v_mount)->um_update(aa, bb) +#define UFS_UPDATE(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_update(aa, bb, cc, dd) missing { &vop_reallocblks_desc, (vop_t *) ufs_missingop }, @@ -390,12 +362,10 @@ int coda_vop_error(void *anon) { struct vnodeop_desc **desc = (struct vnodeop_desc **)anon; - myprintf(("coda_vop_error: Vnode operation %s called, but not defined.\n", + myprintf(("Vnode operation %s called, but not defined\n", (*desc)->vdesc_name)); - /* panic("coda_vop_error"); - */ - return EIO; + return 0; } /* A generic do-nothing. For lease_check, advlock */ @@ -513,7 +483,7 @@ coda_open(v) } /* grab (above) does this when it calls newvnode unless it's in the cache*/ if (vp->v_type == VREG) { - error = vfs_object_create(vp, p, cred); + error = vfs_object_create(vp, p, cred, 1); if (error != 0) { printf("coda_open: vfs_object_create() returns %d\n", error); vput(vp); @@ -554,12 +524,7 @@ coda_close(v) printf("coda_close: destroying container ref %d, ufs vp %p of vp %p/cp %p\n", vp->v_usecount, cp->c_ovp, vp, cp); #endif -#ifdef hmm vgone(cp->c_ovp); -#else - VOP_CLOSE(cp->c_ovp, flag, cred, p); /* Do errors matter here? */ - vrele(cp->c_ovp); -#endif } else { #ifdef CODA_VERBOSE printf("coda_close: NO container vp %p/cp %p\n", vp, cp); @@ -673,7 +638,7 @@ printf("coda_rdwr: Internally Opening %p\n", vp); return (error); } if (vp->v_type == VREG) { - error = vfs_object_create(vp, p, cred); + error = vfs_object_create(vp, p, cred, 1); if (error != 0) { printf("coda_rdwr: vfs_object_create() returns %d\n", error); vput(vp); @@ -1547,6 +1512,8 @@ coda_link(v) CODADEBUG(CODA_LINK, myprintf(("in link result %d\n",error)); ) +exit: + /* Drop the name buffer if we don't need to SAVESTART */ if ((cnp->cn_flags & SAVESTART) == 0) { zfree(namei_zone, cnp->cn_pnbuf); @@ -1896,7 +1863,7 @@ printf("coda_readdir: Internally Opening %p\n", vp); return (error); } if (vp->v_type == VREG) { - error = vfs_object_create(vp, p, cred); + error = vfs_object_create(vp, p, cred, 1); if (error != 0) { printf("coda_readdir: vfs_object_create() returns %d\n", error); vput(vp); @@ -1956,9 +1923,7 @@ coda_bmap(v) #endif return ret; } else { -#if 0 printf("coda_bmap: no container\n"); -#endif return(EOPNOTSUPP); } } @@ -2042,12 +2007,7 @@ coda_lock(v) cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); } -#ifndef DEBUG_LOCKS return (lockmgr(&cp->c_lock, ap->a_flags, &vp->v_interlock, p)); -#else - return (debuglockmgr(&cp->c_lock, ap->a_flags, &vp->v_interlock, p, - "coda_lock", vp->filename, vp->line)); -#endif } int |