diff options
| author | Peter Wemm <peter@FreeBSD.org> | 1999-01-17 20:25:22 +0000 |
|---|---|---|
| committer | Peter Wemm <peter@FreeBSD.org> | 1999-01-17 20:25:22 +0000 |
| commit | 6bfaa53754fbbd91f578bc2014e7b25a5345c3f5 (patch) | |
| tree | 62efbf28d089ed06191e1009a9e696bc2e9fa8fe | |
| parent | 6b3daecd8061a92b4db7426785088de6bcae490b (diff) | |
Notes
| -rw-r--r-- | sys/coda/coda_fbsd.c | 76 | ||||
| -rw-r--r-- | sys/coda/coda_subr.c | 12 | ||||
| -rw-r--r-- | sys/coda/coda_vfsops.c | 28 | ||||
| -rw-r--r-- | sys/fs/coda/coda_fbsd.c | 76 | ||||
| -rw-r--r-- | sys/fs/coda/coda_subr.c | 12 | ||||
| -rw-r--r-- | sys/fs/coda/coda_vfsops.c | 28 | ||||
| -rw-r--r-- | sys/modules/coda/Makefile | 12 |
7 files changed, 56 insertions, 188 deletions
diff --git a/sys/coda/coda_fbsd.c b/sys/coda/coda_fbsd.c index 6e4dc9058bee..66bfe07f6299 100644 --- a/sys/coda/coda_fbsd.c +++ b/sys/coda/coda_fbsd.c @@ -27,16 +27,12 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/coda/coda_fbsd.cr,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: coda_fbsd.c,v 1.9 1998/11/15 15:33:49 bde Exp $ + * $Id: coda_fbsd.c,v 1.10 1999/01/05 18:49:49 eivind Exp $ * */ -#ifdef VFS_LKM -#define NVCODA 4 -#else #include "vcoda.h" #include "opt_devfs.h" -#endif #include <sys/param.h> #include <sys/systm.h> @@ -87,8 +83,6 @@ static struct cdevsw codadevsw = int vcdebug = 1; #define VCDEBUG if (vcdebug) printf -#if !defined(VFS_LKM) || defined(VFS_KLD) - static int codadev_modevent(module_t mod, int type, void *data) { @@ -139,8 +133,6 @@ static moduledata_t codadev_mod = { }; DECLARE_MODULE(codadev, codadev_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+VC_DEV_NO); -#endif - int coda_fbsd_getpages(v) void *v; @@ -222,69 +214,3 @@ coda_fbsd_putpages(v) return vnode_pager_generic_putpages(ap->a_vp, ap->a_m, ap->a_count, ap->a_sync, ap->a_rtvals); } - -#if defined(VFS_LKM) && !defined(VFS_KLD) - -#include <sys/mount.h> -#include <sys/lkm.h> - -void vcattach __P((void)); -static dev_t codadev; - -void -vcattach(void) -{ - if (0 == (codadev = makedev(VC_DEV_NO, 0))) - VCDEBUG("makedev returned null\n"); - else - VCDEBUG("makedev OK.\n"); - - cdevsw_add(&codadev, &codadevsw, NULL); - VCDEBUG("coda: codadevsw entry installed at %d.\n", major(codadev)); -} - -extern struct vfsops coda_vfsops; - -static struct vfsconf _fs_vfsconf = { &coda_vfsops, "coda", -1, 0, 0 }; - -extern struct linker_set coda_modvnops ; - -static struct lkm_vfs coda_mod_vfs = { - LM_VFS, LKM_VERSION, "coda", 0, &coda_modvnops, &_fs_vfsconf }; - -static struct lkm_dev coda_mod_dev = { - LM_DEV, LKM_VERSION, "codadev", VC_DEV_NO, LM_DT_CHAR, (void *) &codadevsw}; - -int coda_mod(struct lkm_table *, int, int); -int -coda_mod(struct lkm_table *lkmtp, int cmd, int ver) -{ - int error = 0; - - if (ver != LKM_VERSION) - return EINVAL; - - switch (cmd) { - case LKM_E_LOAD: - lkmtp->private.lkm_any = (struct lkm_any *) &coda_mod_dev; - error = lkmdispatch(lkmtp, cmd); - if (error) - break; - lkmtp->private.lkm_any = (struct lkm_any *) &coda_mod_vfs ; - error = lkmdispatch(lkmtp, cmd); - break; - case LKM_E_UNLOAD: - lkmtp->private.lkm_any = (struct lkm_any *) &coda_mod_vfs ; - error = lkmdispatch(lkmtp, cmd); - if (error) - break; - lkmtp->private.lkm_any = (struct lkm_any *) &coda_mod_dev; - error = lkmdispatch(lkmtp, cmd); - break; - case LKM_E_STAT: - error = lkmdispatch(lkmtp, cmd); - break; - } - return error; -} -#endif diff --git a/sys/coda/coda_subr.c b/sys/coda/coda_subr.c index 0b0b1447a3da..40d2d0b0b1a4 100644 --- a/sys/coda/coda_subr.c +++ b/sys/coda/coda_subr.c @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/coda/coda_subr.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: coda_subr.c,v 1.7 1998/09/29 20:19:45 rvb Exp $ + * $Id: coda_subr.c,v 1.8 1998/10/28 19:33:50 rvb Exp $ * */ @@ -46,6 +46,12 @@ /* * HISTORY * $Log: coda_subr.c,v $ + * Revision 1.8 1998/10/28 19:33:50 rvb + * Venus must be passed O_CREAT flag on VOP_OPEN iff this is + * a creat so that we can will allow a mode 444 file to be + * written into. Sync with the latest coda.h and deal with + * collateral damage. + * * Revision 1.7 1998/09/29 20:19:45 rvb * Fixes for lkm: * 1. use VFS_LKM vs ACTUALLY_LKM_NOT_KERNEL @@ -223,11 +229,7 @@ * 4. coda_cacheprint (under DEBUG) prints names with vnode/cnode address */ -#ifdef VFS_LKM -#define NVCODA 4 -#else #include <vcoda.h> -#endif #include <sys/param.h> #include <sys/systm.h> diff --git a/sys/coda/coda_vfsops.c b/sys/coda/coda_vfsops.c index 79ca4652944a..8f6befec3e93 100644 --- a/sys/coda/coda_vfsops.c +++ b/sys/coda/coda_vfsops.c @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/coda_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: coda_vfsops.c,v 1.9 1998/11/16 19:48:26 rvb Exp $ + * $Id: coda_vfsops.c,v 1.10 1998/12/04 22:54:43 archie Exp $ * */ @@ -47,6 +47,20 @@ /* * HISTORY * $Log: coda_vfsops.c,v $ + * Revision 1.10 1998/12/04 22:54:43 archie + * Examine all occurrences of sprintf(), strcat(), and str[n]cpy() + * for possible buffer overflow problems. Replaced most sprintf()'s + * with snprintf(); for others cases, added terminating NUL bytes where + * appropriate, replaced constants like "16" with sizeof(), etc. + * + * These changes include several bug fixes, but most changes are for + * maintainability's sake. Any instance where it wasn't "immediately + * obvious" that a buffer overflow could not occur was made safer. + * + * Reviewed by: Bruce Evans <bde@zeta.org.au> + * Reviewed by: Matthew Dillon <dillon@apollo.backplane.com> + * Reviewed by: Mike Spengler <mks@networkcs.com> + * * Revision 1.9 1998/11/16 19:48:26 rvb * A few bug fixes for Robert Watson * @@ -207,11 +221,7 @@ * */ -#ifdef VFS_LKM -#define NVCODA 4 -#else #include <vcoda.h> -#endif #include <sys/param.h> #include <sys/systm.h> @@ -757,12 +767,4 @@ struct vfsops coda_vfsops = { coda_init, }; -#if defined(VFS_LKM) && !defined(VFS_KLD) -/* - * This case is being handled in coda_fbsd.c - * What we want is too hairy for VFS_SET to get right! - * XXX but VFS_KLD does it in VFS_SET.. - */ -#else VFS_SET(coda_vfsops, coda, VFCF_NETWORK); -#endif diff --git a/sys/fs/coda/coda_fbsd.c b/sys/fs/coda/coda_fbsd.c index 6e4dc9058bee..66bfe07f6299 100644 --- a/sys/fs/coda/coda_fbsd.c +++ b/sys/fs/coda/coda_fbsd.c @@ -27,16 +27,12 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/coda/coda_fbsd.cr,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: coda_fbsd.c,v 1.9 1998/11/15 15:33:49 bde Exp $ + * $Id: coda_fbsd.c,v 1.10 1999/01/05 18:49:49 eivind Exp $ * */ -#ifdef VFS_LKM -#define NVCODA 4 -#else #include "vcoda.h" #include "opt_devfs.h" -#endif #include <sys/param.h> #include <sys/systm.h> @@ -87,8 +83,6 @@ static struct cdevsw codadevsw = int vcdebug = 1; #define VCDEBUG if (vcdebug) printf -#if !defined(VFS_LKM) || defined(VFS_KLD) - static int codadev_modevent(module_t mod, int type, void *data) { @@ -139,8 +133,6 @@ static moduledata_t codadev_mod = { }; DECLARE_MODULE(codadev, codadev_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+VC_DEV_NO); -#endif - int coda_fbsd_getpages(v) void *v; @@ -222,69 +214,3 @@ coda_fbsd_putpages(v) return vnode_pager_generic_putpages(ap->a_vp, ap->a_m, ap->a_count, ap->a_sync, ap->a_rtvals); } - -#if defined(VFS_LKM) && !defined(VFS_KLD) - -#include <sys/mount.h> -#include <sys/lkm.h> - -void vcattach __P((void)); -static dev_t codadev; - -void -vcattach(void) -{ - if (0 == (codadev = makedev(VC_DEV_NO, 0))) - VCDEBUG("makedev returned null\n"); - else - VCDEBUG("makedev OK.\n"); - - cdevsw_add(&codadev, &codadevsw, NULL); - VCDEBUG("coda: codadevsw entry installed at %d.\n", major(codadev)); -} - -extern struct vfsops coda_vfsops; - -static struct vfsconf _fs_vfsconf = { &coda_vfsops, "coda", -1, 0, 0 }; - -extern struct linker_set coda_modvnops ; - -static struct lkm_vfs coda_mod_vfs = { - LM_VFS, LKM_VERSION, "coda", 0, &coda_modvnops, &_fs_vfsconf }; - -static struct lkm_dev coda_mod_dev = { - LM_DEV, LKM_VERSION, "codadev", VC_DEV_NO, LM_DT_CHAR, (void *) &codadevsw}; - -int coda_mod(struct lkm_table *, int, int); -int -coda_mod(struct lkm_table *lkmtp, int cmd, int ver) -{ - int error = 0; - - if (ver != LKM_VERSION) - return EINVAL; - - switch (cmd) { - case LKM_E_LOAD: - lkmtp->private.lkm_any = (struct lkm_any *) &coda_mod_dev; - error = lkmdispatch(lkmtp, cmd); - if (error) - break; - lkmtp->private.lkm_any = (struct lkm_any *) &coda_mod_vfs ; - error = lkmdispatch(lkmtp, cmd); - break; - case LKM_E_UNLOAD: - lkmtp->private.lkm_any = (struct lkm_any *) &coda_mod_vfs ; - error = lkmdispatch(lkmtp, cmd); - if (error) - break; - lkmtp->private.lkm_any = (struct lkm_any *) &coda_mod_dev; - error = lkmdispatch(lkmtp, cmd); - break; - case LKM_E_STAT: - error = lkmdispatch(lkmtp, cmd); - break; - } - return error; -} -#endif diff --git a/sys/fs/coda/coda_subr.c b/sys/fs/coda/coda_subr.c index 0b0b1447a3da..40d2d0b0b1a4 100644 --- a/sys/fs/coda/coda_subr.c +++ b/sys/fs/coda/coda_subr.c @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/coda/coda_subr.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: coda_subr.c,v 1.7 1998/09/29 20:19:45 rvb Exp $ + * $Id: coda_subr.c,v 1.8 1998/10/28 19:33:50 rvb Exp $ * */ @@ -46,6 +46,12 @@ /* * HISTORY * $Log: coda_subr.c,v $ + * Revision 1.8 1998/10/28 19:33:50 rvb + * Venus must be passed O_CREAT flag on VOP_OPEN iff this is + * a creat so that we can will allow a mode 444 file to be + * written into. Sync with the latest coda.h and deal with + * collateral damage. + * * Revision 1.7 1998/09/29 20:19:45 rvb * Fixes for lkm: * 1. use VFS_LKM vs ACTUALLY_LKM_NOT_KERNEL @@ -223,11 +229,7 @@ * 4. coda_cacheprint (under DEBUG) prints names with vnode/cnode address */ -#ifdef VFS_LKM -#define NVCODA 4 -#else #include <vcoda.h> -#endif #include <sys/param.h> #include <sys/systm.h> diff --git a/sys/fs/coda/coda_vfsops.c b/sys/fs/coda/coda_vfsops.c index 79ca4652944a..8f6befec3e93 100644 --- a/sys/fs/coda/coda_vfsops.c +++ b/sys/fs/coda/coda_vfsops.c @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/coda_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: coda_vfsops.c,v 1.9 1998/11/16 19:48:26 rvb Exp $ + * $Id: coda_vfsops.c,v 1.10 1998/12/04 22:54:43 archie Exp $ * */ @@ -47,6 +47,20 @@ /* * HISTORY * $Log: coda_vfsops.c,v $ + * Revision 1.10 1998/12/04 22:54:43 archie + * Examine all occurrences of sprintf(), strcat(), and str[n]cpy() + * for possible buffer overflow problems. Replaced most sprintf()'s + * with snprintf(); for others cases, added terminating NUL bytes where + * appropriate, replaced constants like "16" with sizeof(), etc. + * + * These changes include several bug fixes, but most changes are for + * maintainability's sake. Any instance where it wasn't "immediately + * obvious" that a buffer overflow could not occur was made safer. + * + * Reviewed by: Bruce Evans <bde@zeta.org.au> + * Reviewed by: Matthew Dillon <dillon@apollo.backplane.com> + * Reviewed by: Mike Spengler <mks@networkcs.com> + * * Revision 1.9 1998/11/16 19:48:26 rvb * A few bug fixes for Robert Watson * @@ -207,11 +221,7 @@ * */ -#ifdef VFS_LKM -#define NVCODA 4 -#else #include <vcoda.h> -#endif #include <sys/param.h> #include <sys/systm.h> @@ -757,12 +767,4 @@ struct vfsops coda_vfsops = { coda_init, }; -#if defined(VFS_LKM) && !defined(VFS_KLD) -/* - * This case is being handled in coda_fbsd.c - * What we want is too hairy for VFS_SET to get right! - * XXX but VFS_KLD does it in VFS_SET.. - */ -#else VFS_SET(coda_vfsops, coda, VFCF_NETWORK); -#endif diff --git a/sys/modules/coda/Makefile b/sys/modules/coda/Makefile index 9135235c6a47..f30ec7b464a2 100644 --- a/sys/modules/coda/Makefile +++ b/sys/modules/coda/Makefile @@ -1,10 +1,18 @@ -# $Id: Makefile,v 1.2 1998/09/29 20:19:45 rvb Exp $ +# $Id: Makefile,v 1.3 1998/10/16 04:30:42 peter Exp $ .PATH: ${.CURDIR}/../../coda KMOD= coda SRCS= coda_fbsd.c coda_namecache.c coda_psdev.c coda_subr.c \ - coda_venus.c coda_vfsops.c coda_vnops.c + coda_venus.c coda_vfsops.c coda_vnops.c opt_devfs.h vcoda.h NOMAN= VFS_KLD= +CLEANFILES+= vcoda.h opt_devfs.h + +opt_devfs.h: + touch opt_devfs.h + +vcoda.h: + echo "#define NVCODA 4" > vcoda.h + .include <bsd.kmod.mk> |
