/* $FreeBSD: src/sys/dev/ccd/ccd.c,v 1.73.2.1 2001/09/11 09:49:52 kris Exp $ */
-/* $DragonFly: src/sys/dev/disk/ccd/ccd.c,v 1.31 2006/05/05 21:15:06 dillon Exp $ */
+/* $DragonFly: src/sys/dev/disk/ccd/ccd.c,v 1.32 2006/05/06 02:43:02 dillon Exp $ */
/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */
* Get partition information for the component.
*/
if ((error = VOP_IOCTL(vp, DIOCGPART, (caddr_t)&dpart,
- FREAD, cred, td)) != 0) {
+ FREAD, cred)) != 0) {
#ifdef DEBUG
if (ccddebug & (CCDB_FOLLOW|CCDB_INIT))
printf("ccd%d: %s: ioctl failed, error = %d\n",
#endif
if ((error = ccdlookup(cpp[i], td, &vpp[i])) != 0) {
for (j = 0; j < lookedup; ++j)
- (void)vn_close(vpp[j], FREAD|FWRITE, td);
+ (void)vn_close(vpp[j], FREAD|FWRITE);
free(vpp, M_DEVBUF);
free(cpp, M_DEVBUF);
ccdunlock(cs);
*/
if ((error = ccdinit(&ccd, cpp, td)) != 0) {
for (j = 0; j < lookedup; ++j)
- (void)vn_close(vpp[j], FREAD|FWRITE, td);
+ (void)vn_close(vpp[j], FREAD|FWRITE);
bzero(&ccd_softc[unit], sizeof(struct ccd_softc));
free(vpp, M_DEVBUF);
free(cpp, M_DEVBUF);
vprint("CCDIOCCLR: vnode info",
cs->sc_cinfo[i].ci_vp);
#endif
- (void)vn_close(cs->sc_cinfo[i].ci_vp, FREAD|FWRITE, td);
+ (void)vn_close(cs->sc_cinfo[i].ci_vp, FREAD|FWRITE);
free(cs->sc_cinfo[i].ci_path, M_DEVBUF);
}
*
* from: @(#)vn.c 8.6 (Berkeley) 4/1/94
* $FreeBSD: src/sys/dev/vn/vn.c,v 1.105.2.4 2001/11/18 07:11:00 dillon Exp $
- * $DragonFly: src/sys/dev/disk/vn/vn.c,v 1.23 2006/05/05 21:15:08 dillon Exp $
+ * $DragonFly: src/sys/dev/disk/vn/vn.c,v 1.24 2006/05/06 02:43:03 dillon Exp $
*/
/*
}
vp = nd.nl_open_vp;
if (vp->v_type != VREG ||
- (error = VOP_GETATTR(vp, &vattr, td))) {
+ (error = VOP_GETATTR(vp, &vattr))) {
if (error == 0)
error = EINVAL;
goto done;
error = vnsetcred(vn, p->p_ucred);
if (error) {
vn->sc_vp = NULL;
- vn_close(vp, flags, td);
+ vn_close(vp, flags);
goto done;
}
vn->sc_flags |= VNF_INITED;
void
vnclear(struct vn_softc *vn)
{
- struct thread *td = curthread; /* XXX */
-
IFOPT(vn, VN_FOLLOW)
printf("vnclear(%p): vp=%p\n", vn, vn->sc_vp);
if (vn->sc_slices != NULL)
dsgone(&vn->sc_slices);
vn->sc_flags &= ~VNF_INITED;
if (vn->sc_vp != NULL) {
- vn_close(vn->sc_vp, vn->sc_flags & VNF_READONLY ?
- FREAD : (FREAD|FWRITE), td);
+ vn_close(vn->sc_vp,
+ (vn->sc_flags & VNF_READONLY) ? FREAD : (FREAD|FWRITE));
vn->sc_vp = NULL;
}
vn->sc_flags &= ~VNF_READONLY;
* in 3.0-980524-SNAP then hacked a bit (but probably not enough :-).
*
* $FreeBSD: src/sys/dev/streams/streams.c,v 1.16.2.1 2001/02/26 04:23:07 jlemon Exp $
- * $DragonFly: src/sys/dev/misc/streams/Attic/streams.c,v 1.22 2005/12/11 01:54:08 swildner Exp $
+ * $DragonFly: src/sys/dev/misc/streams/Attic/streams.c,v 1.23 2006/05/06 02:43:08 dillon Exp $
*/
#include <sys/param.h>
#include <emulation/svr4/svr4_stropts.h>
#include <emulation/svr4/svr4_socket.h>
-static int svr4_soo_close (struct file *, struct thread *);
+static int svr4_soo_close (struct file *);
static int svr4_ptm_alloc (struct thread *);
static d_open_t streamsopen;
}
static int
-svr4_soo_close(struct file *fp, struct thread *td)
+svr4_soo_close(struct file *fp)
{
struct socket *so = (struct socket *)fp->f_data;
/* CHECKUNIT_DIAG(ENXIO);*/
- svr4_delete_socket(td, fp);
+ svr4_delete_socket(curthread, fp); /* XXX curthread */
free(so->so_emuldata, M_TEMP);
- return soo_close(fp, td);
- return (0);
+ return (soo_close(fp));
}
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $DragonFly: src/sys/emulation/dragonfly12/dfbsd12_stat.c,v 1.1 2005/08/02 13:03:54 joerg Exp $
+ * $DragonFly: src/sys/emulation/dragonfly12/dfbsd12_stat.c,v 1.2 2006/05/06 02:43:09 dillon Exp $
*/
#include "opt_compatdf12.h"
return (ESTALE);
if ((error = VFS_FHTOVP(mp, &fh.fh_fid, &vp)))
return (error);
- error = vn_stat(vp, &sb, td);
+ error = vn_stat(vp, &sb, td->td_proc->p_ucred);
vput(vp);
if (error)
return (error);
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sys/i386/ibcs2/imgact_coff.c,v 1.40 1999/12/15 23:01:47 eivind Exp $
- * $DragonFly: src/sys/emulation/ibcs2/coff/Attic/imgact_coff.c,v 1.15 2006/05/05 21:15:08 dillon Exp $
+ * $DragonFly: src/sys/emulation/ibcs2/coff/Attic/imgact_coff.c,v 1.16 2006/05/06 02:43:10 dillon Exp $
*/
#include <sys/param.h>
goto fail;
}
- if ((error = VOP_GETATTR(vp, &attr, td)) != 0)
+ if ((error = VOP_GETATTR(vp, &attr)) != 0)
goto fail;
if ((vp->v_mount->mnt_flag & MNT_NOEXEC)
goto fail;
}
- if ((error = VOP_ACCESS(vp, VEXEC, cred, td)) != 0)
+ if ((error = VOP_ACCESS(vp, VEXEC, cred)) != 0)
goto fail;
- if ((error = VOP_OPEN(vp, FREAD, cred, NULL, td)) != 0)
+ if ((error = VOP_OPEN(vp, FREAD, cred, NULL)) != 0)
goto fail;
/*
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sys/i386/ibcs2/ibcs2_fcntl.c,v 1.14 1999/09/19 17:00:14 green Exp $
- * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_fcntl.c,v 1.11 2005/12/10 16:06:20 swildner Exp $
+ * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_fcntl.c,v 1.12 2006/05/06 02:43:11 dillon Exp $
*/
#include "opt_spx_hack.h"
/* ignore any error, just give it a try */
if (fp->f_type == DTYPE_VNODE)
- fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0, td);
+ fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0, p->p_ucred);
}
return ret;
}
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sys/i386/ibcs2/ibcs2_ioctl.c,v 1.13.2.1 2001/07/31 20:14:21 jon Exp $
- * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_ioctl.c,v 1.10 2005/12/10 16:06:20 swildner Exp $
+ * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_ioctl.c,v 1.11 2006/05/06 02:43:11 dillon Exp $
*/
#include <sys/param.h>
struct ibcs2_termios sts;
struct ibcs2_termio st;
- if ((error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bts, td)) != 0)
+ if ((error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bts, p->p_ucred)) != 0)
return error;
btios2stios (&bts, &sts);
}
/* get full BSD termios so we don't lose information */
- if ((error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bts, td)) != 0) {
+ if ((error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bts, p->p_ucred)) != 0) {
DPRINTF(("ibcs2_ioctl(%d): TCSET ctl failed fd %d ",
p->p_pid, SCARG(uap, fd)));
return error;
stios2btios(&sts, &bts);
return fo_ioctl(fp, SCARG(uap, cmd) - IBCS2_TCSETA + TIOCSETA,
- (caddr_t)&bts, td);
+ (caddr_t)&bts, p->p_ucred);
}
case IBCS2_XCSETA:
}
stios2btios (&sts, &bts);
return fo_ioctl(fp, SCARG(uap, cmd) - IBCS2_XCSETA + TIOCSETA,
- (caddr_t)&bts, td);
+ (caddr_t)&bts, p->p_ucred);
}
case IBCS2_OXCSETA:
}
stios2btios (&sts, &bts);
return fo_ioctl(fp, SCARG(uap, cmd) - IBCS2_OXCSETA + TIOCSETA,
- (caddr_t)&bts, td);
+ (caddr_t)&bts, p->p_ucred);
}
case IBCS2_TCSBRK:
DPRINTF(("ibcs2_ioctl(td=%p): TCXONC ", td));
return ENOSYS;
case 2:
- return fo_ioctl(fp, TIOCSTOP, (caddr_t)0, td);
+ return fo_ioctl(fp, TIOCSTOP, (caddr_t)0, p->p_ucred);
case 3:
- return fo_ioctl(fp, TIOCSTART, (caddr_t)1, td);
+ return fo_ioctl(fp, TIOCSTART, (caddr_t)1, p->p_ucred);
default:
return EINVAL;
}
default:
return EINVAL;
}
- return fo_ioctl(fp, TIOCFLUSH, (caddr_t)&arg, td);
+ return fo_ioctl(fp, TIOCFLUSH, (caddr_t)&arg, p->p_ucred);
}
case IBCS2_TIOCGWINSZ:
*
* from: svr4_util.c,v 1.5 1995/01/22 23:44:50 christos Exp
* $FreeBSD: src/sys/i386/ibcs2/ibcs2_util.c,v 1.7 1999/12/15 23:01:45 eivind Exp $
- * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_util.c,v 1.10 2005/12/10 16:06:20 swildner Exp $
+ * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_util.c,v 1.11 2006/05/06 02:43:11 dillon Exp $
*/
#include <sys/param.h>
error = cache_vref(nd.nl_ncp, nd.nl_cred, &vp);
if (error)
goto done;
- error = VOP_GETATTR(vp, &vat, nd.nl_td);
+ error = VOP_GETATTR(vp, &vat);
vrele(vp);
if (error == 0)
error = cache_vref(ndroot.nl_ncp, nd.nl_cred, &vp);
if (error)
goto done;
- error = VOP_GETATTR(vp, &vatroot, nd.nl_td);
+ error = VOP_GETATTR(vp, &vatroot);
vrele(vp);
if (error)
goto done;
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sys/i386/ibcs2/ibcs2_xenix.c,v 1.20 1999/12/15 23:01:46 eivind Exp $
- * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_xenix.c,v 1.10 2004/11/12 00:09:16 dillon Exp $
+ * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_xenix.c,v 1.11 2006/05/06 02:43:11 dillon Exp $
*/
#include <sys/param.h>
int
xenix_eaccess(struct xenix_eaccess_args *uap)
{
- struct thread *td = curthread; /* XXX */
struct proc *p = curproc;
struct ucred *cred = p->p_ucred;
struct vnode *vp;
if (SCARG(uap, flags) & IBCS2_X_OK)
flags |= VEXEC;
if ((flags & VWRITE) == 0 || (error = vn_writechk(vp)) == 0)
- error = VOP_ACCESS(vp, flags, cred, td);
+ error = VOP_ACCESS(vp, flags, cred);
}
vput(vp);
done:
* @(#)procfs_subr.c 8.6 (Berkeley) 5/14/95
*
* $FreeBSD: src/sys/i386/linux/linprocfs/linprocfs_subr.c,v 1.3.2.4 2001/06/25 19:46:47 pirzyk Exp $
- * $DragonFly: src/sys/emulation/linux/i386/linprocfs/linprocfs_subr.c,v 1.16 2005/12/10 16:06:20 swildner Exp $
+ * $DragonFly: src/sys/emulation/linux/i386/linprocfs/linprocfs_subr.c,v 1.17 2006/05/06 02:43:11 dillon Exp $
*/
#include <sys/param.h>
linprocfs_allocvp(struct mount *mp, struct vnode **vpp, long pid,
pfstype pfs_type)
{
- struct thread *td = curthread; /* XXX */
struct pfsnode *pfs;
struct vnode *vp;
struct pfsnode **pp;
if (pfs->pfs_pid == pid &&
pfs->pfs_type == pfs_type &&
vp->v_mount == mp) {
- if (vget(vp, LK_EXCLUSIVE|LK_SLEEPFAIL, td))
+ if (vget(vp, LK_EXCLUSIVE|LK_SLEEPFAIL))
goto loop;
*vpp = vp;
return (0);
* @(#)procfs_vnops.c 8.18 (Berkeley) 5/21/95
*
* $FreeBSD: src/sys/i386/linux/linprocfs/linprocfs_vnops.c,v 1.3.2.5 2001/08/12 14:29:19 rwatson Exp $
- * $DragonFly: src/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c,v 1.29 2006/05/05 21:15:08 dillon Exp $
+ * $DragonFly: src/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c,v 1.30 2006/05/06 02:43:11 dillon Exp $
*/
/*
{
struct pfsnode *pfs = VTOPFS(ap->a_vp);
struct proc *procp;
- struct thread *td;
int error;
int signo;
struct procfs_status *psp;
unsigned char flags;
- td = ap->a_td;
procp = pfind(pfs->pfs_pid);
if (procp == NULL) {
return ENOTTY;
return (0);
vap = &vattr;
- error = VOP_GETATTR(ap->a_vp, vap, ap->a_td);
+ error = VOP_GETATTR(ap->a_vp, vap);
if (error)
return (error);
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sys/compat/linux/linux_file.c,v 1.41.2.6 2003/01/06 09:19:43 fjoe Exp $
- * $DragonFly: src/sys/emulation/linux/linux_file.c,v 1.27 2006/05/05 21:15:08 dillon Exp $
+ * $DragonFly: src/sys/emulation/linux/linux_file.c,v 1.28 2006/05/06 02:43:11 dillon Exp $
*/
#include "opt_compat.h"
struct file *fp = fdp->fd_files[args->sysmsg_result].fp;
if (fp->f_type == DTYPE_VNODE)
- fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0, td);
+ fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0, p->p_ucred);
}
#ifdef DEBUG
if (ldebug(open))
if (vp->v_type != VDIR)
return (EINVAL);
- if ((error = VOP_GETATTR(vp, &va, td)))
+ if ((error = VOP_GETATTR(vp, &va)))
return (error);
nbytes = args->count;
return (EINVAL);
}
- error = kern_fcntl(args->fd, cmd, &dat);
+ error = kern_fcntl(args->fd, cmd, &dat, p->p_ucred);
if (error == 0) {
switch (args->cmd) {
return (error);
linux_to_bsd_flock64(&linux_flock, &dat.fc_flock);
- error = kern_fcntl(args->fd, cmd, &dat);
+ error = kern_fcntl(args->fd, cmd, &dat, curproc->p_ucred);
if (error == 0 && args->cmd == LINUX_F_GETLK64) {
bsd_to_linux_flock64(&dat.fc_flock, &linux_flock);
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sys/compat/linux/linux_ioctl.c,v 1.55.2.11 2003/05/01 20:16:09 anholt Exp $
- * $DragonFly: src/sys/emulation/linux/linux_ioctl.c,v 1.18 2005/04/22 02:09:15 swildner Exp $
+ * $DragonFly: src/sys/emulation/linux/linux_ioctl.c,v 1.19 2006/05/06 02:43:11 dillon Exp $
*/
#include <sys/param.h>
static int
-linux_ioctl_BLKGETSIZE(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_BLKGETSIZE(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
int error;
struct disklabel dl;
- error = fo_ioctl(fp, DIOCGDINFO, (caddr_t)&dl, td);
+ error = fo_ioctl(fp, DIOCGDINFO, (caddr_t)&dl, cred);
if (error)
return (error);
bcopy(&(dl.d_secperunit), data, sizeof(dl.d_secperunit));
}
static int
-linux_ioctl_TCGETS(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_TCGETS(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
struct termios bios;
struct linux_termios lios;
int error;
- error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bios, td);
+ error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bios, cred);
if (error)
return (error);
bsd_to_linux_termios(&bios, &lios);
}
static int
-linux_ioctl_TCSETS(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_TCSETS(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
struct termios bios;
struct linux_termios lios;
bcopy(data, &lios, sizeof(lios));
linux_to_bsd_termios(&lios, &bios);
- return (fo_ioctl(fp, TIOCSETA, (caddr_t)&bios, td));
+ return (fo_ioctl(fp, TIOCSETA, (caddr_t)&bios, cred));
}
static int
-linux_ioctl_TCSETSW(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_TCSETSW(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
struct termios bios;
struct linux_termios lios;
bcopy(data, &lios, sizeof(lios));
linux_to_bsd_termios(&lios, &bios);
- return (fo_ioctl(fp, TIOCSETAW, (caddr_t)&bios, td));
+ return (fo_ioctl(fp, TIOCSETAW, (caddr_t)&bios, cred));
}
static int
-linux_ioctl_TCSETSF(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_TCSETSF(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
struct termios bios;
struct linux_termios lios;
bcopy(data, &lios, sizeof(lios));
linux_to_bsd_termios(&lios, &bios);
- return (fo_ioctl(fp, TIOCSETAF, (caddr_t)&bios, td));
+ return (fo_ioctl(fp, TIOCSETAF, (caddr_t)&bios, cred));
}
static int
-linux_ioctl_TCGETA(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_TCGETA(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
struct termios bios;
struct linux_termio lio;
int error;
- error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bios, td);
+ error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bios, cred);
if (error)
return (error);
bsd_to_linux_termio(&bios, &lio);
}
static int
-linux_ioctl_TCSETA(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_TCSETA(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
struct termios bios;
struct linux_termio lio;
bcopy(data, &lio, sizeof(lio));
linux_to_bsd_termio(&lio, &bios);
- return (fo_ioctl(fp, TIOCSETA, (caddr_t)&bios, td));
+ return (fo_ioctl(fp, TIOCSETA, (caddr_t)&bios, cred));
}
static int
-linux_ioctl_TCSETAW(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_TCSETAW(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
struct termios bios;
struct linux_termio lio;
bcopy(data, &lio, sizeof(lio));
linux_to_bsd_termio(&lio, &bios);
- return (fo_ioctl(fp, TIOCSETAW, (caddr_t)&bios, td));
+ return (fo_ioctl(fp, TIOCSETAW, (caddr_t)&bios, cred));
}
static int
-linux_ioctl_TCSETAF(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_TCSETAF(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
struct termios bios;
struct linux_termio lio;
bcopy(data, &lio, sizeof(lio));
linux_to_bsd_termio(&lio, &bios);
- return (fo_ioctl(fp, TIOCSETAF, (caddr_t)&bios, td));
+ return (fo_ioctl(fp, TIOCSETAF, (caddr_t)&bios, cred));
}
static int
-linux_ioctl_TCXONC(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_TCXONC(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
switch ((u_long)data) {
case LINUX_TCOOFF:
struct termios bios;
int error, c;
- error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bios, td);
+ error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bios, cred);
if (error)
return (error);
c = ((u_long)data == LINUX_TCIOFF) ? VSTOP : VSTART;
auio.uio_resid = sizeof(*bios.c_cc);
auio.uio_rw = UIO_WRITE;
auio.uio_segflg = UIO_SYSSPACE;
- auio.uio_td = td;
+ auio.uio_td = curthread;
- return (fo_write(fp, &auio, fp->f_cred, 0, td));
+ return (fo_write(fp, &auio, fp->f_cred, 0));
}
return (0);
default:
return (EINVAL);
}
- return (fo_ioctl(fp, cmd, 0, td));
+ return (fo_ioctl(fp, cmd, 0, cred));
}
static int
-linux_ioctl_TCFLSH(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_TCFLSH(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
switch ((u_long)data) {
case LINUX_TCIFLUSH:
default:
return (EINVAL);
}
- return (fo_ioctl(fp, TIOCFLUSH, data, td));
+ return (fo_ioctl(fp, TIOCFLUSH, data, cred));
}
static int
-linux_ioctl_TIOCGSERIAL(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_TIOCGSERIAL(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
struct linux_serial_struct lss;
}
static int
-linux_ioctl_TIOCSSERIAL(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_TIOCSSERIAL(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
#if 0
struct linux_serial_struct lss;
}
static int
-linux_ioctl_TIOCSETD(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_TIOCSETD(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
int line;
default:
return (EINVAL);
}
- return (fo_ioctl(fp, TIOCSETD, (caddr_t)&line, td));
+ return (fo_ioctl(fp, TIOCSETD, (caddr_t)&line, cred));
}
static int
-linux_ioctl_TIOCGETD(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_TIOCGETD(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
int linux_line, error;
int bsd_line = TTYDISC;
- error = fo_ioctl(fp, TIOCGETD, (caddr_t)&bsd_line, td);
+ error = fo_ioctl(fp, TIOCGETD, (caddr_t)&bsd_line, cred);
if (error)
return (error);
switch (bsd_line) {
}
static int
-linux_ioctl_CDROMREADTOCHDR(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_CDROMREADTOCHDR(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
struct ioc_toc_header th;
struct linux_cdrom_tochdr lth;
int error;
- error = fo_ioctl(fp, CDIOREADTOCHEADER, (caddr_t)&th, td);
+ error = fo_ioctl(fp, CDIOREADTOCHEADER, (caddr_t)&th, cred);
if (error)
return (error);
lth.cdth_trk0 = th.starting_track;
}
static int
-linux_ioctl_CDROMREADTOCENTRY(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_CDROMREADTOCENTRY(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
struct linux_cdrom_tocentry *ltep = (struct linux_cdrom_tocentry *)data;
struct ioc_read_toc_single_entry irtse;
irtse.address_format = ltep->cdte_format;
irtse.track = ltep->cdte_track;
- error = fo_ioctl(fp, CDIOREADTOCENTRY, (caddr_t)&irtse, td);
+ error = fo_ioctl(fp, CDIOREADTOCENTRY, (caddr_t)&irtse, cred);
if (error)
return (error);
}
static int
-linux_ioctl_CDROMSUBCHNL(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_CDROMSUBCHNL(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
struct linux_cdrom_subchnl *sc = (struct linux_cdrom_subchnl *)data;
struct ioc_read_subchannel bsdsc;
bsdsc.track = 0;
bsdsc.data_len = sizeof(struct cd_sub_channel_info);
bsdsc.data = bsdinfo;
- error = fo_ioctl(fp, CDIOCREADSUBCHANNEL, (caddr_t)&bsdsc, td);
+ error = fo_ioctl(fp, CDIOCREADSUBCHANNEL, (caddr_t)&bsdsc, cred);
if (error)
return (error);
sc->cdsc_audiostatus = bsdinfo->header.audio_status;
*/
static int
-linux_ioctl_OSS_GETVERSION(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_OSS_GETVERSION(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
- int version = linux_get_oss_version(td);
+ int version = linux_get_oss_version(curthread);
bcopy(&version, data, sizeof(int));
return (0);
#define ISSIGVALID(sig) ((sig) > 0 && (sig) < NSIG)
static int
-linux_ioctl_KDSKBMODE(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_KDSKBMODE(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
int kbdmode;
default:
return (EINVAL);
}
- return (fo_ioctl(fp, KDSKBMODE, (caddr_t)&kbdmode, td));
+ return (fo_ioctl(fp, KDSKBMODE, (caddr_t)&kbdmode, cred));
}
static int
-linux_ioctl_VT_SETMODE(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_VT_SETMODE(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
struct vt_mode *mode = (struct vt_mode *)data;
if (!ISSIGVALID(mode->frsig) && ISSIGVALID(mode->acqsig))
mode->frsig = mode->acqsig;
- return (fo_ioctl(fp, VT_SETMODE, data, td));
+ return (fo_ioctl(fp, VT_SETMODE, data, cred));
}
}
static int
-linux_ioctl_SIOCGIFCONF(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_SIOCGIFCONF(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
struct ifconf *ifc = (struct ifconf *)data;
struct l_ifreq ifr;
uio.uio_resid = ifc->ifc_len;
uio.uio_segflg = UIO_USERSPACE;
uio.uio_rw = UIO_READ;
- uio.uio_td = td;
+ uio.uio_td = curthread;
/* Keep track of eth interfaces */
ethno = 0;
}
static int
-linux_ioctl_SIOCGIFFLAGS(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_SIOCGIFFLAGS(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
struct l_ifreq *ifr = (struct l_ifreq *)data;
struct ifnet *ifp;
* we don't translate the ifname and
* use l_ifreq instead of ifreq
*/
- return (fo_ioctl(fp, SIOCGIFFLAGS, data, td));
+ return (fo_ioctl(fp, SIOCGIFFLAGS, data, cred));
}
ifp = ifname_linux_to_bsd(ifr->ifr_name, ifname);
#define ARPHRD_LOOPBACK 772
static int
-linux_ioctl_SIOGIFHWADDR(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_SIOGIFHWADDR(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
struct l_ifreq *ifr = (struct l_ifreq *)data;
struct ifnet *ifp;
}
static int
-linux_ioctl_map_ifname(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct thread *td)
+linux_ioctl_map_ifname(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, struct ucred *cred)
{
struct ifnet *ifp;
int error;
/* not a socket - probably a tap / vmnet device */
if (ocmd == LINUX_SIOCGIFADDR || ocmd == LINUX_SIOCSIFADDR) {
cmd = (ocmd == LINUX_SIOCGIFADDR) ? SIOCGIFADDR : SIOCSIFADDR;
- return (fo_ioctl(fp, cmd, data, td));
+ return (fo_ioctl(fp, cmd, data, cred));
} else
return (ENOIOCTL);
}
lifname, oifname);
#endif
- error = fo_ioctl(fp, cmd, data, td);
+ error = fo_ioctl(fp, cmd, data, cred);
clean_ifname:
bcopy(lifname, oifname, LINUX_IFNAMSIZ);
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.85.2.9 2002/09/24 08:11:41 mdodd Exp $
- * $DragonFly: src/sys/emulation/linux/linux_misc.c,v 1.26 2006/05/05 21:15:08 dillon Exp $
+ * $DragonFly: src/sys/emulation/linux/linux_misc.c,v 1.27 2006/05/06 02:43:11 dillon Exp $
*/
#include "opt_compat.h"
}
/* Executable? */
- error = VOP_GETATTR(vp, &attr, td);
+ error = VOP_GETATTR(vp, &attr);
if (error)
goto cleanup;
}
/* Can we access it? */
- error = VOP_ACCESS(vp, VEXEC, p->p_ucred, td);
+ error = VOP_ACCESS(vp, VEXEC, p->p_ucred);
if (error)
goto cleanup;
- error = VOP_OPEN(vp, FREAD, p->p_ucred, NULL, td);
+ error = VOP_OPEN(vp, FREAD, p->p_ucred, NULL);
if (error)
goto cleanup;
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sys/compat/linux/linux_socket.c,v 1.19.2.8 2001/11/07 20:33:55 marcel Exp $
- * $DragonFly: src/sys/emulation/linux/linux_socket.c,v 1.20 2006/04/26 17:42:52 dillon Exp $
+ * $DragonFly: src/sys/emulation/linux/linux_socket.c,v 1.21 2006/05/06 02:43:11 dillon Exp $
*/
#include <sys/param.h>
* accepted one, so we must clear the flags in the new descriptor.
* Ignore any errors, because we already have an open fd.
*/
- kern_fcntl(*res, F_SETFL, &dat);
+ kern_fcntl(*res, F_SETFL, &dat, curproc->p_ucred);
return (0);
}
*
* from: svr4_util.c,v 1.5 1995/01/22 23:44:50 christos Exp
* $FreeBSD: src/sys/compat/linux/linux_util.c,v 1.12.2.2 2001/11/05 19:08:23 marcel Exp $
- * $DragonFly: src/sys/emulation/linux/linux_util.c,v 1.10 2004/11/12 00:09:18 dillon Exp $
+ * $DragonFly: src/sys/emulation/linux/linux_util.c,v 1.11 2006/05/06 02:43:11 dillon Exp $
*/
#include <sys/param.h>
int
linux_copyin_path(char *uname, char **kname, int flags)
{
- struct thread *td = curthread;
struct nlookupdata nd, ndroot;
struct vattr vat, vatroot;
struct vnode *vp, *vproot;
goto dont_translate;
}
- error = VOP_GETATTR(vp, &vat, td);
+ error = VOP_GETATTR(vp, &vat);
if (error == 0) {
- error = VOP_GETATTR(vproot, &vatroot, td);
+ error = VOP_GETATTR(vproot, &vatroot);
if (error == 0) {
if (vat.va_fsid == vatroot.va_fsid &&
vat.va_fileid == vatroot.va_fileid)
* THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sys/compat/ndis/subr_ndis.c,v 1.62 2004/07/11 00:19:30 wpaul Exp $
- * $DragonFly: src/sys/emulation/ndis/subr_ndis.c,v 1.12 2006/05/05 21:15:08 dillon Exp $
+ * $DragonFly: src/sys/emulation/ndis/subr_ndis.c,v 1.13 2006/05/06 02:43:11 dillon Exp $
*/
/*
ndis_unicode_string *filename, ndis_physaddr highestaddr)
{
char *afilename = NULL;
- struct thread *td = curthread;
struct nlookupdata nd;
int error;
struct vattr vat;
nd.nl_open_vp = NULL;
/* Get the file size. */
- VOP_GETATTR(vp, vap, td);
+ VOP_GETATTR(vp, vap);
VOP_UNLOCK(vp, 0);
fh->nf_vp = vp;
ndis_map_file(ndis_status *status, void **mappedbuffer, ndis_handle filehandle)
{
ndis_fh *fh;
- struct thread *td = curthread;
int error, resid;
if (filehandle == NULL) {
fh->nf_map = malloc(fh->nf_maplen, M_DEVBUF, M_WAITOK);
error = vn_rdwr(UIO_READ, fh->nf_vp, fh->nf_map, fh->nf_maplen, 0,
- UIO_SYSSPACE, 0, proc0.p_ucred, &resid, td);
+ UIO_SYSSPACE, 0, proc0.p_ucred, &resid);
if (error)
*status = NDIS_STATUS_FAILURE;
__stdcall static void
ndis_close_file(ndis_handle filehandle)
{
- struct thread *td = curthread;
ndis_fh *fh;
if (filehandle == NULL)
if (fh->nf_vp == NULL)
return;
- vn_close(fh->nf_vp, FREAD, td);
+ vn_close(fh->nf_vp, FREAD);
fh->nf_vp = NULL;
free(fh, M_DEVBUF);
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sys/svr4/svr4_fcntl.c,v 1.7 1999/12/12 10:27:04 newton Exp $
- * $DragonFly: src/sys/emulation/svr4/Attic/svr4_fcntl.c,v 1.17 2005/12/10 16:06:20 swildner Exp $
+ * $DragonFly: src/sys/emulation/svr4/Attic/svr4_fcntl.c,v 1.18 2006/05/06 02:43:12 dillon Exp $
*/
#include <sys/param.h>
#include <sys/systm.h>
goto out;
}
- if ((error = VOP_GETATTR(vp, &vattr, td)) != 0)
+ if ((error = VOP_GETATTR(vp, &vattr)) != 0)
goto out;
if (p->p_ucred->cr_uid != vattr.va_uid &&
if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO)
return ESPIPE;
- if ((error = VOP_GETATTR(vp, &vattr, td)) != 0)
+ if ((error = VOP_GETATTR(vp, &vattr)) != 0)
return error;
length = vattr.va_size;
/* ignore any error, just give it a try */
if (fp->f_type == DTYPE_VNODE)
- fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0, p);
+ fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0, cred);
#endif
}
return error;
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sys/svr4/svr4_filio.c,v 1.8 2000/01/15 15:30:44 newton Exp $
- * $DragonFly: src/sys/emulation/svr4/Attic/svr4_filio.c,v 1.9 2005/12/10 16:06:20 swildner Exp $
+ * $DragonFly: src/sys/emulation/svr4/Attic/svr4_filio.c,v 1.10 2006/05/06 02:43:12 dillon Exp $
*/
#include <sys/param.h>
#ifdef SVR4_DEBUG
if (cmd == FIOASYNC) DPRINTF(("FIOASYNC\n"));
#endif
- error = fo_ioctl(fp, cmd, (caddr_t) &num, td);
+ error = fo_ioctl(fp, cmd, (caddr_t) &num, p->p_ucred);
if (error)
return error;
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sys/svr4/svr4_misc.c,v 1.13.2.7 2003/01/14 21:33:58 dillon Exp $
- * $DragonFly: src/sys/emulation/svr4/Attic/svr4_misc.c,v 1.33 2006/05/05 21:15:08 dillon Exp $
+ * $DragonFly: src/sys/emulation/svr4/Attic/svr4_misc.c,v 1.34 2006/05/06 02:43:12 dillon Exp $
*/
/*
if (vp->v_type != VDIR)
return (EINVAL);
- if ((error = VOP_GETATTR(vp, &va, td))) {
+ if ((error = VOP_GETATTR(vp, &va))) {
return error;
}
if (vp->v_type != VDIR || fp->f_ncp == NULL)
error = ENOTDIR;
else
- error = VOP_ACCESS(vp, VEXEC, cred, td);
+ error = VOP_ACCESS(vp, VEXEC, cred);
VOP_UNLOCK(vp, 0);
if (error)
return error;
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sys/svr4/svr4_sockio.c,v 1.7 1999/12/08 12:00:48 newton Exp $
- * $DragonFly: src/sys/emulation/svr4/Attic/svr4_sockio.c,v 1.8 2005/12/10 16:06:20 swildner Exp $
+ * $DragonFly: src/sys/emulation/svr4/Attic/svr4_sockio.c,v 1.9 2006/05/06 02:43:12 dillon Exp $
*/
#include <sys/param.h>
svr4_sock_ioctl(struct file *fp, struct thread *td, register_t *retval,
int fd, u_long cmd, caddr_t data)
{
+ struct ucred *cred = curproc->p_ucred;
int error;
*retval = 0;
(void) strncpy(br.ifr_name, sr.svr4_ifr_name,
sizeof(br.ifr_name));
if ((error = fo_ioctl(fp, SIOCGIFFLAGS,
- (caddr_t) &br, td)) != 0) {
+ (caddr_t) &br, cred)) != 0) {
DPRINTF(("SIOCGIFFLAGS (%s) %s: error %d\n",
br.ifr_name, sr.svr4_ifr_name, error));
return error;
sc.svr4_ifc_len));
if ((error = fo_ioctl(fp, OSIOCGIFCONF,
- (caddr_t) &sc, td)) != 0)
+ (caddr_t) &sc, cred)) != 0)
return error;
DPRINTF(("SIOCGIFCONF\n"));
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sys/svr4/svr4_stream.c,v 1.12.2.2 2000/11/26 04:42:27 dillon Exp $
- * $DragonFly: src/sys/emulation/svr4/Attic/svr4_stream.c,v 1.15 2005/12/10 16:06:20 swildner Exp $
+ * $DragonFly: src/sys/emulation/svr4/Attic/svr4_stream.c,v 1.16 2006/05/06 02:43:12 dillon Exp $
*/
/*
{
int error;
int nread = 0;
+ struct ucred *cred = curproc->p_ucred;
/*
* We are supposed to return the message length in nread, and the
* for us, and if we do, then we assume that we have at least one
* message waiting for us.
*/
- if ((error = fo_ioctl(fp, FIONREAD, (caddr_t) &nread, td)) != 0)
+ if ((error = fo_ioctl(fp, FIONREAD, (caddr_t) &nread, cred)) != 0)
return error;
if (nread != 0)
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sys/svr4/svr4_sysvec.c,v 1.10.2.2 2002/07/09 14:12:43 robert Exp $
- * $DragonFly: src/sys/emulation/svr4/Attic/svr4_sysvec.c,v 1.14 2005/12/10 16:06:20 swildner Exp $
+ * $DragonFly: src/sys/emulation/svr4/Attic/svr4_sysvec.c,v 1.15 2006/05/06 02:43:12 dillon Exp $
*/
/* XXX we use functions that might not exist. */
free(buf, M_TEMP);
return (error);
}
- error = VOP_GETATTR(vp, &vat, td);
+ error = VOP_GETATTR(vp, &vat);
vrele(vp);
if (error)
goto done;
free(buf, M_TEMP);
return (error);
}
- error = VOP_GETATTR(vp, &vatroot, td);
+ error = VOP_GETATTR(vp, &vatroot);
vrele(vp);
if (error)
goto done;
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sys/svr4/svr4_termios.c,v 1.5 1999/12/08 12:00:48 newton Exp $
- * $DragonFly: src/sys/emulation/svr4/Attic/svr4_termios.c,v 1.6 2005/12/10 16:06:20 swildner Exp $
+ * $DragonFly: src/sys/emulation/svr4/Attic/svr4_termios.c,v 1.7 2006/05/06 02:43:12 dillon Exp $
*/
#include <sys/param.h>
struct svr4_termios st;
struct svr4_termio t;
int error, new;
+ struct ucred *cred = curproc->p_ucred;
*retval = 0;
case SVR4_TCGETA:
case SVR4_TCGETS:
DPRINTF(("ioctl(TCGET%c);\n", cmd == SVR4_TCGETA ? 'A' : 'S'));
- if ((error = fo_ioctl(fp, TIOCGETA, (caddr_t) &bt, td)) != 0)
+ if ((error = fo_ioctl(fp, TIOCGETA, (caddr_t) &bt, cred)) != 0)
return error;
memset(&st, 0, sizeof(st));
case SVR4_TCSETSF:
DPRINTF(("TCSET{A,S,AW,SW,AF,SF}\n"));
/* get full BSD termios so we don't lose information */
- if ((error = fo_ioctl(fp, TIOCGETA, (caddr_t) &bt, td)) != 0)
+ if ((error = fo_ioctl(fp, TIOCGETA, (caddr_t) &bt, cred)) != 0)
return error;
switch (cmd) {
print_svr4_termios(&st);
#endif /* DEBUG_SVR4 */
- return fo_ioctl(fp, cmd, (caddr_t) &bt, td);
+ return fo_ioctl(fp, cmd, (caddr_t) &bt, cred);
case SVR4_TIOCGWINSZ:
DPRINTF(("TIOCGWINSZ\n"));
{
struct svr4_winsize ws;
- error = fo_ioctl(fp, TIOCGWINSZ, (caddr_t) &ws, td);
+ error = fo_ioctl(fp, TIOCGWINSZ, (caddr_t) &ws, cred);
if (error)
return error;
return copyout(&ws, data, sizeof(ws));
if ((error = copyin(data, &ws, sizeof(ws))) != 0)
return error;
- return fo_ioctl(fp, TIOCSWINSZ, (caddr_t) &ws, td);
+ return fo_ioctl(fp, TIOCSWINSZ, (caddr_t) &ws, cred);
}
default:
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sys/svr4/svr4_ttold.c,v 1.7 1999/12/08 12:00:49 newton Exp $
- * $DragonFly: src/sys/emulation/svr4/Attic/svr4_ttold.c,v 1.6 2005/12/10 16:06:20 swildner Exp $
+ * $DragonFly: src/sys/emulation/svr4/Attic/svr4_ttold.c,v 1.7 2006/05/06 02:43:12 dillon Exp $
*/
#include <sys/param.h>
svr4_ttold_ioctl(struct file *fp, struct thread *td, register_t *retval,
int fd, u_long cmd, caddr_t data)
{
- int error;
+ struct ucred *cred = curproc->p_ucred;
+ int error;
*retval = 0;
{
pid_t pid;
- if ((error = fo_ioctl(fp, TIOCGPGRP, (caddr_t) &pid, td)) != 0)
+ if ((error = fo_ioctl(fp, TIOCGPGRP, (caddr_t) &pid, cred)) != 0)
return error;
DPRINTF(("TIOCGPGRP %d\n", pid));
DPRINTF(("TIOCSPGRP %d\n", pid));
- return fo_ioctl(fp, TIOCSPGRP, (caddr_t) &pid, td);
+ return fo_ioctl(fp, TIOCSPGRP, (caddr_t) &pid, cred);
}
case SVR4_TIOCGSID:
{
#if defined(TIOCGSID)
pid_t pid;
- if ((error = fo_ioctl(fp, TIOCGSID, (caddr_t) &pid, td)) != 0)
+ if ((error = fo_ioctl(fp, TIOCGSID, (caddr_t) &pid, cred)) != 0)
return error;
DPRINTF(("TIOCGSID %d\n", pid));
struct sgttyb bs;
struct svr4_sgttyb ss;
- error = fo_ioctl(fp, TIOCGETP, (caddr_t) &bs, td);
+ error = fo_ioctl(fp, TIOCGETP, (caddr_t) &bs, cred);
if (error)
return error;
print_svr4_sgttyb("SVR4_TIOCSET{P,N}", &ss);
#endif /* DEBUG_SVR4 */
cmd = (cmd == SVR4_TIOCSETP) ? TIOCSETP : TIOCSETN;
- return fo_ioctl(fp, cmd, (caddr_t) &bs, td);
+ return fo_ioctl(fp, cmd, (caddr_t) &bs, cred);
}
case SVR4_TIOCGETC:
struct tchars bt;
struct svr4_tchars st;
- error = fo_ioctl(fp, TIOCGETC, (caddr_t) &bt, td);
+ error = fo_ioctl(fp, TIOCGETC, (caddr_t) &bt, cred);
if (error)
return error;
#ifdef DEBUG_SVR4
print_svr4_tchars("SVR4_TIOCSETC", &st);
#endif /* DEBUG_SVR4 */
- return fo_ioctl(fp, TIOCSETC, (caddr_t) &bt, td);
+ return fo_ioctl(fp, TIOCSETC, (caddr_t) &bt, cred);
}
case SVR4_TIOCGLTC:
struct ltchars bl;
struct svr4_ltchars sl;
- error = fo_ioctl(fp, TIOCGLTC, (caddr_t) &bl, td);
+ error = fo_ioctl(fp, TIOCGLTC, (caddr_t) &bl, cred);
if (error)
return error;
#ifdef DEBUG_SVR4
print_svr4_ltchars("SVR4_TIOCSLTC", &sl);
#endif /* DEBUG_SVR4 */
- return fo_ioctl(fp, TIOCSLTC, (caddr_t) &bl, td);
+ return fo_ioctl(fp, TIOCSLTC, (caddr_t) &bl, cred);
}
case SVR4_TIOCLGET:
{
int flags;
- if ((error = fo_ioctl(fp, TIOCLGET, (caddr_t) &flags, td)) != 0)
+ if ((error = fo_ioctl(fp, TIOCLGET, (caddr_t) &flags, cred)) != 0)
return error;
DPRINTF(("SVR4_TIOCLGET %o\n", flags));
return copyout(&flags, data, sizeof(flags));
}
DPRINTF(("SVR4_TIOCL{SET,BIS,BIC} %o\n", flags));
- return fo_ioctl(fp, cmd, (caddr_t) &flags, td);
+ return fo_ioctl(fp, cmd, (caddr_t) &flags, cred);
}
default:
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
* $FreeBSD: src/sys/i386/i386/vm_machdep.c,v 1.132.2.9 2003/01/25 19:02:23 dillon Exp $
- * $DragonFly: src/sys/i386/i386/Attic/vm_machdep.c,v 1.41 2006/04/30 20:23:22 dillon Exp $
+ * $DragonFly: src/sys/i386/i386/Attic/vm_machdep.c,v 1.42 2006/05/06 02:43:12 dillon Exp $
*/
#include "use_npx.h"
bcopy(p->p_thread->td_pcb, tempuser + ((char *)p->p_thread->td_pcb - (char *)p->p_addr), sizeof(struct pcb));
error = vn_rdwr(UIO_WRITE, vp, (caddr_t) tempuser, ctob(UPAGES),
- (off_t)0, UIO_SYSSPACE, IO_UNIT, cred, (int *)NULL, td);
+ (off_t)0, UIO_SYSSPACE, IO_UNIT, cred, (int *)NULL);
free(tempuser, M_TEMP);
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/kern/imgact_aout.c,v 1.59.2.5 2001/11/03 01:41:08 ps Exp $
- * $DragonFly: src/sys/kern/imgact_aout.c,v 1.10 2006/03/29 18:44:50 dillon Exp $
+ * $DragonFly: src/sys/kern/imgact_aout.c,v 1.11 2006/05/06 02:43:12 dillon Exp $
*/
#include <sys/param.h>
if (error == 0)
error = vn_rdwr_inchunks(UIO_WRITE, vp, vm->vm_daddr,
(int)ctob(vm->vm_dsize), (off_t)ctob(UPAGES), UIO_USERSPACE,
- IO_UNIT | IO_DIRECT | IO_CORE, cred, (int *) NULL,
- p->p_thread);
+ IO_UNIT | IO_DIRECT | IO_CORE, cred, (int *) NULL);
if (error == 0)
error = vn_rdwr_inchunks(UIO_WRITE, vp,
(caddr_t) trunc_page(USRSTACK - ctob(vm->vm_ssize)),
round_page(ctob(vm->vm_ssize)),
(off_t)ctob(UPAGES) + ctob(vm->vm_dsize), UIO_USERSPACE,
- IO_UNIT | IO_DIRECT | IO_CORE, cred, (int *) NULL,
- p->p_thread);
+ IO_UNIT | IO_DIRECT | IO_CORE, cred, (int *) NULL);
return (error);
}
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $DragonFly: src/sys/kern/imgact_resident.c,v 1.10 2006/05/05 20:15:01 dillon Exp $
+ * $DragonFly: src/sys/kern/imgact_resident.c,v 1.11 2006/05/06 02:43:12 dillon Exp $
*/
#include <sys/param.h>
}
/* indicate that we are using the vnode */
- error = vget(vrtmp, LK_EXCLUSIVE, td);
+ error = vget(vrtmp, LK_EXCLUSIVE);
if (error)
goto done;
/* retrieve underlying stat information and release vnode */
- error = vn_stat(vrtmp, &st, td);
+ error = vn_stat(vrtmp, &st, td->td_proc->p_ucred);
vput(vrtmp);
if (error)
goto done;
*
* @(#)kern_acct.c 8.1 (Berkeley) 6/14/93
* $FreeBSD: src/sys/kern/kern_acct.c,v 1.23.2.1 2002/07/24 18:33:55 johan Exp $
- * $DragonFly: src/sys/kern/kern_acct.c,v 1.21 2006/05/05 21:15:08 dillon Exp $
+ * $DragonFly: src/sys/kern/kern_acct.c,v 1.22 2006/05/06 02:43:12 dillon Exp $
*/
#include <sys/param.h>
if (acctp != NULLVP || savacctp != NULLVP) {
callout_stop(&acctwatch_handle);
error = vn_close((acctp != NULLVP ? acctp : savacctp),
- FWRITE | O_APPEND, td);
+ FWRITE | O_APPEND);
acctp = savacctp = NULLVP;
}
struct timeval ut, st, tmp;
int t;
struct vnode *vp;
- struct thread *td = p->p_thread;
/* If accounting isn't enabled, don't bother */
vp = acctp;
*/
return (vn_rdwr(UIO_WRITE, vp, (caddr_t)&acct, sizeof (acct),
(off_t)0, UIO_SYSSPACE, IO_APPEND|IO_UNIT, p->p_ucred,
- (int *)0, td));
+ (int *)0));
}
/*
if (savacctp != NULLVP) {
if (savacctp->v_type == VBAD) {
- (void) vn_close(savacctp, FWRITE | O_APPEND, NULL);
+ (void) vn_close(savacctp, FWRITE | O_APPEND);
savacctp = NULLVP;
return;
}
if (acctp == NULLVP)
return;
if (acctp->v_type == VBAD) {
- (void) vn_close(acctp, FWRITE | O_APPEND, NULL);
+ (void) vn_close(acctp, FWRITE | O_APPEND);
acctp = NULLVP;
return;
}
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/kern/kern_acl.c,v 1.2.2.1 2000/07/28 18:48:16 rwatson Exp $
- * $DragonFly: src/sys/kern/kern_acl.c,v 1.11 2006/05/05 21:15:08 dillon Exp $
+ * $DragonFly: src/sys/kern/kern_acl.c,v 1.12 2006/05/06 02:43:12 dillon Exp $
*/
/*
ucred = td->td_proc->p_ucred;
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
- error = VOP_SETACL(vp, type, &inkernacl, ucred, td);
+ error = VOP_SETACL(vp, type, &inkernacl, ucred);
VOP_UNLOCK(vp, 0);
return(error);
}
KKASSERT(td->td_proc);
ucred = td->td_proc->p_ucred;
- error = VOP_GETACL(vp, type, &inkernelacl, ucred, td);
+ error = VOP_GETACL(vp, type, &inkernelacl, ucred);
if (error == 0)
error = copyout(&inkernelacl, aclp, sizeof(struct acl));
return (error);
KKASSERT(td->td_proc);
ucred = td->td_proc->p_ucred;
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
- error = VOP_SETACL(vp, ACL_TYPE_DEFAULT, 0, ucred, td);
+ error = VOP_SETACL(vp, ACL_TYPE_DEFAULT, 0, ucred);
VOP_UNLOCK(vp, 0);
return (error);
}
error = copyin(aclp, &inkernelacl, sizeof(struct acl));
if (error)
return(error);
- error = VOP_ACLCHECK(vp, type, &inkernelacl, ucred, td);
+ error = VOP_ACLCHECK(vp, type, &inkernelacl, ucred);
return (error);
}
*
* @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94
* $FreeBSD: src/sys/kern/kern_descrip.c,v 1.81.2.19 2004/02/28 00:43:31 tegge Exp $
- * $DragonFly: src/sys/kern/kern_descrip.c,v 1.52 2006/05/02 21:30:43 dillon Exp $
+ * $DragonFly: src/sys/kern/kern_descrip.c,v 1.53 2006/05/06 02:43:12 dillon Exp $
*/
#include "opt_compat.h"
};
static int badfo_readwrite (struct file *fp, struct uio *uio,
- struct ucred *cred, int flags, struct thread *td);
+ struct ucred *cred, int flags);
static int badfo_ioctl (struct file *fp, u_long com, caddr_t data,
- struct thread *td);
-static int badfo_poll (struct file *fp, int events,
- struct ucred *cred, struct thread *td);
+ struct ucred *cred);
+static int badfo_poll (struct file *fp, int events, struct ucred *cred);
static int badfo_kqfilter (struct file *fp, struct knote *kn);
-static int badfo_stat (struct file *fp, struct stat *sb, struct thread *td);
-static int badfo_close (struct file *fp, struct thread *td);
-static int badfo_shutdown (struct file *fp, int how, struct thread *td);
+static int badfo_stat (struct file *fp, struct stat *sb, struct ucred *cred);
+static int badfo_close (struct file *fp);
+static int badfo_shutdown (struct file *fp, int how);
/*
* Descriptor management.
}
int
-kern_fcntl(int fd, int cmd, union fcntl_dat *dat)
+kern_fcntl(int fd, int cmd, union fcntl_dat *dat, struct ucred *cred)
{
struct thread *td = curthread;
struct proc *p = td->td_proc;
fp->f_flag &= ~FCNTLFLAGS;
fp->f_flag |= FFLAGS(dat->fc_flags & ~O_ACCMODE) & FCNTLFLAGS;
tmp = fp->f_flag & FNONBLOCK;
- error = fo_ioctl(fp, FIONBIO, (caddr_t)&tmp, td);
+ error = fo_ioctl(fp, FIONBIO, (caddr_t)&tmp, cred);
if (error) {
fdrop(fp, td);
return (error);
}
tmp = fp->f_flag & FASYNC;
- error = fo_ioctl(fp, FIOASYNC, (caddr_t)&tmp, td);
+ error = fo_ioctl(fp, FIOASYNC, (caddr_t)&tmp, cred);
if (!error) {
fdrop(fp, td);
return (0);
}
fp->f_flag &= ~FNONBLOCK;
tmp = 0;
- fo_ioctl(fp, FIONBIO, (caddr_t)&tmp, td);
+ fo_ioctl(fp, FIONBIO, (caddr_t)&tmp, cred);
fdrop(fp, td);
return (error);
case F_GETOWN:
fhold(fp);
- error = fo_ioctl(fp, FIOGETOWN, (caddr_t)&dat->fc_owner, td);
+ error = fo_ioctl(fp, FIOGETOWN, (caddr_t)&dat->fc_owner, cred);
fdrop(fp, td);
return(error);
case F_SETOWN:
fhold(fp);
- error = fo_ioctl(fp, FIOSETOWN, (caddr_t)&dat->fc_owner, td);
+ error = fo_ioctl(fp, FIOSETOWN, (caddr_t)&dat->fc_owner, cred);
fdrop(fp, td);
return(error);
break;
}
- error = kern_fcntl(uap->fd, uap->cmd, &dat);
+ error = kern_fcntl(uap->fd, uap->cmd, &dat, curproc->p_ucred);
if (error == 0) {
switch (uap->cmd) {
(fp = fdp->fd_files[fd].fp) == NULL)
return (EBADF);
fhold(fp);
- error = fo_shutdown(fp, how, td);
+ error = fo_shutdown(fp, how);
fdrop(fp, td);
return (error);
(fp = fdp->fd_files[fd].fp) == NULL)
return (EBADF);
fhold(fp);
- error = fo_stat(fp, ub, td);
+ error = fo_stat(fp, ub, p->p_ucred);
fdrop(fp, td);
return (error);
(void) VOP_ADVLOCK(vp, (caddr_t)fp, F_UNLCK, &lf, F_FLOCK);
}
if (fp->f_ops != &badfileops)
- error = fo_close(fp, td);
+ error = fo_close(fp);
else
error = 0;
ffree(fp);
struct file *fp,
struct uio *uio,
struct ucred *cred,
- int flags,
- struct thread *td
+ int flags
) {
return (EBADF);
}
static int
-badfo_ioctl(struct file *fp, u_long com, caddr_t data, struct thread *td)
+badfo_ioctl(struct file *fp, u_long com, caddr_t data, struct ucred *cred)
{
return (EBADF);
}
static int
-badfo_poll(struct file *fp, int events, struct ucred *cred, struct thread *td)
+badfo_poll(struct file *fp, int events, struct ucred *cred)
{
return (0);
}
}
static int
-badfo_stat(struct file *fp, struct stat *sb, struct thread *td)
+badfo_stat(struct file *fp, struct stat *sb, struct ucred *cred)
{
return (EBADF);
}
static int
-badfo_close(struct file *fp, struct thread *td)
+badfo_close(struct file *fp)
{
return (EBADF);
}
static int
-badfo_shutdown(struct file *fp, int how, struct thread *td)
+badfo_shutdown(struct file *fp, int how)
{
return (EBADF);
}
int
-nofo_shutdown(struct file *fp, int how, struct thread *td)
+nofo_shutdown(struct file *fp, int how)
{
return (EOPNOTSUPP);
}
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/kern/kern_event.c,v 1.2.2.10 2004/04/04 07:03:14 cperciva Exp $
- * $DragonFly: src/sys/kern/kern_event.c,v 1.20 2006/03/25 18:32:35 dillon Exp $
+ * $DragonFly: src/sys/kern/kern_event.c,v 1.21 2006/05/06 02:43:12 dillon Exp $
*/
#include <sys/param.h>
struct kevent *ulistp, const struct timespec *timeout,
struct thread *td, int *res);
static int kqueue_read(struct file *fp, struct uio *uio,
- struct ucred *cred, int flags, struct thread *td);
+ struct ucred *cred, int flags);
static int kqueue_write(struct file *fp, struct uio *uio,
- struct ucred *cred, int flags, struct thread *td);
+ struct ucred *cred, int flags);
static int kqueue_ioctl(struct file *fp, u_long com, caddr_t data,
- struct thread *td);
-static int kqueue_poll(struct file *fp, int events, struct ucred *cred,
- struct thread *td);
+ struct ucred *cred);
+static int kqueue_poll(struct file *fp, int events, struct ucred *cred);
static int kqueue_kqfilter(struct file *fp, struct knote *kn);
-static int kqueue_stat(struct file *fp, struct stat *st, struct thread *td);
-static int kqueue_close(struct file *fp, struct thread *td);
+static int kqueue_stat(struct file *fp, struct stat *st,
+ struct ucred *cred);
+static int kqueue_close(struct file *fp);
static void kqueue_wakeup(struct kqueue *kq);
static struct fileops kqueueops = {
*/
/*ARGSUSED*/
static int
-kqueue_read(struct file *fp, struct uio *uio, struct ucred *cred,
- int flags, struct thread *td)
+kqueue_read(struct file *fp, struct uio *uio, struct ucred *cred, int flags)
{
return (ENXIO);
}
/*ARGSUSED*/
static int
-kqueue_write(struct file *fp, struct uio *uio, struct ucred *cred,
- int flags, struct thread *td)
+kqueue_write(struct file *fp, struct uio *uio, struct ucred *cred, int flags)
{
return (ENXIO);
}
/*ARGSUSED*/
static int
-kqueue_ioctl(struct file *fp, u_long com, caddr_t data, struct thread *td)
+kqueue_ioctl(struct file *fp, u_long com, caddr_t data, struct ucred *cred)
{
return (ENOTTY);
}
/*ARGSUSED*/
static int
-kqueue_poll(struct file *fp, int events, struct ucred *cred, struct thread *td)
+kqueue_poll(struct file *fp, int events, struct ucred *cred)
{
struct kqueue *kq = (struct kqueue *)fp->f_data;
int revents = 0;
if (kq->kq_count) {
revents |= events & (POLLIN | POLLRDNORM);
} else {
- selrecord(td, &kq->kq_sel);
+ selrecord(curthread, &kq->kq_sel);
kq->kq_state |= KQ_SEL;
}
}
/*ARGSUSED*/
static int
-kqueue_stat(struct file *fp, struct stat *st, struct thread *td)
+kqueue_stat(struct file *fp, struct stat *st, struct ucred *cred)
{
struct kqueue *kq = (struct kqueue *)fp->f_data;
/*ARGSUSED*/
static int
-kqueue_close(struct file *fp, struct thread *td)
+kqueue_close(struct file *fp)
{
+ struct thread *td = curthread;
struct proc *p = td->td_proc;
struct kqueue *kq = (struct kqueue *)fp->f_data;
struct filedesc *fdp;
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/kern/kern_exec.c,v 1.107.2.15 2002/07/30 15:40:46 nectar Exp $
- * $DragonFly: src/sys/kern/kern_exec.c,v 1.37 2006/05/05 21:15:08 dillon Exp $
+ * $DragonFly: src/sys/kern/kern_exec.c,v 1.38 2006/05/06 02:43:12 dillon Exp $
*/
#include <sys/param.h>
struct proc *p = imgp->proc;
struct vnode *vp = imgp->vp;
struct vattr *attr = imgp->attr;
- struct thread *td = p->p_thread;
int error;
/* Get file attributes */
- error = VOP_GETATTR(vp, attr, td);
+ error = VOP_GETATTR(vp, attr);
if (error)
return (error);
/*
* Check for execute permission to file based on current credentials.
*/
- error = VOP_ACCESS(vp, VEXEC, p->p_ucred, td);
+ error = VOP_ACCESS(vp, VEXEC, p->p_ucred);
if (error)
return (error);
* write, and mmap the file. Without the VOP_OPEN we can only
* stat the file.
*/
- error = VOP_OPEN(vp, FREAD, p->p_ucred, NULL, td);
+ error = VOP_OPEN(vp, FREAD, p->p_ucred, NULL);
if (error)
return (error);
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $DragonFly: src/sys/kern/kern_fp.c,v 1.14 2006/04/01 20:46:47 dillon Exp $
+ * $DragonFly: src/sys/kern/kern_fp.c,v 1.15 2006/05/06 02:43:12 dillon Exp $
*/
/*
if (flags & FREAD)
vmode |= VREAD;
if (vmode) {
- error = VOP_ACCESS(vp, vmode, td->td_proc->p_ucred, td);
+ error = VOP_ACCESS(vp, vmode, td->td_proc->p_ucred);
if (error)
goto bad2;
}
if ((flags & O_ROOTCRED) == 0 && td->td_proc)
fsetcred(fp, td->td_proc->p_ucred);
- error = VOP_OPEN(vp, flags, td->td_proc->p_ucred, fp, td);
+ error = VOP_OPEN(vp, flags, td->td_proc->p_ucred, fp);
if (error)
goto bad1;
auio.uio_td = curthread;
count = nbytes;
- error = fo_read(fp, &auio, fp->f_cred, FOF_OFFSET, auio.uio_td);
+ error = fo_read(fp, &auio, fp->f_cred, FOF_OFFSET);
if (error) {
if (auio.uio_resid != nbytes && (error == ERESTART || error == EINTR ||
error == EWOULDBLOCK)
*/
do {
lastresid = auio.uio_resid;
- error = fo_read(fp, &auio, fp->f_cred, 0, auio.uio_td);
+ error = fo_read(fp, &auio, fp->f_cred, 0);
} while (all && auio.uio_resid &&
((error == 0 && auio.uio_resid != lastresid) ||
error == ERESTART || error == EINTR));
auio.uio_td = curthread;
count = nbytes;
- error = fo_write(fp, &auio, fp->f_cred, FOF_OFFSET, auio.uio_td);
+ error = fo_write(fp, &auio, fp->f_cred, FOF_OFFSET);
if (error) {
if (auio.uio_resid != nbytes && (error == ERESTART || error == EINTR ||
error == EWOULDBLOCK)
auio.uio_td = curthread;
count = nbytes;
- error = fo_write(fp, &auio, fp->f_cred, 0, auio.uio_td);
+ error = fo_write(fp, &auio, fp->f_cred, 0);
if (error) {
if (auio.uio_resid != nbytes && (error == ERESTART || error == EINTR ||
error == EWOULDBLOCK)
{
int error;
- error = fo_stat(fp, ub, curthread);
+ error = fo_stat(fp, ub, fp->f_cred);
return(error);
}
) {
if ((fp->f_flag & FWRITE) != 0) {
struct vattr va;
- if ((error = VOP_GETATTR(vp, &va, td))) {
+ if ((error = VOP_GETATTR(vp, &va))) {
goto done;
}
if ((va.va_flags & (IMMUTABLE|APPEND)) == 0) {
int
fp_shutdown(file_t fp, int how)
{
- return(fo_shutdown(fp, how, curthread));
+ return(fo_shutdown(fp, how));
}
* ----------------------------------------------------------------------------
*
* $FreeBSD: src/sys/kern/kern_jail.c,v 1.6.2.3 2001/08/17 01:00:26 rwatson Exp $
- * $DragonFly: src/sys/kern/kern_jail.c,v 1.9 2005/10/08 11:43:02 corecode Exp $
+ * $DragonFly: src/sys/kern/kern_jail.c,v 1.10 2006/05/06 02:43:12 dillon Exp $
*
*/
}
int
-prison_if(struct thread *td, struct sockaddr *sa)
+prison_if(struct ucred *cred, struct sockaddr *sa)
{
struct prison *pr;
struct sockaddr_in *sai = (struct sockaddr_in*) sa;
int ok;
- if (td->td_proc == NULL)
- return(0);
- pr = td->td_proc->p_ucred->cr_prison;
+ pr = cred->cr_prison;
if ((sai->sin_family != AF_INET) && jail_socket_unixiproute_only)
ok = 1;
*
* @(#)kern_ktrace.c 8.2 (Berkeley) 9/23/93
* $FreeBSD: src/sys/kern/kern_ktrace.c,v 1.35.2.6 2002/07/05 22:36:38 darrenr Exp $
- * $DragonFly: src/sys/kern/kern_ktrace.c,v 1.21 2006/05/05 21:15:08 dillon Exp $
+ * $DragonFly: src/sys/kern/kern_ktrace.c,v 1.22 2006/05/06 02:43:12 dillon Exp $
*/
#include "opt_ktrace.h"
if (ktrcanset(curp, p) && p->p_tracep == vp) {
p->p_tracep = NULL;
p->p_traceflag = 0;
- vn_close(vp, FREAD|FWRITE, td);
+ vn_close(vp, FREAD|FWRITE);
} else {
error = EPERM;
}
error = EPERM;
done:
if (vp != NULL)
- vn_close(vp, FWRITE, td);
+ vn_close(vp, FWRITE);
curp->p_traceflag &= ~KTRFAC_ACTIVE;
return (error);
#else
*
* @(#)kern_sig.c 8.7 (Berkeley) 4/18/94
* $FreeBSD: src/sys/kern/kern_sig.c,v 1.72.2.17 2003/05/16 16:34:34 obrien Exp $
- * $DragonFly: src/sys/kern/kern_sig.c,v 1.45 2006/05/05 21:15:08 dillon Exp $
+ * $DragonFly: src/sys/kern/kern_sig.c,v 1.46 2006/05/06 02:43:12 dillon Exp $
*/
#include "opt_ktrace.h"
{
struct vnode *vp;
struct ucred *cred = p->p_ucred;
- struct thread *td = p->p_thread;
struct flock lf;
struct nlookupdata nd;
struct vattr vattr;
/* Don't dump to non-regular files or files with links. */
if (vp->v_type != VREG ||
- VOP_GETATTR(vp, &vattr, td) || vattr.va_nlink != 1) {
+ VOP_GETATTR(vp, &vattr) || vattr.va_nlink != 1) {
error = EFAULT;
goto out1;
}
VATTR_NULL(&vattr);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
vattr.va_size = 0;
- VOP_SETATTR(vp, &vattr, cred, td);
+ VOP_SETATTR(vp, &vattr, cred);
p->p_acflag |= ACORE;
VOP_UNLOCK(vp, 0);
lf.l_type = F_UNLCK;
VOP_ADVLOCK(vp, (caddr_t)p, F_UNLCK, &lf, F_FLOCK);
out2:
- error1 = vn_close(vp, FWRITE, td);
+ error1 = vn_close(vp, FWRITE);
if (error == 0)
error = error1;
return (error);
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/kern/link_aout.c,v 1.26 1999/12/24 15:33:36 bde Exp $
- * $DragonFly: src/sys/kern/link_aout.c,v 1.16 2006/05/05 21:15:08 dillon Exp $
+ * $DragonFly: src/sys/kern/link_aout.c,v 1.17 2006/05/06 02:43:12 dillon Exp $
*/
#define FREEBSD_AOUT 1
* Read the a.out header from the file.
*/
error = vn_rdwr(UIO_READ, vp, (void*) &header, sizeof header, 0,
- UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, td);
+ UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid);
if (error)
goto out;
*/
error = vn_rdwr(UIO_READ, vp, (void*) af->address,
header.a_text + header.a_data, 0,
- UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, td);
+ UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid);
if (error)
goto out;
bzero(af->address + header.a_text + header.a_data, header.a_bss);
out:
VOP_UNLOCK(vp, 0);
- vn_close(vp, FREAD, td);
+ vn_close(vp, FREAD);
return error;
}
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/kern/link_elf.c,v 1.24 1999/12/24 15:33:36 bde Exp $
- * $DragonFly: src/sys/kern/link_elf.c,v 1.18 2006/05/05 21:15:09 dillon Exp $
+ * $DragonFly: src/sys/kern/link_elf.c,v 1.19 2006/05/06 02:43:12 dillon Exp $
*/
#include <sys/param.h>
}
hdr = (Elf_Ehdr *)firstpage;
error = vn_rdwr(UIO_READ, vp, firstpage, PAGE_SIZE, 0,
- UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, td);
+ UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid);
nbytes = PAGE_SIZE - resid;
if (error)
goto out;
caddr_t segbase = mapbase + segs[i]->p_vaddr - base_vaddr;
error = vn_rdwr(UIO_READ, vp,
segbase, segs[i]->p_filesz, segs[i]->p_offset,
- UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, td);
+ UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid);
if (error) {
#ifdef SPARSE_MAPPING
vm_map_remove(kernel_map, (vm_offset_t) ef->address,
}
error = vn_rdwr(UIO_READ, vp,
(caddr_t)shdr, nbytes, hdr->e_shoff,
- UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, td);
+ UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid);
if (error)
goto out;
symtabindex = -1;
}
error = vn_rdwr(UIO_READ, vp,
ef->symbase, symcnt, shdr[symtabindex].sh_offset,
- UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, td);
+ UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid);
if (error)
goto out;
error = vn_rdwr(UIO_READ, vp,
ef->strbase, strcnt, shdr[symstrindex].sh_offset,
- UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, td);
+ UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid);
if (error)
goto out;
if (firstpage)
free(firstpage, M_LINKER);
VOP_UNLOCK(vp, 0);
- vn_close(vp, FREAD, td);
+ vn_close(vp, FREAD);
return error;
}
*
* @(#)sys_generic.c 8.5 (Berkeley) 1/21/94
* $FreeBSD: src/sys/kern/sys_generic.c,v 1.55.2.10 2001/03/17 10:39:32 peter Exp $
- * $DragonFly: src/sys/kern/sys_generic.c,v 1.25 2006/04/26 17:42:53 dillon Exp $
+ * $DragonFly: src/sys/kern/sys_generic.c,v 1.26 2006/05/06 02:43:12 dillon Exp $
*/
#include "opt_ktrace.h"
}
#endif
len = auio->uio_resid;
- error = fo_read(fp, auio, fp->f_cred, flags, td);
+ error = fo_read(fp, auio, fp->f_cred, flags);
if (error) {
if (auio->uio_resid != len && (error == ERESTART ||
error == EINTR || error == EWOULDBLOCK))
len = auio->uio_resid;
if (fp->f_type == DTYPE_VNODE)
bwillwrite();
- error = fo_write(fp, auio, fp->f_cred, flags, td);
+ error = fo_write(fp, auio, fp->f_cred, flags);
if (error) {
if (auio->uio_resid != len && (error == ERESTART ||
error == EINTR || error == EWOULDBLOCK))
{
struct thread *td = curthread;
struct proc *p = td->td_proc;
+ struct ucred *cred;
struct file *fp;
struct filedesc *fdp;
struct ioctl_map_range *iomc = NULL;
} ubuf;
KKASSERT(p);
+ cred = p->p_ucred;
fdp = p->p_fd;
if ((u_int)fd >= fdp->fd_nfiles ||
(fp = fdp->fd_files[fd].fp) == NULL)
fp->f_flag |= FNONBLOCK;
else
fp->f_flag &= ~FNONBLOCK;
- error = fo_ioctl(fp, FIONBIO, (caddr_t)&tmp, td);
+ error = fo_ioctl(fp, FIONBIO, (caddr_t)&tmp, cred);
break;
case FIOASYNC:
fp->f_flag |= FASYNC;
else
fp->f_flag &= ~FASYNC;
- error = fo_ioctl(fp, FIOASYNC, (caddr_t)&tmp, td);
+ error = fo_ioctl(fp, FIOASYNC, (caddr_t)&tmp, cred);
break;
default:
* call it instead of directly routing the call
*/
if (map != NULL && iomc->wrapfunc != NULL)
- error = iomc->wrapfunc(fp, com, ocom, data, td);
+ error = iomc->wrapfunc(fp, com, ocom, data, cred);
else
- error = fo_ioctl(fp, com, data, td);
+ error = fo_ioctl(fp, com, data, cred);
/*
* Copy any data to user, size was
* already set and checked above.
static int
selscan(struct proc *p, fd_mask **ibits, fd_mask **obits, int nfd, int *res)
{
- struct thread *td = p->p_thread;
struct filedesc *fdp = p->p_fd;
int msk, i, fd;
fd_mask bits;
fp = fdp->fd_files[fd].fp;
if (fp == NULL)
return (EBADF);
- if (fo_poll(fp, flag[msk], fp->f_cred, td)) {
+ if (fo_poll(fp, flag[msk], fp->f_cred)) {
obits[msk][(fd)/NFDBITS] |=
((fd_mask)1 << ((fd) % NFDBITS));
n++;
static int
pollscan(struct proc *p, struct pollfd *fds, u_int nfd, int *res)
{
- struct thread *td = p->p_thread;
struct filedesc *fdp = p->p_fd;
int i;
struct file *fp;
* POLLERR if appropriate.
*/
fds->revents = fo_poll(fp, fds->events,
- fp->f_cred, td);
+ fp->f_cred);
if (fds->revents != 0)
n++;
}
* are met.
*
* $FreeBSD: src/sys/kern/sys_pipe.c,v 1.60.2.13 2002/08/05 15:05:15 des Exp $
- * $DragonFly: src/sys/kern/sys_pipe.c,v 1.32 2005/09/02 07:16:58 hsu Exp $
+ * $DragonFly: src/sys/kern/sys_pipe.c,v 1.33 2006/05/06 02:43:12 dillon Exp $
*/
/*
* interfaces to the outside world
*/
static int pipe_read (struct file *fp, struct uio *uio,
- struct ucred *cred, int flags, struct thread *td);
+ struct ucred *cred, int flags);
static int pipe_write (struct file *fp, struct uio *uio,
- struct ucred *cred, int flags, struct thread *td);
-static int pipe_close (struct file *fp, struct thread *td);
-static int pipe_shutdown (struct file *fp, int how, struct thread *td);
-static int pipe_poll (struct file *fp, int events, struct ucred *cred,
- struct thread *td);
+ struct ucred *cred, int flags);
+static int pipe_close (struct file *fp);
+static int pipe_shutdown (struct file *fp, int how);
+static int pipe_poll (struct file *fp, int events, struct ucred *cred);
static int pipe_kqfilter (struct file *fp, struct knote *kn);
-static int pipe_stat (struct file *fp, struct stat *sb, struct thread *td);
-static int pipe_ioctl (struct file *fp, u_long cmd, caddr_t data, struct thread *td);
+static int pipe_stat (struct file *fp, struct stat *sb, struct ucred *cred);
+static int pipe_ioctl (struct file *fp, u_long cmd, caddr_t data, struct ucred *cred);
static struct fileops pipeops = {
NULL, /* port */
/* ARGSUSED */
static int
-pipe_read(struct file *fp, struct uio *uio, struct ucred *cred,
- int flags, struct thread *td)
+pipe_read(struct file *fp, struct uio *uio, struct ucred *cred, int flags)
{
struct pipe *rpipe = (struct pipe *) fp->f_data;
int error;
#endif
static int
-pipe_write(struct file *fp, struct uio *uio, struct ucred *cred,
- int flags, struct thread *td)
+pipe_write(struct file *fp, struct uio *uio, struct ucred *cred, int flags)
{
int error = 0;
int orig_resid;
* we implement a very minimal set of ioctls for compatibility with sockets.
*/
int
-pipe_ioctl(struct file *fp, u_long cmd, caddr_t data, struct thread *td)
+pipe_ioctl(struct file *fp, u_long cmd, caddr_t data, struct ucred *cred)
{
struct pipe *mpipe = (struct pipe *)fp->f_data;
}
int
-pipe_poll(struct file *fp, int events, struct ucred *cred, struct thread *td)
+pipe_poll(struct file *fp, int events, struct ucred *cred)
{
struct pipe *rpipe = (struct pipe *)fp->f_data;
struct pipe *wpipe;
if (revents == 0) {
if (events & (POLLIN | POLLRDNORM)) {
- selrecord(td, &rpipe->pipe_sel);
+ selrecord(curthread, &rpipe->pipe_sel);
rpipe->pipe_state |= PIPE_SEL;
}
if (events & (POLLOUT | POLLWRNORM)) {
- selrecord(td, &wpipe->pipe_sel);
+ selrecord(curthread, &wpipe->pipe_sel);
wpipe->pipe_state |= PIPE_SEL;
}
}
}
static int
-pipe_stat(struct file *fp, struct stat *ub, struct thread *td)
+pipe_stat(struct file *fp, struct stat *ub, struct ucred *cred)
{
struct pipe *pipe = (struct pipe *)fp->f_data;
/* ARGSUSED */
static int
-pipe_close(struct file *fp, struct thread *td)
+pipe_close(struct file *fp)
{
struct pipe *cpipe = (struct pipe *)fp->f_data;
*/
/* ARGSUSED */
static int
-pipe_shutdown(struct file *fp, int how, struct thread *td)
+pipe_shutdown(struct file *fp, int how)
{
struct pipe *rpipe = (struct pipe *)fp->f_data;
struct pipe *wpipe;
*
* @(#)sys_socket.c 8.1 (Berkeley) 6/10/93
* $FreeBSD: src/sys/kern/sys_socket.c,v 1.28.2.2 2001/02/26 04:23:16 jlemon Exp $
- * $DragonFly: src/sys/kern/sys_socket.c,v 1.8 2005/07/13 01:38:50 dillon Exp $
+ * $DragonFly: src/sys/kern/sys_socket.c,v 1.9 2006/05/06 02:43:12 dillon Exp $
*/
#include <sys/param.h>
/* ARGSUSED */
int
-soo_read(struct file *fp, struct uio *uio, struct ucred *cred, int flags,
- struct thread *td)
+soo_read(struct file *fp, struct uio *uio, struct ucred *cred, int flags)
{
struct socket *so = (struct socket *)fp->f_data;
/* ARGSUSED */
int
-soo_write(struct file *fp, struct uio *uio, struct ucred *cred, int flags,
- struct thread *td)
+soo_write(struct file *fp, struct uio *uio, struct ucred *cred, int flags)
{
struct socket *so = (struct socket *)fp->f_data;
}
int
-soo_ioctl(struct file *fp, u_long cmd, caddr_t data, struct thread *td)
+soo_ioctl(struct file *fp, u_long cmd, caddr_t data, struct ucred *cred)
{
struct socket *so = (struct socket *)fp->f_data;
* different entry since a socket's unnecessary
*/
if (IOCGROUP(cmd) == 'i')
- return (ifioctl(so, cmd, data, td));
+ return (ifioctl(so, cmd, data, cred));
if (IOCGROUP(cmd) == 'r')
- return (rtioctl(cmd, data, td));
- return (so_pru_control(so, cmd, data, NULL, td));
+ return (rtioctl(cmd, data, cred));
+ return (so_pru_control(so, cmd, data, NULL));
}
int
-soo_poll(struct file *fp, int events, struct ucred *cred, struct thread *td)
+soo_poll(struct file *fp, int events, struct ucred *cred)
{
struct socket *so = (struct socket *)fp->f_data;
- return (so_pru_sopoll(so, events, cred, td));
+ return (so_pru_sopoll(so, events, cred));
}
int
-soo_stat(struct file *fp, struct stat *ub, struct thread *td)
+soo_stat(struct file *fp, struct stat *ub, struct ucred *cred)
{
struct socket *so = (struct socket *)fp->f_data;
/* ARGSUSED */
int
-soo_close(struct file *fp, struct thread *td)
+soo_close(struct file *fp)
{
int error = 0;
/* ARGSUSED */
int
-soo_shutdown(struct file *fp, int how, struct thread *td)
+soo_shutdown(struct file *fp, int how)
{
int error = 0;
*
* @(#)tty.c 8.8 (Berkeley) 1/21/94
* $FreeBSD: src/sys/kern/tty.c,v 1.129.2.5 2002/03/11 01:32:31 dd Exp $
- * $DragonFly: src/sys/kern/tty.c,v 1.22 2006/05/05 21:15:09 dillon Exp $
+ * $DragonFly: src/sys/kern/tty.c,v 1.23 2006/05/06 02:43:12 dillon Exp $
*/
/*-
ttyclosesession(struct session *sp, int dorele)
{
struct vnode *vp;
- struct thread *td = curthread;
if ((vp = sp->s_ttyvp) == NULL)
return;
if (vp->v_flag & VCTTYISOPEN) {
if (vn_lock(vp, LK_EXCLUSIVE|LK_RETRY) == 0) {
vclrflags(vp, VCTTYISOPEN);
- VOP_CLOSE(vp, FREAD|FWRITE, td);
+ VOP_CLOSE(vp, FREAD|FWRITE);
VOP_UNLOCK(vp, 0);
}
}
*
* @(#)tty_tty.c 8.2 (Berkeley) 9/23/93
* $FreeBSD: src/sys/kern/tty_tty.c,v 1.30 1999/09/25 18:24:24 phk Exp $
- * $DragonFly: src/sys/kern/tty_tty.c,v 1.14 2006/05/05 21:15:09 dillon Exp $
+ * $DragonFly: src/sys/kern/tty_tty.c,v 1.15 2006/05/06 02:43:12 dillon Exp $
*/
/*
} else {
vsetflags(ttyvp, VCTTYISOPEN);
vn_lock(ttyvp, LK_EXCLUSIVE | LK_RETRY);
- error = VOP_OPEN(ttyvp, FREAD|FWRITE, NOCRED, NULL, td);
+ error = VOP_OPEN(ttyvp, FREAD|FWRITE, NOCRED, NULL);
if (error)
vclrflags(ttyvp, VCTTYISOPEN);
VOP_UNLOCK(ttyvp, 0);
vclrflags(ttyvp, VCTTYISOPEN);
error = vn_lock(ttyvp, LK_EXCLUSIVE | LK_RETRY);
if (error == 0) {
- error = VOP_CLOSE(ttyvp, FREAD|FWRITE, td);
+ error = VOP_CLOSE(ttyvp, FREAD|FWRITE);
VOP_UNLOCK(ttyvp, 0);
}
} else {
ttyvp = cttyvp(p);
if (ttyvp == NULL)
return (EIO);
- if ((error = vget(ttyvp, LK_EXCLUSIVE | LK_RETRY, td)) == 0) {
+ if ((error = vget(ttyvp, LK_EXCLUSIVE | LK_RETRY)) == 0) {
error = VOP_READ(ttyvp, uio, flag, NOCRED);
vput(ttyvp);
}
ttyvp = cttyvp(p);
if (ttyvp == NULL)
return (EIO);
- if ((error = vget(ttyvp, LK_EXCLUSIVE | LK_RETRY, td)) == 0) {
+ if ((error = vget(ttyvp, LK_EXCLUSIVE | LK_RETRY)) == 0) {
error = VOP_WRITE(ttyvp, uio, flag, NOCRED);
vput(ttyvp);
}
} else
return (EINVAL);
}
- return (VOP_IOCTL(ttyvp, cmd, addr, flag, NOCRED, td));
+ return (VOP_IOCTL(ttyvp, cmd, addr, flag, NOCRED));
}
/*ARGSUSED*/
if (ttyvp == NULL)
/* try operation to get EOF/failure */
return (seltrue(dev, events, td));
- return (VOP_POLL(ttyvp, events, p->p_ucred, td));
+ return (VOP_POLL(ttyvp, events, p->p_ucred));
}
static void ctty_drvinit (void *unused);
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $DragonFly: src/sys/kern/uipc_msg.c,v 1.13 2004/07/08 22:07:34 hsu Exp $
+ * $DragonFly: src/sys/kern/uipc_msg.c,v 1.14 2006/05/06 02:43:12 dillon Exp $
*/
/*
}
int
-so_pru_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
- struct thread *td)
+so_pru_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp)
{
return ((*so->so_proto->pr_usrreqs->pru_control)(so, cmd, data, ifp,
- td));
+ curthread));
#ifdef gag /* does copyin and copyout deep inside stack XXX JH */
int error;
struct netmsg_pru_control msg;
}
int
-so_pru_sopoll(struct socket *so, int events, struct ucred *cred,
- struct thread *td)
+so_pru_sopoll(struct socket *so, int events, struct ucred *cred)
{
int error;
struct netmsg_pru_sopoll msg;
msg.nm_so = so;
msg.nm_events = events;
msg.nm_cred = cred;
- msg.nm_td = td;
+ msg.nm_td = curthread;
error = lwkt_domsg(port, &msg.nm_lmsg);
return (error);
}
*
* @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93
* $FreeBSD: src/sys/kern/uipc_socket2.c,v 1.55.2.17 2002/08/31 19:04:55 dwmalone Exp $
- * $DragonFly: src/sys/kern/uipc_socket2.c,v 1.22 2005/07/23 07:28:34 dillon Exp $
+ * $DragonFly: src/sys/kern/uipc_socket2.c,v 1.23 2006/05/06 02:43:12 dillon Exp $
*/
#include "opt_param.h"
if (head->so_qlen > 3 * head->so_qlimit / 2)
return ((struct socket *)0);
- so = soalloc(0);
+ so = soalloc(1);
if (so == NULL)
- return ((struct socket *)0);
+ return (NULL);
if ((head->so_options & SO_ACCEPTFILTER) != 0)
connstatus = 0;
so->so_head = head;
*
* @(#)uipc_syscalls.c 8.4 (Berkeley) 2/21/94
* $FreeBSD: src/sys/kern/uipc_syscalls.c,v 1.65.2.17 2003/04/04 17:11:16 tegge Exp $
- * $DragonFly: src/sys/kern/uipc_syscalls.c,v 1.63 2006/05/05 21:15:09 dillon Exp $
+ * $DragonFly: src/sys/kern/uipc_syscalls.c,v 1.64 2006/05/06 02:43:12 dillon Exp $
*/
#include "opt_ktrace.h"
nfp->f_data = so;
/* Sync socket nonblocking/async state with file flags */
tmp = fflag & FNONBLOCK;
- (void) fo_ioctl(nfp, FIONBIO, (caddr_t)&tmp, td);
+ (void) fo_ioctl(nfp, FIONBIO, (caddr_t)&tmp, p->p_ucred);
tmp = fflag & FASYNC;
- (void) fo_ioctl(nfp, FIOASYNC, (caddr_t)&tmp, td);
+ (void) fo_ioctl(nfp, FIOASYNC, (caddr_t)&tmp, p->p_ucred);
sa = NULL;
error = soaccept(so, &sa);
*
* From: @(#)uipc_usrreq.c 8.3 (Berkeley) 1/4/94
* $FreeBSD: src/sys/kern/uipc_usrreq.c,v 1.54.2.10 2003/03/04 17:28:09 nectar Exp $
- * $DragonFly: src/sys/kern/uipc_usrreq.c,v 1.23 2006/05/05 21:15:09 dillon Exp $
+ * $DragonFly: src/sys/kern/uipc_usrreq.c,v 1.24 2006/05/06 02:43:12 dillon Exp $
*/
#include <sys/param.h>
error = ENOTSOCK;
goto bad;
}
- error = VOP_ACCESS(vp, VWRITE, p->p_ucred, td);
+ error = VOP_ACCESS(vp, VWRITE, p->p_ucred);
if (error)
goto bad;
so2 = vp->v_socket;
* of the author. This software is distributed AS-IS.
*
* $FreeBSD: src/sys/kern/vfs_aio.c,v 1.70.2.28 2003/05/29 06:15:35 alc Exp $
- * $DragonFly: src/sys/kern/vfs_aio.c,v 1.25 2006/04/30 20:23:24 dillon Exp $
+ * $DragonFly: src/sys/kern/vfs_aio.c,v 1.26 2006/05/06 02:43:12 dillon Exp $
*/
/*
*/
if (cb->aio_lio_opcode == LIO_READ) {
auio.uio_rw = UIO_READ;
- error = fo_read(fp, &auio, fp->f_cred, FOF_OFFSET, mytd);
+ error = fo_read(fp, &auio, fp->f_cred, FOF_OFFSET);
} else {
auio.uio_rw = UIO_WRITE;
- error = fo_write(fp, &auio, fp->f_cred, FOF_OFFSET, mytd);
+ error = fo_write(fp, &auio, fp->f_cred, FOF_OFFSET);
}
inblock_end = mytd->td_proc->p_stats->p_ru.ru_inblock;
oublock_end = mytd->td_proc->p_stats->p_ru.ru_oublock;
*
* @(#)vfs_cache.c 8.5 (Berkeley) 3/22/95
* $FreeBSD: src/sys/kern/vfs_cache.c,v 1.42.2.6 2001/10/05 20:07:03 dillon Exp $
- * $DragonFly: src/sys/kern/vfs_cache.c,v 1.66 2006/05/05 21:27:53 dillon Exp $
+ * $DragonFly: src/sys/kern/vfs_cache.c,v 1.67 2006/05/06 02:43:12 dillon Exp $
*/
#include <sys/param.h>
cache_unlock(ncp);
goto again;
}
- error = vget(vp, lk_type, curthread);
+ error = vget(vp, lk_type);
if (error) {
if (vp != ncp->nc_vp)
goto again;
int error;
vat.va_blocksize = 0;
- if ((error = VOP_GETATTR(dvp, &vat, curthread)) != 0)
+ if ((error = VOP_GETATTR(dvp, &vat)) != 0)
return (error);
if ((error = cache_vget(ncp, cred, LK_SHARED, &pvp)) != 0)
return (error);
*
*
* $FreeBSD: src/sys/kern/vfs_default.c,v 1.28.2.7 2003/01/10 18:23:26 bde Exp $
- * $DragonFly: src/sys/kern/vfs_default.c,v 1.38 2006/05/05 21:15:09 dillon Exp $
+ * $DragonFly: src/sys/kern/vfs_default.c,v 1.39 2006/05/06 02:43:12 dillon Exp $
*/
#include <sys/param.h>
* variable, in the directory inode. That needs to be fixed and the
* other VFS's audited before we can switch to LK_SHARED.
*/
- if ((error = vget(dvp, LK_EXCLUSIVE, curthread)) != 0) {
+ if ((error = vget(dvp, LK_EXCLUSIVE)) != 0) {
printf("[diagnostic] vop_compat_resolve: EAGAIN on ncp %p %s\n",
ncp, ncp->nc_name);
return(EAGAIN);
* other VFS's audited before we can switch to LK_SHARED.
*/
*ap->a_vpp = NULL;
- if ((error = vget(ap->a_dvp, LK_EXCLUSIVE, curthread)) != 0)
+ if ((error = vget(ap->a_dvp, LK_EXCLUSIVE)) != 0)
return (error);
if (ap->a_dvp->v_type != VDIR) {
vput(ap->a_dvp);
if ((dvp = ncp->nc_parent->nc_vp) == NULL)
return(EPERM);
- if ((error = vget(dvp, LK_EXCLUSIVE, td)) != 0) {
+ if ((error = vget(dvp, LK_EXCLUSIVE)) != 0) {
printf("[diagnostic] vop_compat_resolve: EAGAIN on ncp %p %s\n",
ncp, ncp->nc_name);
return(EAGAIN);
if ((dvp = ncp->nc_parent->nc_vp) == NULL)
return(EPERM);
- if ((error = vget(dvp, LK_EXCLUSIVE, td)) != 0) {
+ if ((error = vget(dvp, LK_EXCLUSIVE)) != 0) {
printf("[diagnostic] vop_compat_resolve: EAGAIN on ncp %p %s\n",
ncp, ncp->nc_name);
return(EAGAIN);
if ((dvp = ncp->nc_parent->nc_vp) == NULL)
return(EPERM);
- if ((error = vget(dvp, LK_EXCLUSIVE, td)) != 0) {
+ if ((error = vget(dvp, LK_EXCLUSIVE)) != 0) {
printf("[diagnostic] vop_compat_resolve: EAGAIN on ncp %p %s\n",
ncp, ncp->nc_name);
return(EAGAIN);
if ((dvp = ncp->nc_parent->nc_vp) == NULL)
return(EPERM);
- if ((error = vget(dvp, LK_EXCLUSIVE, td)) != 0) {
+ if ((error = vget(dvp, LK_EXCLUSIVE)) != 0) {
printf("[diagnostic] vop_compat_resolve: EAGAIN on ncp %p %s\n",
ncp, ncp->nc_name);
return(EAGAIN);
if ((dvp = ncp->nc_parent->nc_vp) == NULL)
return(EPERM);
- if ((error = vget(dvp, LK_EXCLUSIVE, td)) != 0) {
+ if ((error = vget(dvp, LK_EXCLUSIVE)) != 0) {
printf("[diagnostic] vop_compat_resolve: EAGAIN on ncp %p %s\n",
ncp, ncp->nc_name);
return(EAGAIN);
if ((dvp = ncp->nc_parent->nc_vp) == NULL)
return(EPERM);
- if ((error = vget(dvp, LK_EXCLUSIVE, td)) != 0) {
+ if ((error = vget(dvp, LK_EXCLUSIVE)) != 0) {
printf("[diagnostic] vop_compat_resolve: EAGAIN on ncp %p %s\n",
ncp, ncp->nc_name);
return(EAGAIN);
if ((dvp = ncp->nc_parent->nc_vp) == NULL)
return(EPERM);
- if ((error = vget(dvp, LK_EXCLUSIVE, td)) != 0) {
+ if ((error = vget(dvp, LK_EXCLUSIVE)) != 0) {
printf("[diagnostic] vop_compat_resolve: EAGAIN on ncp %p %s\n",
ncp, ncp->nc_name);
return(EAGAIN);
if ((dvp = ncp->nc_parent->nc_vp) == NULL)
return(EPERM);
- if ((error = vget(dvp, LK_EXCLUSIVE, td)) != 0) {
+ if ((error = vget(dvp, LK_EXCLUSIVE)) != 0) {
printf("[diagnostic] vop_compat_resolve: EAGAIN on ncp %p %s\n",
ncp, ncp->nc_name);
return(EAGAIN);
* the source, it is believed that the only side effect that matters
* is the permissions check.
*/
- if ((error = vget(fdvp, LK_EXCLUSIVE, td)) != 0) {
+ if ((error = vget(fdvp, LK_EXCLUSIVE)) != 0) {
printf("[diagnostic] vop_compat_resolve: EAGAIN on ncp %p %s\n",
fncp, fncp->nc_name);
return(EAGAIN);
vrele(fvp);
return (error);
}
- if ((error = vget(tdvp, LK_EXCLUSIVE, td)) != 0) {
+ if ((error = vget(tdvp, LK_EXCLUSIVE)) != 0) {
printf("[diagnostic] vop_compat_resolve: EAGAIN on ncp %p %s\n",
tncp, tncp->nc_name);
vrele(fdvp);
struct vnode *a_vp;
int a_events;
struct ucred *a_cred;
- struct thread *a_td;
} */ *ap;
{
if (ap->a_events & ~POLLSTANDARD)
- return (vn_pollrecord(ap->a_vp, ap->a_td, ap->a_events));
+ return (vn_pollrecord(ap->a_vp, ap->a_events));
return (ap->a_events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM));
}
}
int
-vfs_stdsync(struct mount *mp, int waitfor, struct thread *td)
+vfs_stdsync(struct mount *mp, int waitfor)
{
return (0);
}
int
-vfs_stdnosync(struct mount *mp, int waitfor, struct thread *td)
+vfs_stdnosync(struct mount *mp, int waitfor)
{
return (EOPNOTSUPP);
}
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $DragonFly: src/sys/kern/vfs_jops.c,v 1.23 2005/09/17 07:43:00 dillon Exp $
+ * $DragonFly: src/sys/kern/vfs_jops.c,v 1.24 2006/05/06 02:43:12 dillon Exp $
*/
/*
* Each mount point may have zero or more independantly configured journals
error = 0;
if (jrflags & JRUNDO_GETVP)
- error = vget(vp, LK_SHARED, curthread);
+ error = vget(vp, LK_SHARED);
if (error == 0) {
TAILQ_FOREACH(jrec, jreclist, user_entry) {
if (jrec->jo->flags & MC_JOURNAL_WANT_REVERSABLE) {
while (bytes) {
n = (bytes > bufsize) ? bufsize : (int)bytes;
error = vn_rdwr(UIO_READ, vp, buf, n, off, UIO_SYSSPACE, IO_NODELOCKED,
- proc0.p_ucred, NULL, curthread);
+ proc0.p_ucred, NULL);
if (error) {
jrecord_leaf(jrec, JLEAF_ERROR, &error, sizeof(error));
break;
* and retrieve attribute info.
*/
save1 = jrecord_push(jrec, JTYPE_UNDO);
- error = VOP_GETATTR(vp, &attr, curthread);
+ error = VOP_GETATTR(vp, &attr);
if (error)
goto done;
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
TAILQ_FOREACH(jrec, &jreclist, user_entry) {
- jrecord_write_cred(jrec, ap->a_td, ap->a_cred);
+ jrecord_write_cred(jrec, curthread, ap->a_cred);
jrecord_write_vnode_ref(jrec, ap->a_vp);
save = jrecord_push(jrec, JTYPE_REDO);
jrecord_write_vattr(jrec, ap->a_vap);
if ((jo->flags & MC_JOURNAL_WANT_REVERSABLE))
jrecord_undo_file(jrec, ap->a_vp, JRUNDO_XXX, 0, 0);
#endif
- jrecord_write_cred(jrec, ap->a_td, ap->a_cred);
+ jrecord_write_cred(jrec, curthread, ap->a_cred);
jrecord_write_vnode_ref(jrec, ap->a_vp);
#if 0
save = jrecord_push(jrec, JTYPE_REDO);
if ((jo->flags & MC_JOURNAL_WANT_REVERSABLE))
jrecord_undo_file(jrec, ap->a_vp, JRUNDO_XXX, 0, 0);
#endif
- jrecord_write_cred(jrec, ap->a_td, ap->a_cred);
+ jrecord_write_cred(jrec, curthread, ap->a_cred);
jrecord_write_vnode_ref(jrec, ap->a_vp);
jrecord_leaf(jrec, JLEAF_ATTRNAME, ap->a_name, strlen(ap->a_name));
save = jrecord_push(jrec, JTYPE_REDO);
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $DragonFly: src/sys/kern/vfs_journal.c,v 1.23 2005/09/17 07:43:00 dillon Exp $
+ * $DragonFly: src/sys/kern/vfs_journal.c,v 1.24 2006/05/06 02:43:12 dillon Exp $
*/
/*
* Each mount point may have zero or more independantly configured journals
error = 0;
if (jrflags & JRUNDO_GETVP)
- error = vget(vp, LK_SHARED, curthread);
+ error = vget(vp, LK_SHARED);
if (error == 0) {
TAILQ_FOREACH(jrec, jreclist, user_entry) {
if (jrec->jo->flags & MC_JOURNAL_WANT_REVERSABLE) {
while (bytes) {
n = (bytes > bufsize) ? bufsize : (int)bytes;
error = vn_rdwr(UIO_READ, vp, buf, n, off, UIO_SYSSPACE, IO_NODELOCKED,
- proc0.p_ucred, NULL, curthread);
+ proc0.p_ucred, NULL);
if (error) {
jrecord_leaf(jrec, JLEAF_ERROR, &error, sizeof(error));
break;
* and retrieve attribute info.
*/
save1 = jrecord_push(jrec, JTYPE_UNDO);
- error = VOP_GETATTR(vp, &attr, curthread);
+ error = VOP_GETATTR(vp, &attr);
if (error)
goto done;
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
TAILQ_FOREACH(jrec, &jreclist, user_entry) {
- jrecord_write_cred(jrec, ap->a_td, ap->a_cred);
+ jrecord_write_cred(jrec, curthread, ap->a_cred);
jrecord_write_vnode_ref(jrec, ap->a_vp);
save = jrecord_push(jrec, JTYPE_REDO);
jrecord_write_vattr(jrec, ap->a_vap);
if ((jo->flags & MC_JOURNAL_WANT_REVERSABLE))
jrecord_undo_file(jrec, ap->a_vp, JRUNDO_XXX, 0, 0);
#endif
- jrecord_write_cred(jrec, ap->a_td, ap->a_cred);
+ jrecord_write_cred(jrec, curthread, ap->a_cred);
jrecord_write_vnode_ref(jrec, ap->a_vp);
#if 0
save = jrecord_push(jrec, JTYPE_REDO);
if ((jo->flags & MC_JOURNAL_WANT_REVERSABLE))
jrecord_undo_file(jrec, ap->a_vp, JRUNDO_XXX, 0, 0);
#endif
- jrecord_write_cred(jrec, ap->a_td, ap->a_cred);
+ jrecord_write_cred(jrec, curthread, ap->a_cred);
jrecord_write_vnode_ref(jrec, ap->a_vp);
jrecord_leaf(jrec, JLEAF_ATTRNAME, ap->a_name, strlen(ap->a_name));
save = jrecord_push(jrec, JTYPE_REDO);
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $DragonFly: src/sys/kern/vfs_lock.c,v 1.16 2006/05/05 21:15:09 dillon Exp $
+ * $DragonFly: src/sys/kern/vfs_lock.c,v 1.17 2006/05/06 02:43:12 dillon Exp $
*/
/*
void
vrele(struct vnode *vp)
{
- thread_t td = curthread;
-
crit_enter();
if (vp->v_usecount == 1) {
KASSERT(lockcountnb(&vp->v_lock) == 0, ("last vrele vp %p still locked", vp));
if ((vp->v_flag & VINACTIVE) == 0 &&
vp->v_usecount == 1) {
vp->v_flag |= VINACTIVE;
- VOP_INACTIVE(vp, td);
+ VOP_INACTIVE(vp);
}
vx_unlock(vp);
}
* VX lock after the normal unlock. XXX make it more efficient.
*/
int
-vget(struct vnode *vp, int flags, thread_t td)
+vget(struct vnode *vp, int flags)
{
int error;
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $DragonFly: src/sys/kern/vfs_mount.c,v 1.16 2006/05/05 21:27:53 dillon Exp $
+ * $DragonFly: src/sys/kern/vfs_mount.c,v 1.17 2006/05/06 02:43:12 dillon Exp $
*/
/*
if (vp->v_object && vp->v_object->resident_page_count >= page_count)
return (0);
if (vp->v_holdcnt && visleaf(vp)) {
- vinvalbuf(vp, V_SAVE, NULL, 0, 0);
+ vinvalbuf(vp, V_SAVE, 0, 0);
#if 0 /* DEBUG */
printf((vp->v_holdcnt ? "vrecycle: vp %p failed: %s\n" :
"vrecycle: vp %p succeeded: %s\n"), vp,
switch(flags) {
case VMSC_GETVP:
- error = vget(vp, LK_EXCLUSIVE, curthread);
+ error = vget(vp, LK_EXCLUSIVE);
break;
case VMSC_GETVP|VMSC_NOWAIT:
- error = vget(vp, LK_EXCLUSIVE|LK_NOWAIT,
- curthread);
+ error = vget(vp, LK_EXCLUSIVE|LK_NOWAIT);
break;
case VMSC_GETVX:
error = vx_get(vp);
*/
if ((info->flags & WRITECLOSE) &&
(vp->v_type == VNON ||
- (VOP_GETATTR(vp, &vattr, info->td) == 0 &&
+ (VOP_GETATTR(vp, &vattr) == 0 &&
vattr.va_nlink > 0)) &&
(vp->v_writecount == 0 || vp->v_type != VREG)) {
return(0);
if (vp->v_type != VBLK && vp->v_type != VCHR) {
vgone(vp);
} else {
- vclean(vp, 0, info->td);
+ vclean(vp, 0);
vp->v_ops = &spec_vnode_vops;
insmntque(vp, NULL);
}
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $DragonFly: src/sys/kern/vfs_nlookup.c,v 1.14 2006/05/05 21:27:53 dillon Exp $
+ * $DragonFly: src/sys/kern/vfs_nlookup.c,v 1.15 2006/05/06 02:43:12 dillon Exp $
*/
/*
* nlookup() is the 'new' namei interface. Rather then return directory and
VOP_UNLOCK(nd->nl_open_vp, 0);
nd->nl_flags &= ~NLC_LOCKVP;
}
- vn_close(nd->nl_open_vp, nd->nl_vp_fmode, nd->nl_td);
+ vn_close(nd->nl_open_vp, nd->nl_vp_fmode);
nd->nl_open_vp = NULL;
}
nd->nl_flags = 0; /* clear remaining flags (just clear everything) */
error = 0;
} else if (error == 0) {
/* XXX cache the va in the namecache or in the vnode */
- if ((error = VOP_GETATTR(vp, &va, curthread)) == 0) {
+ if ((error = VOP_GETATTR(vp, &va)) == 0) {
if ((vmode & VWRITE) && vp->v_mount) {
if (vp->v_mount->mnt_flag & MNT_RDONLY)
error = EROFS;
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
* $FreeBSD: src/sys/kern/vfs_subr.c,v 1.249.2.30 2003/04/04 20:35:57 tegge Exp $
- * $DragonFly: src/sys/kern/vfs_subr.c,v 1.82 2006/05/05 21:15:09 dillon Exp $
+ * $DragonFly: src/sys/kern/vfs_subr.c,v 1.83 2006/05/06 02:43:12 dillon Exp $
*/
/*
}
int
-vinvalbuf(struct vnode *vp, int flags, struct thread *td,
- int slpflag, int slptimeo)
+vinvalbuf(struct vnode *vp, int flags, int slpflag, int slptimeo)
{
struct vinvalbuf_bp_info info;
int error;
}
if (!RB_EMPTY(&vp->v_rbdirty_tree)) {
crit_exit();
- if ((error = VOP_FSYNC(vp, MNT_WAIT, td)) != 0)
+ if ((error = VOP_FSYNC(vp, MNT_WAIT)) != 0)
return (error);
crit_enter();
if (vp->v_track_write.bk_active > 0 ||
static int vtruncbuf_bp_metasync(struct buf *bp, void *data);
int
-vtruncbuf(struct vnode *vp, struct thread *td, off_t length, int blksize)
+vtruncbuf(struct vnode *vp, off_t length, int blksize)
{
off_t truncloffset;
int count;
* to VOP_CLOSE the vnode before we can deactivate and reclaim it.
*/
void
-vclean(struct vnode *vp, int flags, struct thread *td)
+vclean(struct vnode *vp, int flags)
{
int active;
int n;
* Clean out any buffers associated with the vnode and destroy its
* object, if it has one.
*/
- vinvalbuf(vp, V_SAVE, td, 0, 0);
+ vinvalbuf(vp, V_SAVE, 0, 0);
if ((object = vp->v_object) != NULL) {
if (object->ref_count == 0) {
if (active && (flags & DOCLOSE)) {
while ((n = vp->v_opencount) != 0) {
if (vp->v_writecount)
- VOP_CLOSE(vp, FWRITE|FNONBLOCK, td);
+ VOP_CLOSE(vp, FWRITE|FNONBLOCK);
else
- VOP_CLOSE(vp, FNONBLOCK, td);
+ VOP_CLOSE(vp, FNONBLOCK);
if (vp->v_opencount == n) {
printf("Warning: unable to force-close"
" vnode %p\n", vp);
*/
if ((vp->v_flag & VINACTIVE) == 0) {
vp->v_flag |= VINACTIVE;
- VOP_INACTIVE(vp, td);
+ VOP_INACTIVE(vp);
}
/*
* Reclaim the vnode.
*/
- if (VOP_RECLAIM(vp, td))
+ if (VOP_RECLAIM(vp))
panic("vclean: cannot reclaim");
/*
* 0 otherwise.
*/
int
-vrecycle(struct vnode *vp, struct thread *td)
+vrecycle(struct vnode *vp)
{
if (vp->v_usecount == 1) {
vgone(vp);
* Clean out the filesystem specific data and set the VRECLAIMED
* bit. Also deactivate the vnode if necessary.
*/
- vclean(vp, DOCLOSE, curthread);
+ vclean(vp, DOCLOSE);
/*
* Delete from old mount point vnode list, if on one.
* to avoid race conditions.)
*/
int
-vn_pollrecord(struct vnode *vp, struct thread *td, int events)
+vn_pollrecord(struct vnode *vp, int events)
{
lwkt_tokref ilock;
+ KKASSERT(curthread->td_proc != NULL);
+
lwkt_gettoken(&ilock, &vp->v_pollinfo.vpi_token);
if (vp->v_pollinfo.vpi_revents & events) {
/*
return events;
}
vp->v_pollinfo.vpi_events |= events;
- selrecord(td, &vp->v_pollinfo.vpi_selinfo);
+ selrecord(curthread, &vp->v_pollinfo.vpi_selinfo);
lwkt_reltoken(&ilock);
return 0;
}
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
* $FreeBSD: src/sys/kern/vfs_subr.c,v 1.249.2.30 2003/04/04 20:35:57 tegge Exp $
- * $DragonFly: src/sys/kern/vfs_sync.c,v 1.9 2006/05/05 21:27:53 dillon Exp $
+ * $DragonFly: src/sys/kern/vfs_sync.c,v 1.10 2006/05/06 02:43:12 dillon Exp $
*/
/*
crit_exit();
while ((vp = LIST_FIRST(slp)) != NULL) {
- if (vget(vp, LK_EXCLUSIVE | LK_NOWAIT, td) == 0) {
- VOP_FSYNC(vp, MNT_LAZY, td);
+ if (vget(vp, LK_EXCLUSIVE | LK_NOWAIT) == 0) {
+ VOP_FSYNC(vp, MNT_LAZY);
vput(vp);
}
crit_enter();
{
struct vnode *syncvp = ap->a_vp;
struct mount *mp = syncvp->v_mount;
- struct thread *td = ap->a_td;
int asyncflag;
/*
asyncflag = mp->mnt_flag & MNT_ASYNC;
mp->mnt_flag &= ~MNT_ASYNC; /* ZZZ hack */
vfs_msync(mp, MNT_NOWAIT);
- VFS_SYNC(mp, MNT_LAZY, td);
+ VFS_SYNC(mp, MNT_LAZY);
if (asyncflag)
mp->mnt_flag |= MNT_ASYNC;
}
*
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
* $FreeBSD: src/sys/kern/vfs_syscalls.c,v 1.151.2.18 2003/04/04 20:35:58 tegge Exp $
- * $DragonFly: src/sys/kern/vfs_syscalls.c,v 1.85 2006/05/05 21:27:53 dillon Exp $
+ * $DragonFly: src/sys/kern/vfs_syscalls.c,v 1.86 2006/05/06 02:43:12 dillon Exp $
*/
#include <sys/param.h>
* now we have the locked ref'd ncp and unreferenced vnode.
*/
vp = ncp->nc_vp;
- if ((error = vget(vp, LK_EXCLUSIVE, td)) != 0) {
+ if ((error = vget(vp, LK_EXCLUSIVE)) != 0) {
cache_put(ncp);
return (error);
}
* If the user is not root, ensure that they own the directory
* onto which we are attempting to mount.
*/
- if ((error = VOP_GETATTR(vp, &va, td)) ||
+ if ((error = VOP_GETATTR(vp, &va)) ||
(va.va_uid != p->p_ucred->cr_uid &&
(error = suser(td)))) {
cache_drop(ncp);
vput(vp);
return (error);
}
- if ((error = vinvalbuf(vp, V_SAVE, td, 0, 0)) != 0) {
+ if ((error = vinvalbuf(vp, V_SAVE, 0, 0)) != 0) {
cache_drop(ncp);
vput(vp);
return (error);
if (mp->mnt_syncer != NULL)
vrele(mp->mnt_syncer);
if (((mp->mnt_flag & MNT_RDONLY) ||
- (error = VFS_SYNC(mp, MNT_WAIT, td)) == 0) ||
+ (error = VFS_SYNC(mp, MNT_WAIT)) == 0) ||
(flags & MNT_FORCE))
error = VFS_UNMOUNT(mp, flags, td);
if (error) {
asyncflag = mp->mnt_flag & MNT_ASYNC;
mp->mnt_flag &= ~MNT_ASYNC;
vfs_msync(mp, MNT_NOWAIT);
- VFS_SYNC(mp, MNT_NOWAIT, curthread);
+ VFS_SYNC(mp, MNT_NOWAIT);
mp->mnt_flag |= asyncflag;
}
return(0);
if (vp->v_type != VDIR || fp->f_ncp == NULL)
error = ENOTDIR;
else
- error = VOP_ACCESS(vp, VEXEC, p->p_ucred, td);
+ error = VOP_ACCESS(vp, VEXEC, p->p_ucred);
if (error) {
vput(vp);
return (error);
cache_unlock(nct); /* leave ref intact */
vput(vp);
vp = nct->nc_vp;
- error = vget(vp, LK_SHARED, td);
+ error = vget(vp, LK_SHARED);
KKASSERT(error == 0);
cache_drop(ncp);
ncp = nct;
return (error);
if ((vp = nd->nl_ncp->nc_vp) == NULL)
return (ENOENT);
- if ((error = vget(vp, LK_SHARED, td)) != 0)
+ if ((error = vget(vp, LK_SHARED)) != 0)
return (error);
error = checkvp_chdir(vp, td);
if ((vp = ncp->nc_vp) == NULL)
return (ENOENT);
- if ((error = vget(vp, LK_SHARED, td)) != 0)
+ if ((error = vget(vp, LK_SHARED)) != 0)
return (error);
/*
if (vp->v_type != VDIR)
error = ENOTDIR;
else
- error = VOP_ACCESS(vp, VEXEC, td->td_proc->p_ucred, td);
+ error = VOP_ACCESS(vp, VEXEC, td->td_proc->p_ucred);
return (error);
}
KASSERT(fdp->fd_files[indx].fp != fp,
("Open file descriptor lost all refs"));
vrele(vp);
- fo_close(fp, td);
+ fo_close(fp);
fdrop(fp, td);
*res = indx;
return 0;
* same user or group. Note that any group is allowed if
* the file is owned by the caller.
*/
- error = VOP_GETATTR(vp, &va, td);
+ error = VOP_GETATTR(vp, &va);
if (error != 0)
return (error);
KKASSERT(vp != NULL);
if (vp->v_type == VDIR)
return (EPERM); /* POSIX */
- if ((error = vget(vp, LK_EXCLUSIVE, td)) != 0)
+ if ((error = vget(vp, LK_EXCLUSIVE)) != 0)
return (error);
/*
fp->f_offset += offset;
break;
case L_XTND:
- error=VOP_GETATTR((struct vnode *)fp->f_data, &vattr, td);
+ error=VOP_GETATTR((struct vnode *)fp->f_data, &vattr);
if (error)
return (error);
fp->f_offset = offset + vattr.va_size;
int
kern_access(struct nlookupdata *nd, int aflags)
{
- struct thread *td = curthread;
struct vnode *vp;
int error, flags;
if (aflags & X_OK)
flags |= VEXEC;
if ((flags & VWRITE) == 0 || (error = vn_writechk(vp)) == 0)
- error = VOP_ACCESS(vp, flags, nd->nl_cred, td);
+ error = VOP_ACCESS(vp, flags, nd->nl_cred);
/*
* If the file handle is stale we have to re-resolve the
return (ENOENT);
td = curthread;
- if ((error = vget(vp, LK_SHARED, td)) != 0)
+ if ((error = vget(vp, LK_SHARED)) != 0)
return (error);
- error = vn_stat(vp, st, td);
+ error = vn_stat(vp, st, nd->nl_cred);
/*
* If the file handle is stale we have to re-resolve the entry. This
* note: vget is required for any operation that might mod the vnode
* so VINACTIVE is properly cleared.
*/
- if ((error = vget(vp, LK_EXCLUSIVE, td)) == 0) {
+ if ((error = vget(vp, LK_EXCLUSIVE)) == 0) {
VATTR_NULL(&vattr);
vattr.va_flags = flags;
- error = VOP_SETATTR(vp, &vattr, p->p_ucred, td);
+ error = VOP_SETATTR(vp, &vattr, p->p_ucred);
vput(vp);
}
return (error);
* note: vget is required for any operation that might mod the vnode
* so VINACTIVE is properly cleared.
*/
- if ((error = vget(vp, LK_EXCLUSIVE, td)) == 0) {
+ if ((error = vget(vp, LK_EXCLUSIVE)) == 0) {
VATTR_NULL(&vattr);
vattr.va_mode = mode & ALLPERMS;
- error = VOP_SETATTR(vp, &vattr, p->p_ucred, td);
+ error = VOP_SETATTR(vp, &vattr, p->p_ucred);
vput(vp);
}
return error;
* note: vget is required for any operation that might mod the vnode
* so VINACTIVE is properly cleared.
*/
- if ((error = vget(vp, LK_EXCLUSIVE, td)) == 0) {
+ if ((error = vget(vp, LK_EXCLUSIVE)) == 0) {
VATTR_NULL(&vattr);
vattr.va_uid = uid;
vattr.va_gid = gid;
- error = VOP_SETATTR(vp, &vattr, p->p_ucred, td);
+ error = VOP_SETATTR(vp, &vattr, p->p_ucred);
vput(vp);
}
return error;
* note: vget is required for any operation that might mod the vnode
* so VINACTIVE is properly cleared.
*/
- if ((error = vget(vp, LK_EXCLUSIVE, td)) == 0) {
+ if ((error = vget(vp, LK_EXCLUSIVE)) == 0) {
VATTR_NULL(&vattr);
vattr.va_atime = ts[0];
vattr.va_mtime = ts[1];
if (nullflag)
vattr.va_vaflags |= VA_UTIMES_NULL;
- error = VOP_SETATTR(vp, &vattr, p->p_ucred, td);
+ error = VOP_SETATTR(vp, &vattr, p->p_ucred);
vput(vp);
}
return error;
if (vp->v_type == VDIR) {
error = EISDIR;
} else if ((error = vn_writechk(vp)) == 0 &&
- (error = VOP_ACCESS(vp, VWRITE, nd->nl_cred, nd->nl_td)) == 0) {
+ (error = VOP_ACCESS(vp, VWRITE, nd->nl_cred)) == 0) {
VATTR_NULL(&vattr);
vattr.va_size = length;
- error = VOP_SETATTR(vp, &vattr, nd->nl_cred, nd->nl_td);
+ error = VOP_SETATTR(vp, &vattr, nd->nl_cred);
}
vput(vp);
return (error);
else if ((error = vn_writechk(vp)) == 0) {
VATTR_NULL(&vattr);
vattr.va_size = length;
- error = VOP_SETATTR(vp, &vattr, fp->f_cred, td);
+ error = VOP_SETATTR(vp, &vattr, fp->f_cred);
}
VOP_UNLOCK(vp, 0);
return (error);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
if ((obj = vp->v_object) != NULL)
vm_object_page_clean(obj, 0, 0, 0);
- if ((error = VOP_FSYNC(vp, MNT_WAIT, td)) == 0 &&
+ if ((error = VOP_FSYNC(vp, MNT_WAIT)) == 0 &&
vp->v_mount && (vp->v_mount->mnt_flag & MNT_SOFTDEP) &&
bioops.io_fsync)
error = (*bioops.io_fsync)(vp);
int
revoke(struct revoke_args *uap)
{
- struct thread *td = curthread;
struct nlookupdata nd;
struct vattr vattr;
struct vnode *vp;
if (vp->v_type != VCHR && vp->v_type != VBLK)
error = EINVAL;
if (error == 0)
- error = VOP_GETATTR(vp, &vattr, td);
+ error = VOP_GETATTR(vp, &vattr);
if (error == 0 && cred->cr_uid != vattr.va_uid)
error = suser_cred(cred, PRISON_ROOT);
if (error == 0 && count_udev(vp->v_udev) > 0) {
if (fmode & FREAD)
mode |= VREAD;
if (mode) {
- error = VOP_ACCESS(vp, mode, p->p_ucred, td);
+ error = VOP_ACCESS(vp, mode, p->p_ucred);
if (error)
goto bad;
}
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); /* XXX */
VATTR_NULL(vap);
vap->va_size = 0;
- error = VOP_SETATTR(vp, vap, p->p_ucred, td);
+ error = VOP_SETATTR(vp, vap, p->p_ucred);
if (error)
goto bad;
}
goto bad;
fp = nfp;
- error = VOP_OPEN(vp, fmode, p->p_ucred, fp, td);
+ error = VOP_OPEN(vp, fmode, p->p_ucred, fp);
if (error) {
/*
* setting f_ops this way prevents VOP_CLOSE from being
return (ESTALE);
if ((error = VFS_FHTOVP(mp, &fh.fh_fid, &vp)))
return (error);
- error = vn_stat(vp, &sb, td);
+ error = vn_stat(vp, &sb, td->td_proc->p_ucred);
vput(vp);
if (error)
return (error);
iov++;
}
cnt = auio.uio_resid;
- error = VOP_SETEXTATTR(vp, attrname, &auio, nd.nl_cred, nd.nl_td);
+ error = VOP_SETEXTATTR(vp, attrname, &auio, nd.nl_cred);
cnt -= auio.uio_resid;
uap->sysmsg_result = cnt;
done:
iov++;
}
cnt = auio.uio_resid;
- error = VOP_GETEXTATTR(vp, attrname, &auio, nd.nl_cred, nd.nl_td);
+ error = VOP_GETEXTATTR(vp, attrname, &auio, nd.nl_cred);
cnt -= auio.uio_resid;
uap->sysmsg_result = cnt;
done:
return (error);
}
- error = VOP_SETEXTATTR(vp, attrname, NULL, nd.nl_cred, nd.nl_td);
+ error = VOP_SETEXTATTR(vp, attrname, NULL, nd.nl_cred);
vput(vp);
nlookup_done(&nd);
return(error);
*
* @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94
* $FreeBSD: src/sys/kern/vfs_vnops.c,v 1.87.2.13 2002/12/29 18:19:53 dillon Exp $
- * $DragonFly: src/sys/kern/vfs_vnops.c,v 1.38 2006/05/05 21:15:09 dillon Exp $
+ * $DragonFly: src/sys/kern/vfs_vnops.c,v 1.39 2006/05/06 02:43:12 dillon Exp $
*/
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/syslog.h>
-static int vn_closefile (struct file *fp, struct thread *td);
-static int vn_ioctl (struct file *fp, u_long com, caddr_t data,
- struct thread *td);
+static int vn_closefile (struct file *fp);
+static int vn_ioctl (struct file *fp, u_long com, caddr_t data,
+ struct ucred *cred);
static int vn_read (struct file *fp, struct uio *uio,
- struct ucred *cred, int flags, struct thread *td);
+ struct ucred *cred, int flags);
static int svn_read (struct file *fp, struct uio *uio,
- struct ucred *cred, int flags, struct thread *td);
-static int vn_poll (struct file *fp, int events, struct ucred *cred,
- struct thread *td);
+ struct ucred *cred, int flags);
+static int vn_poll (struct file *fp, int events, struct ucred *cred);
static int vn_kqfilter (struct file *fp, struct knote *kn);
-static int vn_statfile (struct file *fp, struct stat *sb, struct thread *td);
+static int vn_statfile (struct file *fp, struct stat *sb, struct ucred *cred);
static int vn_write (struct file *fp, struct uio *uio,
- struct ucred *cred, int flags, struct thread *td);
+ struct ucred *cred, int flags);
static int svn_write (struct file *fp, struct uio *uio,
- struct ucred *cred, int flags, struct thread *td);
+ struct ucred *cred, int flags);
struct fileops vnode_fileops = {
NULL, /* port */
vn_open(struct nlookupdata *nd, struct file *fp, int fmode, int cmode)
{
struct vnode *vp;
- struct thread *td = nd->nl_td;
struct ucred *cred = nd->nl_cred;
struct vattr vat;
struct vattr *vap = &vat;
if (fmode & FREAD)
mode |= VREAD;
if (mode) {
- error = VOP_ACCESS(vp, mode, cred, td);
+ error = VOP_ACCESS(vp, mode, cred);
if (error) {
/*
* Special stale handling, re-resolve the
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); /* XXX */
VATTR_NULL(vap);
vap->va_size = 0;
- error = VOP_SETATTR(vp, vap, cred, td);
+ error = VOP_SETATTR(vp, vap, cred);
if (error)
goto bad;
}
nd->nl_ncp = NULL;
}
- error = VOP_OPEN(vp, fmode, cred, fp, td);
+ error = VOP_OPEN(vp, fmode, cred, fp);
if (error) {
/*
* setting f_ops to &badfileops will prevent the descriptor
* Vnode close call
*/
int
-vn_close(struct vnode *vp, int flags, struct thread *td)
+vn_close(struct vnode *vp, int flags)
{
int error;
if ((error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY)) == 0) {
- error = VOP_CLOSE(vp, flags, td);
+ error = VOP_CLOSE(vp, flags);
VOP_UNLOCK(vp, 0);
}
vrele(vp);
* Package up an I/O request on a vnode into a uio and do it.
*/
int
-vn_rdwr(rw, vp, base, len, offset, segflg, ioflg, cred, aresid, td)
- enum uio_rw rw;
- struct vnode *vp;
- caddr_t base;
- int len;
- off_t offset;
- enum uio_seg segflg;
- int ioflg;
- struct ucred *cred;
- int *aresid;
- struct thread *td;
+vn_rdwr(enum uio_rw rw, struct vnode *vp, caddr_t base, int len,
+ off_t offset, enum uio_seg segflg, int ioflg,
+ struct ucred *cred, int *aresid)
{
struct uio auio;
struct iovec aiov;
auio.uio_offset = offset;
auio.uio_segflg = segflg;
auio.uio_rw = rw;
- auio.uio_td = td;
+ auio.uio_td = curthread;
if (rw == UIO_READ) {
error = VOP_READ(vp, &auio, ioflg, cred);
} else {
* core'ing the same binary, or unrelated processes scanning the directory).
*/
int
-vn_rdwr_inchunks(rw, vp, base, len, offset, segflg, ioflg, cred, aresid, td)
- enum uio_rw rw;
- struct vnode *vp;
- caddr_t base;
- int len;
- off_t offset;
- enum uio_seg segflg;
- int ioflg;
- struct ucred *cred;
- int *aresid;
- struct thread *td;
+vn_rdwr_inchunks(enum uio_rw rw, struct vnode *vp, caddr_t base, int len,
+ off_t offset, enum uio_seg segflg, int ioflg,
+ struct ucred *cred, int *aresid)
{
int error = 0;
if (rw != UIO_READ && vp->v_type == VREG)
bwillwrite();
error = vn_rdwr(rw, vp, base, chunk, offset, segflg,
- ioflg, cred, aresid, td);
+ ioflg, cred, aresid);
len -= chunk; /* aresid calc already includes length */
if (error)
break;
* File table vnode read routine.
*/
static int
-vn_read(fp, uio, cred, flags, td)
- struct file *fp;
- struct uio *uio;
- struct ucred *cred;
- struct thread *td;
- int flags;
+vn_read(struct file *fp, struct uio *uio, struct ucred *cred, int flags)
{
struct vnode *vp;
int error, ioflag;
- KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td));
+ KASSERT(uio->uio_td == curthread,
+ ("uio_td %p is not td %p", uio->uio_td, curthread));
vp = (struct vnode *)fp->f_data;
ioflag = 0;
if (fp->f_flag & FNONBLOCK)
* filesystems just route to specfs and can make this optimization.
*/
static int
-svn_read(fp, uio, cred, flags, td)
- struct file *fp;
- struct uio *uio;
- struct ucred *cred;
- struct thread *td;
- int flags;
+svn_read(struct file *fp, struct uio *uio, struct ucred *cred, int flags)
{
struct vnode *vp;
int ioflag;
int error;
dev_t dev;
- KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td));
+ KASSERT(uio->uio_td == curthread,
+ ("uio_td %p is not td %p", uio->uio_td, curthread));
vp = (struct vnode *)fp->f_data;
if (vp == NULL || vp->v_type == VBAD)
* File table vnode write routine.
*/
static int
-vn_write(fp, uio, cred, flags, td)
- struct file *fp;
- struct uio *uio;
- struct ucred *cred;
- struct thread *td;
- int flags;
+vn_write(struct file *fp, struct uio *uio, struct ucred *cred, int flags)
{
struct vnode *vp;
int error, ioflag;
- KASSERT(uio->uio_td == td, ("uio_procp %p is not p %p",
- uio->uio_td, td));
+ KASSERT(uio->uio_td == curthread,
+ ("uio_procp %p is not p %p", uio->uio_td, curthread));
vp = (struct vnode *)fp->f_data;
if (vp->v_type == VREG)
bwillwrite();
* filesystems just route to specfs and can make this optimization.
*/
static int
-svn_write(fp, uio, cred, flags, td)
- struct file *fp;
- struct uio *uio;
- struct ucred *cred;
- struct thread *td;
- int flags;
+svn_write(struct file *fp, struct uio *uio, struct ucred *cred, int flags)
{
struct vnode *vp;
int ioflag;
int error;
dev_t dev;
- KASSERT(uio->uio_td == td, ("uio_procp %p is not p %p",
- uio->uio_td, td));
+ KASSERT(uio->uio_td == curthread,
+ ("uio_procp %p is not p %p", uio->uio_td, curthread));
vp = (struct vnode *)fp->f_data;
if (vp == NULL || vp->v_type == VBAD)
* File table vnode stat routine.
*/
static int
-vn_statfile(struct file *fp, struct stat *sb, struct thread *td)
+vn_statfile(struct file *fp, struct stat *sb, struct ucred *cred)
{
struct vnode *vp = (struct vnode *)fp->f_data;
- return vn_stat(vp, sb, td);
+ return vn_stat(vp, sb, cred);
}
int
-vn_stat(struct vnode *vp, struct stat *sb, struct thread *td)
+vn_stat(struct vnode *vp, struct stat *sb, struct ucred *cred)
{
struct vattr vattr;
struct vattr *vap;
dev_t dev;
vap = &vattr;
- error = VOP_GETATTR(vp, vap, td);
+ error = VOP_GETATTR(vp, vap);
if (error)
return (error);
}
sb->st_flags = vap->va_flags;
- if (suser(td))
+ if (suser_cred(cred, 0))
sb->st_gen = 0;
else
sb->st_gen = vap->va_gen;
* File table vnode ioctl routine.
*/
static int
-vn_ioctl(struct file *fp, u_long com, caddr_t data, struct thread *td)
+vn_ioctl(struct file *fp, u_long com, caddr_t data, struct ucred *ucred)
{
struct vnode *vp = ((struct vnode *)fp->f_data);
struct vnode *ovp;
- struct ucred *ucred;
struct vattr vattr;
int error;
- KKASSERT(td->td_proc != NULL);
- ucred = td->td_proc->p_ucred;
-
switch (vp->v_type) {
case VREG:
case VDIR:
if (com == FIONREAD) {
- error = VOP_GETATTR(vp, &vattr, td);
+ error = VOP_GETATTR(vp, &vattr);
if (error)
return (error);
*(int *)data = vattr.va_size - fp->f_offset;
*(int *)data = dev_dflags(vp->v_rdev) & D_TYPEMASK;
return (0);
}
- error = VOP_IOCTL(vp, com, data, fp->f_flag, ucred, td);
+ error = VOP_IOCTL(vp, com, data, fp->f_flag, ucred);
if (error == 0 && com == TIOCSCTTY) {
- struct session *sess = td->td_proc->p_session;
+ struct proc *p = curthread->td_proc;
+ struct session *sess;
+
+ if (p == NULL)
+ return (ENOTTY);
+ sess = p->p_session;
/* Do nothing if reassigning same control tty */
if (sess->s_ttyvp == vp)
return (0);
* File table vnode poll routine.
*/
static int
-vn_poll(struct file *fp, int events, struct ucred *cred, struct thread *td)
+vn_poll(struct file *fp, int events, struct ucred *cred)
{
- return (VOP_POLL(((struct vnode *)fp->f_data), events, cred, td));
+ return (VOP_POLL(((struct vnode *)fp->f_data), events, cred));
}
/*
* File table vnode close routine.
*/
static int
-vn_closefile(struct file *fp, struct thread *td)
+vn_closefile(struct file *fp)
{
int err;
fp->f_ops = &badfileops;
- err = vn_close(((struct vnode *)fp->f_data), fp->f_flag, td);
+ err = vn_close(((struct vnode *)fp->f_data), fp->f_flag);
return(err);
}
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $DragonFly: src/sys/kern/vfs_vopops.c,v 1.24 2006/05/05 21:15:09 dillon Exp $
+ * $DragonFly: src/sys/kern/vfs_vopops.c,v 1.25 2006/05/06 02:43:12 dillon Exp $
*/
#include <sys/param.h>
int
vop_open(struct vop_ops *ops, struct vnode *vp, int mode, struct ucred *cred,
- struct file *fp, struct thread *td)
+ struct file *fp)
{
struct vop_open_args ap;
int error;
ap.a_fp = fp;
ap.a_mode = mode;
ap.a_cred = cred;
- ap.a_td = td;
DO_OPS(ops, error, &ap, vop_open);
return(error);
}
int
-vop_close(struct vop_ops *ops, struct vnode *vp, int fflag, struct thread *td)
+vop_close(struct vop_ops *ops, struct vnode *vp, int fflag)
{
struct vop_close_args ap;
int error;
ap.a_head.a_ops = ops;
ap.a_vp = vp;
ap.a_fflag = fflag;
- ap.a_td = td;
DO_OPS(ops, error, &ap, vop_close);
return(error);
}
int
-vop_access(struct vop_ops *ops, struct vnode *vp, int mode, struct ucred *cred,
- struct thread *td)
+vop_access(struct vop_ops *ops, struct vnode *vp, int mode, struct ucred *cred)
{
struct vop_access_args ap;
int error;
ap.a_vp = vp;
ap.a_mode = mode;
ap.a_cred = cred;
- ap.a_td = td;
DO_OPS(ops, error, &ap, vop_access);
return(error);
}
int
-vop_getattr(struct vop_ops *ops, struct vnode *vp, struct vattr *vap,
- struct thread *td)
+vop_getattr(struct vop_ops *ops, struct vnode *vp, struct vattr *vap)
{
struct vop_getattr_args ap;
struct namecache *ncp;
ap.a_head.a_ops = ops;
ap.a_vp = vp;
ap.a_vap = vap;
- ap.a_td = td;
DO_OPS(ops, error, &ap, vop_getattr);
if ((ops->vv_flags & VVF_SUPPORTS_FSMID) == 0) {
int
vop_setattr(struct vop_ops *ops, struct vnode *vp, struct vattr *vap,
- struct ucred *cred, struct thread *td)
+ struct ucred *cred)
{
struct vop_setattr_args ap;
int error;
ap.a_vp = vp;
ap.a_vap = vap;
ap.a_cred = cred;
- ap.a_td = td;
DO_OPS(ops, error, &ap, vop_setattr);
if (error == 0)
int
vop_ioctl(struct vop_ops *ops, struct vnode *vp, u_long command, caddr_t data,
- int fflag, struct ucred *cred,
- struct thread *td)
+ int fflag, struct ucred *cred)
{
struct vop_ioctl_args ap;
int error;
ap.a_data = data;
ap.a_fflag = fflag;
ap.a_cred = cred;
- ap.a_td = td;
DO_OPS(ops, error, &ap, vop_ioctl);
return(error);
}
int
-vop_poll(struct vop_ops *ops, struct vnode *vp, int events, struct ucred *cred,
- struct thread *td)
+vop_poll(struct vop_ops *ops, struct vnode *vp, int events, struct ucred *cred)
{
struct vop_poll_args ap;
int error;
ap.a_vp = vp;
ap.a_events = events;
ap.a_cred = cred;
- ap.a_td = td;
DO_OPS(ops, error, &ap, vop_poll);
return(error);
}
int
-vop_mmap(struct vop_ops *ops, struct vnode *vp, int fflags, struct ucred *cred,
- struct thread *td)
+vop_mmap(struct vop_ops *ops, struct vnode *vp, int fflags, struct ucred *cred)
{
struct vop_mmap_args ap;
int error;
ap.a_vp = vp;
ap.a_fflags = fflags;
ap.a_cred = cred;
- ap.a_td = td;
DO_OPS(ops, error, &ap, vop_mmap);
return(error);
}
int
-vop_fsync(struct vop_ops *ops, struct vnode *vp, int waitfor, struct thread *td)
+vop_fsync(struct vop_ops *ops, struct vnode *vp, int waitfor)
{
struct vop_fsync_args ap;
int error;
ap.a_head.a_ops = ops;
ap.a_vp = vp;
ap.a_waitfor = waitfor;
- ap.a_td = td;
DO_OPS(ops, error, &ap, vop_fsync);
return(error);
}
int
-vop_inactive(struct vop_ops *ops, struct vnode *vp, struct thread *td)
+vop_inactive(struct vop_ops *ops, struct vnode *vp)
{
struct vop_inactive_args ap;
int error;
ap.a_head.a_desc = &vop_inactive_desc;
ap.a_head.a_ops = ops;
ap.a_vp = vp;
- ap.a_td = td;
DO_OPS(ops, error, &ap, vop_inactive);
return(error);
}
int
-vop_reclaim(struct vop_ops *ops, struct vnode *vp, struct thread *td)
+vop_reclaim(struct vop_ops *ops, struct vnode *vp)
{
struct vop_reclaim_args ap;
int error;
ap.a_head.a_desc = &vop_reclaim_desc;
ap.a_head.a_ops = ops;
ap.a_vp = vp;
- ap.a_td = td;
DO_OPS(ops, error, &ap, vop_reclaim);
return(error);
int
vop_getacl(struct vop_ops *ops, struct vnode *vp, acl_type_t type,
- struct acl *aclp, struct ucred *cred, struct thread *td)
+ struct acl *aclp, struct ucred *cred)
{
struct vop_getacl_args ap;
int error;
ap.a_type = type;
ap.a_aclp = aclp;
ap.a_cred = cred;
- ap.a_td = td;
DO_OPS(ops, error, &ap, vop_getacl);
return(error);
int
vop_setacl(struct vop_ops *ops, struct vnode *vp, acl_type_t type,
- struct acl *aclp, struct ucred *cred, struct thread *td)
+ struct acl *aclp, struct ucred *cred)
{
struct vop_setacl_args ap;
int error;
ap.a_type = type;
ap.a_aclp = aclp;
ap.a_cred = cred;
- ap.a_td = td;
DO_OPS(ops, error, &ap, vop_setacl);
if (error == 0)
int
vop_aclcheck(struct vop_ops *ops, struct vnode *vp, acl_type_t type,
- struct acl *aclp, struct ucred *cred, struct thread *td)
+ struct acl *aclp, struct ucred *cred)
{
struct vop_aclcheck_args ap;
int error;
ap.a_type = type;
ap.a_aclp = aclp;
ap.a_cred = cred;
- ap.a_td = td;
DO_OPS(ops, error, &ap, vop_aclcheck);
return(error);
int
vop_getextattr(struct vop_ops *ops, struct vnode *vp, char *name,
- struct uio *uio, struct ucred *cred, struct thread *td)
+ struct uio *uio, struct ucred *cred)
{
struct vop_getextattr_args ap;
int error;
ap.a_name = name;
ap.a_uio = uio;
ap.a_cred = cred;
- ap.a_td = td;
DO_OPS(ops, error, &ap, vop_getextattr);
return(error);
int
vop_setextattr(struct vop_ops *ops, struct vnode *vp, char *name,
- struct uio *uio, struct ucred *cred, struct thread *td)
+ struct uio *uio, struct ucred *cred)
{
struct vop_setextattr_args ap;
int error;
ap.a_name = name;
ap.a_uio = uio;
ap.a_cred = cred;
- ap.a_td = td;
DO_OPS(ops, error, &ap, vop_setextattr);
if (error == 0)
*
* @(#)if.c 8.3 (Berkeley) 1/4/94
* $FreeBSD: src/sys/net/if.c,v 1.185 2004/03/13 02:35:03 brooks Exp $
- * $DragonFly: src/sys/net/if.c,v 1.44 2006/01/31 19:05:35 dillon Exp $
+ * $DragonFly: src/sys/net/if.c,v 1.45 2006/05/06 02:43:12 dillon Exp $
*/
#include "opt_compat.h"
static void if_attachdomain(void *);
static void if_attachdomain1(struct ifnet *);
-static int ifconf (u_long, caddr_t, struct thread *);
+static int ifconf (u_long, caddr_t, struct ucred *);
static void ifinit (void *);
static void if_slowtimo (void *);
static void link_rtrequest (int, struct rtentry *, struct rt_addrinfo *);
* Interface ioctls.
*/
int
-ifioctl(struct socket *so, u_long cmd, caddr_t data, struct thread *td)
+ifioctl(struct socket *so, u_long cmd, caddr_t data, struct ucred *cred)
{
struct ifnet *ifp;
struct ifreq *ifr;
case SIOCGIFCONF:
case OSIOCGIFCONF:
- return (ifconf(cmd, data, td));
+ return (ifconf(cmd, data, cred));
}
ifr = (struct ifreq *)data;
switch (cmd) {
case SIOCIFCREATE:
case SIOCIFDESTROY:
- if ((error = suser(td)) != 0)
+ if ((error = suser_cred(cred, 0)) != 0)
return (error);
return ((cmd == SIOCIFCREATE) ?
if_clone_create(ifr->ifr_name, sizeof(ifr->ifr_name)) :
break;
case SIOCSIFFLAGS:
- error = suser(td);
+ error = suser_cred(cred, 0);
if (error)
return (error);
new_flags = (ifr->ifr_flags & 0xffff) |
}
if (ifp->if_ioctl) {
lwkt_serialize_enter(ifp->if_serializer);
- ifp->if_ioctl(ifp, cmd, data, td->td_proc->p_ucred);
+ ifp->if_ioctl(ifp, cmd, data, cred);
lwkt_serialize_exit(ifp->if_serializer);
}
getmicrotime(&ifp->if_lastchange);
break;
case SIOCSIFCAP:
- error = suser(td);
+ error = suser_cred(cred, 0);
if (error)
return (error);
if (ifr->ifr_reqcap & ~ifp->if_capabilities)
return (EINVAL);
lwkt_serialize_enter(ifp->if_serializer);
- ifp->if_ioctl(ifp, cmd, data, td->td_proc->p_ucred);
+ ifp->if_ioctl(ifp, cmd, data, cred);
lwkt_serialize_exit(ifp->if_serializer);
break;
case SIOCSIFNAME:
- error = suser(td);
+ error = suser_cred(cred, 0);
if (error != 0)
return (error);
error = copyinstr(ifr->ifr_data, new_name, IFNAMSIZ, NULL);
break;
case SIOCSIFMETRIC:
- error = suser(td);
+ error = suser_cred(cred, 0);
if (error)
return (error);
ifp->if_metric = ifr->ifr_metric;
break;
case SIOCSIFPHYS:
- error = suser(td);
+ error = suser_cred(cred, 0);
if (error)
return error;
if (!ifp->if_ioctl)
return EOPNOTSUPP;
lwkt_serialize_enter(ifp->if_serializer);
- error = ifp->if_ioctl(ifp, cmd, data, td->td_proc->p_ucred);
+ error = ifp->if_ioctl(ifp, cmd, data, cred);
lwkt_serialize_exit(ifp->if_serializer);
if (error == 0)
getmicrotime(&ifp->if_lastchange);
{
u_long oldmtu = ifp->if_mtu;
- error = suser(td);
+ error = suser_cred(cred, 0);
if (error)
return (error);
if (ifp->if_ioctl == NULL)
if (ifr->ifr_mtu < IF_MINMTU || ifr->ifr_mtu > IF_MAXMTU)
return (EINVAL);
lwkt_serialize_enter(ifp->if_serializer);
- error = ifp->if_ioctl(ifp, cmd, data, td->td_proc->p_ucred);
+ error = ifp->if_ioctl(ifp, cmd, data, cred);
lwkt_serialize_exit(ifp->if_serializer);
if (error == 0) {
getmicrotime(&ifp->if_lastchange);
case SIOCADDMULTI:
case SIOCDELMULTI:
- error = suser(td);
+ error = suser_cred(cred, 0);
if (error)
return (error);
case SIOCSLIFPHYADDR:
case SIOCSIFMEDIA:
case SIOCSIFGENERIC:
- error = suser(td);
+ error = suser_cred(cred, 0);
if (error)
return (error);
if (ifp->if_ioctl == 0)
return (EOPNOTSUPP);
lwkt_serialize_enter(ifp->if_serializer);
- error = ifp->if_ioctl(ifp, cmd, data, td->td_proc->p_ucred);
+ error = ifp->if_ioctl(ifp, cmd, data, cred);
lwkt_serialize_exit(ifp->if_serializer);
if (error == 0)
getmicrotime(&ifp->if_lastchange);
if (ifp->if_ioctl == NULL)
return (EOPNOTSUPP);
lwkt_serialize_enter(ifp->if_serializer);
- error = ifp->if_ioctl(ifp, cmd, data, td->td_proc->p_ucred);
+ error = ifp->if_ioctl(ifp, cmd, data, cred);
lwkt_serialize_exit(ifp->if_serializer);
return (error);
case SIOCSIFLLADDR:
- error = suser(td);
+ error = suser_cred(cred, 0);
if (error)
return (error);
return if_setlladdr(ifp,
if (so->so_proto == 0)
return (EOPNOTSUPP);
#ifndef COMPAT_43
- error = so_pru_control(so, cmd, data, ifp, td);
+ error = so_pru_control(so, cmd, data, ifp);
#else
{
int ocmd = cmd;
case OSIOCGIFNETMASK:
cmd = SIOCGIFNETMASK;
}
- error = so_pru_control(so, cmd, data, ifp, td);
+ error = so_pru_control(so, cmd, data, ifp);
switch (ocmd) {
case OSIOCGIFADDR:
* other information.
*/
static int
-ifconf(u_long cmd, caddr_t data, struct thread *td)
+ifconf(u_long cmd, caddr_t data, struct ucred *cred)
{
struct ifconf *ifc = (struct ifconf *)data;
struct ifnet *ifp;
if (space <= sizeof ifr)
break;
sa = ifa->ifa_addr;
- if (td->td_proc->p_ucred->cr_prison &&
- prison_if(td, sa))
+ if (cred->cr_prison &&
+ prison_if(cred, sa))
continue;
addrs++;
#ifdef COMPAT_43
*
* @(#)if.h 8.1 (Berkeley) 6/10/93
* $FreeBSD: src/sys/net/if.h,v 1.58.2.9 2002/08/30 14:23:38 sobomax Exp $
- * $DragonFly: src/sys/net/if.h,v 1.14 2005/12/21 16:37:15 corecode Exp $
+ * $DragonFly: src/sys/net/if.h,v 1.15 2006/05/06 02:43:12 dillon Exp $
*/
#ifndef _NET_IF_H_
#ifdef _KERNEL
struct thread;
+struct ucred;
-int prison_if (struct thread *td, struct sockaddr *sa);
+int prison_if (struct ucred *cred, struct sockaddr *sa);
/* XXX - this should go away soon. */
#include <net/if_var.h>
*
* From: @(#)if.h 8.1 (Berkeley) 6/10/93
* $FreeBSD: src/sys/net/if_var.h,v 1.18.2.16 2003/04/15 18:11:19 fjoe Exp $
- * $DragonFly: src/sys/net/if_var.h,v 1.33 2005/12/21 16:37:15 corecode Exp $
+ * $DragonFly: src/sys/net/if_var.h,v 1.34 2006/05/06 02:43:12 dillon Exp $
*/
#ifndef _NET_IF_VAR_H_
void if_unroute(struct ifnet *, int flag, int fam);
void if_up(struct ifnet *);
/*void ifinit(void);*/ /* declared in systm.h for main() */
-int ifioctl(struct socket *, u_long, caddr_t, struct thread *);
+int ifioctl(struct socket *, u_long, caddr_t, struct ucred *);
int ifpromisc(struct ifnet *, int);
struct ifnet *ifunit(const char *);
struct ifnet *if_withname(struct sockaddr *);
*
* @(#)route.c 8.3 (Berkeley) 1/9/95
* $FreeBSD: src/sys/net/route.c,v 1.59.2.10 2003/01/17 08:04:00 ru Exp $
- * $DragonFly: src/sys/net/route.c,v 1.25 2006/04/11 06:59:36 dillon Exp $
+ * $DragonFly: src/sys/net/route.c,v 1.26 2006/05/06 02:43:12 dillon Exp $
*/
#include "opt_inet.h"
* Routing table ioctl interface.
*/
int
-rtioctl(u_long req, caddr_t data, struct thread *td)
+rtioctl(u_long req, caddr_t data, struct ucred *cred)
{
#ifdef INET
/* Multicast goop, grrr... */
*
* @(#)route.h 8.4 (Berkeley) 1/9/95
* $FreeBSD: src/sys/net/route.h,v 1.36.2.5 2002/02/01 11:48:01 ru Exp $
- * $DragonFly: src/sys/net/route.h,v 1.16 2006/04/11 06:59:36 dillon Exp $
+ * $DragonFly: src/sys/net/route.h,v 1.17 2006/05/06 02:43:12 dillon Exp $
*/
#ifndef _NET_ROUTE_H_
struct ifmultiaddr;
struct proc;
+struct ucred;
void route_init (void);
void rt_dstmsg(int type, struct sockaddr *dst, int error);
void rtfree (struct rtentry *);
int rtinit (struct ifaddr *, int, int);
-int rtioctl (u_long, caddr_t, struct thread *);
+int rtioctl (u_long, caddr_t, struct ucred *);
void rtredirect (struct sockaddr *, struct sockaddr *,
struct sockaddr *, int, struct sockaddr *);
int rtrequest (int, struct sockaddr *,
*
* @(#)rtsock.c 8.7 (Berkeley) 10/12/95
* $FreeBSD: src/sys/net/rtsock.c,v 1.44.2.11 2002/12/04 14:05:41 ru Exp $
- * $DragonFly: src/sys/net/rtsock.c,v 1.30 2006/01/31 19:05:35 dillon Exp $
+ * $DragonFly: src/sys/net/rtsock.c,v 1.31 2006/05/06 02:43:12 dillon Exp $
*/
#include "opt_sctp.h"
if (af && af != ifa->ifa_addr->sa_family)
continue;
if (curproc->p_ucred->cr_prison &&
- prison_if(curthread, ifa->ifa_addr))
+ prison_if(curproc->p_ucred, ifa->ifa_addr))
continue;
rtinfo.rti_ifaaddr = ifa->ifa_addr;
rtinfo.rti_netmask = ifa->ifa_netmask;
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/netncp/ncp_sock.c,v 1.2 1999/10/12 10:36:59 bp Exp $
- * $DragonFly: src/sys/netproto/ncp/ncp_sock.c,v 1.12 2006/01/14 13:36:40 swildner Exp $
+ * $DragonFly: src/sys/netproto/ncp/ncp_sock.c,v 1.13 2006/05/06 02:43:13 dillon Exp $
*
* Low level socket routines
*/
}
int
-ncp_poll(struct socket *so, int events){
- struct thread *td = curthread; /* XXX */
- struct ucred *cred=NULL;
- return so_pru_sopoll(so, events, cred, td);
+ncp_poll(struct socket *so, int events)
+{
+ return (so_pru_sopoll(so, events, NULL));
}
int
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/netsmb/smb_trantcp.c,v 1.3.2.1 2001/05/22 08:32:34 bp Exp $
- * $DragonFly: src/sys/netproto/smb/smb_trantcp.c,v 1.13 2005/12/08 20:20:34 dillon Exp $
+ * $DragonFly: src/sys/netproto/smb/smb_trantcp.c,v 1.14 2006/05/06 02:43:13 dillon Exp $
*/
#include <sys/param.h>
#include <sys/systm.h>
static __inline int
nb_poll(struct nbpcb *nbp, int events, struct thread *td)
{
- return so_pru_sopoll(nbp->nbp_tso, events, NULL, td);
+ return so_pru_sopoll(nbp->nbp_tso, events, NULL);
}
static int
/* $FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $ */
-/* $DragonFly: src/sys/opencrypto/cryptodev.c,v 1.12 2005/09/02 07:16:58 hsu Exp $ */
+/* $DragonFly: src/sys/opencrypto/cryptodev.c,v 1.13 2006/05/06 02:43:13 dillon Exp $ */
/* $OpenBSD: cryptodev.c,v 1.52 2002/06/19 07:22:46 deraadt Exp $ */
/*
};
static int cryptof_rw(struct file *fp, struct uio *uio,
- struct ucred *cred, int flags, struct thread *);
-static int cryptof_ioctl(struct file *, u_long, caddr_t, struct thread *);
-static int cryptof_poll(struct file *, int, struct ucred *, struct thread *);
+ struct ucred *cred, int flags);
+static int cryptof_ioctl(struct file *, u_long, caddr_t, struct ucred *);
+static int cryptof_poll(struct file *, int, struct ucred *);
static int cryptof_kqfilter(struct file *, struct knote *);
-static int cryptof_stat(struct file *, struct stat *, struct thread *);
-static int cryptof_close(struct file *, struct thread *);
+static int cryptof_stat(struct file *, struct stat *, struct ucred *);
+static int cryptof_close(struct file *);
static struct fileops cryptofops = {
NULL, /* port */
struct auth_hash *);
static int csefree(struct csession *);
-static int cryptodev_op(struct csession *, struct crypt_op *,
- struct thread *td);
+static int cryptodev_op(struct csession *, struct crypt_op *);
static int cryptodev_key(struct crypt_kop *);
static int
struct file *fp,
struct uio *uio,
struct ucred *active_cred,
- int flags,
- struct thread *td)
+ int flags)
{
return (EIO);
struct file *fp,
u_long cmd,
caddr_t data,
- struct thread *td)
+ struct ucred *cred)
{
struct cryptoini cria, crie;
struct fcrypt *fcr = (struct fcrypt *)fp->f_data;
cse = csefind(fcr, cop->ses);
if (cse == NULL)
return (EINVAL);
- error = cryptodev_op(cse, cop, td);
+ error = cryptodev_op(cse, cop);
break;
case CIOCKEY:
error = cryptodev_key((struct crypt_kop *)data);
static int
-cryptodev_op(
- struct csession *cse,
- struct crypt_op *cop,
- struct thread *td)
+cryptodev_op(struct csession *cse, struct crypt_op *cop)
{
struct cryptop *crp = NULL;
struct cryptodesc *crde = NULL, *crda = NULL;
cse->uio.uio_resid = 0;
cse->uio.uio_segflg = UIO_SYSSPACE;
cse->uio.uio_rw = UIO_WRITE;
- cse->uio.uio_td = td;
+ cse->uio.uio_td = curthread;
cse->uio.uio_iov = cse->iovec;
bzero(&cse->iovec, sizeof(cse->iovec));
cse->uio.uio_iov[0].iov_len = cop->len;
/* ARGSUSED */
static int
-cryptof_poll(
- struct file *fp,
- int events,
- struct ucred *active_cred,
- struct thread *td)
+cryptof_poll(struct file *fp, int events, struct ucred *active_cred)
{
-
return (0);
}
/* ARGSUSED */
static int
-cryptof_stat(
- struct file *fp,
- struct stat *sb,
- struct thread *td)
+cryptof_stat(struct file *fp, struct stat *sb, struct ucred *cred)
{
-
return (EOPNOTSUPP);
}
/* ARGSUSED */
static int
-cryptof_close(struct file *fp, struct thread *td)
+cryptof_close(struct file *fp)
{
struct fcrypt *fcr = (struct fcrypt *)fp->f_data;
struct csession *cse;
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
* $FreeBSD: src/sys/i386/i386/vm_machdep.c,v 1.132.2.9 2003/01/25 19:02:23 dillon Exp $
- * $DragonFly: src/sys/platform/pc32/i386/vm_machdep.c,v 1.41 2006/04/30 20:23:22 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/i386/vm_machdep.c,v 1.42 2006/05/06 02:43:12 dillon Exp $
*/
#include "use_npx.h"
bcopy(p->p_thread->td_pcb, tempuser + ((char *)p->p_thread->td_pcb - (char *)p->p_addr), sizeof(struct pcb));
error = vn_rdwr(UIO_WRITE, vp, (caddr_t) tempuser, ctob(UPAGES),
- (off_t)0, UIO_SYSSPACE, IO_UNIT, cred, (int *)NULL, td);
+ (off_t)0, UIO_SYSSPACE, IO_UNIT, cred, (int *)NULL);
free(tempuser, M_TEMP);
*
* @(#)file.h 8.3 (Berkeley) 1/9/95
* $FreeBSD: src/sys/sys/file.h,v 1.22.2.7 2002/11/21 23:39:24 sam Exp $
- * $DragonFly: src/sys/sys/file.h,v 1.15 2005/09/02 07:16:58 hsu Exp $
+ * $DragonFly: src/sys/sys/file.h,v 1.16 2006/05/06 02:43:13 dillon Exp $
*/
#ifndef _SYS_FILE_H_
struct fileops {
struct lwkt_port *fo_port;
- int (*fo_clone)(struct file *); /* additional work after dup */
-
- int (*fold_read) (struct file *fp, struct uio *uio,
- struct ucred *cred, int flags,
- struct thread *td);
- int (*fold_write) (struct file *fp, struct uio *uio,
- struct ucred *cred, int flags,
- struct thread *td);
- int (*fold_ioctl) (struct file *fp, u_long com,
- caddr_t data, struct thread *td);
- int (*fold_poll) (struct file *fp, int events,
- struct ucred *cred, struct thread *td);
- int (*fold_kqfilter) (struct file *fp,
- struct knote *kn);
- int (*fold_stat) (struct file *fp, struct stat *sb,
- struct thread *td);
- int (*fold_close) (struct file *fp, struct thread *td);
- int (*fold_shutdown) (struct file *fp, int how, struct thread *td);
+ int (*fo_clone) (struct file *);/* additional work after dup */
+
+ int (*fold_read) (struct file *fp, struct uio *uio,
+ struct ucred *cred, int flags);
+ int (*fold_write) (struct file *fp, struct uio *uio,
+ struct ucred *cred, int flags);
+ int (*fold_ioctl) (struct file *fp, u_long com, caddr_t data,
+ struct ucred *cred);
+ int (*fold_poll) (struct file *fp, int events,
+ struct ucred *cred);
+ int (*fold_kqfilter) (struct file *fp, struct knote *kn);
+ int (*fold_stat) (struct file *fp, struct stat *sb,
+ struct ucred *cred);
+ int (*fold_close) (struct file *fp);
+ int (*fold_shutdown) (struct file *fp, int how);
};
#define FOF_OFFSET 1 /* fo_read(), fo_write() flags */
extern int fp_stat(struct file *fp, struct stat *ub);
extern int fp_mmap(void *addr, size_t size, int prot, int flags, struct file *fp, off_t pos, void **resp);
-extern int nofo_shutdown(struct file *fp, int how, struct thread *td);
+extern int nofo_shutdown(struct file *fp, int how);
extern int fp_close(struct file *fp);
extern int fp_shutdown(struct file *fp, int how);
*
* @(#)file.h 8.3 (Berkeley) 1/9/95
* $FreeBSD: src/sys/sys/file.h,v 1.22.2.7 2002/11/21 23:39:24 sam Exp $
- * $DragonFly: src/sys/sys/file2.h,v 1.3 2005/07/13 01:38:53 dillon Exp $
+ * $DragonFly: src/sys/sys/file2.h,v 1.4 2006/05/06 02:43:13 dillon Exp $
*/
#ifndef _SYS_FILE2_H_
struct file *fp,
struct uio *uio,
struct ucred *cred,
- int flags,
- struct thread *td
+ int flags
) {
int error;
fhold(fp);
- error = (*fp->f_ops->fold_read)(fp, uio, cred, flags, td);
- fdrop(fp, td);
+ error = (*fp->f_ops->fold_read)(fp, uio, cred, flags);
+ fdrop(fp, curthread);
return (error);
}
struct file *fp,
struct uio *uio,
struct ucred *cred,
- int flags,
- struct thread *td
+ int flags
) {
int error;
fhold(fp);
- error = (*fp->f_ops->fold_write)(fp, uio, cred, flags, td);
- fdrop(fp, td);
+ error = (*fp->f_ops->fold_write)(fp, uio, cred, flags);
+ fdrop(fp, curthread);
return (error);
}
struct file *fp,
u_long com,
caddr_t data,
- struct thread *td
+ struct ucred *cred
) {
int error;
fhold(fp);
- error = (*fp->f_ops->fold_ioctl)(fp, com, data, td);
- fdrop(fp, td);
+ error = (*fp->f_ops->fold_ioctl)(fp, com, data, cred);
+ fdrop(fp, curthread);
return (error);
}
fo_poll(
struct file *fp,
int events,
- struct ucred *cred,
- struct thread *td
+ struct ucred *cred
) {
int error;
fhold(fp);
- error = (*fp->f_ops->fold_poll)(fp, events, cred, td);
- fdrop(fp, td);
+ error = (*fp->f_ops->fold_poll)(fp, events, cred);
+ fdrop(fp, curthread);
return (error);
}
static __inline int
-fo_stat(struct file *fp, struct stat *sb, struct thread *td)
+fo_stat(struct file *fp, struct stat *sb, struct ucred *cred)
{
int error;
fhold(fp);
- error = (*fp->f_ops->fold_stat)(fp, sb, td);
- fdrop(fp, td);
+ error = (*fp->f_ops->fold_stat)(fp, sb, cred);
+ fdrop(fp, curthread);
return (error);
}
static __inline int
-fo_close(struct file *fp, struct thread *td)
+fo_close(struct file *fp)
{
- return ((*fp->f_ops->fold_close)(fp, td));
+ return ((*fp->f_ops->fold_close)(fp));
}
static __inline int
-fo_shutdown(struct file *fp, int how, struct thread *td)
+fo_shutdown(struct file *fp, int how)
{
- return ((*fp->f_ops->fold_shutdown)(fp, how, td));
+ return ((*fp->f_ops->fold_shutdown)(fp, how));
}
static __inline int
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $DragonFly: src/sys/sys/kern_syscall.h,v 1.29 2006/04/26 17:17:57 dillon Exp $
+ * $DragonFly: src/sys/sys/kern_syscall.h,v 1.30 2006/05/06 02:43:13 dillon Exp $
*/
#ifndef _SYS_KERN_SYSCALL_H_
struct uio;
struct vnode;
struct file;
+struct ucred;
/*
* Prototypes for syscalls in kern/kern_descrip.c
*/
int kern_dup(enum dup_type type, int old, int new, int *res);
-int kern_fcntl(int fd, int cmd, union fcntl_dat *dat);
+int kern_fcntl(int fd, int cmd, union fcntl_dat *dat, struct ucred *cred);
int kern_fstat(int fd, struct stat *st);
/*
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $DragonFly: src/sys/sys/mapped_ioctl.h,v 1.2 2005/03/01 00:43:02 corecode Exp $
+ * $DragonFly: src/sys/sys/mapped_ioctl.h,v 1.3 2006/05/06 02:43:13 dillon Exp $
*/
#ifndef _SYS_MAPPED_IOCTL_H_
#define _SYS_MAPPED_IOCTL_H_
struct file;
struct thread;
+struct ucred;
struct ioctl_map_entry;
-typedef int (ioctl_wrap_func)(struct file *, u_long, u_long, caddr_t,
- struct thread *);
+typedef int (ioctl_wrap_func)(struct file *, u_long, u_long, caddr_t,
+ struct ucred *);
typedef u_long (ioctl_map_func)(u_long, u_long, u_long, u_long, u_long, u_long);
struct ioctl_map_range {
*
* @(#)mount.h 8.21 (Berkeley) 5/20/95
* $FreeBSD: src/sys/sys/mount.h,v 1.89.2.7 2003/04/04 20:35:57 tegge Exp $
- * $DragonFly: src/sys/sys/mount.h,v 1.22 2006/05/05 21:27:54 dillon Exp $
+ * $DragonFly: src/sys/sys/mount.h,v 1.23 2006/05/06 02:43:13 dillon Exp $
*/
#ifndef _SYS_MOUNT_H_
struct thread *td);
typedef int vfs_statfs_t(struct mount *mp, struct statfs *sbp,
struct thread *td);
-typedef int vfs_sync_t(struct mount *mp, int waitfor, struct thread *td);
+typedef int vfs_sync_t(struct mount *mp, int waitfor);
typedef int vfs_vget_t(struct mount *mp, ino_t ino, struct vnode **vpp);
typedef int vfs_fhtovp_t(struct mount *mp, struct fid *fhp,
struct vnode **vpp);
#define VFS_ROOT(MP, VPP) (*(MP)->mnt_op->vfs_root)(MP, VPP)
#define VFS_QUOTACTL(MP,C,U,A,P) (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A, P)
#define VFS_STATFS(MP, SBP, P) (*(MP)->mnt_op->vfs_statfs)(MP, SBP, P)
-#define VFS_SYNC(MP, WAIT, P) (*(MP)->mnt_op->vfs_sync)(MP, WAIT, P)
+#define VFS_SYNC(MP, WAIT) (*(MP)->mnt_op->vfs_sync)(MP, WAIT)
#define VFS_VGET(MP, INO, VPP) (*(MP)->mnt_op->vfs_vget)(MP, INO, VPP)
#define VFS_FHTOVP(MP, FIDP, VPP) \
(*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, VPP)
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $DragonFly: src/sys/sys/socketops.h,v 1.6 2004/12/30 07:01:52 cpressey Exp $
+ * $DragonFly: src/sys/sys/socketops.h,v 1.7 2006/05/06 02:43:13 dillon Exp $
*/
/*
int so_pru_connect (struct socket *so, struct sockaddr *nam, struct thread *td);
int so_pru_connect2 (struct socket *so1, struct socket *so2);
int so_pru_control (struct socket *so, u_long cmd, caddr_t data,
- struct ifnet *ifp, struct thread *td);
+ struct ifnet *ifp);
int so_pru_detach (struct socket *so);
int so_pru_disconnect (struct socket *so);
int so_pru_listen (struct socket *so, struct thread *td);
int so_pru_sense (struct socket *so, struct stat *sb);
int so_pru_shutdown (struct socket *so);
int so_pru_sockaddr (struct socket *so, struct sockaddr **nam);
-int so_pru_sopoll (struct socket *so, int events, struct ucred *cred,
- struct thread *td);
+int so_pru_sopoll (struct socket *so, int events, struct ucred *cred);
int so_pr_ctloutput(struct socket *so, struct sockopt *sopt);
#endif
*
* @(#)socketvar.h 8.3 (Berkeley) 2/19/95
* $FreeBSD: src/sys/sys/socketvar.h,v 1.46.2.10 2003/08/24 08:24:39 hsu Exp $
- * $DragonFly: src/sys/sys/socketvar.h,v 1.20 2005/07/23 07:28:36 dillon Exp $
+ * $DragonFly: src/sys/sys/socketvar.h,v 1.21 2006/05/06 02:43:13 dillon Exp $
*/
#ifndef _SYS_SOCKETVAR_H_
* File operations on sockets.
*/
int soo_read (struct file *fp, struct uio *uio, struct ucred *cred,
- int flags, struct thread *td);
+ int flags);
int soo_write (struct file *fp, struct uio *uio, struct ucred *cred,
- int flags, struct thread *td);
-int soo_close (struct file *fp, struct thread *td);
-int soo_shutdown (struct file *fp, int how, struct thread *td);
+ int flags);
+int soo_close (struct file *fp);
+int soo_shutdown (struct file *fp, int how);
int soo_ioctl (struct file *fp, u_long cmd, caddr_t data,
- struct thread *td);
-int soo_poll (struct file *fp, int events, struct ucred *cred,
- struct thread *td);
-int soo_stat (struct file *fp, struct stat *ub, struct thread *td);
+ struct ucred *cred);
+int soo_poll (struct file *fp, int events, struct ucred *cred);
+int soo_stat (struct file *fp, struct stat *ub, struct ucred *cred);
int sokqfilter (struct file *fp, struct knote *kn);
/*
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $DragonFly: src/sys/sys/vfsops.h,v 1.21 2006/05/05 21:15:09 dillon Exp $
+ * $DragonFly: src/sys/sys/vfsops.h,v 1.22 2006/05/06 02:43:13 dillon Exp $
*/
/*
int a_mode;
struct ucred *a_cred;
struct file *a_fp; /* optional fp for fileops override */
- struct thread *a_td;
};
struct vop_close_args {
struct vop_generic_args a_head;
struct vnode *a_vp;
int a_fflag;
- struct thread *a_td;
};
struct vop_access_args {
struct vnode *a_vp;
int a_mode;
struct ucred *a_cred;
- struct thread *a_td;
};
struct vop_getattr_args {
struct vop_generic_args a_head;
struct vnode *a_vp;
struct vattr *a_vap;
- struct thread *a_td;
};
struct vop_setattr_args {
struct vnode *a_vp;
struct vattr *a_vap;
struct ucred *a_cred;
- struct thread *a_td;
};
struct vop_read_args {
caddr_t a_data;
int a_fflag;
struct ucred *a_cred;
- struct thread *a_td;
};
struct vop_poll_args {
struct vnode *a_vp;
int a_events;
struct ucred *a_cred;
- struct thread *a_td;
};
struct vop_kqfilter_args {
struct vnode *a_vp;
int a_fflags;
struct ucred *a_cred;
- struct thread *a_td;
};
struct vop_fsync_args {
struct vop_generic_args a_head;
struct vnode *a_vp;
int a_waitfor;
- struct thread *a_td;
};
struct vop_old_remove_args {
struct vop_inactive_args {
struct vop_generic_args a_head;
struct vnode *a_vp;
- struct thread *a_td;
};
struct vop_reclaim_args {
struct vop_generic_args a_head;
struct vnode *a_vp;
- struct thread *a_td;
};
struct vop_lock_args {
acl_type_t a_type;
struct acl *a_aclp;
struct ucred *a_cred;
- struct thread *a_td;
};
struct vop_setacl_args {
acl_type_t a_type;
struct acl *a_aclp;
struct ucred *a_cred;
- struct thread *a_td;
};
struct vop_aclcheck_args {
acl_type_t a_type;
struct acl *a_aclp;
struct ucred *a_cred;
- struct thread *a_td;
};
struct vop_getextattr_args {
char *a_name;
struct uio *a_uio;
struct ucred *a_cred;
- struct thread *a_td;
};
struct vop_setextattr_args {
char *a_name;
struct uio *a_uio;
struct ucred *a_cred;
- struct thread *a_td;
};
struct vop_mountctl_args {
struct vnode **vpp, struct componentname *cnp,
struct vattr *vap);
int vop_open(struct vop_ops *ops, struct vnode *vp, int mode,
- struct ucred *cred, struct file *file, struct thread *td);
-int vop_close(struct vop_ops *ops, struct vnode *vp,
- int fflag, struct thread *td);
+ struct ucred *cred, struct file *file);
+int vop_close(struct vop_ops *ops, struct vnode *vp, int fflag);
int vop_access(struct vop_ops *ops, struct vnode *vp, int mode,
- struct ucred *cred, struct thread *td);
-int vop_getattr(struct vop_ops *ops, struct vnode *vp, struct vattr *vap,
- struct thread *td);
+ struct ucred *cred);
+int vop_getattr(struct vop_ops *ops, struct vnode *vp, struct vattr *vap);
int vop_setattr(struct vop_ops *ops, struct vnode *vp, struct vattr *vap,
- struct ucred *cred, struct thread *td);
+ struct ucred *cred);
int vop_read(struct vop_ops *ops, struct vnode *vp, struct uio *uio,
int ioflag, struct ucred *cred);
int vop_write(struct vop_ops *ops, struct vnode *vp, struct uio *uio,
int ioflag, struct ucred *cred);
int vop_ioctl(struct vop_ops *ops, struct vnode *vp, u_long command,
- caddr_t data, int fflag,
- struct ucred *cred, struct thread *td);
+ caddr_t data, int fflag, struct ucred *cred);
int vop_poll(struct vop_ops *ops, struct vnode *vp, int events,
- struct ucred *cred, struct thread *td);
+ struct ucred *cred);
int vop_kqfilter(struct vop_ops *ops, struct vnode *vp, struct knote *kn);
int vop_revoke(struct vop_ops *ops, struct vnode *vp, int flags);
int vop_mmap(struct vop_ops *ops, struct vnode *vp, int fflags,
- struct ucred *cred, struct thread *td);
-int vop_fsync(struct vop_ops *ops, struct vnode *vp, int waitfor,
- struct thread *td);
+ struct ucred *cred);
+int vop_fsync(struct vop_ops *ops, struct vnode *vp, int waitfor);
int vop_old_remove(struct vop_ops *ops, struct vnode *dvp,
struct vnode *vp, struct componentname *cnp);
int vop_old_link(struct vop_ops *ops, struct vnode *tdvp,
int *ncookies, u_long **cookies);
int vop_readlink(struct vop_ops *ops, struct vnode *vp, struct uio *uio,
struct ucred *cred);
-int vop_inactive(struct vop_ops *ops, struct vnode *vp, struct thread *td);
-int vop_reclaim(struct vop_ops *ops, struct vnode *vp, struct thread *td);
+int vop_inactive(struct vop_ops *ops, struct vnode *vp);
+int vop_reclaim(struct vop_ops *ops, struct vnode *vp);
int vop_lock(struct vop_ops *ops, struct vnode *vp, int flags);
int vop_unlock(struct vop_ops *ops, struct vnode *vp, int flags);
int vop_bmap(struct vop_ops *ops, struct vnode *vp, off_t loffset,
int vop_freeblks(struct vop_ops *ops, struct vnode *vp,
off_t offset, int length);
int vop_getacl(struct vop_ops *ops, struct vnode *vp, acl_type_t type,
- struct acl *aclp, struct ucred *cred, struct thread *td);
+ struct acl *aclp, struct ucred *cred);
int vop_setacl(struct vop_ops *ops, struct vnode *vp, acl_type_t type,
- struct acl *aclp, struct ucred *cred, struct thread *td);
+ struct acl *aclp, struct ucred *cred);
int vop_aclcheck(struct vop_ops *ops, struct vnode *vp, acl_type_t type,
- struct acl *aclp, struct ucred *cred, struct thread *td);
+ struct acl *aclp, struct ucred *cred);
int vop_getextattr(struct vop_ops *ops, struct vnode *vp, char *name,
- struct uio *uio, struct ucred *cred, struct thread *td);
+ struct uio *uio, struct ucred *cred);
int vop_setextattr(struct vop_ops *ops, struct vnode *vp, char *name,
- struct uio *uio, struct ucred *cred, struct thread *td);
+ struct uio *uio, struct ucred *cred);
int vop_mountctl(struct vop_ops *ops, int op, struct file *fp,
const void *ctl, int ctllen, void *buf, int buflen, int *res);
int vop_nresolve(struct vop_ops *ops, struct namecache *ncp,
*/
#define VOP_ISLOCKED(vp, td) \
vop_islocked(*(vp)->v_ops, vp, td)
-#define VOP_OPEN(vp, mode, cred, fp, td) \
- vop_open(*(vp)->v_ops, vp, mode, cred, fp, td)
-#define VOP_CLOSE(vp, fflag, td) \
- vop_close(*(vp)->v_ops, vp, fflag, td)
-#define VOP_ACCESS(vp, mode, cred, td) \
- vop_access(*(vp)->v_ops, vp, mode, cred, td)
-#define VOP_GETATTR(vp, vap, td) \
- vop_getattr(*(vp)->v_ops, vp, vap, td)
-#define VOP_SETATTR(vp, vap, cred, td) \
- vop_setattr(*(vp)->v_ops, vp, vap, cred, td)
+#define VOP_OPEN(vp, mode, cred, fp) \
+ vop_open(*(vp)->v_ops, vp, mode, cred, fp)
+#define VOP_CLOSE(vp, fflag) \
+ vop_close(*(vp)->v_ops, vp, fflag)
+#define VOP_ACCESS(vp, mode, cred) \
+ vop_access(*(vp)->v_ops, vp, mode, cred)
+#define VOP_GETATTR(vp, vap) \
+ vop_getattr(*(vp)->v_ops, vp, vap)
+#define VOP_SETATTR(vp, vap, cred) \
+ vop_setattr(*(vp)->v_ops, vp, vap, cred)
#define VOP_READ(vp, uio, ioflag, cred) \
vop_read(*(vp)->v_ops, vp, uio, ioflag, cred)
#define VOP_WRITE(vp, uio, ioflag, cred) \
vop_write(*(vp)->v_ops, vp, uio, ioflag, cred)
-#define VOP_IOCTL(vp, command, data, fflag, cred, td) \
- vop_ioctl(*(vp)->v_ops, vp, command, data, fflag, cred, td)
-#define VOP_POLL(vp, events, cred, td) \
- vop_poll(*(vp)->v_ops, vp, events, cred, td)
+#define VOP_IOCTL(vp, command, data, fflag, cred) \
+ vop_ioctl(*(vp)->v_ops, vp, command, data, fflag, cred)
+#define VOP_POLL(vp, events, cred) \
+ vop_poll(*(vp)->v_ops, vp, events, cred)
#define VOP_KQFILTER(vp, kn) \
vop_kqfilter(*(vp)->v_ops, vp, kn)
#define VOP_REVOKE(vp, flags) \
vop_revoke(*(vp)->v_ops, vp, flags)
-#define VOP_MMAP(vp, fflags, cred, td) \
- vop_mmap(*(vp)->v_ops, vp, fflags, cred, td)
-#define VOP_FSYNC(vp, waitfor, td) \
- vop_fsync(*(vp)->v_ops, vp, waitfor, td)
+#define VOP_MMAP(vp, fflags, cred) \
+ vop_mmap(*(vp)->v_ops, vp, fflags, cred)
+#define VOP_FSYNC(vp, waitfor) \
+ vop_fsync(*(vp)->v_ops, vp, waitfor)
#define VOP_READDIR(vp, uio, cred, eofflag, ncookies, cookies) \
vop_readdir(*(vp)->v_ops, vp, uio, cred, eofflag, ncookies, cookies)
#define VOP_READLINK(vp, uio, cred) \
vop_readlink(*(vp)->v_ops, vp, uio, cred)
-#define VOP_INACTIVE(vp, td) \
- vop_inactive(*(vp)->v_ops, vp, td)
-#define VOP_RECLAIM(vp, td) \
- vop_reclaim(*(vp)->v_ops, vp, td)
+#define VOP_INACTIVE(vp) \
+ vop_inactive(*(vp)->v_ops, vp)
+#define VOP_RECLAIM(vp) \
+ vop_reclaim(*(vp)->v_ops, vp)
#define VOP_LOCK(vp, flags) \
vop_lock(*(vp)->v_ops, vp, flags)
#define VOP_UNLOCK(vp, flags) \
vop_putpages(*(vp)->v_ops, vp, m, count, sync, rtvals, off)
#define VOP_FREEBLKS(vp, offset, length) \
vop_freeblks(*(vp)->v_ops, vp, offset, length)
-#define VOP_GETACL(vp, type, aclp, cred, td) \
- vop_getacl(*(vp)->v_ops, vp, type, aclp, cred, td)
-#define VOP_SETACL(vp, type, aclp, cred, td) \
- vop_setacl(*(vp)->v_ops, vp, type, aclp, cred, td)
-#define VOP_ACLCHECK(vp, type, aclp, cred, td) \
- vop_aclcheck(*(vp)->v_ops, vp, type, aclp, cred, td)
-#define VOP_GETEXTATTR(vp, name, uio, cred, td) \
- vop_getextattr(*(vp)->v_ops, vp, name, uio, cred, td)
-#define VOP_SETEXTATTR(vp, name, uio, cred, td) \
- vop_setextattr(*(vp)->v_ops, vp, name, uio, cred, td)
+#define VOP_GETACL(vp, type, aclp, cred) \
+ vop_getacl(*(vp)->v_ops, vp, type, aclp, cred)
+#define VOP_SETACL(vp, type, aclp, cred) \
+ vop_setacl(*(vp)->v_ops, vp, type, aclp, cred)
+#define VOP_ACLCHECK(vp, type, aclp, cred) \
+ vop_aclcheck(*(vp)->v_ops, vp, type, aclp, cred)
+#define VOP_GETEXTATTR(vp, name, uio, cred) \
+ vop_getextattr(*(vp)->v_ops, vp, name, uio, cred)
+#define VOP_SETEXTATTR(vp, name, uio, cred) \
+ vop_setextattr(*(vp)->v_ops, vp, name, uio, cred)
/* no VOP_VFSSET() */
/* VOP_STRATEGY - does not exist, use vn_strategy() */
*
* @(#)vnode.h 8.7 (Berkeley) 2/4/94
* $FreeBSD: src/sys/sys/vnode.h,v 1.111.2.19 2002/12/29 18:19:53 dillon Exp $
- * $DragonFly: src/sys/sys/vnode.h,v 1.51 2006/05/05 21:15:09 dillon Exp $
+ * $DragonFly: src/sys/sys/vnode.h,v 1.52 2006/05/06 02:43:13 dillon Exp $
*/
#ifndef _SYS_VNODE_H_
void *data);
void insmntque(struct vnode *vp, struct mount *mp);
-void vclean (struct vnode *vp, int flags, struct thread *td);
+void vclean (struct vnode *vp, int flags);
void vgone (struct vnode *vp);
void vupdatefsmid (struct vnode *vp);
-int vinvalbuf (struct vnode *vp, int save,
- struct thread *td, int slpflag, int slptimeo);
-int vtruncbuf (struct vnode *vp, struct thread *td,
- off_t length, int blksize);
+int vinvalbuf (struct vnode *vp, int save, int slpflag, int slptimeo);
+int vtruncbuf (struct vnode *vp, off_t length, int blksize);
int vfsync(struct vnode *vp, int waitfor, int passes,
int (*checkdef)(struct buf *),
int (*waitoutput)(struct vnode *, struct thread *));
int vinitvmio(struct vnode *vp, off_t filesize);
void vprint (char *label, struct vnode *vp);
-int vrecycle (struct vnode *vp, struct thread *td);
+int vrecycle (struct vnode *vp);
void vn_strategy(struct vnode *vp, struct bio *bio);
-int vn_close (struct vnode *vp, int flags, struct thread *td);
+int vn_close (struct vnode *vp, int flags);
int vn_isdisk (struct vnode *vp, int *errp);
int vn_lock (struct vnode *vp, int flags);
#ifdef DEBUG_LOCKS
int vn_open (struct nlookupdata *ndp, struct file *fp, int fmode, int cmode);
void vn_pollevent (struct vnode *vp, int events);
void vn_pollgone (struct vnode *vp);
-int vn_pollrecord (struct vnode *vp, struct thread *td, int events);
+int vn_pollrecord (struct vnode *vp, int events);
int vn_rdwr (enum uio_rw rw, struct vnode *vp, caddr_t base,
int len, off_t offset, enum uio_seg segflg, int ioflg,
- struct ucred *cred, int *aresid, struct thread *td);
+ struct ucred *cred, int *aresid);
int vn_rdwr_inchunks (enum uio_rw rw, struct vnode *vp, caddr_t base,
int len, off_t offset, enum uio_seg segflg, int ioflg,
- struct ucred *cred, int *aresid, struct thread *td);
-int vn_stat (struct vnode *vp, struct stat *sb, struct thread *td);
+ struct ucred *cred, int *aresid);
+int vn_stat (struct vnode *vp, struct stat *sb, struct ucred *cred);
dev_t vn_todev (struct vnode *vp);
void vfs_timestamp (struct timespec *);
int vn_writechk (struct vnode *vp);
int vx_get (struct vnode *vp);
int vx_get_nonblock (struct vnode *vp);
void vx_put (struct vnode *vp);
-int vget (struct vnode *vp, int lockflag, struct thread *td);
+int vget (struct vnode *vp, int lockflag);
void vput (struct vnode *vp);
void vhold (struct vnode *);
void vdrop (struct vnode *);
*
* @(#) src/sys/coda/coda_fbsd.cr,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $FreeBSD: src/sys/coda/coda_fbsd.c,v 1.18 1999/09/25 18:23:43 phk Exp $
- * $DragonFly: src/sys/vfs/coda/Attic/coda_fbsd.c,v 1.10 2006/03/29 18:44:53 dillon Exp $
+ * $DragonFly: src/sys/vfs/coda/Attic/coda_fbsd.c,v 1.11 2006/05/06 02:43:13 dillon Exp $
*
*/
struct vop_getpages_args *ap = v;
int ret = 0;
-#if 1
- /* ??? a_offset */
- ret = vnode_pager_generic_getpages(ap->a_vp, ap->a_m, ap->a_count,
- ap->a_reqpage);
- return ret;
-#else
- {
- struct vnode *vp = ap->a_vp;
- struct cnode *cp = VTOC(vp);
- struct vnode *cfvp = cp->c_ovp;
- int opened_internally = 0;
- struct ucred *cred = (struct ucred *) 0;
- struct proc *p = curproc;
- int error = 0;
-
- if (IS_CTL_VP(vp)) {
- return(EINVAL);
- }
-
- /* Redirect the request to UFS. */
-
- if (cfvp == NULL) {
- opened_internally = 1;
-
- error = VOP_OPEN(vp, FREAD, cred, NULL, p);
-printf("coda_getp: Internally Opening %p\n", vp);
-
- if (error) {
- printf("coda_getpage: VOP_OPEN on container failed %d\n", error);
- return (error);
- }
- if (vp->v_type == VREG) {
- if (vp->v_object == NULL) {
- printf("coda_getpage: vp %p has no VM object\n", vp);
- vput(vp);
- return(EINVAL);
- }
- }
-
- cfvp = cp->c_ovp;
- } else {
-printf("coda_getp: has container %p\n", cfvp);
- }
-
-printf("coda_fbsd_getpages: using container ");
-/*
- error = vnode_pager_generic_getpages(cfvp, ap->a_m, ap->a_count,
- ap->a_reqpage);
-*/
- error = VOP_GETPAGES(cfvp, ap->a_m, ap->a_count,
- ap->a_reqpage, ap->a_offset);
-printf("error = %d\n", error);
-
- /* Do an internal close if necessary. */
- if (opened_internally) {
- VOP_CLOSE(vp, FREAD, cred, p);
- }
-
- return(error);
- }
-#endif
+ /* ??? a_offset */
+ ret = vnode_pager_generic_getpages(ap->a_vp, ap->a_m, ap->a_count,
+ ap->a_reqpage);
+ return ret;
}
int
*
* @(#) src/sys/cfs/coda_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $FreeBSD: src/sys/coda/coda_vfsops.c,v 1.24.2.1 2001/07/26 20:36:45 iedowse Exp $
- * $DragonFly: src/sys/vfs/coda/Attic/coda_vfsops.c,v 1.22 2005/07/26 15:43:35 hmp Exp $
+ * $DragonFly: src/sys/vfs/coda/Attic/coda_vfsops.c,v 1.23 2006/05/06 02:43:13 dillon Exp $
*
*/
{ /* Found valid root. */
*vpp = mi->mi_rootvp;
/* On Mach, this is vref. On NetBSD, VOP_LOCK */
- vget(*vpp, LK_EXCLUSIVE, td);
+ vget(*vpp, LK_EXCLUSIVE);
MARK_INT_SAT(CODA_ROOT_STATS);
return(0);
}
coda_save(VTOC(mi->mi_rootvp));
*vpp = mi->mi_rootvp;
- vget(*vpp, LK_EXCLUSIVE, td);
+ vget(*vpp, LK_EXCLUSIVE);
MARK_INT_SAT(CODA_ROOT_STATS);
goto exit;
* will fail.
*/
*vpp = mi->mi_rootvp;
- vget(*vpp, LK_EXCLUSIVE, td);
+ vget(*vpp, LK_EXCLUSIVE);
MARK_INT_FAIL(CODA_ROOT_STATS);
error = 0;
* Flush any pending I/O.
*/
int
-coda_sync(struct mount *vfsp, int waitfor, struct thread *td)
+coda_sync(struct mount *vfsp, int waitfor)
{
ENTRY;
MARK_ENTRY(CODA_SYNC_STATS);
*
* @(#) src/sys/cfs/coda_vfsops.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $FreeBSD: src/sys/coda/coda_vfsops.h,v 1.4 1999/08/28 00:40:57 peter Exp $
- * $DragonFly: src/sys/vfs/coda/Attic/coda_vfsops.h,v 1.5 2004/09/30 18:59:53 dillon Exp $
+ * $DragonFly: src/sys/vfs/coda/Attic/coda_vfsops.h,v 1.6 2006/05/06 02:43:13 dillon Exp $
*
*/
int coda_root(struct mount *, struct vnode **);
int coda_quotactl(struct mount *, int, uid_t, caddr_t, struct thread *);
int coda_nb_statfs(struct mount *, struct statfs *, struct thread *);
-int coda_sync(struct mount *, int, struct thread *);
+int coda_sync(struct mount *, int);
int coda_vget(struct mount *, ino_t, struct vnode **);
int coda_fhtovp(struct mount *, struct fid *, struct mbuf *, struct vnode **,
int *, struct ucred **);
*
* @(#) src/sys/coda/coda_vnops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $FreeBSD: src/sys/coda/coda_vnops.c,v 1.22.2.1 2001/06/29 16:26:22 shafeeq Exp $
- * $DragonFly: src/sys/vfs/coda/Attic/coda_vnops.c,v 1.37 2006/05/05 21:15:09 dillon Exp $
+ * $DragonFly: src/sys/vfs/coda/Attic/coda_vnops.c,v 1.38 2006/05/06 02:43:13 dillon Exp $
*
*/
#define UFS_BLKATOFF(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_blkatoff(aa, bb, cc, dd)
#define UFS_VALLOC(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_valloc(aa, bb, cc, dd)
#define UFS_VFREE(aa, bb, cc) VFSTOUFS((aa)->v_mount)->um_vfree(aa, bb, cc)
-#define UFS_TRUNCATE(aa, bb, cc, dd, ee) VFSTOUFS((aa)->v_mount)->um_truncate(aa, bb, cc, dd, ee)
+#define UFS_TRUNCATE(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_truncate(aa, bb, cc, dd)
#define UFS_UPDATE(aa, bb) VFSTOUFS((aa)->v_mount)->um_update(aa, bb)
missing
struct cnode *cp = VTOC(*vpp);
int flag = ap->a_mode & (~O_EXCL);
struct ucred *cred = ap->a_cred;
- struct thread *td = ap->a_td;
+ struct thread *td = curthread;
/* locals */
int error;
struct vnode *vp;
cp->c_inode = inode;
/* Open the cache file. */
- error = VOP_OPEN(vp, flag, cred, NULL, td);
+ error = VOP_OPEN(vp, flag, cred, NULL);
if (error) {
printf("coda_open: VOP_OPEN on container failed %d\n", error);
goto done;
struct vnode *vp = ap->a_vp;
struct cnode *cp = VTOC(vp);
int flag = ap->a_fflag;
- struct thread *td = ap->a_td;
+ struct thread *td = curthread;
/* locals */
int error;
#ifdef hmm
vgone(cp->c_ovp);
#else
- VOP_CLOSE(cp->c_ovp, flag, td); /* Do errors matter here? */
+ VOP_CLOSE(cp->c_ovp, flag); /* Do errors matter here? */
vrele(cp->c_ovp);
#endif
} else {
error = ENODEV;
goto done;
} else {
- VOP_CLOSE(cp->c_ovp, flag, td); /* Do errors matter here? */
+ VOP_CLOSE(cp->c_ovp, flag); /* Do errors matter here? */
vrele(cp->c_ovp);
}
else {
opened_internally = 1;
MARK_INT_GEN(CODA_OPEN_STATS);
- error = VOP_OPEN(vp, (rw == UIO_READ ? FREAD : FWRITE),
- cred, NULL, td);
+ error = VOP_OPEN(vp, (rw == UIO_READ ? FREAD : FWRITE), cred, NULL);
printf("coda_rdwr: Internally Opening %p\n", vp);
if (error) {
printf("coda_rdwr: VOP_OPEN on container failed %d\n", error);
{ struct vattr attr;
- if (VOP_GETATTR(cfvp, &attr, td) == 0) {
+ if (VOP_GETATTR(cfvp, &attr) == 0) {
vnode_pager_setsize(vp, attr.va_size);
}
}
/* Do an internal close if necessary. */
if (opened_internally) {
MARK_INT_GEN(CODA_CLOSE_STATS);
- VOP_CLOSE(vp, (rw == UIO_READ ? FREAD : FWRITE), td);
+ VOP_CLOSE(vp, (rw == UIO_READ ? FREAD : FWRITE));
}
/* Invalidate cached attributes if writing. */
caddr_t data = ap->a_data;
int flag = ap->a_fflag;
struct ucred *cred = ap->a_cred;
- struct thread *td = ap->a_td;
+ struct thread *td = curthread;
/* locals */
int error;
struct vnode *tvp;
struct vnode *vp = ap->a_vp;
struct cnode *cp = VTOC(vp);
struct vattr *vap = ap->a_vap;
- struct thread *td = ap->a_td;
+ struct thread *td = curthread;
/* locals */
int error;
struct cnode *cp = VTOC(vp);
struct vattr *vap = ap->a_vap;
struct ucred *cred = ap->a_cred;
- struct thread *td = ap->a_td;
+ struct thread *td = curthread;
/* locals */
int error;
struct cnode *cp = VTOC(vp);
int mode = ap->a_mode;
struct ucred *cred = ap->a_cred;
- struct thread *td = ap->a_td;
+ struct thread *td = curthread;
/* locals */
int error;
struct vop_fsync_args *ap = v;
struct vnode *vp = ap->a_vp;
struct cnode *cp = VTOC(vp);
- struct thread *td = ap->a_td;
+ struct thread *td = curthread;
/* locals */
struct vnode *convp = cp->c_ovp;
int error;
}
if (convp)
- VOP_FSYNC(convp, MNT_WAIT, td);
+ VOP_FSYNC(convp, MNT_WAIT);
/*
* We see fsyncs with usecount == 1 then usecount == 0.
int *eofflag = ap->a_eofflag;
u_long **cookies = ap->a_cookies;
int *ncookies = ap->a_ncookies;
- struct thread *td = ap->a_uio->uio_td;
/* upcall decl */
/* locals */
int error = 0;
if (cp->c_ovp == NULL) {
opened_internally = 1;
MARK_INT_GEN(CODA_OPEN_STATS);
- error = VOP_OPEN(vp, FREAD, cred, NULL, td);
+ error = VOP_OPEN(vp, FREAD, cred, NULL);
printf("coda_readdir: Internally Opening %p\n", vp);
if (error) {
printf("coda_readdir: VOP_OPEN on container failed %d\n", error);
/* Do an "internal close" if necessary. */
if (opened_internally) {
MARK_INT_GEN(CODA_CLOSE_STATS);
- VOP_CLOSE(vp, FREAD, td);
+ VOP_CLOSE(vp, FREAD);
}
}
* @(#)fdesc_vnops.c 8.9 (Berkeley) 1/21/94
*
* $FreeBSD: src/sys/miscfs/fdesc/fdesc_vnops.c,v 1.47.2.1 2001/10/22 22:49:26 chris Exp $
- * $DragonFly: src/sys/vfs/fdesc/fdesc_vnops.c,v 1.26 2006/05/05 21:15:09 dillon Exp $
+ * $DragonFly: src/sys/vfs/fdesc/fdesc_vnops.c,v 1.27 2006/05/06 02:43:13 dillon Exp $
*/
/*
loop:
LIST_FOREACH(fd, fc, fd_hash) {
if (fd->fd_ix == ix && fd->fd_vnode->v_mount == mp) {
- if (vget(fd->fd_vnode, LK_EXCLUSIVE|LK_SLEEPFAIL, td))
+ if (vget(fd->fd_vnode, LK_EXCLUSIVE|LK_SLEEPFAIL))
goto loop;
*vpp = fd->fd_vnode;
return (error);
}
/*
- * fdesc_open(struct vnode *a_vp, int a_mode, struct ucred *a_cred,
- * struct thread *a_td)
+ * fdesc_open(struct vnode *a_vp, int a_mode, struct ucred *a_cred)
*/
static int
fdesc_open(struct vop_open_args *ap)
{
struct vnode *vp = ap->a_vp;
- struct lwp *lp = ap->a_td->td_lwp;
+ struct lwp *lp = curthread->td_lwp;
KKASSERT(lp);
}
/*
- * fdesc_getattr(struct vnode *a_vp, struct vattr *a_vap,
- * struct ucred *a_cred, struct thread *a_td)
+ * fdesc_getattr(struct vnode *a_vp, struct vattr *a_vap, struct ucred *a_cred)
*/
static int
fdesc_getattr(struct vop_getattr_args *ap)
{
- struct proc *p = ap->a_td->td_proc;
+ struct proc *p = curproc;
struct vnode *vp = ap->a_vp;
struct vattr *vap = ap->a_vap;
struct filedesc *fdp;
return (EBADF);
bzero(&stb, sizeof(stb));
- error = fo_stat(fp, &stb, ap->a_td);
+ error = fo_stat(fp, &stb, curproc->p_ucred);
if (error == 0) {
VATTR_NULL(vap);
vap->va_type = IFTOVT(stb.st_mode);
static int
fdesc_setattr(struct vop_setattr_args *ap)
{
- struct proc *p = ap->a_td->td_proc;
+ struct proc *p = curproc;
struct vattr *vap = ap->a_vap;
struct file *fp;
unsigned fd;
static int
fdesc_poll(struct vop_poll_args *ap)
{
- return seltrue(0, ap->a_events, ap->a_td);
+ return seltrue(0, ap->a_events, curthread);
}
/*
*
* @(#)fifo_vnops.c 8.10 (Berkeley) 5/27/95
* $FreeBSD: src/sys/miscfs/fifofs/fifo_vnops.c,v 1.45.2.4 2003/04/22 10:11:24 bde Exp $
- * $DragonFly: src/sys/vfs/fifofs/fifo_vnops.c,v 1.27 2006/05/05 21:15:09 dillon Exp $
+ * $DragonFly: src/sys/vfs/fifofs/fifo_vnops.c,v 1.28 2006/05/06 02:43:13 dillon Exp $
*/
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
+#include <sys/thread2.h>
#include <sys/vnode.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/event.h>
#include <sys/poll.h>
#include <sys/un.h>
+
+#include <sys/thread2.h>
+
#include "fifo.h"
/*
static int
fifo_open(struct vop_open_args *ap)
{
+ struct thread *td = curthread;
struct vnode *vp = ap->a_vp;
struct fifoinfo *fip;
struct socket *rso, *wso;
if ((fip = vp->v_fifoinfo) == NULL) {
MALLOC(fip, struct fifoinfo *, sizeof(*fip), M_FIFOINFO, M_WAITOK);
vp->v_fifoinfo = fip;
- error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0, ap->a_td);
+ error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0, td);
if (error) {
free(fip, M_FIFOINFO);
vp->v_fifoinfo = NULL;
return (error);
}
fip->fi_readsock = rso;
- error = socreate(AF_LOCAL, &wso, SOCK_STREAM, 0, ap->a_td);
+ error = socreate(AF_LOCAL, &wso, SOCK_STREAM, 0, td);
if (error) {
soclose(rso);
free(fip, M_FIFOINFO);
return (vop_stdopen(ap));
bad:
vop_stdopen(ap); /* bump opencount/writecount as appropriate */
- VOP_CLOSE(vp, ap->a_mode, ap->a_td);
+ VOP_CLOSE(vp, ap->a_mode);
return (error);
}
return (0);
if (ap->a_fflag & FREAD) {
filetmp.f_data = ap->a_vp->v_fifoinfo->fi_readsock;
- error = soo_ioctl(&filetmp, ap->a_command, ap->a_data, ap->a_td);
+ error = soo_ioctl(&filetmp, ap->a_command, ap->a_data, ap->a_cred);
if (error)
return (error);
}
if (ap->a_fflag & FWRITE) {
filetmp.f_data = ap->a_vp->v_fifoinfo->fi_writesock;
- error = soo_ioctl(&filetmp, ap->a_command, ap->a_data, ap->a_td);
+ error = soo_ioctl(&filetmp, ap->a_command, ap->a_data, ap->a_cred);
if (error)
return (error);
}
filetmp.f_data = ap->a_vp->v_fifoinfo->fi_readsock;
if (filetmp.f_data)
- revents |= soo_poll(&filetmp, events, ap->a_cred,
- ap->a_td);
+ revents |= soo_poll(&filetmp, events, ap->a_cred);
/* Reverse the above conversion. */
if ((revents & POLLINIGNEOF) &&
if (events) {
filetmp.f_data = ap->a_vp->v_fifoinfo->fi_writesock;
if (filetmp.f_data)
- revents |= soo_poll(&filetmp, events, ap->a_cred,
- ap->a_td);
+ revents |= soo_poll(&filetmp, events, ap->a_cred);
}
return (revents);
}
*
* @(#)ffs_extern.h 8.3 (Berkeley) 4/16/94
* $FreeBSD: src/sys/gnu/ext2fs/ext2_extern.h,v 1.22.6.1 2000/11/05 19:17:40 bde Exp $
- * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_extern.h,v 1.10 2006/04/04 17:34:32 dillon Exp $
+ * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_extern.h,v 1.11 2006/05/06 02:43:13 dillon Exp $
*/
#ifndef _VFS_GNU_EXT2FS_EXT2_EXTERN_H_
int ext2_reallocblks (struct vop_reallocblks_args *);
int ext2_reclaim (struct vop_reclaim_args *);
void ext2_setblock (struct ext2_sb_info *, u_char *, daddr_t);
-int ext2_truncate (struct vnode *, off_t, int, struct ucred *, struct thread *);
+int ext2_truncate (struct vnode *, off_t, int, struct ucred *);
int ext2_update (struct vnode *, int);
int ext2_valloc (struct vnode *, int, struct ucred *, struct vnode **);
int ext2_vfree (struct vnode *, ino_t, int);
*
* @(#)ufs_ihash.c 8.7 (Berkeley) 5/17/95
* $FreeBSD: src/sys/ufs/ufs/ufs_ihash.c,v 1.20 1999/08/28 00:52:29 peter Exp $
- * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_ihash.c,v 1.1 2006/04/04 17:34:32 dillon Exp $
+ * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_ihash.c,v 1.2 2006/05/06 02:43:13 dillon Exp $
*/
#include <sys/param.h>
struct vnode *
ext2_ihashget(dev_t dev, ino_t inum)
{
- struct thread *td = curthread; /* XXX */
lwkt_tokref ilock;
struct inode *ip;
struct vnode *vp;
if (inum != ip->i_number || dev != ip->i_dev)
continue;
vp = ITOV(ip);
- &nb