diff options
-rw-r--r-- | sys/ufs/ufs/ufs_quota.c | 107 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_readwrite.c | 26 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_vfsops.c | 33 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_vnops.c | 135 |
4 files changed, 101 insertions, 200 deletions
diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c index 50015f51ab3..a87d2f23aed 100644 --- a/sys/ufs/ufs/ufs_quota.c +++ b/sys/ufs/ufs/ufs_quota.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_quota.c,v 1.19 2005/07/03 20:14:03 drahn Exp $ */ +/* $OpenBSD: ufs_quota.c,v 1.20 2005/11/11 16:27:52 pedro Exp $ */ /* $NetBSD: ufs_quota.c,v 1.8 1996/02/09 22:36:09 christos Exp $ */ /* @@ -34,6 +34,7 @@ * * @(#)ufs_quota.c 8.5 (Berkeley) 8/19/94 */ + #include <sys/param.h> #include <sys/kernel.h> #include <sys/systm.h> @@ -69,6 +70,7 @@ struct dquot { struct ucred *dq_cred; /* credentials for writing file */ struct dqblk dq_dqb; /* actual usage & quotas */ }; + /* * Flag values. */ @@ -78,6 +80,7 @@ struct dquot { #define DQ_FAKE 0x08 /* no limits here, just usage */ #define DQ_BLKS 0x10 /* has been warned about blk limit */ #define DQ_INODS 0x20 /* has been warned about inode limit */ + /* * Shorthand notation. */ @@ -129,14 +132,11 @@ static char *quotatypes[] = INITQFNAMES; * Obtain a reference to a dquot. */ void -dqref(dq) - struct dquot *dq; +dqref(struct dquot *dq) { - dq->dq_cnt++; } - /* * Set up the quotas for an inode. * @@ -146,8 +146,7 @@ dqref(dq) * additional dquots set up here. */ int -getinoquota(ip) - struct inode *ip; +getinoquota(struct inode *ip) { struct ufsmount *ump; struct vnode *vp = ITOV(ip); @@ -180,7 +179,8 @@ getinoquota(ip) */ int ufs_quota_alloc_blocks2(struct inode *ip, int32_t change, - struct ucred *cred, enum ufs_quota_flags flags) { + struct ucred *cred, enum ufs_quota_flags flags) +{ struct dquot *dq; int i; int error; @@ -220,7 +220,8 @@ ufs_quota_alloc_blocks2(struct inode *ip, int32_t change, int ufs_quota_free_blocks2(struct inode *ip, int32_t change, - struct ucred *cred, enum ufs_quota_flags flags) { + struct ucred *cred, enum ufs_quota_flags flags) +{ struct dquot *dq; int i; @@ -256,11 +257,7 @@ ufs_quota_free_blocks2(struct inode *ip, int32_t change, * Issue an error message if appropriate. */ int -chkdqchg(ip, change, cred, type) - struct inode *ip; - long change; - struct ucred *cred; - int type; +chkdqchg(struct inode *ip, long change, struct ucred *cred, int type) { struct dquot *dq = ip->i_dquot[type]; long ncurblocks = dq->dq_curblocks + change; @@ -312,7 +309,8 @@ chkdqchg(ip, change, cred, type) */ int ufs_quota_alloc_inode2(struct inode *ip, struct ucred *cred, - enum ufs_quota_flags flags) { + enum ufs_quota_flags flags) +{ struct dquot *dq; int i; int error; @@ -348,7 +346,8 @@ ufs_quota_alloc_inode2(struct inode *ip, struct ucred *cred, int ufs_quota_free_inode2(struct inode *ip, struct ucred *cred, - enum ufs_quota_flags flags) { + enum ufs_quota_flags flags) +{ struct dquot *dq; int i; @@ -379,11 +378,7 @@ ufs_quota_free_inode2(struct inode *ip, struct ucred *cred, * Issue an error message if appropriate. */ int -chkiqchg(ip, change, cred, type) - struct inode *ip; - long change; - struct ucred *cred; - int type; +chkiqchg(struct inode *ip, long change, struct ucred *cred, int type) { struct dquot *dq = ip->i_dquot[type]; long ncurinodes = dq->dq_curinodes + change; @@ -436,8 +431,7 @@ chkiqchg(ip, change, cred, type) * size and not to have a dquot structure associated with it. */ void -chkdquot(ip) - struct inode *ip; +chkdquot(struct inode *ip) { struct ufsmount *ump = ip->i_ump; int i; @@ -487,11 +481,7 @@ quotaon_vnode(struct vnode *vp, void *arg) * Q_QUOTAON - set up a quota file for a particular file system. */ int -quotaon(p, mp, type, fname) - struct proc *p; - struct mount *mp; - int type; - caddr_t fname; +quotaon(struct proc *p, struct mount *mp, int type, caddr_t fname) { struct ufsmount *ump = VFSTOUFS(mp); struct vnode *vp, **vpp; @@ -579,10 +569,7 @@ quotaoff_vnode(struct vnode *vp, void *arg) * Q_QUOTAOFF - turn off disk quotas for a filesystem. */ int -quotaoff(p, mp, type) - struct proc *p; - struct mount *mp; - int type; +quotaoff(struct proc *p, struct mount *mp, int type) { struct vnode *qvp; struct ufsmount *ump = VFSTOUFS(mp); @@ -621,11 +608,7 @@ quotaoff(p, mp, type) * Q_GETQUOTA - return current values in a dqblk structure. */ int -getquota(mp, id, type, addr) - struct mount *mp; - u_long id; - int type; - caddr_t addr; +getquota(struct mount *mp, u_long id, int type, caddr_t addr) { struct dquot *dq; int error; @@ -641,11 +624,7 @@ getquota(mp, id, type, addr) * Q_SETQUOTA - assign an entire dqblk structure. */ int -setquota(mp, id, type, addr) - struct mount *mp; - u_long id; - int type; - caddr_t addr; +setquota(struct mount *mp, u_long id, int type, caddr_t addr) { struct dquot *dq; struct dquot *ndq; @@ -701,11 +680,7 @@ setquota(mp, id, type, addr) * Q_SETUSE - set current inode and block usage. */ int -setuse(mp, id, type, addr) - struct mount *mp; - u_long id; - int type; - caddr_t addr; +setuse(struct mount *mp, u_long id, int type, caddr_t addr) { struct dquot *dq; struct ufsmount *ump = VFSTOUFS(mp); @@ -744,10 +719,9 @@ setuse(mp, id, type, addr) return (0); } - - int -qsync_vnode(struct vnode *vp, void *arg) { +qsync_vnode(struct vnode *vp, void *arg) +{ int i; struct proc *p = curproc; struct dquot *dq; @@ -773,8 +747,7 @@ qsync_vnode(struct vnode *vp, void *arg) { * Q_SYNC - sync quota files to disk. */ int -qsync(mp) - struct mount *mp; +qsync(struct mount *mp) { struct ufsmount *ump = VFSTOUFS(mp); int i; @@ -815,9 +788,8 @@ long numdquot, desireddquot = DQUOTINC; * Initialize the quota system. */ void -ufs_quota_init() +ufs_quota_init(void) { - dqhashtbl = hashinit(desiredvnodes, M_DQUOT, M_WAITOK, &dqhash); TAILQ_INIT(&dqfreelist); } @@ -827,12 +799,8 @@ ufs_quota_init() * reading the information from the file if necessary. */ int -dqget(vp, id, ump, type, dqp) - struct vnode *vp; - u_long id; - struct ufsmount *ump; - int type; - struct dquot **dqp; +dqget(struct vnode *vp, u_long id, struct ufsmount *ump, int type, + struct dquot **dqp) { struct proc *p = curproc; struct dquot *dq; @@ -949,9 +917,7 @@ dqget(vp, id, ump, type, dqp) * Release a reference to a dquot. */ void -dqrele(vp, dq) - struct vnode *vp; - struct dquot *dq; +dqrele(struct vnode *vp, struct dquot *dq) { if (dq == NODQUOT) @@ -971,9 +937,7 @@ dqrele(vp, dq) * Update the disk quota in the quota file. */ int -dqsync(vp, dq) - struct vnode *vp; - struct dquot *dq; +dqsync(struct vnode *vp, struct dquot *dq) { struct proc *p = curproc; struct vnode *dqvp; @@ -1021,7 +985,8 @@ dqsync(vp, dq) } int -ufs_quota_delete(struct inode *ip) { +ufs_quota_delete(struct inode *ip) +{ struct vnode *vp = ITOV(ip); int i; for (i = 0; i < MAXQUOTAS; i++) { @@ -1038,12 +1003,8 @@ ufs_quota_delete(struct inode *ip) { * Do operations associated with quotas */ int -ufs_quotactl(mp, cmds, uid, arg, p) - struct mount *mp; - int cmds; - uid_t uid; - caddr_t arg; - struct proc *p; +ufs_quotactl(struct mount *mp, int cmds, uid_t uid, caddr_t arg, + struct proc *p) { int cmd, type, error; diff --git a/sys/ufs/ufs/ufs_readwrite.c b/sys/ufs/ufs/ufs_readwrite.c index f1aa4821891..69ba26d4d75 100644 --- a/sys/ufs/ufs/ufs_readwrite.c +++ b/sys/ufs/ufs/ufs_readwrite.c @@ -1,7 +1,7 @@ -/* $OpenBSD: ufs_readwrite.c,v 1.26 2004/07/13 21:04:29 millert Exp $ */ +/* $OpenBSD: ufs_readwrite.c,v 1.27 2005/11/11 16:27:52 pedro Exp $ */ /* $NetBSD: ufs_readwrite.c,v 1.9 1996/05/11 18:27:57 mycroft Exp $ */ -/*- +/* * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. * @@ -63,8 +63,7 @@ */ /* ARGSUSED */ int -READ(v) - void *v; +READ(void *v) { struct vop_read_args /* { struct vnode *a_vp; @@ -72,10 +71,10 @@ READ(v) int a_ioflag; struct ucred *a_cred; } */ *ap = v; - register struct vnode *vp; - register struct inode *ip; - register struct uio *uio; - register FS *fs; + struct vnode *vp; + struct inode *ip; + struct uio *uio; + FS *fs; struct buf *bp; daddr_t lbn, nextlbn; off_t bytesinfile; @@ -170,8 +169,7 @@ READ(v) * Vnode op for writing. */ int -WRITE(v) - void *v; +WRITE(void *v) { struct vop_write_args /* { struct vnode *a_vp; @@ -179,10 +177,10 @@ WRITE(v) int a_ioflag; struct ucred *a_cred; } */ *ap = v; - register struct vnode *vp; - register struct uio *uio; - register struct inode *ip; - register FS *fs; + struct vnode *vp; + struct uio *uio; + struct inode *ip; + FS *fs; struct buf *bp; struct proc *p; daddr_t lbn; diff --git a/sys/ufs/ufs/ufs_vfsops.c b/sys/ufs/ufs/ufs_vfsops.c index 4d60cc4ba96..99148f9da88 100644 --- a/sys/ufs/ufs/ufs_vfsops.c +++ b/sys/ufs/ufs/ufs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_vfsops.c,v 1.12 2005/07/03 20:14:03 drahn Exp $ */ +/* $OpenBSD: ufs_vfsops.c,v 1.13 2005/11/11 16:27:52 pedro Exp $ */ /* $NetBSD: ufs_vfsops.c,v 1.4 1996/02/09 22:36:12 christos Exp $ */ /* @@ -62,12 +62,8 @@ */ /* ARGSUSED */ int -ufs_start(mp, flags, p) - struct mount *mp; - int flags; - struct proc *p; +ufs_start(struct mount *mp, int flags, struct proc *p) { - return (0); } @@ -75,9 +71,7 @@ ufs_start(mp, flags, p) * Return the root of a filesystem. */ int -ufs_root(mp, vpp) - struct mount *mp; - struct vnode **vpp; +ufs_root(struct mount *mp, struct vnode **vpp) { struct vnode *nvp; int error; @@ -93,14 +87,11 @@ ufs_root(mp, vpp) * exflagsp and credanonp. */ int -ufs_check_export(mp, nam, exflagsp, credanonp) - register struct mount *mp; - struct mbuf *nam; - int *exflagsp; - struct ucred **credanonp; +ufs_check_export(struct mount *mp, struct mbuf *nam, int *exflagsp, + struct ucred **credanonp) { - register struct netcred *np; - register struct ufsmount *ump = VFSTOUFS(mp); + struct netcred *np; + struct ufsmount *ump = VFSTOUFS(mp); /* * Get the export permission structure for this <mp, client> tuple. @@ -118,8 +109,7 @@ ufs_check_export(mp, nam, exflagsp, credanonp) * Initial UFS filesystems, done only once. */ int -ufs_init(vfsp) - struct vfsconf *vfsp; +ufs_init(struct vfsconf *vfsp) { static int done; @@ -140,12 +130,9 @@ ufs_init(vfsp) * filesystem has validated the file handle. */ int -ufs_fhtovp(mp, ufhp, vpp) - register struct mount *mp; - struct ufid *ufhp; - struct vnode **vpp; +ufs_fhtovp(struct mount *mp, struct ufid *ufhp, struct vnode **vpp) { - register struct inode *ip; + struct inode *ip; struct vnode *nvp; int error; diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index ab463f59d38..a359abbc514 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_vnops.c,v 1.67 2005/07/24 05:43:36 millert Exp $ */ +/* $OpenBSD: ufs_vnops.c,v 1.68 2005/11/11 16:27:52 pedro Exp $ */ /* $NetBSD: ufs_vnops.c,v 1.18 1996/05/11 18:28:04 mycroft Exp $ */ /* @@ -73,15 +73,16 @@ static int ufs_chmod(struct vnode *, int, struct ucred *, struct proc *); static int ufs_chown(struct vnode *, uid_t, gid_t, struct ucred *, struct proc *); -int filt_ufsread(struct knote *kn, long hint); -int filt_ufswrite(struct knote *kn, long hint); -int filt_ufsvnode(struct knote *kn, long hint); -void filt_ufsdetach(struct knote *kn); +int filt_ufsread(struct knote *, long); +int filt_ufswrite(struct knote *, long); +int filt_ufsvnode(struct knote *, long); +void filt_ufsdetach(struct knote *); union _qcvt { int64_t qcvt; int32_t val[2]; }; + #define SETHIGH(q, h) { \ union _qcvt tmp; \ tmp.qcvt = (q); \ @@ -114,8 +115,7 @@ static struct odirtemplate omastertemplate = { * Create a regular file */ int -ufs_create(v) - void *v; +ufs_create(void *v) { struct vop_create_args /* { struct vnode *a_dvp; @@ -139,8 +139,7 @@ ufs_create(v) */ /* ARGSUSED */ int -ufs_mknod(v) - void *v; +ufs_mknod(void *v) { struct vop_mknod_args /* { struct vnode *a_dvp; @@ -186,8 +185,7 @@ ufs_mknod(v) */ /* ARGSUSED */ int -ufs_open(v) - void *v; +ufs_open(void *v) { struct vop_open_args /* { struct vnode *a_vp; @@ -217,8 +215,7 @@ ufs_open(v) */ /* ARGSUSED */ int -ufs_close(v) - void *v; +ufs_close(void *v) { struct vop_close_args /* { struct vnode *a_vp; @@ -241,8 +238,7 @@ ufs_close(v) } int -ufs_access(v) - void *v; +ufs_access(void *v) { struct vop_access_args /* { struct vnode *a_vp; @@ -292,8 +288,7 @@ ufs_access(v) /* ARGSUSED */ int -ufs_getattr(v) - void *v; +ufs_getattr(void *v) { struct vop_getattr_args /* { struct vnode *a_vp; @@ -344,8 +339,7 @@ ufs_getattr(v) * Set attribute vnode op. called from several syscalls */ int -ufs_setattr(v) - void *v; +ufs_setattr(void *v) { struct vop_setattr_args /* { struct vnode *a_vp; @@ -459,11 +453,7 @@ ufs_setattr(v) * Inode must be locked before calling. */ static int -ufs_chmod(vp, mode, cred, p) - struct vnode *vp; - int mode; - struct ucred *cred; - struct proc *p; +ufs_chmod(struct vnode *vp, int mode, struct ucred *cred, struct proc *p) { struct inode *ip = VTOI(vp); int error; @@ -490,12 +480,8 @@ ufs_chmod(vp, mode, cred, p) * inode must be locked prior to call. */ static int -ufs_chown(vp, uid, gid, cred, p) - struct vnode *vp; - uid_t uid; - gid_t gid; - struct ucred *cred; - struct proc *p; +ufs_chown(struct vnode *vp, uid_t uid, gid_t gid, struct ucred *cred, + struct proc *p) { struct inode *ip = VTOI(vp); uid_t ouid; @@ -579,8 +565,7 @@ error: /* ARGSUSED */ int -ufs_ioctl(v) - void *v; +ufs_ioctl(void *v) { #if 0 struct vop_ioctl_args /* { @@ -597,8 +582,7 @@ ufs_ioctl(v) /* ARGSUSED */ int -ufs_poll(v) - void *v; +ufs_poll(void *v) { struct vop_poll_args /* { struct vnode *a_vp; @@ -619,8 +603,7 @@ ufs_poll(v) */ /* ARGSUSED */ int -ufs_seek(v) - void *v; +ufs_seek(void *v) { #if 0 struct vop_seek_args /* { @@ -635,8 +618,7 @@ ufs_seek(v) } int -ufs_remove(v) - void *v; +ufs_remove(void *v) { struct vop_remove_args /* { struct vnode *a_dvp; @@ -670,8 +652,7 @@ ufs_remove(v) * link vnode call */ int -ufs_link(v) - void *v; +ufs_link(void *v) { struct vop_link_args /* { struct vnode *a_dvp; @@ -767,8 +748,7 @@ out2: * directory. */ int -ufs_rename(v) - void *v; +ufs_rename(void *v) { struct vop_rename_args /* { struct vnode *a_fdvp; @@ -1187,8 +1167,7 @@ out: * Mkdir system call */ int -ufs_mkdir(v) - void *v; +ufs_mkdir(void *v) { struct vop_mkdir_args /* { struct vnode *a_dvp; @@ -1343,8 +1322,7 @@ out: * Rmdir system call. */ int -ufs_rmdir(v) - void *v; +ufs_rmdir(void *v) { struct vop_rmdir_args /* { struct vnode *a_dvp; @@ -1449,8 +1427,7 @@ out: * symlink -- make a symbolic link */ int -ufs_symlink(v) - void *v; +ufs_symlink(void *v) { struct vop_symlink_args /* { struct vnode *a_dvp; @@ -1493,8 +1470,7 @@ ufs_symlink(v) * by <sys/dirent.h>. */ int -ufs_readdir(v) - void *v; +ufs_readdir(void *v) { struct vop_readdir_args /* { struct vnode *a_vp; @@ -1605,8 +1581,7 @@ ufs_readdir(v) * Return target name of a symbolic link */ int -ufs_readlink(v) - void *v; +ufs_readlink(void *v) { struct vop_readlink_args /* { struct vnode *a_vp; @@ -1630,8 +1605,7 @@ ufs_readlink(v) * Lock an inode. If its already locked, set the WANT bit and sleep. */ int -ufs_lock(v) - void *v; +ufs_lock(void *v) { struct vop_lock_args /* { struct vnode *a_vp; @@ -1648,8 +1622,7 @@ ufs_lock(v) * Unlock an inode. If WANT bit is on, wakeup. */ int -ufs_unlock(v) - void *v; +ufs_unlock(void *v) { struct vop_unlock_args /* { struct vnode *a_vp; @@ -1666,8 +1639,7 @@ ufs_unlock(v) * Check for a locked inode. */ int -ufs_islocked(v) - void *v; +ufs_islocked(void *v) { struct vop_islocked_args /* { struct vnode *a_vp; @@ -1681,8 +1653,7 @@ ufs_islocked(v) * then call the device strategy routine. */ int -ufs_strategy(v) - void *v; +ufs_strategy(void *v) { struct vop_strategy_args /* { struct buf *a_bp; @@ -1726,8 +1697,7 @@ ufs_strategy(v) * Print out the contents of an inode. */ int -ufs_print(v) - void *v; +ufs_print(void *v) { struct vop_print_args /* { struct vnode *a_vp; @@ -1755,8 +1725,7 @@ ufs_print(v) * Read wrapper for special devices. */ int -ufsspec_read(v) - void *v; +ufsspec_read(void *v) { struct vop_read_args /* { struct vnode *a_vp; @@ -1776,8 +1745,7 @@ ufsspec_read(v) * Write wrapper for special devices. */ int -ufsspec_write(v) - void *v; +ufsspec_write(void *v) { struct vop_write_args /* { struct vnode *a_vp; @@ -1799,8 +1767,7 @@ ufsspec_write(v) * Update the times on the inode then do device close. */ int -ufsspec_close(v) - void *v; +ufsspec_close(void *v) { struct vop_close_args /* { struct vnode *a_vp; @@ -1827,8 +1794,7 @@ ufsspec_close(v) * Read wrapper for fifo's */ int -ufsfifo_read(v) - void *v; +ufsfifo_read(void *v) { struct vop_read_args /* { struct vnode *a_vp; @@ -1849,8 +1815,7 @@ ufsfifo_read(v) * Write wrapper for fifo's. */ int -ufsfifo_write(v) - void *v; +ufsfifo_write(void *v) { struct vop_write_args /* { struct vnode *a_vp; @@ -1873,8 +1838,7 @@ ufsfifo_write(v) * Update the times on the inode then do device close. */ int -ufsfifo_close(v) - void *v; +ufsfifo_close(void *v) { struct vop_close_args /* { struct vnode *a_vp; @@ -1902,8 +1866,7 @@ ufsfifo_close(v) * Return POSIX pathconf information applicable to ufs filesystems. */ int -ufs_pathconf(v) - void *v; +ufs_pathconf(void *v) { struct vop_pathconf_args /* { struct vnode *a_vp; @@ -1940,8 +1903,7 @@ ufs_pathconf(v) * Advisory record locking support */ int -ufs_advlock(v) - void *v; +ufs_advlock(void *v) { struct vop_advlock_args /* { struct vnode *a_vp; @@ -1961,11 +1923,8 @@ ufs_advlock(v) * vnodes. */ int -ufs_vinit(mntp, specops, fifoops, vpp) - struct mount *mntp; - int (**specops)(void *); - int (**fifoops)(void *); - struct vnode **vpp; +ufs_vinit(struct mount *mntp, int (**specops)(void *), + int (**fifoops)(void *), struct vnode **vpp) { struct inode *ip; struct vnode *vp, *nvp; @@ -2029,11 +1988,8 @@ ufs_vinit(mntp, specops, fifoops, vpp) * Allocate a new inode. */ int -ufs_makeinode(mode, dvp, vpp, cnp) - int mode; - struct vnode *dvp; - struct vnode **vpp; - struct componentname *cnp; +ufs_makeinode(int mode, struct vnode *dvp, struct vnode **vpp, + struct componentname *cnp) { struct inode *ip, *pdir; struct direct newdir; @@ -2121,8 +2077,7 @@ struct filterops ufsvnode_filtops = { 1, NULL, filt_ufsdetach, filt_ufsvnode }; int -ufs_kqfilter(v) - void *v; +ufs_kqfilter(void *v) { struct vop_kqfilter_args /* { struct vnode *a_vp; |