Clean up whitespace, s/register //, refrain from strong urge to ANSIfy.

This commit is contained in:
Dag-Erling Smørgrav 2003-03-02 15:56:49 +00:00
parent c952458814
commit 8994a245e0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=111742
16 changed files with 352 additions and 354 deletions

View File

@ -96,7 +96,7 @@ DATA_SET(linux_ioctl_handler_set, sound_handler);
DATA_SET(linux_ioctl_handler_set, termio_handler);
DATA_SET(linux_ioctl_handler_set, private_handler);
struct handler_element
struct handler_element
{
TAILQ_ENTRY(handler_element) list;
int (*func)(struct thread *, struct linux_ioctl_args *);
@ -345,7 +345,7 @@ bsd_to_linux_termios(struct termios *bios, struct linux_termios *lios)
lios->c_iflag, lios->c_oflag, lios->c_cflag,
lios->c_lflag, (int)lios->c_line);
printf("c_cc ");
for (i=0; i<LINUX_NCCS; i++)
for (i=0; i<LINUX_NCCS; i++)
printf("%02x ", lios->c_cc[i]);
printf("\n");
}
@ -360,7 +360,7 @@ linux_to_bsd_termios(struct linux_termios *lios, struct termios *bios)
#ifdef DEBUG
if (ldebug(ioctl)) {
printf("LINUX: LINUX termios structure (input):\n");
printf("i=%08x o=%08x c=%08x l=%08x line=%d\n",
printf("i=%08x o=%08x c=%08x l=%08x line=%d\n",
lios->c_iflag, lios->c_oflag, lios->c_cflag,
lios->c_lflag, (int)lios->c_line);
printf("c_cc ");
@ -486,7 +486,7 @@ linux_to_bsd_termios(struct linux_termios *lios, struct termios *bios)
bios->c_iflag, bios->c_oflag, bios->c_cflag, bios->c_lflag,
bios->c_ispeed, bios->c_ospeed);
printf("c_cc ");
for (i=0; i<NCCS; i++)
for (i=0; i<NCCS; i++)
printf("%02x ", bios->c_cc[i]);
printf("\n");
}
@ -912,12 +912,12 @@ union linux_cdrom_addr
struct linux_cdrom_tocentry
{
u_char cdte_track;
u_char cdte_track;
u_char cdte_adr:4;
u_char cdte_ctrl:4;
u_char cdte_format;
u_char cdte_format;
union linux_cdrom_addr cdte_addr;
u_char cdte_datamode;
u_char cdte_datamode;
};
struct linux_cdrom_subchnl
@ -1880,7 +1880,7 @@ linux_ioctl_console(struct thread *td, struct linux_ioctl_args *args)
error = ENOIOCTL;
break;
}
fdrop(fp, td);
return (error);
}
@ -2073,7 +2073,7 @@ linux_gifhwaddr(struct ifnet *ifp, struct l_ifreq *ifr)
lsa.sa_family = ARPHRD_LOOPBACK;
return (copyout(&lsa, &ifr->ifr_hwaddr, sizeof lsa));
}
if (ifp->if_type != IFT_ETHER)
return (ENOENT);
@ -2087,7 +2087,7 @@ linux_gifhwaddr(struct ifnet *ifp, struct l_ifreq *ifr)
return (copyout(&lsa, &ifr->ifr_hwaddr, sizeof lsa));
}
}
return (ENOENT);
}
@ -2105,10 +2105,10 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args)
KASSERT(LINUX_IFNAMSIZ == IFNAMSIZ,
("%s(): LINUX_IFNAMSIZ != IFNAMSIZ", __func__));
ifp = NULL;
error = 0;
if ((error = fget(td, args->fd, &fp)) != 0)
return (error);
type = fp->f_type;
@ -2126,7 +2126,7 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args)
}
switch (args->cmd & 0xffff) {
case LINUX_FIOGETOWN:
case LINUX_FIOSETOWN:
case LINUX_SIOCADDMULTI:
@ -2141,7 +2141,7 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args)
args->cmd & 0xffff);
#endif
break;
case LINUX_SIOCGIFFLAGS:
case LINUX_SIOCGIFADDR:
case LINUX_SIOCSIFADDR:
@ -2181,7 +2181,7 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args)
lifname, ifname);
#endif
break;
default:
return (ENOIOCTL);
}
@ -2253,21 +2253,21 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args)
case LINUX_SIOCSIFNETMASK:
error = ENOIOCTL;
break;
case LINUX_SIOCGIFMTU:
args->cmd = SIOCGIFMTU;
error = ioctl(td, (struct ioctl_args *)args);
break;
case LINUX_SIOCSIFMTU:
args->cmd = SIOCSIFMTU;
error = ioctl(td, (struct ioctl_args *)args);
break;
case LINUX_SIOCSIFNAME:
error = ENOIOCTL;
break;
case LINUX_SIOCGIFHWADDR:
error = linux_gifhwaddr(ifp, (struct l_ifreq *)args->arg);
break;
@ -2275,7 +2275,7 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args)
case LINUX_SIOCSIFHWADDR:
error = ENOIOCTL;
break;
case LINUX_SIOCADDMULTI:
args->cmd = SIOCADDMULTI;
error = ioctl(td, (struct ioctl_args *)args);
@ -2294,7 +2294,7 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args)
args->cmd = SIOCGPRIVATE_0;
error = ioctl(td, (struct ioctl_args *)args);
break;
case LINUX_SIOCDEVPRIVATE+1:
args->cmd = SIOCGPRIVATE_1;
error = ioctl(td, (struct ioctl_args *)args);
@ -2423,7 +2423,7 @@ linux_ioctl_register_handler(struct linux_ioctl_handler *h)
he->func = h->func;
} else
TAILQ_REMOVE(&handlers, he, list);
/* Initialize range information. */
he->low = h->low;
he->high = h->high;

View File

@ -91,21 +91,21 @@ cd9660_setattr(ap)
struct vnode *vp = ap->a_vp;
struct vattr *vap = ap->a_vap;
if (vap->va_flags != (u_long)VNOVAL || vap->va_uid != (uid_t)VNOVAL ||
if (vap->va_flags != (u_long)VNOVAL || vap->va_uid != (uid_t)VNOVAL ||
vap->va_gid != (gid_t)VNOVAL || vap->va_atime.tv_sec != VNOVAL ||
vap->va_mtime.tv_sec != VNOVAL || vap->va_mode != (mode_t)VNOVAL)
return (EROFS);
if (vap->va_size != (u_quad_t)VNOVAL) {
switch (vp->v_type) {
case VDIR:
return (EISDIR);
switch (vp->v_type) {
case VDIR:
return (EISDIR);
case VLNK:
case VREG:
return (EROFS);
case VCHR:
case VBLK:
case VSOCK:
case VFIFO:
case VCHR:
case VBLK:
case VSOCK:
case VFIFO:
case VNON:
case VBAD:
return (0);
@ -165,8 +165,8 @@ cd9660_getattr(ap)
{
struct vnode *vp = ap->a_vp;
register struct vattr *vap = ap->a_vap;
register struct iso_node *ip = VTOI(vp);
struct vattr *vap = ap->a_vap;
struct iso_node *ip = VTOI(vp);
vap->va_fsid = dev2udev(ip->i_dev);
@ -237,14 +237,14 @@ cd9660_ioctl(ap)
struct vnode *vp = ap->a_vp;
struct iso_node *ip = VTOI(vp);
switch (ap->a_command) {
switch (ap->a_command) {
case FIOGETLBA:
case FIOGETLBA:
*(int *)(ap->a_data) = ip->iso_start;
return 0;
default:
return (ENOTTY);
}
default:
return (ENOTTY);
}
}
/*
@ -260,9 +260,9 @@ cd9660_read(ap)
} */ *ap;
{
struct vnode *vp = ap->a_vp;
register struct uio *uio = ap->a_uio;
register struct iso_node *ip = VTOI(vp);
register struct iso_mnt *imp;
struct uio *uio = ap->a_uio;
struct iso_node *ip = VTOI(vp);
struct iso_mnt *imp;
struct buf *bp;
daddr_t lbn, rablock;
off_t diff;
@ -293,7 +293,7 @@ cd9660_read(ap)
if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
if (lblktosize(imp, rablock) < ip->i_size)
error = cluster_read(vp, (off_t)ip->i_size,
lbn, size, NOCRED, uio->uio_resid,
lbn, size, NOCRED, uio->uio_resid,
(ap->a_ioflag >> 16), &bp);
else
error = bread(vp, lbn, size, NOCRED, &bp);
@ -431,7 +431,7 @@ cd9660_readdir(ap)
u_long *a_cookies;
} */ *ap;
{
register struct uio *uio = ap->a_uio;
struct uio *uio = ap->a_uio;
struct isoreaddir *idp;
struct vnode *vdp = ap->a_vp;
struct iso_node *dp;
@ -672,7 +672,7 @@ cd9660_readlink(ap)
symname = uio->uio_iov->iov_base;
else
symname = uma_zalloc(namei_zone, M_WAITOK);
/*
* Ok, we just gathering a symbolic name in SL record.
*/
@ -712,15 +712,15 @@ cd9660_strategy(ap)
struct buf *a_bp;
} */ *ap;
{
register struct buf *bp = ap->a_bp;
register struct vnode *vp = bp->b_vp;
register struct iso_node *ip;
struct buf *bp = ap->a_bp;
struct vnode *vp = bp->b_vp;
struct iso_node *ip;
ip = VTOI(vp);
if (vp->v_type == VBLK || vp->v_type == VCHR)
panic("cd9660_strategy: spec");
if (bp->b_blkno == bp->b_lblkno) {
bp->b_blkno = (ip->iso_start + bp->b_lblkno) <<
bp->b_blkno = (ip->iso_start + bp->b_lblkno) <<
(ip->i_mnt->im_bshift - DEV_BSHIFT);
if ((long)bp->b_blkno == -1) /* XXX: cut&paste junk ? */
clrbuf(bp);

View File

@ -37,7 +37,7 @@
/*
* TODO:
* remove empty directories
* mknod: hunt down DE_DELETED, compare name, reinstantiate.
* mknod: hunt down DE_DELETED, compare name, reinstantiate.
* mkdir: want it ?
*/
@ -84,7 +84,7 @@ static vop_t **devfs_specop_p;
/*
* Construct the fully qualified path name relative to the mountpoint
*/
*/
static char *
devfs_fqpn(char *buf, struct vnode *dvp, struct componentname *cnp)
{
@ -223,7 +223,7 @@ devfs_getattr(ap)
vap->va_uid = de->de_uid;
vap->va_gid = de->de_gid;
vap->va_mode = de->de_mode;
if (vp->v_type == VLNK)
if (vp->v_type == VLNK)
vap->va_size = de->de_dirent->d_namlen;
else if (vp->v_type == VDIR)
vap->va_size = vap->va_bytes = DEV_BSIZE;
@ -312,7 +312,7 @@ devfs_lookupx(ap)
dmp = VFSTODEVFS(dvp->v_mount);
cloned = 0;
dd = dvp->v_data;
*vpp = NULLVP;
cnp->cn_flags &= ~PDIRUNLOCK;
@ -453,11 +453,11 @@ static int
devfs_mknod(struct vop_mknod_args *ap)
/*
struct vop_mknod_args {
struct vnodeop_desc *a_desc;
struct vnode *a_dvp;
struct vnode **a_vpp;
struct componentname *a_cnp;
struct vattr *a_vap;
struct vnodeop_desc *a_desc;
struct vnode *a_dvp;
struct vnode **a_vpp;
struct componentname *a_cnp;
struct vattr *a_vap;
};
*/
{
@ -480,7 +480,7 @@ struct vop_mknod_args {
nameiop = cnp->cn_nameiop;
cloned = 0;
dd = dvp->v_data;
error = ENOENT;
TAILQ_FOREACH(de, &dd->de_dlist, de_list) {
if (cnp->cn_namelen != de->de_dirent->d_namlen)
@ -587,7 +587,7 @@ devfs_readdir(ap)
off = 0;
oldoff = uio->uio_offset;
TAILQ_FOREACH(dd, &de->de_dlist, de_list) {
if (dd->de_flags & DE_WHITEOUT)
if (dd->de_flags & DE_WHITEOUT)
continue;
if (dd->de_dirent->d_type == DT_DIR)
de = dd->de_dir;
@ -607,13 +607,13 @@ devfs_readdir(ap)
}
if( !error && ap->a_ncookies != NULL && ap->a_cookies != NULL ) {
MALLOC(cookiebuf, u_long *, ncookies * sizeof(u_long),
M_TEMP, M_WAITOK);
M_TEMP, M_WAITOK);
cookiep = cookiebuf;
dps = (struct dirent *)((char *)uio->uio_iov->iov_base -
(uio->uio_offset - oldoff));
dpe = (struct dirent *) uio->uio_iov->iov_base;
for( dp = dps;
dp < dpe;
for( dp = dps;
dp < dpe;
dp = (struct dirent *)((caddr_t) dp + dp->d_reclen)) {
oldoff += dp->d_reclen;
*cookiep++ = (u_long) oldoff;

View File

@ -189,7 +189,7 @@ fdesc_lookup(ap)
VOP_UNLOCK(dvp, 0, td);
if (cnp->cn_namelen == 1 && *pname == '.') {
*vpp = dvp;
VREF(dvp);
VREF(dvp);
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td);
return (0);
}

View File

@ -406,7 +406,7 @@ msdosfs_setattr(ap)
if (vap->va_uid != (uid_t)VNOVAL || vap->va_gid != (gid_t)VNOVAL) {
uid_t uid;
gid_t gid;
if (vp->v_mount->mnt_flag & MNT_RDONLY)
return (EROFS);
uid = vap->va_uid;
@ -523,7 +523,7 @@ msdosfs_read(ap)
return (EINVAL);
if ((uoff_t)uio->uio_offset > DOS_FILESIZE_MAX)
return (0);
return (0);
/*
* If they didn't ask for any data, then we are done.
*/
@ -559,7 +559,7 @@ msdosfs_read(ap)
de_cn2off(pmp, rablock) < dep->de_FileSize) {
rasize = pmp->pm_bpcluster;
error = breadn(vp, lbn, blsize,
&rablock, &rasize, 1, NOCRED, &bp);
&rablock, &rasize, 1, NOCRED, &bp);
} else {
error = bread(vp, lbn, blsize, NOCRED, &bp);
}
@ -653,7 +653,7 @@ msdosfs_write(ap)
}
if ((uoff_t)uio->uio_offset + uio->uio_resid > DOS_FILESIZE_MAX)
return (EFBIG);
return (EFBIG);
/*
* If the offset we are starting the write at is beyond the end of
@ -703,8 +703,8 @@ msdosfs_write(ap)
bn = de_cluster(pmp, uio->uio_offset);
if ((uio->uio_offset & pmp->pm_crbomask) == 0
&& (de_cluster(pmp, uio->uio_offset + uio->uio_resid)
> de_cluster(pmp, uio->uio_offset)
&& (de_cluster(pmp, uio->uio_offset + uio->uio_resid)
> de_cluster(pmp, uio->uio_offset)
|| uio->uio_offset + uio->uio_resid >= dep->de_FileSize)) {
/*
* If either the whole cluster gets written,
@ -1229,17 +1229,17 @@ static struct {
} dosdirtemplate = {
{ ". ", " ", /* the . entry */
ATTR_DIRECTORY, /* file attribute */
0, /* reserved */
0, /* reserved */
0, { 0, 0 }, { 0, 0 }, /* create time & date */
{ 0, 0 }, /* access date */
{ 0, 0 }, /* high bits of start cluster */
{ 210, 4 }, { 210, 4 }, /* modify time & date */
{ 0, 0 }, /* startcluster */
{ 0, 0, 0, 0 } /* filesize */
{ 0, 0, 0, 0 } /* filesize */
},
{ ".. ", " ", /* the .. entry */
ATTR_DIRECTORY, /* file attribute */
0, /* reserved */
0, /* reserved */
0, { 0, 0 }, { 0, 0 }, /* create time & date */
{ 0, 0 }, /* access date */
{ 0, 0 }, /* high bits of start cluster */
@ -1370,13 +1370,13 @@ msdosfs_rmdir(ap)
struct componentname *a_cnp;
} */ *ap;
{
register struct vnode *vp = ap->a_vp;
register struct vnode *dvp = ap->a_dvp;
register struct componentname *cnp = ap->a_cnp;
register struct denode *ip, *dp;
struct vnode *vp = ap->a_vp;
struct vnode *dvp = ap->a_dvp;
struct componentname *cnp = ap->a_cnp;
struct denode *ip, *dp;
struct thread *td = cnp->cn_thread;
int error;
ip = VTODE(vp);
dp = VTODE(dvp);

View File

@ -124,7 +124,7 @@ nwfs_readvdir(struct vnode *vp, struct uio *uio, struct ucred *cred) {
#if 0
if (error && eofflag) {
/* *eofflag = 1;*/
break;
break;
}
#endif
break;
@ -137,7 +137,7 @@ nwfs_readvdir(struct vnode *vp, struct uio *uio, struct ucred *cred) {
VTONW(newvp)->n_ctime = VTONW(newvp)->n_vattr.va_ctime.tv_sec;
cn.cn_nameptr = dp.d_name;
cn.cn_namelen = dp.d_namlen;
cache_enter(vp, newvp, &cn);
cache_enter(vp, newvp, &cn);
vput(newvp);
} else
error = 0;
@ -343,7 +343,7 @@ nwfs_doio(bp, cr, td)
* the block is reused. This is indicated by setting
* the B_DELWRI and B_NEEDCOMMIT flags.
*/
if (error == EINTR
if (error == EINTR
|| (!error && (bp->b_flags & B_NEEDCOMMIT))) {
int s;
@ -358,7 +358,7 @@ nwfs_doio(bp, cr, td)
if ((bp->b_flags & B_ASYNC) == 0)
bp->b_flags |= B_EINTR;
splx(s);
} else {
} else {
if (error) {
bp->b_ioflags |= BIO_ERROR;
bp->b_error /*= np->n_error */= error;
@ -467,7 +467,7 @@ nwfs_getpages(ap)
int nvalid = ((size + DEV_BSIZE - 1) - toff) & ~(DEV_BSIZE - 1);
vm_page_set_validclean(m, 0, nvalid);
}
if (i != ap->a_reqpage) {
/*
* Whether or not to leave the page activated is up in

View File

@ -92,7 +92,7 @@ smbfs_readvdir(struct vnode *vp, struct uio *uio, struct ucred *cred)
np = VTOSMB(vp);
SMBVDEBUG("dirname='%s'\n", np->n_name);
smb_makescred(&scred, uio->uio_td, cred);
offset = uio->uio_offset / DE_SIZE; /* offset in the directory */
offset = uio->uio_offset / DE_SIZE; /* offset in the directory */
limit = uio->uio_resid / DE_SIZE;
if (uio->uio_resid < DE_SIZE || uio->uio_offset < 0)
return EINVAL;
@ -161,7 +161,7 @@ smbfs_readvdir(struct vnode *vp, struct uio *uio, struct ucred *cred)
if (!error) {
cn.cn_nameptr = de.d_name;
cn.cn_namelen = de.d_namlen;
cache_enter(vp, newvp, &cn);
cache_enter(vp, newvp, &cn);
vput(newvp);
}
}
@ -367,7 +367,7 @@ smbfs_doio(struct buf *bp, struct ucred *cr, struct thread *td)
* the block is reused. This is indicated by setting
* the B_DELWRI and B_NEEDCOMMIT flags.
*/
if (error == EINTR
if (error == EINTR
|| (!error && (bp->b_flags & B_NEEDCOMMIT))) {
int s;
@ -382,7 +382,7 @@ smbfs_doio(struct buf *bp, struct ucred *cr, struct thread *td)
if ((bp->b_flags & B_ASYNC) == 0)
bp->b_flags |= B_EINTR;
splx(s);
} else {
} else {
if (error) {
bp->b_ioflags |= BIO_ERROR;
bp->b_error = error;
@ -531,7 +531,7 @@ smbfs_getpages(ap)
*/
;
}
if (i != reqpage) {
/*
* Whether or not to leave the page activated is up in

View File

@ -188,7 +188,7 @@ udf_permtomode(struct udf_node *node)
return (mode);
}
static int
udf_access(struct vop_access_args *a)
{
@ -266,7 +266,7 @@ udf_timetotimespec(struct timestamp *time, struct timespec *t)
/* Calclulate the month */
lpyear = udf_isaleapyear(time->year);
for (i = 1; i < time->month; i++)
t->tv_sec += mon_lens[lpyear][i] * 3600 * 24;
t->tv_sec += mon_lens[lpyear][i] * 3600 * 24;
/* Speed up the calculation */
if (time->year > 1979)
@ -458,7 +458,7 @@ udf_transname(char *cs0string, char *destname, int len)
}
/* At this point, the name is in 16-bit Unicode. Compact it down
* to 8-bit
* to 8-bit
*/
for (i = 0; i < unilen ; i++) {
if (transname[i] & 0xff00) {
@ -739,7 +739,7 @@ udf_readdir(struct vop_readdir_args *a)
dir.d_namlen = 1;
dir.d_reclen = GENERIC_DIRSIZ(&dir);
uiodir.dirent = &dir;
error = udf_uiodir(&uiodir, dir.d_reclen, uio, 1);
error = udf_uiodir(&uiodir, dir.d_reclen, uio, 1);
if (error)
break;
@ -1032,7 +1032,7 @@ udf_reclaim(struct vop_reclaim_args *a)
}
/*
* Read the block and then set the data pointer to correspond with the
* Read the block and then set the data pointer to correspond with the
* offset passed in. Only read in at most 'size' bytes, and then set 'size'
* to the number of bytes pointed to. If 'size' is zero, try to read in a
* whole extent.
@ -1157,7 +1157,7 @@ udf_bmap_internal(struct udf_node *node, uint32_t offset, daddr_t *sector, uint3
ad_num++;
} while(offset >= icblen);
lsector = (offset >> udfmp->bshift) +
lsector = (offset >> udfmp->bshift) +
((struct long_ad *)(icb))->loc.lb_num;
*max_size = GETICBLEN(long_ad, icb) - offset;

View File

@ -73,7 +73,7 @@ static int dirchk = 0;
SYSCTL_NODE(_vfs, OID_AUTO, e2fs, CTLFLAG_RD, 0, "EXT2FS filesystem");
SYSCTL_INT(_vfs_e2fs, OID_AUTO, dircheck, CTLFLAG_RW, &dirchk, 0, "");
/*
/*
DIRBLKSIZE in ffs is DEV_BSIZE (in most cases 512)
while it is the native blocksize in ext2fs - thus, a #define
is no longer appropriate
@ -131,21 +131,21 @@ static int ext2_dirbadentry(struct vnode *dp, struct ext2_dir_entry_2 *de,
* this is exactly what we do here - the problem is that the conversion
* will blow up some entries by four bytes, so it can't be done in place.
* This is too bad. Right now the conversion is done entry by entry, the
* converted entry is sent via uiomove.
* converted entry is sent via uiomove.
*
* XXX allocate a buffer, convert as many entries as possible, then send
* the whole buffer to uiomove
*/
int
ext2_readdir(ap)
struct vop_readdir_args /* {
struct vnode *a_vp;
struct uio *a_uio;
struct ucred *a_cred;
} */ *ap;
struct vop_readdir_args /* {
struct vnode *a_vp;
struct uio *a_uio;
struct ucred *a_cred;
} */ *ap;
{
struct uio *uio = ap->a_uio;
int count, error;
struct uio *uio = ap->a_uio;
int count, error;
struct ext2_dir_entry_2 *edp, *dp;
int ncookies;
@ -171,7 +171,7 @@ ext2_readdir(ap)
count += DIRBLKSIZ;
#ifdef EXT2FS_DEBUG
printf("ext2_readdir: uio_offset = %lld, uio_resid = %d, count = %d\n",
printf("ext2_readdir: uio_offset = %lld, uio_resid = %d, count = %d\n",
uio->uio_offset, uio->uio_resid, count);
#endif
@ -189,7 +189,7 @@ ext2_readdir(ap)
edp = (struct ext2_dir_entry_2 *)&dirbuf[readcnt];
ncookies = 0;
bzero(&dstdp, offsetof(struct dirent, d_name));
for (dp = (struct ext2_dir_entry_2 *)dirbuf;
for (dp = (struct ext2_dir_entry_2 *)dirbuf;
!error && uio->uio_resid > 0 && dp < edp; ) {
/*-
* "New" ext2fs directory entries differ in 3 ways
@ -220,8 +220,8 @@ ext2_readdir(ap)
if(dstdp.d_reclen <= uio->uio_resid) {
/* advance dp */
dp = (struct ext2_dir_entry_2 *)
((char *)dp + dp->rec_len);
error =
((char *)dp + dp->rec_len);
error =
uiomove(&dstdp, dstdp.d_reclen, uio);
if (!error)
ncookies++;
@ -258,7 +258,7 @@ ext2_readdir(ap)
FREE(dirbuf, M_TEMP);
if (ap->a_eofflag)
*ap->a_eofflag = VTOI(ap->a_vp)->i_size <= uio->uio_offset;
return (error);
return (error);
}
/*
@ -351,7 +351,7 @@ ext2_lookup(ap)
if ((nameiop == CREATE || nameiop == RENAME) &&
(flags & ISLASTCN)) {
slotstatus = NONE;
slotneeded = EXT2_DIR_REC_LEN(cnp->cn_namelen);
slotneeded = EXT2_DIR_REC_LEN(cnp->cn_namelen);
/* was
slotneeded = (sizeof(struct direct) - MAXNAMLEN +
cnp->cn_namelen + 3) &~ 3; */
@ -740,28 +740,28 @@ ext2_dirbadentry(dp, de, entryoffsetinblock)
{
int DIRBLKSIZ = VTOI(dp)->i_e2fs->s_blocksize;
char * error_msg = NULL;
char * error_msg = NULL;
if (de->rec_len < EXT2_DIR_REC_LEN(1))
error_msg = "rec_len is smaller than minimal";
else if (de->rec_len % 4 != 0)
error_msg = "rec_len % 4 != 0";
else if (de->rec_len < EXT2_DIR_REC_LEN(de->name_len))
error_msg = "reclen is too small for name_len";
else if (entryoffsetinblock + de->rec_len > DIRBLKSIZ)
error_msg = "directory entry across blocks";
/* else LATER
if (de->rec_len < EXT2_DIR_REC_LEN(1))
error_msg = "rec_len is smaller than minimal";
else if (de->rec_len % 4 != 0)
error_msg = "rec_len % 4 != 0";
else if (de->rec_len < EXT2_DIR_REC_LEN(de->name_len))
error_msg = "reclen is too small for name_len";
else if (entryoffsetinblock + de->rec_len > DIRBLKSIZ)
error_msg = "directory entry across blocks";
/* else LATER
if (de->inode > dir->i_sb->u.ext2_sb.s_es->s_inodes_count)
error_msg = "inode out of bounds";
error_msg = "inode out of bounds";
*/
if (error_msg != NULL) {
printf("bad directory entry: %s\n", error_msg);
printf("offset=%d, inode=%lu, rec_len=%u, name_len=%u\n",
if (error_msg != NULL) {
printf("bad directory entry: %s\n", error_msg);
printf("offset=%d, inode=%lu, rec_len=%u, name_len=%u\n",
entryoffsetinblock, (unsigned long)de->inode,
de->rec_len, de->name_len);
}
return error_msg == NULL ? 0 : 1;
}
return error_msg == NULL ? 0 : 1;
}
/*
@ -929,7 +929,7 @@ ext2_dirremove(dvp, cnp)
struct ext2_dir_entry_2 *ep;
struct buf *bp;
int error;
dp = VTOI(dvp);
if (dp->i_count == 0) {
/*
@ -1004,7 +1004,7 @@ ext2_dirempty(ip, parentino, cred)
struct dirtemplate dbuf;
struct ext2_dir_entry_2 *dp = (struct ext2_dir_entry_2 *)&dbuf;
int error, count, namlen;
#define MINDIRSIZ (sizeof (struct dirtemplate) / 2)
for (off = 0; off < ip->i_size; off += dp->rec_len) {
@ -1106,4 +1106,3 @@ ext2_checkpath(source, target, cred)
vput(vp);
return (error);
}

View File

@ -73,7 +73,7 @@ static int dirchk = 0;
SYSCTL_NODE(_vfs, OID_AUTO, e2fs, CTLFLAG_RD, 0, "EXT2FS filesystem");
SYSCTL_INT(_vfs_e2fs, OID_AUTO, dircheck, CTLFLAG_RW, &dirchk, 0, "");
/*
/*
DIRBLKSIZE in ffs is DEV_BSIZE (in most cases 512)
while it is the native blocksize in ext2fs - thus, a #define
is no longer appropriate
@ -131,21 +131,21 @@ static int ext2_dirbadentry(struct vnode *dp, struct ext2_dir_entry_2 *de,
* this is exactly what we do here - the problem is that the conversion
* will blow up some entries by four bytes, so it can't be done in place.
* This is too bad. Right now the conversion is done entry by entry, the
* converted entry is sent via uiomove.
* converted entry is sent via uiomove.
*
* XXX allocate a buffer, convert as many entries as possible, then send
* the whole buffer to uiomove
*/
int
ext2_readdir(ap)
struct vop_readdir_args /* {
struct vnode *a_vp;
struct uio *a_uio;
struct ucred *a_cred;
} */ *ap;
struct vop_readdir_args /* {
struct vnode *a_vp;
struct uio *a_uio;
struct ucred *a_cred;
} */ *ap;
{
struct uio *uio = ap->a_uio;
int count, error;
struct uio *uio = ap->a_uio;
int count, error;
struct ext2_dir_entry_2 *edp, *dp;
int ncookies;
@ -171,7 +171,7 @@ ext2_readdir(ap)
count += DIRBLKSIZ;
#ifdef EXT2FS_DEBUG
printf("ext2_readdir: uio_offset = %lld, uio_resid = %d, count = %d\n",
printf("ext2_readdir: uio_offset = %lld, uio_resid = %d, count = %d\n",
uio->uio_offset, uio->uio_resid, count);
#endif
@ -189,7 +189,7 @@ ext2_readdir(ap)
edp = (struct ext2_dir_entry_2 *)&dirbuf[readcnt];
ncookies = 0;
bzero(&dstdp, offsetof(struct dirent, d_name));
for (dp = (struct ext2_dir_entry_2 *)dirbuf;
for (dp = (struct ext2_dir_entry_2 *)dirbuf;
!error && uio->uio_resid > 0 && dp < edp; ) {
/*-
* "New" ext2fs directory entries differ in 3 ways
@ -220,8 +220,8 @@ ext2_readdir(ap)
if(dstdp.d_reclen <= uio->uio_resid) {
/* advance dp */
dp = (struct ext2_dir_entry_2 *)
((char *)dp + dp->rec_len);
error =
((char *)dp + dp->rec_len);
error =
uiomove(&dstdp, dstdp.d_reclen, uio);
if (!error)
ncookies++;
@ -258,7 +258,7 @@ ext2_readdir(ap)
FREE(dirbuf, M_TEMP);
if (ap->a_eofflag)
*ap->a_eofflag = VTOI(ap->a_vp)->i_size <= uio->uio_offset;
return (error);
return (error);
}
/*
@ -351,7 +351,7 @@ ext2_lookup(ap)
if ((nameiop == CREATE || nameiop == RENAME) &&
(flags & ISLASTCN)) {
slotstatus = NONE;
slotneeded = EXT2_DIR_REC_LEN(cnp->cn_namelen);
slotneeded = EXT2_DIR_REC_LEN(cnp->cn_namelen);
/* was
slotneeded = (sizeof(struct direct) - MAXNAMLEN +
cnp->cn_namelen + 3) &~ 3; */
@ -740,28 +740,28 @@ ext2_dirbadentry(dp, de, entryoffsetinblock)
{
int DIRBLKSIZ = VTOI(dp)->i_e2fs->s_blocksize;
char * error_msg = NULL;
char * error_msg = NULL;
if (de->rec_len < EXT2_DIR_REC_LEN(1))
error_msg = "rec_len is smaller than minimal";
else if (de->rec_len % 4 != 0)
error_msg = "rec_len % 4 != 0";
else if (de->rec_len < EXT2_DIR_REC_LEN(de->name_len))
error_msg = "reclen is too small for name_len";
else if (entryoffsetinblock + de->rec_len > DIRBLKSIZ)
error_msg = "directory entry across blocks";
/* else LATER
if (de->rec_len < EXT2_DIR_REC_LEN(1))
error_msg = "rec_len is smaller than minimal";
else if (de->rec_len % 4 != 0)
error_msg = "rec_len % 4 != 0";
else if (de->rec_len < EXT2_DIR_REC_LEN(de->name_len))
error_msg = "reclen is too small for name_len";
else if (entryoffsetinblock + de->rec_len > DIRBLKSIZ)
error_msg = "directory entry across blocks";
/* else LATER
if (de->inode > dir->i_sb->u.ext2_sb.s_es->s_inodes_count)
error_msg = "inode out of bounds";
error_msg = "inode out of bounds";
*/
if (error_msg != NULL) {
printf("bad directory entry: %s\n", error_msg);
printf("offset=%d, inode=%lu, rec_len=%u, name_len=%u\n",
if (error_msg != NULL) {
printf("bad directory entry: %s\n", error_msg);
printf("offset=%d, inode=%lu, rec_len=%u, name_len=%u\n",
entryoffsetinblock, (unsigned long)de->inode,
de->rec_len, de->name_len);
}
return error_msg == NULL ? 0 : 1;
}
return error_msg == NULL ? 0 : 1;
}
/*
@ -929,7 +929,7 @@ ext2_dirremove(dvp, cnp)
struct ext2_dir_entry_2 *ep;
struct buf *bp;
int error;
dp = VTOI(dvp);
if (dp->i_count == 0) {
/*
@ -1004,7 +1004,7 @@ ext2_dirempty(ip, parentino, cred)
struct dirtemplate dbuf;
struct ext2_dir_entry_2 *dp = (struct ext2_dir_entry_2 *)&dbuf;
int error, count, namlen;
#define MINDIRSIZ (sizeof (struct dirtemplate) / 2)
for (off = 0; off < ip->i_size; off += dp->rec_len) {
@ -1106,4 +1106,3 @@ ext2_checkpath(source, target, cred)
vput(vp);
return (error);
}

View File

@ -91,21 +91,21 @@ cd9660_setattr(ap)
struct vnode *vp = ap->a_vp;
struct vattr *vap = ap->a_vap;
if (vap->va_flags != (u_long)VNOVAL || vap->va_uid != (uid_t)VNOVAL ||
if (vap->va_flags != (u_long)VNOVAL || vap->va_uid != (uid_t)VNOVAL ||
vap->va_gid != (gid_t)VNOVAL || vap->va_atime.tv_sec != VNOVAL ||
vap->va_mtime.tv_sec != VNOVAL || vap->va_mode != (mode_t)VNOVAL)
return (EROFS);
if (vap->va_size != (u_quad_t)VNOVAL) {
switch (vp->v_type) {
case VDIR:
return (EISDIR);
switch (vp->v_type) {
case VDIR:
return (EISDIR);
case VLNK:
case VREG:
return (EROFS);
case VCHR:
case VBLK:
case VSOCK:
case VFIFO:
case VCHR:
case VBLK:
case VSOCK:
case VFIFO:
case VNON:
case VBAD:
return (0);
@ -165,8 +165,8 @@ cd9660_getattr(ap)
{
struct vnode *vp = ap->a_vp;
register struct vattr *vap = ap->a_vap;
register struct iso_node *ip = VTOI(vp);
struct vattr *vap = ap->a_vap;
struct iso_node *ip = VTOI(vp);
vap->va_fsid = dev2udev(ip->i_dev);
@ -237,14 +237,14 @@ cd9660_ioctl(ap)
struct vnode *vp = ap->a_vp;
struct iso_node *ip = VTOI(vp);
switch (ap->a_command) {
switch (ap->a_command) {
case FIOGETLBA:
case FIOGETLBA:
*(int *)(ap->a_data) = ip->iso_start;
return 0;
default:
return (ENOTTY);
}
default:
return (ENOTTY);
}
}
/*
@ -260,9 +260,9 @@ cd9660_read(ap)
} */ *ap;
{
struct vnode *vp = ap->a_vp;
register struct uio *uio = ap->a_uio;
register struct iso_node *ip = VTOI(vp);
register struct iso_mnt *imp;
struct uio *uio = ap->a_uio;
struct iso_node *ip = VTOI(vp);
struct iso_mnt *imp;
struct buf *bp;
daddr_t lbn, rablock;
off_t diff;
@ -293,7 +293,7 @@ cd9660_read(ap)
if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
if (lblktosize(imp, rablock) < ip->i_size)
error = cluster_read(vp, (off_t)ip->i_size,
lbn, size, NOCRED, uio->uio_resid,
lbn, size, NOCRED, uio->uio_resid,
(ap->a_ioflag >> 16), &bp);
else
error = bread(vp, lbn, size, NOCRED, &bp);
@ -431,7 +431,7 @@ cd9660_readdir(ap)
u_long *a_cookies;
} */ *ap;
{
register struct uio *uio = ap->a_uio;
struct uio *uio = ap->a_uio;
struct isoreaddir *idp;
struct vnode *vdp = ap->a_vp;
struct iso_node *dp;
@ -672,7 +672,7 @@ cd9660_readlink(ap)
symname = uio->uio_iov->iov_base;
else
symname = uma_zalloc(namei_zone, M_WAITOK);
/*
* Ok, we just gathering a symbolic name in SL record.
*/
@ -712,15 +712,15 @@ cd9660_strategy(ap)
struct buf *a_bp;
} */ *ap;
{
register struct buf *bp = ap->a_bp;
register struct vnode *vp = bp->b_vp;
register struct iso_node *ip;
struct buf *bp = ap->a_bp;
struct vnode *vp = bp->b_vp;
struct iso_node *ip;
ip = VTOI(vp);
if (vp->v_type == VBLK || vp->v_type == VCHR)
panic("cd9660_strategy: spec");
if (bp->b_blkno == bp->b_lblkno) {
bp->b_blkno = (ip->iso_start + bp->b_lblkno) <<
bp->b_blkno = (ip->iso_start + bp->b_lblkno) <<
(ip->i_mnt->im_bshift - DEV_BSHIFT);
if ((long)bp->b_blkno == -1) /* XXX: cut&paste junk ? */
clrbuf(bp);

View File

@ -136,7 +136,7 @@ static char *names = "pqrsPQRS";
* pts == /dev/tty[pqrsPQRS][0123456789abcdefghijklmnopqrstuv]
* ptc == /dev/pty[pqrsPQRS][0123456789abcdefghijklmnopqrstuv]
*
* XXX: define and add mapping of upper minor bits to allow more
* XXX: define and add mapping of upper minor bits to allow more
* than 256 ptys.
*/
static dev_t
@ -172,12 +172,12 @@ ptsopen(dev, flag, devtype, td)
int flag, devtype;
struct thread *td;
{
register struct tty *tp;
struct tty *tp;
int error;
struct pt_ioctl *pti;
if (!dev->si_drv1)
return(ENXIO);
return(ENXIO);
pti = dev->si_drv1;
tp = dev->si_tty;
if ((tp->t_state & TS_ISOPEN) == 0) {
@ -214,7 +214,7 @@ ptsclose(dev, flag, mode, td)
int flag, mode;
struct thread *td;
{
register struct tty *tp;
struct tty *tp;
int err;
tp = dev->si_tty;
@ -232,8 +232,8 @@ ptsread(dev, uio, flag)
{
struct thread *td = curthread;
struct proc *p = td->td_proc;
register struct tty *tp = dev->si_tty;
register struct pt_ioctl *pti = dev->si_drv1;
struct tty *tp = dev->si_tty;
struct pt_ioctl *pti = dev->si_drv1;
struct pgrp *pg;
int error = 0;
@ -296,7 +296,7 @@ ptswrite(dev, uio, flag)
struct uio *uio;
int flag;
{
register struct tty *tp;
struct tty *tp;
tp = dev->si_tty;
if (tp->t_oproc == 0)
@ -312,7 +312,7 @@ static void
ptsstart(tp)
struct tty *tp;
{
register struct pt_ioctl *pti = tp->t_dev->si_drv1;
struct pt_ioctl *pti = tp->t_dev->si_drv1;
if (tp->t_state & TS_TTSTOP)
return;
@ -346,13 +346,13 @@ ptcopen(dev, flag, devtype, td)
int flag, devtype;
struct thread *td;
{
register struct tty *tp;
struct tty *tp;
struct pt_ioctl *pti;
if (!dev->si_drv1)
ptyinit(dev);
if (!dev->si_drv1)
return(ENXIO);
return(ENXIO);
tp = dev->si_tty;
if (tp->t_oproc)
return (EIO);
@ -376,7 +376,7 @@ ptcclose(dev, flags, fmt, td)
int fmt;
struct thread *td;
{
register struct tty *tp;
struct tty *tp;
tp = dev->si_tty;
(void)(*linesw[tp->t_line].l_modem)(tp, 0);
@ -405,7 +405,7 @@ ptcread(dev, uio, flag)
struct uio *uio;
int flag;
{
register struct tty *tp = dev->si_tty;
struct tty *tp = dev->si_tty;
struct pt_ioctl *pti = dev->si_drv1;
char buf[BUFSIZ];
int error = 0, cc;
@ -462,7 +462,7 @@ ptcread(dev, uio, flag)
static void
ptsstop(tp, flush)
register struct tty *tp;
struct tty *tp;
int flush;
{
struct pt_ioctl *pti = tp->t_dev->si_drv1;
@ -490,7 +490,7 @@ ptcpoll(dev, events, td)
int events;
struct thread *td;
{
register struct tty *tp = dev->si_tty;
struct tty *tp = dev->si_tty;
struct pt_ioctl *pti = dev->si_drv1;
int revents = 0;
int s;
@ -513,7 +513,7 @@ ptcpoll(dev, events, td)
if (events & (POLLOUT | POLLWRNORM))
if (tp->t_state & TS_ISOPEN &&
((pti->pt_flags & PF_REMOTE) ?
(tp->t_canq.c_cc == 0) :
(tp->t_canq.c_cc == 0) :
((tp->t_rawq.c_cc + tp->t_canq.c_cc < TTYHOG - 2) ||
(tp->t_canq.c_cc == 0 && (tp->t_lflag & ICANON)))))
revents |= events & (POLLOUT | POLLWRNORM);
@ -526,7 +526,7 @@ ptcpoll(dev, events, td)
if (events & (POLLIN | POLLRDNORM))
selrecord(td, &pti->pt_selr);
if (events & (POLLOUT | POLLWRNORM))
if (events & (POLLOUT | POLLWRNORM))
selrecord(td, &pti->pt_selw);
}
splx(s);
@ -537,12 +537,12 @@ ptcpoll(dev, events, td)
static int
ptcwrite(dev, uio, flag)
dev_t dev;
register struct uio *uio;
struct uio *uio;
int flag;
{
register struct tty *tp = dev->si_tty;
register u_char *cp = 0;
register int cc = 0;
struct tty *tp = dev->si_tty;
u_char *cp = 0;
int cc = 0;
u_char locbuf[BUFSIZ];
int cnt = 0;
struct pt_ioctl *pti = dev->si_drv1;
@ -653,9 +653,9 @@ ptyioctl(dev, cmd, data, flag, td)
int flag;
struct thread *td;
{
register struct tty *tp = dev->si_tty;
register struct pt_ioctl *pti = dev->si_drv1;
register u_char *cc = tp->t_cc;
struct tty *tp = dev->si_tty;
struct pt_ioctl *pti = dev->si_drv1;
u_char *cc = tp->t_cc;
int stop, error;
if (devsw(dev)->d_open == ptcopen) {
@ -697,7 +697,7 @@ ptyioctl(dev, cmd, data, flag, td)
}
/*
* The rest of the ioctls shouldn't be called until
* The rest of the ioctls shouldn't be called until
* the slave is open.
*/
if ((tp->t_state & TS_ISOPEN) == 0)

View File

@ -69,9 +69,9 @@
static int do_setopt_accept_filter(struct socket *so, struct sockopt *sopt);
#endif
static void filt_sordetach(struct knote *kn);
static int filt_soread(struct knote *kn, long hint);
static void filt_sowdetach(struct knote *kn);
static void filt_sordetach(struct knote *kn);
static int filt_soread(struct knote *kn, long hint);
static void filt_sowdetach(struct knote *kn);
static int filt_sowrite(struct knote *kn, long hint);
static int filt_solisten(struct knote *kn, long hint);
@ -167,14 +167,14 @@ int
socreate(dom, aso, type, proto, cred, td)
int dom;
struct socket **aso;
register int type;
int type;
int proto;
struct ucred *cred;
struct thread *td;
{
register struct protosw *prp;
register struct socket *so;
register int error;
struct protosw *prp;
struct socket *so;
int error;
if (proto)
prp = pffindproto(dom, proto, type);
@ -258,7 +258,7 @@ sodealloc(struct socket *so)
int
solisten(so, backlog, td)
register struct socket *so;
struct socket *so;
int backlog;
struct thread *td;
{
@ -285,7 +285,7 @@ solisten(so, backlog, td)
void
sofree(so)
register struct socket *so;
struct socket *so;
{
struct socket *head = so->so_head;
@ -327,7 +327,7 @@ sofree(so)
*/
int
soclose(so)
register struct socket *so;
struct socket *so;
{
int s = splnet(); /* conservative */
int error = 0;
@ -405,7 +405,7 @@ soabort(so)
int
soaccept(so, nam)
register struct socket *so;
struct socket *so;
struct sockaddr **nam;
{
int s = splnet();
@ -421,7 +421,7 @@ soaccept(so, nam)
int
soconnect(so, nam, td)
register struct socket *so;
struct socket *so;
struct sockaddr *nam;
struct thread *td;
{
@ -449,7 +449,7 @@ soconnect(so, nam, td)
int
soconnect2(so1, so2)
register struct socket *so1;
struct socket *so1;
struct socket *so2;
{
int s = splnet();
@ -462,7 +462,7 @@ soconnect2(so1, so2)
int
sodisconnect(so)
register struct socket *so;
struct socket *so;
{
int s = splnet();
int error;
@ -517,7 +517,7 @@ struct so_zerocopy_stats so_zerocp_stats = {0,0,0};
int
sosend(so, addr, uio, top, control, flags, td)
register struct socket *so;
struct socket *so;
struct sockaddr *addr;
struct uio *uio;
struct mbuf *top;
@ -526,8 +526,8 @@ sosend(so, addr, uio, top, control, flags, td)
struct thread *td;
{
struct mbuf **mp;
register struct mbuf *m;
register long space, len, resid;
struct mbuf *m;
long space, len, resid;
int clen = 0, error, s, dontroute, mlen;
int atomic = sosendallatonce(so) || top;
#ifdef ZERO_COPY_SOCKETS
@ -642,10 +642,10 @@ sosend(so, addr, uio, top, control, flags, td)
mlen = MLEN;
}
if (resid >= MINCLSIZE) {
#ifdef ZERO_COPY_SOCKETS
#ifdef ZERO_COPY_SOCKETS
if (so_zero_copy_send &&
resid>=PAGE_SIZE &&
space>=PAGE_SIZE &&
resid>=PAGE_SIZE &&
space>=PAGE_SIZE &&
uio->uio_iov->iov_len>=PAGE_SIZE) {
so_zerocp_stats.size_ok++;
if (!((vm_offset_t)
@ -653,7 +653,7 @@ sosend(so, addr, uio, top, control, flags, td)
so_zerocp_stats.align_ok++;
cow_send = socow_setup(m, uio);
}
}
}
if (!cow_send){
#endif /* ZERO_COPY_SOCKETS */
MCLGET(m, M_TRYWAIT);
@ -665,7 +665,7 @@ sosend(so, addr, uio, top, control, flags, td)
#ifdef ZERO_COPY_SOCKETS
len = PAGE_SIZE;
}
} else {
#endif /* ZERO_COPY_SOCKETS */
nopages:
@ -763,7 +763,7 @@ sosend(so, addr, uio, top, control, flags, td)
*/
int
soreceive(so, psa, uio, mp0, controlp, flagsp)
register struct socket *so;
struct socket *so;
struct sockaddr **psa;
struct uio *uio;
struct mbuf **mp0;
@ -771,7 +771,7 @@ soreceive(so, psa, uio, mp0, controlp, flagsp)
int *flagsp;
{
struct mbuf *m, **mp;
register int flags, len, error, s, offset;
int flags, len, error, s, offset;
struct protosw *pr = so->so_proto;
struct mbuf *nextrecord;
int moff, type = 0;
@ -980,7 +980,7 @@ soreceive(so, psa, uio, mp0, controlp, flagsp)
disposable = 1;
else
disposable = 0;
pg = PHYS_TO_VM_PAGE(vtophys(mtod(m, caddr_t) +
moff));
@ -1102,10 +1102,10 @@ soreceive(so, psa, uio, mp0, controlp, flagsp)
int
soshutdown(so, how)
register struct socket *so;
register int how;
struct socket *so;
int how;
{
register struct protosw *pr = so->so_proto;
struct protosw *pr = so->so_proto;
if (!(how == SHUT_RD || how == SHUT_WR || how == SHUT_RDWR))
return (EINVAL);
@ -1119,11 +1119,11 @@ soshutdown(so, how)
void
sorflush(so)
register struct socket *so;
struct socket *so;
{
register struct sockbuf *sb = &so->so_rcv;
register struct protosw *pr = so->so_proto;
register int s;
struct sockbuf *sb = &so->so_rcv;
struct protosw *pr = so->so_proto;
int s;
struct sockbuf asb;
sb->sb_flags |= SB_NOINTR;
@ -1686,7 +1686,7 @@ soopt_mcopyout(struct sockopt *sopt, struct mbuf *m)
void
sohasoutofband(so)
register struct socket *so;
struct socket *so;
{
if (so->so_sigio != NULL)
pgsigio(&so->so_sigio, SIGURG, 0);

View File

@ -82,10 +82,10 @@ static MALLOC_DEFINE(M_BPF, "BPF", "BPF data");
* The default read buffer size is patchable.
*/
static int bpf_bufsize = 4096;
SYSCTL_INT(_debug, OID_AUTO, bpf_bufsize, CTLFLAG_RW,
SYSCTL_INT(_debug, OID_AUTO, bpf_bufsize, CTLFLAG_RW,
&bpf_bufsize, 0, "");
static int bpf_maxbufsize = BPF_MAXBUFSIZE;
SYSCTL_INT(_debug, OID_AUTO, bpf_maxbufsize, CTLFLAG_RW,
SYSCTL_INT(_debug, OID_AUTO, bpf_maxbufsize, CTLFLAG_RW,
&bpf_maxbufsize, 0, "");
/*
@ -139,10 +139,10 @@ static struct cdevsw bpf_cdevsw = {
static int
bpf_movein(uio, linktype, mp, sockp, datlen)
register struct uio *uio;
struct uio *uio;
int linktype, *datlen;
register struct mbuf **mp;
register struct sockaddr *sockp;
struct mbuf **mp;
struct sockaddr *sockp;
{
struct mbuf *m;
int error;
@ -189,7 +189,7 @@ bpf_movein(uio, linktype, mp, sockp, datlen)
* specified anyway.
*/
sockp->sa_family = AF_UNSPEC;
hlen = 12; /* XXX 4(ATM_PH) + 3(LLC) + 5(SNAP) */
hlen = 12; /* XXX 4(ATM_PH) + 3(LLC) + 5(SNAP) */
break;
case DLT_PPP:
@ -327,7 +327,7 @@ bpfopen(dev, flags, fmt, td)
mtx_lock(&bpf_mtx);
d = dev->si_drv1;
/*
* Each minor can be opened by only one process. If the requested
* Each minor can be opened by only one process. If the requested
* minor is in use, return EBUSY.
*/
if (d) {
@ -407,7 +407,7 @@ bpfclose(dev, flags, fmt, td)
static int
bpfread(dev, uio, ioflag)
dev_t dev;
register struct uio *uio;
struct uio *uio;
int ioflag;
{
struct bpf_d *d = dev->si_drv1;
@ -512,7 +512,7 @@ bpfread(dev, uio, ioflag)
*/
static __inline void
bpf_wakeup(d)
register struct bpf_d *d;
struct bpf_d *d;
{
if (d->bd_state == BPF_WAITING) {
callout_stop(&d->bd_callout);
@ -692,7 +692,7 @@ bpfioctl(dev, cmd, addr, flags, td)
if (d->bd_bif != 0)
error = EINVAL;
else {
register u_int size = *(u_int *)addr;
u_int size = *(u_int *)addr;
if (size > bpf_maxbufsize)
*(u_int *)addr = size = bpf_maxbufsize;
@ -748,7 +748,7 @@ bpfioctl(dev, cmd, addr, flags, td)
*(u_int *)addr = d->bd_bif->bif_dlt;
break;
/*
/*
* Get a list of supported data link types.
*/
case BIOCGDLTLIST:
@ -901,7 +901,7 @@ bpfioctl(dev, cmd, addr, flags, td)
case BIOCSRSIG: /* Set receive signal */
{
u_int sig;
u_int sig;
sig = *(u_int *)addr;
@ -1037,7 +1037,7 @@ bpf_setif(d, ifr)
*/
static int
bpfpoll(dev, events, td)
register dev_t dev;
dev_t dev;
int events;
struct thread *td;
{
@ -1084,11 +1084,11 @@ bpfpoll(dev, events, td)
void
bpf_tap(bp, pkt, pktlen)
struct bpf_if *bp;
register u_char *pkt;
register u_int pktlen;
u_char *pkt;
u_int pktlen;
{
register struct bpf_d *d;
register u_int slen;
struct bpf_d *d;
u_int slen;
BPFIF_LOCK(bp);
for (d = bp->bif_dlist; d != 0; d = d->bd_next) {
@ -1114,10 +1114,10 @@ static void
bpf_mcopy(src_arg, dst_arg, len)
const void *src_arg;
void *dst_arg;
register size_t len;
size_t len;
{
register const struct mbuf *m;
register u_int count;
const struct mbuf *m;
u_int count;
u_char *dst;
m = src_arg;
@ -1178,14 +1178,14 @@ bpf_mtap(bp, m)
*/
static void
catchpacket(d, pkt, pktlen, snaplen, cpfn)
register struct bpf_d *d;
register u_char *pkt;
register u_int pktlen, snaplen;
register void (*cpfn)(const void *, void *, size_t);
struct bpf_d *d;
u_char *pkt;
u_int pktlen, snaplen;
void (*cpfn)(const void *, void *, size_t);
{
register struct bpf_hdr *hp;
register int totlen, curlen;
register int hdrlen = d->bd_bif->bif_hdrlen;
struct bpf_hdr *hp;
int totlen, curlen;
int hdrlen = d->bd_bif->bif_hdrlen;
/*
* Figure out how many bytes to move. If the packet is
* greater or equal to the snapshot length, transfer that
@ -1245,7 +1245,7 @@ catchpacket(d, pkt, pktlen, snaplen, cpfn)
*/
static int
bpf_allocbufs(d)
register struct bpf_d *d;
struct bpf_d *d;
{
d->bd_fbuf = (caddr_t)malloc(d->bd_bufsize, M_BPF, M_WAITOK);
if (d->bd_fbuf == 0)
@ -1267,7 +1267,7 @@ bpf_allocbufs(d)
*/
static void
bpf_freed(d)
register struct bpf_d *d;
struct bpf_d *d;
{
/*
* We don't need to lock out interrupts since this descriptor has
@ -1510,8 +1510,8 @@ SYSINIT(bpfdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,bpf_drvinit,NULL)
void
bpf_tap(bp, pkt, pktlen)
struct bpf_if *bp;
register u_char *pkt;
register u_int pktlen;
u_char *pkt;
u_int pktlen;
{
}
@ -1537,10 +1537,10 @@ bpfdetach(ifp)
u_int
bpf_filter(pc, p, wirelen, buflen)
register const struct bpf_insn *pc;
register u_char *p;
const struct bpf_insn *pc;
u_char *p;
u_int wirelen;
register u_int buflen;
u_int buflen;
{
return -1; /* "no filter" behaviour */
}

View File

@ -81,7 +81,7 @@
/* 0x007f00ff */
/* module */
static int tapmodevent(module_t, int, void *);
static int tapmodevent(module_t, int, void *);
/* device */
static void tapclone(void *, char *, int, dev_t *);
@ -206,8 +206,8 @@ tapmodevent(mod, type, data)
TAPDEBUG("detaching %s%d\n", ifp->if_name,ifp->if_unit);
KASSERT(!(tp->tap_flags & TAP_OPEN),
("%s%d flags is out of sync", ifp->if_name,
KASSERT(!(tp->tap_flags & TAP_OPEN),
("%s%d flags is out of sync", ifp->if_name,
ifp->if_unit));
/* XXX makedev check? nah.. not right now :) */
@ -219,7 +219,7 @@ tapmodevent(mod, type, data)
free(tp, M_TAP);
}
if (tapbasedev != NOUDEV)
if (tapbasedev != NOUDEV)
destroy_dev(udev2dev(tapbasedev, 0));
@ -254,14 +254,14 @@ tapclone(arg, name, namelen, dev)
if (strcmp(device_name, TAP) == 0) {
/* get first free tap unit */
r = rman_reserve_resource(tapunits, 0, TAPMAXUNIT, 1,
r = rman_reserve_resource(tapunits, 0, TAPMAXUNIT, 1,
RF_ALLOCATED | RF_ACTIVE, NULL);
unit = rman_get_start(r);
minor = unit2minor(unit);
}
else if (strcmp(device_name, VMNET) == 0) {
/* get first free vmnet unit */
r = rman_reserve_resource(vmnetunits, 0, TAPMAXUNIT, 1,
r = rman_reserve_resource(vmnetunits, 0, TAPMAXUNIT, 1,
RF_ALLOCATED | RF_ACTIVE, NULL);
unit = rman_get_start(r);
minor = unit2minor(unit) | VMNET_DEV_MASK;
@ -277,7 +277,7 @@ tapclone(arg, name, namelen, dev)
/* check if device for the unit has been created */
*dev = makedev(CDEV_MAJOR, minor);
if ((*dev)->si_flags & SI_NAMED) {
TAPDEBUG("%s%d device exists. minor = %#x\n",
TAPDEBUG("%s%d device exists. minor = %#x\n",
device_name, unit, minor);
return; /* device has been created */
}
@ -339,7 +339,7 @@ tapcreate(dev)
TAPDEBUG("tapcreate(%s%d). minor = %#x\n", name, unit, minor(dev));
if (!(dev->si_flags & SI_NAMED))
dev = make_dev(&tap_cdevsw, minor(dev), UID_ROOT, GID_WHEEL,
dev = make_dev(&tap_cdevsw, minor(dev), UID_ROOT, GID_WHEEL,
0600, "%s%d", name, unit);
/* generate fake MAC address: 00 bd xx xx xx unit_no */
@ -348,7 +348,7 @@ tapcreate(dev)
bcopy(&ticks, &tp->arpcom.ac_enaddr[2], sizeof(long));
tp->arpcom.ac_enaddr[5] = (u_char)unit;
/* fill the rest and attach interface */
/* fill the rest and attach interface */
ifp = &tp->tap_if;
ifp->if_softc = tp;
ifp->if_unit = unit;
@ -368,13 +368,13 @@ tapcreate(dev)
tp->tap_flags |= TAP_INITED;
TAPDEBUG("interface %s%d is created. minor = %#x\n",
TAPDEBUG("interface %s%d is created. minor = %#x\n",
ifp->if_name, ifp->if_unit, minor(dev));
} /* tapcreate */
/*
* tapopen
* tapopen
*
* to open tunnel. must be superuser
*/
@ -395,10 +395,10 @@ tapopen(dev, flag, mode, td)
unit = dev2unit(dev) & TAPMAXUNIT;
if (minor(dev) & VMNET_DEV_MASK)
r = rman_reserve_resource(vmnetunits, unit, unit, 1,
r = rman_reserve_resource(vmnetunits, unit, unit, 1,
RF_ALLOCATED | RF_ACTIVE, NULL);
else
r = rman_reserve_resource(tapunits, unit, unit, 1,
r = rman_reserve_resource(tapunits, unit, unit, 1,
RF_ALLOCATED | RF_ACTIVE, NULL);
if (r == NULL)
@ -412,7 +412,7 @@ tapopen(dev, flag, mode, td)
tp = dev->si_drv1;
}
KASSERT(!(tp->tap_flags & TAP_OPEN),
KASSERT(!(tp->tap_flags & TAP_OPEN),
("%s%d flags is out of sync", tp->tap_if.if_name, unit));
bcopy(tp->arpcom.ac_enaddr, tp->ether_addr, sizeof(tp->ether_addr));
@ -421,7 +421,7 @@ tapopen(dev, flag, mode, td)
tp->tap_pid = td->td_proc->p_pid;
tp->tap_flags |= TAP_OPEN;
TAPDEBUG("%s%d is open. minor = %#x\n",
TAPDEBUG("%s%d is open. minor = %#x\n",
tp->tap_if.if_name, unit, minor(dev));
return (0);
@ -467,11 +467,11 @@ tapclose(dev, foo, bar, td)
rtinit(ifa, (int)RTM_DELETE, 0);
/* remove address from interface */
bzero(ifa->ifa_addr,
bzero(ifa->ifa_addr,
sizeof(*(ifa->ifa_addr)));
bzero(ifa->ifa_dstaddr,
bzero(ifa->ifa_dstaddr,
sizeof(*(ifa->ifa_dstaddr)));
bzero(ifa->ifa_netmask,
bzero(ifa->ifa_netmask,
sizeof(*(ifa->ifa_netmask)));
}
}
@ -487,11 +487,11 @@ tapclose(dev, foo, bar, td)
tp->tap_flags &= ~TAP_OPEN;
tp->tap_pid = 0;
error = rman_release_resource(tp->tap_unit);
KASSERT((error == 0),
("%s%d could not release unit", ifp->if_name, ifp->if_unit));
KASSERT((error == 0),
("%s%d could not release unit", ifp->if_name, ifp->if_unit));
tp->tap_unit = NULL;
TAPDEBUG("%s%d is closed. minor = %#x\n",
TAPDEBUG("%s%d is closed. minor = %#x\n",
ifp->if_name, ifp->if_unit, minor(dev));
return (0);
@ -531,7 +531,7 @@ tapifioctl(ifp, cmd, data)
u_long cmd;
caddr_t data;
{
struct tap_softc *tp = (struct tap_softc *)(ifp->if_softc);
struct tap_softc *tp = (struct tap_softc *)(ifp->if_softc);
struct ifstat *ifs = NULL;
int s, dummy;
@ -564,8 +564,8 @@ tapifioctl(ifp, cmd, data)
/*
* tapifstart
*
* tapifstart
*
* queue packets from higher level ready to put out
*/
static void
@ -582,11 +582,11 @@ tapifstart(ifp)
* XXX: can this do any harm because of queue overflow?
*/
if (((tp->tap_flags & TAP_VMNET) == 0) &&
if (((tp->tap_flags & TAP_VMNET) == 0) &&
((tp->tap_flags & TAP_READY) != TAP_READY)) {
struct mbuf *m = NULL;
TAPDEBUG("%s%d not ready, tap_flags = 0x%x\n", ifp->if_name,
TAPDEBUG("%s%d not ready, tap_flags = 0x%x\n", ifp->if_name,
ifp->if_unit, tp->tap_flags);
s = splimp();
@ -637,26 +637,26 @@ tapioctl(dev, cmd, data, flag, td)
{
struct tap_softc *tp = dev->si_drv1;
struct ifnet *ifp = &tp->tap_if;
struct tapinfo *tapp = NULL;
struct tapinfo *tapp = NULL;
int s;
int f;
switch (cmd) {
case TAPSIFINFO:
case TAPSIFINFO:
s = splimp();
tapp = (struct tapinfo *)data;
ifp->if_mtu = tapp->mtu;
ifp->if_type = tapp->type;
ifp->if_baudrate = tapp->baudrate;
tapp = (struct tapinfo *)data;
ifp->if_mtu = tapp->mtu;
ifp->if_type = tapp->type;
ifp->if_baudrate = tapp->baudrate;
splx(s);
break;
break;
case TAPGIFINFO:
tapp = (struct tapinfo *)data;
tapp->mtu = ifp->if_mtu;
tapp->type = ifp->if_type;
tapp->baudrate = ifp->if_baudrate;
break;
case TAPGIFINFO:
tapp = (struct tapinfo *)data;
tapp->mtu = ifp->if_mtu;
tapp->type = ifp->if_type;
tapp->baudrate = ifp->if_baudrate;
break;
case TAPSDEBUG:
tapdebug = *(int *)data;
@ -756,7 +756,7 @@ tapread(dev, uio, flag)
struct mbuf *m = NULL;
int error = 0, len, s;
TAPDEBUG("%s%d reading, minor = %#x\n",
TAPDEBUG("%s%d reading, minor = %#x\n",
ifp->if_name, ifp->if_unit, minor(dev));
if ((tp->tap_flags & TAP_READY) != TAP_READY) {
@ -777,7 +777,7 @@ tapread(dev, uio, flag)
if (m == NULL) {
if (flag & IO_NDELAY)
return (EWOULDBLOCK);
tp->tap_flags |= TAP_RWAIT;
error = tsleep((caddr_t)tp,PCATCH|(PZERO+1),"taprd",0);
if (error)
@ -799,7 +799,7 @@ tapread(dev, uio, flag)
}
if (m != NULL) {
TAPDEBUG("%s%d dropping mbuf, minor = %#x\n", ifp->if_name,
TAPDEBUG("%s%d dropping mbuf, minor = %#x\n", ifp->if_name,
ifp->if_unit, minor(dev));
m_freem(m);
}
@ -822,9 +822,9 @@ tapwrite(dev, uio, flag)
struct tap_softc *tp = dev->si_drv1;
struct ifnet *ifp = &tp->tap_if;
struct mbuf *top = NULL, **mp = NULL, *m = NULL;
int error = 0, tlen, mlen;
int error = 0, tlen, mlen;
TAPDEBUG("%s%d writting, minor = %#x\n",
TAPDEBUG("%s%d writting, minor = %#x\n",
ifp->if_name, ifp->if_unit, minor(dev));
if (uio->uio_resid == 0)
@ -869,7 +869,7 @@ tapwrite(dev, uio, flag)
top->m_pkthdr.len = tlen;
top->m_pkthdr.rcvif = ifp;
/* Pass packet up to parent. */
(*ifp->if_input)(ifp, top);
ifp->if_ipackets ++; /* ibytes are counted in parent */
@ -893,9 +893,9 @@ tappoll(dev, events, td)
{
struct tap_softc *tp = dev->si_drv1;
struct ifnet *ifp = &tp->tap_if;
int s, revents = 0;
int s, revents = 0;
TAPDEBUG("%s%d polling, minor = %#x\n",
TAPDEBUG("%s%d polling, minor = %#x\n",
ifp->if_name, ifp->if_unit, minor(dev));
s = splimp();

View File

@ -135,15 +135,15 @@ tunclone(void *arg, char *name, int namelen, dev_t *dev)
}
static int
tunmodevent(module_t mod, int type, void *data)
tunmodevent(module_t mod, int type, void *data)
{
static eventhandler_tag tag;
struct tun_softc *tp;
dev_t dev;
int err;
switch (type) {
case MOD_LOAD:
switch (type) {
case MOD_LOAD:
tag = EVENTHANDLER_REGISTER(dev_clone, tunclone, 0, 1000);
if (tag == NULL)
return (ENOMEM);
@ -162,8 +162,8 @@ tunmodevent(module_t mod, int type, void *data)
EVENTHANDLER_DEREGISTER(dev_clone, tag);
return (err);
}
break;
case MOD_UNLOAD:
break;
case MOD_UNLOAD:
err = rman_fini(&tununits);
if (err != 0)
return (err);
@ -192,15 +192,15 @@ tunmodevent(module_t mod, int type, void *data)
destroy_dev(udev2dev(tunbasedev, 0));
break;
}
return 0;
}
}
return 0;
}
static moduledata_t tun_mod = {
"if_tun",
tunmodevent,
static moduledata_t tun_mod = {
"if_tun",
tunmodevent,
0
};
};
DECLARE_MODULE(if_tun, tun_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
@ -314,7 +314,7 @@ tunclose(dev_t dev, int foo, int bar, struct thread *td)
}
if (ifp->if_flags & IFF_RUNNING) {
register struct ifaddr *ifa;
struct ifaddr *ifa;
s = splimp();
/* find internet addresses and delete routes */
@ -340,7 +340,7 @@ static int
tuninit(struct ifnet *ifp)
{
struct tun_softc *tp = ifp->if_softc;
register struct ifaddr *ifa;
struct ifaddr *ifa;
int error = 0;
TUNDEBUG("%s%d: tuninit\n", ifp->if_name, ifp->if_unit);
@ -348,7 +348,7 @@ tuninit(struct ifnet *ifp)
ifp->if_flags |= IFF_UP | IFF_RUNNING;
getmicrotime(&ifp->if_lastchange);
for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa;
for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa;
ifa = TAILQ_NEXT(ifa, ifa_link)) {
if (ifa->ifa_addr == NULL)
error = EFAULT;
@ -532,26 +532,26 @@ tunioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
int s;
int error;
struct tun_softc *tp = dev->si_drv1;
struct tuninfo *tunp;
struct tuninfo *tunp;
switch (cmd) {
case TUNSIFINFO:
tunp = (struct tuninfo *)data;
case TUNSIFINFO:
tunp = (struct tuninfo *)data;
if (tunp->mtu < IF_MINMTU)
return (EINVAL);
if (tp->tun_if.if_mtu != tunp->mtu
if (tp->tun_if.if_mtu != tunp->mtu
&& (error = suser(td)) != 0)
return (error);
tp->tun_if.if_mtu = tunp->mtu;
tp->tun_if.if_type = tunp->type;
tp->tun_if.if_baudrate = tunp->baudrate;
break;
case TUNGIFINFO:
tunp = (struct tuninfo *)data;
tunp->mtu = tp->tun_if.if_mtu;
tunp->type = tp->tun_if.if_type;
tunp->baudrate = tp->tun_if.if_baudrate;
break;
tp->tun_if.if_mtu = tunp->mtu;
tp->tun_if.if_type = tunp->type;
tp->tun_if.if_baudrate = tunp->baudrate;
break;
case TUNGIFINFO:
tunp = (struct tuninfo *)data;
tunp->mtu = tp->tun_if.if_mtu;
tunp->type = tp->tun_if.if_type;
tunp->baudrate = tp->tun_if.if_baudrate;
break;
case TUNSDEBUG:
tundebug = *(int *)data;
break;
@ -569,7 +569,7 @@ tunioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
if (*(int *)data) {
tp->tun_flags |= TUN_IFHEAD;
tp->tun_flags &= ~TUN_LMODE;
} else
} else
tp->tun_flags &= ~TUN_IFHEAD;
break;
case TUNGIFHEAD:
@ -606,7 +606,7 @@ tunioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
s = splimp();
if (tp->tun_if.if_snd.ifq_head) {
struct mbuf *mb = tp->tun_if.if_snd.ifq_head;
for( *(int *)data = 0; mb != 0; mb = mb->m_next)
for( *(int *)data = 0; mb != 0; mb = mb->m_next)
*(int *)data += mb->m_len;
} else
*(int *)data = 0;