summaryrefslogtreecommitdiffstats
path: root/sys/ufs/ffs/ffs_inode.c
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1997-02-10 02:22:35 +0000
committerdyson <dyson@FreeBSD.org>1997-02-10 02:22:35 +0000
commit10f666af84d48e89e4e2960415c9b616fce4077f (patch)
tree88a944de263165091f0a18abeedbaaccec532407 /sys/ufs/ffs/ffs_inode.c
parent0960d7e91af3428ffba89b42228d82d8afaa0389 (diff)
downloadFreeBSD-src-10f666af84d48e89e4e2960415c9b616fce4077f.zip
FreeBSD-src-10f666af84d48e89e4e2960415c9b616fce4077f.tar.gz
This is the kernel Lite/2 commit. There are some requisite userland
changes, so don't expect to be able to run the kernel as-is (very well) without the appropriate Lite/2 userland changes. The system boots and can mount UFS filesystems. Untested: ext2fs, msdosfs, NFS Known problems: Incorrect Berkeley ID strings in some files. Mount_std mounts will not work until the getfsent library routine is changed. Reviewed by: various people Submitted by: Jeffery Hsu <hsu@freebsd.org>
Diffstat (limited to 'sys/ufs/ffs/ffs_inode.c')
-rw-r--r--sys/ufs/ffs/ffs_inode.c50
1 files changed, 23 insertions, 27 deletions
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c
index ba3e82a..f7af3f3 100644
--- a/sys/ufs/ffs/ffs_inode.c
+++ b/sys/ufs/ffs/ffs_inode.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)ffs_inode.c 8.5 (Berkeley) 12/30/93
+ * @(#)ffs_inode.c 8.13 (Berkeley) 4/21/95
* $FreeBSD$
*/
@@ -59,14 +59,8 @@
#include <ufs/ffs/fs.h>
#include <ufs/ffs/ffs_extern.h>
-static int ffs_indirtrunc __P((struct inode *, daddr_t, daddr_t, daddr_t, int,
- long *));
-
-int
-ffs_init()
-{
- return (ufs_init());
-}
+static int ffs_indirtrunc __P((struct inode *, ufs_daddr_t, ufs_daddr_t,
+ ufs_daddr_t, int, long *));
/*
* Update the access, modified, and inode change times as specified by the
@@ -115,15 +109,15 @@ ffs_update(ap)
*/
tv_sec = time.tv_sec;
if (ip->i_flag & IN_ACCESS)
- ip->i_atime.tv_sec =
+ ip->i_atime =
(ap->a_access == &time ? tv_sec : ap->a_access->tv_sec);
if (ip->i_flag & IN_UPDATE) {
- ip->i_mtime.tv_sec =
+ ip->i_mtime =
(ap->a_modify == &time ? tv_sec : ap->a_modify->tv_sec);
ip->i_modrev++;
}
if (ip->i_flag & IN_CHANGE)
- ip->i_ctime.tv_sec = tv_sec;
+ ip->i_ctime = tv_sec;
ip->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE);
fs = ip->i_fs;
/*
@@ -169,10 +163,10 @@ ffs_truncate(ap)
} */ *ap;
{
register struct vnode *ovp = ap->a_vp;
- register daddr_t lastblock;
+ ufs_daddr_t lastblock;
register struct inode *oip;
- daddr_t bn, lbn, lastiblock[NIADDR], indir_lbn[NIADDR];
- daddr_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR];
+ ufs_daddr_t bn, lbn, lastiblock[NIADDR], indir_lbn[NIADDR];
+ ufs_daddr_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR];
off_t length = ap->a_length;
register struct fs *fs;
struct buf *bp;
@@ -185,8 +179,10 @@ ffs_truncate(ap)
oip = VTOI(ovp);
fs = oip->i_fs;
- if (length < 0 || length > fs->fs_maxfilesize)
+ if (length < 0)
return (EINVAL);
+ if (length > fs->fs_maxfilesize)
+ return (EFBIG);
tv = time;
if (ovp->v_type == VLNK &&
(oip->i_size < ovp->v_mount->mnt_maxsymlinklen || oip->i_din.di_blocks == 0)) {
@@ -220,12 +216,12 @@ ffs_truncate(ap)
aflags = B_CLRBUF;
if (ap->a_flags & IO_SYNC)
aflags |= B_SYNC;
- vnode_pager_setsize(ovp, length);
error = ffs_balloc(oip, lbn, offset + 1, ap->a_cred,
&bp, aflags);
if (error)
return (error);
oip->i_size = length;
+ vnode_pager_setsize(ovp, length);
if (aflags & B_SYNC)
bwrite(bp);
else if (ovp->v_mount->mnt_flag & MNT_ASYNC)
@@ -264,6 +260,7 @@ ffs_truncate(ap)
else
bawrite(bp);
}
+ vnode_pager_setsize(ovp, length);
/*
* Calculate index into inode's block list of
* last direct and indirect blocks (if any)
@@ -413,17 +410,17 @@ done:
static int
ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
register struct inode *ip;
- daddr_t lbn, lastbn;
- daddr_t dbn;
+ ufs_daddr_t lbn, lastbn;
+ ufs_daddr_t dbn;
int level;
long *countp;
{
register int i;
struct buf *bp;
register struct fs *fs = ip->i_fs;
- register daddr_t *bap;
+ register ufs_daddr_t *bap;
struct vnode *vp;
- daddr_t *copy = NULL, nb, nlbn, last;
+ ufs_daddr_t *copy = NULL, nb, nlbn, last;
long blkcount, factor;
int nblocks, blocksreleased = 0;
int error = 0, allerror = 0;
@@ -466,12 +463,12 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
return (error);
}
- bap = (daddr_t *)bp->b_data;
+ bap = (ufs_daddr_t *)bp->b_data;
if (lastbn != -1) {
- MALLOC(copy, daddr_t *, fs->fs_bsize, M_TEMP, M_WAITOK);
+ MALLOC(copy, ufs_daddr_t *, fs->fs_bsize, M_TEMP, M_WAITOK);
bcopy((caddr_t)bap, (caddr_t)copy, (u_int)fs->fs_bsize);
bzero((caddr_t)&bap[last + 1],
- (u_int)(NINDIR(fs) - (last + 1)) * sizeof (daddr_t));
+ (u_int)(NINDIR(fs) - (last + 1)) * sizeof (ufs_daddr_t));
if ((vp->v_mount->mnt_flag & MNT_ASYNC) == 0) {
error = bwrite(bp);
if (error)
@@ -491,9 +488,8 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
if (nb == 0)
continue;
if (level > SINGLE) {
- error = ffs_indirtrunc(ip, nlbn,
- fsbtodb(fs, nb), (daddr_t)-1, level - 1, &blkcount);
- if (error)
+ if (error = ffs_indirtrunc(ip, nlbn, fsbtodb(fs, nb),
+ (ufs_daddr_t)-1, level - 1, &blkcount))
allerror = error;
blocksreleased += blkcount;
}
OpenPOWER on IntegriCloud