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.
This commit is contained in:
+5
-34
@@ -2417,35 +2417,6 @@ mq_proc_exit(void *arg __unused, struct proc *p)
|
||||
KASSERT(LIST_EMPTY(&p->p_mqnotifier), ("mq notifiers left"));
|
||||
}
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user