diff options
author | rvb <rvb@FreeBSD.org> | 1998-11-11 20:32:20 +0000 |
---|---|---|
committer | rvb <rvb@FreeBSD.org> | 1998-11-11 20:32:20 +0000 |
commit | db28f40beee243ea6c2a3d88927156f63fb38080 (patch) | |
tree | 5bc009d1aa22b55b919520268f7dea232359bbc1 /sys | |
parent | ba58877007d91e681de82ac5e39beeef438e2931 (diff) | |
download | FreeBSD-src-db28f40beee243ea6c2a3d88927156f63fb38080.zip FreeBSD-src-db28f40beee243ea6c2a3d88927156f63fb38080.tar.gz |
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.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/coda/cnode.h | 20 | ||||
-rw-r--r-- | sys/coda/coda.h | 34 | ||||
-rw-r--r-- | sys/coda/coda_psdev.c | 32 | ||||
-rw-r--r-- | sys/coda/coda_venus.c | 14 | ||||
-rw-r--r-- | sys/fs/coda/cnode.h | 20 | ||||
-rw-r--r-- | sys/fs/coda/coda.h | 34 | ||||
-rw-r--r-- | sys/fs/coda/coda_psdev.c | 32 | ||||
-rw-r--r-- | sys/fs/coda/coda_venus.c | 14 |
8 files changed, 168 insertions, 32 deletions
diff --git a/sys/coda/cnode.h b/sys/coda/cnode.h index bd93389..bf6f632 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.3 1998/09/11 18:50:17 rvb Exp $ + * $Id: cnode.h,v 1.4 1998/09/13 13:57:59 rvb Exp $ * */ @@ -47,6 +47,9 @@ /* * 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.) @@ -294,19 +297,20 @@ enum dc_status { }; /* cfs_psdev.h */ -int coda_call(struct coda_mntinfo *mntinfo, int inSize, int *outSize, caddr_t buffer); +extern int coda_call(struct coda_mntinfo *mntinfo, int inSize, int *outSize, caddr_t buffer); +extern int coda_kernel_version; /* cfs_subr.h */ -int handleDownCall(int opcode, union outputArgs *out); -void coda_unmounting(struct mount *whoIam); -int coda_vmflush(struct cnode *cp); +extern int handleDownCall(int opcode, union outputArgs *out); +extern void coda_unmounting(struct mount *whoIam); +extern int coda_vmflush(struct cnode *cp); /* cfs_vnodeops.h */ -struct cnode *make_coda_node(ViceFid *fid, struct mount *vfsp, short type); -int coda_vnodeopstats_init(void); +extern struct cnode *make_coda_node(ViceFid *fid, struct mount *vfsp, short type); +extern int coda_vnodeopstats_init(void); /* coda_vfsops.h */ -struct mount *devtomp(dev_t dev); +extern 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 8426d00..7b67ea9 100644 --- a/sys/coda/coda.h +++ b/sys/coda/coda.h @@ -27,10 +27,11 @@ * 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.4 1998/09/13 13:57:59 rvb Exp $ + * $Id: coda.h,v 1.5 1998/10/28 19:33:49 rvb Exp $ * */ + /* * * Based on cfs.h from Mach, but revamped for increased simplicity. @@ -59,7 +60,11 @@ 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 @@ -188,7 +193,7 @@ static __inline__ ino_t coda_f2i(struct ViceFid *fid) #else #define coda_f2i(fid)\ - (fid) ? ((fid)->Unique + ((fid)->Vnode<<10) + ((fid)->Volume<<20)) : 0 + ((fid) ? ((fid)->Unique + ((fid)->Vnode<<10) + ((fid)->Volume<<20)) : 0) #endif @@ -282,7 +287,15 @@ 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 @@ -392,11 +405,17 @@ 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 { @@ -711,11 +730,20 @@ 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_psdev.c b/sys/coda/coda_psdev.c index 07df46d..6a505ec 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.7 1998/09/29 20:19:45 rvb Exp $ + * $Id: coda_psdev.c,v 1.8 1998/10/28 20:31:13 rvb Exp $ * */ @@ -53,6 +53,13 @@ /* * HISTORY * $Log: coda_psdev.c,v $ + * 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 @@ -274,7 +281,7 @@ vc_nb_close (dev, flag, mode, p) struct proc *p; { register struct vcomm *vcp; - register struct vmsg *vmp; + register struct vmsg *vmp, *nvmp = NULL; struct coda_mntinfo *mi; int err; @@ -309,8 +316,9 @@ vc_nb_close (dev, flag, mode, p) /* Wakeup clients so they can return. */ for (vmp = (struct vmsg *)GETNEXT(vcp->vc_requests); !EOQ(vmp, vcp->vc_requests); - vmp = (struct vmsg *)GETNEXT(vmp->vm_chain)) - { + vmp = nvmp) + { + nvmp = (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) { @@ -535,6 +543,22 @@ 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; diff --git a/sys/coda/coda_venus.c b/sys/coda/coda_venus.c index 4f81ca1..96228f1 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.4 1998/09/13 13:57:59 rvb Exp $ + * $Id: coda_venus.c,v 1.5 1998/10/28 19:33:50 rvb Exp $ * */ @@ -159,6 +159,8 @@ } while (0) +int coda_kernel_version = CODA_KERNEL_VERSION; + int venus_root(void *mdp, struct ucred *cred, struct proc *p, @@ -408,7 +410,17 @@ 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/fs/coda/cnode.h b/sys/fs/coda/cnode.h index bd93389..bf6f632 100644 --- a/sys/fs/coda/cnode.h +++ b/sys/fs/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.3 1998/09/11 18:50:17 rvb Exp $ + * $Id: cnode.h,v 1.4 1998/09/13 13:57:59 rvb Exp $ * */ @@ -47,6 +47,9 @@ /* * 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.) @@ -294,19 +297,20 @@ enum dc_status { }; /* cfs_psdev.h */ -int coda_call(struct coda_mntinfo *mntinfo, int inSize, int *outSize, caddr_t buffer); +extern int coda_call(struct coda_mntinfo *mntinfo, int inSize, int *outSize, caddr_t buffer); +extern int coda_kernel_version; /* cfs_subr.h */ -int handleDownCall(int opcode, union outputArgs *out); -void coda_unmounting(struct mount *whoIam); -int coda_vmflush(struct cnode *cp); +extern int handleDownCall(int opcode, union outputArgs *out); +extern void coda_unmounting(struct mount *whoIam); +extern int coda_vmflush(struct cnode *cp); /* cfs_vnodeops.h */ -struct cnode *make_coda_node(ViceFid *fid, struct mount *vfsp, short type); -int coda_vnodeopstats_init(void); +extern struct cnode *make_coda_node(ViceFid *fid, struct mount *vfsp, short type); +extern int coda_vnodeopstats_init(void); /* coda_vfsops.h */ -struct mount *devtomp(dev_t dev); +extern struct mount *devtomp(dev_t dev); /* sigh */ #define CODA_RDWR ((u_long) 31) diff --git a/sys/fs/coda/coda.h b/sys/fs/coda/coda.h index 8426d00..7b67ea9 100644 --- a/sys/fs/coda/coda.h +++ b/sys/fs/coda/coda.h @@ -27,10 +27,11 @@ * 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.4 1998/09/13 13:57:59 rvb Exp $ + * $Id: coda.h,v 1.5 1998/10/28 19:33:49 rvb Exp $ * */ + /* * * Based on cfs.h from Mach, but revamped for increased simplicity. @@ -59,7 +60,11 @@ 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 @@ -188,7 +193,7 @@ static __inline__ ino_t coda_f2i(struct ViceFid *fid) #else #define coda_f2i(fid)\ - (fid) ? ((fid)->Unique + ((fid)->Vnode<<10) + ((fid)->Volume<<20)) : 0 + ((fid) ? ((fid)->Unique + ((fid)->Vnode<<10) + ((fid)->Volume<<20)) : 0) #endif @@ -282,7 +287,15 @@ 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 @@ -392,11 +405,17 @@ 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 { @@ -711,11 +730,20 @@ 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/fs/coda/coda_psdev.c b/sys/fs/coda/coda_psdev.c index 07df46d..6a505ec 100644 --- a/sys/fs/coda/coda_psdev.c +++ b/sys/fs/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.7 1998/09/29 20:19:45 rvb Exp $ + * $Id: coda_psdev.c,v 1.8 1998/10/28 20:31:13 rvb Exp $ * */ @@ -53,6 +53,13 @@ /* * HISTORY * $Log: coda_psdev.c,v $ + * 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 @@ -274,7 +281,7 @@ vc_nb_close (dev, flag, mode, p) struct proc *p; { register struct vcomm *vcp; - register struct vmsg *vmp; + register struct vmsg *vmp, *nvmp = NULL; struct coda_mntinfo *mi; int err; @@ -309,8 +316,9 @@ vc_nb_close (dev, flag, mode, p) /* Wakeup clients so they can return. */ for (vmp = (struct vmsg *)GETNEXT(vcp->vc_requests); !EOQ(vmp, vcp->vc_requests); - vmp = (struct vmsg *)GETNEXT(vmp->vm_chain)) - { + vmp = nvmp) + { + nvmp = (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) { @@ -535,6 +543,22 @@ 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; diff --git a/sys/fs/coda/coda_venus.c b/sys/fs/coda/coda_venus.c index 4f81ca1..96228f1 100644 --- a/sys/fs/coda/coda_venus.c +++ b/sys/fs/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.4 1998/09/13 13:57:59 rvb Exp $ + * $Id: coda_venus.c,v 1.5 1998/10/28 19:33:50 rvb Exp $ * */ @@ -159,6 +159,8 @@ } while (0) +int coda_kernel_version = CODA_KERNEL_VERSION; + int venus_root(void *mdp, struct ucred *cred, struct proc *p, @@ -408,7 +410,17 @@ 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); |