aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2014-09-12 21:29:10 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2014-09-12 21:29:10 +0000
commit2d69d0dcc2bb94d874dd0fa77d53b08112b9d530 (patch)
treefc1dbe779c09eb00d34cdab6782e26b3e78ede72
parentcd550b9b521ba1403f48a6a8e8d67061c7526874 (diff)
Notes
-rw-r--r--sys/kern/kern_descrip.c31
-rw-r--r--sys/kern/kern_event.c38
-rw-r--r--sys/kern/sys_procdesc.c65
-rw-r--r--sys/kern/tty_pts.c10
-rw-r--r--sys/kern/uipc_mqueue.c39
-rw-r--r--sys/kern/uipc_sem.c65
-rw-r--r--sys/kern/uipc_shm.c32
-rw-r--r--sys/ofed/include/linux/linux_compat.c14
-rw-r--r--sys/opencrypto/cryptodev.c59
-rw-r--r--sys/sys/file.h6
10 files changed, 78 insertions, 281 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 6d15c474ee0e..b6fcc7636705 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -3941,6 +3941,14 @@ struct fileops badfileops = {
};
int
+invfo_rdwr(struct file *fp, struct uio *uio, struct ucred *active_cred,
+ int flags, struct thread *td)
+{
+
+ return (EOPNOTSUPP);
+}
+
+int
invfo_truncate(struct file *fp, off_t length, struct ucred *active_cred,
struct thread *td)
{
@@ -3949,6 +3957,29 @@ invfo_truncate(struct file *fp, off_t length, struct ucred *active_cred,
}
int
+invfo_ioctl(struct file *fp, u_long com, void *data,
+ struct ucred *active_cred, struct thread *td)
+{
+
+ return (ENOTTY);
+}
+
+int
+invfo_poll(struct file *fp, int events, struct ucred *active_cred,
+ struct thread *td)
+{
+
+ return (poll_no_poll(events));
+}
+
+int
+invfo_kqfilter(struct file *fp, struct knote *kn)
+{
+
+ return (EINVAL);
+}
+
+int
invfo_chmod(struct file *fp, mode_t mode, struct ucred *active_cred,
struct thread *td)
{
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index fc256f120525..36ec19ed815c 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -109,9 +109,6 @@ static void kqueue_wakeup(struct kqueue *kq);
static struct filterops *kqueue_fo_find(int filt);
static void kqueue_fo_release(int filt);
-static fo_rdwr_t kqueue_read;
-static fo_rdwr_t kqueue_write;
-static fo_truncate_t kqueue_truncate;
static fo_ioctl_t kqueue_ioctl;
static fo_poll_t kqueue_poll;
static fo_kqfilter_t kqueue_kqfilter;
@@ -119,9 +116,9 @@ static fo_stat_t kqueue_stat;
static fo_close_t kqueue_close;
static struct fileops kqueueops = {
- .fo_read = kqueue_read,
- .fo_write = kqueue_write,
- .fo_truncate = kqueue_truncate,
+ .fo_read = invfo_rdwr,
+ .fo_write = invfo_rdwr,
+ .fo_truncate = invfo_truncate,
.fo_ioctl = kqueue_ioctl,
.fo_poll = kqueue_poll,
.fo_kqfilter = kqueue_kqfilter,
@@ -1602,35 +1599,6 @@ done_nl:
return (error);
}
-/*
- * XXX
- * This could be expanded to call kqueue_scan, if desired.
- */
-/*ARGSUSED*/
-static int
-kqueue_read(struct file *fp, struct uio *uio, struct ucred *active_cred,
- int flags, struct thread *td)
-{
- return (ENXIO);
-}
-
-/*ARGSUSED*/
-static int
-kqueue_write(struct file *fp, struct uio *uio, struct ucred *active_cred,
- int flags, struct thread *td)
-{
- return (ENXIO);
-}
-
-/*ARGSUSED*/
-static int
-kqueue_truncate(struct file *fp, off_t length, struct ucred *active_cred,
- struct thread *td)
-{
-
- return (EINVAL);
-}
-
/*ARGSUSED*/
static int
kqueue_ioctl(struct file *fp, u_long cmd, void *data,
diff --git a/sys/kern/sys_procdesc.c b/sys/kern/sys_procdesc.c
index 1039dac6e2a8..9bdca9a1f6d5 100644
--- a/sys/kern/sys_procdesc.c
+++ b/sys/kern/sys_procdesc.c
@@ -87,28 +87,22 @@ FEATURE(process_descriptors, "Process Descriptors");
static uma_zone_t procdesc_zone;
-static fo_rdwr_t procdesc_read;
-static fo_rdwr_t procdesc_write;
-static fo_truncate_t procdesc_truncate;
-static fo_ioctl_t procdesc_ioctl;
static fo_poll_t procdesc_poll;
static fo_kqfilter_t procdesc_kqfilter;
static fo_stat_t procdesc_stat;
static fo_close_t procdesc_close;
-static fo_chmod_t procdesc_chmod;
-static fo_chown_t procdesc_chown;
static struct fileops procdesc_ops = {
- .fo_read = procdesc_read,
- .fo_write = procdesc_write,
- .fo_truncate = procdesc_truncate,
- .fo_ioctl = procdesc_ioctl,
+ .fo_read = invfo_rdwr,
+ .fo_write = invfo_rdwr,
+ .fo_truncate = invfo_truncate,
+ .fo_ioctl = invfo_ioctl,
.fo_poll = procdesc_poll,
.fo_kqfilter = procdesc_kqfilter,
.fo_stat = procdesc_stat,
.fo_close = procdesc_close,
- .fo_chmod = procdesc_chmod,
- .fo_chown = procdesc_chown,
+ .fo_chmod = invfo_chmod,
+ .fo_chown = invfo_chown,
.fo_sendfile = invfo_sendfile,
.fo_flags = DFLAG_PASSABLE,
};
@@ -413,38 +407,6 @@ procdesc_close(struct file *fp, struct thread *td)
}
static int
-procdesc_read(struct file *fp, struct uio *uio, struct ucred *active_cred,
- int flags, struct thread *td)
-{
-
- return (EOPNOTSUPP);
-}
-
-static int
-procdesc_write(struct file *fp, struct uio *uio, struct ucred *active_cred,
- int flags, struct thread *td)
-{
-
- return (EOPNOTSUPP);
-}
-
-static int
-procdesc_truncate(struct file *fp, off_t length, struct ucred *active_cred,
- struct thread *td)
-{
-
- return (EOPNOTSUPP);
-}
-
-static int
-procdesc_ioctl(struct file *fp, u_long com, void *data,
- struct ucred *active_cred, struct thread *td)
-{
-
- return (EOPNOTSUPP);
-}
-
-static int
procdesc_poll(struct file *fp, int events, struct ucred *active_cred,
struct thread *td)
{
@@ -569,18 +531,3 @@ procdesc_stat(struct file *fp, struct stat *sb, struct ucred *active_cred,
return (0);
}
-static int
-procdesc_chmod(struct file *fp, mode_t mode, struct ucred *active_cred,
- struct thread *td)
-{
-
- return (EOPNOTSUPP);
-}
-
-static int
-procdesc_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred,
- struct thread *td)
-{
-
- return (EOPNOTSUPP);
-}
diff --git a/sys/kern/tty_pts.c b/sys/kern/tty_pts.c
index 8d2ac0324b35..16cbb3c56f5f 100644
--- a/sys/kern/tty_pts.c
+++ b/sys/kern/tty_pts.c
@@ -253,14 +253,6 @@ done: ttydisc_rint_done(tp);
}
static int
-ptsdev_truncate(struct file *fp, off_t length, struct ucred *active_cred,
- struct thread *td)
-{
-
- return (EINVAL);
-}
-
-static int
ptsdev_ioctl(struct file *fp, u_long cmd, void *data,
struct ucred *active_cred, struct thread *td)
{
@@ -591,7 +583,7 @@ ptsdev_close(struct file *fp, struct thread *td)
static struct fileops ptsdev_ops = {
.fo_read = ptsdev_read,
.fo_write = ptsdev_write,
- .fo_truncate = ptsdev_truncate,
+ .fo_truncate = invfo_truncate,
.fo_ioctl = ptsdev_ioctl,
.fo_poll = ptsdev_poll,
.fo_kqfilter = ptsdev_kqfilter,
diff --git a/sys/kern/uipc_mqueue.c b/sys/kern/uipc_mqueue.c
index 8ddf356488af..24d5ada5f4f9 100644
--- a/sys/kern/uipc_mqueue.c
+++ b/sys/kern/uipc_mqueue.c
@@ -2418,35 +2418,6 @@ mq_proc_exit(void *arg __unused, struct proc *p)
}
static int
-mqf_read(struct file *fp, struct uio *uio, struct ucred *active_cred,
- int flags, struct thread *td)
-{
- return (EOPNOTSUPP);
-}
-
-static int
-mqf_write(struct file *fp, struct uio *uio, struct ucred *active_cred,
- int flags, struct thread *td)
-{
- return (EOPNOTSUPP);
-}
-
-static int
-mqf_truncate(struct file *fp, off_t length, struct ucred *active_cred,
- struct thread *td)
-{
-
- return (EINVAL);
-}
-
-static int
-mqf_ioctl(struct file *fp, u_long cmd, void *data,
- struct ucred *active_cred, struct thread *td)
-{
- return (ENOTTY);
-}
-
-static int
mqf_poll(struct file *fp, int events, struct ucred *active_cred,
struct thread *td)
{
@@ -2601,16 +2572,16 @@ filt_mqwrite(struct knote *kn, long hint)
}
static struct fileops mqueueops = {
- .fo_read = mqf_read,
- .fo_write = mqf_write,
- .fo_truncate = mqf_truncate,
- .fo_ioctl = mqf_ioctl,
+ .fo_read = invfo_rdwr,
+ .fo_write = invfo_rdwr,
+ .fo_truncate = invfo_truncate,
+ .fo_ioctl = invfo_ioctl,
.fo_poll = mqf_poll,
.fo_kqfilter = mqf_kqfilter,
.fo_stat = mqf_stat,
+ .fo_close = mqf_close,
.fo_chmod = mqf_chmod,
.fo_chown = mqf_chown,
- .fo_close = mqf_close,
.fo_sendfile = invfo_sendfile,
};
diff --git a/sys/kern/uipc_sem.c b/sys/kern/uipc_sem.c
index b957d9bf49dc..593c2a368e22 100644
--- a/sys/kern/uipc_sem.c
+++ b/sys/kern/uipc_sem.c
@@ -126,12 +126,6 @@ static int ksem_module_init(void);
static int ksem_remove(char *path, Fnv32_t fnv, struct ucred *ucred);
static int sem_modload(struct module *module, int cmd, void *arg);
-static fo_rdwr_t ksem_read;
-static fo_rdwr_t ksem_write;
-static fo_truncate_t ksem_truncate;
-static fo_ioctl_t ksem_ioctl;
-static fo_poll_t ksem_poll;
-static fo_kqfilter_t ksem_kqfilter;
static fo_stat_t ksem_stat;
static fo_close_t ksem_closef;
static fo_chmod_t ksem_chmod;
@@ -139,12 +133,12 @@ static fo_chown_t ksem_chown;
/* File descriptor operations. */
static struct fileops ksem_ops = {
- .fo_read = ksem_read,
- .fo_write = ksem_write,
- .fo_truncate = ksem_truncate,
- .fo_ioctl = ksem_ioctl,
- .fo_poll = ksem_poll,
- .fo_kqfilter = ksem_kqfilter,
+ .fo_read = invfo_rdwr,
+ .fo_write = invfo_rdwr,
+ .fo_truncate = invfo_truncate,
+ .fo_ioctl = invfo_ioctl,
+ .fo_poll = invfo_poll,
+ .fo_kqfilter = invfo_kqfilter,
.fo_stat = ksem_stat,
.fo_close = ksem_closef,
.fo_chmod = ksem_chmod,
@@ -156,53 +150,6 @@ static struct fileops ksem_ops = {
FEATURE(posix_sem, "POSIX semaphores");
static int
-ksem_read(struct file *fp, struct uio *uio, struct ucred *active_cred,
- int flags, struct thread *td)
-{
-
- return (EOPNOTSUPP);
-}
-
-static int
-ksem_write(struct file *fp, struct uio *uio, struct ucred *active_cred,
- int flags, struct thread *td)
-{
-
- return (EOPNOTSUPP);
-}
-
-static int
-ksem_truncate(struct file *fp, off_t length, struct ucred *active_cred,
- struct thread *td)
-{
-
- return (EINVAL);
-}
-
-static int
-ksem_ioctl(struct file *fp, u_long com, void *data,
- struct ucred *active_cred, struct thread *td)
-{
-
- return (EOPNOTSUPP);
-}
-
-static int
-ksem_poll(struct file *fp, int events, struct ucred *active_cred,
- struct thread *td)
-{
-
- return (EOPNOTSUPP);
-}
-
-static int
-ksem_kqfilter(struct file *fp, struct knote *kn)
-{
-
- return (EOPNOTSUPP);
-}
-
-static int
ksem_stat(struct file *fp, struct stat *sb, struct ucred *active_cred,
struct thread *td)
{
diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c
index 435b8e10be23..9a558bec1fd8 100644
--- a/sys/kern/uipc_shm.c
+++ b/sys/kern/uipc_shm.c
@@ -120,9 +120,6 @@ static int shm_dotruncate(struct shmfd *shmfd, off_t length);
static fo_rdwr_t shm_read;
static fo_rdwr_t shm_write;
static fo_truncate_t shm_truncate;
-static fo_ioctl_t shm_ioctl;
-static fo_poll_t shm_poll;
-static fo_kqfilter_t shm_kqfilter;
static fo_stat_t shm_stat;
static fo_close_t shm_close;
static fo_chmod_t shm_chmod;
@@ -134,9 +131,9 @@ static struct fileops shm_ops = {
.fo_read = shm_read,
.fo_write = shm_write,
.fo_truncate = shm_truncate,
- .fo_ioctl = shm_ioctl,
- .fo_poll = shm_poll,
- .fo_kqfilter = shm_kqfilter,
+ .fo_ioctl = invfo_ioctl,
+ .fo_poll = invfo_poll,
+ .fo_kqfilter = invfo_kqfilter,
.fo_stat = shm_stat,
.fo_close = shm_close,
.fo_chmod = shm_chmod,
@@ -355,29 +352,6 @@ shm_truncate(struct file *fp, off_t length, struct ucred *active_cred,
}
static int
-shm_ioctl(struct file *fp, u_long com, void *data,
- struct ucred *active_cred, struct thread *td)
-{
-
- return (EOPNOTSUPP);
-}
-
-static int
-shm_poll(struct file *fp, int events, struct ucred *active_cred,
- struct thread *td)
-{
-
- return (EOPNOTSUPP);
-}
-
-static int
-shm_kqfilter(struct file *fp, struct knote *kn)
-{
-
- return (EOPNOTSUPP);
-}
-
-static int
shm_stat(struct file *fp, struct stat *sb, struct ucred *active_cred,
struct thread *td)
{
diff --git a/sys/ofed/include/linux/linux_compat.c b/sys/ofed/include/linux/linux_compat.c
index e8e73c065403..f67039109a09 100644
--- a/sys/ofed/include/linux/linux_compat.c
+++ b/sys/ofed/include/linux/linux_compat.c
@@ -568,11 +568,23 @@ linux_file_ioctl(struct file *fp, u_long cmd, void *data, struct ucred *cred,
return (error);
}
+static int
+linux_file_stat(struct file *fp, struct stat *sb, struct ucred *active_cred,
+ struct thread *td)
+{
+
+ return (EOPNOTSUPP);
+}
+
struct fileops linuxfileops = {
.fo_read = linux_file_read,
+ .fo_write = invfo_rdwr,
+ .fo_truncate = invfo_truncate,
+ .fo_ioctl = linux_file_ioctl,
.fo_poll = linux_file_poll,
+ .fo_kqfilter = invfo_kqfilter,
+ .fo_stat = linux_file_stat,
.fo_close = linux_file_close,
- .fo_ioctl = linux_file_ioctl,
.fo_chmod = invfo_chmod,
.fo_chown = invfo_chown,
.fo_sendfile = invfo_sendfile,
diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c
index 4d16833cf0f1..778a6709cd43 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,
diff --git a/sys/sys/file.h b/sys/sys/file.h
index 63072e0a03cf..92f125f839a4 100644
--- a/sys/sys/file.h
+++ b/sys/sys/file.h
@@ -231,10 +231,14 @@ int fget_write(struct thread *td, int fd, cap_rights_t *rightsp,
struct file **fpp);
int _fdrop(struct file *fp, struct thread *td);
+fo_rdwr_t invfo_rdwr;
+fo_truncate_t invfo_truncate;
+fo_ioctl_t invfo_ioctl;
+fo_poll_t invfo_poll;
+fo_kqfilter_t invfo_kqfilter;
fo_chmod_t invfo_chmod;
fo_chown_t invfo_chown;
fo_sendfile_t invfo_sendfile;
-fo_truncate_t invfo_truncate;
fo_sendfile_t vn_sendfile;
fo_seek_t vn_seek;