aboutsummaryrefslogtreecommitdiff
path: root/sys/ofed
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 /sys/ofed
parentcd550b9b521ba1403f48a6a8e8d67061c7526874 (diff)
downloadsrc-2d69d0dcc2bb94d874dd0fa77d53b08112b9d530.tar.gz
src-2d69d0dcc2bb94d874dd0fa77d53b08112b9d530.zip
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.
Notes
Notes: svn path=/head/; revision=271489
Diffstat (limited to 'sys/ofed')
-rw-r--r--sys/ofed/include/linux/linux_compat.c14
1 files changed, 13 insertions, 1 deletions
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,