From 41159be768bc4f55444cbbb32e1457d64f43dc85 Mon Sep 17 00:00:00 2001 From: "Robert V. Baron" Date: Wed, 2 Sep 1998 19:09:53 +0000 Subject: [PATCH] Pass2 complete --- sys/cfs/00READ | 9 +- sys/cfs/README | 10 +- sys/cfs/TODO | 9 +- sys/cfs/cfs_fbsd.c | 120 ++---- sys/cfs/cfs_namecache.c | 96 ++--- sys/cfs/cfs_nbsd.c | 136 ------ sys/cfs/cfs_psdev.c | 141 ++---- sys/cfs/cfs_subr.c | 86 ++-- sys/cfs/cfs_subr.h | 62 +-- sys/cfs/cfs_venus.c | 77 ++-- sys/cfs/cfs_venus.h | 60 +-- sys/cfs/cfs_vfsops.c | 281 +++--------- sys/cfs/cfs_vfsops.h | 79 ++-- sys/cfs/cfs_vnodeops.c | 806 ++++------------------------------- sys/cfs/cfs_vnodeops.h | 77 ++-- sys/cfs/cfsio.h | 74 ++-- sys/cfs/cfsk.h | 62 +-- sys/cfs/cfsnc.h | 65 +-- sys/cfs/cnode.h | 105 ++--- sys/cfs/coda.h | 62 +-- sys/cfs/coda_opstats.h | 64 ++- sys/cfs/pioctl.h | 70 +-- sys/coda/00READ | 9 +- sys/coda/README | 10 +- sys/coda/TODO | 9 +- sys/coda/cnode.h | 105 ++--- sys/coda/coda.h | 62 +-- sys/coda/coda_fbsd.c | 120 ++---- sys/coda/coda_io.h | 74 ++-- sys/coda/coda_kernel.h | 62 +-- sys/coda/coda_namecache.c | 96 ++--- sys/coda/coda_namecache.h | 65 +-- sys/coda/coda_nbsd.c | 136 ------ sys/coda/coda_opstats.h | 64 ++- sys/coda/coda_pioctl.h | 70 +-- sys/coda/coda_psdev.c | 141 ++---- sys/coda/coda_subr.c | 86 ++-- sys/coda/coda_subr.h | 62 +-- sys/coda/coda_venus.c | 77 ++-- sys/coda/coda_venus.h | 60 +-- sys/coda/coda_vfsops.c | 281 +++--------- sys/coda/coda_vfsops.h | 79 ++-- sys/coda/coda_vnops.c | 806 ++++------------------------------- sys/coda/coda_vnops.h | 77 ++-- sys/conf/files | 1 - sys/fs/coda/README | 10 +- sys/fs/coda/TODO | 9 +- sys/fs/coda/cnode.h | 105 ++--- sys/fs/coda/coda.h | 62 +-- sys/fs/coda/coda_fbsd.c | 120 ++---- sys/fs/coda/coda_io.h | 74 ++-- sys/fs/coda/coda_kernel.h | 62 +-- sys/fs/coda/coda_namecache.c | 96 ++--- sys/fs/coda/coda_namecache.h | 65 +-- sys/fs/coda/coda_opstats.h | 64 ++- sys/fs/coda/coda_pioctl.h | 70 +-- sys/fs/coda/coda_psdev.c | 141 ++---- sys/fs/coda/coda_subr.c | 86 ++-- sys/fs/coda/coda_subr.h | 62 +-- sys/fs/coda/coda_venus.c | 77 ++-- sys/fs/coda/coda_venus.h | 60 +-- sys/fs/coda/coda_vfsops.c | 281 +++--------- sys/fs/coda/coda_vfsops.h | 79 ++-- sys/fs/coda/coda_vnops.c | 806 ++++------------------------------- sys/fs/coda/coda_vnops.h | 77 ++-- 65 files changed, 2149 insertions(+), 5360 deletions(-) delete mode 100644 sys/cfs/cfs_nbsd.c delete mode 100644 sys/coda/coda_nbsd.c diff --git a/sys/cfs/00READ b/sys/cfs/00READ index ce27b8af65de..29e45b1a008f 100644 --- a/sys/cfs/00READ +++ b/sys/cfs/00READ @@ -1,8 +1,3 @@ -NOTE: Please do not edit any files in this directory - until this NOTE is removed. - In the next week, I want to clear out all the - platform and release #ifdefs from the code. - 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 @@ -14,8 +9,8 @@ BUG: There is a bug in file mapping/executing. When a file is 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. +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 working, but hasn't been run long enough to be sure all the bugs are sorted out. Let me know if there are any problems. diff --git a/sys/cfs/README b/sys/cfs/README index 49ccad6ec50d..f9bf3c35cdc6 100644 --- a/sys/cfs/README +++ b/sys/cfs/README @@ -15,8 +15,8 @@ to experiment with. To get more information on Coda, I would like to refer people to http://www.coda.cs.cmu.edu -There is a wealth of documents, papers, theses there. There is also a -good introduction to the Coda File System in +There is a wealth of documents, papers, and theses there. There is +also a good introduction to the Coda File System in http://www.coda.cs.cmu.edu/ljpaper/lj.html Coda was originally developed as an academic prototype/testbed. It is @@ -45,11 +45,11 @@ The relevant sources, binaries, and docs can be found in ftp://ftp.coda.cs.cmu.edu/pub/coda/ We intend to come out with new Coda releases often, not daily. We -don't wish to slight any OS/platform not mentioned above. We are just +don't want to slight any OS/platform not mentioned above. We are just limited in our resources as to what we can support internally. We will be happy to integrate OpenBSD support as well as other OS -support. Also, adding platform support is relatively easy and we can -discuss this. The only problem is that Coda has a light weight +support. Also, adding platform support should be relatively easy and +we can discuss this. The only difficulty is that Coda has a light weight process package. It does some manipulations in assembler which would have to be redone for a different platform. diff --git a/sys/cfs/TODO b/sys/cfs/TODO index f19b4b675cba..eac514394b38 100644 --- a/sys/cfs/TODO +++ b/sys/cfs/TODO @@ -1,12 +1,17 @@ +OOPS: + FreeBSD does not fsync!!! + Near term: - Existing VOP_LOCKS's should proabably be - vn_lock since that is what they were in -stable. Fix bug in executing/mapping new files. + cfs_mount bug: interaction with cfs_inactive no cfs_unsave. + vref/vn_lock == vget except no VXWANT which may be on. + Review locks: vn_lock/VOP_UNLOCK/lockmgr ... Medium term: Add missing VFS methods. Do performance profile. Tune hash algorithm used in cfs_namecache. + Tune hash algorithm used in cfs_subr. Eventually: Use standard queue macros. diff --git a/sys/cfs/cfs_fbsd.c b/sys/cfs/cfs_fbsd.c index 23d55cc29d54..f137ff55389d 100644 --- a/sys/cfs/cfs_fbsd.c +++ b/sys/cfs/cfs_fbsd.c @@ -1,53 +1,56 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_fbsd.c,v 1.6 1998/08/28 18:12:11 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_fbsd.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ #include #include #include #include +#include #include #include -#include +#include +#include + #include #include +#include +#include +#include + #ifdef DEVFS #include #endif -#include - -#include -#include -#include -#include /* From: "Jordan K. Hubbard" @@ -63,7 +66,6 @@ Mellon the rights to redistribute these changes without encumbrance. #define VC_DEV_NO 93 -#ifdef __FreeBSD_version /* Type of device methods. */ extern d_open_t vc_nb_open; extern d_close_t vc_nb_close; @@ -76,33 +78,8 @@ static struct cdevsw vccdevsw = { vc_nb_open, vc_nb_close, vc_nb_read, vc_nb_write, /*93*/ vc_nb_ioctl, nostop, nullreset, nodevtotty, - vc_nb_poll, nommap, NULL, "Coda", NULL, -1 }; -#else -/* Type of device methods. */ -#define D_OPEN_T d_open_t -#define D_CLOSE_T d_close_t -#define D_RDWR_T d_rdwr_t -#define D_READ_T d_read_t -#define D_WRITE_T d_write_t -#define D_IOCTL_T d_ioctl_t -#define D_SELECT_T d_select_t - -/* rvb why */ -D_OPEN_T vc_nb_open; /* was is defined in cfs_FreeBSD.h */ -D_CLOSE_T vc_nb_close; -D_READ_T vc_nb_read; -D_WRITE_T vc_nb_write; -D_IOCTL_T vc_nb_ioctl; -D_SELECT_T vc_nb_select; - -static struct cdevsw vccdevsw = -{ - vc_nb_open, vc_nb_close, vc_nb_read, vc_nb_write, - vc_nb_ioctl, nostop, nullreset, nodevtotty, - vc_nb_select, nommap, NULL, "Coda", NULL, -1 }; - -PSEUDO_SET(vcattach, vc); -#endif + vc_nb_poll, nommap, NULL, "Coda", NULL, -1 +}; void vcattach __P((void)); static dev_t vccdev; @@ -125,21 +102,9 @@ vcattach(void) VCDEBUG("cfs: vccdevsw entry installed at %d.\n", major(vccdev)); } -void -cvref(vp) - struct vnode *vp; -{ - if (vp->v_usecount <= 0) - panic("vref used where vget required"); - - vp->v_usecount++; -} - - -#ifdef __FreeBSD_version static vc_devsw_installed = 0; - static void vc_drvinit __P((void *unused)); + static void vc_drvinit(void *unused) { @@ -238,4 +203,3 @@ cfs_fbsd_putpages(v) SYSINIT(vccdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+VC_DEV_NO,vc_drvinit,NULL) -#endif diff --git a/sys/cfs/cfs_namecache.c b/sys/cfs/cfs_namecache.c index 6c80a2607c34..eb5e8bff82b8 100644 --- a/sys/cfs/cfs_namecache.c +++ b/sys/cfs/cfs_namecache.c @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_namecache.c,v 1.11 1998/08/28 18:12:16 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_namecache.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -45,6 +47,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cfs_namecache.c,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.11 1998/08/28 18:12:16 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -206,32 +211,25 @@ Mellon the rights to redistribute these changes without encumbrance. #include #include #include +#include #include +#ifndef insque +#include +#endif /* insque */ + +#include +#include + #include #include #include -#if defined(__NetBSD__) || defined(__FreeBSD__) -#ifndef insque -#include -#endif /* insque */ -#endif /* __NetBSD__ || defined(__FreeBSD__) */ - -#ifdef __FreeBSD__ -#include -#include -#ifdef __FreeBSD_version -#include -#endif -#endif - /* * Declaration of the name cache data structure. */ int cfsnc_use = 1; /* Indicate use of CFS Name Cache */ - int cfsnc_size = CFSNC_CACHESIZE; /* size of the cache */ int cfsnc_hashsize = CFSNC_HASHSIZE; /* size of the primary hash */ @@ -246,16 +244,12 @@ struct cfsnc_statistics cfsnc_stat; /* Keep various stats */ */ int cfsnc_debug = 0; - /* * Entry points for the CFS Name Cache */ -static struct cfscache * -cfsnc_find(struct cnode *dcp, const char *name, int namelen, +static struct cfscache *cfsnc_find(struct cnode *dcp, const char *name, int namelen, struct ucred *cred, int hash); -static void -cfsnc_remove(struct cfscache *cncp, enum dc_status dcstat); - +static void cfsnc_remove(struct cfscache *cncp, enum dc_status dcstat); /* * Initialize the cache, the LRU structure and the Hash structure(s) @@ -657,7 +651,7 @@ cfsnc_zapfile(dcp, name, namelen) while (cncp) { cfsnchash[hash].length--; /* Used for tuning */ -/* 1.3 */ + cfsnc_remove(cncp, NOT_DOWNCALL); cncp = cfsnc_find(dcp, name, namelen, 0, hash); } diff --git a/sys/cfs/cfs_nbsd.c b/sys/cfs/cfs_nbsd.c deleted file mode 100644 index eb117ce58003..000000000000 --- a/sys/cfs/cfs_nbsd.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_nbsd.c,v 1.21 1998/08/28 18:12:17 rvb Exp $ */ - -/* - * Mach Operating System - * Copyright (c) 1990 Carnegie-Mellon University - * Copyright (c) 1989 Carnegie-Mellon University - * All rights reserved. The CMU software License Agreement specifies - * the terms and conditions for use and redistribution. - */ - -/* - * This code was written for the Coda file system at Carnegie Mellon - * University. Contributers include David Steere, James Kistler, - * M. Satyanarayanan, and Brian Noble. - */ - -/* - * HISTORY - * $Log: cfs_nbsd.c,v $ - * Revision 1.21 1998/08/28 18:12:17 rvb - * Now it also works on FreeBSD -current. This code will be - * committed to the FreeBSD -current and NetBSD -current - * trees. It will then be tailored to the particular platform - * by flushing conditional code. - * - * Revision 1.20 1998/08/18 17:05:15 rvb - * Don't use __RCSID now - * - * Revision 1.19 1998/08/18 16:31:40 rvb - * Sync the code for NetBSD -current; test on 1.3 later - * - * Revision 1.18 98/01/23 11:53:40 rvb - * Bring RVB_CFS1_1 to HEAD - * - * Revision 1.17.2.1 97/12/09 16:07:11 rvb - * Sync with vfs/include/coda.h - * - * Revision 1.17 97/12/05 10:39:15 rvb - * Read CHANGES - * - * Revision 1.16.6.5 97/11/20 11:46:39 rvb - * Capture current cfs_venus - * - * Revision 1.16.6.4 97/11/18 10:27:14 rvb - * cfs_nbsd.c is DEAD!!!; integrated into cfs_vf/vnops.c - * cfs_nb_foo and cfs_foo are joined - * - * Revision 1.16.6.3 97/11/13 22:02:58 rvb - * pass2 cfs_NetBSD.h mt - * - * Revision 1.16.6.2 97/11/12 12:09:37 rvb - * reorg pass1 - * - * Revision 1.16.6.1 97/10/28 23:10:14 rvb - * >64Meg; venus can be killed! - * - * Revision 1.16 97/07/18 15:28:41 rvb - * Bigger/Better/Faster than AFS - * - * Revision 1.15 1997/02/19 18:41:39 bnoble - * Didn't sufficiently unswap the now-unswapped dvp and vp in cfs_nb_link - * - * Revision 1.13 1997/02/18 23:46:25 bnoble - * NetBSD swapped the order of arguments to VOP_LINK between 1.1 and 1.2. - * This tracks that change. - * - * Revision 1.12 1997/02/18 22:23:38 bnoble - * Rename lockdebug to cfs_lockdebug - * - * Revision 1.11 1997/02/13 18:46:14 rvb - * Name CODA FS for df - * - * Revision 1.10 1997/02/12 15:32:05 rvb - * Make statfs return values like for AFS - * - * Revision 1.9 1997/01/30 16:42:02 bnoble - * Trace version as of SIGCOMM submission. Minor fix in cfs_nb_open - * - * Revision 1.8 1997/01/13 17:11:05 bnoble - * Coda statfs needs to return something other than -1 for blocks avail. and - * files available for wabi (and other windowsish) programs to install - * there correctly. - * - * Revision 1.6 1996/12/05 16:20:14 bnoble - * Minor debugging aids - * - * Revision 1.5 1996/11/25 18:25:11 bnoble - * Added a diagnostic check for cfs_nb_lock - * - * Revision 1.4 1996/11/13 04:14:19 bnoble - * Merging BNOBLE_WORK_6_20_96 into main line - * - * - * Revision 1.3 1996/11/08 18:06:11 bnoble - * Minor changes in vnode operation signature, VOP_UPDATE signature, and - * some newly defined bits in the include files. - * - * Revision 1.2.8.1 1996/06/26 16:28:26 bnoble - * Minor bug fixes - * - * Revision 1.2 1996/01/02 16:56:52 bnoble - * Added support for Coda MiniCache and raw inode calls (final commit) - * - * Revision 1.1.2.1 1995/12/20 01:57:17 bnoble - * Added CFS-specific files - * - */ diff --git a/sys/cfs/cfs_psdev.c b/sys/cfs/cfs_psdev.c index 47b4754f8dcd..3c7c7242bda1 100644 --- a/sys/cfs/cfs_psdev.c +++ b/sys/cfs/cfs_psdev.c @@ -1,35 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_psdev.c,v 1.9 1998/08/28 18:12:17 rvb Exp $ */ - -#define CTL_C + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_psdev.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -43,20 +43,19 @@ Mellon the rights to redistribute these changes without encumbrance. * University. Contributers include David Steere, James Kistler, and * M. Satyanarayanan. */ -/* ************************************************** */ -/* These routines define the psuedo device for communication between +/* + * These routines define the psuedo device for communication between * Coda's Venus and Minicache in Mach 2.6. They used to be in cfs_subr.c, * but I moved them to make it easier to port the Minicache without * porting coda. -- DCS 10/12/94 */ -/* - * Renamed to cfs_psdev: pseudo-device driver. - */ - /* * HISTORY * $Log: cfs_psdev.c,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.9 1998/08/28 18:12:17 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -153,40 +152,28 @@ Mellon the rights to redistribute these changes without encumbrance. extern int cfsnc_initialized; /* Set if cache has been initialized */ #include + #include #include #include -#include #include +#include #include #include -#ifdef __FreeBSD_version #include -#else -#include -#endif -#ifdef NetBSD1_3 #include -#endif -#ifdef __FreeBSD_version -#include -#else -#include -#endif +#include #include #include #include #include +#define CTL_C + int cfs_psdev_print_entry = 0; -#ifdef __GNUC__ -#define ENTRY \ - if(cfs_psdev_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) -#else -#define ENTRY -#endif +#define ENTRY if(cfs_psdev_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) void vcfsattach(int n); int vc_nb_open(dev_t dev, int flag, int mode, struct proc *p); @@ -194,11 +181,7 @@ int vc_nb_close (dev_t dev, int flag, int mode, struct proc *p); int vc_nb_read(dev_t dev, struct uio *uiop, int flag); int vc_nb_write(dev_t dev, struct uio *uiop, int flag); int vc_nb_ioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p); -#if defined(NetBSD1_3) || defined(__FreeBSD_version) int vc_nb_poll(dev_t dev, int events, struct proc *p); -#else -int vc_nb_select(dev_t dev, int flag, struct proc *p); -#endif struct vmsg { struct queue vm_chain; @@ -222,9 +205,6 @@ vcfsattach(n) { } -/* - * These functions are written for NetBSD. - */ int vc_nb_open(dev, flag, mode, p) dev_t dev; @@ -289,14 +269,6 @@ vc_nb_close (dev, flag, mode, p) if (mi->mi_rootvp) { /* Let unmount know this is for real */ VTOC(mi->mi_rootvp)->c_flags |= C_UNMOUNTING; -#ifdef NEW_LOCKMGR -#ifdef __FreeBSD_version - /* dounmount is different ... probably wrong ... */ -#else - if (vfs_busy(mi->mi_vfsp, 0, 0)) - return (EBUSY); -#endif -#endif cfs_unmounting(mi->mi_vfsp); err = dounmount(mi->mi_vfsp, flag, p); if (err) @@ -523,7 +495,6 @@ vc_nb_ioctl(dev, cmd, addr, flag, p) } } -#if defined(NetBSD1_3) || defined(__FreeBSD_version) int vc_nb_poll(dev, events, p) dev_t dev; @@ -551,33 +522,6 @@ vc_nb_poll(dev, events, p) return(0); } -#else -int -vc_nb_select(dev, flag, p) - dev_t dev; - int flag; - struct proc *p; -{ - register struct vcomm *vcp; - - ENTRY; - - if (minor(dev) >= NVCFS || minor(dev) < 0) - return(ENXIO); - - vcp = &cfs_mnttbl[minor(dev)].mi_vcomm; - - if (flag != FREAD) - return(0); - - if (!EMPTY(vcp->vc_requests)) - return(1); - - selrecord(p, &(vcp->vc_selproc)); - - return(0); -} -#endif /* * Statistics @@ -593,7 +537,6 @@ struct cfs_clstat cfs_clstat; * (e.g. kill -9). */ -/* If you want this to be interruptible, set this to > PZERO */ int cfscall_sleep = PZERO - 1; #ifdef CTL_C int cfs_pcatch = PCATCH; diff --git a/sys/cfs/cfs_subr.c b/sys/cfs/cfs_subr.c index 3d20e578788c..a2fd7922e1de 100644 --- a/sys/cfs/cfs_subr.c +++ b/sys/cfs/cfs_subr.c @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_subr.c,v 1.11 1998/08/28 18:12:18 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_subr.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -44,6 +46,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cfs_subr.c,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.11 1998/08/28 18:12:18 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -202,8 +207,8 @@ Mellon the rights to redistribute these changes without encumbrance. #include #include -#include #include +#include #include #include @@ -212,8 +217,6 @@ Mellon the rights to redistribute these changes without encumbrance. #include #include -#if NVCFS - int cfs_active = 0; int cfs_reuse = 0; int cfs_new = 0; @@ -221,11 +224,8 @@ int cfs_new = 0; struct cnode *cfs_freelist = NULL; struct cnode *cfs_cache[CFS_CACHESIZE]; -#define cfshash(fid) \ - (((fid)->Volume + (fid)->Vnode) & (CFS_CACHESIZE-1)) - +#define cfshash(fid) (((fid)->Volume + (fid)->Vnode) & (CFS_CACHESIZE-1)) #define CNODE_NEXT(cp) ((cp)->c_next) - #define ODD(vnode) ((vnode) & 0x1) /* @@ -690,24 +690,13 @@ int cfs_vmflush(cp) struct cnode *cp; { -#if 0 - /* old code */ - /* Unset so that page_read doesn't try to use - (possibly) invalid cache file. */ - cp->c_device = 0; - cp->c_inode = 0; - - return(inode_uncache_try(VTOI(CTOV(cp))) ? 0 : ETXTBSY); -#else /* __NetBSD__ || __FreeBSD__ */ return 0; -#endif /* __NetBSD__ || __FreeBSD__ */ } /* * kernel-internal debugging switches */ - void cfs_debugon(void) { cfsdebug = -1; @@ -745,6 +734,3 @@ void cfs_debugoff(void) * 13) all <= 3 * ... */ - - -#endif /* NVCFS */ diff --git a/sys/cfs/cfs_subr.h b/sys/cfs/cfs_subr.h index cf983d420dc1..4beedc9436f9 100644 --- a/sys/cfs/cfs_subr.h +++ b/sys/cfs/cfs_subr.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_subr.h,v 1.4 1998/08/18 17:05:16 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_subr.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ struct cnode *cfs_alloc(void); void cfs_free(struct cnode *cp); @@ -41,5 +43,3 @@ void cfs_debugoff(void); int cfs_kill(struct mount *whoIam, enum dc_status dcstat); void cfs_save(struct cnode *cp); void cfs_unsave(struct cnode *cp); - - diff --git a/sys/cfs/cfs_venus.c b/sys/cfs/cfs_venus.c index 87679148cd11..7f7b30b9a17d 100644 --- a/sys/cfs/cfs_venus.c +++ b/sys/cfs/cfs_venus.c @@ -1,45 +1,42 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_venus.c,v 1.11 1998/08/28 18:12:20 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_venus.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ #include #include #include #include #include -#ifdef __FreeBSD_version #include -#else -#include -#endif -/* for CNV_OFLAGS below */ #include #include @@ -342,11 +339,11 @@ venus_access(void *mdp, ViceFid *fid, int mode, /* send the open to venus. */ INIT_IN(&inp->ih, CFS_ACCESS, cred, p); inp->VFid = *fid; -#ifdef NetBSD1_3 - inp->flags = mode; -#else + /* NOTE: + * NetBSD and Venus internals use the "data" in the low 3 bits. + * Hence, the conversion. + */ inp->flags = mode>>6; -#endif error = cfscall(mdp, Isize, &Osize, (char *)inp); @@ -437,11 +434,7 @@ venus_create(void *mdp, ViceFid *fid, INIT_IN(&inp->ih, CFS_CREATE, cred, p); inp->VFid = *fid; inp->excl = exclusive ? C_O_EXCL : 0; -#ifdef NetBSD1_3 - inp->mode = mode<<6; -#else inp->mode = mode; -#endif CNV_V2VV_ATTR(&inp->attr, va); inp->name = Isize; diff --git a/sys/cfs/cfs_venus.h b/sys/cfs/cfs_venus.h index 19c95e77ecc6..ee0fb4f6cd4e 100644 --- a/sys/cfs/cfs_venus.h +++ b/sys/cfs/cfs_venus.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_venus.h,v 1.4 1998/08/18 17:05:18 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_venus.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ int venus_root(void *mdp, diff --git a/sys/cfs/cfs_vfsops.c b/sys/cfs/cfs_vfsops.c index d44533a127bb..64861680b1c6 100644 --- a/sys/cfs/cfs_vfsops.c +++ b/sys/cfs/cfs_vfsops.c @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_vfsops.c,v 1.11 1998/08/28 18:12:22 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -45,6 +47,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cfs_vfsops.c,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.11 1998/08/28 18:12:22 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -173,11 +178,12 @@ Mellon the rights to redistribute these changes without encumbrance. #include #include +#include +#include #include #include #include #include -#include #include #include @@ -186,25 +192,14 @@ Mellon the rights to redistribute these changes without encumbrance. #include #include #include -/* for VN_RDEV */ + #include -#ifdef __FreeBSD__ -#ifdef __FreeBSD_version MALLOC_DEFINE(M_CFS, "CFS storage", "Various Coda Structures"); -#endif -#endif int cfsdebug = 0; - int cfs_vfsop_print_entry = 0; -#ifdef __GNUC__ -#define ENTRY \ - if(cfs_vfsop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) -#else -#define ENTRY -#endif - +#define ENTRY if(cfs_vfsop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) struct vnode *cfs_ctlvp; struct cfs_mntinfo cfs_mnttbl[NVCFS]; /* indexed by minor device number */ @@ -220,65 +215,7 @@ struct cfs_op_stats cfs_vfsopstats[CFS_VFSOPS_SIZE]; extern int cfsnc_initialized; /* Set if cache has been initialized */ extern int vc_nb_open __P((dev_t, int, int, struct proc *)); -#ifdef __NetBSD__ -extern struct cdevsw cdevsw[]; /* For sanity check in cfs_mount */ -#endif -/* NetBSD interface to statfs */ -#if defined(__NetBSD__) && defined(NetBSD1_3) && (NetBSD1_3 >= 5) -extern struct vnodeopv_desc cfs_vnodeop_opv_desc; - -struct vnodeopv_desc *cfs_vnodeopv_descs[] = { - &cfs_vnodeop_opv_desc, - NULL, -}; - -struct vfsops cfs_vfsops = { - MOUNT_CFS, - cfs_mount, - cfs_start, - cfs_unmount, - cfs_root, - cfs_quotactl, - cfs_nb_statfs, - cfs_sync, - cfs_vget, - (int (*) (struct mount *, struct fid *, struct mbuf *, struct vnode **, - int *, struct ucred **)) - eopnotsupp, - (int (*) (struct vnode *, struct fid *)) eopnotsupp, - cfs_init, -#if (NetBSD1_3 >= 7) - cfs_sysctl, -#endif - (int (*)(void)) eopnotsupp, - cfs_vnodeopv_descs, - 0 -}; -#elif defined(__NetBSD__) -struct vfsops cfs_vfsops = { - MOUNT_CFS, - cfs_mount, - cfs_start, - cfs_unmount, - cfs_root, - cfs_quotactl, - cfs_nb_statfs, - cfs_sync, - cfs_vget, - (int (*) (struct mount *, struct fid *, struct mbuf *, struct vnode **, - int *, struct ucred **)) - eopnotsupp, - (int (*) (struct vnode *, struct fid *)) eopnotsupp, - cfs_init, -#ifdef NetBSD1_3 - (int (*)(void)) eopnotsupp, -#endif - 0 -}; - -#elif defined(__FreeBSD__) -#ifdef __FreeBSD_version struct vfsops cfs_vfsops = { cfs_mount, cfs_start, @@ -295,29 +232,7 @@ struct vfsops cfs_vfsops = { cfs_init, }; -#else -struct vfsops cfs_vfsops = { - cfs_mount, - cfs_start, - cfs_unmount, - cfs_root, - cfs_quotactl, - cfs_nb_statfs, - cfs_sync, - cfs_vget, - (int (*) (struct mount *, struct fid *, struct mbuf *, struct vnode **, - int *, struct ucred **)) - eopnotsupp, - (int (*) (struct vnode *, struct fid *)) eopnotsupp, - cfs_init, -}; - -#endif - - -#include VFS_SET(cfs_vfsops, cfs, MOUNT_CFS, VFCF_NETWORK); -#endif int cfs_vfsopstats_init(void) @@ -335,7 +250,6 @@ cfs_vfsopstats_init(void) return 0; } - /* * cfs mount vfsop * Set up mount info record and attach it to vfs struct. @@ -344,13 +258,8 @@ cfs_vfsopstats_init(void) int cfs_mount(vfsp, path, data, ndp, p) struct mount *vfsp; /* Allocated and initialized by mount(2) */ -#ifdef NetBSD1_3 - const char *path; /* path covered: ignored by the fs-layer */ - void *data; /* Need to define a data type for this in netbsd? */ -#else char *path; /* path covered: ignored by the fs-layer */ caddr_t data; /* Need to define a data type for this in netbsd? */ -#endif struct nameidata *ndp; /* Clobber this to lookup the device name */ struct proc *p; /* The ever-famous proc pointer */ { @@ -399,11 +308,7 @@ cfs_mount(vfsp, path, data, ndp, p) /* * See if the device table matches our expectations. */ -#ifdef __NetBSD__ - if (cdevsw[major(dev)].d_open != vc_nb_open) -#elif defined(__FreeBSD__) if (cdevsw[major(dev)]->d_open != vc_nb_open) -#endif { MARK_INT_FAIL(CFS_MOUNT_STATS); return(ENXIO); @@ -426,19 +331,8 @@ cfs_mount(vfsp, path, data, ndp, p) /* No initialization (here) of mi_vcomm! */ vfsp->mnt_data = (qaddr_t)mi; -#ifdef __NetBSD__ - vfsp->mnt_stat.f_fsid.val[0] = 0; - vfsp->mnt_stat.f_fsid.val[1] = makefstype(MOUNT_CFS); -#elif defined(__FreeBSD__) && defined(__FreeBSD_version) - vfs_getnewfsid (vfsp); -#elif defined(__FreeBSD__) - /* Seems a bit overkill, since usualy /coda is the only mount point - * for cfs. - */ - getnewfsid (vfsp, MOUNT_CFS); -#endif mi->mi_vfsp = vfsp; /* @@ -471,13 +365,12 @@ cfs_mount(vfsp, path, data, ndp, p) /* set filesystem block size */ vfsp->mnt_stat.f_bsize = 8192; /* XXX -JJK */ -#ifdef __FreeBSD__ + /* Set f_iosize. XXX -- inamura@isl.ntt.co.jp. For vnode_pager_haspage() references. The value should be obtained from underlying UFS. */ /* Checked UFS. iosize is set as 8192 */ vfsp->mnt_stat.f_iosize = 8192; -#endif /* error is currently guaranteed to be zero, but in case some code changes... */ @@ -526,27 +419,10 @@ cfs_unmount(vfsp, mntflags, p) #endif vrele(mi->mi_rootvp); -#ifdef NetBSD1_3 - active = cfs_kill(vfsp, NOT_DOWNCALL); - -#if defined(__NetBSD__) && defined(NetBSD1_3) && (NetBSD1_3 >= 7) - if (1) -#else - if ((error = vfs_busy(mi->mi_vfsp)) == 0) -#endif - { - error = vflush(mi->mi_vfsp, NULLVP, FORCECLOSE); - printf("cfs_unmount: active = %d, vflush active %d\n", active, error); - error = 0; - } else { - printf("cfs_unmount: busy\n"); - } -#else /* FreeBSD I guess */ active = cfs_kill(vfsp, NOT_DOWNCALL); error = vflush(mi->mi_vfsp, NULLVP, FORCECLOSE); printf("cfs_unmount: active = %d, vflush active %d\n", active, error); error = 0; -#endif /* I'm going to take this out to allow lookups to go through. I'm * not sure it's important anyway. -- DCS 2/2/94 */ @@ -591,8 +467,12 @@ cfs_root(vfsp, vpp) { /* Found valid root. */ *vpp = mi->mi_rootvp; /* On Mach, this is vref. On NetBSD, VOP_LOCK */ +#if 1 vref(*vpp); - VOP_X_LOCK(*vpp, LK_EXCLUSIVE); + vn_lock(*vpp, LK_EXCLUSIVE, p); +#else + vget(*vpp, LK_EXCLUSIVE, p); +#endif MARK_INT_SAT(CFS_ROOT_STATS); return(0); } @@ -610,8 +490,13 @@ cfs_root(vfsp, vpp) cfs_save(VTOC(mi->mi_rootvp)); *vpp = mi->mi_rootvp; +#if 1 vref(*vpp); - VOP_X_LOCK(*vpp, LK_EXCLUSIVE); + vn_lock(*vpp, LK_EXCLUSIVE, p); +#else + vget(*vpp, LK_EXCLUSIVE, p); +#endif + MARK_INT_SAT(CFS_ROOT_STATS); goto exit; } else if (error == ENODEV) { @@ -625,8 +510,13 @@ cfs_root(vfsp, vpp) * will fail. */ *vpp = mi->mi_rootvp; +#if 1 vref(*vpp); - VOP_X_LOCK(*vpp, LK_EXCLUSIVE); + vn_lock(*vpp, LK_EXCLUSIVE, p); +#else + vget(*vpp, LK_EXCLUSIVE, p); +#endif + MARK_INT_FAIL(CFS_ROOT_STATS); error = 0; goto exit; @@ -636,6 +526,7 @@ cfs_root(vfsp, vpp) goto exit; } + exit: return(error); } @@ -674,11 +565,7 @@ cfs_nb_statfs(vfsp, sbp, p) #define NB_SFS_SIZ 0x895440 */ /* Note: Normal fs's have a bsize of 0x400 == 1024 */ -#ifdef __NetBSD__ - sbp->f_type = 0; -#elif defined(__FreeBSD__) sbp->f_type = MOUNT_CFS; -#endif sbp->f_bsize = 8192; /* XXX */ sbp->f_iosize = 8192; /* XXX */ #define NB_SFS_SIZ 0x8AB75D @@ -688,9 +575,6 @@ cfs_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)); -#ifdef __NetBSD__ - strncpy(sbp->f_fstypename, MOUNT_CFS, MFSNAMELEN-1); -#endif strcpy(sbp->f_mntonname, "/coda"); strcpy(sbp->f_mntfromname, "CFS"); /* MARK_INT_SAT(CFS_STATFS_STATS); */ @@ -780,57 +664,12 @@ cfs_vptofh(vnp, fidp) return (EOPNOTSUPP); } -#ifdef __NetBSD__ -void -cfs_init(void) -{ - ENTRY; -} -#elif defined(__FreeBSD__) -#ifdef __FreeBSD_version int cfs_init(struct vfsconf *vfsp) { ENTRY; return 0; } -#else -int -cfs_init(void) -{ - ENTRY; - return 0; -} -#endif -#endif - -#if defined(__NetBSD__) && defined(NetBSD1_3) && (NetBSD1_3 >= 7) -int -cfs_sysctl(name, namelen, oldp, oldlp, newp, newl, p) - int *name; - u_int namelen; - void *oldp; - size_t *oldlp; - void *newp; - size_t newl; - struct proc *p; -{ - - /* all sysctl names at this level are terminal */ - if (namelen != 1) - return (ENOTDIR); /* overloaded */ - - switch (name[0]) { -/* - case FFS_CLUSTERREAD: - return (sysctl_int(oldp, oldlp, newp, newl, &doclusterread)); - */ - default: - return (EOPNOTSUPP); - } - /* NOTREACHED */ -} -#endif /* * To allow for greater ease of use, some vnodes may be orphaned when @@ -873,11 +712,7 @@ struct mount *devtomp(dev) for (mp = mountlist.cqh_first; mp != (void*)&mountlist; mp = nmp) { nmp = mp->mnt_list.cqe_next; - if ( -#ifdef __NetBSD__ - (!strcmp(mp->mnt_op->vfs_name, MOUNT_UFS)) && -#endif - ((VFSTOUFS(mp))->um_dev == (dev_t) dev)) { + if (((VFSTOUFS(mp))->um_dev == (dev_t) dev)) { /* mount corresponds to UFS and the device matches one we want */ return(mp); } diff --git a/sys/cfs/cfs_vfsops.h b/sys/cfs/cfs_vfsops.h index 9f8e77767a3f..754bbf321dcf 100644 --- a/sys/cfs/cfs_vfsops.h +++ b/sys/cfs/cfs_vfsops.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_vfsops.h,v 1.9 1998/08/28 18:12:22 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_vfsops.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * cfid structure: @@ -41,17 +43,11 @@ struct cfid { ViceFid cfid_fid; }; - struct mount; int cfs_vfsopstats_init(void); -#ifdef NetBSD1_3 -int cfs_mount(struct mount *, const char *, void *, struct nameidata *, - struct proc *); -#else int cfs_mount(struct mount *, char *, caddr_t, struct nameidata *, struct proc *); -#endif int cfs_start(struct mount *, int, struct proc *); int cfs_unmount(struct mount *, int, struct proc *); int cfs_root(struct mount *, struct vnode **); @@ -62,17 +58,6 @@ int cfs_vget(struct mount *, ino_t, struct vnode **); int cfs_fhtovp(struct mount *, struct fid *, struct mbuf *, struct vnode **, int *, struct ucred **); int cfs_vptofh(struct vnode *, struct fid *); -#ifdef __NetBSD__ -void cfs_init(void); -#elif defined(__FreeBSD__) -#ifdef __FreeBSD_version int cfs_init(struct vfsconf *vfsp); -#else -int cfs_init(void); -#endif -#endif -#if defined(__NetBSD__) && defined(NetBSD1_3) && (NetBSD1_3 >= 7) -int cfs_sysctl(int *, u_int, void *, size_t *, void *, size_t, - struct proc *); -#endif + int getNewVnode(struct vnode **vpp); diff --git a/sys/cfs/cfs_vnodeops.c b/sys/cfs/cfs_vnodeops.c index 69197d7e8912..c5c82038581b 100644 --- a/sys/cfs/cfs_vnodeops.c +++ b/sys/cfs/cfs_vnodeops.c @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_vnodeops.c,v 1.12 1998/08/28 18:28:00 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_vnodeops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -46,6 +48,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cfs_vnodeops.c,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.12 1998/08/28 18:28:00 rvb * NetBSD -current is stricter! * @@ -214,35 +219,23 @@ Mellon the rights to redistribute these changes without encumbrance. #include #include +#include +#include #include +#include #include #include #include +#include #include #include -#ifdef __FreeBSD_version #include -#else -#include -#endif -#include -#include #include -#ifdef __NetBSD__ -#include -#endif -#include -#ifdef NetBSD1_3 -#include -#endif -#ifdef __FreeBSD__ +#include #include #include -#ifdef __FreeBSD_version -#include -#endif -#endif +#include #include #include @@ -256,7 +249,6 @@ Mellon the rights to redistribute these changes without encumbrance. /* * These flags select various performance enhancements. */ -int cfs_intercept_rdwr = 1; /* Set to handle read/write in the kernel */ int cfs_attr_cache = 1; /* Set to cache attributes in the kernel */ int cfs_symlink_cache = 1; /* Set to cache symbolic link information */ int cfs_access_cache = 1; /* Set to handle some access checks directly */ @@ -284,20 +276,15 @@ static int cfs_lockdebug = 0; * cfs_init is called at boot time. */ -#ifdef __GNUC__ -#define ENTRY \ - if(cfs_vnop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) -#else -#define ENTRY -#endif +#define ENTRY if(cfs_vnop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) /* Definition of the vnode operation vector */ struct vnodeopv_entry_desc cfs_vnodeop_entries[] = { - { &vop_default_desc, nbsd_vop_error }, + { &vop_default_desc, cfs_vop_error }, { &vop_lookup_desc, cfs_lookup }, /* lookup */ { &vop_create_desc, cfs_create }, /* create */ - { &vop_mknod_desc, nbsd_vop_error }, /* mknod */ + { &vop_mknod_desc, cfs_vop_error }, /* mknod */ { &vop_open_desc, cfs_open }, /* open */ { &vop_close_desc, cfs_close }, /* close */ { &vop_access_desc, cfs_access }, /* access */ @@ -306,8 +293,7 @@ struct vnodeopv_entry_desc cfs_vnodeop_entries[] = { { &vop_read_desc, cfs_read }, /* read */ { &vop_write_desc, cfs_write }, /* write */ { &vop_ioctl_desc, cfs_ioctl }, /* ioctl */ -/* 1.3 { &vop_select_desc, cfs_select }, select */ - { &vop_mmap_desc, nbsd_vop_error }, /* mmap */ + { &vop_mmap_desc, cfs_vop_error }, /* mmap */ { &vop_fsync_desc, cfs_fsync }, /* fsync */ { &vop_remove_desc, cfs_remove }, /* remove */ { &vop_link_desc, cfs_link }, /* link */ @@ -324,41 +310,19 @@ struct vnodeopv_entry_desc cfs_vnodeop_entries[] = { { &vop_unlock_desc, cfs_unlock }, /* unlock */ { &vop_bmap_desc, cfs_bmap }, /* bmap */ { &vop_strategy_desc, cfs_strategy }, /* strategy */ - { &vop_print_desc, nbsd_vop_error }, /* print */ + { &vop_print_desc, cfs_vop_error }, /* print */ { &vop_islocked_desc, cfs_islocked }, /* islocked */ - { &vop_pathconf_desc, nbsd_vop_error }, /* pathconf */ - { &vop_advlock_desc, nbsd_vop_nop }, /* advlock */ - { &vop_bwrite_desc, nbsd_vop_error }, /* bwrite */ - { &vop_lease_desc, nbsd_vop_nop }, /* lease */ - -#ifdef __FreeBSD_version -#else /* FreeBSD stable & NetBSD both */ - { &vop_blkatoff_desc, nbsd_vop_error }, /* blkatoff */ - { &vop_valloc_desc, nbsd_vop_error }, /* valloc */ - { &vop_vfree_desc, nbsd_vop_error }, /* vfree */ - { &vop_truncate_desc, nbsd_vop_error }, /* truncate */ - { &vop_update_desc, nbsd_vop_error }, /* update */ -#endif - - /* NetBSD only */ -#ifdef __NetBSD__ -#ifdef NetBSD1_3 - { &vop_seek_desc, genfs_seek }, /* seek */ -#else - { &vop_seek_desc, nbsd_vop_error }, /* seek */ -#endif -#endif - - /* FreeBSD only */ -#ifdef __FreeBSD__ - -#ifdef __FreeBSD_version - - { &vop_poll_desc, (vop_t *) vop_stdpoll }, - { &vop_getpages_desc, (vop_t *) cfs_fbsd_getpages }, /* pager intf.*/ - { &vop_putpages_desc, (vop_t *) cfs_fbsd_putpages }, /* pager intf.*/ + { &vop_pathconf_desc, cfs_vop_error }, /* pathconf */ + { &vop_advlock_desc, cfs_vop_nop }, /* advlock */ + { &vop_bwrite_desc, cfs_vop_error }, /* bwrite */ + { &vop_lease_desc, cfs_vop_nop }, /* lease */ + { &vop_poll_desc, (vop_t *) vop_stdpoll }, + { &vop_getpages_desc, cfs_fbsd_getpages }, /* pager intf.*/ + { &vop_putpages_desc, cfs_fbsd_putpages }, /* pager intf.*/ #if 0 + + we need to define these someday #define UFS_BLKATOFF(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_blkatoff(aa, bb, cc, dd) #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) @@ -369,68 +333,29 @@ struct vnodeopv_entry_desc cfs_vnodeop_entries[] = { { &vop_reallocblks_desc, (vop_t *) ufs_missingop }, { &vop_cachedlookup_desc, (vop_t *) ufs_lookup }, { &vop_whiteout_desc, (vop_t *) ufs_whiteout }, -#endif - -#else /* FreeBSD stable */ - { &vop_getpages_desc, fbsd_vnotsup }, /* pager intf.*/ - { &vop_putpages_desc, fbsd_vnotsup }, /* pager intf.*/ - { &vop_seek_desc, nbsd_vop_error }, /* seek */ - { &vop_blkatoff_desc, nbsd_vop_error }, /* blkatoff */ - { &vop_valloc_desc, nbsd_vop_error }, /* valloc */ - { &vop_vfree_desc, nbsd_vop_error }, /* vfree */ - { &vop_truncate_desc, nbsd_vop_error }, /* truncate */ - { &vop_update_desc, nbsd_vop_error }, /* update */ -#endif #endif { (struct vnodeop_desc*)NULL, (int(*)(void *))NULL } }; -#ifdef __NetBSD__ -struct vnodeopv_desc cfs_vnodeop_opv_desc = - { &cfs_vnodeop_p, cfs_vnodeop_entries }; - -#define NAMEI_FREE(a) FREE(a, M_NAMEI) -#endif - -#ifdef __FreeBSD__ static struct vnodeopv_desc cfs_vnodeop_opv_desc = { &cfs_vnodeop_p, cfs_vnodeop_entries }; -#include VNODEOP_SET(cfs_vnodeop_opv_desc); -int -fbsd_vnotsup(ap) - void *ap; -{ - return(EOPNOTSUPP); -} - -#ifdef __FreeBSD_version -#include - -#define NAMEI_FREE(a) zfree(namei_zone, a); -#else -#define NAMEI_FREE(a) FREE(a, M_NAMEI) -#endif -#endif - -/* Definitions of NetBSD vnodeop interfaces */ - /* A generic panic: we were called with something we didn't define yet */ int -nbsd_vop_error(void *anon) { +cfs_vop_error(void *anon) { struct vnodeop_desc **desc = (struct vnodeop_desc **)anon; myprintf(("Vnode operation %s called, but not defined\n", (*desc)->vdesc_name)); - panic("nbsd_vop_error"); + panic("cfs_vop_error"); return 0; } /* A generic do-nothing. For lease_check, advlock */ int -nbsd_vop_nop(void *anon) { +cfs_vop_nop(void *anon) { struct vnodeop_desc **desc = (struct vnodeop_desc **)anon; if (cfsdebug) { @@ -452,7 +377,6 @@ cfs_vnodeopstats_init(void) cfs_vnodeopstats[i].unsat_intrn = 0; cfs_vnodeopstats[i].gen_intrn = 0; } - return 0; } @@ -511,8 +435,8 @@ cfs_open(v) if (error) return (error); - /* We get the vnode back locked in both Mach and NetBSD. Needs unlocked */ - VOP_X_UNLOCK(vp, 0); + /* We get the vnode back locked. Needs unlocked */ + VOP_UNLOCK(vp, 0, p); /* Keep a reference until the close comes in. */ vref(*vpp); @@ -538,7 +462,6 @@ cfs_open(v) /* Open the cache file. */ error = VOP_OPEN(vp, flag, cred, p); -#ifdef __FreeBSD__ if (error) { printf("cfs_open: VOP_OPEN on container failed %d\n", error); return (error); @@ -550,7 +473,6 @@ cfs_open(v) vput(vp); } } -#endif return(error); } @@ -658,8 +580,6 @@ cfs_rdwr(vp, uiop, rw, ioflag, cred, p) return(EINVAL); } - /* Redirect the request to UFS. */ - /* * If file is not already open this must be a page * {read,write} request. Iget the cache file's inode @@ -684,7 +604,7 @@ cfs_rdwr(vp, uiop, rw, ioflag, cred, p) * We get the vnode back locked in both Mach and * NetBSD. Needs unlocked */ - VOP_X_UNLOCK(cfvp, 0); + VOP_UNLOCK(cfvp, 0, p); } else { opened_internally = 1; @@ -692,7 +612,6 @@ cfs_rdwr(vp, uiop, rw, ioflag, cred, p) error = VOP_OPEN(vp, (rw == UIO_READ ? FREAD : FWRITE), cred, p); printf("cfs_rdwr: Internally Opening %p\n", vp); -#ifdef __FreeBSD__ if (error) { printf("cfs_rdwr: VOP_OPEN on container failed %d\n", error); return (error); @@ -704,7 +623,6 @@ printf("cfs_rdwr: Internally Opening %p\n", vp); vput(vp); } } -#endif if (error) { MARK_INT_FAIL(CFS_RDWR_STATS); return(error); @@ -722,18 +640,13 @@ printf("cfs_rdwr: Internally Opening %p\n", vp); error = VOP_READ(cfvp, uiop, ioflag, cred); } else { error = VOP_WRITE(cfvp, uiop, ioflag, cred); -#ifdef __FreeBSD__ /* ufs_write updates the vnode_pager_setsize for the vnode/object */ { struct vattr attr; if (VOP_GETATTR(cfvp, &attr, cred, p) == 0) { vnode_pager_setsize(vp, attr.va_size); -#ifdef __DEBUG_FreeBSD__ - printf("write: vnode_pager_setsize(%p, %d)\n", vp, attr.va_size); -#endif } } -#endif } if (error) @@ -829,28 +742,6 @@ cfs_ioctl(v) return(error); } -#if 0 -int -cfs_select(v) - void *v; -{ -/* true args */ - struct vop_select_args *ap = v; - struct vnode *vp = ap->a_vp; - int which = ap->a_which; - struct ucred *cred = ap->a_cred; - struct proc *p = ap->a_p; -/* upcall decl */ -/* locals */ - - MARK_ENTRY(CFS_SELECT_STATS); - - myprintf(("in cfs_select\n")); - MARK_INT_FAIL(CFS_SELECT_STATS); - return (EOPNOTSUPP); -} -#endif - /* * To reduce the cost of a user-level venus;we cache attributes in * the kernel. Each cnode has storage allocated for an attribute. If @@ -873,29 +764,12 @@ cfs_getattr(v) struct proc *p = ap->a_p; /* locals */ int error; - struct cnode *scp = NULL; MARK_ENTRY(CFS_GETATTR_STATS); -#if 0 - /* Check for operation on a dying object */ - if (IS_DYING(cp)) { - COMPLAIN_BITTERLY(getattr, cp->c_fid); - scp = cp; /* Save old cp */ - /* If no error, gives a valid vnode with which to work. */ - error = getNewVnode(&vp); - if (error) { - MARK_INT_FAIL(CFS_GETATTR_STATS); - return(error); /* Can't contact dead venus */ - } - cp = VTOC(vp); - } -#endif - -#ifdef __FreeBSD__ if (IS_UNMOUNTING(cp)) return ENODEV; -#endif + /* Check for getattr of control object. */ if (IS_CTL_VP(vp)) { MARK_INT_FAIL(CFS_GETATTR_STATS); @@ -913,7 +787,6 @@ cfs_getattr(v) *vap = cp->c_vattr; MARK_INT_SAT(CFS_GETATTR_STATS); - if (scp) vrele(vp); return(0); } @@ -929,17 +802,12 @@ cfs_getattr(v) CFSDEBUG(CFS_GETATTR, if (!(cfsdebug & ~CFS_GETATTR)) print_vattr(vap); ); -#ifdef __FreeBSD__ { int size = vap->va_size; struct vnode *convp = cp->c_ovp; if (convp != (struct vnode *)0) { vnode_pager_setsize(convp, size); -#ifdef __DEBUG_FreeBSD__ - printf("getattr: vnode_pager_setsize(%p, %d)\n", convp, size); -#endif } } -#endif /* If not open for write, store attributes in cnode */ if ((cp->c_owrite == 0) && (cfs_attr_cache)) { cp->c_vattr = *vap; @@ -947,7 +815,6 @@ cfs_getattr(v) } } - if (scp) vrele(vp); return(error); } @@ -981,17 +848,12 @@ cfs_setattr(v) if (!error) cp->c_flags &= ~C_VATTR; -#ifdef __FreeBSD__ { int size = vap->va_size; struct vnode *convp = cp->c_ovp; if (size != VNOVAL && convp != (struct vnode *)0) { vnode_pager_setsize(convp, size); -#ifdef __DEBUG_FreeBSD__ - printf("setattr: vnode_pager_setsize(%p, %d)\n", convp, size); -#endif } } -#endif CFSDEBUG(CFS_SETATTR, myprintf(("setattr %d\n", error)); ) return(error); } @@ -1059,7 +921,7 @@ cfs_abortop(v) /* locals */ if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF) - NAMEI_FREE(ap->a_cnp->cn_pnbuf); + zfree(namei_zone, ap->a_cnp->cn_pnbuf); return (0); } @@ -1149,7 +1011,6 @@ cfs_fsync(v) if (convp) VOP_FSYNC(convp, cred, MNT_WAIT, p); -#ifdef __FreeBSD__ /* * We see fsyncs with usecount == 1 then usecount == 0. * For now we ignore them. @@ -1160,7 +1021,6 @@ cfs_fsync(v) vp, vp->v_usecount, cp->c_flags, cp->c_flags&C_PURGING); } */ -#endif /* * We can expect fsync on any vnode at all if venus is pruging it. @@ -1173,10 +1033,8 @@ cfs_fsync(v) return(0); } -#ifdef __FreeBSD__ /* needs research */ return 0; -#endif error = venus_fsync(vtomi(vp), &cp->c_fid, cred, p); CFSDEBUG(CFS_FSYNC, myprintf(("in fsync result %d\n",error)); ); @@ -1210,11 +1068,6 @@ cfs_inactive(v) cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vp->v_mount));) -#ifdef __DEBUG_FreeBSD__ - if (vp->v_flag & VXLOCK) - printf ("Inactive: Vnode is Locked\n"); -#endif - /* If an array has been allocated to hold the symlink, deallocate it */ if ((cfs_symlink_cache) && (VALID_SYMLINK(cp))) { if (cp->c_symlink == NULL) @@ -1239,9 +1092,7 @@ cfs_inactive(v) printf("cfs_inactive: cp->ovp != NULL use %d: vp %p, cp %p\n", vp->v_usecount, vp, cp); #endif -#ifdef NEW_LOCKMGR - NEW_LOCKMGR(&cp->c_lock, LK_RELEASE, &vp->v_interlock); -#endif + lockmgr(&cp->c_lock, LK_RELEASE, &vp->v_interlock, p); } else { #ifdef DIAGNOSTIC if (CTOV(cp)->v_usecount) { @@ -1251,9 +1102,7 @@ cfs_inactive(v) panic("cfs_inactive: cp->ovp != NULL"); } #endif -#ifdef NEW_LOCKMGR - VOP_X_UNLOCK(vp, 0); -#endif + VOP_UNLOCK(vp, 0, p); vgone(vp); } @@ -1288,7 +1137,6 @@ cfs_lookup(v) struct proc *p = cnp->cn_proc; /* locals */ struct cnode *cp; - struct cnode *scp = NULL; const char *nm = cnp->cn_nameptr; int len = cnp->cn_namelen; ViceFid VFid; @@ -1301,27 +1149,11 @@ cfs_lookup(v) nm, dcp->c_fid.Volume, dcp->c_fid.Vnode, dcp->c_fid.Unique));); -#if 0 - /* Check for operation on a dying object */ - if (IS_DYING(dcp)) { - COMPLAIN_BITTERLY(lookup, dcp->c_fid); - scp = dcp; /* Save old dcp */ - /* If no error, gives a valid vnode with which to work. */ - error = getNewVnode(&dvp); - if (error) { - MARK_INT_FAIL(CFS_LOOKUP_STATS); - return(error); /* Can't contact dead venus */ - } - dcp = VTOC(dvp); - } -#endif - /* Check for lookup of control object. */ if (IS_CTL_NAME(dvp, nm, len)) { *vpp = cfs_ctlvp; vref(*vpp); MARK_INT_SAT(CFS_LOOKUP_STATS); - if (scp) vrele(dvp); goto exit; } @@ -1364,13 +1196,12 @@ cfs_lookup(v) /* enter the new vnode in the Name Cache only if the top bit isn't set */ /* And don't enter a new vnode for an invalid one! */ - if (!(vtype & CFS_NOCACHE) && scp == 0) + if (!(vtype & CFS_NOCACHE)) cfsnc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp)); } } exit: - if (scp) vrele(dvp); /* * If we are creating, and this was the last name to be looked up, * and the error was ENOENT, then there really shouldn't be an @@ -1417,7 +1248,7 @@ cfs_lookup(v) */ if (!error || (error == EJUSTRETURN)) { if (!(cnp->cn_flags & LOCKPARENT) || !(cnp->cn_flags & ISLASTCN)) { - if ((error = VOP_X_UNLOCK(dvp, 0))) { + if ((error = VOP_UNLOCK(dvp, 0, p))) { return error; } /* @@ -1425,7 +1256,7 @@ cfs_lookup(v) * lock it without bothering to check anything else. */ if (*ap->a_vpp) { - if ((error = VOP_X_LOCK(*ap->a_vpp, LK_EXCLUSIVE))) { + if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, p))) { printf("cfs_lookup: "); panic("unlocked parent but couldn't lock child"); } @@ -1434,7 +1265,7 @@ cfs_lookup(v) /* The parent is locked, and may be the same as the child */ if (*ap->a_vpp && (*ap->a_vpp != dvp)) { /* Different, go ahead and lock it. */ - if ((error = VOP_X_LOCK(*ap->a_vpp, LK_EXCLUSIVE))) { + if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, p))) { printf("cfs_lookup: "); panic("unlocked parent but couldn't lock child"); } @@ -1521,25 +1352,9 @@ cfs_create(v) CFSDEBUG(CFS_CREATE, myprintf(("create error %d\n", error));) } - /* Locking strategy. */ - /* - * In NetBSD, all creates must explicitly vput their dvp's. We'll - * go ahead and use the LOCKLEAF flag of the cnp argument. - * However, I'm pretty sure that create must return the leaf - * locked; so there is a DIAGNOSTIC check to ensure that this is - * true. - */ -#ifdef __FreeBSD_version - /* - * Well, FreeBSD -current does the vput put in - * kern/vfs_vnops.c.c:vn_open() - */ -#else - vput(dvp); -#endif if (!error) { if (cnp->cn_flags & LOCKLEAF) { - if ((error = VOP_X_LOCK(*ap->a_vpp, LK_EXCLUSIVE))) { + if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, p))) { printf("cfs_create: "); panic("unlocked parent but couldn't lock child"); } @@ -1556,7 +1371,7 @@ cfs_create(v) * why it's here, but what the hey... */ if ((cnp->cn_flags & SAVESTART) == 0) { - NAMEI_FREE(cnp->cn_pnbuf); + zfree(namei_zone, cnp->cn_pnbuf); } return(error); } @@ -1618,27 +1433,8 @@ cfs_remove(v) CFSDEBUG(CFS_REMOVE, myprintf(("in remove result %d\n",error)); ) -#ifdef __FreeBSD_version - /* - * Well, FreeBSD -current does the vrele/vput put in - * kern/vfs_syscalls.c:unlink() - */ -#else - /* - * Regardless of what happens, we have to unconditionally drop - * locks/refs on parent and child. (I hope). This is based on - * what ufs_remove seems to be doing. - */ - if (dvp == ap->a_vp) { - vrele(ap->a_vp); - } else { - vput(ap->a_vp); - } - vput(dvp); -#endif - if ((cnp->cn_flags & SAVESTART) == 0) { - NAMEI_FREE(cnp->cn_pnbuf); + zfree(namei_zone, cnp->cn_pnbuf); } return(error); } @@ -1651,11 +1447,7 @@ cfs_link(v) struct vop_link_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); -#ifdef __NetBSD__ - struct vnode *tdvp = ap->a_dvp; -#elif defined(__FreeBSD__) struct vnode *tdvp = ap->a_tdvp; -#endif struct cnode *tdcp = VTOC(tdvp); struct componentname *cnp = ap->a_cnp; struct ucred *cred = cnp->cn_cred; @@ -1689,28 +1481,6 @@ cfs_link(v) return(EACCES); } - /* - * According to the ufs_link operation here's the locking situation: - * We enter with the thing called "dvp" (the directory) locked. - * We must unconditionally drop locks on "dvp" - * - * We enter with the thing called "vp" (the linked-to) unlocked, - * but ref'd (?) - * We seem to need to lock it before calling cfs_link, and - * unconditionally unlock it after. - */ - -#ifdef __FreeBSD_version - /* - * Well, FreeBSD -current does the vrele/vput put in - * kern/vfs_syscalls.c:link() - */ -#else - if ((ap->a_vp != tdvp) && (error = VOP_X_LOCK(ap->a_vp, LK_EXCLUSIVE))) { - goto exit; - } -#endif - error = venus_link(vtomi(vp), &cp->c_fid, &tdcp->c_fid, nm, len, cred, p); /* Invalidate the parent's attr cache, the modification time has changed */ @@ -1721,21 +1491,9 @@ cfs_link(v) exit: -#ifdef __FreeBSD_version - /* - * Well, FreeBSD -current does the vrele/vput put in - * kern/vfs_syscalls.c:link() - */ -#else - if (ap->a_vp != tdvp) { - VOP_X_UNLOCK(ap->a_vp, 0); - } - vput(tdvp); -#endif - /* Drop the name buffer if we don't need to SAVESTART */ if ((cnp->cn_flags & SAVESTART) == 0) { - NAMEI_FREE(cnp->cn_pnbuf); + zfree(namei_zone, cnp->cn_pnbuf); } return(error); } @@ -1903,26 +1661,6 @@ cfs_mkdir(v) CFSDEBUG(CFS_MKDIR, myprintf(("mkdir error %d\n",error));) } - /* - * Currently, all mkdirs explicitly vput their dvp's. - * It also appears that we *must* lock the vpp, since - * lockleaf isn't set, but someone down the road is going - * to try to unlock the new directory. - */ -#ifdef __FreeBSD_version - /* - * Well, FreeBSD -current does the vrele/vput put in - * kern/vfs_syscalls.c:mkdir() - */ -#else - vput(dvp); - if (!error) { - if ((error = VOP_X_LOCK(*ap->a_vpp, LK_EXCLUSIVE))) { - panic("cfs_mkdir: couldn't lock child"); - } - } -#endif - /* Have to free the previously saved name */ /* * ufs_mkdir doesn't check for SAVESTART before freeing the @@ -1930,7 +1668,7 @@ cfs_mkdir(v) * follow their lead, but this seems like it is probably * incorrect. */ - NAMEI_FREE(cnp->cn_pnbuf); + zfree(namei_zone, cnp->cn_pnbuf); return(error); } @@ -1980,26 +1718,8 @@ cfs_rmdir(v) CFSDEBUG(CFS_RMDIR, myprintf(("in rmdir result %d\n", error)); ) -#ifdef __FreeBSD_version - /* - * Well, FreeBSD -current does the vrele/vput put in - * kern/vfs_syscalls.c:rmdir() - */ -#else - /* - * regardless of what happens, we need to drop locks/refs on the - * parent and child. I think. - */ - if (dvp == ap->a_vp) { - vrele(ap->a_vp); - } else { - vput(ap->a_vp); - } - vput(dvp); -#endif - if ((cnp->cn_flags & SAVESTART) == 0) { - NAMEI_FREE(cnp->cn_pnbuf); + zfree(namei_zone, cnp->cn_pnbuf); } return(error); } @@ -2025,10 +1745,7 @@ cfs_symlink(v) * t(foo) is the new name/parent/etc being created. * lname is the contents of the new symlink. */ -#ifdef NetBSD1_3 - const -#endif - char *nm = cnp->cn_nameptr; + char *nm = cnp->cn_nameptr; int len = cnp->cn_namelen; int plen = strlen(path); @@ -2067,45 +1784,11 @@ cfs_symlink(v) /* Invalidate the parent's attr cache, the modification time has changed */ tdcp->c_flags &= ~C_VATTR; -#ifdef __FreeBSD_version - -#else - if (!error) - { - struct nameidata nd; - NDINIT(&nd, LOOKUP, FOLLOW|LOCKLEAF, UIO_SYSSPACE, nm, p); - nd.ni_cnd.cn_cred = cred; - nd.ni_loopcnt = 0; - nd.ni_startdir = tdvp; - nd.ni_cnd.cn_pnbuf = (char *)nm; - nd.ni_cnd.cn_nameptr = nd.ni_cnd.cn_pnbuf; - nd.ni_pathlen = len; - vput(tdvp); - error = lookup(&nd); - *ap->a_vpp = nd.ni_vp; - } - - /* - * Okay, now we have to drop locks on dvp. vpp is unlocked, but - * ref'd. It doesn't matter what happens in either symlink or - * lookup. Furthermore, there isn't any way for (dvp == *vpp), so - * we don't bother checking. - */ -/* vput(ap->a_dvp); released earlier */ - if (*ap->a_vpp) { - VOP_X_UNLOCK(*ap->a_vpp, 0); /* this line is new!! It is necessary because lookup() calls - VOP_LOOKUP (cfs_lookup) which returns vpp locked. cfs_nb_lookup - merged with cfs_lookup() to become cfs_lookup so UNLOCK is - necessary */ - vrele(*ap->a_vpp); - } -#endif - /* * Free the name buffer */ if ((cnp->cn_flags & SAVESTART) == 0) { - NAMEI_FREE(cnp->cn_pnbuf); + zfree(namei_zone, cnp->cn_pnbuf); } exit: @@ -2127,22 +1810,8 @@ cfs_readdir(v) register struct uio *uiop = ap->a_uio; struct ucred *cred = ap->a_cred; int *eofflag = ap->a_eofflag; -#if defined(__NetBSD__) && defined(NetBSD1_3) && (NetBSD1_3 >= 7) - off_t **cookies = ap->a_cookies; - int *ncookies = ap->a_ncookies; -#elif defined(NetBSD1_3) - off_t *cookies = ap->a_cookies; - int ncookies = ap->a_ncookies; -#elif NetBSD1_2 - u_long *cookies = ap->a_cookies; - int ncookies = ap->a_ncookies; -#elif defined(__FreeBSD__) && defined(__FreeBSD_version) u_long **cookies = ap->a_cookies; int *ncookies = ap->a_ncookies; -#elif defined(__FreeBSD__) - u_int **cookies = ap->a_cookies; - int *ncookies = ap->a_ncookies; -#endif struct proc *p = ap->a_uio->uio_procp; /* upcall decl */ /* locals */ @@ -2158,9 +1827,7 @@ cfs_readdir(v) return(ENOENT); } - if (cfs_intercept_rdwr) { - /* Redirect the request to UFS. */ - + { /* If directory is not already open do an "internal open" on it. */ int opened_internally = 0; if (cp->c_ovp == NULL) { @@ -2168,7 +1835,6 @@ cfs_readdir(v) MARK_INT_GEN(CFS_OPEN_STATS); error = VOP_OPEN(vp, FREAD, cred, p); printf("cfs_readdir: Internally Opening %p\n", vp); -#ifdef __FreeBSD__ if (error) { printf("cfs_readdir: VOP_OPEN on container failed %d\n", error); return (error); @@ -2180,19 +1846,13 @@ printf("cfs_readdir: Internally Opening %p\n", vp); vput(vp); } } -#endif if (error) return(error); } /* Have UFS handle the call. */ CFSDEBUG(CFS_READDIR, myprintf(("indirect readdir: fid = (%lx.%lx.%lx), refcnt = %d\n",cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vp->v_usecount)); ) -#ifdef __NetBSD__ - error = VOP_READDIR(cp->c_ovp, uiop, cred, eofflag, cookies, - ncookies); -#elif defined(__FreeBSD__) error = VOP_READDIR(cp->c_ovp, uiop, cred, eofflag, ncookies, cookies); -#endif if (error) MARK_INT_FAIL(CFS_READDIR_STATS); @@ -2205,39 +1865,6 @@ printf("cfs_readdir: Internally Opening %p\n", vp); (void)VOP_CLOSE(vp, FREAD, cred, p); } } - else { - /* Read the block from Venus. */ - struct iovec *iovp = uiop->uio_iov; - unsigned count = iovp->iov_len; - int size; - - - /* Make the count a multiple of DIRBLKSIZ (borrowed from ufs_readdir). */ -#define DIRBLKSIZ DEV_BSIZE - if ((uiop->uio_iovcnt != 1) || (count < DIRBLKSIZ) || - (uiop->uio_offset & (DIRBLKSIZ - 1))) - return (EINVAL); - count &= ~(DIRBLKSIZ - 1); - uiop->uio_resid -= iovp->iov_len - count; - iovp->iov_len = count; - if (count > VC_MAXDATASIZE) - return(EINVAL); - - - error = venus_readdir(vtomi(CTOV(cp)), &cp->c_fid, count, uiop->uio_offset, cred, p, iovp->iov_base, &size); - - CFSDEBUG(CFS_READDIR, - myprintf(("cfs_readdir(%p, %d, %qd, %d) returns (%d, %d)\n", - iovp->iov_base, count, - uiop->uio_offset, uiop->uio_segflg, error, - size)); ) - if (!error) { - iovp->iov_base += size; - iovp->iov_len -= size; - uiop->uio_resid -= size; - uiop->uio_offset += size; - } - } return(error); } @@ -2260,8 +1887,6 @@ cfs_bmap(v) /* upcall decl */ /* locals */ -#ifdef __FreeBSD__ -#ifdef __FreeBSD_version int ret = 0; struct cnode *cp; @@ -2276,15 +1901,6 @@ cfs_bmap(v) printf("cfs_bmap: no container\n"); return(EOPNOTSUPP); } -#else - /* Just like nfs_bmap(). Do not touch *vpp, this cause pfault. */ - return(EOPNOTSUPP); -#endif -#else /* !FreeBSD */ - *vpp = (struct vnode *)0; - myprintf(("cfs_bmap called!\n")); - return(EINVAL); -#endif } /* @@ -2305,18 +1921,8 @@ cfs_strategy(v) /* upcall decl */ /* locals */ -#ifdef __FreeBSD__ -#ifdef __FreeBSD_version printf("cfs_strategy: called ???\n"); return(EOPNOTSUPP); -#else /* ! __MAYBE_FreeBSD__ */ - myprintf(("cfs_strategy called! ")); - return(EOPNOTSUPP); -#endif /* __MAYBE_FreeBSD__ */ -#else /* ! __FreeBSD__ */ - myprintf(("cfs_strategy called! ")); - return(EINVAL); -#endif /* __FreeBSD__ */ } int @@ -2357,7 +1963,6 @@ cfs_reclaim(v) return (0); } -#ifdef NEW_LOCKMGR int cfs_lock(v) void *v; @@ -2366,9 +1971,7 @@ cfs_lock(v) struct vop_lock_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); -#ifdef __FreeBSD_version struct proc *p = ap->a_p; -#endif /* upcall decl */ /* locals */ @@ -2379,7 +1982,7 @@ cfs_lock(v) cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); } - return (NEW_LOCKMGR(&cp->c_lock, ap->a_flags, &vp->v_interlock)); + return (lockmgr(&cp->c_lock, ap->a_flags, &vp->v_interlock, p)); } int @@ -2390,9 +1993,7 @@ cfs_unlock(v) struct vop_unlock_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); -#ifdef __FreeBSD_version struct proc *p = ap->a_p; -#endif /* upcall decl */ /* locals */ @@ -2402,7 +2003,7 @@ cfs_unlock(v) cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); } - return (NEW_LOCKMGR(&cp->c_lock, ap->a_flags | LK_RELEASE, &vp->v_interlock)); + return (lockmgr(&cp->c_lock, ap->a_flags | LK_RELEASE, &vp->v_interlock, p)); } int @@ -2416,99 +2017,6 @@ cfs_islocked(v) return (lockstatus(&cp->c_lock)); } -#else -int -cfs_lock(v) - void *v; -{ -/* true args */ - struct vop_lock_args *ap = v; - struct vnode *vp = ap->a_vp; - struct cnode *cp; - struct proc *p __attribute__((unused)) = curproc; /* XXX */ -/* upcall decl */ -/* locals */ - - ENTRY; - cp = VTOC(vp); - - if (cfs_lockdebug) { - myprintf(("Attempting lock on %lx.%lx.%lx\n", - cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); - } -start: - while (vp->v_flag & VXLOCK) { - vp->v_flag |= VXWANT; -#ifdef __NetBSD__ - (void) sleep((caddr_t)vp, PINOD); -#elif defined(__FreeBSD__) - (void) tsleep((caddr_t)vp, PINOD, "cfs_lock1", 0); -#endif - } - if (vp->v_tag == VT_NON) - return (ENOENT); - - if (cp->c_flags & C_LOCKED) { - cp->c_flags |= C_WANTED; -#ifdef DIAGNOSTIC - myprintf(("cfs_lock: lock contention")); - cfsnc_name(cp); - myprintf(("\n")); -#endif -#ifdef __NetBSD__ - (void) sleep((caddr_t)cp, PINOD); -#elif defined(__FreeBSD__) - (void) tsleep((caddr_t)cp, PINOD, "cfs_lock2", 0); -#endif -#ifdef DIAGNOSTIC - myprintf(("cfs_lock: contention resolved\n")); -#endif - goto start; - } - cp->c_flags |= C_LOCKED; - return (0); -} - -int -cfs_unlock(v) - void *v; -{ -/* true args */ - struct vop_unlock_args *ap = v; - struct cnode *cp = VTOC(ap->a_vp); -/* upcall decl */ -/* locals */ - - ENTRY; - if (cfs_lockdebug) { - myprintf(("Attempting unlock on %lx.%lx.%lx\n", - cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); - } -#ifdef DIAGNOSTIC - if ((cp->c_flags & C_LOCKED) == 0) - panic("cfs_unlock: not locked"); -#endif - cp->c_flags &= ~C_LOCKED; - if (cp->c_flags & C_WANTED) { - cp->c_flags &= ~C_WANTED; - wakeup((caddr_t)cp); - } - return (0); -} - -int -cfs_islocked(v) - void *v; -{ -/* true args */ - struct vop_islocked_args *ap = v; - - ENTRY; - if (VTOC(ap->a_vp)->c_flags & C_LOCKED) - return (1); - return (0); -} -#endif /* How one looks up a vnode given a device/inode pair: */ int @@ -2607,10 +2115,6 @@ print_cred(cred) } -/* - ----------------------------------------------------------------------------------- - */ - /* * Return a vnode for the given fid. * If no cnode exists for this fid create one and put it @@ -2630,9 +2134,7 @@ makecfsnode(fid, vfsp, type) struct vnode *vp; cp = cfs_alloc(); -#ifdef NEW_LOCKMGR lockinit(&cp->c_lock, PINOD, "cnode", 0, 0); -#endif cp->c_fid = *fid; err = getnewvnode(VT_CFS, vfsp, cfs_vnodeop_p, &vp); @@ -2650,153 +2152,3 @@ makecfsnode(fid, vfsp, type) return cp; } - - - -#ifdef MACH -/* - * read a logical block and return it in a buffer */ -int -cfs_bread(vp, lbn, bpp) - struct vnode *vp; - daddr_t lbn; - struct buf **bpp; -{ - myprintf(("cfs_bread called!\n")); - return(EINVAL); -} - -/* - * release a block returned by cfs_bread - */ -int -cfs_brelse(vp, bp) - struct vnode *vp; - struct buf *bp; -{ - - myprintf(("cfs_brelse called!\n")); - return(EINVAL); -} - -int -cfs_badop() -{ - panic("cfs_badop"); -} - -int -cfs_noop() -{ - return (EINVAL); -} - -int -cfs_fid(vp, fidpp) - struct vnode *vp; - struct fid **fidpp; -{ - struct cfid *cfid; - - cfid = (struct cfid *)kalloc(sizeof(struct cfid)); - bzero((caddr_t)cfid, sizeof(struct cfid)); - cfid->cfid_len = sizeof(struct cfid) - (sizeof(struct fid) - MAXFIDSZ); - cfid->cfid_fid = VTOC(vp)->c_fid; - *fidpp = (struct fid *)cfid; - return (0); -} - -int -cfs_freefid(vp, fidp) - struct vnode *vp; - struct fid *fidp; -{ - kfree((struct cfid *)fidp, sizeof(struct cfid)); - return (0); -} - -/* - * Record-locking requests are passed to the local Lock-Manager daemon. - */ -int -cfs_lockctl(vp, ld, cmd, cred) - struct vnode *vp; - struct flock *ld; - int cmd; - struct ucred *cred; -{ - myprintf(("cfs_lockctl called!\n")); - return(EINVAL); -} - -cfs_page_read(vp, buffer, size, offset, cred) - struct vnode *vp; - caddr_t buffer; - int size; - vm_offset_t offset; - struct ucred *cred; -{ - struct cnode *cp = VTOC(vp); - struct uio uio; - struct iovec iov; - int error = 0; - - CFSDEBUG(CFS_RDWR, myprintf(("cfs_page_read(%p, %d, %d), fid = (%lx.%lx.%lx), refcnt = %d\n", buffer, size, offset, VTOC(vp)->c_fid.Volume, VTOC(vp)->c_fid.Vnode, VTOC(vp)->c_fid.Unique, vp->v_count)); ) - - iov.iov_base = buffer; - iov.iov_len = size; - uio.uio_iov = &iov; - uio.uio_iovcnt = 1; - uio.uio_offset = offset; - uio.uio_segflg = UIO_SYSSPACE; - uio.uio_resid = size; - error = cfs_rdwr(vp, &uio, UIO_READ, 0, cred); - if (error) { - myprintf(("error %d on pagein (cfs_rdwr)\n", error)); - error = EIO; - } - -/* - if (!error && (cp->states & CWired) == 0) - cfs_Wire(cp); -*/ - - return(error); -} - -cfs_page_write(vp, buffer, size, offset, cred, init) - struct vnode *vp; - caddr_t buffer; - int size; - vm_offset_t offset; - struct ucred *cred; - boolean_t init; -{ - struct cnode *cp = VTOC(vp); - struct uio uio; - struct iovec iov; - int error = 0; - - CFSDEBUG(CFS_RDWR, myprintf(("cfs_page_write(%p, %d, %d), fid = (%lx.%lx.%lx), refcnt = %d\n", buffer, size, offset, VTOC(vp)->c_fid.Volume, VTOC(vp)->c_fid.Vnode, VTOC(vp)->c_fid.Unique, vp->v_count)); ) - - if (init) { - panic("cfs_page_write: called from data_initialize"); - } - - iov.iov_base = buffer; - iov.iov_len = size; - uio.uio_iov = &iov; - uio.uio_iovcnt = 1; - uio.uio_offset = offset; - uio.uio_segflg = UIO_SYSSPACE; - uio.uio_resid = size; - error = cfs_rdwr(vp, &uio, UIO_WRITE, 0, cred); - if (error) { - myprintf(("error %d on pageout (cfs_rdwr)\n", error)); - error = EIO; - } - - return(error); -} - -#endif diff --git a/sys/cfs/cfs_vnodeops.h b/sys/cfs/cfs_vnodeops.h index 697cb9123f04..f965c93c26b6 100644 --- a/sys/cfs/cfs_vnodeops.h +++ b/sys/cfs/cfs_vnodeops.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_vnodeops.h,v 1.7 1998/08/28 18:12:24 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_vnodeops.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -46,6 +48,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cfs_vnodeops.h,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.7 1998/08/28 18:12:24 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -87,7 +92,6 @@ Mellon the rights to redistribute these changes without encumbrance. * */ - /* NetBSD interfaces to the vnodeops */ int cfs_open __P((void *)); int cfs_close __P((void *)); @@ -117,22 +121,15 @@ int cfs_reclaim __P((void *)); int cfs_lock __P((void *)); int cfs_unlock __P((void *)); int cfs_islocked __P((void *)); -int nbsd_vop_error __P((void *)); -int nbsd_vop_nop __P((void *)); -#ifdef __FreeBSD__ -int fbsd_vnotsup __P((void *ap)); -#ifdef __FreeBSD_version +int cfs_vop_error __P((void *)); +int cfs_vop_nop __P((void *)); int cfs_fbsd_getpages __P((void *)); int cfs_fbsd_putpages __P((void *)); -#endif -#endif int (**cfs_vnodeop_p)(void *); + int cfs_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw, int ioflag, struct ucred *cred, struct proc *p); - - - int cfs_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp); void print_vattr(struct vattr *attr); void print_cred(struct ucred *cred); diff --git a/sys/cfs/cfsio.h b/sys/cfs/cfsio.h index e515594f94e8..87a0ec370a9c 100644 --- a/sys/cfs/cfsio.h +++ b/sys/cfs/cfsio.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfsio.h,v 1.5 1998/08/18 17:05:23 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfsio.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -45,6 +47,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cfsio.h,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.5 1998/08/18 17:05:23 rvb * Don't use __RCSID now * @@ -106,20 +111,11 @@ Mellon the rights to redistribute these changes without encumbrance. /* Define ioctl commands for vcioctl, /dev/cfs */ -#ifdef __STDC__ #define CFSRESIZE _IOW('c', 1, struct cfs_resize ) /* Resize CFS NameCache */ #define CFSSTATS _IO('c', 2) /* Collect stats */ #define CFSPRINT _IO('c', 3) /* Print Cache */ #define CFSTEST _IO('c', 4) /* Print Cache */ -#else /* sys/ioctl.h puts the quotes on */ -#define CFSRESIZE _IOW(c, 1, struct cfs_resize ) /* Resize CFS NameCache */ -#define CFSSTATS _IO(c, 2) /* Collect stats */ -#define CFSPRINT _IO(c, 3) /* Print Cache */ - -#define CFSTEST _IO(c, 4) /* Print Cache */ -#endif __STDC__ - struct cfs_resize { int hashsize, heapsize; }; -#endif !_CFSIO_H_ +#endif diff --git a/sys/cfs/cfsk.h b/sys/cfs/cfsk.h index 5bdcd41442ec..299d15d6641a 100644 --- a/sys/cfs/cfsk.h +++ b/sys/cfs/cfsk.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfsk.h,v 1.9 1998/08/18 17:05:23 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfsk.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* Macros to manipulate the queue */ #ifndef INIT_QUEUE @@ -61,4 +63,4 @@ do { \ (el).back->forw = (el).forw; \ } while (0) -#endif INIT_QUEUE +#endif diff --git a/sys/cfs/cfsnc.h b/sys/cfs/cfsnc.h index 86ed38c256db..d3d89455f8eb 100644 --- a/sys/cfs/cfsnc.h +++ b/sys/cfs/cfsnc.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfsnc.h,v 1.8 1998/08/28 18:12:25 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfsnc.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -45,6 +47,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cfsnc.h,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.8 1998/08/28 18:12:25 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -270,4 +275,4 @@ struct cfsnc_statistics { #define CFSNC_PRINTCFSNC ((u_long) 12) #define CFSNC_PRINTSTATS ((u_long) 13) -#endif /* _CFSNC_HEADER_ */ +#endif diff --git a/sys/cfs/cnode.h b/sys/cfs/cnode.h index 901dc8a1240c..9f29ca9cc887 100644 --- a/sys/cfs/cnode.h +++ b/sys/cfs/cnode.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cnode.h,v 1.10 1998/08/28 18:12:25 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cnode.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -45,6 +47,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cnode.h,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.10 1998/08/28 18:12:25 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -144,45 +149,11 @@ Mellon the rights to redistribute these changes without encumbrance. #define _CNODE_H_ #include - -#ifdef __FreeBSD__ - -/* for the prototype of DELAY() */ +#include #include -#ifdef __FreeBSD_version -/* You would think that or something would include this */ -#include - MALLOC_DECLARE(M_CFS); -#else - -/* yuck yuck yuck */ -#define vref(x) cvref(x) -extern void cvref(struct vnode *vp); -/* yuck yuck yuck */ - -#endif -#endif - -#if defined(__NetBSD__) && defined(NetBSD1_3) && (NetBSD1_3 >= 7) -#define NEW_LOCKMGR(l, f, i) lockmgr(l, f, i) -#define VOP_X_LOCK(vn, fl) vn_lock(vn, fl) -#define VOP_X_UNLOCK(vn, fl) VOP_UNLOCK(vn, fl) - -#elif defined(__FreeBSD_version) -#define NEW_LOCKMGR(l, f, i) lockmgr(l, f, i, curproc) -#define VOP_X_LOCK(vn, fl) vn_lock(vn, fl, curproc) -#define VOP_X_UNLOCK(vn, fl) VOP_UNLOCK(vn, fl, curproc) - -/* NetBSD 1.3 & FreeBSD 2.2.x */ -#else -#undef NEW_LOCKMGR -#define VOP_X_LOCK(vn, fl) VOP_LOCK(vn) -#define VOP_X_UNLOCK(vn, fl) VOP_UNLOCK(vn) -#endif - /* * tmp below since we need struct queue */ @@ -232,9 +203,7 @@ struct cnode { struct vnode *c_vnode; u_short c_flags; /* flags (see below) */ ViceFid c_fid; /* file handle */ -#ifdef NEW_LOCKMGR struct lock c_lock; /* new lock protocol */ -#endif struct vnode *c_ovp; /* open vnode pointer */ u_short c_ocount; /* count of openers */ u_short c_owrite; /* count of open for write */ @@ -332,10 +301,6 @@ int cfs_vnodeopstats_init(void); /* cfs_vfsops.h */ struct mount *devtomp(dev_t dev); -#if !(defined NetBSD1_3) && !defined(__FreeBSD_version) -#define __RCSID(x) static char *rcsid = x -#endif - /* sigh */ #define CFS_RDWR ((u_long) 31) diff --git a/sys/cfs/coda.h b/sys/cfs/coda.h index 78de1fd1a6cc..09268b622abf 100644 --- a/sys/cfs/coda.h +++ b/sys/cfs/coda.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/coda.h,v 1.10 1998/08/28 18:12:26 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/coda.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * @@ -38,8 +40,6 @@ Mellon the rights to redistribute these changes without encumbrance. #ifndef _CFS_HEADER_ #define _CFS_HEADER_ - - /* Catch new _KERNEL defn for NetBSD */ #ifdef __NetBSD__ #include diff --git a/sys/cfs/coda_opstats.h b/sys/cfs/coda_opstats.h index 37017f279f09..5f528ec386c4 100644 --- a/sys/cfs/coda_opstats.h +++ b/sys/cfs/coda_opstats.h @@ -1,34 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/coda_opstats.h,v 1.5 1998/08/18 17:05:25 rvb Exp $ */ - + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/coda_opstats.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * operation stats: what the minicache can intercept that @@ -102,12 +103,10 @@ Mellon the rights to redistribute these changes without encumbrance. #define CFS_READDIR_STATS 19 #define CFS_VNODEOPS_SIZE 20 - /* * I propose the following structres: */ - struct cfs_op_stats { int opcode; /* vfs opcode */ long entries; /* number of times call attempted */ @@ -118,7 +117,6 @@ struct cfs_op_stats { /* (do we need that?) */ }; - /* * With each call to the minicache, we'll bump the counters whenver * a call is satisfied internally (through the cache or through a diff --git a/sys/cfs/pioctl.h b/sys/cfs/pioctl.h index 3e8957062a18..c6fcc6fe947f 100644 --- a/sys/cfs/pioctl.h +++ b/sys/cfs/pioctl.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/pioctl.h,v 1.7 1998/08/28 18:12:26 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/pioctl.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -41,6 +43,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: pioctl.h,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.7 1998/08/28 18:12:26 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -108,11 +113,8 @@ Mellon the rights to redistribute these changes without encumbrance. are no input or output parameters */ -#ifdef __STDC__ #define _VICEIOCTL(id) ((unsigned int ) _IOW('V', id, struct ViceIoctl)) -#else -#define _VICEIOCTL(id) ((unsigned int ) _IOW(V, id, struct ViceIoctl)) -#endif + /* Use this macro to define up to 256 vice ioctl's. These ioctl's all potentially have in/out parameters--this depends upon the values in the ViceIoctl structure. This structure is itself passed @@ -121,4 +123,4 @@ Mellon the rights to redistribute these changes without encumbrance. #define _VALIDVICEIOCTL(com) (com >= _VICEIOCTL(0) && com <= _VICEIOCTL(255)) -#endif _SYS_PIOCTL_H_ +#endif diff --git a/sys/coda/00READ b/sys/coda/00READ index ce27b8af65de..29e45b1a008f 100644 --- a/sys/coda/00READ +++ b/sys/coda/00READ @@ -1,8 +1,3 @@ -NOTE: Please do not edit any files in this directory - until this NOTE is removed. - In the next week, I want to clear out all the - platform and release #ifdefs from the code. - 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 @@ -14,8 +9,8 @@ BUG: There is a bug in file mapping/executing. When a file is 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. +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 working, but hasn't been run long enough to be sure all the bugs are sorted out. Let me know if there are any problems. diff --git a/sys/coda/README b/sys/coda/README index 49ccad6ec50d..f9bf3c35cdc6 100644 --- a/sys/coda/README +++ b/sys/coda/README @@ -15,8 +15,8 @@ to experiment with. To get more information on Coda, I would like to refer people to http://www.coda.cs.cmu.edu -There is a wealth of documents, papers, theses there. There is also a -good introduction to the Coda File System in +There is a wealth of documents, papers, and theses there. There is +also a good introduction to the Coda File System in http://www.coda.cs.cmu.edu/ljpaper/lj.html Coda was originally developed as an academic prototype/testbed. It is @@ -45,11 +45,11 @@ The relevant sources, binaries, and docs can be found in ftp://ftp.coda.cs.cmu.edu/pub/coda/ We intend to come out with new Coda releases often, not daily. We -don't wish to slight any OS/platform not mentioned above. We are just +don't want to slight any OS/platform not mentioned above. We are just limited in our resources as to what we can support internally. We will be happy to integrate OpenBSD support as well as other OS -support. Also, adding platform support is relatively easy and we can -discuss this. The only problem is that Coda has a light weight +support. Also, adding platform support should be relatively easy and +we can discuss this. The only difficulty is that Coda has a light weight process package. It does some manipulations in assembler which would have to be redone for a different platform. diff --git a/sys/coda/TODO b/sys/coda/TODO index f19b4b675cba..eac514394b38 100644 --- a/sys/coda/TODO +++ b/sys/coda/TODO @@ -1,12 +1,17 @@ +OOPS: + FreeBSD does not fsync!!! + Near term: - Existing VOP_LOCKS's should proabably be - vn_lock since that is what they were in -stable. Fix bug in executing/mapping new files. + cfs_mount bug: interaction with cfs_inactive no cfs_unsave. + vref/vn_lock == vget except no VXWANT which may be on. + Review locks: vn_lock/VOP_UNLOCK/lockmgr ... Medium term: Add missing VFS methods. Do performance profile. Tune hash algorithm used in cfs_namecache. + Tune hash algorithm used in cfs_subr. Eventually: Use standard queue macros. diff --git a/sys/coda/cnode.h b/sys/coda/cnode.h index 901dc8a1240c..9f29ca9cc887 100644 --- a/sys/coda/cnode.h +++ b/sys/coda/cnode.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cnode.h,v 1.10 1998/08/28 18:12:25 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cnode.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -45,6 +47,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cnode.h,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.10 1998/08/28 18:12:25 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -144,45 +149,11 @@ Mellon the rights to redistribute these changes without encumbrance. #define _CNODE_H_ #include - -#ifdef __FreeBSD__ - -/* for the prototype of DELAY() */ +#include #include -#ifdef __FreeBSD_version -/* You would think that or something would include this */ -#include - MALLOC_DECLARE(M_CFS); -#else - -/* yuck yuck yuck */ -#define vref(x) cvref(x) -extern void cvref(struct vnode *vp); -/* yuck yuck yuck */ - -#endif -#endif - -#if defined(__NetBSD__) && defined(NetBSD1_3) && (NetBSD1_3 >= 7) -#define NEW_LOCKMGR(l, f, i) lockmgr(l, f, i) -#define VOP_X_LOCK(vn, fl) vn_lock(vn, fl) -#define VOP_X_UNLOCK(vn, fl) VOP_UNLOCK(vn, fl) - -#elif defined(__FreeBSD_version) -#define NEW_LOCKMGR(l, f, i) lockmgr(l, f, i, curproc) -#define VOP_X_LOCK(vn, fl) vn_lock(vn, fl, curproc) -#define VOP_X_UNLOCK(vn, fl) VOP_UNLOCK(vn, fl, curproc) - -/* NetBSD 1.3 & FreeBSD 2.2.x */ -#else -#undef NEW_LOCKMGR -#define VOP_X_LOCK(vn, fl) VOP_LOCK(vn) -#define VOP_X_UNLOCK(vn, fl) VOP_UNLOCK(vn) -#endif - /* * tmp below since we need struct queue */ @@ -232,9 +203,7 @@ struct cnode { struct vnode *c_vnode; u_short c_flags; /* flags (see below) */ ViceFid c_fid; /* file handle */ -#ifdef NEW_LOCKMGR struct lock c_lock; /* new lock protocol */ -#endif struct vnode *c_ovp; /* open vnode pointer */ u_short c_ocount; /* count of openers */ u_short c_owrite; /* count of open for write */ @@ -332,10 +301,6 @@ int cfs_vnodeopstats_init(void); /* cfs_vfsops.h */ struct mount *devtomp(dev_t dev); -#if !(defined NetBSD1_3) && !defined(__FreeBSD_version) -#define __RCSID(x) static char *rcsid = x -#endif - /* sigh */ #define CFS_RDWR ((u_long) 31) diff --git a/sys/coda/coda.h b/sys/coda/coda.h index 78de1fd1a6cc..09268b622abf 100644 --- a/sys/coda/coda.h +++ b/sys/coda/coda.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/coda.h,v 1.10 1998/08/28 18:12:26 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/coda.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * @@ -38,8 +40,6 @@ Mellon the rights to redistribute these changes without encumbrance. #ifndef _CFS_HEADER_ #define _CFS_HEADER_ - - /* Catch new _KERNEL defn for NetBSD */ #ifdef __NetBSD__ #include diff --git a/sys/coda/coda_fbsd.c b/sys/coda/coda_fbsd.c index 23d55cc29d54..f137ff55389d 100644 --- a/sys/coda/coda_fbsd.c +++ b/sys/coda/coda_fbsd.c @@ -1,53 +1,56 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_fbsd.c,v 1.6 1998/08/28 18:12:11 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_fbsd.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ #include #include #include #include +#include #include #include -#include +#include +#include + #include #include +#include +#include +#include + #ifdef DEVFS #include #endif -#include - -#include -#include -#include -#include /* From: "Jordan K. Hubbard" @@ -63,7 +66,6 @@ Mellon the rights to redistribute these changes without encumbrance. #define VC_DEV_NO 93 -#ifdef __FreeBSD_version /* Type of device methods. */ extern d_open_t vc_nb_open; extern d_close_t vc_nb_close; @@ -76,33 +78,8 @@ static struct cdevsw vccdevsw = { vc_nb_open, vc_nb_close, vc_nb_read, vc_nb_write, /*93*/ vc_nb_ioctl, nostop, nullreset, nodevtotty, - vc_nb_poll, nommap, NULL, "Coda", NULL, -1 }; -#else -/* Type of device methods. */ -#define D_OPEN_T d_open_t -#define D_CLOSE_T d_close_t -#define D_RDWR_T d_rdwr_t -#define D_READ_T d_read_t -#define D_WRITE_T d_write_t -#define D_IOCTL_T d_ioctl_t -#define D_SELECT_T d_select_t - -/* rvb why */ -D_OPEN_T vc_nb_open; /* was is defined in cfs_FreeBSD.h */ -D_CLOSE_T vc_nb_close; -D_READ_T vc_nb_read; -D_WRITE_T vc_nb_write; -D_IOCTL_T vc_nb_ioctl; -D_SELECT_T vc_nb_select; - -static struct cdevsw vccdevsw = -{ - vc_nb_open, vc_nb_close, vc_nb_read, vc_nb_write, - vc_nb_ioctl, nostop, nullreset, nodevtotty, - vc_nb_select, nommap, NULL, "Coda", NULL, -1 }; - -PSEUDO_SET(vcattach, vc); -#endif + vc_nb_poll, nommap, NULL, "Coda", NULL, -1 +}; void vcattach __P((void)); static dev_t vccdev; @@ -125,21 +102,9 @@ vcattach(void) VCDEBUG("cfs: vccdevsw entry installed at %d.\n", major(vccdev)); } -void -cvref(vp) - struct vnode *vp; -{ - if (vp->v_usecount <= 0) - panic("vref used where vget required"); - - vp->v_usecount++; -} - - -#ifdef __FreeBSD_version static vc_devsw_installed = 0; - static void vc_drvinit __P((void *unused)); + static void vc_drvinit(void *unused) { @@ -238,4 +203,3 @@ cfs_fbsd_putpages(v) SYSINIT(vccdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+VC_DEV_NO,vc_drvinit,NULL) -#endif diff --git a/sys/coda/coda_io.h b/sys/coda/coda_io.h index e515594f94e8..87a0ec370a9c 100644 --- a/sys/coda/coda_io.h +++ b/sys/coda/coda_io.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfsio.h,v 1.5 1998/08/18 17:05:23 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfsio.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -45,6 +47,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cfsio.h,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.5 1998/08/18 17:05:23 rvb * Don't use __RCSID now * @@ -106,20 +111,11 @@ Mellon the rights to redistribute these changes without encumbrance. /* Define ioctl commands for vcioctl, /dev/cfs */ -#ifdef __STDC__ #define CFSRESIZE _IOW('c', 1, struct cfs_resize ) /* Resize CFS NameCache */ #define CFSSTATS _IO('c', 2) /* Collect stats */ #define CFSPRINT _IO('c', 3) /* Print Cache */ #define CFSTEST _IO('c', 4) /* Print Cache */ -#else /* sys/ioctl.h puts the quotes on */ -#define CFSRESIZE _IOW(c, 1, struct cfs_resize ) /* Resize CFS NameCache */ -#define CFSSTATS _IO(c, 2) /* Collect stats */ -#define CFSPRINT _IO(c, 3) /* Print Cache */ - -#define CFSTEST _IO(c, 4) /* Print Cache */ -#endif __STDC__ - struct cfs_resize { int hashsize, heapsize; }; -#endif !_CFSIO_H_ +#endif diff --git a/sys/coda/coda_kernel.h b/sys/coda/coda_kernel.h index 5bdcd41442ec..299d15d6641a 100644 --- a/sys/coda/coda_kernel.h +++ b/sys/coda/coda_kernel.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfsk.h,v 1.9 1998/08/18 17:05:23 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfsk.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* Macros to manipulate the queue */ #ifndef INIT_QUEUE @@ -61,4 +63,4 @@ do { \ (el).back->forw = (el).forw; \ } while (0) -#endif INIT_QUEUE +#endif diff --git a/sys/coda/coda_namecache.c b/sys/coda/coda_namecache.c index 6c80a2607c34..eb5e8bff82b8 100644 --- a/sys/coda/coda_namecache.c +++ b/sys/coda/coda_namecache.c @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_namecache.c,v 1.11 1998/08/28 18:12:16 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_namecache.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -45,6 +47,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cfs_namecache.c,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.11 1998/08/28 18:12:16 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -206,32 +211,25 @@ Mellon the rights to redistribute these changes without encumbrance. #include #include #include +#include #include +#ifndef insque +#include +#endif /* insque */ + +#include +#include + #include #include #include -#if defined(__NetBSD__) || defined(__FreeBSD__) -#ifndef insque -#include -#endif /* insque */ -#endif /* __NetBSD__ || defined(__FreeBSD__) */ - -#ifdef __FreeBSD__ -#include -#include -#ifdef __FreeBSD_version -#include -#endif -#endif - /* * Declaration of the name cache data structure. */ int cfsnc_use = 1; /* Indicate use of CFS Name Cache */ - int cfsnc_size = CFSNC_CACHESIZE; /* size of the cache */ int cfsnc_hashsize = CFSNC_HASHSIZE; /* size of the primary hash */ @@ -246,16 +244,12 @@ struct cfsnc_statistics cfsnc_stat; /* Keep various stats */ */ int cfsnc_debug = 0; - /* * Entry points for the CFS Name Cache */ -static struct cfscache * -cfsnc_find(struct cnode *dcp, const char *name, int namelen, +static struct cfscache *cfsnc_find(struct cnode *dcp, const char *name, int namelen, struct ucred *cred, int hash); -static void -cfsnc_remove(struct cfscache *cncp, enum dc_status dcstat); - +static void cfsnc_remove(struct cfscache *cncp, enum dc_status dcstat); /* * Initialize the cache, the LRU structure and the Hash structure(s) @@ -657,7 +651,7 @@ cfsnc_zapfile(dcp, name, namelen) while (cncp) { cfsnchash[hash].length--; /* Used for tuning */ -/* 1.3 */ + cfsnc_remove(cncp, NOT_DOWNCALL); cncp = cfsnc_find(dcp, name, namelen, 0, hash); } diff --git a/sys/coda/coda_namecache.h b/sys/coda/coda_namecache.h index 86ed38c256db..d3d89455f8eb 100644 --- a/sys/coda/coda_namecache.h +++ b/sys/coda/coda_namecache.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfsnc.h,v 1.8 1998/08/28 18:12:25 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfsnc.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -45,6 +47,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cfsnc.h,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.8 1998/08/28 18:12:25 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -270,4 +275,4 @@ struct cfsnc_statistics { #define CFSNC_PRINTCFSNC ((u_long) 12) #define CFSNC_PRINTSTATS ((u_long) 13) -#endif /* _CFSNC_HEADER_ */ +#endif diff --git a/sys/coda/coda_nbsd.c b/sys/coda/coda_nbsd.c deleted file mode 100644 index eb117ce58003..000000000000 --- a/sys/coda/coda_nbsd.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_nbsd.c,v 1.21 1998/08/28 18:12:17 rvb Exp $ */ - -/* - * Mach Operating System - * Copyright (c) 1990 Carnegie-Mellon University - * Copyright (c) 1989 Carnegie-Mellon University - * All rights reserved. The CMU software License Agreement specifies - * the terms and conditions for use and redistribution. - */ - -/* - * This code was written for the Coda file system at Carnegie Mellon - * University. Contributers include David Steere, James Kistler, - * M. Satyanarayanan, and Brian Noble. - */ - -/* - * HISTORY - * $Log: cfs_nbsd.c,v $ - * Revision 1.21 1998/08/28 18:12:17 rvb - * Now it also works on FreeBSD -current. This code will be - * committed to the FreeBSD -current and NetBSD -current - * trees. It will then be tailored to the particular platform - * by flushing conditional code. - * - * Revision 1.20 1998/08/18 17:05:15 rvb - * Don't use __RCSID now - * - * Revision 1.19 1998/08/18 16:31:40 rvb - * Sync the code for NetBSD -current; test on 1.3 later - * - * Revision 1.18 98/01/23 11:53:40 rvb - * Bring RVB_CFS1_1 to HEAD - * - * Revision 1.17.2.1 97/12/09 16:07:11 rvb - * Sync with vfs/include/coda.h - * - * Revision 1.17 97/12/05 10:39:15 rvb - * Read CHANGES - * - * Revision 1.16.6.5 97/11/20 11:46:39 rvb - * Capture current cfs_venus - * - * Revision 1.16.6.4 97/11/18 10:27:14 rvb - * cfs_nbsd.c is DEAD!!!; integrated into cfs_vf/vnops.c - * cfs_nb_foo and cfs_foo are joined - * - * Revision 1.16.6.3 97/11/13 22:02:58 rvb - * pass2 cfs_NetBSD.h mt - * - * Revision 1.16.6.2 97/11/12 12:09:37 rvb - * reorg pass1 - * - * Revision 1.16.6.1 97/10/28 23:10:14 rvb - * >64Meg; venus can be killed! - * - * Revision 1.16 97/07/18 15:28:41 rvb - * Bigger/Better/Faster than AFS - * - * Revision 1.15 1997/02/19 18:41:39 bnoble - * Didn't sufficiently unswap the now-unswapped dvp and vp in cfs_nb_link - * - * Revision 1.13 1997/02/18 23:46:25 bnoble - * NetBSD swapped the order of arguments to VOP_LINK between 1.1 and 1.2. - * This tracks that change. - * - * Revision 1.12 1997/02/18 22:23:38 bnoble - * Rename lockdebug to cfs_lockdebug - * - * Revision 1.11 1997/02/13 18:46:14 rvb - * Name CODA FS for df - * - * Revision 1.10 1997/02/12 15:32:05 rvb - * Make statfs return values like for AFS - * - * Revision 1.9 1997/01/30 16:42:02 bnoble - * Trace version as of SIGCOMM submission. Minor fix in cfs_nb_open - * - * Revision 1.8 1997/01/13 17:11:05 bnoble - * Coda statfs needs to return something other than -1 for blocks avail. and - * files available for wabi (and other windowsish) programs to install - * there correctly. - * - * Revision 1.6 1996/12/05 16:20:14 bnoble - * Minor debugging aids - * - * Revision 1.5 1996/11/25 18:25:11 bnoble - * Added a diagnostic check for cfs_nb_lock - * - * Revision 1.4 1996/11/13 04:14:19 bnoble - * Merging BNOBLE_WORK_6_20_96 into main line - * - * - * Revision 1.3 1996/11/08 18:06:11 bnoble - * Minor changes in vnode operation signature, VOP_UPDATE signature, and - * some newly defined bits in the include files. - * - * Revision 1.2.8.1 1996/06/26 16:28:26 bnoble - * Minor bug fixes - * - * Revision 1.2 1996/01/02 16:56:52 bnoble - * Added support for Coda MiniCache and raw inode calls (final commit) - * - * Revision 1.1.2.1 1995/12/20 01:57:17 bnoble - * Added CFS-specific files - * - */ diff --git a/sys/coda/coda_opstats.h b/sys/coda/coda_opstats.h index 37017f279f09..5f528ec386c4 100644 --- a/sys/coda/coda_opstats.h +++ b/sys/coda/coda_opstats.h @@ -1,34 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/coda_opstats.h,v 1.5 1998/08/18 17:05:25 rvb Exp $ */ - + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/coda_opstats.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * operation stats: what the minicache can intercept that @@ -102,12 +103,10 @@ Mellon the rights to redistribute these changes without encumbrance. #define CFS_READDIR_STATS 19 #define CFS_VNODEOPS_SIZE 20 - /* * I propose the following structres: */ - struct cfs_op_stats { int opcode; /* vfs opcode */ long entries; /* number of times call attempted */ @@ -118,7 +117,6 @@ struct cfs_op_stats { /* (do we need that?) */ }; - /* * With each call to the minicache, we'll bump the counters whenver * a call is satisfied internally (through the cache or through a diff --git a/sys/coda/coda_pioctl.h b/sys/coda/coda_pioctl.h index 3e8957062a18..c6fcc6fe947f 100644 --- a/sys/coda/coda_pioctl.h +++ b/sys/coda/coda_pioctl.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/pioctl.h,v 1.7 1998/08/28 18:12:26 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/pioctl.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -41,6 +43,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: pioctl.h,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.7 1998/08/28 18:12:26 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -108,11 +113,8 @@ Mellon the rights to redistribute these changes without encumbrance. are no input or output parameters */ -#ifdef __STDC__ #define _VICEIOCTL(id) ((unsigned int ) _IOW('V', id, struct ViceIoctl)) -#else -#define _VICEIOCTL(id) ((unsigned int ) _IOW(V, id, struct ViceIoctl)) -#endif + /* Use this macro to define up to 256 vice ioctl's. These ioctl's all potentially have in/out parameters--this depends upon the values in the ViceIoctl structure. This structure is itself passed @@ -121,4 +123,4 @@ Mellon the rights to redistribute these changes without encumbrance. #define _VALIDVICEIOCTL(com) (com >= _VICEIOCTL(0) && com <= _VICEIOCTL(255)) -#endif _SYS_PIOCTL_H_ +#endif diff --git a/sys/coda/coda_psdev.c b/sys/coda/coda_psdev.c index 47b4754f8dcd..3c7c7242bda1 100644 --- a/sys/coda/coda_psdev.c +++ b/sys/coda/coda_psdev.c @@ -1,35 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_psdev.c,v 1.9 1998/08/28 18:12:17 rvb Exp $ */ - -#define CTL_C + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_psdev.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -43,20 +43,19 @@ Mellon the rights to redistribute these changes without encumbrance. * University. Contributers include David Steere, James Kistler, and * M. Satyanarayanan. */ -/* ************************************************** */ -/* These routines define the psuedo device for communication between +/* + * These routines define the psuedo device for communication between * Coda's Venus and Minicache in Mach 2.6. They used to be in cfs_subr.c, * but I moved them to make it easier to port the Minicache without * porting coda. -- DCS 10/12/94 */ -/* - * Renamed to cfs_psdev: pseudo-device driver. - */ - /* * HISTORY * $Log: cfs_psdev.c,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.9 1998/08/28 18:12:17 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -153,40 +152,28 @@ Mellon the rights to redistribute these changes without encumbrance. extern int cfsnc_initialized; /* Set if cache has been initialized */ #include + #include #include #include -#include #include +#include #include #include -#ifdef __FreeBSD_version #include -#else -#include -#endif -#ifdef NetBSD1_3 #include -#endif -#ifdef __FreeBSD_version -#include -#else -#include -#endif +#include #include #include #include #include +#define CTL_C + int cfs_psdev_print_entry = 0; -#ifdef __GNUC__ -#define ENTRY \ - if(cfs_psdev_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) -#else -#define ENTRY -#endif +#define ENTRY if(cfs_psdev_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) void vcfsattach(int n); int vc_nb_open(dev_t dev, int flag, int mode, struct proc *p); @@ -194,11 +181,7 @@ int vc_nb_close (dev_t dev, int flag, int mode, struct proc *p); int vc_nb_read(dev_t dev, struct uio *uiop, int flag); int vc_nb_write(dev_t dev, struct uio *uiop, int flag); int vc_nb_ioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p); -#if defined(NetBSD1_3) || defined(__FreeBSD_version) int vc_nb_poll(dev_t dev, int events, struct proc *p); -#else -int vc_nb_select(dev_t dev, int flag, struct proc *p); -#endif struct vmsg { struct queue vm_chain; @@ -222,9 +205,6 @@ vcfsattach(n) { } -/* - * These functions are written for NetBSD. - */ int vc_nb_open(dev, flag, mode, p) dev_t dev; @@ -289,14 +269,6 @@ vc_nb_close (dev, flag, mode, p) if (mi->mi_rootvp) { /* Let unmount know this is for real */ VTOC(mi->mi_rootvp)->c_flags |= C_UNMOUNTING; -#ifdef NEW_LOCKMGR -#ifdef __FreeBSD_version - /* dounmount is different ... probably wrong ... */ -#else - if (vfs_busy(mi->mi_vfsp, 0, 0)) - return (EBUSY); -#endif -#endif cfs_unmounting(mi->mi_vfsp); err = dounmount(mi->mi_vfsp, flag, p); if (err) @@ -523,7 +495,6 @@ vc_nb_ioctl(dev, cmd, addr, flag, p) } } -#if defined(NetBSD1_3) || defined(__FreeBSD_version) int vc_nb_poll(dev, events, p) dev_t dev; @@ -551,33 +522,6 @@ vc_nb_poll(dev, events, p) return(0); } -#else -int -vc_nb_select(dev, flag, p) - dev_t dev; - int flag; - struct proc *p; -{ - register struct vcomm *vcp; - - ENTRY; - - if (minor(dev) >= NVCFS || minor(dev) < 0) - return(ENXIO); - - vcp = &cfs_mnttbl[minor(dev)].mi_vcomm; - - if (flag != FREAD) - return(0); - - if (!EMPTY(vcp->vc_requests)) - return(1); - - selrecord(p, &(vcp->vc_selproc)); - - return(0); -} -#endif /* * Statistics @@ -593,7 +537,6 @@ struct cfs_clstat cfs_clstat; * (e.g. kill -9). */ -/* If you want this to be interruptible, set this to > PZERO */ int cfscall_sleep = PZERO - 1; #ifdef CTL_C int cfs_pcatch = PCATCH; diff --git a/sys/coda/coda_subr.c b/sys/coda/coda_subr.c index 3d20e578788c..a2fd7922e1de 100644 --- a/sys/coda/coda_subr.c +++ b/sys/coda/coda_subr.c @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_subr.c,v 1.11 1998/08/28 18:12:18 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_subr.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -44,6 +46,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cfs_subr.c,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.11 1998/08/28 18:12:18 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -202,8 +207,8 @@ Mellon the rights to redistribute these changes without encumbrance. #include #include -#include #include +#include #include #include @@ -212,8 +217,6 @@ Mellon the rights to redistribute these changes without encumbrance. #include #include -#if NVCFS - int cfs_active = 0; int cfs_reuse = 0; int cfs_new = 0; @@ -221,11 +224,8 @@ int cfs_new = 0; struct cnode *cfs_freelist = NULL; struct cnode *cfs_cache[CFS_CACHESIZE]; -#define cfshash(fid) \ - (((fid)->Volume + (fid)->Vnode) & (CFS_CACHESIZE-1)) - +#define cfshash(fid) (((fid)->Volume + (fid)->Vnode) & (CFS_CACHESIZE-1)) #define CNODE_NEXT(cp) ((cp)->c_next) - #define ODD(vnode) ((vnode) & 0x1) /* @@ -690,24 +690,13 @@ int cfs_vmflush(cp) struct cnode *cp; { -#if 0 - /* old code */ - /* Unset so that page_read doesn't try to use - (possibly) invalid cache file. */ - cp->c_device = 0; - cp->c_inode = 0; - - return(inode_uncache_try(VTOI(CTOV(cp))) ? 0 : ETXTBSY); -#else /* __NetBSD__ || __FreeBSD__ */ return 0; -#endif /* __NetBSD__ || __FreeBSD__ */ } /* * kernel-internal debugging switches */ - void cfs_debugon(void) { cfsdebug = -1; @@ -745,6 +734,3 @@ void cfs_debugoff(void) * 13) all <= 3 * ... */ - - -#endif /* NVCFS */ diff --git a/sys/coda/coda_subr.h b/sys/coda/coda_subr.h index cf983d420dc1..4beedc9436f9 100644 --- a/sys/coda/coda_subr.h +++ b/sys/coda/coda_subr.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_subr.h,v 1.4 1998/08/18 17:05:16 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_subr.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ struct cnode *cfs_alloc(void); void cfs_free(struct cnode *cp); @@ -41,5 +43,3 @@ void cfs_debugoff(void); int cfs_kill(struct mount *whoIam, enum dc_status dcstat); void cfs_save(struct cnode *cp); void cfs_unsave(struct cnode *cp); - - diff --git a/sys/coda/coda_venus.c b/sys/coda/coda_venus.c index 87679148cd11..7f7b30b9a17d 100644 --- a/sys/coda/coda_venus.c +++ b/sys/coda/coda_venus.c @@ -1,45 +1,42 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_venus.c,v 1.11 1998/08/28 18:12:20 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_venus.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ #include #include #include #include #include -#ifdef __FreeBSD_version #include -#else -#include -#endif -/* for CNV_OFLAGS below */ #include #include @@ -342,11 +339,11 @@ venus_access(void *mdp, ViceFid *fid, int mode, /* send the open to venus. */ INIT_IN(&inp->ih, CFS_ACCESS, cred, p); inp->VFid = *fid; -#ifdef NetBSD1_3 - inp->flags = mode; -#else + /* NOTE: + * NetBSD and Venus internals use the "data" in the low 3 bits. + * Hence, the conversion. + */ inp->flags = mode>>6; -#endif error = cfscall(mdp, Isize, &Osize, (char *)inp); @@ -437,11 +434,7 @@ venus_create(void *mdp, ViceFid *fid, INIT_IN(&inp->ih, CFS_CREATE, cred, p); inp->VFid = *fid; inp->excl = exclusive ? C_O_EXCL : 0; -#ifdef NetBSD1_3 - inp->mode = mode<<6; -#else inp->mode = mode; -#endif CNV_V2VV_ATTR(&inp->attr, va); inp->name = Isize; diff --git a/sys/coda/coda_venus.h b/sys/coda/coda_venus.h index 19c95e77ecc6..ee0fb4f6cd4e 100644 --- a/sys/coda/coda_venus.h +++ b/sys/coda/coda_venus.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_venus.h,v 1.4 1998/08/18 17:05:18 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_venus.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ int venus_root(void *mdp, diff --git a/sys/coda/coda_vfsops.c b/sys/coda/coda_vfsops.c index d44533a127bb..64861680b1c6 100644 --- a/sys/coda/coda_vfsops.c +++ b/sys/coda/coda_vfsops.c @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_vfsops.c,v 1.11 1998/08/28 18:12:22 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -45,6 +47,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cfs_vfsops.c,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.11 1998/08/28 18:12:22 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -173,11 +178,12 @@ Mellon the rights to redistribute these changes without encumbrance. #include #include +#include +#include #include #include #include #include -#include #include #include @@ -186,25 +192,14 @@ Mellon the rights to redistribute these changes without encumbrance. #include #include #include -/* for VN_RDEV */ + #include -#ifdef __FreeBSD__ -#ifdef __FreeBSD_version MALLOC_DEFINE(M_CFS, "CFS storage", "Various Coda Structures"); -#endif -#endif int cfsdebug = 0; - int cfs_vfsop_print_entry = 0; -#ifdef __GNUC__ -#define ENTRY \ - if(cfs_vfsop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) -#else -#define ENTRY -#endif - +#define ENTRY if(cfs_vfsop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) struct vnode *cfs_ctlvp; struct cfs_mntinfo cfs_mnttbl[NVCFS]; /* indexed by minor device number */ @@ -220,65 +215,7 @@ struct cfs_op_stats cfs_vfsopstats[CFS_VFSOPS_SIZE]; extern int cfsnc_initialized; /* Set if cache has been initialized */ extern int vc_nb_open __P((dev_t, int, int, struct proc *)); -#ifdef __NetBSD__ -extern struct cdevsw cdevsw[]; /* For sanity check in cfs_mount */ -#endif -/* NetBSD interface to statfs */ -#if defined(__NetBSD__) && defined(NetBSD1_3) && (NetBSD1_3 >= 5) -extern struct vnodeopv_desc cfs_vnodeop_opv_desc; - -struct vnodeopv_desc *cfs_vnodeopv_descs[] = { - &cfs_vnodeop_opv_desc, - NULL, -}; - -struct vfsops cfs_vfsops = { - MOUNT_CFS, - cfs_mount, - cfs_start, - cfs_unmount, - cfs_root, - cfs_quotactl, - cfs_nb_statfs, - cfs_sync, - cfs_vget, - (int (*) (struct mount *, struct fid *, struct mbuf *, struct vnode **, - int *, struct ucred **)) - eopnotsupp, - (int (*) (struct vnode *, struct fid *)) eopnotsupp, - cfs_init, -#if (NetBSD1_3 >= 7) - cfs_sysctl, -#endif - (int (*)(void)) eopnotsupp, - cfs_vnodeopv_descs, - 0 -}; -#elif defined(__NetBSD__) -struct vfsops cfs_vfsops = { - MOUNT_CFS, - cfs_mount, - cfs_start, - cfs_unmount, - cfs_root, - cfs_quotactl, - cfs_nb_statfs, - cfs_sync, - cfs_vget, - (int (*) (struct mount *, struct fid *, struct mbuf *, struct vnode **, - int *, struct ucred **)) - eopnotsupp, - (int (*) (struct vnode *, struct fid *)) eopnotsupp, - cfs_init, -#ifdef NetBSD1_3 - (int (*)(void)) eopnotsupp, -#endif - 0 -}; - -#elif defined(__FreeBSD__) -#ifdef __FreeBSD_version struct vfsops cfs_vfsops = { cfs_mount, cfs_start, @@ -295,29 +232,7 @@ struct vfsops cfs_vfsops = { cfs_init, }; -#else -struct vfsops cfs_vfsops = { - cfs_mount, - cfs_start, - cfs_unmount, - cfs_root, - cfs_quotactl, - cfs_nb_statfs, - cfs_sync, - cfs_vget, - (int (*) (struct mount *, struct fid *, struct mbuf *, struct vnode **, - int *, struct ucred **)) - eopnotsupp, - (int (*) (struct vnode *, struct fid *)) eopnotsupp, - cfs_init, -}; - -#endif - - -#include VFS_SET(cfs_vfsops, cfs, MOUNT_CFS, VFCF_NETWORK); -#endif int cfs_vfsopstats_init(void) @@ -335,7 +250,6 @@ cfs_vfsopstats_init(void) return 0; } - /* * cfs mount vfsop * Set up mount info record and attach it to vfs struct. @@ -344,13 +258,8 @@ cfs_vfsopstats_init(void) int cfs_mount(vfsp, path, data, ndp, p) struct mount *vfsp; /* Allocated and initialized by mount(2) */ -#ifdef NetBSD1_3 - const char *path; /* path covered: ignored by the fs-layer */ - void *data; /* Need to define a data type for this in netbsd? */ -#else char *path; /* path covered: ignored by the fs-layer */ caddr_t data; /* Need to define a data type for this in netbsd? */ -#endif struct nameidata *ndp; /* Clobber this to lookup the device name */ struct proc *p; /* The ever-famous proc pointer */ { @@ -399,11 +308,7 @@ cfs_mount(vfsp, path, data, ndp, p) /* * See if the device table matches our expectations. */ -#ifdef __NetBSD__ - if (cdevsw[major(dev)].d_open != vc_nb_open) -#elif defined(__FreeBSD__) if (cdevsw[major(dev)]->d_open != vc_nb_open) -#endif { MARK_INT_FAIL(CFS_MOUNT_STATS); return(ENXIO); @@ -426,19 +331,8 @@ cfs_mount(vfsp, path, data, ndp, p) /* No initialization (here) of mi_vcomm! */ vfsp->mnt_data = (qaddr_t)mi; -#ifdef __NetBSD__ - vfsp->mnt_stat.f_fsid.val[0] = 0; - vfsp->mnt_stat.f_fsid.val[1] = makefstype(MOUNT_CFS); -#elif defined(__FreeBSD__) && defined(__FreeBSD_version) - vfs_getnewfsid (vfsp); -#elif defined(__FreeBSD__) - /* Seems a bit overkill, since usualy /coda is the only mount point - * for cfs. - */ - getnewfsid (vfsp, MOUNT_CFS); -#endif mi->mi_vfsp = vfsp; /* @@ -471,13 +365,12 @@ cfs_mount(vfsp, path, data, ndp, p) /* set filesystem block size */ vfsp->mnt_stat.f_bsize = 8192; /* XXX -JJK */ -#ifdef __FreeBSD__ + /* Set f_iosize. XXX -- inamura@isl.ntt.co.jp. For vnode_pager_haspage() references. The value should be obtained from underlying UFS. */ /* Checked UFS. iosize is set as 8192 */ vfsp->mnt_stat.f_iosize = 8192; -#endif /* error is currently guaranteed to be zero, but in case some code changes... */ @@ -526,27 +419,10 @@ cfs_unmount(vfsp, mntflags, p) #endif vrele(mi->mi_rootvp); -#ifdef NetBSD1_3 - active = cfs_kill(vfsp, NOT_DOWNCALL); - -#if defined(__NetBSD__) && defined(NetBSD1_3) && (NetBSD1_3 >= 7) - if (1) -#else - if ((error = vfs_busy(mi->mi_vfsp)) == 0) -#endif - { - error = vflush(mi->mi_vfsp, NULLVP, FORCECLOSE); - printf("cfs_unmount: active = %d, vflush active %d\n", active, error); - error = 0; - } else { - printf("cfs_unmount: busy\n"); - } -#else /* FreeBSD I guess */ active = cfs_kill(vfsp, NOT_DOWNCALL); error = vflush(mi->mi_vfsp, NULLVP, FORCECLOSE); printf("cfs_unmount: active = %d, vflush active %d\n", active, error); error = 0; -#endif /* I'm going to take this out to allow lookups to go through. I'm * not sure it's important anyway. -- DCS 2/2/94 */ @@ -591,8 +467,12 @@ cfs_root(vfsp, vpp) { /* Found valid root. */ *vpp = mi->mi_rootvp; /* On Mach, this is vref. On NetBSD, VOP_LOCK */ +#if 1 vref(*vpp); - VOP_X_LOCK(*vpp, LK_EXCLUSIVE); + vn_lock(*vpp, LK_EXCLUSIVE, p); +#else + vget(*vpp, LK_EXCLUSIVE, p); +#endif MARK_INT_SAT(CFS_ROOT_STATS); return(0); } @@ -610,8 +490,13 @@ cfs_root(vfsp, vpp) cfs_save(VTOC(mi->mi_rootvp)); *vpp = mi->mi_rootvp; +#if 1 vref(*vpp); - VOP_X_LOCK(*vpp, LK_EXCLUSIVE); + vn_lock(*vpp, LK_EXCLUSIVE, p); +#else + vget(*vpp, LK_EXCLUSIVE, p); +#endif + MARK_INT_SAT(CFS_ROOT_STATS); goto exit; } else if (error == ENODEV) { @@ -625,8 +510,13 @@ cfs_root(vfsp, vpp) * will fail. */ *vpp = mi->mi_rootvp; +#if 1 vref(*vpp); - VOP_X_LOCK(*vpp, LK_EXCLUSIVE); + vn_lock(*vpp, LK_EXCLUSIVE, p); +#else + vget(*vpp, LK_EXCLUSIVE, p); +#endif + MARK_INT_FAIL(CFS_ROOT_STATS); error = 0; goto exit; @@ -636,6 +526,7 @@ cfs_root(vfsp, vpp) goto exit; } + exit: return(error); } @@ -674,11 +565,7 @@ cfs_nb_statfs(vfsp, sbp, p) #define NB_SFS_SIZ 0x895440 */ /* Note: Normal fs's have a bsize of 0x400 == 1024 */ -#ifdef __NetBSD__ - sbp->f_type = 0; -#elif defined(__FreeBSD__) sbp->f_type = MOUNT_CFS; -#endif sbp->f_bsize = 8192; /* XXX */ sbp->f_iosize = 8192; /* XXX */ #define NB_SFS_SIZ 0x8AB75D @@ -688,9 +575,6 @@ cfs_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)); -#ifdef __NetBSD__ - strncpy(sbp->f_fstypename, MOUNT_CFS, MFSNAMELEN-1); -#endif strcpy(sbp->f_mntonname, "/coda"); strcpy(sbp->f_mntfromname, "CFS"); /* MARK_INT_SAT(CFS_STATFS_STATS); */ @@ -780,57 +664,12 @@ cfs_vptofh(vnp, fidp) return (EOPNOTSUPP); } -#ifdef __NetBSD__ -void -cfs_init(void) -{ - ENTRY; -} -#elif defined(__FreeBSD__) -#ifdef __FreeBSD_version int cfs_init(struct vfsconf *vfsp) { ENTRY; return 0; } -#else -int -cfs_init(void) -{ - ENTRY; - return 0; -} -#endif -#endif - -#if defined(__NetBSD__) && defined(NetBSD1_3) && (NetBSD1_3 >= 7) -int -cfs_sysctl(name, namelen, oldp, oldlp, newp, newl, p) - int *name; - u_int namelen; - void *oldp; - size_t *oldlp; - void *newp; - size_t newl; - struct proc *p; -{ - - /* all sysctl names at this level are terminal */ - if (namelen != 1) - return (ENOTDIR); /* overloaded */ - - switch (name[0]) { -/* - case FFS_CLUSTERREAD: - return (sysctl_int(oldp, oldlp, newp, newl, &doclusterread)); - */ - default: - return (EOPNOTSUPP); - } - /* NOTREACHED */ -} -#endif /* * To allow for greater ease of use, some vnodes may be orphaned when @@ -873,11 +712,7 @@ struct mount *devtomp(dev) for (mp = mountlist.cqh_first; mp != (void*)&mountlist; mp = nmp) { nmp = mp->mnt_list.cqe_next; - if ( -#ifdef __NetBSD__ - (!strcmp(mp->mnt_op->vfs_name, MOUNT_UFS)) && -#endif - ((VFSTOUFS(mp))->um_dev == (dev_t) dev)) { + if (((VFSTOUFS(mp))->um_dev == (dev_t) dev)) { /* mount corresponds to UFS and the device matches one we want */ return(mp); } diff --git a/sys/coda/coda_vfsops.h b/sys/coda/coda_vfsops.h index 9f8e77767a3f..754bbf321dcf 100644 --- a/sys/coda/coda_vfsops.h +++ b/sys/coda/coda_vfsops.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_vfsops.h,v 1.9 1998/08/28 18:12:22 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_vfsops.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * cfid structure: @@ -41,17 +43,11 @@ struct cfid { ViceFid cfid_fid; }; - struct mount; int cfs_vfsopstats_init(void); -#ifdef NetBSD1_3 -int cfs_mount(struct mount *, const char *, void *, struct nameidata *, - struct proc *); -#else int cfs_mount(struct mount *, char *, caddr_t, struct nameidata *, struct proc *); -#endif int cfs_start(struct mount *, int, struct proc *); int cfs_unmount(struct mount *, int, struct proc *); int cfs_root(struct mount *, struct vnode **); @@ -62,17 +58,6 @@ int cfs_vget(struct mount *, ino_t, struct vnode **); int cfs_fhtovp(struct mount *, struct fid *, struct mbuf *, struct vnode **, int *, struct ucred **); int cfs_vptofh(struct vnode *, struct fid *); -#ifdef __NetBSD__ -void cfs_init(void); -#elif defined(__FreeBSD__) -#ifdef __FreeBSD_version int cfs_init(struct vfsconf *vfsp); -#else -int cfs_init(void); -#endif -#endif -#if defined(__NetBSD__) && defined(NetBSD1_3) && (NetBSD1_3 >= 7) -int cfs_sysctl(int *, u_int, void *, size_t *, void *, size_t, - struct proc *); -#endif + int getNewVnode(struct vnode **vpp); diff --git a/sys/coda/coda_vnops.c b/sys/coda/coda_vnops.c index 69197d7e8912..c5c82038581b 100644 --- a/sys/coda/coda_vnops.c +++ b/sys/coda/coda_vnops.c @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_vnodeops.c,v 1.12 1998/08/28 18:28:00 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_vnodeops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -46,6 +48,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cfs_vnodeops.c,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.12 1998/08/28 18:28:00 rvb * NetBSD -current is stricter! * @@ -214,35 +219,23 @@ Mellon the rights to redistribute these changes without encumbrance. #include #include +#include +#include #include +#include #include #include #include +#include #include #include -#ifdef __FreeBSD_version #include -#else -#include -#endif -#include -#include #include -#ifdef __NetBSD__ -#include -#endif -#include -#ifdef NetBSD1_3 -#include -#endif -#ifdef __FreeBSD__ +#include #include #include -#ifdef __FreeBSD_version -#include -#endif -#endif +#include #include #include @@ -256,7 +249,6 @@ Mellon the rights to redistribute these changes without encumbrance. /* * These flags select various performance enhancements. */ -int cfs_intercept_rdwr = 1; /* Set to handle read/write in the kernel */ int cfs_attr_cache = 1; /* Set to cache attributes in the kernel */ int cfs_symlink_cache = 1; /* Set to cache symbolic link information */ int cfs_access_cache = 1; /* Set to handle some access checks directly */ @@ -284,20 +276,15 @@ static int cfs_lockdebug = 0; * cfs_init is called at boot time. */ -#ifdef __GNUC__ -#define ENTRY \ - if(cfs_vnop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) -#else -#define ENTRY -#endif +#define ENTRY if(cfs_vnop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) /* Definition of the vnode operation vector */ struct vnodeopv_entry_desc cfs_vnodeop_entries[] = { - { &vop_default_desc, nbsd_vop_error }, + { &vop_default_desc, cfs_vop_error }, { &vop_lookup_desc, cfs_lookup }, /* lookup */ { &vop_create_desc, cfs_create }, /* create */ - { &vop_mknod_desc, nbsd_vop_error }, /* mknod */ + { &vop_mknod_desc, cfs_vop_error }, /* mknod */ { &vop_open_desc, cfs_open }, /* open */ { &vop_close_desc, cfs_close }, /* close */ { &vop_access_desc, cfs_access }, /* access */ @@ -306,8 +293,7 @@ struct vnodeopv_entry_desc cfs_vnodeop_entries[] = { { &vop_read_desc, cfs_read }, /* read */ { &vop_write_desc, cfs_write }, /* write */ { &vop_ioctl_desc, cfs_ioctl }, /* ioctl */ -/* 1.3 { &vop_select_desc, cfs_select }, select */ - { &vop_mmap_desc, nbsd_vop_error }, /* mmap */ + { &vop_mmap_desc, cfs_vop_error }, /* mmap */ { &vop_fsync_desc, cfs_fsync }, /* fsync */ { &vop_remove_desc, cfs_remove }, /* remove */ { &vop_link_desc, cfs_link }, /* link */ @@ -324,41 +310,19 @@ struct vnodeopv_entry_desc cfs_vnodeop_entries[] = { { &vop_unlock_desc, cfs_unlock }, /* unlock */ { &vop_bmap_desc, cfs_bmap }, /* bmap */ { &vop_strategy_desc, cfs_strategy }, /* strategy */ - { &vop_print_desc, nbsd_vop_error }, /* print */ + { &vop_print_desc, cfs_vop_error }, /* print */ { &vop_islocked_desc, cfs_islocked }, /* islocked */ - { &vop_pathconf_desc, nbsd_vop_error }, /* pathconf */ - { &vop_advlock_desc, nbsd_vop_nop }, /* advlock */ - { &vop_bwrite_desc, nbsd_vop_error }, /* bwrite */ - { &vop_lease_desc, nbsd_vop_nop }, /* lease */ - -#ifdef __FreeBSD_version -#else /* FreeBSD stable & NetBSD both */ - { &vop_blkatoff_desc, nbsd_vop_error }, /* blkatoff */ - { &vop_valloc_desc, nbsd_vop_error }, /* valloc */ - { &vop_vfree_desc, nbsd_vop_error }, /* vfree */ - { &vop_truncate_desc, nbsd_vop_error }, /* truncate */ - { &vop_update_desc, nbsd_vop_error }, /* update */ -#endif - - /* NetBSD only */ -#ifdef __NetBSD__ -#ifdef NetBSD1_3 - { &vop_seek_desc, genfs_seek }, /* seek */ -#else - { &vop_seek_desc, nbsd_vop_error }, /* seek */ -#endif -#endif - - /* FreeBSD only */ -#ifdef __FreeBSD__ - -#ifdef __FreeBSD_version - - { &vop_poll_desc, (vop_t *) vop_stdpoll }, - { &vop_getpages_desc, (vop_t *) cfs_fbsd_getpages }, /* pager intf.*/ - { &vop_putpages_desc, (vop_t *) cfs_fbsd_putpages }, /* pager intf.*/ + { &vop_pathconf_desc, cfs_vop_error }, /* pathconf */ + { &vop_advlock_desc, cfs_vop_nop }, /* advlock */ + { &vop_bwrite_desc, cfs_vop_error }, /* bwrite */ + { &vop_lease_desc, cfs_vop_nop }, /* lease */ + { &vop_poll_desc, (vop_t *) vop_stdpoll }, + { &vop_getpages_desc, cfs_fbsd_getpages }, /* pager intf.*/ + { &vop_putpages_desc, cfs_fbsd_putpages }, /* pager intf.*/ #if 0 + + we need to define these someday #define UFS_BLKATOFF(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_blkatoff(aa, bb, cc, dd) #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) @@ -369,68 +333,29 @@ struct vnodeopv_entry_desc cfs_vnodeop_entries[] = { { &vop_reallocblks_desc, (vop_t *) ufs_missingop }, { &vop_cachedlookup_desc, (vop_t *) ufs_lookup }, { &vop_whiteout_desc, (vop_t *) ufs_whiteout }, -#endif - -#else /* FreeBSD stable */ - { &vop_getpages_desc, fbsd_vnotsup }, /* pager intf.*/ - { &vop_putpages_desc, fbsd_vnotsup }, /* pager intf.*/ - { &vop_seek_desc, nbsd_vop_error }, /* seek */ - { &vop_blkatoff_desc, nbsd_vop_error }, /* blkatoff */ - { &vop_valloc_desc, nbsd_vop_error }, /* valloc */ - { &vop_vfree_desc, nbsd_vop_error }, /* vfree */ - { &vop_truncate_desc, nbsd_vop_error }, /* truncate */ - { &vop_update_desc, nbsd_vop_error }, /* update */ -#endif #endif { (struct vnodeop_desc*)NULL, (int(*)(void *))NULL } }; -#ifdef __NetBSD__ -struct vnodeopv_desc cfs_vnodeop_opv_desc = - { &cfs_vnodeop_p, cfs_vnodeop_entries }; - -#define NAMEI_FREE(a) FREE(a, M_NAMEI) -#endif - -#ifdef __FreeBSD__ static struct vnodeopv_desc cfs_vnodeop_opv_desc = { &cfs_vnodeop_p, cfs_vnodeop_entries }; -#include VNODEOP_SET(cfs_vnodeop_opv_desc); -int -fbsd_vnotsup(ap) - void *ap; -{ - return(EOPNOTSUPP); -} - -#ifdef __FreeBSD_version -#include - -#define NAMEI_FREE(a) zfree(namei_zone, a); -#else -#define NAMEI_FREE(a) FREE(a, M_NAMEI) -#endif -#endif - -/* Definitions of NetBSD vnodeop interfaces */ - /* A generic panic: we were called with something we didn't define yet */ int -nbsd_vop_error(void *anon) { +cfs_vop_error(void *anon) { struct vnodeop_desc **desc = (struct vnodeop_desc **)anon; myprintf(("Vnode operation %s called, but not defined\n", (*desc)->vdesc_name)); - panic("nbsd_vop_error"); + panic("cfs_vop_error"); return 0; } /* A generic do-nothing. For lease_check, advlock */ int -nbsd_vop_nop(void *anon) { +cfs_vop_nop(void *anon) { struct vnodeop_desc **desc = (struct vnodeop_desc **)anon; if (cfsdebug) { @@ -452,7 +377,6 @@ cfs_vnodeopstats_init(void) cfs_vnodeopstats[i].unsat_intrn = 0; cfs_vnodeopstats[i].gen_intrn = 0; } - return 0; } @@ -511,8 +435,8 @@ cfs_open(v) if (error) return (error); - /* We get the vnode back locked in both Mach and NetBSD. Needs unlocked */ - VOP_X_UNLOCK(vp, 0); + /* We get the vnode back locked. Needs unlocked */ + VOP_UNLOCK(vp, 0, p); /* Keep a reference until the close comes in. */ vref(*vpp); @@ -538,7 +462,6 @@ cfs_open(v) /* Open the cache file. */ error = VOP_OPEN(vp, flag, cred, p); -#ifdef __FreeBSD__ if (error) { printf("cfs_open: VOP_OPEN on container failed %d\n", error); return (error); @@ -550,7 +473,6 @@ cfs_open(v) vput(vp); } } -#endif return(error); } @@ -658,8 +580,6 @@ cfs_rdwr(vp, uiop, rw, ioflag, cred, p) return(EINVAL); } - /* Redirect the request to UFS. */ - /* * If file is not already open this must be a page * {read,write} request. Iget the cache file's inode @@ -684,7 +604,7 @@ cfs_rdwr(vp, uiop, rw, ioflag, cred, p) * We get the vnode back locked in both Mach and * NetBSD. Needs unlocked */ - VOP_X_UNLOCK(cfvp, 0); + VOP_UNLOCK(cfvp, 0, p); } else { opened_internally = 1; @@ -692,7 +612,6 @@ cfs_rdwr(vp, uiop, rw, ioflag, cred, p) error = VOP_OPEN(vp, (rw == UIO_READ ? FREAD : FWRITE), cred, p); printf("cfs_rdwr: Internally Opening %p\n", vp); -#ifdef __FreeBSD__ if (error) { printf("cfs_rdwr: VOP_OPEN on container failed %d\n", error); return (error); @@ -704,7 +623,6 @@ printf("cfs_rdwr: Internally Opening %p\n", vp); vput(vp); } } -#endif if (error) { MARK_INT_FAIL(CFS_RDWR_STATS); return(error); @@ -722,18 +640,13 @@ printf("cfs_rdwr: Internally Opening %p\n", vp); error = VOP_READ(cfvp, uiop, ioflag, cred); } else { error = VOP_WRITE(cfvp, uiop, ioflag, cred); -#ifdef __FreeBSD__ /* ufs_write updates the vnode_pager_setsize for the vnode/object */ { struct vattr attr; if (VOP_GETATTR(cfvp, &attr, cred, p) == 0) { vnode_pager_setsize(vp, attr.va_size); -#ifdef __DEBUG_FreeBSD__ - printf("write: vnode_pager_setsize(%p, %d)\n", vp, attr.va_size); -#endif } } -#endif } if (error) @@ -829,28 +742,6 @@ cfs_ioctl(v) return(error); } -#if 0 -int -cfs_select(v) - void *v; -{ -/* true args */ - struct vop_select_args *ap = v; - struct vnode *vp = ap->a_vp; - int which = ap->a_which; - struct ucred *cred = ap->a_cred; - struct proc *p = ap->a_p; -/* upcall decl */ -/* locals */ - - MARK_ENTRY(CFS_SELECT_STATS); - - myprintf(("in cfs_select\n")); - MARK_INT_FAIL(CFS_SELECT_STATS); - return (EOPNOTSUPP); -} -#endif - /* * To reduce the cost of a user-level venus;we cache attributes in * the kernel. Each cnode has storage allocated for an attribute. If @@ -873,29 +764,12 @@ cfs_getattr(v) struct proc *p = ap->a_p; /* locals */ int error; - struct cnode *scp = NULL; MARK_ENTRY(CFS_GETATTR_STATS); -#if 0 - /* Check for operation on a dying object */ - if (IS_DYING(cp)) { - COMPLAIN_BITTERLY(getattr, cp->c_fid); - scp = cp; /* Save old cp */ - /* If no error, gives a valid vnode with which to work. */ - error = getNewVnode(&vp); - if (error) { - MARK_INT_FAIL(CFS_GETATTR_STATS); - return(error); /* Can't contact dead venus */ - } - cp = VTOC(vp); - } -#endif - -#ifdef __FreeBSD__ if (IS_UNMOUNTING(cp)) return ENODEV; -#endif + /* Check for getattr of control object. */ if (IS_CTL_VP(vp)) { MARK_INT_FAIL(CFS_GETATTR_STATS); @@ -913,7 +787,6 @@ cfs_getattr(v) *vap = cp->c_vattr; MARK_INT_SAT(CFS_GETATTR_STATS); - if (scp) vrele(vp); return(0); } @@ -929,17 +802,12 @@ cfs_getattr(v) CFSDEBUG(CFS_GETATTR, if (!(cfsdebug & ~CFS_GETATTR)) print_vattr(vap); ); -#ifdef __FreeBSD__ { int size = vap->va_size; struct vnode *convp = cp->c_ovp; if (convp != (struct vnode *)0) { vnode_pager_setsize(convp, size); -#ifdef __DEBUG_FreeBSD__ - printf("getattr: vnode_pager_setsize(%p, %d)\n", convp, size); -#endif } } -#endif /* If not open for write, store attributes in cnode */ if ((cp->c_owrite == 0) && (cfs_attr_cache)) { cp->c_vattr = *vap; @@ -947,7 +815,6 @@ cfs_getattr(v) } } - if (scp) vrele(vp); return(error); } @@ -981,17 +848,12 @@ cfs_setattr(v) if (!error) cp->c_flags &= ~C_VATTR; -#ifdef __FreeBSD__ { int size = vap->va_size; struct vnode *convp = cp->c_ovp; if (size != VNOVAL && convp != (struct vnode *)0) { vnode_pager_setsize(convp, size); -#ifdef __DEBUG_FreeBSD__ - printf("setattr: vnode_pager_setsize(%p, %d)\n", convp, size); -#endif } } -#endif CFSDEBUG(CFS_SETATTR, myprintf(("setattr %d\n", error)); ) return(error); } @@ -1059,7 +921,7 @@ cfs_abortop(v) /* locals */ if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF) - NAMEI_FREE(ap->a_cnp->cn_pnbuf); + zfree(namei_zone, ap->a_cnp->cn_pnbuf); return (0); } @@ -1149,7 +1011,6 @@ cfs_fsync(v) if (convp) VOP_FSYNC(convp, cred, MNT_WAIT, p); -#ifdef __FreeBSD__ /* * We see fsyncs with usecount == 1 then usecount == 0. * For now we ignore them. @@ -1160,7 +1021,6 @@ cfs_fsync(v) vp, vp->v_usecount, cp->c_flags, cp->c_flags&C_PURGING); } */ -#endif /* * We can expect fsync on any vnode at all if venus is pruging it. @@ -1173,10 +1033,8 @@ cfs_fsync(v) return(0); } -#ifdef __FreeBSD__ /* needs research */ return 0; -#endif error = venus_fsync(vtomi(vp), &cp->c_fid, cred, p); CFSDEBUG(CFS_FSYNC, myprintf(("in fsync result %d\n",error)); ); @@ -1210,11 +1068,6 @@ cfs_inactive(v) cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vp->v_mount));) -#ifdef __DEBUG_FreeBSD__ - if (vp->v_flag & VXLOCK) - printf ("Inactive: Vnode is Locked\n"); -#endif - /* If an array has been allocated to hold the symlink, deallocate it */ if ((cfs_symlink_cache) && (VALID_SYMLINK(cp))) { if (cp->c_symlink == NULL) @@ -1239,9 +1092,7 @@ cfs_inactive(v) printf("cfs_inactive: cp->ovp != NULL use %d: vp %p, cp %p\n", vp->v_usecount, vp, cp); #endif -#ifdef NEW_LOCKMGR - NEW_LOCKMGR(&cp->c_lock, LK_RELEASE, &vp->v_interlock); -#endif + lockmgr(&cp->c_lock, LK_RELEASE, &vp->v_interlock, p); } else { #ifdef DIAGNOSTIC if (CTOV(cp)->v_usecount) { @@ -1251,9 +1102,7 @@ cfs_inactive(v) panic("cfs_inactive: cp->ovp != NULL"); } #endif -#ifdef NEW_LOCKMGR - VOP_X_UNLOCK(vp, 0); -#endif + VOP_UNLOCK(vp, 0, p); vgone(vp); } @@ -1288,7 +1137,6 @@ cfs_lookup(v) struct proc *p = cnp->cn_proc; /* locals */ struct cnode *cp; - struct cnode *scp = NULL; const char *nm = cnp->cn_nameptr; int len = cnp->cn_namelen; ViceFid VFid; @@ -1301,27 +1149,11 @@ cfs_lookup(v) nm, dcp->c_fid.Volume, dcp->c_fid.Vnode, dcp->c_fid.Unique));); -#if 0 - /* Check for operation on a dying object */ - if (IS_DYING(dcp)) { - COMPLAIN_BITTERLY(lookup, dcp->c_fid); - scp = dcp; /* Save old dcp */ - /* If no error, gives a valid vnode with which to work. */ - error = getNewVnode(&dvp); - if (error) { - MARK_INT_FAIL(CFS_LOOKUP_STATS); - return(error); /* Can't contact dead venus */ - } - dcp = VTOC(dvp); - } -#endif - /* Check for lookup of control object. */ if (IS_CTL_NAME(dvp, nm, len)) { *vpp = cfs_ctlvp; vref(*vpp); MARK_INT_SAT(CFS_LOOKUP_STATS); - if (scp) vrele(dvp); goto exit; } @@ -1364,13 +1196,12 @@ cfs_lookup(v) /* enter the new vnode in the Name Cache only if the top bit isn't set */ /* And don't enter a new vnode for an invalid one! */ - if (!(vtype & CFS_NOCACHE) && scp == 0) + if (!(vtype & CFS_NOCACHE)) cfsnc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp)); } } exit: - if (scp) vrele(dvp); /* * If we are creating, and this was the last name to be looked up, * and the error was ENOENT, then there really shouldn't be an @@ -1417,7 +1248,7 @@ cfs_lookup(v) */ if (!error || (error == EJUSTRETURN)) { if (!(cnp->cn_flags & LOCKPARENT) || !(cnp->cn_flags & ISLASTCN)) { - if ((error = VOP_X_UNLOCK(dvp, 0))) { + if ((error = VOP_UNLOCK(dvp, 0, p))) { return error; } /* @@ -1425,7 +1256,7 @@ cfs_lookup(v) * lock it without bothering to check anything else. */ if (*ap->a_vpp) { - if ((error = VOP_X_LOCK(*ap->a_vpp, LK_EXCLUSIVE))) { + if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, p))) { printf("cfs_lookup: "); panic("unlocked parent but couldn't lock child"); } @@ -1434,7 +1265,7 @@ cfs_lookup(v) /* The parent is locked, and may be the same as the child */ if (*ap->a_vpp && (*ap->a_vpp != dvp)) { /* Different, go ahead and lock it. */ - if ((error = VOP_X_LOCK(*ap->a_vpp, LK_EXCLUSIVE))) { + if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, p))) { printf("cfs_lookup: "); panic("unlocked parent but couldn't lock child"); } @@ -1521,25 +1352,9 @@ cfs_create(v) CFSDEBUG(CFS_CREATE, myprintf(("create error %d\n", error));) } - /* Locking strategy. */ - /* - * In NetBSD, all creates must explicitly vput their dvp's. We'll - * go ahead and use the LOCKLEAF flag of the cnp argument. - * However, I'm pretty sure that create must return the leaf - * locked; so there is a DIAGNOSTIC check to ensure that this is - * true. - */ -#ifdef __FreeBSD_version - /* - * Well, FreeBSD -current does the vput put in - * kern/vfs_vnops.c.c:vn_open() - */ -#else - vput(dvp); -#endif if (!error) { if (cnp->cn_flags & LOCKLEAF) { - if ((error = VOP_X_LOCK(*ap->a_vpp, LK_EXCLUSIVE))) { + if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, p))) { printf("cfs_create: "); panic("unlocked parent but couldn't lock child"); } @@ -1556,7 +1371,7 @@ cfs_create(v) * why it's here, but what the hey... */ if ((cnp->cn_flags & SAVESTART) == 0) { - NAMEI_FREE(cnp->cn_pnbuf); + zfree(namei_zone, cnp->cn_pnbuf); } return(error); } @@ -1618,27 +1433,8 @@ cfs_remove(v) CFSDEBUG(CFS_REMOVE, myprintf(("in remove result %d\n",error)); ) -#ifdef __FreeBSD_version - /* - * Well, FreeBSD -current does the vrele/vput put in - * kern/vfs_syscalls.c:unlink() - */ -#else - /* - * Regardless of what happens, we have to unconditionally drop - * locks/refs on parent and child. (I hope). This is based on - * what ufs_remove seems to be doing. - */ - if (dvp == ap->a_vp) { - vrele(ap->a_vp); - } else { - vput(ap->a_vp); - } - vput(dvp); -#endif - if ((cnp->cn_flags & SAVESTART) == 0) { - NAMEI_FREE(cnp->cn_pnbuf); + zfree(namei_zone, cnp->cn_pnbuf); } return(error); } @@ -1651,11 +1447,7 @@ cfs_link(v) struct vop_link_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); -#ifdef __NetBSD__ - struct vnode *tdvp = ap->a_dvp; -#elif defined(__FreeBSD__) struct vnode *tdvp = ap->a_tdvp; -#endif struct cnode *tdcp = VTOC(tdvp); struct componentname *cnp = ap->a_cnp; struct ucred *cred = cnp->cn_cred; @@ -1689,28 +1481,6 @@ cfs_link(v) return(EACCES); } - /* - * According to the ufs_link operation here's the locking situation: - * We enter with the thing called "dvp" (the directory) locked. - * We must unconditionally drop locks on "dvp" - * - * We enter with the thing called "vp" (the linked-to) unlocked, - * but ref'd (?) - * We seem to need to lock it before calling cfs_link, and - * unconditionally unlock it after. - */ - -#ifdef __FreeBSD_version - /* - * Well, FreeBSD -current does the vrele/vput put in - * kern/vfs_syscalls.c:link() - */ -#else - if ((ap->a_vp != tdvp) && (error = VOP_X_LOCK(ap->a_vp, LK_EXCLUSIVE))) { - goto exit; - } -#endif - error = venus_link(vtomi(vp), &cp->c_fid, &tdcp->c_fid, nm, len, cred, p); /* Invalidate the parent's attr cache, the modification time has changed */ @@ -1721,21 +1491,9 @@ cfs_link(v) exit: -#ifdef __FreeBSD_version - /* - * Well, FreeBSD -current does the vrele/vput put in - * kern/vfs_syscalls.c:link() - */ -#else - if (ap->a_vp != tdvp) { - VOP_X_UNLOCK(ap->a_vp, 0); - } - vput(tdvp); -#endif - /* Drop the name buffer if we don't need to SAVESTART */ if ((cnp->cn_flags & SAVESTART) == 0) { - NAMEI_FREE(cnp->cn_pnbuf); + zfree(namei_zone, cnp->cn_pnbuf); } return(error); } @@ -1903,26 +1661,6 @@ cfs_mkdir(v) CFSDEBUG(CFS_MKDIR, myprintf(("mkdir error %d\n",error));) } - /* - * Currently, all mkdirs explicitly vput their dvp's. - * It also appears that we *must* lock the vpp, since - * lockleaf isn't set, but someone down the road is going - * to try to unlock the new directory. - */ -#ifdef __FreeBSD_version - /* - * Well, FreeBSD -current does the vrele/vput put in - * kern/vfs_syscalls.c:mkdir() - */ -#else - vput(dvp); - if (!error) { - if ((error = VOP_X_LOCK(*ap->a_vpp, LK_EXCLUSIVE))) { - panic("cfs_mkdir: couldn't lock child"); - } - } -#endif - /* Have to free the previously saved name */ /* * ufs_mkdir doesn't check for SAVESTART before freeing the @@ -1930,7 +1668,7 @@ cfs_mkdir(v) * follow their lead, but this seems like it is probably * incorrect. */ - NAMEI_FREE(cnp->cn_pnbuf); + zfree(namei_zone, cnp->cn_pnbuf); return(error); } @@ -1980,26 +1718,8 @@ cfs_rmdir(v) CFSDEBUG(CFS_RMDIR, myprintf(("in rmdir result %d\n", error)); ) -#ifdef __FreeBSD_version - /* - * Well, FreeBSD -current does the vrele/vput put in - * kern/vfs_syscalls.c:rmdir() - */ -#else - /* - * regardless of what happens, we need to drop locks/refs on the - * parent and child. I think. - */ - if (dvp == ap->a_vp) { - vrele(ap->a_vp); - } else { - vput(ap->a_vp); - } - vput(dvp); -#endif - if ((cnp->cn_flags & SAVESTART) == 0) { - NAMEI_FREE(cnp->cn_pnbuf); + zfree(namei_zone, cnp->cn_pnbuf); } return(error); } @@ -2025,10 +1745,7 @@ cfs_symlink(v) * t(foo) is the new name/parent/etc being created. * lname is the contents of the new symlink. */ -#ifdef NetBSD1_3 - const -#endif - char *nm = cnp->cn_nameptr; + char *nm = cnp->cn_nameptr; int len = cnp->cn_namelen; int plen = strlen(path); @@ -2067,45 +1784,11 @@ cfs_symlink(v) /* Invalidate the parent's attr cache, the modification time has changed */ tdcp->c_flags &= ~C_VATTR; -#ifdef __FreeBSD_version - -#else - if (!error) - { - struct nameidata nd; - NDINIT(&nd, LOOKUP, FOLLOW|LOCKLEAF, UIO_SYSSPACE, nm, p); - nd.ni_cnd.cn_cred = cred; - nd.ni_loopcnt = 0; - nd.ni_startdir = tdvp; - nd.ni_cnd.cn_pnbuf = (char *)nm; - nd.ni_cnd.cn_nameptr = nd.ni_cnd.cn_pnbuf; - nd.ni_pathlen = len; - vput(tdvp); - error = lookup(&nd); - *ap->a_vpp = nd.ni_vp; - } - - /* - * Okay, now we have to drop locks on dvp. vpp is unlocked, but - * ref'd. It doesn't matter what happens in either symlink or - * lookup. Furthermore, there isn't any way for (dvp == *vpp), so - * we don't bother checking. - */ -/* vput(ap->a_dvp); released earlier */ - if (*ap->a_vpp) { - VOP_X_UNLOCK(*ap->a_vpp, 0); /* this line is new!! It is necessary because lookup() calls - VOP_LOOKUP (cfs_lookup) which returns vpp locked. cfs_nb_lookup - merged with cfs_lookup() to become cfs_lookup so UNLOCK is - necessary */ - vrele(*ap->a_vpp); - } -#endif - /* * Free the name buffer */ if ((cnp->cn_flags & SAVESTART) == 0) { - NAMEI_FREE(cnp->cn_pnbuf); + zfree(namei_zone, cnp->cn_pnbuf); } exit: @@ -2127,22 +1810,8 @@ cfs_readdir(v) register struct uio *uiop = ap->a_uio; struct ucred *cred = ap->a_cred; int *eofflag = ap->a_eofflag; -#if defined(__NetBSD__) && defined(NetBSD1_3) && (NetBSD1_3 >= 7) - off_t **cookies = ap->a_cookies; - int *ncookies = ap->a_ncookies; -#elif defined(NetBSD1_3) - off_t *cookies = ap->a_cookies; - int ncookies = ap->a_ncookies; -#elif NetBSD1_2 - u_long *cookies = ap->a_cookies; - int ncookies = ap->a_ncookies; -#elif defined(__FreeBSD__) && defined(__FreeBSD_version) u_long **cookies = ap->a_cookies; int *ncookies = ap->a_ncookies; -#elif defined(__FreeBSD__) - u_int **cookies = ap->a_cookies; - int *ncookies = ap->a_ncookies; -#endif struct proc *p = ap->a_uio->uio_procp; /* upcall decl */ /* locals */ @@ -2158,9 +1827,7 @@ cfs_readdir(v) return(ENOENT); } - if (cfs_intercept_rdwr) { - /* Redirect the request to UFS. */ - + { /* If directory is not already open do an "internal open" on it. */ int opened_internally = 0; if (cp->c_ovp == NULL) { @@ -2168,7 +1835,6 @@ cfs_readdir(v) MARK_INT_GEN(CFS_OPEN_STATS); error = VOP_OPEN(vp, FREAD, cred, p); printf("cfs_readdir: Internally Opening %p\n", vp); -#ifdef __FreeBSD__ if (error) { printf("cfs_readdir: VOP_OPEN on container failed %d\n", error); return (error); @@ -2180,19 +1846,13 @@ printf("cfs_readdir: Internally Opening %p\n", vp); vput(vp); } } -#endif if (error) return(error); } /* Have UFS handle the call. */ CFSDEBUG(CFS_READDIR, myprintf(("indirect readdir: fid = (%lx.%lx.%lx), refcnt = %d\n",cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vp->v_usecount)); ) -#ifdef __NetBSD__ - error = VOP_READDIR(cp->c_ovp, uiop, cred, eofflag, cookies, - ncookies); -#elif defined(__FreeBSD__) error = VOP_READDIR(cp->c_ovp, uiop, cred, eofflag, ncookies, cookies); -#endif if (error) MARK_INT_FAIL(CFS_READDIR_STATS); @@ -2205,39 +1865,6 @@ printf("cfs_readdir: Internally Opening %p\n", vp); (void)VOP_CLOSE(vp, FREAD, cred, p); } } - else { - /* Read the block from Venus. */ - struct iovec *iovp = uiop->uio_iov; - unsigned count = iovp->iov_len; - int size; - - - /* Make the count a multiple of DIRBLKSIZ (borrowed from ufs_readdir). */ -#define DIRBLKSIZ DEV_BSIZE - if ((uiop->uio_iovcnt != 1) || (count < DIRBLKSIZ) || - (uiop->uio_offset & (DIRBLKSIZ - 1))) - return (EINVAL); - count &= ~(DIRBLKSIZ - 1); - uiop->uio_resid -= iovp->iov_len - count; - iovp->iov_len = count; - if (count > VC_MAXDATASIZE) - return(EINVAL); - - - error = venus_readdir(vtomi(CTOV(cp)), &cp->c_fid, count, uiop->uio_offset, cred, p, iovp->iov_base, &size); - - CFSDEBUG(CFS_READDIR, - myprintf(("cfs_readdir(%p, %d, %qd, %d) returns (%d, %d)\n", - iovp->iov_base, count, - uiop->uio_offset, uiop->uio_segflg, error, - size)); ) - if (!error) { - iovp->iov_base += size; - iovp->iov_len -= size; - uiop->uio_resid -= size; - uiop->uio_offset += size; - } - } return(error); } @@ -2260,8 +1887,6 @@ cfs_bmap(v) /* upcall decl */ /* locals */ -#ifdef __FreeBSD__ -#ifdef __FreeBSD_version int ret = 0; struct cnode *cp; @@ -2276,15 +1901,6 @@ cfs_bmap(v) printf("cfs_bmap: no container\n"); return(EOPNOTSUPP); } -#else - /* Just like nfs_bmap(). Do not touch *vpp, this cause pfault. */ - return(EOPNOTSUPP); -#endif -#else /* !FreeBSD */ - *vpp = (struct vnode *)0; - myprintf(("cfs_bmap called!\n")); - return(EINVAL); -#endif } /* @@ -2305,18 +1921,8 @@ cfs_strategy(v) /* upcall decl */ /* locals */ -#ifdef __FreeBSD__ -#ifdef __FreeBSD_version printf("cfs_strategy: called ???\n"); return(EOPNOTSUPP); -#else /* ! __MAYBE_FreeBSD__ */ - myprintf(("cfs_strategy called! ")); - return(EOPNOTSUPP); -#endif /* __MAYBE_FreeBSD__ */ -#else /* ! __FreeBSD__ */ - myprintf(("cfs_strategy called! ")); - return(EINVAL); -#endif /* __FreeBSD__ */ } int @@ -2357,7 +1963,6 @@ cfs_reclaim(v) return (0); } -#ifdef NEW_LOCKMGR int cfs_lock(v) void *v; @@ -2366,9 +1971,7 @@ cfs_lock(v) struct vop_lock_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); -#ifdef __FreeBSD_version struct proc *p = ap->a_p; -#endif /* upcall decl */ /* locals */ @@ -2379,7 +1982,7 @@ cfs_lock(v) cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); } - return (NEW_LOCKMGR(&cp->c_lock, ap->a_flags, &vp->v_interlock)); + return (lockmgr(&cp->c_lock, ap->a_flags, &vp->v_interlock, p)); } int @@ -2390,9 +1993,7 @@ cfs_unlock(v) struct vop_unlock_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); -#ifdef __FreeBSD_version struct proc *p = ap->a_p; -#endif /* upcall decl */ /* locals */ @@ -2402,7 +2003,7 @@ cfs_unlock(v) cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); } - return (NEW_LOCKMGR(&cp->c_lock, ap->a_flags | LK_RELEASE, &vp->v_interlock)); + return (lockmgr(&cp->c_lock, ap->a_flags | LK_RELEASE, &vp->v_interlock, p)); } int @@ -2416,99 +2017,6 @@ cfs_islocked(v) return (lockstatus(&cp->c_lock)); } -#else -int -cfs_lock(v) - void *v; -{ -/* true args */ - struct vop_lock_args *ap = v; - struct vnode *vp = ap->a_vp; - struct cnode *cp; - struct proc *p __attribute__((unused)) = curproc; /* XXX */ -/* upcall decl */ -/* locals */ - - ENTRY; - cp = VTOC(vp); - - if (cfs_lockdebug) { - myprintf(("Attempting lock on %lx.%lx.%lx\n", - cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); - } -start: - while (vp->v_flag & VXLOCK) { - vp->v_flag |= VXWANT; -#ifdef __NetBSD__ - (void) sleep((caddr_t)vp, PINOD); -#elif defined(__FreeBSD__) - (void) tsleep((caddr_t)vp, PINOD, "cfs_lock1", 0); -#endif - } - if (vp->v_tag == VT_NON) - return (ENOENT); - - if (cp->c_flags & C_LOCKED) { - cp->c_flags |= C_WANTED; -#ifdef DIAGNOSTIC - myprintf(("cfs_lock: lock contention")); - cfsnc_name(cp); - myprintf(("\n")); -#endif -#ifdef __NetBSD__ - (void) sleep((caddr_t)cp, PINOD); -#elif defined(__FreeBSD__) - (void) tsleep((caddr_t)cp, PINOD, "cfs_lock2", 0); -#endif -#ifdef DIAGNOSTIC - myprintf(("cfs_lock: contention resolved\n")); -#endif - goto start; - } - cp->c_flags |= C_LOCKED; - return (0); -} - -int -cfs_unlock(v) - void *v; -{ -/* true args */ - struct vop_unlock_args *ap = v; - struct cnode *cp = VTOC(ap->a_vp); -/* upcall decl */ -/* locals */ - - ENTRY; - if (cfs_lockdebug) { - myprintf(("Attempting unlock on %lx.%lx.%lx\n", - cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); - } -#ifdef DIAGNOSTIC - if ((cp->c_flags & C_LOCKED) == 0) - panic("cfs_unlock: not locked"); -#endif - cp->c_flags &= ~C_LOCKED; - if (cp->c_flags & C_WANTED) { - cp->c_flags &= ~C_WANTED; - wakeup((caddr_t)cp); - } - return (0); -} - -int -cfs_islocked(v) - void *v; -{ -/* true args */ - struct vop_islocked_args *ap = v; - - ENTRY; - if (VTOC(ap->a_vp)->c_flags & C_LOCKED) - return (1); - return (0); -} -#endif /* How one looks up a vnode given a device/inode pair: */ int @@ -2607,10 +2115,6 @@ print_cred(cred) } -/* - ----------------------------------------------------------------------------------- - */ - /* * Return a vnode for the given fid. * If no cnode exists for this fid create one and put it @@ -2630,9 +2134,7 @@ makecfsnode(fid, vfsp, type) struct vnode *vp; cp = cfs_alloc(); -#ifdef NEW_LOCKMGR lockinit(&cp->c_lock, PINOD, "cnode", 0, 0); -#endif cp->c_fid = *fid; err = getnewvnode(VT_CFS, vfsp, cfs_vnodeop_p, &vp); @@ -2650,153 +2152,3 @@ makecfsnode(fid, vfsp, type) return cp; } - - - -#ifdef MACH -/* - * read a logical block and return it in a buffer */ -int -cfs_bread(vp, lbn, bpp) - struct vnode *vp; - daddr_t lbn; - struct buf **bpp; -{ - myprintf(("cfs_bread called!\n")); - return(EINVAL); -} - -/* - * release a block returned by cfs_bread - */ -int -cfs_brelse(vp, bp) - struct vnode *vp; - struct buf *bp; -{ - - myprintf(("cfs_brelse called!\n")); - return(EINVAL); -} - -int -cfs_badop() -{ - panic("cfs_badop"); -} - -int -cfs_noop() -{ - return (EINVAL); -} - -int -cfs_fid(vp, fidpp) - struct vnode *vp; - struct fid **fidpp; -{ - struct cfid *cfid; - - cfid = (struct cfid *)kalloc(sizeof(struct cfid)); - bzero((caddr_t)cfid, sizeof(struct cfid)); - cfid->cfid_len = sizeof(struct cfid) - (sizeof(struct fid) - MAXFIDSZ); - cfid->cfid_fid = VTOC(vp)->c_fid; - *fidpp = (struct fid *)cfid; - return (0); -} - -int -cfs_freefid(vp, fidp) - struct vnode *vp; - struct fid *fidp; -{ - kfree((struct cfid *)fidp, sizeof(struct cfid)); - return (0); -} - -/* - * Record-locking requests are passed to the local Lock-Manager daemon. - */ -int -cfs_lockctl(vp, ld, cmd, cred) - struct vnode *vp; - struct flock *ld; - int cmd; - struct ucred *cred; -{ - myprintf(("cfs_lockctl called!\n")); - return(EINVAL); -} - -cfs_page_read(vp, buffer, size, offset, cred) - struct vnode *vp; - caddr_t buffer; - int size; - vm_offset_t offset; - struct ucred *cred; -{ - struct cnode *cp = VTOC(vp); - struct uio uio; - struct iovec iov; - int error = 0; - - CFSDEBUG(CFS_RDWR, myprintf(("cfs_page_read(%p, %d, %d), fid = (%lx.%lx.%lx), refcnt = %d\n", buffer, size, offset, VTOC(vp)->c_fid.Volume, VTOC(vp)->c_fid.Vnode, VTOC(vp)->c_fid.Unique, vp->v_count)); ) - - iov.iov_base = buffer; - iov.iov_len = size; - uio.uio_iov = &iov; - uio.uio_iovcnt = 1; - uio.uio_offset = offset; - uio.uio_segflg = UIO_SYSSPACE; - uio.uio_resid = size; - error = cfs_rdwr(vp, &uio, UIO_READ, 0, cred); - if (error) { - myprintf(("error %d on pagein (cfs_rdwr)\n", error)); - error = EIO; - } - -/* - if (!error && (cp->states & CWired) == 0) - cfs_Wire(cp); -*/ - - return(error); -} - -cfs_page_write(vp, buffer, size, offset, cred, init) - struct vnode *vp; - caddr_t buffer; - int size; - vm_offset_t offset; - struct ucred *cred; - boolean_t init; -{ - struct cnode *cp = VTOC(vp); - struct uio uio; - struct iovec iov; - int error = 0; - - CFSDEBUG(CFS_RDWR, myprintf(("cfs_page_write(%p, %d, %d), fid = (%lx.%lx.%lx), refcnt = %d\n", buffer, size, offset, VTOC(vp)->c_fid.Volume, VTOC(vp)->c_fid.Vnode, VTOC(vp)->c_fid.Unique, vp->v_count)); ) - - if (init) { - panic("cfs_page_write: called from data_initialize"); - } - - iov.iov_base = buffer; - iov.iov_len = size; - uio.uio_iov = &iov; - uio.uio_iovcnt = 1; - uio.uio_offset = offset; - uio.uio_segflg = UIO_SYSSPACE; - uio.uio_resid = size; - error = cfs_rdwr(vp, &uio, UIO_WRITE, 0, cred); - if (error) { - myprintf(("error %d on pageout (cfs_rdwr)\n", error)); - error = EIO; - } - - return(error); -} - -#endif diff --git a/sys/coda/coda_vnops.h b/sys/coda/coda_vnops.h index 697cb9123f04..f965c93c26b6 100644 --- a/sys/coda/coda_vnops.h +++ b/sys/coda/coda_vnops.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_vnodeops.h,v 1.7 1998/08/28 18:12:24 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_vnodeops.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -46,6 +48,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cfs_vnodeops.h,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.7 1998/08/28 18:12:24 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -87,7 +92,6 @@ Mellon the rights to redistribute these changes without encumbrance. * */ - /* NetBSD interfaces to the vnodeops */ int cfs_open __P((void *)); int cfs_close __P((void *)); @@ -117,22 +121,15 @@ int cfs_reclaim __P((void *)); int cfs_lock __P((void *)); int cfs_unlock __P((void *)); int cfs_islocked __P((void *)); -int nbsd_vop_error __P((void *)); -int nbsd_vop_nop __P((void *)); -#ifdef __FreeBSD__ -int fbsd_vnotsup __P((void *ap)); -#ifdef __FreeBSD_version +int cfs_vop_error __P((void *)); +int cfs_vop_nop __P((void *)); int cfs_fbsd_getpages __P((void *)); int cfs_fbsd_putpages __P((void *)); -#endif -#endif int (**cfs_vnodeop_p)(void *); + int cfs_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw, int ioflag, struct ucred *cred, struct proc *p); - - - int cfs_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp); void print_vattr(struct vattr *attr); void print_cred(struct ucred *cred); diff --git a/sys/conf/files b/sys/conf/files index bcc07683ed0e..098bc30000a1 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -14,7 +14,6 @@ aic7xxx_{seq,reg}.h optional ahc device-driver \ clean "aic7xxx_seq.h aic7xxx_reg.h" \ dependency "$S/dev/aic7xxx/aic7xxx.{reg,seq} $S/scsi/scsi_message.h aicasm" cfs/cfs_namecache.c optional vcfs -cfs/cfs_nbsd.c optional vcfs cfs/cfs_fbsd.c optional vcfs cfs/cfs_psdev.c optional vcfs cfs/cfs_subr.c optional vcfs diff --git a/sys/fs/coda/README b/sys/fs/coda/README index 49ccad6ec50d..f9bf3c35cdc6 100644 --- a/sys/fs/coda/README +++ b/sys/fs/coda/README @@ -15,8 +15,8 @@ to experiment with. To get more information on Coda, I would like to refer people to http://www.coda.cs.cmu.edu -There is a wealth of documents, papers, theses there. There is also a -good introduction to the Coda File System in +There is a wealth of documents, papers, and theses there. There is +also a good introduction to the Coda File System in http://www.coda.cs.cmu.edu/ljpaper/lj.html Coda was originally developed as an academic prototype/testbed. It is @@ -45,11 +45,11 @@ The relevant sources, binaries, and docs can be found in ftp://ftp.coda.cs.cmu.edu/pub/coda/ We intend to come out with new Coda releases often, not daily. We -don't wish to slight any OS/platform not mentioned above. We are just +don't want to slight any OS/platform not mentioned above. We are just limited in our resources as to what we can support internally. We will be happy to integrate OpenBSD support as well as other OS -support. Also, adding platform support is relatively easy and we can -discuss this. The only problem is that Coda has a light weight +support. Also, adding platform support should be relatively easy and +we can discuss this. The only difficulty is that Coda has a light weight process package. It does some manipulations in assembler which would have to be redone for a different platform. diff --git a/sys/fs/coda/TODO b/sys/fs/coda/TODO index f19b4b675cba..eac514394b38 100644 --- a/sys/fs/coda/TODO +++ b/sys/fs/coda/TODO @@ -1,12 +1,17 @@ +OOPS: + FreeBSD does not fsync!!! + Near term: - Existing VOP_LOCKS's should proabably be - vn_lock since that is what they were in -stable. Fix bug in executing/mapping new files. + cfs_mount bug: interaction with cfs_inactive no cfs_unsave. + vref/vn_lock == vget except no VXWANT which may be on. + Review locks: vn_lock/VOP_UNLOCK/lockmgr ... Medium term: Add missing VFS methods. Do performance profile. Tune hash algorithm used in cfs_namecache. + Tune hash algorithm used in cfs_subr. Eventually: Use standard queue macros. diff --git a/sys/fs/coda/cnode.h b/sys/fs/coda/cnode.h index 901dc8a1240c..9f29ca9cc887 100644 --- a/sys/fs/coda/cnode.h +++ b/sys/fs/coda/cnode.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cnode.h,v 1.10 1998/08/28 18:12:25 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cnode.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -45,6 +47,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cnode.h,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.10 1998/08/28 18:12:25 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -144,45 +149,11 @@ Mellon the rights to redistribute these changes without encumbrance. #define _CNODE_H_ #include - -#ifdef __FreeBSD__ - -/* for the prototype of DELAY() */ +#include #include -#ifdef __FreeBSD_version -/* You would think that or something would include this */ -#include - MALLOC_DECLARE(M_CFS); -#else - -/* yuck yuck yuck */ -#define vref(x) cvref(x) -extern void cvref(struct vnode *vp); -/* yuck yuck yuck */ - -#endif -#endif - -#if defined(__NetBSD__) && defined(NetBSD1_3) && (NetBSD1_3 >= 7) -#define NEW_LOCKMGR(l, f, i) lockmgr(l, f, i) -#define VOP_X_LOCK(vn, fl) vn_lock(vn, fl) -#define VOP_X_UNLOCK(vn, fl) VOP_UNLOCK(vn, fl) - -#elif defined(__FreeBSD_version) -#define NEW_LOCKMGR(l, f, i) lockmgr(l, f, i, curproc) -#define VOP_X_LOCK(vn, fl) vn_lock(vn, fl, curproc) -#define VOP_X_UNLOCK(vn, fl) VOP_UNLOCK(vn, fl, curproc) - -/* NetBSD 1.3 & FreeBSD 2.2.x */ -#else -#undef NEW_LOCKMGR -#define VOP_X_LOCK(vn, fl) VOP_LOCK(vn) -#define VOP_X_UNLOCK(vn, fl) VOP_UNLOCK(vn) -#endif - /* * tmp below since we need struct queue */ @@ -232,9 +203,7 @@ struct cnode { struct vnode *c_vnode; u_short c_flags; /* flags (see below) */ ViceFid c_fid; /* file handle */ -#ifdef NEW_LOCKMGR struct lock c_lock; /* new lock protocol */ -#endif struct vnode *c_ovp; /* open vnode pointer */ u_short c_ocount; /* count of openers */ u_short c_owrite; /* count of open for write */ @@ -332,10 +301,6 @@ int cfs_vnodeopstats_init(void); /* cfs_vfsops.h */ struct mount *devtomp(dev_t dev); -#if !(defined NetBSD1_3) && !defined(__FreeBSD_version) -#define __RCSID(x) static char *rcsid = x -#endif - /* sigh */ #define CFS_RDWR ((u_long) 31) diff --git a/sys/fs/coda/coda.h b/sys/fs/coda/coda.h index 78de1fd1a6cc..09268b622abf 100644 --- a/sys/fs/coda/coda.h +++ b/sys/fs/coda/coda.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/coda.h,v 1.10 1998/08/28 18:12:26 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/coda.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * @@ -38,8 +40,6 @@ Mellon the rights to redistribute these changes without encumbrance. #ifndef _CFS_HEADER_ #define _CFS_HEADER_ - - /* Catch new _KERNEL defn for NetBSD */ #ifdef __NetBSD__ #include diff --git a/sys/fs/coda/coda_fbsd.c b/sys/fs/coda/coda_fbsd.c index 23d55cc29d54..f137ff55389d 100644 --- a/sys/fs/coda/coda_fbsd.c +++ b/sys/fs/coda/coda_fbsd.c @@ -1,53 +1,56 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_fbsd.c,v 1.6 1998/08/28 18:12:11 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_fbsd.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ #include #include #include #include +#include #include #include -#include +#include +#include + #include #include +#include +#include +#include + #ifdef DEVFS #include #endif -#include - -#include -#include -#include -#include /* From: "Jordan K. Hubbard" @@ -63,7 +66,6 @@ Mellon the rights to redistribute these changes without encumbrance. #define VC_DEV_NO 93 -#ifdef __FreeBSD_version /* Type of device methods. */ extern d_open_t vc_nb_open; extern d_close_t vc_nb_close; @@ -76,33 +78,8 @@ static struct cdevsw vccdevsw = { vc_nb_open, vc_nb_close, vc_nb_read, vc_nb_write, /*93*/ vc_nb_ioctl, nostop, nullreset, nodevtotty, - vc_nb_poll, nommap, NULL, "Coda", NULL, -1 }; -#else -/* Type of device methods. */ -#define D_OPEN_T d_open_t -#define D_CLOSE_T d_close_t -#define D_RDWR_T d_rdwr_t -#define D_READ_T d_read_t -#define D_WRITE_T d_write_t -#define D_IOCTL_T d_ioctl_t -#define D_SELECT_T d_select_t - -/* rvb why */ -D_OPEN_T vc_nb_open; /* was is defined in cfs_FreeBSD.h */ -D_CLOSE_T vc_nb_close; -D_READ_T vc_nb_read; -D_WRITE_T vc_nb_write; -D_IOCTL_T vc_nb_ioctl; -D_SELECT_T vc_nb_select; - -static struct cdevsw vccdevsw = -{ - vc_nb_open, vc_nb_close, vc_nb_read, vc_nb_write, - vc_nb_ioctl, nostop, nullreset, nodevtotty, - vc_nb_select, nommap, NULL, "Coda", NULL, -1 }; - -PSEUDO_SET(vcattach, vc); -#endif + vc_nb_poll, nommap, NULL, "Coda", NULL, -1 +}; void vcattach __P((void)); static dev_t vccdev; @@ -125,21 +102,9 @@ vcattach(void) VCDEBUG("cfs: vccdevsw entry installed at %d.\n", major(vccdev)); } -void -cvref(vp) - struct vnode *vp; -{ - if (vp->v_usecount <= 0) - panic("vref used where vget required"); - - vp->v_usecount++; -} - - -#ifdef __FreeBSD_version static vc_devsw_installed = 0; - static void vc_drvinit __P((void *unused)); + static void vc_drvinit(void *unused) { @@ -238,4 +203,3 @@ cfs_fbsd_putpages(v) SYSINIT(vccdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+VC_DEV_NO,vc_drvinit,NULL) -#endif diff --git a/sys/fs/coda/coda_io.h b/sys/fs/coda/coda_io.h index e515594f94e8..87a0ec370a9c 100644 --- a/sys/fs/coda/coda_io.h +++ b/sys/fs/coda/coda_io.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfsio.h,v 1.5 1998/08/18 17:05:23 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfsio.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -45,6 +47,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cfsio.h,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.5 1998/08/18 17:05:23 rvb * Don't use __RCSID now * @@ -106,20 +111,11 @@ Mellon the rights to redistribute these changes without encumbrance. /* Define ioctl commands for vcioctl, /dev/cfs */ -#ifdef __STDC__ #define CFSRESIZE _IOW('c', 1, struct cfs_resize ) /* Resize CFS NameCache */ #define CFSSTATS _IO('c', 2) /* Collect stats */ #define CFSPRINT _IO('c', 3) /* Print Cache */ #define CFSTEST _IO('c', 4) /* Print Cache */ -#else /* sys/ioctl.h puts the quotes on */ -#define CFSRESIZE _IOW(c, 1, struct cfs_resize ) /* Resize CFS NameCache */ -#define CFSSTATS _IO(c, 2) /* Collect stats */ -#define CFSPRINT _IO(c, 3) /* Print Cache */ - -#define CFSTEST _IO(c, 4) /* Print Cache */ -#endif __STDC__ - struct cfs_resize { int hashsize, heapsize; }; -#endif !_CFSIO_H_ +#endif diff --git a/sys/fs/coda/coda_kernel.h b/sys/fs/coda/coda_kernel.h index 5bdcd41442ec..299d15d6641a 100644 --- a/sys/fs/coda/coda_kernel.h +++ b/sys/fs/coda/coda_kernel.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfsk.h,v 1.9 1998/08/18 17:05:23 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfsk.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* Macros to manipulate the queue */ #ifndef INIT_QUEUE @@ -61,4 +63,4 @@ do { \ (el).back->forw = (el).forw; \ } while (0) -#endif INIT_QUEUE +#endif diff --git a/sys/fs/coda/coda_namecache.c b/sys/fs/coda/coda_namecache.c index 6c80a2607c34..eb5e8bff82b8 100644 --- a/sys/fs/coda/coda_namecache.c +++ b/sys/fs/coda/coda_namecache.c @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_namecache.c,v 1.11 1998/08/28 18:12:16 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_namecache.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -45,6 +47,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cfs_namecache.c,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.11 1998/08/28 18:12:16 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -206,32 +211,25 @@ Mellon the rights to redistribute these changes without encumbrance. #include #include #include +#include #include +#ifndef insque +#include +#endif /* insque */ + +#include +#include + #include #include #include -#if defined(__NetBSD__) || defined(__FreeBSD__) -#ifndef insque -#include -#endif /* insque */ -#endif /* __NetBSD__ || defined(__FreeBSD__) */ - -#ifdef __FreeBSD__ -#include -#include -#ifdef __FreeBSD_version -#include -#endif -#endif - /* * Declaration of the name cache data structure. */ int cfsnc_use = 1; /* Indicate use of CFS Name Cache */ - int cfsnc_size = CFSNC_CACHESIZE; /* size of the cache */ int cfsnc_hashsize = CFSNC_HASHSIZE; /* size of the primary hash */ @@ -246,16 +244,12 @@ struct cfsnc_statistics cfsnc_stat; /* Keep various stats */ */ int cfsnc_debug = 0; - /* * Entry points for the CFS Name Cache */ -static struct cfscache * -cfsnc_find(struct cnode *dcp, const char *name, int namelen, +static struct cfscache *cfsnc_find(struct cnode *dcp, const char *name, int namelen, struct ucred *cred, int hash); -static void -cfsnc_remove(struct cfscache *cncp, enum dc_status dcstat); - +static void cfsnc_remove(struct cfscache *cncp, enum dc_status dcstat); /* * Initialize the cache, the LRU structure and the Hash structure(s) @@ -657,7 +651,7 @@ cfsnc_zapfile(dcp, name, namelen) while (cncp) { cfsnchash[hash].length--; /* Used for tuning */ -/* 1.3 */ + cfsnc_remove(cncp, NOT_DOWNCALL); cncp = cfsnc_find(dcp, name, namelen, 0, hash); } diff --git a/sys/fs/coda/coda_namecache.h b/sys/fs/coda/coda_namecache.h index 86ed38c256db..d3d89455f8eb 100644 --- a/sys/fs/coda/coda_namecache.h +++ b/sys/fs/coda/coda_namecache.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfsnc.h,v 1.8 1998/08/28 18:12:25 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfsnc.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -45,6 +47,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cfsnc.h,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.8 1998/08/28 18:12:25 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -270,4 +275,4 @@ struct cfsnc_statistics { #define CFSNC_PRINTCFSNC ((u_long) 12) #define CFSNC_PRINTSTATS ((u_long) 13) -#endif /* _CFSNC_HEADER_ */ +#endif diff --git a/sys/fs/coda/coda_opstats.h b/sys/fs/coda/coda_opstats.h index 37017f279f09..5f528ec386c4 100644 --- a/sys/fs/coda/coda_opstats.h +++ b/sys/fs/coda/coda_opstats.h @@ -1,34 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/coda_opstats.h,v 1.5 1998/08/18 17:05:25 rvb Exp $ */ - + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/coda_opstats.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * operation stats: what the minicache can intercept that @@ -102,12 +103,10 @@ Mellon the rights to redistribute these changes without encumbrance. #define CFS_READDIR_STATS 19 #define CFS_VNODEOPS_SIZE 20 - /* * I propose the following structres: */ - struct cfs_op_stats { int opcode; /* vfs opcode */ long entries; /* number of times call attempted */ @@ -118,7 +117,6 @@ struct cfs_op_stats { /* (do we need that?) */ }; - /* * With each call to the minicache, we'll bump the counters whenver * a call is satisfied internally (through the cache or through a diff --git a/sys/fs/coda/coda_pioctl.h b/sys/fs/coda/coda_pioctl.h index 3e8957062a18..c6fcc6fe947f 100644 --- a/sys/fs/coda/coda_pioctl.h +++ b/sys/fs/coda/coda_pioctl.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/pioctl.h,v 1.7 1998/08/28 18:12:26 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/pioctl.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -41,6 +43,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: pioctl.h,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.7 1998/08/28 18:12:26 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -108,11 +113,8 @@ Mellon the rights to redistribute these changes without encumbrance. are no input or output parameters */ -#ifdef __STDC__ #define _VICEIOCTL(id) ((unsigned int ) _IOW('V', id, struct ViceIoctl)) -#else -#define _VICEIOCTL(id) ((unsigned int ) _IOW(V, id, struct ViceIoctl)) -#endif + /* Use this macro to define up to 256 vice ioctl's. These ioctl's all potentially have in/out parameters--this depends upon the values in the ViceIoctl structure. This structure is itself passed @@ -121,4 +123,4 @@ Mellon the rights to redistribute these changes without encumbrance. #define _VALIDVICEIOCTL(com) (com >= _VICEIOCTL(0) && com <= _VICEIOCTL(255)) -#endif _SYS_PIOCTL_H_ +#endif diff --git a/sys/fs/coda/coda_psdev.c b/sys/fs/coda/coda_psdev.c index 47b4754f8dcd..3c7c7242bda1 100644 --- a/sys/fs/coda/coda_psdev.c +++ b/sys/fs/coda/coda_psdev.c @@ -1,35 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_psdev.c,v 1.9 1998/08/28 18:12:17 rvb Exp $ */ - -#define CTL_C + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_psdev.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -43,20 +43,19 @@ Mellon the rights to redistribute these changes without encumbrance. * University. Contributers include David Steere, James Kistler, and * M. Satyanarayanan. */ -/* ************************************************** */ -/* These routines define the psuedo device for communication between +/* + * These routines define the psuedo device for communication between * Coda's Venus and Minicache in Mach 2.6. They used to be in cfs_subr.c, * but I moved them to make it easier to port the Minicache without * porting coda. -- DCS 10/12/94 */ -/* - * Renamed to cfs_psdev: pseudo-device driver. - */ - /* * HISTORY * $Log: cfs_psdev.c,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.9 1998/08/28 18:12:17 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -153,40 +152,28 @@ Mellon the rights to redistribute these changes without encumbrance. extern int cfsnc_initialized; /* Set if cache has been initialized */ #include + #include #include #include -#include #include +#include #include #include -#ifdef __FreeBSD_version #include -#else -#include -#endif -#ifdef NetBSD1_3 #include -#endif -#ifdef __FreeBSD_version -#include -#else -#include -#endif +#include #include #include #include #include +#define CTL_C + int cfs_psdev_print_entry = 0; -#ifdef __GNUC__ -#define ENTRY \ - if(cfs_psdev_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) -#else -#define ENTRY -#endif +#define ENTRY if(cfs_psdev_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) void vcfsattach(int n); int vc_nb_open(dev_t dev, int flag, int mode, struct proc *p); @@ -194,11 +181,7 @@ int vc_nb_close (dev_t dev, int flag, int mode, struct proc *p); int vc_nb_read(dev_t dev, struct uio *uiop, int flag); int vc_nb_write(dev_t dev, struct uio *uiop, int flag); int vc_nb_ioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p); -#if defined(NetBSD1_3) || defined(__FreeBSD_version) int vc_nb_poll(dev_t dev, int events, struct proc *p); -#else -int vc_nb_select(dev_t dev, int flag, struct proc *p); -#endif struct vmsg { struct queue vm_chain; @@ -222,9 +205,6 @@ vcfsattach(n) { } -/* - * These functions are written for NetBSD. - */ int vc_nb_open(dev, flag, mode, p) dev_t dev; @@ -289,14 +269,6 @@ vc_nb_close (dev, flag, mode, p) if (mi->mi_rootvp) { /* Let unmount know this is for real */ VTOC(mi->mi_rootvp)->c_flags |= C_UNMOUNTING; -#ifdef NEW_LOCKMGR -#ifdef __FreeBSD_version - /* dounmount is different ... probably wrong ... */ -#else - if (vfs_busy(mi->mi_vfsp, 0, 0)) - return (EBUSY); -#endif -#endif cfs_unmounting(mi->mi_vfsp); err = dounmount(mi->mi_vfsp, flag, p); if (err) @@ -523,7 +495,6 @@ vc_nb_ioctl(dev, cmd, addr, flag, p) } } -#if defined(NetBSD1_3) || defined(__FreeBSD_version) int vc_nb_poll(dev, events, p) dev_t dev; @@ -551,33 +522,6 @@ vc_nb_poll(dev, events, p) return(0); } -#else -int -vc_nb_select(dev, flag, p) - dev_t dev; - int flag; - struct proc *p; -{ - register struct vcomm *vcp; - - ENTRY; - - if (minor(dev) >= NVCFS || minor(dev) < 0) - return(ENXIO); - - vcp = &cfs_mnttbl[minor(dev)].mi_vcomm; - - if (flag != FREAD) - return(0); - - if (!EMPTY(vcp->vc_requests)) - return(1); - - selrecord(p, &(vcp->vc_selproc)); - - return(0); -} -#endif /* * Statistics @@ -593,7 +537,6 @@ struct cfs_clstat cfs_clstat; * (e.g. kill -9). */ -/* If you want this to be interruptible, set this to > PZERO */ int cfscall_sleep = PZERO - 1; #ifdef CTL_C int cfs_pcatch = PCATCH; diff --git a/sys/fs/coda/coda_subr.c b/sys/fs/coda/coda_subr.c index 3d20e578788c..a2fd7922e1de 100644 --- a/sys/fs/coda/coda_subr.c +++ b/sys/fs/coda/coda_subr.c @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_subr.c,v 1.11 1998/08/28 18:12:18 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_subr.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -44,6 +46,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cfs_subr.c,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.11 1998/08/28 18:12:18 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -202,8 +207,8 @@ Mellon the rights to redistribute these changes without encumbrance. #include #include -#include #include +#include #include #include @@ -212,8 +217,6 @@ Mellon the rights to redistribute these changes without encumbrance. #include #include -#if NVCFS - int cfs_active = 0; int cfs_reuse = 0; int cfs_new = 0; @@ -221,11 +224,8 @@ int cfs_new = 0; struct cnode *cfs_freelist = NULL; struct cnode *cfs_cache[CFS_CACHESIZE]; -#define cfshash(fid) \ - (((fid)->Volume + (fid)->Vnode) & (CFS_CACHESIZE-1)) - +#define cfshash(fid) (((fid)->Volume + (fid)->Vnode) & (CFS_CACHESIZE-1)) #define CNODE_NEXT(cp) ((cp)->c_next) - #define ODD(vnode) ((vnode) & 0x1) /* @@ -690,24 +690,13 @@ int cfs_vmflush(cp) struct cnode *cp; { -#if 0 - /* old code */ - /* Unset so that page_read doesn't try to use - (possibly) invalid cache file. */ - cp->c_device = 0; - cp->c_inode = 0; - - return(inode_uncache_try(VTOI(CTOV(cp))) ? 0 : ETXTBSY); -#else /* __NetBSD__ || __FreeBSD__ */ return 0; -#endif /* __NetBSD__ || __FreeBSD__ */ } /* * kernel-internal debugging switches */ - void cfs_debugon(void) { cfsdebug = -1; @@ -745,6 +734,3 @@ void cfs_debugoff(void) * 13) all <= 3 * ... */ - - -#endif /* NVCFS */ diff --git a/sys/fs/coda/coda_subr.h b/sys/fs/coda/coda_subr.h index cf983d420dc1..4beedc9436f9 100644 --- a/sys/fs/coda/coda_subr.h +++ b/sys/fs/coda/coda_subr.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_subr.h,v 1.4 1998/08/18 17:05:16 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_subr.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ struct cnode *cfs_alloc(void); void cfs_free(struct cnode *cp); @@ -41,5 +43,3 @@ void cfs_debugoff(void); int cfs_kill(struct mount *whoIam, enum dc_status dcstat); void cfs_save(struct cnode *cp); void cfs_unsave(struct cnode *cp); - - diff --git a/sys/fs/coda/coda_venus.c b/sys/fs/coda/coda_venus.c index 87679148cd11..7f7b30b9a17d 100644 --- a/sys/fs/coda/coda_venus.c +++ b/sys/fs/coda/coda_venus.c @@ -1,45 +1,42 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_venus.c,v 1.11 1998/08/28 18:12:20 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_venus.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ #include #include #include #include #include -#ifdef __FreeBSD_version #include -#else -#include -#endif -/* for CNV_OFLAGS below */ #include #include @@ -342,11 +339,11 @@ venus_access(void *mdp, ViceFid *fid, int mode, /* send the open to venus. */ INIT_IN(&inp->ih, CFS_ACCESS, cred, p); inp->VFid = *fid; -#ifdef NetBSD1_3 - inp->flags = mode; -#else + /* NOTE: + * NetBSD and Venus internals use the "data" in the low 3 bits. + * Hence, the conversion. + */ inp->flags = mode>>6; -#endif error = cfscall(mdp, Isize, &Osize, (char *)inp); @@ -437,11 +434,7 @@ venus_create(void *mdp, ViceFid *fid, INIT_IN(&inp->ih, CFS_CREATE, cred, p); inp->VFid = *fid; inp->excl = exclusive ? C_O_EXCL : 0; -#ifdef NetBSD1_3 - inp->mode = mode<<6; -#else inp->mode = mode; -#endif CNV_V2VV_ATTR(&inp->attr, va); inp->name = Isize; diff --git a/sys/fs/coda/coda_venus.h b/sys/fs/coda/coda_venus.h index 19c95e77ecc6..ee0fb4f6cd4e 100644 --- a/sys/fs/coda/coda_venus.h +++ b/sys/fs/coda/coda_venus.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_venus.h,v 1.4 1998/08/18 17:05:18 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_venus.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ int venus_root(void *mdp, diff --git a/sys/fs/coda/coda_vfsops.c b/sys/fs/coda/coda_vfsops.c index d44533a127bb..64861680b1c6 100644 --- a/sys/fs/coda/coda_vfsops.c +++ b/sys/fs/coda/coda_vfsops.c @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_vfsops.c,v 1.11 1998/08/28 18:12:22 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -45,6 +47,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cfs_vfsops.c,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.11 1998/08/28 18:12:22 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -173,11 +178,12 @@ Mellon the rights to redistribute these changes without encumbrance. #include #include +#include +#include #include #include #include #include -#include #include #include @@ -186,25 +192,14 @@ Mellon the rights to redistribute these changes without encumbrance. #include #include #include -/* for VN_RDEV */ + #include -#ifdef __FreeBSD__ -#ifdef __FreeBSD_version MALLOC_DEFINE(M_CFS, "CFS storage", "Various Coda Structures"); -#endif -#endif int cfsdebug = 0; - int cfs_vfsop_print_entry = 0; -#ifdef __GNUC__ -#define ENTRY \ - if(cfs_vfsop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) -#else -#define ENTRY -#endif - +#define ENTRY if(cfs_vfsop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) struct vnode *cfs_ctlvp; struct cfs_mntinfo cfs_mnttbl[NVCFS]; /* indexed by minor device number */ @@ -220,65 +215,7 @@ struct cfs_op_stats cfs_vfsopstats[CFS_VFSOPS_SIZE]; extern int cfsnc_initialized; /* Set if cache has been initialized */ extern int vc_nb_open __P((dev_t, int, int, struct proc *)); -#ifdef __NetBSD__ -extern struct cdevsw cdevsw[]; /* For sanity check in cfs_mount */ -#endif -/* NetBSD interface to statfs */ -#if defined(__NetBSD__) && defined(NetBSD1_3) && (NetBSD1_3 >= 5) -extern struct vnodeopv_desc cfs_vnodeop_opv_desc; - -struct vnodeopv_desc *cfs_vnodeopv_descs[] = { - &cfs_vnodeop_opv_desc, - NULL, -}; - -struct vfsops cfs_vfsops = { - MOUNT_CFS, - cfs_mount, - cfs_start, - cfs_unmount, - cfs_root, - cfs_quotactl, - cfs_nb_statfs, - cfs_sync, - cfs_vget, - (int (*) (struct mount *, struct fid *, struct mbuf *, struct vnode **, - int *, struct ucred **)) - eopnotsupp, - (int (*) (struct vnode *, struct fid *)) eopnotsupp, - cfs_init, -#if (NetBSD1_3 >= 7) - cfs_sysctl, -#endif - (int (*)(void)) eopnotsupp, - cfs_vnodeopv_descs, - 0 -}; -#elif defined(__NetBSD__) -struct vfsops cfs_vfsops = { - MOUNT_CFS, - cfs_mount, - cfs_start, - cfs_unmount, - cfs_root, - cfs_quotactl, - cfs_nb_statfs, - cfs_sync, - cfs_vget, - (int (*) (struct mount *, struct fid *, struct mbuf *, struct vnode **, - int *, struct ucred **)) - eopnotsupp, - (int (*) (struct vnode *, struct fid *)) eopnotsupp, - cfs_init, -#ifdef NetBSD1_3 - (int (*)(void)) eopnotsupp, -#endif - 0 -}; - -#elif defined(__FreeBSD__) -#ifdef __FreeBSD_version struct vfsops cfs_vfsops = { cfs_mount, cfs_start, @@ -295,29 +232,7 @@ struct vfsops cfs_vfsops = { cfs_init, }; -#else -struct vfsops cfs_vfsops = { - cfs_mount, - cfs_start, - cfs_unmount, - cfs_root, - cfs_quotactl, - cfs_nb_statfs, - cfs_sync, - cfs_vget, - (int (*) (struct mount *, struct fid *, struct mbuf *, struct vnode **, - int *, struct ucred **)) - eopnotsupp, - (int (*) (struct vnode *, struct fid *)) eopnotsupp, - cfs_init, -}; - -#endif - - -#include VFS_SET(cfs_vfsops, cfs, MOUNT_CFS, VFCF_NETWORK); -#endif int cfs_vfsopstats_init(void) @@ -335,7 +250,6 @@ cfs_vfsopstats_init(void) return 0; } - /* * cfs mount vfsop * Set up mount info record and attach it to vfs struct. @@ -344,13 +258,8 @@ cfs_vfsopstats_init(void) int cfs_mount(vfsp, path, data, ndp, p) struct mount *vfsp; /* Allocated and initialized by mount(2) */ -#ifdef NetBSD1_3 - const char *path; /* path covered: ignored by the fs-layer */ - void *data; /* Need to define a data type for this in netbsd? */ -#else char *path; /* path covered: ignored by the fs-layer */ caddr_t data; /* Need to define a data type for this in netbsd? */ -#endif struct nameidata *ndp; /* Clobber this to lookup the device name */ struct proc *p; /* The ever-famous proc pointer */ { @@ -399,11 +308,7 @@ cfs_mount(vfsp, path, data, ndp, p) /* * See if the device table matches our expectations. */ -#ifdef __NetBSD__ - if (cdevsw[major(dev)].d_open != vc_nb_open) -#elif defined(__FreeBSD__) if (cdevsw[major(dev)]->d_open != vc_nb_open) -#endif { MARK_INT_FAIL(CFS_MOUNT_STATS); return(ENXIO); @@ -426,19 +331,8 @@ cfs_mount(vfsp, path, data, ndp, p) /* No initialization (here) of mi_vcomm! */ vfsp->mnt_data = (qaddr_t)mi; -#ifdef __NetBSD__ - vfsp->mnt_stat.f_fsid.val[0] = 0; - vfsp->mnt_stat.f_fsid.val[1] = makefstype(MOUNT_CFS); -#elif defined(__FreeBSD__) && defined(__FreeBSD_version) - vfs_getnewfsid (vfsp); -#elif defined(__FreeBSD__) - /* Seems a bit overkill, since usualy /coda is the only mount point - * for cfs. - */ - getnewfsid (vfsp, MOUNT_CFS); -#endif mi->mi_vfsp = vfsp; /* @@ -471,13 +365,12 @@ cfs_mount(vfsp, path, data, ndp, p) /* set filesystem block size */ vfsp->mnt_stat.f_bsize = 8192; /* XXX -JJK */ -#ifdef __FreeBSD__ + /* Set f_iosize. XXX -- inamura@isl.ntt.co.jp. For vnode_pager_haspage() references. The value should be obtained from underlying UFS. */ /* Checked UFS. iosize is set as 8192 */ vfsp->mnt_stat.f_iosize = 8192; -#endif /* error is currently guaranteed to be zero, but in case some code changes... */ @@ -526,27 +419,10 @@ cfs_unmount(vfsp, mntflags, p) #endif vrele(mi->mi_rootvp); -#ifdef NetBSD1_3 - active = cfs_kill(vfsp, NOT_DOWNCALL); - -#if defined(__NetBSD__) && defined(NetBSD1_3) && (NetBSD1_3 >= 7) - if (1) -#else - if ((error = vfs_busy(mi->mi_vfsp)) == 0) -#endif - { - error = vflush(mi->mi_vfsp, NULLVP, FORCECLOSE); - printf("cfs_unmount: active = %d, vflush active %d\n", active, error); - error = 0; - } else { - printf("cfs_unmount: busy\n"); - } -#else /* FreeBSD I guess */ active = cfs_kill(vfsp, NOT_DOWNCALL); error = vflush(mi->mi_vfsp, NULLVP, FORCECLOSE); printf("cfs_unmount: active = %d, vflush active %d\n", active, error); error = 0; -#endif /* I'm going to take this out to allow lookups to go through. I'm * not sure it's important anyway. -- DCS 2/2/94 */ @@ -591,8 +467,12 @@ cfs_root(vfsp, vpp) { /* Found valid root. */ *vpp = mi->mi_rootvp; /* On Mach, this is vref. On NetBSD, VOP_LOCK */ +#if 1 vref(*vpp); - VOP_X_LOCK(*vpp, LK_EXCLUSIVE); + vn_lock(*vpp, LK_EXCLUSIVE, p); +#else + vget(*vpp, LK_EXCLUSIVE, p); +#endif MARK_INT_SAT(CFS_ROOT_STATS); return(0); } @@ -610,8 +490,13 @@ cfs_root(vfsp, vpp) cfs_save(VTOC(mi->mi_rootvp)); *vpp = mi->mi_rootvp; +#if 1 vref(*vpp); - VOP_X_LOCK(*vpp, LK_EXCLUSIVE); + vn_lock(*vpp, LK_EXCLUSIVE, p); +#else + vget(*vpp, LK_EXCLUSIVE, p); +#endif + MARK_INT_SAT(CFS_ROOT_STATS); goto exit; } else if (error == ENODEV) { @@ -625,8 +510,13 @@ cfs_root(vfsp, vpp) * will fail. */ *vpp = mi->mi_rootvp; +#if 1 vref(*vpp); - VOP_X_LOCK(*vpp, LK_EXCLUSIVE); + vn_lock(*vpp, LK_EXCLUSIVE, p); +#else + vget(*vpp, LK_EXCLUSIVE, p); +#endif + MARK_INT_FAIL(CFS_ROOT_STATS); error = 0; goto exit; @@ -636,6 +526,7 @@ cfs_root(vfsp, vpp) goto exit; } + exit: return(error); } @@ -674,11 +565,7 @@ cfs_nb_statfs(vfsp, sbp, p) #define NB_SFS_SIZ 0x895440 */ /* Note: Normal fs's have a bsize of 0x400 == 1024 */ -#ifdef __NetBSD__ - sbp->f_type = 0; -#elif defined(__FreeBSD__) sbp->f_type = MOUNT_CFS; -#endif sbp->f_bsize = 8192; /* XXX */ sbp->f_iosize = 8192; /* XXX */ #define NB_SFS_SIZ 0x8AB75D @@ -688,9 +575,6 @@ cfs_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)); -#ifdef __NetBSD__ - strncpy(sbp->f_fstypename, MOUNT_CFS, MFSNAMELEN-1); -#endif strcpy(sbp->f_mntonname, "/coda"); strcpy(sbp->f_mntfromname, "CFS"); /* MARK_INT_SAT(CFS_STATFS_STATS); */ @@ -780,57 +664,12 @@ cfs_vptofh(vnp, fidp) return (EOPNOTSUPP); } -#ifdef __NetBSD__ -void -cfs_init(void) -{ - ENTRY; -} -#elif defined(__FreeBSD__) -#ifdef __FreeBSD_version int cfs_init(struct vfsconf *vfsp) { ENTRY; return 0; } -#else -int -cfs_init(void) -{ - ENTRY; - return 0; -} -#endif -#endif - -#if defined(__NetBSD__) && defined(NetBSD1_3) && (NetBSD1_3 >= 7) -int -cfs_sysctl(name, namelen, oldp, oldlp, newp, newl, p) - int *name; - u_int namelen; - void *oldp; - size_t *oldlp; - void *newp; - size_t newl; - struct proc *p; -{ - - /* all sysctl names at this level are terminal */ - if (namelen != 1) - return (ENOTDIR); /* overloaded */ - - switch (name[0]) { -/* - case FFS_CLUSTERREAD: - return (sysctl_int(oldp, oldlp, newp, newl, &doclusterread)); - */ - default: - return (EOPNOTSUPP); - } - /* NOTREACHED */ -} -#endif /* * To allow for greater ease of use, some vnodes may be orphaned when @@ -873,11 +712,7 @@ struct mount *devtomp(dev) for (mp = mountlist.cqh_first; mp != (void*)&mountlist; mp = nmp) { nmp = mp->mnt_list.cqe_next; - if ( -#ifdef __NetBSD__ - (!strcmp(mp->mnt_op->vfs_name, MOUNT_UFS)) && -#endif - ((VFSTOUFS(mp))->um_dev == (dev_t) dev)) { + if (((VFSTOUFS(mp))->um_dev == (dev_t) dev)) { /* mount corresponds to UFS and the device matches one we want */ return(mp); } diff --git a/sys/fs/coda/coda_vfsops.h b/sys/fs/coda/coda_vfsops.h index 9f8e77767a3f..754bbf321dcf 100644 --- a/sys/fs/coda/coda_vfsops.h +++ b/sys/fs/coda/coda_vfsops.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_vfsops.h,v 1.9 1998/08/28 18:12:22 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_vfsops.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * cfid structure: @@ -41,17 +43,11 @@ struct cfid { ViceFid cfid_fid; }; - struct mount; int cfs_vfsopstats_init(void); -#ifdef NetBSD1_3 -int cfs_mount(struct mount *, const char *, void *, struct nameidata *, - struct proc *); -#else int cfs_mount(struct mount *, char *, caddr_t, struct nameidata *, struct proc *); -#endif int cfs_start(struct mount *, int, struct proc *); int cfs_unmount(struct mount *, int, struct proc *); int cfs_root(struct mount *, struct vnode **); @@ -62,17 +58,6 @@ int cfs_vget(struct mount *, ino_t, struct vnode **); int cfs_fhtovp(struct mount *, struct fid *, struct mbuf *, struct vnode **, int *, struct ucred **); int cfs_vptofh(struct vnode *, struct fid *); -#ifdef __NetBSD__ -void cfs_init(void); -#elif defined(__FreeBSD__) -#ifdef __FreeBSD_version int cfs_init(struct vfsconf *vfsp); -#else -int cfs_init(void); -#endif -#endif -#if defined(__NetBSD__) && defined(NetBSD1_3) && (NetBSD1_3 >= 7) -int cfs_sysctl(int *, u_int, void *, size_t *, void *, size_t, - struct proc *); -#endif + int getNewVnode(struct vnode **vpp); diff --git a/sys/fs/coda/coda_vnops.c b/sys/fs/coda/coda_vnops.c index 69197d7e8912..c5c82038581b 100644 --- a/sys/fs/coda/coda_vnops.c +++ b/sys/fs/coda/coda_vnops.c @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_vnodeops.c,v 1.12 1998/08/28 18:28:00 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_vnodeops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -46,6 +48,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cfs_vnodeops.c,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.12 1998/08/28 18:28:00 rvb * NetBSD -current is stricter! * @@ -214,35 +219,23 @@ Mellon the rights to redistribute these changes without encumbrance. #include #include +#include +#include #include +#include #include #include #include +#include #include #include -#ifdef __FreeBSD_version #include -#else -#include -#endif -#include -#include #include -#ifdef __NetBSD__ -#include -#endif -#include -#ifdef NetBSD1_3 -#include -#endif -#ifdef __FreeBSD__ +#include #include #include -#ifdef __FreeBSD_version -#include -#endif -#endif +#include #include #include @@ -256,7 +249,6 @@ Mellon the rights to redistribute these changes without encumbrance. /* * These flags select various performance enhancements. */ -int cfs_intercept_rdwr = 1; /* Set to handle read/write in the kernel */ int cfs_attr_cache = 1; /* Set to cache attributes in the kernel */ int cfs_symlink_cache = 1; /* Set to cache symbolic link information */ int cfs_access_cache = 1; /* Set to handle some access checks directly */ @@ -284,20 +276,15 @@ static int cfs_lockdebug = 0; * cfs_init is called at boot time. */ -#ifdef __GNUC__ -#define ENTRY \ - if(cfs_vnop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) -#else -#define ENTRY -#endif +#define ENTRY if(cfs_vnop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) /* Definition of the vnode operation vector */ struct vnodeopv_entry_desc cfs_vnodeop_entries[] = { - { &vop_default_desc, nbsd_vop_error }, + { &vop_default_desc, cfs_vop_error }, { &vop_lookup_desc, cfs_lookup }, /* lookup */ { &vop_create_desc, cfs_create }, /* create */ - { &vop_mknod_desc, nbsd_vop_error }, /* mknod */ + { &vop_mknod_desc, cfs_vop_error }, /* mknod */ { &vop_open_desc, cfs_open }, /* open */ { &vop_close_desc, cfs_close }, /* close */ { &vop_access_desc, cfs_access }, /* access */ @@ -306,8 +293,7 @@ struct vnodeopv_entry_desc cfs_vnodeop_entries[] = { { &vop_read_desc, cfs_read }, /* read */ { &vop_write_desc, cfs_write }, /* write */ { &vop_ioctl_desc, cfs_ioctl }, /* ioctl */ -/* 1.3 { &vop_select_desc, cfs_select }, select */ - { &vop_mmap_desc, nbsd_vop_error }, /* mmap */ + { &vop_mmap_desc, cfs_vop_error }, /* mmap */ { &vop_fsync_desc, cfs_fsync }, /* fsync */ { &vop_remove_desc, cfs_remove }, /* remove */ { &vop_link_desc, cfs_link }, /* link */ @@ -324,41 +310,19 @@ struct vnodeopv_entry_desc cfs_vnodeop_entries[] = { { &vop_unlock_desc, cfs_unlock }, /* unlock */ { &vop_bmap_desc, cfs_bmap }, /* bmap */ { &vop_strategy_desc, cfs_strategy }, /* strategy */ - { &vop_print_desc, nbsd_vop_error }, /* print */ + { &vop_print_desc, cfs_vop_error }, /* print */ { &vop_islocked_desc, cfs_islocked }, /* islocked */ - { &vop_pathconf_desc, nbsd_vop_error }, /* pathconf */ - { &vop_advlock_desc, nbsd_vop_nop }, /* advlock */ - { &vop_bwrite_desc, nbsd_vop_error }, /* bwrite */ - { &vop_lease_desc, nbsd_vop_nop }, /* lease */ - -#ifdef __FreeBSD_version -#else /* FreeBSD stable & NetBSD both */ - { &vop_blkatoff_desc, nbsd_vop_error }, /* blkatoff */ - { &vop_valloc_desc, nbsd_vop_error }, /* valloc */ - { &vop_vfree_desc, nbsd_vop_error }, /* vfree */ - { &vop_truncate_desc, nbsd_vop_error }, /* truncate */ - { &vop_update_desc, nbsd_vop_error }, /* update */ -#endif - - /* NetBSD only */ -#ifdef __NetBSD__ -#ifdef NetBSD1_3 - { &vop_seek_desc, genfs_seek }, /* seek */ -#else - { &vop_seek_desc, nbsd_vop_error }, /* seek */ -#endif -#endif - - /* FreeBSD only */ -#ifdef __FreeBSD__ - -#ifdef __FreeBSD_version - - { &vop_poll_desc, (vop_t *) vop_stdpoll }, - { &vop_getpages_desc, (vop_t *) cfs_fbsd_getpages }, /* pager intf.*/ - { &vop_putpages_desc, (vop_t *) cfs_fbsd_putpages }, /* pager intf.*/ + { &vop_pathconf_desc, cfs_vop_error }, /* pathconf */ + { &vop_advlock_desc, cfs_vop_nop }, /* advlock */ + { &vop_bwrite_desc, cfs_vop_error }, /* bwrite */ + { &vop_lease_desc, cfs_vop_nop }, /* lease */ + { &vop_poll_desc, (vop_t *) vop_stdpoll }, + { &vop_getpages_desc, cfs_fbsd_getpages }, /* pager intf.*/ + { &vop_putpages_desc, cfs_fbsd_putpages }, /* pager intf.*/ #if 0 + + we need to define these someday #define UFS_BLKATOFF(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_blkatoff(aa, bb, cc, dd) #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) @@ -369,68 +333,29 @@ struct vnodeopv_entry_desc cfs_vnodeop_entries[] = { { &vop_reallocblks_desc, (vop_t *) ufs_missingop }, { &vop_cachedlookup_desc, (vop_t *) ufs_lookup }, { &vop_whiteout_desc, (vop_t *) ufs_whiteout }, -#endif - -#else /* FreeBSD stable */ - { &vop_getpages_desc, fbsd_vnotsup }, /* pager intf.*/ - { &vop_putpages_desc, fbsd_vnotsup }, /* pager intf.*/ - { &vop_seek_desc, nbsd_vop_error }, /* seek */ - { &vop_blkatoff_desc, nbsd_vop_error }, /* blkatoff */ - { &vop_valloc_desc, nbsd_vop_error }, /* valloc */ - { &vop_vfree_desc, nbsd_vop_error }, /* vfree */ - { &vop_truncate_desc, nbsd_vop_error }, /* truncate */ - { &vop_update_desc, nbsd_vop_error }, /* update */ -#endif #endif { (struct vnodeop_desc*)NULL, (int(*)(void *))NULL } }; -#ifdef __NetBSD__ -struct vnodeopv_desc cfs_vnodeop_opv_desc = - { &cfs_vnodeop_p, cfs_vnodeop_entries }; - -#define NAMEI_FREE(a) FREE(a, M_NAMEI) -#endif - -#ifdef __FreeBSD__ static struct vnodeopv_desc cfs_vnodeop_opv_desc = { &cfs_vnodeop_p, cfs_vnodeop_entries }; -#include VNODEOP_SET(cfs_vnodeop_opv_desc); -int -fbsd_vnotsup(ap) - void *ap; -{ - return(EOPNOTSUPP); -} - -#ifdef __FreeBSD_version -#include - -#define NAMEI_FREE(a) zfree(namei_zone, a); -#else -#define NAMEI_FREE(a) FREE(a, M_NAMEI) -#endif -#endif - -/* Definitions of NetBSD vnodeop interfaces */ - /* A generic panic: we were called with something we didn't define yet */ int -nbsd_vop_error(void *anon) { +cfs_vop_error(void *anon) { struct vnodeop_desc **desc = (struct vnodeop_desc **)anon; myprintf(("Vnode operation %s called, but not defined\n", (*desc)->vdesc_name)); - panic("nbsd_vop_error"); + panic("cfs_vop_error"); return 0; } /* A generic do-nothing. For lease_check, advlock */ int -nbsd_vop_nop(void *anon) { +cfs_vop_nop(void *anon) { struct vnodeop_desc **desc = (struct vnodeop_desc **)anon; if (cfsdebug) { @@ -452,7 +377,6 @@ cfs_vnodeopstats_init(void) cfs_vnodeopstats[i].unsat_intrn = 0; cfs_vnodeopstats[i].gen_intrn = 0; } - return 0; } @@ -511,8 +435,8 @@ cfs_open(v) if (error) return (error); - /* We get the vnode back locked in both Mach and NetBSD. Needs unlocked */ - VOP_X_UNLOCK(vp, 0); + /* We get the vnode back locked. Needs unlocked */ + VOP_UNLOCK(vp, 0, p); /* Keep a reference until the close comes in. */ vref(*vpp); @@ -538,7 +462,6 @@ cfs_open(v) /* Open the cache file. */ error = VOP_OPEN(vp, flag, cred, p); -#ifdef __FreeBSD__ if (error) { printf("cfs_open: VOP_OPEN on container failed %d\n", error); return (error); @@ -550,7 +473,6 @@ cfs_open(v) vput(vp); } } -#endif return(error); } @@ -658,8 +580,6 @@ cfs_rdwr(vp, uiop, rw, ioflag, cred, p) return(EINVAL); } - /* Redirect the request to UFS. */ - /* * If file is not already open this must be a page * {read,write} request. Iget the cache file's inode @@ -684,7 +604,7 @@ cfs_rdwr(vp, uiop, rw, ioflag, cred, p) * We get the vnode back locked in both Mach and * NetBSD. Needs unlocked */ - VOP_X_UNLOCK(cfvp, 0); + VOP_UNLOCK(cfvp, 0, p); } else { opened_internally = 1; @@ -692,7 +612,6 @@ cfs_rdwr(vp, uiop, rw, ioflag, cred, p) error = VOP_OPEN(vp, (rw == UIO_READ ? FREAD : FWRITE), cred, p); printf("cfs_rdwr: Internally Opening %p\n", vp); -#ifdef __FreeBSD__ if (error) { printf("cfs_rdwr: VOP_OPEN on container failed %d\n", error); return (error); @@ -704,7 +623,6 @@ printf("cfs_rdwr: Internally Opening %p\n", vp); vput(vp); } } -#endif if (error) { MARK_INT_FAIL(CFS_RDWR_STATS); return(error); @@ -722,18 +640,13 @@ printf("cfs_rdwr: Internally Opening %p\n", vp); error = VOP_READ(cfvp, uiop, ioflag, cred); } else { error = VOP_WRITE(cfvp, uiop, ioflag, cred); -#ifdef __FreeBSD__ /* ufs_write updates the vnode_pager_setsize for the vnode/object */ { struct vattr attr; if (VOP_GETATTR(cfvp, &attr, cred, p) == 0) { vnode_pager_setsize(vp, attr.va_size); -#ifdef __DEBUG_FreeBSD__ - printf("write: vnode_pager_setsize(%p, %d)\n", vp, attr.va_size); -#endif } } -#endif } if (error) @@ -829,28 +742,6 @@ cfs_ioctl(v) return(error); } -#if 0 -int -cfs_select(v) - void *v; -{ -/* true args */ - struct vop_select_args *ap = v; - struct vnode *vp = ap->a_vp; - int which = ap->a_which; - struct ucred *cred = ap->a_cred; - struct proc *p = ap->a_p; -/* upcall decl */ -/* locals */ - - MARK_ENTRY(CFS_SELECT_STATS); - - myprintf(("in cfs_select\n")); - MARK_INT_FAIL(CFS_SELECT_STATS); - return (EOPNOTSUPP); -} -#endif - /* * To reduce the cost of a user-level venus;we cache attributes in * the kernel. Each cnode has storage allocated for an attribute. If @@ -873,29 +764,12 @@ cfs_getattr(v) struct proc *p = ap->a_p; /* locals */ int error; - struct cnode *scp = NULL; MARK_ENTRY(CFS_GETATTR_STATS); -#if 0 - /* Check for operation on a dying object */ - if (IS_DYING(cp)) { - COMPLAIN_BITTERLY(getattr, cp->c_fid); - scp = cp; /* Save old cp */ - /* If no error, gives a valid vnode with which to work. */ - error = getNewVnode(&vp); - if (error) { - MARK_INT_FAIL(CFS_GETATTR_STATS); - return(error); /* Can't contact dead venus */ - } - cp = VTOC(vp); - } -#endif - -#ifdef __FreeBSD__ if (IS_UNMOUNTING(cp)) return ENODEV; -#endif + /* Check for getattr of control object. */ if (IS_CTL_VP(vp)) { MARK_INT_FAIL(CFS_GETATTR_STATS); @@ -913,7 +787,6 @@ cfs_getattr(v) *vap = cp->c_vattr; MARK_INT_SAT(CFS_GETATTR_STATS); - if (scp) vrele(vp); return(0); } @@ -929,17 +802,12 @@ cfs_getattr(v) CFSDEBUG(CFS_GETATTR, if (!(cfsdebug & ~CFS_GETATTR)) print_vattr(vap); ); -#ifdef __FreeBSD__ { int size = vap->va_size; struct vnode *convp = cp->c_ovp; if (convp != (struct vnode *)0) { vnode_pager_setsize(convp, size); -#ifdef __DEBUG_FreeBSD__ - printf("getattr: vnode_pager_setsize(%p, %d)\n", convp, size); -#endif } } -#endif /* If not open for write, store attributes in cnode */ if ((cp->c_owrite == 0) && (cfs_attr_cache)) { cp->c_vattr = *vap; @@ -947,7 +815,6 @@ cfs_getattr(v) } } - if (scp) vrele(vp); return(error); } @@ -981,17 +848,12 @@ cfs_setattr(v) if (!error) cp->c_flags &= ~C_VATTR; -#ifdef __FreeBSD__ { int size = vap->va_size; struct vnode *convp = cp->c_ovp; if (size != VNOVAL && convp != (struct vnode *)0) { vnode_pager_setsize(convp, size); -#ifdef __DEBUG_FreeBSD__ - printf("setattr: vnode_pager_setsize(%p, %d)\n", convp, size); -#endif } } -#endif CFSDEBUG(CFS_SETATTR, myprintf(("setattr %d\n", error)); ) return(error); } @@ -1059,7 +921,7 @@ cfs_abortop(v) /* locals */ if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF) - NAMEI_FREE(ap->a_cnp->cn_pnbuf); + zfree(namei_zone, ap->a_cnp->cn_pnbuf); return (0); } @@ -1149,7 +1011,6 @@ cfs_fsync(v) if (convp) VOP_FSYNC(convp, cred, MNT_WAIT, p); -#ifdef __FreeBSD__ /* * We see fsyncs with usecount == 1 then usecount == 0. * For now we ignore them. @@ -1160,7 +1021,6 @@ cfs_fsync(v) vp, vp->v_usecount, cp->c_flags, cp->c_flags&C_PURGING); } */ -#endif /* * We can expect fsync on any vnode at all if venus is pruging it. @@ -1173,10 +1033,8 @@ cfs_fsync(v) return(0); } -#ifdef __FreeBSD__ /* needs research */ return 0; -#endif error = venus_fsync(vtomi(vp), &cp->c_fid, cred, p); CFSDEBUG(CFS_FSYNC, myprintf(("in fsync result %d\n",error)); ); @@ -1210,11 +1068,6 @@ cfs_inactive(v) cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vp->v_mount));) -#ifdef __DEBUG_FreeBSD__ - if (vp->v_flag & VXLOCK) - printf ("Inactive: Vnode is Locked\n"); -#endif - /* If an array has been allocated to hold the symlink, deallocate it */ if ((cfs_symlink_cache) && (VALID_SYMLINK(cp))) { if (cp->c_symlink == NULL) @@ -1239,9 +1092,7 @@ cfs_inactive(v) printf("cfs_inactive: cp->ovp != NULL use %d: vp %p, cp %p\n", vp->v_usecount, vp, cp); #endif -#ifdef NEW_LOCKMGR - NEW_LOCKMGR(&cp->c_lock, LK_RELEASE, &vp->v_interlock); -#endif + lockmgr(&cp->c_lock, LK_RELEASE, &vp->v_interlock, p); } else { #ifdef DIAGNOSTIC if (CTOV(cp)->v_usecount) { @@ -1251,9 +1102,7 @@ cfs_inactive(v) panic("cfs_inactive: cp->ovp != NULL"); } #endif -#ifdef NEW_LOCKMGR - VOP_X_UNLOCK(vp, 0); -#endif + VOP_UNLOCK(vp, 0, p); vgone(vp); } @@ -1288,7 +1137,6 @@ cfs_lookup(v) struct proc *p = cnp->cn_proc; /* locals */ struct cnode *cp; - struct cnode *scp = NULL; const char *nm = cnp->cn_nameptr; int len = cnp->cn_namelen; ViceFid VFid; @@ -1301,27 +1149,11 @@ cfs_lookup(v) nm, dcp->c_fid.Volume, dcp->c_fid.Vnode, dcp->c_fid.Unique));); -#if 0 - /* Check for operation on a dying object */ - if (IS_DYING(dcp)) { - COMPLAIN_BITTERLY(lookup, dcp->c_fid); - scp = dcp; /* Save old dcp */ - /* If no error, gives a valid vnode with which to work. */ - error = getNewVnode(&dvp); - if (error) { - MARK_INT_FAIL(CFS_LOOKUP_STATS); - return(error); /* Can't contact dead venus */ - } - dcp = VTOC(dvp); - } -#endif - /* Check for lookup of control object. */ if (IS_CTL_NAME(dvp, nm, len)) { *vpp = cfs_ctlvp; vref(*vpp); MARK_INT_SAT(CFS_LOOKUP_STATS); - if (scp) vrele(dvp); goto exit; } @@ -1364,13 +1196,12 @@ cfs_lookup(v) /* enter the new vnode in the Name Cache only if the top bit isn't set */ /* And don't enter a new vnode for an invalid one! */ - if (!(vtype & CFS_NOCACHE) && scp == 0) + if (!(vtype & CFS_NOCACHE)) cfsnc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp)); } } exit: - if (scp) vrele(dvp); /* * If we are creating, and this was the last name to be looked up, * and the error was ENOENT, then there really shouldn't be an @@ -1417,7 +1248,7 @@ cfs_lookup(v) */ if (!error || (error == EJUSTRETURN)) { if (!(cnp->cn_flags & LOCKPARENT) || !(cnp->cn_flags & ISLASTCN)) { - if ((error = VOP_X_UNLOCK(dvp, 0))) { + if ((error = VOP_UNLOCK(dvp, 0, p))) { return error; } /* @@ -1425,7 +1256,7 @@ cfs_lookup(v) * lock it without bothering to check anything else. */ if (*ap->a_vpp) { - if ((error = VOP_X_LOCK(*ap->a_vpp, LK_EXCLUSIVE))) { + if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, p))) { printf("cfs_lookup: "); panic("unlocked parent but couldn't lock child"); } @@ -1434,7 +1265,7 @@ cfs_lookup(v) /* The parent is locked, and may be the same as the child */ if (*ap->a_vpp && (*ap->a_vpp != dvp)) { /* Different, go ahead and lock it. */ - if ((error = VOP_X_LOCK(*ap->a_vpp, LK_EXCLUSIVE))) { + if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, p))) { printf("cfs_lookup: "); panic("unlocked parent but couldn't lock child"); } @@ -1521,25 +1352,9 @@ cfs_create(v) CFSDEBUG(CFS_CREATE, myprintf(("create error %d\n", error));) } - /* Locking strategy. */ - /* - * In NetBSD, all creates must explicitly vput their dvp's. We'll - * go ahead and use the LOCKLEAF flag of the cnp argument. - * However, I'm pretty sure that create must return the leaf - * locked; so there is a DIAGNOSTIC check to ensure that this is - * true. - */ -#ifdef __FreeBSD_version - /* - * Well, FreeBSD -current does the vput put in - * kern/vfs_vnops.c.c:vn_open() - */ -#else - vput(dvp); -#endif if (!error) { if (cnp->cn_flags & LOCKLEAF) { - if ((error = VOP_X_LOCK(*ap->a_vpp, LK_EXCLUSIVE))) { + if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, p))) { printf("cfs_create: "); panic("unlocked parent but couldn't lock child"); } @@ -1556,7 +1371,7 @@ cfs_create(v) * why it's here, but what the hey... */ if ((cnp->cn_flags & SAVESTART) == 0) { - NAMEI_FREE(cnp->cn_pnbuf); + zfree(namei_zone, cnp->cn_pnbuf); } return(error); } @@ -1618,27 +1433,8 @@ cfs_remove(v) CFSDEBUG(CFS_REMOVE, myprintf(("in remove result %d\n",error)); ) -#ifdef __FreeBSD_version - /* - * Well, FreeBSD -current does the vrele/vput put in - * kern/vfs_syscalls.c:unlink() - */ -#else - /* - * Regardless of what happens, we have to unconditionally drop - * locks/refs on parent and child. (I hope). This is based on - * what ufs_remove seems to be doing. - */ - if (dvp == ap->a_vp) { - vrele(ap->a_vp); - } else { - vput(ap->a_vp); - } - vput(dvp); -#endif - if ((cnp->cn_flags & SAVESTART) == 0) { - NAMEI_FREE(cnp->cn_pnbuf); + zfree(namei_zone, cnp->cn_pnbuf); } return(error); } @@ -1651,11 +1447,7 @@ cfs_link(v) struct vop_link_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); -#ifdef __NetBSD__ - struct vnode *tdvp = ap->a_dvp; -#elif defined(__FreeBSD__) struct vnode *tdvp = ap->a_tdvp; -#endif struct cnode *tdcp = VTOC(tdvp); struct componentname *cnp = ap->a_cnp; struct ucred *cred = cnp->cn_cred; @@ -1689,28 +1481,6 @@ cfs_link(v) return(EACCES); } - /* - * According to the ufs_link operation here's the locking situation: - * We enter with the thing called "dvp" (the directory) locked. - * We must unconditionally drop locks on "dvp" - * - * We enter with the thing called "vp" (the linked-to) unlocked, - * but ref'd (?) - * We seem to need to lock it before calling cfs_link, and - * unconditionally unlock it after. - */ - -#ifdef __FreeBSD_version - /* - * Well, FreeBSD -current does the vrele/vput put in - * kern/vfs_syscalls.c:link() - */ -#else - if ((ap->a_vp != tdvp) && (error = VOP_X_LOCK(ap->a_vp, LK_EXCLUSIVE))) { - goto exit; - } -#endif - error = venus_link(vtomi(vp), &cp->c_fid, &tdcp->c_fid, nm, len, cred, p); /* Invalidate the parent's attr cache, the modification time has changed */ @@ -1721,21 +1491,9 @@ cfs_link(v) exit: -#ifdef __FreeBSD_version - /* - * Well, FreeBSD -current does the vrele/vput put in - * kern/vfs_syscalls.c:link() - */ -#else - if (ap->a_vp != tdvp) { - VOP_X_UNLOCK(ap->a_vp, 0); - } - vput(tdvp); -#endif - /* Drop the name buffer if we don't need to SAVESTART */ if ((cnp->cn_flags & SAVESTART) == 0) { - NAMEI_FREE(cnp->cn_pnbuf); + zfree(namei_zone, cnp->cn_pnbuf); } return(error); } @@ -1903,26 +1661,6 @@ cfs_mkdir(v) CFSDEBUG(CFS_MKDIR, myprintf(("mkdir error %d\n",error));) } - /* - * Currently, all mkdirs explicitly vput their dvp's. - * It also appears that we *must* lock the vpp, since - * lockleaf isn't set, but someone down the road is going - * to try to unlock the new directory. - */ -#ifdef __FreeBSD_version - /* - * Well, FreeBSD -current does the vrele/vput put in - * kern/vfs_syscalls.c:mkdir() - */ -#else - vput(dvp); - if (!error) { - if ((error = VOP_X_LOCK(*ap->a_vpp, LK_EXCLUSIVE))) { - panic("cfs_mkdir: couldn't lock child"); - } - } -#endif - /* Have to free the previously saved name */ /* * ufs_mkdir doesn't check for SAVESTART before freeing the @@ -1930,7 +1668,7 @@ cfs_mkdir(v) * follow their lead, but this seems like it is probably * incorrect. */ - NAMEI_FREE(cnp->cn_pnbuf); + zfree(namei_zone, cnp->cn_pnbuf); return(error); } @@ -1980,26 +1718,8 @@ cfs_rmdir(v) CFSDEBUG(CFS_RMDIR, myprintf(("in rmdir result %d\n", error)); ) -#ifdef __FreeBSD_version - /* - * Well, FreeBSD -current does the vrele/vput put in - * kern/vfs_syscalls.c:rmdir() - */ -#else - /* - * regardless of what happens, we need to drop locks/refs on the - * parent and child. I think. - */ - if (dvp == ap->a_vp) { - vrele(ap->a_vp); - } else { - vput(ap->a_vp); - } - vput(dvp); -#endif - if ((cnp->cn_flags & SAVESTART) == 0) { - NAMEI_FREE(cnp->cn_pnbuf); + zfree(namei_zone, cnp->cn_pnbuf); } return(error); } @@ -2025,10 +1745,7 @@ cfs_symlink(v) * t(foo) is the new name/parent/etc being created. * lname is the contents of the new symlink. */ -#ifdef NetBSD1_3 - const -#endif - char *nm = cnp->cn_nameptr; + char *nm = cnp->cn_nameptr; int len = cnp->cn_namelen; int plen = strlen(path); @@ -2067,45 +1784,11 @@ cfs_symlink(v) /* Invalidate the parent's attr cache, the modification time has changed */ tdcp->c_flags &= ~C_VATTR; -#ifdef __FreeBSD_version - -#else - if (!error) - { - struct nameidata nd; - NDINIT(&nd, LOOKUP, FOLLOW|LOCKLEAF, UIO_SYSSPACE, nm, p); - nd.ni_cnd.cn_cred = cred; - nd.ni_loopcnt = 0; - nd.ni_startdir = tdvp; - nd.ni_cnd.cn_pnbuf = (char *)nm; - nd.ni_cnd.cn_nameptr = nd.ni_cnd.cn_pnbuf; - nd.ni_pathlen = len; - vput(tdvp); - error = lookup(&nd); - *ap->a_vpp = nd.ni_vp; - } - - /* - * Okay, now we have to drop locks on dvp. vpp is unlocked, but - * ref'd. It doesn't matter what happens in either symlink or - * lookup. Furthermore, there isn't any way for (dvp == *vpp), so - * we don't bother checking. - */ -/* vput(ap->a_dvp); released earlier */ - if (*ap->a_vpp) { - VOP_X_UNLOCK(*ap->a_vpp, 0); /* this line is new!! It is necessary because lookup() calls - VOP_LOOKUP (cfs_lookup) which returns vpp locked. cfs_nb_lookup - merged with cfs_lookup() to become cfs_lookup so UNLOCK is - necessary */ - vrele(*ap->a_vpp); - } -#endif - /* * Free the name buffer */ if ((cnp->cn_flags & SAVESTART) == 0) { - NAMEI_FREE(cnp->cn_pnbuf); + zfree(namei_zone, cnp->cn_pnbuf); } exit: @@ -2127,22 +1810,8 @@ cfs_readdir(v) register struct uio *uiop = ap->a_uio; struct ucred *cred = ap->a_cred; int *eofflag = ap->a_eofflag; -#if defined(__NetBSD__) && defined(NetBSD1_3) && (NetBSD1_3 >= 7) - off_t **cookies = ap->a_cookies; - int *ncookies = ap->a_ncookies; -#elif defined(NetBSD1_3) - off_t *cookies = ap->a_cookies; - int ncookies = ap->a_ncookies; -#elif NetBSD1_2 - u_long *cookies = ap->a_cookies; - int ncookies = ap->a_ncookies; -#elif defined(__FreeBSD__) && defined(__FreeBSD_version) u_long **cookies = ap->a_cookies; int *ncookies = ap->a_ncookies; -#elif defined(__FreeBSD__) - u_int **cookies = ap->a_cookies; - int *ncookies = ap->a_ncookies; -#endif struct proc *p = ap->a_uio->uio_procp; /* upcall decl */ /* locals */ @@ -2158,9 +1827,7 @@ cfs_readdir(v) return(ENOENT); } - if (cfs_intercept_rdwr) { - /* Redirect the request to UFS. */ - + { /* If directory is not already open do an "internal open" on it. */ int opened_internally = 0; if (cp->c_ovp == NULL) { @@ -2168,7 +1835,6 @@ cfs_readdir(v) MARK_INT_GEN(CFS_OPEN_STATS); error = VOP_OPEN(vp, FREAD, cred, p); printf("cfs_readdir: Internally Opening %p\n", vp); -#ifdef __FreeBSD__ if (error) { printf("cfs_readdir: VOP_OPEN on container failed %d\n", error); return (error); @@ -2180,19 +1846,13 @@ printf("cfs_readdir: Internally Opening %p\n", vp); vput(vp); } } -#endif if (error) return(error); } /* Have UFS handle the call. */ CFSDEBUG(CFS_READDIR, myprintf(("indirect readdir: fid = (%lx.%lx.%lx), refcnt = %d\n",cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vp->v_usecount)); ) -#ifdef __NetBSD__ - error = VOP_READDIR(cp->c_ovp, uiop, cred, eofflag, cookies, - ncookies); -#elif defined(__FreeBSD__) error = VOP_READDIR(cp->c_ovp, uiop, cred, eofflag, ncookies, cookies); -#endif if (error) MARK_INT_FAIL(CFS_READDIR_STATS); @@ -2205,39 +1865,6 @@ printf("cfs_readdir: Internally Opening %p\n", vp); (void)VOP_CLOSE(vp, FREAD, cred, p); } } - else { - /* Read the block from Venus. */ - struct iovec *iovp = uiop->uio_iov; - unsigned count = iovp->iov_len; - int size; - - - /* Make the count a multiple of DIRBLKSIZ (borrowed from ufs_readdir). */ -#define DIRBLKSIZ DEV_BSIZE - if ((uiop->uio_iovcnt != 1) || (count < DIRBLKSIZ) || - (uiop->uio_offset & (DIRBLKSIZ - 1))) - return (EINVAL); - count &= ~(DIRBLKSIZ - 1); - uiop->uio_resid -= iovp->iov_len - count; - iovp->iov_len = count; - if (count > VC_MAXDATASIZE) - return(EINVAL); - - - error = venus_readdir(vtomi(CTOV(cp)), &cp->c_fid, count, uiop->uio_offset, cred, p, iovp->iov_base, &size); - - CFSDEBUG(CFS_READDIR, - myprintf(("cfs_readdir(%p, %d, %qd, %d) returns (%d, %d)\n", - iovp->iov_base, count, - uiop->uio_offset, uiop->uio_segflg, error, - size)); ) - if (!error) { - iovp->iov_base += size; - iovp->iov_len -= size; - uiop->uio_resid -= size; - uiop->uio_offset += size; - } - } return(error); } @@ -2260,8 +1887,6 @@ cfs_bmap(v) /* upcall decl */ /* locals */ -#ifdef __FreeBSD__ -#ifdef __FreeBSD_version int ret = 0; struct cnode *cp; @@ -2276,15 +1901,6 @@ cfs_bmap(v) printf("cfs_bmap: no container\n"); return(EOPNOTSUPP); } -#else - /* Just like nfs_bmap(). Do not touch *vpp, this cause pfault. */ - return(EOPNOTSUPP); -#endif -#else /* !FreeBSD */ - *vpp = (struct vnode *)0; - myprintf(("cfs_bmap called!\n")); - return(EINVAL); -#endif } /* @@ -2305,18 +1921,8 @@ cfs_strategy(v) /* upcall decl */ /* locals */ -#ifdef __FreeBSD__ -#ifdef __FreeBSD_version printf("cfs_strategy: called ???\n"); return(EOPNOTSUPP); -#else /* ! __MAYBE_FreeBSD__ */ - myprintf(("cfs_strategy called! ")); - return(EOPNOTSUPP); -#endif /* __MAYBE_FreeBSD__ */ -#else /* ! __FreeBSD__ */ - myprintf(("cfs_strategy called! ")); - return(EINVAL); -#endif /* __FreeBSD__ */ } int @@ -2357,7 +1963,6 @@ cfs_reclaim(v) return (0); } -#ifdef NEW_LOCKMGR int cfs_lock(v) void *v; @@ -2366,9 +1971,7 @@ cfs_lock(v) struct vop_lock_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); -#ifdef __FreeBSD_version struct proc *p = ap->a_p; -#endif /* upcall decl */ /* locals */ @@ -2379,7 +1982,7 @@ cfs_lock(v) cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); } - return (NEW_LOCKMGR(&cp->c_lock, ap->a_flags, &vp->v_interlock)); + return (lockmgr(&cp->c_lock, ap->a_flags, &vp->v_interlock, p)); } int @@ -2390,9 +1993,7 @@ cfs_unlock(v) struct vop_unlock_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); -#ifdef __FreeBSD_version struct proc *p = ap->a_p; -#endif /* upcall decl */ /* locals */ @@ -2402,7 +2003,7 @@ cfs_unlock(v) cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); } - return (NEW_LOCKMGR(&cp->c_lock, ap->a_flags | LK_RELEASE, &vp->v_interlock)); + return (lockmgr(&cp->c_lock, ap->a_flags | LK_RELEASE, &vp->v_interlock, p)); } int @@ -2416,99 +2017,6 @@ cfs_islocked(v) return (lockstatus(&cp->c_lock)); } -#else -int -cfs_lock(v) - void *v; -{ -/* true args */ - struct vop_lock_args *ap = v; - struct vnode *vp = ap->a_vp; - struct cnode *cp; - struct proc *p __attribute__((unused)) = curproc; /* XXX */ -/* upcall decl */ -/* locals */ - - ENTRY; - cp = VTOC(vp); - - if (cfs_lockdebug) { - myprintf(("Attempting lock on %lx.%lx.%lx\n", - cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); - } -start: - while (vp->v_flag & VXLOCK) { - vp->v_flag |= VXWANT; -#ifdef __NetBSD__ - (void) sleep((caddr_t)vp, PINOD); -#elif defined(__FreeBSD__) - (void) tsleep((caddr_t)vp, PINOD, "cfs_lock1", 0); -#endif - } - if (vp->v_tag == VT_NON) - return (ENOENT); - - if (cp->c_flags & C_LOCKED) { - cp->c_flags |= C_WANTED; -#ifdef DIAGNOSTIC - myprintf(("cfs_lock: lock contention")); - cfsnc_name(cp); - myprintf(("\n")); -#endif -#ifdef __NetBSD__ - (void) sleep((caddr_t)cp, PINOD); -#elif defined(__FreeBSD__) - (void) tsleep((caddr_t)cp, PINOD, "cfs_lock2", 0); -#endif -#ifdef DIAGNOSTIC - myprintf(("cfs_lock: contention resolved\n")); -#endif - goto start; - } - cp->c_flags |= C_LOCKED; - return (0); -} - -int -cfs_unlock(v) - void *v; -{ -/* true args */ - struct vop_unlock_args *ap = v; - struct cnode *cp = VTOC(ap->a_vp); -/* upcall decl */ -/* locals */ - - ENTRY; - if (cfs_lockdebug) { - myprintf(("Attempting unlock on %lx.%lx.%lx\n", - cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); - } -#ifdef DIAGNOSTIC - if ((cp->c_flags & C_LOCKED) == 0) - panic("cfs_unlock: not locked"); -#endif - cp->c_flags &= ~C_LOCKED; - if (cp->c_flags & C_WANTED) { - cp->c_flags &= ~C_WANTED; - wakeup((caddr_t)cp); - } - return (0); -} - -int -cfs_islocked(v) - void *v; -{ -/* true args */ - struct vop_islocked_args *ap = v; - - ENTRY; - if (VTOC(ap->a_vp)->c_flags & C_LOCKED) - return (1); - return (0); -} -#endif /* How one looks up a vnode given a device/inode pair: */ int @@ -2607,10 +2115,6 @@ print_cred(cred) } -/* - ----------------------------------------------------------------------------------- - */ - /* * Return a vnode for the given fid. * If no cnode exists for this fid create one and put it @@ -2630,9 +2134,7 @@ makecfsnode(fid, vfsp, type) struct vnode *vp; cp = cfs_alloc(); -#ifdef NEW_LOCKMGR lockinit(&cp->c_lock, PINOD, "cnode", 0, 0); -#endif cp->c_fid = *fid; err = getnewvnode(VT_CFS, vfsp, cfs_vnodeop_p, &vp); @@ -2650,153 +2152,3 @@ makecfsnode(fid, vfsp, type) return cp; } - - - -#ifdef MACH -/* - * read a logical block and return it in a buffer */ -int -cfs_bread(vp, lbn, bpp) - struct vnode *vp; - daddr_t lbn; - struct buf **bpp; -{ - myprintf(("cfs_bread called!\n")); - return(EINVAL); -} - -/* - * release a block returned by cfs_bread - */ -int -cfs_brelse(vp, bp) - struct vnode *vp; - struct buf *bp; -{ - - myprintf(("cfs_brelse called!\n")); - return(EINVAL); -} - -int -cfs_badop() -{ - panic("cfs_badop"); -} - -int -cfs_noop() -{ - return (EINVAL); -} - -int -cfs_fid(vp, fidpp) - struct vnode *vp; - struct fid **fidpp; -{ - struct cfid *cfid; - - cfid = (struct cfid *)kalloc(sizeof(struct cfid)); - bzero((caddr_t)cfid, sizeof(struct cfid)); - cfid->cfid_len = sizeof(struct cfid) - (sizeof(struct fid) - MAXFIDSZ); - cfid->cfid_fid = VTOC(vp)->c_fid; - *fidpp = (struct fid *)cfid; - return (0); -} - -int -cfs_freefid(vp, fidp) - struct vnode *vp; - struct fid *fidp; -{ - kfree((struct cfid *)fidp, sizeof(struct cfid)); - return (0); -} - -/* - * Record-locking requests are passed to the local Lock-Manager daemon. - */ -int -cfs_lockctl(vp, ld, cmd, cred) - struct vnode *vp; - struct flock *ld; - int cmd; - struct ucred *cred; -{ - myprintf(("cfs_lockctl called!\n")); - return(EINVAL); -} - -cfs_page_read(vp, buffer, size, offset, cred) - struct vnode *vp; - caddr_t buffer; - int size; - vm_offset_t offset; - struct ucred *cred; -{ - struct cnode *cp = VTOC(vp); - struct uio uio; - struct iovec iov; - int error = 0; - - CFSDEBUG(CFS_RDWR, myprintf(("cfs_page_read(%p, %d, %d), fid = (%lx.%lx.%lx), refcnt = %d\n", buffer, size, offset, VTOC(vp)->c_fid.Volume, VTOC(vp)->c_fid.Vnode, VTOC(vp)->c_fid.Unique, vp->v_count)); ) - - iov.iov_base = buffer; - iov.iov_len = size; - uio.uio_iov = &iov; - uio.uio_iovcnt = 1; - uio.uio_offset = offset; - uio.uio_segflg = UIO_SYSSPACE; - uio.uio_resid = size; - error = cfs_rdwr(vp, &uio, UIO_READ, 0, cred); - if (error) { - myprintf(("error %d on pagein (cfs_rdwr)\n", error)); - error = EIO; - } - -/* - if (!error && (cp->states & CWired) == 0) - cfs_Wire(cp); -*/ - - return(error); -} - -cfs_page_write(vp, buffer, size, offset, cred, init) - struct vnode *vp; - caddr_t buffer; - int size; - vm_offset_t offset; - struct ucred *cred; - boolean_t init; -{ - struct cnode *cp = VTOC(vp); - struct uio uio; - struct iovec iov; - int error = 0; - - CFSDEBUG(CFS_RDWR, myprintf(("cfs_page_write(%p, %d, %d), fid = (%lx.%lx.%lx), refcnt = %d\n", buffer, size, offset, VTOC(vp)->c_fid.Volume, VTOC(vp)->c_fid.Vnode, VTOC(vp)->c_fid.Unique, vp->v_count)); ) - - if (init) { - panic("cfs_page_write: called from data_initialize"); - } - - iov.iov_base = buffer; - iov.iov_len = size; - uio.uio_iov = &iov; - uio.uio_iovcnt = 1; - uio.uio_offset = offset; - uio.uio_segflg = UIO_SYSSPACE; - uio.uio_resid = size; - error = cfs_rdwr(vp, &uio, UIO_WRITE, 0, cred); - if (error) { - myprintf(("error %d on pageout (cfs_rdwr)\n", error)); - error = EIO; - } - - return(error); -} - -#endif diff --git a/sys/fs/coda/coda_vnops.h b/sys/fs/coda/coda_vnops.h index 697cb9123f04..f965c93c26b6 100644 --- a/sys/fs/coda/coda_vnops.h +++ b/sys/fs/coda/coda_vnops.h @@ -1,33 +1,35 @@ /* - - Coda: an Experimental Distributed File System - Release 3.1 - - Copyright (c) 1987-1998 Carnegie Mellon University - All Rights Reserved - -Permission to use, copy, modify and distribute this software and its -documentation is hereby granted, provided that both the copyright -notice and this permission notice appear in all copies of the -software, derivative works or modified versions, and any portions -thereof, and that both notices appear in supporting documentation, and -that credit is given to Carnegie Mellon University in all documents -and publicity pertaining to direct or indirect use of this code or its -derivatives. - -CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, -SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS -FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON -DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER -RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF -ANY DERIVATIVE WORK. - -Carnegie Mellon encourages users of this software to return any -improvements or extensions that they make, and to grant Carnegie -Mellon the rights to redistribute these changes without encumbrance. -*/ - -/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_vnodeops.h,v 1.7 1998/08/28 18:12:24 rvb Exp $ */ + * + * Coda: an Experimental Distributed File System + * Release 3.1 + * + * Copyright (c) 1987-1998 Carnegie Mellon University + * All Rights Reserved + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation, and + * that credit is given to Carnegie Mellon University in all documents + * and publicity pertaining to direct or indirect use of this code or its + * derivatives. + * + * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, + * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS + * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON + * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF + * ANY DERIVATIVE WORK. + * + * Carnegie Mellon encourages users of this software to return any + * improvements or extensions that they make, and to grant Carnegie + * Mellon the rights to redistribute these changes without encumbrance. + * + * @(#) src/sys/cfs/cfs_vnodeops.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: $ + * + */ /* * Mach Operating System @@ -46,6 +48,9 @@ Mellon the rights to redistribute these changes without encumbrance. /* * HISTORY * $Log: cfs_vnodeops.h,v $ + * Revision 1.1.1.1 1998/08/29 21:14:52 rvb + * Very Preliminary Coda + * * Revision 1.7 1998/08/28 18:12:24 rvb * Now it also works on FreeBSD -current. This code will be * committed to the FreeBSD -current and NetBSD -current @@ -87,7 +92,6 @@ Mellon the rights to redistribute these changes without encumbrance. * */ - /* NetBSD interfaces to the vnodeops */ int cfs_open __P((void *)); int cfs_close __P((void *)); @@ -117,22 +121,15 @@ int cfs_reclaim __P((void *)); int cfs_lock __P((void *)); int cfs_unlock __P((void *)); int cfs_islocked __P((void *)); -int nbsd_vop_error __P((void *)); -int nbsd_vop_nop __P((void *)); -#ifdef __FreeBSD__ -int fbsd_vnotsup __P((void *ap)); -#ifdef __FreeBSD_version +int cfs_vop_error __P((void *)); +int cfs_vop_nop __P((void *)); int cfs_fbsd_getpages __P((void *)); int cfs_fbsd_putpages __P((void *)); -#endif -#endif int (**cfs_vnodeop_p)(void *); + int cfs_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw, int ioflag, struct ucred *cred, struct proc *p); - - - int cfs_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp); void print_vattr(struct vattr *attr); void print_cred(struct ucred *cred);