Bow to the whining masses and change a union back into void *. Retain
removal of unnecessary casts and throw in some minor cleanups to see if anyone complains, just for the hell of it.
This commit is contained in:
parent
a15700fe32
commit
48e3128b34
@ -222,7 +222,7 @@ struct tcpiphdr *ti;
|
||||
}
|
||||
|
||||
s = (struct socket *)calloc(1, sizeof(*s));
|
||||
if (KMCPY(s, f->un_data.socket, sizeof(*s)) == -1)
|
||||
if (KMCPY(s, f->f_data, sizeof(*s)) == -1)
|
||||
{
|
||||
fprintf(stderr, "read(%#x,%#x,%d) - f_data - failed\n",
|
||||
o[fd], s, sizeof(*s));
|
||||
@ -316,10 +316,10 @@ struct tcpiphdr *ti;
|
||||
}
|
||||
|
||||
s = (struct socket *)calloc(1, sizeof(*s));
|
||||
if (KMCPY(s, f->un_data.socket, sizeof(*s)) == -1)
|
||||
if (KMCPY(s, f->f_data, sizeof(*s)) == -1)
|
||||
{
|
||||
fprintf(stderr, "read(%#lx,%#lx,%lu) - f_data - failed\n",
|
||||
(u_long)f->un_data.socket, (u_long)s,
|
||||
(u_long)f->f_data, (u_long)s,
|
||||
(u_long)sizeof(*s));
|
||||
return NULL;
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ osf1_fstatfs(td, uap)
|
||||
|
||||
if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)))
|
||||
return (error);
|
||||
mp = (fp->un_data.vnode)->v_mount;
|
||||
mp = ((struct vnode *)fp->f_data)->v_mount;
|
||||
#ifdef MAC
|
||||
error = mac_check_mount_stat(td->td_proc->p_ucred, mp);
|
||||
if (error) {
|
||||
|
@ -270,7 +270,7 @@ getdents_common(struct thread *td, struct linux_getdents64_args *args,
|
||||
return (EBADF);
|
||||
}
|
||||
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
if (vp->v_type != VDIR) {
|
||||
fdrop(fp, td);
|
||||
return (EINVAL);
|
||||
|
@ -289,7 +289,7 @@ linux_fstatfs(struct thread *td, struct linux_fstatfs_args *args)
|
||||
error = getvnode(td->td_proc->p_fd, args->fd, &fp);
|
||||
if (error)
|
||||
return error;
|
||||
mp = fp->un_data.vnode->v_mount;
|
||||
mp = ((struct vnode *)fp->f_data)->v_mount;
|
||||
#ifdef MAC
|
||||
error = mac_check_mount_stat(td->td_proc->p_ucred, mp);
|
||||
if (error) {
|
||||
|
@ -311,7 +311,7 @@ fd_truncate(td, fd, flp)
|
||||
if ((error = fget(td, fd, &fp)) != 0)
|
||||
return (error);
|
||||
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
|
||||
if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO) {
|
||||
fdrop(fp, td);
|
||||
|
@ -115,7 +115,7 @@ svr4_sys_read(td, uap)
|
||||
}
|
||||
|
||||
if (fp->f_type == DTYPE_SOCKET) {
|
||||
so = fp->un_data.socket;
|
||||
so = fp->f_data;
|
||||
DPRINTF(("fd %d is a socket\n", uap->fd));
|
||||
if (so->so_state & SS_ASYNC) {
|
||||
DPRINTF(("fd %d is an ASYNC socket!\n", uap->fd));
|
||||
|
@ -112,7 +112,7 @@ svr4_sys_ioctl(td, uap)
|
||||
|
||||
#if defined(DEBUG_SVR4)
|
||||
if (fp->f_type == DTYPE_SOCKET) {
|
||||
struct socket *so = fp->un_data.socket;
|
||||
struct socket *so = fp->f_data;
|
||||
DPRINTF(("<<< IN: so_state = 0x%x\n", so->so_state));
|
||||
}
|
||||
#endif
|
||||
@ -157,7 +157,7 @@ svr4_sys_ioctl(td, uap)
|
||||
if (fp->f_type == DTYPE_SOCKET) {
|
||||
struct socket *so;
|
||||
|
||||
so = fp->un_data.socket;
|
||||
so = fp->f_data;
|
||||
DPRINTF((">>> OUT: so_state = 0x%x\n", so->so_state));
|
||||
}
|
||||
#endif
|
||||
|
@ -271,7 +271,7 @@ svr4_sys_getdents64(td, uap)
|
||||
return (EBADF);
|
||||
}
|
||||
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
|
||||
if (vp->v_type != VDIR) {
|
||||
fdrop(fp, td);
|
||||
@ -451,7 +451,7 @@ svr4_sys_getdents(td, uap)
|
||||
return (EBADF);
|
||||
}
|
||||
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
if (vp->v_type != VDIR) {
|
||||
fdrop(fp, td);
|
||||
return (EINVAL);
|
||||
@ -627,7 +627,7 @@ svr4_sys_fchroot(td, uap)
|
||||
return error;
|
||||
if ((error = getvnode(fdp, uap->fd, &fp)) != 0)
|
||||
return error;
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
if (vp->v_type != VDIR)
|
||||
error = ENOTDIR;
|
||||
|
@ -82,7 +82,7 @@ svr4_find_socket(td, fp, dev, ino)
|
||||
ino_t ino;
|
||||
{
|
||||
struct svr4_sockcache_entry *e;
|
||||
void *cookie = fp->un_data.socket->so_emuldata;
|
||||
void *cookie = ((struct socket *)fp->f_data)->so_emuldata;
|
||||
|
||||
if (svr4_str_initialized != 2) {
|
||||
if (atomic_cmpset_acq_int(&svr4_str_initialized, 0, 1)) {
|
||||
|
@ -644,7 +644,7 @@ getparm(fp, pa)
|
||||
if (st == NULL)
|
||||
return;
|
||||
|
||||
so = fp->un_data.socket;
|
||||
so = fp->f_data;
|
||||
|
||||
pa->family = st->s_family;
|
||||
|
||||
|
@ -274,7 +274,7 @@ streamsopen(dev_t dev, int oflags, int devtype, struct thread *td)
|
||||
}
|
||||
|
||||
FILEDESC_LOCK(p->p_fd);
|
||||
fp->un_data.socket = so;
|
||||
fp->f_data = so;
|
||||
fp->f_flag = FREAD|FWRITE;
|
||||
fp->f_ops = &svr4_netops;
|
||||
fp->f_type = DTYPE_SOCKET;
|
||||
@ -357,7 +357,7 @@ svr4_stream_get(fp)
|
||||
if (fp == NULL || fp->f_type != DTYPE_SOCKET)
|
||||
return NULL;
|
||||
|
||||
so = fp->un_data.socket;
|
||||
so = fp->f_data;
|
||||
|
||||
/*
|
||||
* mpfixme: lock socketbuffer here
|
||||
@ -395,7 +395,7 @@ svr4_delete_socket(p, fp)
|
||||
struct file *fp;
|
||||
{
|
||||
struct svr4_sockcache_entry *e;
|
||||
void *cookie = fp->un_data.socket->so_emuldata;
|
||||
void *cookie = ((struct socket *)fp->f_data)->so_emuldata;
|
||||
|
||||
while (svr4_str_initialized != 2) {
|
||||
if (atomic_cmpset_acq_int(&svr4_str_initialized, 0, 1)) {
|
||||
@ -418,7 +418,7 @@ svr4_delete_socket(p, fp)
|
||||
static int
|
||||
svr4_soo_close(struct file *fp, struct thread *td)
|
||||
{
|
||||
struct socket *so = fp->un_data.socket;
|
||||
struct socket *so = fp->f_data;
|
||||
|
||||
/* CHECKUNIT_DIAG(ENXIO);*/
|
||||
|
||||
|
@ -395,7 +395,7 @@ fdesc_setattr(ap)
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) {
|
||||
fdrop(fp, ap->a_td);
|
||||
return (error);
|
||||
|
@ -352,7 +352,7 @@ fifo_ioctl(ap)
|
||||
if (ap->a_command == FIONBIO)
|
||||
return (0);
|
||||
if (ap->a_fflag & FREAD) {
|
||||
filetmp.un_data.socket = ap->a_vp->v_fifoinfo->fi_readsock;
|
||||
filetmp.f_data = ap->a_vp->v_fifoinfo->fi_readsock;
|
||||
filetmp.f_cred = ap->a_cred;
|
||||
error = soo_ioctl(&filetmp, ap->a_command, ap->a_data,
|
||||
ap->a_td->td_ucred, ap->a_td);
|
||||
@ -360,7 +360,7 @@ fifo_ioctl(ap)
|
||||
return (error);
|
||||
}
|
||||
if (ap->a_fflag & FWRITE) {
|
||||
filetmp.un_data.socket = ap->a_vp->v_fifoinfo->fi_writesock;
|
||||
filetmp.f_data = ap->a_vp->v_fifoinfo->fi_writesock;
|
||||
filetmp.f_cred = ap->a_cred;
|
||||
error = soo_ioctl(&filetmp, ap->a_command, ap->a_data,
|
||||
ap->a_td->td_ucred, ap->a_td);
|
||||
@ -482,9 +482,9 @@ fifo_poll(ap)
|
||||
events |= POLLINIGNEOF;
|
||||
}
|
||||
|
||||
filetmp.un_data.socket = ap->a_vp->v_fifoinfo->fi_readsock;
|
||||
filetmp.f_data = ap->a_vp->v_fifoinfo->fi_readsock;
|
||||
filetmp.f_cred = ap->a_cred;
|
||||
if (filetmp.un_data.socket)
|
||||
if (filetmp.f_data)
|
||||
revents |= soo_poll(&filetmp, events,
|
||||
ap->a_td->td_ucred, ap->a_td);
|
||||
|
||||
@ -497,11 +497,12 @@ fifo_poll(ap)
|
||||
}
|
||||
events = ap->a_events & (POLLOUT | POLLWRNORM | POLLWRBAND);
|
||||
if (events) {
|
||||
filetmp.un_data.socket = ap->a_vp->v_fifoinfo->fi_writesock;
|
||||
filetmp.f_data = ap->a_vp->v_fifoinfo->fi_writesock;
|
||||
filetmp.f_cred = ap->a_cred;
|
||||
if (filetmp.un_data.socket)
|
||||
if (filetmp.f_data) {
|
||||
revents |= soo_poll(&filetmp, events,
|
||||
ap->a_td->td_ucred, ap->a_td);
|
||||
}
|
||||
}
|
||||
return (revents);
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ portal_mount(mp, path, data, ndp, td)
|
||||
fdrop(fp, td);
|
||||
return(ENOTSOCK);
|
||||
}
|
||||
so = fp->un_data.socket; /* XXX race against userland */
|
||||
so = fp->f_data; /* XXX race against userland */
|
||||
if (so->so_proto->pr_domain->dom_family != AF_UNIX) {
|
||||
fdrop(fp, td);
|
||||
return (ESOCKTNOSUPPORT);
|
||||
@ -186,7 +186,7 @@ portal_unmount(mp, mntflags, td)
|
||||
* daemon to wake up, and then the accept will get ECONNABORTED
|
||||
* which it interprets as a request to go and bury itself.
|
||||
*/
|
||||
soshutdown(VFSTOPORTAL(mp)->pm_server->un_data.socket, 2);
|
||||
soshutdown(VFSTOPORTAL(mp)->pm_server->f_data, 2);
|
||||
/*
|
||||
* Discard reference to underlying file. Must call closef because
|
||||
* this may be the last reference.
|
||||
|
@ -269,7 +269,7 @@ portal_open(ap)
|
||||
/*
|
||||
* Kick off connection
|
||||
*/
|
||||
error = portal_connect(so, fmp->pm_server->un_data.socket);
|
||||
error = portal_connect(so, fmp->pm_server->f_data);
|
||||
if (error)
|
||||
goto bad;
|
||||
|
||||
|
@ -1329,7 +1329,7 @@ union_dircheck(struct thread *td, struct vnode **vp, struct file *fp)
|
||||
}
|
||||
VOP_UNLOCK(lvp, 0, td);
|
||||
FILE_LOCK(fp);
|
||||
fp->un_data.vnode = lvp;
|
||||
fp->f_data = lvp;
|
||||
fp->f_offset = 0;
|
||||
FILE_UNLOCK(fp);
|
||||
error = vn_close(*vp, FREAD, fp->f_cred, td);
|
||||
|
@ -323,7 +323,7 @@ ibcs2_getdents(td, uap)
|
||||
fdrop(fp, td);
|
||||
return (EBADF);
|
||||
}
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
if (vp->v_type != VDIR) { /* XXX vnode readdir op should do this */
|
||||
fdrop(fp, td);
|
||||
return (EINVAL);
|
||||
@ -480,7 +480,7 @@ ibcs2_read(td, uap)
|
||||
fdrop(fp, td);
|
||||
return (EBADF);
|
||||
}
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
if (vp->v_type != VDIR) {
|
||||
fdrop(fp, td);
|
||||
return read(td, (struct read_args *)uap);
|
||||
|
@ -132,7 +132,7 @@ ibcs2_fstatfs(td, uap)
|
||||
|
||||
if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
|
||||
return (error);
|
||||
mp = fp->un_data.vnode->v_mount;
|
||||
mp = ((struct vnode *)fp->f_data)->v_mount;
|
||||
sp = &mp->mnt_stat;
|
||||
error = VFS_STATFS(mp, sp, td);
|
||||
fdrop(fp, td);
|
||||
|
@ -780,8 +780,7 @@ __acl_get_fd(struct thread *td, struct __acl_get_fd_args *uap)
|
||||
mtx_lock(&Giant);
|
||||
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
|
||||
if (error == 0) {
|
||||
error = vacl_get_acl(td, fp->un_data.vnode,
|
||||
uap->type, uap->aclp);
|
||||
error = vacl_get_acl(td, fp->f_data, uap->type, uap->aclp);
|
||||
fdrop(fp, td);
|
||||
}
|
||||
mtx_unlock(&Giant);
|
||||
@ -802,8 +801,7 @@ __acl_set_fd(struct thread *td, struct __acl_set_fd_args *uap)
|
||||
mtx_lock(&Giant);
|
||||
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
|
||||
if (error == 0) {
|
||||
error = vacl_set_acl(td, fp->un_data.vnode,
|
||||
uap->type, uap->aclp);
|
||||
error = vacl_set_acl(td, fp->f_data, uap->type, uap->aclp);
|
||||
fdrop(fp, td);
|
||||
}
|
||||
mtx_unlock(&Giant);
|
||||
@ -868,7 +866,7 @@ __acl_delete_fd(struct thread *td, struct __acl_delete_fd_args *uap)
|
||||
mtx_lock(&Giant);
|
||||
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
|
||||
if (error == 0) {
|
||||
error = vacl_delete(td, fp->un_data.vnode, uap->type);
|
||||
error = vacl_delete(td, fp->f_data, uap->type);
|
||||
fdrop(fp, td);
|
||||
}
|
||||
mtx_unlock(&Giant);
|
||||
@ -933,8 +931,7 @@ __acl_aclcheck_fd(struct thread *td, struct __acl_aclcheck_fd_args *uap)
|
||||
mtx_lock(&Giant);
|
||||
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
|
||||
if (error == 0) {
|
||||
error = vacl_aclcheck(td, fp->un_data.vnode,
|
||||
uap->type, uap->aclp);
|
||||
error = vacl_aclcheck(td, fp->f_data, uap->type, uap->aclp);
|
||||
fdrop(fp, td);
|
||||
}
|
||||
mtx_unlock(&Giant);
|
||||
|
@ -355,7 +355,7 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg)
|
||||
*/
|
||||
fhold(fp);
|
||||
FILEDESC_UNLOCK(fdp);
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
|
||||
switch (flp->l_type) {
|
||||
case F_RDLCK:
|
||||
@ -420,7 +420,7 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg)
|
||||
*/
|
||||
fhold(fp);
|
||||
FILEDESC_UNLOCK(fdp);
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
error = VOP_ADVLOCK(vp, (caddr_t)p->p_leader, F_GETLK, flp,
|
||||
F_POSIX);
|
||||
fdrop(fp, td);
|
||||
@ -979,7 +979,7 @@ fpathconf(td, uap)
|
||||
break;
|
||||
case DTYPE_FIFO:
|
||||
case DTYPE_VNODE:
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
mtx_lock(&Giant);
|
||||
error = VOP_PATHCONF(vp, uap->name, td->td_retval);
|
||||
mtx_unlock(&Giant);
|
||||
@ -1424,7 +1424,7 @@ static int
|
||||
is_unsafe(struct file *fp)
|
||||
{
|
||||
if (fp->f_type == DTYPE_VNODE) {
|
||||
struct vnode *vp = fp->un_data.vnode;
|
||||
struct vnode *vp = fp->f_data;
|
||||
|
||||
if ((vp->v_vflag & VV_PROCDEP) != 0)
|
||||
return (1);
|
||||
@ -1582,7 +1582,7 @@ fdcheckstd(td)
|
||||
break;
|
||||
}
|
||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||
fp->un_data.vnode = nd.ni_vp;
|
||||
fp->f_data = nd.ni_vp;
|
||||
fp->f_flag = flags;
|
||||
fp->f_ops = &vnops;
|
||||
fp->f_type = DTYPE_VNODE;
|
||||
@ -1627,7 +1627,7 @@ closef(fp, td)
|
||||
lf.l_start = 0;
|
||||
lf.l_len = 0;
|
||||
lf.l_type = F_UNLCK;
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
(void) VOP_ADVLOCK(vp, (caddr_t)td->td_proc->p_leader,
|
||||
F_UNLCK, &lf, F_POSIX);
|
||||
}
|
||||
@ -1741,7 +1741,7 @@ _fgetvp(struct thread *td, int fd, struct vnode **vpp, int flags)
|
||||
if (fp->f_type != DTYPE_VNODE && fp->f_type != DTYPE_FIFO) {
|
||||
error = EINVAL;
|
||||
} else {
|
||||
*vpp = fp->un_data.vnode;
|
||||
*vpp = fp->f_data;
|
||||
vref(*vpp);
|
||||
}
|
||||
FILEDESC_UNLOCK(td->td_proc->p_fd);
|
||||
@ -1790,7 +1790,7 @@ fgetsock(struct thread *td, int fd, struct socket **spp, u_int *fflagp)
|
||||
if (fp->f_type != DTYPE_SOCKET) {
|
||||
error = ENOTSOCK;
|
||||
} else {
|
||||
*spp = fp->un_data.socket;
|
||||
*spp = fp->f_data;
|
||||
if (fflagp)
|
||||
*fflagp = fp->f_flag;
|
||||
soref(*spp);
|
||||
@ -1838,7 +1838,7 @@ fdrop_locked(fp, td)
|
||||
lf.l_start = 0;
|
||||
lf.l_len = 0;
|
||||
lf.l_type = F_UNLCK;
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
FILE_UNLOCK(fp);
|
||||
(void) VOP_ADVLOCK(vp, (caddr_t)fp, F_UNLCK, &lf, F_FLOCK);
|
||||
} else
|
||||
@ -1886,7 +1886,7 @@ flock(td, uap)
|
||||
}
|
||||
|
||||
mtx_lock(&Giant);
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
lf.l_whence = SEEK_SET;
|
||||
lf.l_start = 0;
|
||||
lf.l_len = 0;
|
||||
@ -2110,14 +2110,12 @@ sysctl_kern_file(SYSCTL_HANDLER_ARGS)
|
||||
continue;
|
||||
xf.xf_fd = n;
|
||||
xf.xf_file = fp;
|
||||
xf.xun_data.generic = fp->un_data.generic;
|
||||
#define XF_COPY(field) xf.xf_##field = fp->f_##field
|
||||
XF_COPY(type);
|
||||
XF_COPY(count);
|
||||
XF_COPY(msgcount);
|
||||
XF_COPY(offset);
|
||||
XF_COPY(flag);
|
||||
#undef XF_COPY
|
||||
xf.xf_data = fp->f_data;
|
||||
xf.xf_type = fp->f_type;
|
||||
xf.xf_count = fp->f_count;
|
||||
xf.xf_msgcount = fp->f_msgcount;
|
||||
xf.xf_offset = fp->f_offset;
|
||||
xf.xf_flag = fp->f_flag;
|
||||
error = SYSCTL_OUT(req, &xf, sizeof(xf));
|
||||
if (error)
|
||||
break;
|
||||
|
@ -157,7 +157,7 @@ filt_fileattach(struct knote *kn)
|
||||
static int
|
||||
kqueue_kqfilter(struct file *fp, struct knote *kn)
|
||||
{
|
||||
struct kqueue *kq = kn->kn_fp->un_data.kqueue;
|
||||
struct kqueue *kq = kn->kn_fp->f_data;
|
||||
|
||||
if (kn->kn_filter != EVFILT_READ)
|
||||
return (1);
|
||||
@ -170,7 +170,7 @@ kqueue_kqfilter(struct file *fp, struct knote *kn)
|
||||
static void
|
||||
filt_kqdetach(struct knote *kn)
|
||||
{
|
||||
struct kqueue *kq = kn->kn_fp->un_data.kqueue;
|
||||
struct kqueue *kq = kn->kn_fp->f_data;
|
||||
|
||||
SLIST_REMOVE(&kq->kq_sel.si_note, kn, knote, kn_selnext);
|
||||
}
|
||||
@ -179,7 +179,7 @@ filt_kqdetach(struct knote *kn)
|
||||
static int
|
||||
filt_kqueue(struct knote *kn, long hint)
|
||||
{
|
||||
struct kqueue *kq = kn->kn_fp->un_data.kqueue;
|
||||
struct kqueue *kq = kn->kn_fp->f_data;
|
||||
|
||||
kn->kn_data = kq->kq_count;
|
||||
return (kn->kn_data > 0);
|
||||
@ -378,7 +378,7 @@ kqueue(struct thread *td, struct kqueue_args *uap)
|
||||
fp->f_type = DTYPE_KQUEUE;
|
||||
fp->f_ops = &kqueueops;
|
||||
TAILQ_INIT(&kq->kq_head);
|
||||
fp->un_data.kqueue = kq;
|
||||
fp->f_data = kq;
|
||||
FILE_UNLOCK(fp);
|
||||
FILEDESC_LOCK(fdp);
|
||||
td->td_retval[0] = fd;
|
||||
@ -427,7 +427,7 @@ kevent(struct thread *td, struct kevent_args *uap)
|
||||
}
|
||||
mtx_lock(&Giant);
|
||||
|
||||
kq = fp->un_data.kqueue;
|
||||
kq = fp->f_data;
|
||||
nerrors = 0;
|
||||
|
||||
while (uap->nchanges > 0) {
|
||||
@ -650,7 +650,7 @@ kqueue_scan(struct file *fp, int maxevents, struct kevent *ulistp,
|
||||
|
||||
FILE_LOCK_ASSERT(fp, MA_NOTOWNED);
|
||||
|
||||
kq = fp->un_data.kqueue;
|
||||
kq = fp->f_data;
|
||||
count = maxevents;
|
||||
if (count == 0)
|
||||
goto done;
|
||||
@ -806,7 +806,7 @@ kqueue_poll(struct file *fp, int events, struct ucred *active_cred,
|
||||
int revents = 0;
|
||||
int s = splnet();
|
||||
|
||||
kq = fp->un_data.kqueue;
|
||||
kq = fp->f_data;
|
||||
if (events & (POLLIN | POLLRDNORM)) {
|
||||
if (kq->kq_count) {
|
||||
revents |= events & (POLLIN | POLLRDNORM);
|
||||
@ -826,7 +826,7 @@ kqueue_stat(struct file *fp, struct stat *st, struct ucred *active_cred,
|
||||
{
|
||||
struct kqueue *kq;
|
||||
|
||||
kq = fp->un_data.kqueue;
|
||||
kq = fp->f_data;
|
||||
bzero((void *)st, sizeof(*st));
|
||||
st->st_size = kq->kq_count;
|
||||
st->st_blksize = sizeof(struct kevent);
|
||||
@ -838,7 +838,7 @@ kqueue_stat(struct file *fp, struct stat *st, struct ucred *active_cred,
|
||||
static int
|
||||
kqueue_close(struct file *fp, struct thread *td)
|
||||
{
|
||||
struct kqueue *kq = fp->un_data.kqueue;
|
||||
struct kqueue *kq = fp->f_data;
|
||||
struct filedesc *fdp = td->td_proc->p_fd;
|
||||
struct knote **knp, *kn, *kn0;
|
||||
int i;
|
||||
@ -885,7 +885,7 @@ kqueue_close(struct file *fp, struct thread *td)
|
||||
}
|
||||
FILEDESC_UNLOCK(fdp);
|
||||
free(kq, M_KQUEUE);
|
||||
fp->un_data.kqueue = NULL;
|
||||
fp->f_data = NULL;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -3211,7 +3211,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
|
||||
switch (fp->f_type) {
|
||||
case DTYPE_FIFO:
|
||||
case DTYPE_VNODE:
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
|
||||
mac_init_vnode_label(&intlabel);
|
||||
|
||||
@ -3221,7 +3221,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
|
||||
|
||||
break;
|
||||
case DTYPE_PIPE:
|
||||
pipe = fp->un_data.pipe;
|
||||
pipe = fp->f_data;
|
||||
|
||||
mac_init_pipe_label(&intlabel);
|
||||
|
||||
@ -3419,7 +3419,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
|
||||
break;
|
||||
}
|
||||
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
|
||||
if (error != 0) {
|
||||
mac_destroy_vnode_label(&intlabel);
|
||||
@ -3438,7 +3438,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
|
||||
mac_init_pipe_label(&intlabel);
|
||||
error = mac_internalize_pipe_label(&intlabel, buffer);
|
||||
if (error == 0) {
|
||||
pipe = fp->un_data.pipe;
|
||||
pipe = fp->f_data;
|
||||
PIPE_LOCK(pipe);
|
||||
error = mac_pipe_label_set(td->td_ucred, pipe,
|
||||
&intlabel);
|
||||
|
@ -780,8 +780,7 @@ __acl_get_fd(struct thread *td, struct __acl_get_fd_args *uap)
|
||||
mtx_lock(&Giant);
|
||||
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
|
||||
if (error == 0) {
|
||||
error = vacl_get_acl(td, fp->un_data.vnode,
|
||||
uap->type, uap->aclp);
|
||||
error = vacl_get_acl(td, fp->f_data, uap->type, uap->aclp);
|
||||
fdrop(fp, td);
|
||||
}
|
||||
mtx_unlock(&Giant);
|
||||
@ -802,8 +801,7 @@ __acl_set_fd(struct thread *td, struct __acl_set_fd_args *uap)
|
||||
mtx_lock(&Giant);
|
||||
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
|
||||
if (error == 0) {
|
||||
error = vacl_set_acl(td, fp->un_data.vnode,
|
||||
uap->type, uap->aclp);
|
||||
error = vacl_set_acl(td, fp->f_data, uap->type, uap->aclp);
|
||||
fdrop(fp, td);
|
||||
}
|
||||
mtx_unlock(&Giant);
|
||||
@ -868,7 +866,7 @@ __acl_delete_fd(struct thread *td, struct __acl_delete_fd_args *uap)
|
||||
mtx_lock(&Giant);
|
||||
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
|
||||
if (error == 0) {
|
||||
error = vacl_delete(td, fp->un_data.vnode, uap->type);
|
||||
error = vacl_delete(td, fp->f_data, uap->type);
|
||||
fdrop(fp, td);
|
||||
}
|
||||
mtx_unlock(&Giant);
|
||||
@ -933,8 +931,7 @@ __acl_aclcheck_fd(struct thread *td, struct __acl_aclcheck_fd_args *uap)
|
||||
mtx_lock(&Giant);
|
||||
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
|
||||
if (error == 0) {
|
||||
error = vacl_aclcheck(td, fp->un_data.vnode,
|
||||
uap->type, uap->aclp);
|
||||
error = vacl_aclcheck(td, fp->f_data, uap->type, uap->aclp);
|
||||
fdrop(fp, td);
|
||||
}
|
||||
mtx_unlock(&Giant);
|
||||
|
@ -238,7 +238,7 @@ pipe(td, uap)
|
||||
FILE_LOCK(rf);
|
||||
rf->f_flag = FREAD | FWRITE;
|
||||
rf->f_type = DTYPE_PIPE;
|
||||
rf->un_data.pipe = rpipe;
|
||||
rf->f_data = rpipe;
|
||||
rf->f_ops = &pipeops;
|
||||
FILE_UNLOCK(rf);
|
||||
error = falloc(td, &wf, &fd);
|
||||
@ -259,7 +259,7 @@ pipe(td, uap)
|
||||
FILE_LOCK(wf);
|
||||
wf->f_flag = FREAD | FWRITE;
|
||||
wf->f_type = DTYPE_PIPE;
|
||||
wf->un_data.pipe = wpipe;
|
||||
wf->f_data = wpipe;
|
||||
wf->f_ops = &pipeops;
|
||||
FILE_UNLOCK(wf);
|
||||
td->td_retval[1] = fd;
|
||||
@ -452,7 +452,7 @@ pipe_read(fp, uio, active_cred, flags, td)
|
||||
struct thread *td;
|
||||
int flags;
|
||||
{
|
||||
struct pipe *rpipe = fp->un_data.pipe;
|
||||
struct pipe *rpipe = fp->f_data;
|
||||
int error;
|
||||
int nread = 0;
|
||||
u_int size;
|
||||
@ -868,7 +868,7 @@ pipe_write(fp, uio, active_cred, flags, td)
|
||||
int orig_resid;
|
||||
struct pipe *wpipe, *rpipe;
|
||||
|
||||
rpipe = fp->un_data.pipe;
|
||||
rpipe = fp->f_data;
|
||||
wpipe = rpipe->pipe_peer;
|
||||
|
||||
PIPE_LOCK(rpipe);
|
||||
@ -1155,7 +1155,7 @@ pipe_ioctl(fp, cmd, data, active_cred, td)
|
||||
struct ucred *active_cred;
|
||||
struct thread *td;
|
||||
{
|
||||
struct pipe *mpipe = fp->un_data.pipe;
|
||||
struct pipe *mpipe = fp->f_data;
|
||||
#ifdef MAC
|
||||
int error;
|
||||
#endif
|
||||
@ -1223,7 +1223,7 @@ pipe_poll(fp, events, active_cred, td)
|
||||
struct ucred *active_cred;
|
||||
struct thread *td;
|
||||
{
|
||||
struct pipe *rpipe = fp->un_data.pipe;
|
||||
struct pipe *rpipe = fp->f_data;
|
||||
struct pipe *wpipe;
|
||||
int revents = 0;
|
||||
#ifdef MAC
|
||||
@ -1284,7 +1284,7 @@ pipe_stat(fp, ub, active_cred, td)
|
||||
struct ucred *active_cred;
|
||||
struct thread *td;
|
||||
{
|
||||
struct pipe *pipe = fp->un_data.pipe;
|
||||
struct pipe *pipe = fp->f_data;
|
||||
#ifdef MAC
|
||||
int error;
|
||||
|
||||
@ -1317,10 +1317,10 @@ pipe_close(fp, td)
|
||||
struct file *fp;
|
||||
struct thread *td;
|
||||
{
|
||||
struct pipe *cpipe = fp->un_data.pipe;
|
||||
struct pipe *cpipe = fp->f_data;
|
||||
|
||||
fp->f_ops = &badfileops;
|
||||
fp->un_data.pipe = NULL;
|
||||
fp->f_data = NULL;
|
||||
funsetown(&cpipe->pipe_sigio);
|
||||
pipeclose(cpipe);
|
||||
return (0);
|
||||
@ -1428,7 +1428,7 @@ pipe_kqfilter(struct file *fp, struct knote *kn)
|
||||
{
|
||||
struct pipe *cpipe;
|
||||
|
||||
cpipe = kn->kn_fp->un_data.pipe;
|
||||
cpipe = kn->kn_fp->f_data;
|
||||
switch (kn->kn_filter) {
|
||||
case EVFILT_READ:
|
||||
kn->kn_fop = &pipe_rfiltops;
|
||||
@ -1465,7 +1465,7 @@ filt_pipedetach(struct knote *kn)
|
||||
static int
|
||||
filt_piperead(struct knote *kn, long hint)
|
||||
{
|
||||
struct pipe *rpipe = kn->kn_fp->un_data.pipe;
|
||||
struct pipe *rpipe = kn->kn_fp->f_data;
|
||||
struct pipe *wpipe = rpipe->pipe_peer;
|
||||
|
||||
PIPE_LOCK(rpipe);
|
||||
@ -1487,7 +1487,7 @@ filt_piperead(struct knote *kn, long hint)
|
||||
static int
|
||||
filt_pipewrite(struct knote *kn, long hint)
|
||||
{
|
||||
struct pipe *rpipe = kn->kn_fp->un_data.pipe;
|
||||
struct pipe *rpipe = kn->kn_fp->f_data;
|
||||
struct pipe *wpipe = rpipe->pipe_peer;
|
||||
|
||||
PIPE_LOCK(rpipe);
|
||||
|
@ -69,7 +69,7 @@ soo_read(fp, uio, active_cred, flags, td)
|
||||
struct thread *td;
|
||||
int flags;
|
||||
{
|
||||
struct socket *so = fp->un_data.socket;
|
||||
struct socket *so = fp->f_data;
|
||||
int error;
|
||||
|
||||
mtx_lock(&Giant);
|
||||
@ -94,7 +94,7 @@ soo_write(fp, uio, active_cred, flags, td)
|
||||
struct thread *td;
|
||||
int flags;
|
||||
{
|
||||
struct socket *so = fp->un_data.socket;
|
||||
struct socket *so = fp->f_data;
|
||||
int error;
|
||||
|
||||
mtx_lock(&Giant);
|
||||
@ -119,7 +119,7 @@ soo_ioctl(fp, cmd, data, active_cred, td)
|
||||
struct ucred *active_cred;
|
||||
struct thread *td;
|
||||
{
|
||||
register struct socket *so = fp->un_data.socket;
|
||||
register struct socket *so = fp->f_data;
|
||||
|
||||
switch (cmd) {
|
||||
|
||||
@ -183,7 +183,7 @@ soo_poll(fp, events, active_cred, td)
|
||||
struct ucred *active_cred;
|
||||
struct thread *td;
|
||||
{
|
||||
struct socket *so = fp->un_data.socket;
|
||||
struct socket *so = fp->f_data;
|
||||
return so->so_proto->pr_usrreqs->pru_sopoll(so, events,
|
||||
fp->f_cred, td);
|
||||
}
|
||||
@ -195,7 +195,7 @@ soo_stat(fp, ub, active_cred, td)
|
||||
struct ucred *active_cred;
|
||||
struct thread *td;
|
||||
{
|
||||
struct socket *so = fp->un_data.socket;
|
||||
struct socket *so = fp->f_data;
|
||||
|
||||
bzero((caddr_t)ub, sizeof (*ub));
|
||||
ub->st_mode = S_IFSOCK;
|
||||
@ -229,9 +229,9 @@ soo_close(fp, td)
|
||||
int error = 0;
|
||||
struct socket *so;
|
||||
|
||||
so = fp->un_data.socket;
|
||||
so = fp->f_data;
|
||||
fp->f_ops = &badfileops;
|
||||
fp->un_data.socket = 0;
|
||||
fp->f_data = NULL;
|
||||
|
||||
if (so)
|
||||
error = soclose(so);
|
||||
|
@ -1735,7 +1735,7 @@ sopoll(struct socket *so, int events, struct ucred *active_cred,
|
||||
int
|
||||
soo_kqfilter(struct file *fp, struct knote *kn)
|
||||
{
|
||||
struct socket *so = kn->kn_fp->un_data.socket;
|
||||
struct socket *so = kn->kn_fp->f_data;
|
||||
struct sockbuf *sb;
|
||||
int s;
|
||||
|
||||
@ -1765,7 +1765,7 @@ soo_kqfilter(struct file *fp, struct knote *kn)
|
||||
static void
|
||||
filt_sordetach(struct knote *kn)
|
||||
{
|
||||
struct socket *so = kn->kn_fp->un_data.socket;
|
||||
struct socket *so = kn->kn_fp->f_data;
|
||||
int s = splnet();
|
||||
|
||||
SLIST_REMOVE(&so->so_rcv.sb_sel.si_note, kn, knote, kn_selnext);
|
||||
@ -1778,7 +1778,7 @@ filt_sordetach(struct knote *kn)
|
||||
static int
|
||||
filt_soread(struct knote *kn, long hint)
|
||||
{
|
||||
struct socket *so = kn->kn_fp->un_data.socket;
|
||||
struct socket *so = kn->kn_fp->f_data;
|
||||
|
||||
kn->kn_data = so->so_rcv.sb_cc - so->so_rcv.sb_ctl;
|
||||
if (so->so_state & SS_CANTRCVMORE) {
|
||||
@ -1796,7 +1796,7 @@ filt_soread(struct knote *kn, long hint)
|
||||
static void
|
||||
filt_sowdetach(struct knote *kn)
|
||||
{
|
||||
struct socket *so = kn->kn_fp->un_data.socket;
|
||||
struct socket *so = kn->kn_fp->f_data;
|
||||
int s = splnet();
|
||||
|
||||
SLIST_REMOVE(&so->so_snd.sb_sel.si_note, kn, knote, kn_selnext);
|
||||
@ -1809,7 +1809,7 @@ filt_sowdetach(struct knote *kn)
|
||||
static int
|
||||
filt_sowrite(struct knote *kn, long hint)
|
||||
{
|
||||
struct socket *so = kn->kn_fp->un_data.socket;
|
||||
struct socket *so = kn->kn_fp->f_data;
|
||||
|
||||
kn->kn_data = sbspace(&so->so_snd);
|
||||
if (so->so_state & SS_CANTSENDMORE) {
|
||||
@ -1831,7 +1831,7 @@ filt_sowrite(struct knote *kn, long hint)
|
||||
static int
|
||||
filt_solisten(struct knote *kn, long hint)
|
||||
{
|
||||
struct socket *so = kn->kn_fp->un_data.socket;
|
||||
struct socket *so = kn->kn_fp->f_data;
|
||||
|
||||
kn->kn_data = so->so_qlen;
|
||||
return (! TAILQ_EMPTY(&so->so_comp));
|
||||
|
@ -141,7 +141,7 @@ socket(td, uap)
|
||||
} else
|
||||
FILEDESC_UNLOCK(fdp);
|
||||
} else {
|
||||
fp->un_data.socket = so; /* already has ref count */
|
||||
fp->f_data = so; /* already has ref count */
|
||||
fp->f_flag = FREAD|FWRITE;
|
||||
fp->f_ops = &socketops;
|
||||
fp->f_type = DTYPE_SOCKET;
|
||||
@ -329,7 +329,7 @@ accept1(td, uap, compat)
|
||||
|
||||
FILE_LOCK(nfp);
|
||||
soref(so); /* file descriptor reference */
|
||||
nfp->un_data.socket = so; /* nfp has ref count from falloc */
|
||||
nfp->f_data = so; /* nfp has ref count from falloc */
|
||||
nfp->f_flag = fflag;
|
||||
nfp->f_ops = &socketops;
|
||||
nfp->f_type = DTYPE_SOCKET;
|
||||
@ -524,12 +524,12 @@ socketpair(td, uap)
|
||||
goto free2;
|
||||
fhold(fp1);
|
||||
sv[0] = fd;
|
||||
fp1->un_data.socket = so1; /* so1 already has ref count */
|
||||
fp1->f_data = so1; /* so1 already has ref count */
|
||||
error = falloc(td, &fp2, &fd);
|
||||
if (error)
|
||||
goto free3;
|
||||
fhold(fp2);
|
||||
fp2->un_data.socket = so2; /* so2 already has ref count */
|
||||
fp2->f_data = so2; /* so2 already has ref count */
|
||||
sv[1] = fd;
|
||||
error = soconnect2(so1, so2);
|
||||
if (error)
|
||||
|
@ -1305,7 +1305,7 @@ unp_gc()
|
||||
* Now check if it is possibly one of OUR sockets.
|
||||
*/
|
||||
if (fp->f_type != DTYPE_SOCKET ||
|
||||
(so = fp->un_data.socket) == 0) {
|
||||
(so = fp->f_data) == NULL) {
|
||||
FILE_UNLOCK(fp);
|
||||
continue;
|
||||
}
|
||||
@ -1413,9 +1413,9 @@ unp_gc()
|
||||
struct file *tfp = *fpp;
|
||||
FILE_LOCK(tfp);
|
||||
if (tfp->f_type == DTYPE_SOCKET &&
|
||||
tfp->un_data.socket != NULL) {
|
||||
tfp->f_data != NULL) {
|
||||
FILE_UNLOCK(tfp);
|
||||
sorflush(tfp->un_data.socket);
|
||||
sorflush(tfp->f_data);
|
||||
} else
|
||||
FILE_UNLOCK(tfp);
|
||||
}
|
||||
|
@ -780,8 +780,7 @@ __acl_get_fd(struct thread *td, struct __acl_get_fd_args *uap)
|
||||
mtx_lock(&Giant);
|
||||
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
|
||||
if (error == 0) {
|
||||
error = vacl_get_acl(td, fp->un_data.vnode,
|
||||
uap->type, uap->aclp);
|
||||
error = vacl_get_acl(td, fp->f_data, uap->type, uap->aclp);
|
||||
fdrop(fp, td);
|
||||
}
|
||||
mtx_unlock(&Giant);
|
||||
@ -802,8 +801,7 @@ __acl_set_fd(struct thread *td, struct __acl_set_fd_args *uap)
|
||||
mtx_lock(&Giant);
|
||||
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
|
||||
if (error == 0) {
|
||||
error = vacl_set_acl(td, fp->un_data.vnode,
|
||||
uap->type, uap->aclp);
|
||||
error = vacl_set_acl(td, fp->f_data, uap->type, uap->aclp);
|
||||
fdrop(fp, td);
|
||||
}
|
||||
mtx_unlock(&Giant);
|
||||
@ -868,7 +866,7 @@ __acl_delete_fd(struct thread *td, struct __acl_delete_fd_args *uap)
|
||||
mtx_lock(&Giant);
|
||||
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
|
||||
if (error == 0) {
|
||||
error = vacl_delete(td, fp->un_data.vnode, uap->type);
|
||||
error = vacl_delete(td, fp->f_data, uap->type);
|
||||
fdrop(fp, td);
|
||||
}
|
||||
mtx_unlock(&Giant);
|
||||
@ -933,8 +931,7 @@ __acl_aclcheck_fd(struct thread *td, struct __acl_aclcheck_fd_args *uap)
|
||||
mtx_lock(&Giant);
|
||||
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
|
||||
if (error == 0) {
|
||||
error = vacl_aclcheck(td, fp->un_data.vnode,
|
||||
uap->type, uap->aclp);
|
||||
error = vacl_aclcheck(td, fp->f_data, uap->type, uap->aclp);
|
||||
fdrop(fp, td);
|
||||
}
|
||||
mtx_unlock(&Giant);
|
||||
|
@ -555,7 +555,7 @@ aio_proc_rundown(struct proc *p)
|
||||
aiocbn = TAILQ_NEXT(aiocbe, plist);
|
||||
fp = aiocbe->fd_file;
|
||||
if (fp != NULL) {
|
||||
so = fp->un_data.socket;
|
||||
so = fp->f_data;
|
||||
TAILQ_REMOVE(&so->so_aiojobq, aiocbe, list);
|
||||
if (TAILQ_EMPTY(&so->so_aiojobq)) {
|
||||
so->so_snd.sb_flags &= ~SB_AIO;
|
||||
@ -1059,7 +1059,7 @@ aio_qphysio(struct proc *p, struct aiocblist *aiocbe)
|
||||
if (fp->f_type != DTYPE_VNODE)
|
||||
return (-1);
|
||||
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
|
||||
/*
|
||||
* If its not a disk, we don't want to return a positive error.
|
||||
@ -1406,7 +1406,7 @@ _aio_aqueue(struct thread *td, struct aiocb *job, struct aio_liojob *lj, int typ
|
||||
error = EBADF;
|
||||
goto aqueue_fail;
|
||||
}
|
||||
kq = kq_fp->un_data.kqueue;
|
||||
kq = kq_fp->f_data;
|
||||
kev.ident = (uintptr_t)aiocbe->uuaiocb;
|
||||
kev.filter = EVFILT_AIO;
|
||||
kev.flags = EV_ADD | EV_ENABLE | EV_FLAG1;
|
||||
@ -1441,7 +1441,7 @@ _aio_aqueue(struct thread *td, struct aiocb *job, struct aio_liojob *lj, int typ
|
||||
* socket, and set the flags so we get a call when sbnotify()
|
||||
* happens.
|
||||
*/
|
||||
so = fp->un_data.socket;
|
||||
so = fp->f_data;
|
||||
s = splnet();
|
||||
if (((opcode == LIO_READ) && (!soreadable(so))) || ((opcode ==
|
||||
LIO_WRITE) && (!sowriteable(so)))) {
|
||||
@ -1731,14 +1731,14 @@ aio_cancel(struct thread *td, struct aio_cancel_args *uap)
|
||||
return (EBADF);
|
||||
|
||||
if (fp->f_type == DTYPE_VNODE) {
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
|
||||
if (vn_isdisk(vp,&error)) {
|
||||
td->td_retval[0] = AIO_NOTCANCELED;
|
||||
return 0;
|
||||
}
|
||||
} else if (fp->f_type == DTYPE_SOCKET) {
|
||||
so = fp->un_data.socket;
|
||||
so = fp->f_data;
|
||||
|
||||
s = splnet();
|
||||
|
||||
|
@ -278,7 +278,7 @@ fstatfs(td, uap)
|
||||
|
||||
if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
|
||||
return (error);
|
||||
mp = (fp->un_data.vnode)->v_mount;
|
||||
mp = ((struct vnode *)fp->f_data)->v_mount;
|
||||
fdrop(fp, td);
|
||||
if (mp == NULL)
|
||||
return (EBADF);
|
||||
@ -399,7 +399,7 @@ fchdir(td, uap)
|
||||
|
||||
if ((error = getvnode(fdp, uap->fd, &fp)) != 0)
|
||||
return (error);
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
VREF(vp);
|
||||
fdrop(fp, td);
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
@ -492,7 +492,7 @@ chroot_refuse_vdir_fds(fdp)
|
||||
if (fp == NULL)
|
||||
continue;
|
||||
if (fp->f_type == DTYPE_VNODE) {
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
if (vp->v_type == VDIR)
|
||||
return (EPERM);
|
||||
}
|
||||
@ -724,7 +724,7 @@ kern_open(struct thread *td, char *path, enum uio_seg pathseg, int flags,
|
||||
KASSERT(!vn_canvmio(vp) || VOP_GETVOBJECT(vp, NULL) == 0,
|
||||
("open: vmio vnode has no backing object after vn_open"));
|
||||
|
||||
fp->un_data.vnode = vp;
|
||||
fp->f_data = vp;
|
||||
fp->f_flag = flags & FMASK;
|
||||
fp->f_ops = &vnops;
|
||||
fp->f_type = (vp->v_type == VFIFO ? DTYPE_FIFO : DTYPE_VNODE);
|
||||
@ -1319,7 +1319,7 @@ lseek(td, uap)
|
||||
fdrop(fp, td);
|
||||
return (ESPIPE);
|
||||
}
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
noneg = (vp->v_type != VCHR);
|
||||
offset = uap->offset;
|
||||
switch (uap->whence) {
|
||||
@ -2032,7 +2032,7 @@ fchflags(td, uap)
|
||||
|
||||
if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
|
||||
return (error);
|
||||
error = setfflags(td, fp->un_data.vnode, uap->flags);
|
||||
error = setfflags(td, fp->f_data, uap->flags);
|
||||
fdrop(fp, td);
|
||||
return (error);
|
||||
}
|
||||
@ -2157,8 +2157,8 @@ fchmod(td, uap)
|
||||
|
||||
if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
|
||||
return (error);
|
||||
vp = fp->un_data.vnode;
|
||||
error = setfmode(td, fp->un_data.vnode, uap->mode);
|
||||
vp = fp->f_data;
|
||||
error = setfmode(td, fp->f_data, uap->mode);
|
||||
fdrop(fp, td);
|
||||
return (error);
|
||||
}
|
||||
@ -2301,8 +2301,8 @@ fchown(td, uap)
|
||||
|
||||
if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
|
||||
return (error);
|
||||
vp = fp->un_data.vnode;
|
||||
error = setfown(td, fp->un_data.vnode, uap->uid, uap->gid);
|
||||
vp = fp->f_data;
|
||||
error = setfown(td, fp->f_data, uap->uid, uap->gid);
|
||||
fdrop(fp, td);
|
||||
return (error);
|
||||
}
|
||||
@ -2500,7 +2500,7 @@ kern_futimes(struct thread *td, int fd, struct timeval *tptr,
|
||||
return (error);
|
||||
if ((error = getvnode(td->td_proc->p_fd, fd, &fp)) != 0)
|
||||
return (error);
|
||||
error = setutimes(td, fp->un_data.vnode, ts, 2, tptr == NULL);
|
||||
error = setutimes(td, fp->f_data, ts, 2, tptr == NULL);
|
||||
fdrop(fp, td);
|
||||
return (error);
|
||||
}
|
||||
@ -2602,7 +2602,7 @@ ftruncate(td, uap)
|
||||
fdrop(fp, td);
|
||||
return (EINVAL);
|
||||
}
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) {
|
||||
fdrop(fp, td);
|
||||
return (error);
|
||||
@ -2713,7 +2713,7 @@ fsync(td, uap)
|
||||
|
||||
if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
|
||||
return (error);
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) {
|
||||
fdrop(fp, td);
|
||||
return (error);
|
||||
@ -3074,7 +3074,7 @@ ogetdirentries(td, uap)
|
||||
fdrop(fp, td);
|
||||
return (EBADF);
|
||||
}
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
unionread:
|
||||
if (vp->v_type != VDIR) {
|
||||
fdrop(fp, td);
|
||||
@ -3174,7 +3174,7 @@ ogetdirentries(td, uap)
|
||||
struct vnode *tvp = vp;
|
||||
vp = vp->v_mount->mnt_vnodecovered;
|
||||
VREF(vp);
|
||||
fp->un_data.vnode = vp;
|
||||
fp->f_data = vp;
|
||||
fp->f_offset = 0;
|
||||
vput(tvp);
|
||||
goto unionread;
|
||||
@ -3222,7 +3222,7 @@ getdirentries(td, uap)
|
||||
fdrop(fp, td);
|
||||
return (EBADF);
|
||||
}
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
unionread:
|
||||
if (vp->v_type != VDIR) {
|
||||
fdrop(fp, td);
|
||||
@ -3271,7 +3271,7 @@ getdirentries(td, uap)
|
||||
struct vnode *tvp = vp;
|
||||
vp = vp->v_mount->mnt_vnodecovered;
|
||||
VREF(vp);
|
||||
fp->un_data.vnode = vp;
|
||||
fp->f_data = vp;
|
||||
fp->f_offset = 0;
|
||||
vput(tvp);
|
||||
goto unionread;
|
||||
@ -3624,7 +3624,7 @@ fhopen(td, uap)
|
||||
* from under us while we block in the lock op
|
||||
*/
|
||||
fhold(fp);
|
||||
nfp->un_data.vnode = vp;
|
||||
nfp->f_data = vp;
|
||||
nfp->f_flag = fmode & FMASK;
|
||||
nfp->f_ops = &vnops;
|
||||
nfp->f_type = DTYPE_VNODE;
|
||||
@ -3945,7 +3945,7 @@ extattr_set_fd(td, uap)
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
error = extattr_set_vp(fp->un_data.vnode, uap->attrnamespace,
|
||||
error = extattr_set_vp(fp->f_data, uap->attrnamespace,
|
||||
attrname, uap->data, uap->nbytes, td);
|
||||
fdrop(fp, td);
|
||||
|
||||
@ -4109,7 +4109,7 @@ extattr_get_fd(td, uap)
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
error = extattr_get_vp(fp->un_data.vnode, uap->attrnamespace,
|
||||
error = extattr_get_vp(fp->f_data, uap->attrnamespace,
|
||||
attrname, uap->data, uap->nbytes, td);
|
||||
|
||||
fdrop(fp, td);
|
||||
@ -4241,7 +4241,7 @@ extattr_delete_fd(td, uap)
|
||||
error = getvnode(td->td_proc->p_fd, uap->fd, &fp);
|
||||
if (error)
|
||||
return (error);
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
|
||||
error = extattr_delete_vp(vp, uap->attrnamespace, attrname, td);
|
||||
fdrop(fp, td);
|
||||
|
@ -278,7 +278,7 @@ fstatfs(td, uap)
|
||||
|
||||
if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
|
||||
return (error);
|
||||
mp = (fp->un_data.vnode)->v_mount;
|
||||
mp = ((struct vnode *)fp->f_data)->v_mount;
|
||||
fdrop(fp, td);
|
||||
if (mp == NULL)
|
||||
return (EBADF);
|
||||
@ -399,7 +399,7 @@ fchdir(td, uap)
|
||||
|
||||
if ((error = getvnode(fdp, uap->fd, &fp)) != 0)
|
||||
return (error);
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
VREF(vp);
|
||||
fdrop(fp, td);
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
@ -492,7 +492,7 @@ chroot_refuse_vdir_fds(fdp)
|
||||
if (fp == NULL)
|
||||
continue;
|
||||
if (fp->f_type == DTYPE_VNODE) {
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
if (vp->v_type == VDIR)
|
||||
return (EPERM);
|
||||
}
|
||||
@ -724,7 +724,7 @@ kern_open(struct thread *td, char *path, enum uio_seg pathseg, int flags,
|
||||
KASSERT(!vn_canvmio(vp) || VOP_GETVOBJECT(vp, NULL) == 0,
|
||||
("open: vmio vnode has no backing object after vn_open"));
|
||||
|
||||
fp->un_data.vnode = vp;
|
||||
fp->f_data = vp;
|
||||
fp->f_flag = flags & FMASK;
|
||||
fp->f_ops = &vnops;
|
||||
fp->f_type = (vp->v_type == VFIFO ? DTYPE_FIFO : DTYPE_VNODE);
|
||||
@ -1319,7 +1319,7 @@ lseek(td, uap)
|
||||
fdrop(fp, td);
|
||||
return (ESPIPE);
|
||||
}
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
noneg = (vp->v_type != VCHR);
|
||||
offset = uap->offset;
|
||||
switch (uap->whence) {
|
||||
@ -2032,7 +2032,7 @@ fchflags(td, uap)
|
||||
|
||||
if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
|
||||
return (error);
|
||||
error = setfflags(td, fp->un_data.vnode, uap->flags);
|
||||
error = setfflags(td, fp->f_data, uap->flags);
|
||||
fdrop(fp, td);
|
||||
return (error);
|
||||
}
|
||||
@ -2157,8 +2157,8 @@ fchmod(td, uap)
|
||||
|
||||
if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
|
||||
return (error);
|
||||
vp = fp->un_data.vnode;
|
||||
error = setfmode(td, fp->un_data.vnode, uap->mode);
|
||||
vp = fp->f_data;
|
||||
error = setfmode(td, fp->f_data, uap->mode);
|
||||
fdrop(fp, td);
|
||||
return (error);
|
||||
}
|
||||
@ -2301,8 +2301,8 @@ fchown(td, uap)
|
||||
|
||||
if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
|
||||
return (error);
|
||||
vp = fp->un_data.vnode;
|
||||
error = setfown(td, fp->un_data.vnode, uap->uid, uap->gid);
|
||||
vp = fp->f_data;
|
||||
error = setfown(td, fp->f_data, uap->uid, uap->gid);
|
||||
fdrop(fp, td);
|
||||
return (error);
|
||||
}
|
||||
@ -2500,7 +2500,7 @@ kern_futimes(struct thread *td, int fd, struct timeval *tptr,
|
||||
return (error);
|
||||
if ((error = getvnode(td->td_proc->p_fd, fd, &fp)) != 0)
|
||||
return (error);
|
||||
error = setutimes(td, fp->un_data.vnode, ts, 2, tptr == NULL);
|
||||
error = setutimes(td, fp->f_data, ts, 2, tptr == NULL);
|
||||
fdrop(fp, td);
|
||||
return (error);
|
||||
}
|
||||
@ -2602,7 +2602,7 @@ ftruncate(td, uap)
|
||||
fdrop(fp, td);
|
||||
return (EINVAL);
|
||||
}
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) {
|
||||
fdrop(fp, td);
|
||||
return (error);
|
||||
@ -2713,7 +2713,7 @@ fsync(td, uap)
|
||||
|
||||
if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
|
||||
return (error);
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) {
|
||||
fdrop(fp, td);
|
||||
return (error);
|
||||
@ -3074,7 +3074,7 @@ ogetdirentries(td, uap)
|
||||
fdrop(fp, td);
|
||||
return (EBADF);
|
||||
}
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
unionread:
|
||||
if (vp->v_type != VDIR) {
|
||||
fdrop(fp, td);
|
||||
@ -3174,7 +3174,7 @@ ogetdirentries(td, uap)
|
||||
struct vnode *tvp = vp;
|
||||
vp = vp->v_mount->mnt_vnodecovered;
|
||||
VREF(vp);
|
||||
fp->un_data.vnode = vp;
|
||||
fp->f_data = vp;
|
||||
fp->f_offset = 0;
|
||||
vput(tvp);
|
||||
goto unionread;
|
||||
@ -3222,7 +3222,7 @@ getdirentries(td, uap)
|
||||
fdrop(fp, td);
|
||||
return (EBADF);
|
||||
}
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
unionread:
|
||||
if (vp->v_type != VDIR) {
|
||||
fdrop(fp, td);
|
||||
@ -3271,7 +3271,7 @@ getdirentries(td, uap)
|
||||
struct vnode *tvp = vp;
|
||||
vp = vp->v_mount->mnt_vnodecovered;
|
||||
VREF(vp);
|
||||
fp->un_data.vnode = vp;
|
||||
fp->f_data = vp;
|
||||
fp->f_offset = 0;
|
||||
vput(tvp);
|
||||
goto unionread;
|
||||
@ -3624,7 +3624,7 @@ fhopen(td, uap)
|
||||
* from under us while we block in the lock op
|
||||
*/
|
||||
fhold(fp);
|
||||
nfp->un_data.vnode = vp;
|
||||
nfp->f_data = vp;
|
||||
nfp->f_flag = fmode & FMASK;
|
||||
nfp->f_ops = &vnops;
|
||||
nfp->f_type = DTYPE_VNODE;
|
||||
@ -3945,7 +3945,7 @@ extattr_set_fd(td, uap)
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
error = extattr_set_vp(fp->un_data.vnode, uap->attrnamespace,
|
||||
error = extattr_set_vp(fp->f_data, uap->attrnamespace,
|
||||
attrname, uap->data, uap->nbytes, td);
|
||||
fdrop(fp, td);
|
||||
|
||||
@ -4109,7 +4109,7 @@ extattr_get_fd(td, uap)
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
error = extattr_get_vp(fp->un_data.vnode, uap->attrnamespace,
|
||||
error = extattr_get_vp(fp->f_data, uap->attrnamespace,
|
||||
attrname, uap->data, uap->nbytes, td);
|
||||
|
||||
fdrop(fp, td);
|
||||
@ -4241,7 +4241,7 @@ extattr_delete_fd(td, uap)
|
||||
error = getvnode(td->td_proc->p_fd, uap->fd, &fp);
|
||||
if (error)
|
||||
return (error);
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
|
||||
error = extattr_delete_vp(vp, uap->attrnamespace, attrname, td);
|
||||
fdrop(fp, td);
|
||||
|
@ -502,7 +502,7 @@ vn_read(fp, uio, active_cred, flags, td)
|
||||
mtx_lock(&Giant);
|
||||
KASSERT(uio->uio_td == td, ("uio_td %p is not td %p",
|
||||
uio->uio_td, td));
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
ioflag = 0;
|
||||
if (fp->f_flag & FNONBLOCK)
|
||||
ioflag |= IO_NDELAY;
|
||||
@ -550,7 +550,7 @@ vn_write(fp, uio, active_cred, flags, td)
|
||||
mtx_lock(&Giant);
|
||||
KASSERT(uio->uio_td == td, ("uio_td %p is not td %p",
|
||||
uio->uio_td, td));
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
if (vp->v_type == VREG)
|
||||
bwillwrite();
|
||||
ioflag = IO_UNIT;
|
||||
@ -598,7 +598,7 @@ vn_statfile(fp, sb, active_cred, td)
|
||||
struct ucred *active_cred;
|
||||
struct thread *td;
|
||||
{
|
||||
struct vnode *vp = fp->un_data.vnode;
|
||||
struct vnode *vp = fp->f_data;
|
||||
int error;
|
||||
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
@ -741,7 +741,7 @@ vn_ioctl(fp, com, data, active_cred, td)
|
||||
struct ucred *active_cred;
|
||||
struct thread *td;
|
||||
{
|
||||
struct vnode *vp = fp->un_data.vnode;
|
||||
struct vnode *vp = fp->f_data;
|
||||
struct vnode *vpold;
|
||||
struct vattr vattr;
|
||||
int error;
|
||||
@ -823,7 +823,7 @@ vn_poll(fp, events, active_cred, td)
|
||||
int error;
|
||||
#endif
|
||||
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
#ifdef MAC
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
error = mac_check_vnode_poll(active_cred, fp->f_cred, vp);
|
||||
@ -891,7 +891,7 @@ vn_closefile(fp, td)
|
||||
{
|
||||
|
||||
fp->f_ops = &badfileops;
|
||||
return (vn_close(fp->un_data.vnode, fp->f_flag, fp->f_cred, td));
|
||||
return (vn_close(fp->f_data, fp->f_flag, fp->f_cred, td));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1042,7 +1042,7 @@ static int
|
||||
vn_kqfilter(struct file *fp, struct knote *kn)
|
||||
{
|
||||
|
||||
return (VOP_KQFILTER(fp->un_data.vnode, kn));
|
||||
return (VOP_KQFILTER(fp->f_data, kn));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -601,7 +601,7 @@ ng_internalize(struct mbuf *control, struct thread *td)
|
||||
* shortcut straight to the node. */
|
||||
switch (fp->f_type) {
|
||||
case DTYPE_VNODE:
|
||||
vn = fp->un_data.vnode;
|
||||
vn = fp->f_data;
|
||||
if (vn && (vn->v_type == VCHR)) {
|
||||
/* for a VCHR, actually reference the FILE */
|
||||
fp->f_count++;
|
||||
|
@ -420,7 +420,7 @@ smb_dev2share(int fd, int mode, struct smb_cred *scred,
|
||||
fp = nsmb_getfp(scred->scr_td->td_proc->p_fd, fd, FREAD | FWRITE);
|
||||
if (fp == NULL)
|
||||
return EBADF;
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
if (vp == NULL) {
|
||||
fdrop(fp, curthread);
|
||||
return EBADF;
|
||||
|
@ -200,7 +200,7 @@ nfssvc_addsock(struct file *fp, struct sockaddr *mynam, struct thread *td)
|
||||
struct socket *so;
|
||||
int error, s;
|
||||
|
||||
so = fp->un_data.socket;
|
||||
so = fp->f_data;
|
||||
#if 0
|
||||
tslp = NULL;
|
||||
/*
|
||||
|
@ -134,7 +134,7 @@ cryptof_ioctl(
|
||||
struct thread *td)
|
||||
{
|
||||
struct cryptoini cria, crie;
|
||||
struct fcrypt *fcr = fp->un_data.fcrypt;
|
||||
struct fcrypt *fcr = fp->f_data;
|
||||
struct csession *cse;
|
||||
struct session_op *sop;
|
||||
struct crypt_op *cop;
|
||||
@ -608,7 +608,7 @@ cryptof_stat(
|
||||
static int
|
||||
cryptof_close(struct file *fp, struct thread *td)
|
||||
{
|
||||
struct fcrypt *fcr = fp->un_data.fcrypt;
|
||||
struct fcrypt *fcr = fp->f_data;
|
||||
struct csession *cse;
|
||||
|
||||
while ((cse = TAILQ_FIRST(&fcr->csessions))) {
|
||||
@ -616,7 +616,7 @@ cryptof_close(struct file *fp, struct thread *td)
|
||||
(void)csefree(cse);
|
||||
}
|
||||
FREE(fcr, M_XDATA);
|
||||
fp->un_data.fcrypt = NULL;
|
||||
fp->f_data = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -733,7 +733,7 @@ cryptoioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
|
||||
f->f_flag = FREAD | FWRITE;
|
||||
f->f_type = DTYPE_CRYPTO;
|
||||
f->f_ops = &cryptofops;
|
||||
f->un_data.fcrypt = fcr;
|
||||
f->f_data = fcr;
|
||||
*(u_int32_t *)data = fd;
|
||||
fdrop(f, td);
|
||||
break;
|
||||
|
@ -3211,7 +3211,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
|
||||
switch (fp->f_type) {
|
||||
case DTYPE_FIFO:
|
||||
case DTYPE_VNODE:
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
|
||||
mac_init_vnode_label(&intlabel);
|
||||
|
||||
@ -3221,7 +3221,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
|
||||
|
||||
break;
|
||||
case DTYPE_PIPE:
|
||||
pipe = fp->un_data.pipe;
|
||||
pipe = fp->f_data;
|
||||
|
||||
mac_init_pipe_label(&intlabel);
|
||||
|
||||
@ -3419,7 +3419,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
|
||||
break;
|
||||
}
|
||||
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
|
||||
if (error != 0) {
|
||||
mac_destroy_vnode_label(&intlabel);
|
||||
@ -3438,7 +3438,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
|
||||
mac_init_pipe_label(&intlabel);
|
||||
error = mac_internalize_pipe_label(&intlabel, buffer);
|
||||
if (error == 0) {
|
||||
pipe = fp->un_data.pipe;
|
||||
pipe = fp->f_data;
|
||||
PIPE_LOCK(pipe);
|
||||
error = mac_pipe_label_set(td->td_ucred, pipe,
|
||||
&intlabel);
|
||||
|
@ -3211,7 +3211,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
|
||||
switch (fp->f_type) {
|
||||
case DTYPE_FIFO:
|
||||
case DTYPE_VNODE:
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
|
||||
mac_init_vnode_label(&intlabel);
|
||||
|
||||
@ -3221,7 +3221,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
|
||||
|
||||
break;
|
||||
case DTYPE_PIPE:
|
||||
pipe = fp->un_data.pipe;
|
||||
pipe = fp->f_data;
|
||||
|
||||
mac_init_pipe_label(&intlabel);
|
||||
|
||||
@ -3419,7 +3419,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
|
||||
break;
|
||||
}
|
||||
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
|
||||
if (error != 0) {
|
||||
mac_destroy_vnode_label(&intlabel);
|
||||
@ -3438,7 +3438,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
|
||||
mac_init_pipe_label(&intlabel);
|
||||
error = mac_internalize_pipe_label(&intlabel, buffer);
|
||||
if (error == 0) {
|
||||
pipe = fp->un_data.pipe;
|
||||
pipe = fp->f_data;
|
||||
PIPE_LOCK(pipe);
|
||||
error = mac_pipe_label_set(td->td_ucred, pipe,
|
||||
&intlabel);
|
||||
|
@ -3211,7 +3211,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
|
||||
switch (fp->f_type) {
|
||||
case DTYPE_FIFO:
|
||||
case DTYPE_VNODE:
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
|
||||
mac_init_vnode_label(&intlabel);
|
||||
|
||||
@ -3221,7 +3221,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
|
||||
|
||||
break;
|
||||
case DTYPE_PIPE:
|
||||
pipe = fp->un_data.pipe;
|
||||
pipe = fp->f_data;
|
||||
|
||||
mac_init_pipe_label(&intlabel);
|
||||
|
||||
@ -3419,7 +3419,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
|
||||
break;
|
||||
}
|
||||
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
|
||||
if (error != 0) {
|
||||
mac_destroy_vnode_label(&intlabel);
|
||||
@ -3438,7 +3438,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
|
||||
mac_init_pipe_label(&intlabel);
|
||||
error = mac_internalize_pipe_label(&intlabel, buffer);
|
||||
if (error == 0) {
|
||||
pipe = fp->un_data.pipe;
|
||||
pipe = fp->f_data;
|
||||
PIPE_LOCK(pipe);
|
||||
error = mac_pipe_label_set(td->td_ucred, pipe,
|
||||
&intlabel);
|
||||
|
@ -3211,7 +3211,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
|
||||
switch (fp->f_type) {
|
||||
case DTYPE_FIFO:
|
||||
case DTYPE_VNODE:
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
|
||||
mac_init_vnode_label(&intlabel);
|
||||
|
||||
@ -3221,7 +3221,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
|
||||
|
||||
break;
|
||||
case DTYPE_PIPE:
|
||||
pipe = fp->un_data.pipe;
|
||||
pipe = fp->f_data;
|
||||
|
||||
mac_init_pipe_label(&intlabel);
|
||||
|
||||
@ -3419,7 +3419,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
|
||||
break;
|
||||
}
|
||||
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
|
||||
if (error != 0) {
|
||||
mac_destroy_vnode_label(&intlabel);
|
||||
@ -3438,7 +3438,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
|
||||
mac_init_pipe_label(&intlabel);
|
||||
error = mac_internalize_pipe_label(&intlabel, buffer);
|
||||
if (error == 0) {
|
||||
pipe = fp->un_data.pipe;
|
||||
pipe = fp->f_data;
|
||||
PIPE_LOCK(pipe);
|
||||
error = mac_pipe_label_set(td->td_ucred, pipe,
|
||||
&intlabel);
|
||||
|
@ -3211,7 +3211,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
|
||||
switch (fp->f_type) {
|
||||
case DTYPE_FIFO:
|
||||
case DTYPE_VNODE:
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
|
||||
mac_init_vnode_label(&intlabel);
|
||||
|
||||
@ -3221,7 +3221,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
|
||||
|
||||
break;
|
||||
case DTYPE_PIPE:
|
||||
pipe = fp->un_data.pipe;
|
||||
pipe = fp->f_data;
|
||||
|
||||
mac_init_pipe_label(&intlabel);
|
||||
|
||||
@ -3419,7 +3419,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
|
||||
break;
|
||||
}
|
||||
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
|
||||
if (error != 0) {
|
||||
mac_destroy_vnode_label(&intlabel);
|
||||
@ -3438,7 +3438,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
|
||||
mac_init_pipe_label(&intlabel);
|
||||
error = mac_internalize_pipe_label(&intlabel, buffer);
|
||||
if (error == 0) {
|
||||
pipe = fp->un_data.pipe;
|
||||
pipe = fp->f_data;
|
||||
PIPE_LOCK(pipe);
|
||||
error = mac_pipe_label_set(td->td_ucred, pipe,
|
||||
&intlabel);
|
||||
|
@ -3211,7 +3211,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
|
||||
switch (fp->f_type) {
|
||||
case DTYPE_FIFO:
|
||||
case DTYPE_VNODE:
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
|
||||
mac_init_vnode_label(&intlabel);
|
||||
|
||||
@ -3221,7 +3221,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
|
||||
|
||||
break;
|
||||
case DTYPE_PIPE:
|
||||
pipe = fp->un_data.pipe;
|
||||
pipe = fp->f_data;
|
||||
|
||||
mac_init_pipe_label(&intlabel);
|
||||
|
||||
@ -3419,7 +3419,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
|
||||
break;
|
||||
}
|
||||
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
|
||||
if (error != 0) {
|
||||
mac_destroy_vnode_label(&intlabel);
|
||||
@ -3438,7 +3438,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
|
||||
mac_init_pipe_label(&intlabel);
|
||||
error = mac_internalize_pipe_label(&intlabel, buffer);
|
||||
if (error == 0) {
|
||||
pipe = fp->un_data.pipe;
|
||||
pipe = fp->f_data;
|
||||
PIPE_LOCK(pipe);
|
||||
error = mac_pipe_label_set(td->td_ucred, pipe,
|
||||
&intlabel);
|
||||
|
@ -3211,7 +3211,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
|
||||
switch (fp->f_type) {
|
||||
case DTYPE_FIFO:
|
||||
case DTYPE_VNODE:
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
|
||||
mac_init_vnode_label(&intlabel);
|
||||
|
||||
@ -3221,7 +3221,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
|
||||
|
||||
break;
|
||||
case DTYPE_PIPE:
|
||||
pipe = fp->un_data.pipe;
|
||||
pipe = fp->f_data;
|
||||
|
||||
mac_init_pipe_label(&intlabel);
|
||||
|
||||
@ -3419,7 +3419,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
|
||||
break;
|
||||
}
|
||||
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
|
||||
if (error != 0) {
|
||||
mac_destroy_vnode_label(&intlabel);
|
||||
@ -3438,7 +3438,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
|
||||
mac_init_pipe_label(&intlabel);
|
||||
error = mac_internalize_pipe_label(&intlabel, buffer);
|
||||
if (error == 0) {
|
||||
pipe = fp->un_data.pipe;
|
||||
pipe = fp->f_data;
|
||||
PIPE_LOCK(pipe);
|
||||
error = mac_pipe_label_set(td->td_ucred, pipe,
|
||||
&intlabel);
|
||||
|
@ -3211,7 +3211,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
|
||||
switch (fp->f_type) {
|
||||
case DTYPE_FIFO:
|
||||
case DTYPE_VNODE:
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
|
||||
mac_init_vnode_label(&intlabel);
|
||||
|
||||
@ -3221,7 +3221,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
|
||||
|
||||
break;
|
||||
case DTYPE_PIPE:
|
||||
pipe = fp->un_data.pipe;
|
||||
pipe = fp->f_data;
|
||||
|
||||
mac_init_pipe_label(&intlabel);
|
||||
|
||||
@ -3419,7 +3419,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
|
||||
break;
|
||||
}
|
||||
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
|
||||
if (error != 0) {
|
||||
mac_destroy_vnode_label(&intlabel);
|
||||
@ -3438,7 +3438,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
|
||||
mac_init_pipe_label(&intlabel);
|
||||
error = mac_internalize_pipe_label(&intlabel, buffer);
|
||||
if (error == 0) {
|
||||
pipe = fp->un_data.pipe;
|
||||
pipe = fp->f_data;
|
||||
PIPE_LOCK(pipe);
|
||||
error = mac_pipe_label_set(td->td_ucred, pipe,
|
||||
&intlabel);
|
||||
|
@ -52,10 +52,6 @@ struct uio;
|
||||
struct knote;
|
||||
struct vnode;
|
||||
struct socket;
|
||||
struct kqueue;
|
||||
struct pipe;
|
||||
struct fcrypt;
|
||||
struct vm_object;
|
||||
|
||||
|
||||
#endif /* _KERNEL */
|
||||
@ -122,15 +118,7 @@ struct file {
|
||||
* offset of next expected read or write
|
||||
*/
|
||||
off_t f_offset;
|
||||
union { /* file descriptor specific data */
|
||||
void *generic;
|
||||
struct vnode *vnode;
|
||||
struct socket *socket;
|
||||
struct kqueue *kqueue;
|
||||
struct pipe *pipe;
|
||||
struct fcrypt *fcrypt;
|
||||
struct vm_object *object;
|
||||
} un_data;
|
||||
void *f_data; /* file descriptor specific data */
|
||||
u_int f_flag; /* see fcntl.h */
|
||||
struct mtx *f_mtxp; /* mutex to protect data */
|
||||
};
|
||||
@ -150,15 +138,7 @@ struct xfile {
|
||||
int xf_count; /* reference count */
|
||||
int xf_msgcount; /* references from message queue */
|
||||
off_t xf_offset; /* file offset */
|
||||
union {
|
||||
void *generic;
|
||||
struct vnode *vnode;
|
||||
struct socket *socket;
|
||||
struct kqueue *kqueue;
|
||||
struct pipe *pipe;
|
||||
struct fcrypt *fcrypt;
|
||||
struct vm_object *object;
|
||||
} xun_data;
|
||||
void *xf_data; /* file descriptor specific data */
|
||||
u_int xf_flag; /* flags (see fcntl.h) */
|
||||
};
|
||||
|
||||
|
@ -2184,7 +2184,7 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS)
|
||||
return (ERPCMISMATCH);
|
||||
if ((error = getvnode(curproc->p_fd, cmd.handle, &fp)) != 0)
|
||||
return (error);
|
||||
vn_start_write(fp->un_data.vnode, &mp, V_WAIT);
|
||||
vn_start_write(fp->f_data, &mp, V_WAIT);
|
||||
if (mp == 0 || strncmp(mp->mnt_stat.f_fstypename, "ufs", MFSNAMELEN)) {
|
||||
vn_finished_write(mp);
|
||||
fdrop(fp, curthread);
|
||||
|
@ -309,7 +309,7 @@ mmap(td, uap)
|
||||
*/
|
||||
if (fp->f_flag & FPOSIXSHM)
|
||||
flags |= MAP_NOSYNC;
|
||||
vp = fp->un_data.vnode;
|
||||
vp = fp->f_data;
|
||||
error = vget(vp, LK_EXCLUSIVE, td);
|
||||
if (error)
|
||||
goto done;
|
||||
|
@ -381,21 +381,21 @@ dofiles(kp)
|
||||
continue;
|
||||
}
|
||||
if (file.f_type == DTYPE_VNODE)
|
||||
vtrans(file.un_data.vnode, i, file.f_flag);
|
||||
vtrans(file.f_data, i, file.f_flag);
|
||||
else if (file.f_type == DTYPE_SOCKET) {
|
||||
if (checkfile == 0)
|
||||
socktrans(file.un_data.socket, i);
|
||||
socktrans(file.f_data, i);
|
||||
}
|
||||
#ifdef DTYPE_PIPE
|
||||
else if (file.f_type == DTYPE_PIPE) {
|
||||
if (checkfile == 0)
|
||||
pipetrans(file.un_data.pipe, i, file.f_flag);
|
||||
pipetrans(file.f_data, i, file.f_flag);
|
||||
}
|
||||
#endif
|
||||
#ifdef DTYPE_FIFO
|
||||
else if (file.f_type == DTYPE_FIFO) {
|
||||
if (checkfile == 0)
|
||||
vtrans(file.un_data.vnode, i, file.f_flag);
|
||||
vtrans(file.f_data, i, file.f_flag);
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
|
@ -470,9 +470,9 @@ display(void)
|
||||
"LOCAL ADDRESS", "FOREIGN ADDRESS");
|
||||
setpassent(1);
|
||||
for (xf = xfiles, n = 0; n < nxfiles; ++n, ++xf) {
|
||||
hash = (int)((uintptr_t)xf->xun_data.generic % HASHSIZE);
|
||||
hash = (int)((uintptr_t)xf->xf_data % HASHSIZE);
|
||||
for (s = sockhash[hash]; s != NULL; s = s->next)
|
||||
if (s->socket == xf->xun_data.socket)
|
||||
if ((void *)s->socket == xf->xf_data)
|
||||
break;
|
||||
if (s == NULL)
|
||||
continue;
|
||||
|
@ -418,7 +418,7 @@ filemode(void)
|
||||
*fbp = '\0';
|
||||
(void)printf("%6s %3d", flagbuf, fp->xf_count);
|
||||
(void)printf(" %3d", fp->xf_msgcount);
|
||||
(void)printf(" %8lx", (u_long)fp->xun_data.generic);
|
||||
(void)printf(" %p", fp->xf_data);
|
||||
(void)printf(" %jx\n", (uintmax_t)fp->xf_offset);
|
||||
}
|
||||
free(buf);
|
||||
|
Loading…
Reference in New Issue
Block a user