projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
BSD 4_4_Lite1 release
[unix-history]
/
usr
/
src
/
sys
/
ufs
/
lfs
/
lfs_syscalls.c
diff --git
a/usr/src/sys/ufs/lfs/lfs_syscalls.c
b/usr/src/sys/ufs/lfs/lfs_syscalls.c
index
c3d294b
..
666595e
100644
(file)
--- a/
usr/src/sys/ufs/lfs/lfs_syscalls.c
+++ b/
usr/src/sys/ufs/lfs/lfs_syscalls.c
@@
-1,5
+1,5
@@
/*-
/*-
- * Copyright (c) 1991, 1993
+ * Copyright (c) 1991, 1993
, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@
-30,7
+30,7
@@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)lfs_syscalls.c 8.
1 (Berkeley) 6/11/93
+ * @(#)lfs_syscalls.c 8.
5 (Berkeley) 4/20/94
*/
#include <sys/param.h>
*/
#include <sys/param.h>
@@
-78,7
+78,7
@@
struct buf *lfs_fakebuf __P((struct vnode *, int, size_t, caddr_t));
* -1/errno is return on error.
*/
struct lfs_markv_args {
* -1/errno is return on error.
*/
struct lfs_markv_args {
- fsid_t
fsid;
/* file system */
+ fsid_t
*fsidp;
/* file system */
BLOCK_INFO *blkiov; /* block array */
int blkcnt; /* count of block array entries */
};
BLOCK_INFO *blkiov; /* block array */
int blkcnt; /* count of block array entries */
};
@@
-96,6
+96,7
@@
lfs_markv(p, uap, retval)
struct lfs *fs;
struct mount *mntp;
struct vnode *vp;
struct lfs *fs;
struct mount *mntp;
struct vnode *vp;
+ fsid_t fsid;
void *start;
ino_t lastino;
daddr_t b_daddr, v_daddr;
void *start;
ino_t lastino;
daddr_t b_daddr, v_daddr;
@@
-104,7
+105,10
@@
lfs_markv(p, uap, retval)
if (error = suser(p->p_ucred, &p->p_acflag))
return (error);
if (error = suser(p->p_ucred, &p->p_acflag))
return (error);
- if ((mntp = getvfs(&uap->fsid)) == NULL)
+
+ if (error = copyin(uap->fsidp, &fsid, sizeof(fsid_t)))
+ return (error);
+ if ((mntp = getvfs(&fsid)) == NULL)
return (EINVAL);
cnt = uap->blkcnt;
return (EINVAL);
cnt = uap->blkcnt;
@@
-128,17
+132,17
@@
lfs_markv(p, uap, retval)
if (lastino != blkp->bi_inode) {
if (lastino != LFS_UNUSED_INUM) {
/* Finish up last file */
if (lastino != blkp->bi_inode) {
if (lastino != LFS_UNUSED_INUM) {
/* Finish up last file */
- lfs_updatemeta(sp);
- lfs_writeinode(fs, sp, ip);
- lfs_vunref(vp);
- if (sp->fip->fi_nblocks)
- BUMP_FIP(sp);
- else {
+ if (sp->fip->fi_nblocks == 0) {
DEC_FINFO(sp);
sp->sum_bytes_left +=
DEC_FINFO(sp);
sp->sum_bytes_left +=
- sizeof(FINFO) - sizeof(daddr_t);
-
+ sizeof(FINFO) - sizeof(daddr_t);
+ } else {
+ lfs_updatemeta(sp);
+ BUMP_FIP(sp);
}
}
+
+ lfs_writeinode(fs, sp, ip);
+ lfs_vunref(vp);
}
/* Start a new file */
}
/* Start a new file */
@@
-197,7
+201,7
@@
lfs_markv(p, uap, retval)
else {
bp = getblk(vp, blkp->bi_lbn, bsize, 0, 0);
if (!(bp->b_flags & (B_DELWRI | B_DONE | B_CACHE)) &&
else {
bp = getblk(vp, blkp->bi_lbn, bsize, 0, 0);
if (!(bp->b_flags & (B_DELWRI | B_DONE | B_CACHE)) &&
- (error = copyin(blkp->bi_bp, bp->b_
un.b_addr
,
+ (error = copyin(blkp->bi_bp, bp->b_
data
,
bsize)))
goto err2;
if (error = VOP_BWRITE(bp))
bsize)))
goto err2;
if (error = VOP_BWRITE(bp))
@@
-206,20
+210,24
@@
lfs_markv(p, uap, retval)
while (lfs_gatherblock(sp, bp, NULL));
}
if (sp->vp) {
while (lfs_gatherblock(sp, bp, NULL));
}
if (sp->vp) {
- lfs_updatemeta(sp);
+ if (sp->fip->fi_nblocks == 0) {
+ DEC_FINFO(sp);
+ sp->sum_bytes_left +=
+ sizeof(FINFO) - sizeof(daddr_t);
+ } else
+ lfs_updatemeta(sp);
+
lfs_writeinode(fs, sp, ip);
lfs_vunref(vp);
lfs_writeinode(fs, sp, ip);
lfs_vunref(vp);
- if (!sp->fip->fi_nblocks) {
- DEC_FINFO(sp);
- sp->sum_bytes_left += sizeof(FINFO) - sizeof(daddr_t);
- }
}
(void) lfs_writeseg(fs, sp);
lfs_segunlock(fs);
free(start, M_SEGMENT);
return (error);
}
(void) lfs_writeseg(fs, sp);
lfs_segunlock(fs);
free(start, M_SEGMENT);
return (error);
+
/*
/*
- * XXX If we come in to error 2, we might have indirect blocks that were
+ * XXX
+ * If we come in to error 2, we might have indirect blocks that were
* updated and now have bad block pointers. I don't know what to do
* about this.
*/
* updated and now have bad block pointers. I don't know what to do
* about this.
*/
@@
-233,9
+241,9
@@
err2: lfs_vunref(vp);
} else
brelse(*bpp);
lfs_segunlock(fs);
} else
brelse(*bpp);
lfs_segunlock(fs);
-err1:
+err1:
free(start, M_SEGMENT);
free(start, M_SEGMENT);
- return(error);
+ return
(error);
}
/*
}
/*
@@
-247,7
+255,7
@@
err1:
* -1/errno is return on error.
*/
struct lfs_bmapv_args {
* -1/errno is return on error.
*/
struct lfs_bmapv_args {
- fsid_t
fsid;
/* file system */
+ fsid_t
*fsidp;
/* file system */
BLOCK_INFO *blkiov; /* block array */
int blkcnt; /* count of block array entries */
};
BLOCK_INFO *blkiov; /* block array */
int blkcnt; /* count of block array entries */
};
@@
-260,13
+268,17
@@
lfs_bmapv(p, uap, retval)
BLOCK_INFO *blkp;
struct mount *mntp;
struct vnode *vp;
BLOCK_INFO *blkp;
struct mount *mntp;
struct vnode *vp;
+ fsid_t fsid;
void *start;
daddr_t daddr;
int cnt, error, step;
if (error = suser(p->p_ucred, &p->p_acflag))
return (error);
void *start;
daddr_t daddr;
int cnt, error, step;
if (error = suser(p->p_ucred, &p->p_acflag))
return (error);
- if ((mntp = getvfs(&uap->fsid)) == NULL)
+
+ if (error = copyin(uap->fsidp, &fsid, sizeof(fsid_t)))
+ return (error);
+ if ((mntp = getvfs(&fsid)) == NULL)
return (EINVAL);
cnt = uap->blkcnt;
return (EINVAL);
cnt = uap->blkcnt;
@@
-303,7
+315,7
@@
lfs_bmapv(p, uap, retval)
* -1/errno is return on error.
*/
struct lfs_segclean_args {
* -1/errno is return on error.
*/
struct lfs_segclean_args {
- fsid_t
fsid;
/* file system */
+ fsid_t
*fsidp;
/* file system */
u_long segment; /* segment number */
};
int
u_long segment; /* segment number */
};
int
@@
-317,11
+329,15
@@
lfs_segclean(p, uap, retval)
struct buf *bp;
struct mount *mntp;
struct lfs *fs;
struct buf *bp;
struct mount *mntp;
struct lfs *fs;
+ fsid_t fsid;
int error;
if (error = suser(p->p_ucred, &p->p_acflag))
return (error);
int error;
if (error = suser(p->p_ucred, &p->p_acflag))
return (error);
- if ((mntp = getvfs(&uap->fsid)) == NULL)
+
+ if (error = copyin(uap->fsidp, &fsid, sizeof(fsid_t)))
+ return (error);
+ if ((mntp = getvfs(&fsid)) == NULL)
return (EINVAL);
fs = VFSTOUFS(mntp)->um_lfs;
return (EINVAL);
fs = VFSTOUFS(mntp)->um_lfs;
@@
-332,7
+348,7
@@
lfs_segclean(p, uap, retval)
LFS_SEGENTRY(sup, fs, uap->segment, bp);
if (sup->su_flags & SEGUSE_ACTIVE) {
brelse(bp);
LFS_SEGENTRY(sup, fs, uap->segment, bp);
if (sup->su_flags & SEGUSE_ACTIVE) {
brelse(bp);
- return(EBUSY);
+ return
(EBUSY);
}
fs->lfs_avail += fsbtodb(fs, fs->lfs_ssize) - 1;
fs->lfs_bfree += (sup->su_nsums * LFS_SUMMARY_SIZE / DEV_BSIZE) +
}
fs->lfs_avail += fsbtodb(fs, fs->lfs_ssize) - 1;
fs->lfs_bfree += (sup->su_nsums * LFS_SUMMARY_SIZE / DEV_BSIZE) +
@@
-360,7
+376,7
@@
lfs_segclean(p, uap, retval)
* -1/errno is return on error.
*/
struct lfs_segwait_args {
* -1/errno is return on error.
*/
struct lfs_segwait_args {
- fsid_t
fsid;
/* file system */
+ fsid_t
*fsidp;
/* file system */
struct timeval *tv; /* timeout */
};
int
struct timeval *tv; /* timeout */
};
int
@@
-372,6
+388,7
@@
lfs_segwait(p, uap, retval)
extern int lfs_allclean_wakeup;
struct mount *mntp;
struct timeval atv;
extern int lfs_allclean_wakeup;
struct mount *mntp;
struct timeval atv;
+ fsid_t fsid;
void *addr;
u_long timeout;
int error, s;
void *addr;
u_long timeout;
int error, s;
@@
-380,15
+397,19
@@
lfs_segwait(p, uap, retval)
return (error);
}
#ifdef WHEN_QUADS_WORK
return (error);
}
#ifdef WHEN_QUADS_WORK
- if (uap->fsid == (fsid_t)-1)
+ if (error = copyin(uap->fsidp, &fsid, sizeof(fsid_t)))
+ return (error);
+ if (fsid == (fsid_t)-1)
addr = &lfs_allclean_wakeup;
else {
addr = &lfs_allclean_wakeup;
else {
- if ((mntp = getvfs(&
uap->
fsid)) == NULL)
+ if ((mntp = getvfs(&fsid)) == NULL)
return (EINVAL);
addr = &VFSTOUFS(mntp)->um_lfs->lfs_nextseg;
}
#else
return (EINVAL);
addr = &VFSTOUFS(mntp)->um_lfs->lfs_nextseg;
}
#else
- if ((mntp = getvfs(&uap->fsid)) == NULL)
+ if (error = copyin(uap->fsidp, &fsid, sizeof(fsid_t)))
+ return (error);
+ if ((mntp = getvfs(&fsid)) == NULL)
addr = &lfs_allclean_wakeup;
else
addr = &VFSTOUFS(mntp)->um_lfs->lfs_nextseg;
addr = &lfs_allclean_wakeup;
else
addr = &VFSTOUFS(mntp)->um_lfs->lfs_nextseg;
@@
-443,13
+464,13
@@
lfs_fastvget(mp, ino, daddr, vpp, dinp)
if ((*vpp)->v_flag & VXLOCK)
printf ("Cleaned vnode VXLOCKED\n");
ip = VTOI(*vpp);
if ((*vpp)->v_flag & VXLOCK)
printf ("Cleaned vnode VXLOCKED\n");
ip = VTOI(*vpp);
- if (ip->i_flags & ILOCKED)
- printf
("Cleaned vnode ILOCKED
\n");
- if (!(ip->i_flag & I
MO
D)) {
+ if (ip->i_flags & I
N_
LOCKED)
+ printf
("cleaned vnode locked
\n");
+ if (!(ip->i_flag & I
N_MODIFIE
D)) {
++ump->um_lfs->lfs_uinodes;
++ump->um_lfs->lfs_uinodes;
- ip->i_flag |= I
MO
D;
+ ip->i_flag |= I
N_MODIFIE
D;
}
}
- ip->i_flag |= I
MO
D;
+ ip->i_flag |= I
N_MODIFIE
D;
return (0);
}
return (0);
}
@@
-496,12
+517,13
@@
lfs_fastvget(mp, ino, daddr, vpp, dinp)
*vpp = NULL;
return (error);
}
*vpp = NULL;
return (error);
}
- ip->i_din = *lfs_ifind(ump->um_lfs, ino, bp->b_un.b_dino);
+ ip->i_din =
+ *lfs_ifind(ump->um_lfs, ino, (struct dinode *)bp->b_data);
brelse(bp);
}
/* Inode was just read from user space or disk, make sure it's locked */
brelse(bp);
}
/* Inode was just read from user space or disk, make sure it's locked */
- ip->i_flag |= ILOCKED;
+ ip->i_flag |= I
N_
LOCKED;
/*
* Initialize the vnode from the inode, check for aliases. In all
/*
* Initialize the vnode from the inode, check for aliases. In all
@@
-516,7
+538,7
@@
lfs_fastvget(mp, ino, daddr, vpp, dinp)
* Finish inode initialization now that aliasing has been resolved.
*/
ip->i_devvp = ump->um_devvp;
* Finish inode initialization now that aliasing has been resolved.
*/
ip->i_devvp = ump->um_devvp;
- ip->i_flag |= I
MO
D;
+ ip->i_flag |= I
N_MODIFIE
D;
++ump->um_lfs->lfs_uinodes;
VREF(ip->i_devvp);
*vpp = vp;
++ump->um_lfs->lfs_uinodes;
VREF(ip->i_devvp);
*vpp = vp;
@@
-536,5
+558,5
@@
lfs_fakebuf(vp, lbn, size, uaddr)
bp->b_bufsize = size;
bp->b_bcount = size;
bp->b_flags |= B_INVAL;
bp->b_bufsize = size;
bp->b_bcount = size;
bp->b_flags |= B_INVAL;
- return(bp);
+ return
(bp);
}
}