X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/blobdiff_plain/908b5ff6c75734cb1c729163dc81aa9e670aea44..dadab5e9782225b1752766daee5c789e2266b933:/sys/opencrypto/cryptodev.c diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index badac03684..f319a36aa3 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -1,5 +1,5 @@ /* $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.2 2003/06/17 04:28:54 dillon Exp $ */ +/* $DragonFly: src/sys/opencrypto/cryptodev.c,v 1.3 2003/06/25 03:56:08 dillon Exp $ */ /* $OpenBSD: cryptodev.c,v 1.52 2002/06/19 07:22:46 deraadt Exp $ */ /* @@ -47,6 +47,8 @@ #include #include #include +#include +#include #include #include @@ -80,12 +82,12 @@ struct fcrypt { }; static int cryptof_rw(struct file *fp, struct uio *uio, - struct ucred *cred, int flags, struct proc *); -static int cryptof_ioctl(struct file *, u_long, caddr_t, struct proc *); -static int cryptof_poll(struct file *, int, struct ucred *, struct proc *); + 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 *); static int cryptof_kqfilter(struct file *, struct knote *); -static int cryptof_stat(struct file *, struct stat *, struct proc *); -static int cryptof_close(struct file *, struct proc *); +static int cryptof_stat(struct file *, struct stat *, struct thread *); +static int cryptof_close(struct file *, struct thread *); static struct fileops cryptofops = { cryptof_rw, @@ -106,7 +108,7 @@ static struct csession *csecreate(struct fcrypt *, u_int64_t, caddr_t, static int csefree(struct csession *); static int cryptodev_op(struct csession *, struct crypt_op *, - struct proc *p); + struct thread *td); static int cryptodev_key(struct crypt_kop *); static int @@ -115,7 +117,7 @@ cryptof_rw( struct uio *uio, struct ucred *active_cred, int flags, - struct proc *p) + struct thread *td) { return (EIO); @@ -127,7 +129,7 @@ cryptof_ioctl( struct file *fp, u_long cmd, caddr_t data, - struct proc *p) + struct thread *td) { struct cryptoini cria, crie; struct fcrypt *fcr = (struct fcrypt *)fp->f_data; @@ -285,7 +287,7 @@ bail: cse = csefind(fcr, cop->ses); if (cse == NULL) return (EINVAL); - error = cryptodev_op(cse, cop, p); + error = cryptodev_op(cse, cop, td); break; case CIOCKEY: error = cryptodev_key((struct crypt_kop *)data); @@ -306,7 +308,7 @@ static int cryptodev_op( struct csession *cse, struct crypt_op *cop, - struct proc *p) + struct thread *td) { struct cryptop *crp = NULL; struct cryptodesc *crde = NULL, *crda = NULL; @@ -323,7 +325,7 @@ cryptodev_op( cse->uio.uio_resid = 0; cse->uio.uio_segflg = UIO_SYSSPACE; cse->uio.uio_rw = UIO_WRITE; - cse->uio.uio_procp = p; + cse->uio.uio_td = td; cse->uio.uio_iov = cse->iovec; bzero(&cse->iovec, sizeof(cse->iovec)); cse->uio.uio_iov[0].iov_len = cop->len; @@ -572,7 +574,7 @@ cryptof_poll( struct file *fp, int events, struct ucred *active_cred, - struct proc *p) + struct thread *td) { return (0); @@ -591,7 +593,7 @@ static int cryptof_stat( struct file *fp, struct stat *sb, - struct proc *p) + struct thread *td) { return (EOPNOTSUPP); @@ -599,7 +601,7 @@ cryptof_stat( /* ARGSUSED */ static int -cryptof_close(struct file *fp, struct proc *p) +cryptof_close(struct file *fp, struct thread *td) { struct fcrypt *fcr = (struct fcrypt *)fp->f_data; struct csession *cse; @@ -685,7 +687,7 @@ csefree(struct csession *cse) } static int -cryptoopen(dev_t dev, int oflags, int devtype, struct proc *p) +cryptoopen(dev_t dev, int oflags, int devtype, struct thread *td) { if (crypto_usercrypto == 0) return (ENXIO); @@ -705,7 +707,7 @@ cryptowrite(dev_t dev, struct uio *uio, int ioflag) } static int -cryptoioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) +cryptoioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) { struct file *f; struct fcrypt *fcr; @@ -717,7 +719,8 @@ cryptoioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) TAILQ_INIT(&fcr->csessions); fcr->sesn = 0; - error = falloc(p, &f, &fd); + KKASSERT(td->td_proc); + error = falloc(td->td_proc, &f, &fd); if (error) { FREE(fcr, M_XDATA); @@ -729,7 +732,7 @@ cryptoioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) f->f_ops = &cryptofops; f->f_data = (caddr_t) fcr; *(u_int32_t *)data = fd; - fdrop(f, p); + fdrop(f, td); break; default: error = EINVAL;