diff options
author | jhb <jhb@FreeBSD.org> | 2014-09-12 21:29:10 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2014-09-12 21:29:10 +0000 |
commit | 4cd91e9d81f8eee5a5ab7b6250d49c03383d1b96 (patch) | |
tree | fc1dbe779c09eb00d34cdab6782e26b3e78ede72 /sys/opencrypto/cryptodev.c | |
parent | 94540ef6a561ec6b2ed88ec5b146d1a6a0b9a297 (diff) | |
download | FreeBSD-src-4cd91e9d81f8eee5a5ab7b6250d49c03383d1b96.zip FreeBSD-src-4cd91e9d81f8eee5a5ab7b6250d49c03383d1b96.tar.gz |
Fix various issues with invalid file operations:
- Add invfo_rdwr() (for read and write), invfo_ioctl(), invfo_poll(),
and invfo_kqfilter() for use by file types that do not support the
respective operations. Home-grown versions of invfo_poll() were
universally broken (they returned an errno value, invfo_poll()
uses poll_no_poll() to return an appropriate event mask). Home-grown
ioctl routines also tended to return an incorrect errno (invfo_ioctl
returns ENOTTY).
- Use the invfo_*() functions instead of local versions for
unsupported file operations.
- Reorder fileops members to match the order in the structure definition
to make it easier to spot missing members.
- Add several missing methods to linuxfileops used by the OFED shim
layer: fo_write(), fo_truncate(), fo_kqfilter(), and fo_stat(). Most
of these used invfo_*(), but a dummy fo_stat() implementation was
added.
Diffstat (limited to 'sys/opencrypto/cryptodev.c')
-rw-r--r-- | sys/opencrypto/cryptodev.c | 59 |
1 files changed, 5 insertions, 54 deletions
diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index 4d16833..778a670 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -281,25 +281,19 @@ struct fcrypt { int sesn; }; -static int cryptof_rw(struct file *fp, struct uio *uio, - struct ucred *cred, int flags, struct thread *); -static int cryptof_truncate(struct file *, off_t, struct ucred *, - struct thread *); static int cryptof_ioctl(struct file *, u_long, void *, struct ucred *, 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 ucred *, struct thread *); static int cryptof_close(struct file *, struct thread *); static struct fileops cryptofops = { - .fo_read = cryptof_rw, - .fo_write = cryptof_rw, - .fo_truncate = cryptof_truncate, + .fo_read = invfo_rdwr, + .fo_write = invfo_rdwr, + .fo_truncate = invfo_truncate, .fo_ioctl = cryptof_ioctl, - .fo_poll = cryptof_poll, - .fo_kqfilter = cryptof_kqfilter, + .fo_poll = invfo_poll, + .fo_kqfilter = invfo_kqfilter, .fo_stat = cryptof_stat, .fo_close = cryptof_close, .fo_chmod = invfo_chmod, @@ -320,29 +314,6 @@ static int cryptodev_op(struct csession *, struct crypt_op *, static int cryptodev_key(struct crypt_kop *); static int cryptodev_find(struct crypt_find_op *); -static int -cryptof_rw( - struct file *fp, - struct uio *uio, - struct ucred *active_cred, - int flags, - struct thread *td) -{ - - return (EIO); -} - -static int -cryptof_truncate( - struct file *fp, - off_t length, - struct ucred *active_cred, - struct thread *td) -{ - - return (EINVAL); -} - /* * Check a crypto identifier to see if it requested * a software device/driver. This can be done either @@ -961,26 +932,6 @@ cryptodev_find(struct crypt_find_op *find) /* ARGSUSED */ static int -cryptof_poll( - struct file *fp, - int events, - struct ucred *active_cred, - struct thread *td) -{ - - return (0); -} - -/* ARGSUSED */ -static int -cryptof_kqfilter(struct file *fp, struct knote *kn) -{ - - return (0); -} - -/* ARGSUSED */ -static int cryptof_stat( struct file *fp, struct stat *sb, |