Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/nathanw_sa]: src/sys/fs With with HEAD.



details:   https://anonhg.NetBSD.org/src/rev/a68785abf694
branches:  nathanw_sa
changeset: 506627:a68785abf694
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Dec 29 19:55:23 2002 +0000

description:
With with HEAD.

diffstat:

 sys/fs/Makefile                     |     4 +-
 sys/fs/adosfs/Makefile              |     7 +
 sys/fs/adosfs/adlookup.c            |   276 ++++
 sys/fs/adosfs/adosfs.h              |   173 ++
 sys/fs/adosfs/adutil.c              |   259 ++++
 sys/fs/adosfs/advfsops.c            |   876 ++++++++++++++
 sys/fs/adosfs/advnops.c             |   956 ++++++++++++++++
 sys/fs/adosfs/files.adosfs          |     8 +
 sys/fs/cd9660/Makefile              |     8 +
 sys/fs/cd9660/TODO                  |    47 +
 sys/fs/cd9660/TODO.hibler           |    13 +
 sys/fs/cd9660/cd9660_bmap.c         |   109 +
 sys/fs/cd9660/cd9660_extern.h       |   115 +
 sys/fs/cd9660/cd9660_lookup.c       |   470 +++++++
 sys/fs/cd9660/cd9660_mount.h        |    59 +
 sys/fs/cd9660/cd9660_node.c         |   547 +++++++++
 sys/fs/cd9660/cd9660_node.h         |   153 ++
 sys/fs/cd9660/cd9660_rrip.c         |   745 ++++++++++++
 sys/fs/cd9660/cd9660_rrip.h         |   142 ++
 sys/fs/cd9660/cd9660_util.c         |   194 +++
 sys/fs/cd9660/cd9660_vfsops.c       |  1009 ++++++++++++++++
 sys/fs/cd9660/cd9660_vnops.c        |  1064 +++++++++++++++++
 sys/fs/cd9660/files.cd9660          |    11 +
 sys/fs/cd9660/iso.h                 |   301 +++++
 sys/fs/cd9660/iso_rrip.h            |    85 +
 sys/fs/filecorefs/Makefile          |     7 +
 sys/fs/filecorefs/filecore.h        |   119 ++
 sys/fs/filecorefs/filecore_bmap.c   |   256 ++++
 sys/fs/filecorefs/filecore_extern.h |    99 +
 sys/fs/filecorefs/filecore_lookup.c |   311 +++++
 sys/fs/filecorefs/filecore_mount.h  |    59 +
 sys/fs/filecorefs/filecore_node.c   |   247 ++++
 sys/fs/filecorefs/filecore_node.h   |   114 +
 sys/fs/filecorefs/filecore_utils.c  |   335 +++++
 sys/fs/filecorefs/filecore_vfsops.c |   724 ++++++++++++
 sys/fs/filecorefs/filecore_vnops.c  |   582 +++++++++
 sys/fs/filecorefs/files.filecorefs  |    10 +
 sys/fs/msdosfs/Makefile             |     7 +
 sys/fs/msdosfs/TODO                 |     8 +
 sys/fs/msdosfs/bootsect.h           |   112 +
 sys/fs/msdosfs/bpb.h                |   208 +++
 sys/fs/msdosfs/denode.h             |   310 +++++
 sys/fs/msdosfs/direntry.h           |   135 ++
 sys/fs/msdosfs/fat.h                |   116 +
 sys/fs/msdosfs/files.msdosfs        |    10 +
 sys/fs/msdosfs/msdosfs_conv.c       |   856 ++++++++++++++
 sys/fs/msdosfs/msdosfs_denode.c     |   682 +++++++++++
 sys/fs/msdosfs/msdosfs_fat.c        |  1076 ++++++++++++++++++
 sys/fs/msdosfs/msdosfs_lookup.c     |  1192 ++++++++++++++++++++
 sys/fs/msdosfs/msdosfs_vfsops.c     |  1033 +++++++++++++++++
 sys/fs/msdosfs/msdosfs_vnops.c      |  1894 +++++++++++++++++++++++++++++++
 sys/fs/msdosfs/msdosfsmount.h       |   218 +++
 sys/fs/ntfs/Makefile                |     7 +
 sys/fs/ntfs/TODO                    |    38 +
 sys/fs/ntfs/files.ntfs              |    12 +
 sys/fs/ntfs/ntfs.h                  |   340 +++++
 sys/fs/ntfs/ntfs_compr.c            |   123 ++
 sys/fs/ntfs/ntfs_compr.h            |    35 +
 sys/fs/ntfs/ntfs_conv.c             |   173 ++
 sys/fs/ntfs/ntfs_ihash.c            |   174 ++
 sys/fs/ntfs/ntfs_ihash.h            |    38 +
 sys/fs/ntfs/ntfs_inode.h            |   126 ++
 sys/fs/ntfs/ntfs_subr.c             |  2081 +++++++++++++++++++++++++++++++++++
 sys/fs/ntfs/ntfs_subr.h             |   109 +
 sys/fs/ntfs/ntfs_vfsops.c           |  1087 ++++++++++++++++++
 sys/fs/ntfs/ntfs_vfsops.h           |    39 +
 sys/fs/ntfs/ntfs_vnops.c            |   989 ++++++++++++++++
 sys/fs/ntfs/ntfsmount.h             |    44 +
 68 files changed, 23764 insertions(+), 2 deletions(-)

diffs (truncated from 24041 to 300 lines):

diff -r b5313a3e484a -r a68785abf694 sys/fs/Makefile
--- a/sys/fs/Makefile   Sun Dec 29 19:49:10 2002 +0000
+++ b/sys/fs/Makefile   Sun Dec 29 19:55:23 2002 +0000
@@ -1,5 +1,5 @@
-#      $NetBSD: Makefile,v 1.1.4.2 2002/02/28 04:14:41 nathanw Exp $
+#      $NetBSD: Makefile,v 1.1.4.3 2002/12/29 19:55:23 thorpej Exp $
 
-SUBDIR=        smbfs
+SUBDIR=        adosfs cd9660 filecorefs msdosfs ntfs smbfs
 
 .include <bsd.kinc.mk>
diff -r b5313a3e484a -r a68785abf694 sys/fs/adosfs/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/fs/adosfs/Makefile    Sun Dec 29 19:55:23 2002 +0000
@@ -0,0 +1,7 @@
+#      $NetBSD: Makefile,v 1.1.2.2 2002/12/29 19:55:24 thorpej Exp $
+
+INCSDIR= /usr/include/adosfs
+
+INCS=  adosfs.h
+
+.include <bsd.kinc.mk>
diff -r b5313a3e484a -r a68785abf694 sys/fs/adosfs/adlookup.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/fs/adosfs/adlookup.c  Sun Dec 29 19:55:23 2002 +0000
@@ -0,0 +1,276 @@
+/*     $NetBSD: adlookup.c,v 1.1.2.2 2002/12/29 19:55:25 thorpej Exp $ */
+
+/*
+ * Copyright (c) 1994 Christian E. Hopps
+ * Copyright (c) 1996 Matthias Scheler
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Christian E. Hopps.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: adlookup.c,v 1.1.2.2 2002/12/29 19:55:25 thorpej Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/vnode.h>
+#include <sys/namei.h>
+#include <sys/mount.h>
+#include <sys/time.h>
+#include <sys/queue.h>
+#include <fs/adosfs/adosfs.h>
+
+#ifdef ADOSFS_EXACTMATCH
+#define strmatch(s1, l1, s2, l2, i) \
+    ((l1) == (l2) && memcmp((s1), (s2), (l1)) == 0)
+#else
+#define strmatch(s1, l1, s2, l2, i) \
+    ((l1) == (l2) && adoscaseequ((s1), (s2), (l1), (i)))
+#endif
+
+/*
+ * adosfs lookup. enters with:
+ * pvp (parent vnode) referenced and locked.
+ * exit with:
+ *     target vp referenced and locked.
+ *     unlock pvp unless LOCKPARENT and at end of search.
+ * special cases:
+ *     pvp == vp, just ref pvp, pvp already holds a ref and lock from
+ *         caller, this will not occur with RENAME or CREATE.
+ *     LOOKUP always unlocks parent if last element. (not now!?!?)
+ */
+int
+adosfs_lookup(v)
+       void *v;
+{
+       struct vop_lookup_args /* {
+               struct vnode *a_dvp;
+               struct vnode **a_vpp;
+               struct componentname *a_cnp;
+       } */ *sp = v;
+       int nameiop, last, lockp, wantp, flags, error, nocache, i;
+       struct componentname *cnp;
+       struct vnode **vpp;     /* place to store result */
+       struct anode *ap;       /* anode to find */
+       struct vnode *vdp;      /* vnode of search dir */
+       struct anode *adp;      /* anode of search dir */
+       struct ucred *ucp;      /* lookup credentials */
+       u_long bn, plen, hval;
+       const u_char *pelt;
+
+#ifdef ADOSFS_DIAGNOSTIC
+       advopprint(sp);
+#endif
+       cnp = sp->a_cnp;
+       vdp = sp->a_dvp;
+       adp = VTOA(vdp);
+       vpp = sp->a_vpp;
+       *vpp = NULL;
+       ucp = cnp->cn_cred;
+       nameiop = cnp->cn_nameiop;
+       cnp->cn_flags &= ~PDIRUNLOCK;
+       flags = cnp->cn_flags;
+       last = flags & ISLASTCN;
+       lockp = flags & LOCKPARENT;
+       wantp = flags & (LOCKPARENT | WANTPARENT);
+       pelt = (const u_char *)cnp->cn_nameptr;
+       plen = cnp->cn_namelen;
+       nocache = 0;
+       
+       /* 
+        * Check accessiblity of directory.
+        */
+       if ((error = VOP_ACCESS(vdp, VEXEC, ucp, cnp->cn_proc)) != 0)
+               return (error);
+
+       if ((flags & ISLASTCN) && (vdp->v_mount->mnt_flag & MNT_RDONLY) &&
+           (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME))
+               return (EROFS);
+
+       /*
+        * Before tediously performing a linear scan of the directory,
+        * check the name cache to see if the directory/name pair
+        * we are looking for is known already.
+        */
+       if ((error = cache_lookup(vdp, vpp, cnp)) >= 0)
+               return (error);
+
+       /*
+        * fake a '.'
+        */
+       if (plen == 1 && pelt[0] == '.') {
+               /* see special cases in prologue. */
+               *vpp = vdp;
+               goto found;
+       }
+       /*
+        * fake a ".."
+        */
+       if (flags & ISDOTDOT) {
+               if (vdp->v_type == VDIR && (vdp->v_flag & VROOT)) 
+                       panic("adosfs .. attempted through root");
+               /*
+                * cannot get `..' while `vdp' is locked
+                * e.g. procA holds lock on `..' and waits for `vdp'
+                * we wait for `..' and hold lock on `vdp'. deadlock.
+                * becuase `vdp' may have been acheived through symlink
+                * fancy detection code that decreases the race
+                * window size is not reasonably possible.
+                *
+                * basically unlock the parent, try and lock the child (..)
+                * if that fails relock the parent (ignoring error) and 
+                * fail.  Otherwise we have the child (..) if this is the
+                * last and the caller requested LOCKPARENT, attempt to
+                * relock the parent.  If that fails unlock the child (..)
+                * and fail. Otherwise we have succeded.
+                * 
+                */
+               VOP_UNLOCK(vdp, 0); /* race */
+               cnp->cn_flags |= PDIRUNLOCK;
+               if ((error = VFS_VGET(vdp->v_mount, 
+                                     (ino_t)adp->pblock, vpp)) != 0) {
+                       if (vn_lock(vdp, LK_EXCLUSIVE | LK_RETRY) == 0)
+                               cnp->cn_flags &= ~PDIRUNLOCK;
+               } else if (last && lockp ) {
+                   if ((error = vn_lock(vdp, LK_EXCLUSIVE))) {
+                       vput(*vpp);
+                   } else {
+                       cnp->cn_flags &= ~PDIRUNLOCK;
+                   }
+               }
+               if (error) {
+                       *vpp = NULL;
+                       return (error);
+               }
+               goto found_lockdone;
+       }
+
+       /*
+        * hash the name and grab the first block in chain
+        * then walk the chain. if chain has not been fully
+        * walked before, track the count in `tabi'
+        */
+       hval = adoshash(pelt, plen, adp->ntabent, IS_INTER(adp->amp));
+       bn = adp->tab[hval];
+       i = min(adp->tabi[hval], 0);
+       while (bn != 0) {
+               if ((error = VFS_VGET(vdp->v_mount, (ino_t)bn, vpp)) != 0) {
+#ifdef ADOSFS_DIAGNOSTIC
+                       printf("[aget] %d)", error);
+#endif
+                       /* XXX check to unlock parent possibly? */
+                       return(error);
+               }
+               ap = VTOA(*vpp);
+               if (i <= 0) {
+                       if (--i < adp->tabi[hval])
+                               adp->tabi[hval] = i;    
+                       /*
+                        * last header in chain lock count down by
+                        * negating it to positive
+                        */
+                       if (ap->hashf == 0) {
+#ifdef DEBUG
+                               if (i != adp->tabi[hval])
+                                       panic("adlookup: wrong chain count");
+#endif
+                               adp->tabi[hval] = -adp->tabi[hval];
+                       }
+               }
+               if (strmatch(pelt, plen, ap->name, strlen(ap->name), 
+                   IS_INTER(adp->amp)))
+                       goto found;
+               bn = ap->hashf;
+               vput(*vpp);
+       }
+       *vpp = NULL;
+       /*
+        * not found
+        */
+       if ((nameiop == CREATE || nameiop == RENAME) && last) {
+
+               if (vdp->v_mount->mnt_flag & MNT_RDONLY)
+                       return (EROFS);
+
+               if ((error = VOP_ACCESS(vdp, VWRITE, ucp, cnp->cn_proc)) != 0) {
+#ifdef ADOSFS_DIAGNOSTIC
+                       printf("[VOP_ACCESS] %d)", error);
+#endif
+                       return (error);
+               }
+               if (lockp == 0) {
+                       VOP_UNLOCK(vdp, 0);
+                       cnp->cn_flags |= PDIRUNLOCK;
+               }
+               cnp->cn_nameiop |= SAVENAME;
+#ifdef ADOSFS_DIAGNOSTIC
+               printf("EJUSTRETURN)");
+#endif
+               return(EJUSTRETURN);
+       }
+       if ((cnp->cn_flags & MAKEENTRY) && nameiop != CREATE)
+               cache_enter(vdp, NULL, cnp);
+#ifdef ADOSFS_DIAGNOSTIC
+       printf("ENOENT)");
+#endif
+       return(ENOENT);
+
+found:
+       if (nameiop == DELETE && last)  {
+               if ((error = VOP_ACCESS(vdp, VWRITE, ucp, cnp->cn_proc)) != 0) {
+                       if (vdp != *vpp)
+                               vput(*vpp);
+                       *vpp = NULL;
+                       return (error);
+               }
+               nocache = 1;
+       } 
+       if (nameiop == RENAME && wantp && last) {
+               if (vdp == *vpp)
+                       return(EISDIR);
+               if ((error = VOP_ACCESS(vdp, VWRITE, ucp, cnp->cn_proc)) != 0) {
+                       vput(*vpp);
+                       *vpp = NULL;
+                       return (error);
+               }
+               cnp->cn_flags |= SAVENAME;
+               nocache = 1;
+       }
+       if (vdp == *vpp)
+               VREF(vdp);
+       else if (lockp == 0 || last == 0) {
+               VOP_UNLOCK(vdp, 0);
+               cnp->cn_flags |= PDIRUNLOCK;
+       }
+found_lockdone:
+       if ((cnp->cn_flags & MAKEENTRY) && nocache == 0)
+               cache_enter(vdp, *vpp, cnp);
+
+#ifdef ADOSFS_DIAGNOSTIC
+       printf("0)\n");
+#endif



Home | Main Index | Thread Index | Old Index