BSD 4_4_Lite2 release
[unix-history] / usr / src / sys / ufs / lfs / lfs_alloc.c
index 2641590..837d2ea 100644 (file)
@@ -1,10 +1,36 @@
 /*
 /*
- * Copyright (c) 1991, 1993
+ * Copyright (c) 1991, 1993, 1995
  *     The Regents of the University of California.  All rights reserved.
  *
  *     The Regents of the University of California.  All rights reserved.
  *
- * %sccs.include.redist.c%
+ * 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 the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
  *
  *
- *     @(#)lfs_alloc.c 8.4 (Berkeley) %G%
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ *
+ *     @(#)lfs_alloc.c 8.7 (Berkeley) 5/14/95
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -20,6 +46,7 @@
 #include <ufs/ufs/quota.h>
 #include <ufs/ufs/inode.h>
 #include <ufs/ufs/ufsmount.h>
 #include <ufs/ufs/quota.h>
 #include <ufs/ufs/inode.h>
 #include <ufs/ufs/ufsmount.h>
+#include <ufs/ufs/ufs_extern.h>
 
 #include <ufs/lfs/lfs.h>
 #include <ufs/lfs/lfs_extern.h>
 
 #include <ufs/lfs/lfs.h>
 #include <ufs/lfs/lfs_extern.h>
@@ -42,7 +69,7 @@ lfs_valloc(ap)
        struct ifile *ifp;
        struct inode *ip;
        struct vnode *vp;
        struct ifile *ifp;
        struct inode *ip;
        struct vnode *vp;
-       daddr_t blkno;
+       ufs_daddr_t blkno;
        ino_t new_ino;
        u_long i, max;
        int error;
        ino_t new_ino;
        u_long i, max;
        int error;
@@ -69,7 +96,7 @@ lfs_valloc(ap)
                vp = fs->lfs_ivnode;
                ip = VTOI(vp);
                blkno = lblkno(fs, ip->i_size);
                vp = fs->lfs_ivnode;
                ip = VTOI(vp);
                blkno = lblkno(fs, ip->i_size);
-               lfs_balloc(vp, fs->lfs_bsize, blkno, &bp);
+               lfs_balloc(vp, 0, fs->lfs_bsize, blkno, &bp);
                ip->i_size += fs->lfs_bsize;
                vnode_pager_setsize(vp, (u_long)ip->i_size);
                vnode_pager_uncache(vp);
                ip->i_size += fs->lfs_bsize;
                vnode_pager_setsize(vp, (u_long)ip->i_size);
                vnode_pager_uncache(vp);
@@ -146,14 +173,13 @@ lfs_vcreate(mp, ino, vpp)
 
        /* Initialize the inode. */
        MALLOC(ip, struct inode *, sizeof(struct inode), M_LFSNODE, M_WAITOK);
 
        /* Initialize the inode. */
        MALLOC(ip, struct inode *, sizeof(struct inode), M_LFSNODE, M_WAITOK);
+       lockinit(&ip->i_lock, PINOD, "lfsinode", 0, 0);
        (*vpp)->v_data = ip;
        ip->i_vnode = *vpp;
        ip->i_devvp = ump->um_devvp;
        ip->i_flag = IN_MODIFIED;
        ip->i_dev = ump->um_dev;
        ip->i_number = ip->i_din.di_inumber = ino;
        (*vpp)->v_data = ip;
        ip->i_vnode = *vpp;
        ip->i_devvp = ump->um_devvp;
        ip->i_flag = IN_MODIFIED;
        ip->i_dev = ump->um_dev;
        ip->i_number = ip->i_din.di_inumber = ino;
-ip->i_din.di_spare[0] = 0xdeadbeef;
-ip->i_din.di_spare[1] = 0xdeadbeef;
        ip->i_lfs = ump->um_lfs;
 #ifdef QUOTA
        for (i = 0; i < MAXQUOTAS; i++)
        ip->i_lfs = ump->um_lfs;
 #ifdef QUOTA
        for (i = 0; i < MAXQUOTAS; i++)
@@ -183,7 +209,7 @@ lfs_vfree(ap)
        struct ifile *ifp;
        struct inode *ip;
        struct lfs *fs;
        struct ifile *ifp;
        struct inode *ip;
        struct lfs *fs;
-       daddr_t old_iaddr;
+       ufs_daddr_t old_iaddr;
        ino_t ino;
 
        /* Get the inode number and file system. */
        ino_t ino;
 
        /* Get the inode number and file system. */