Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148299347
D21299.id60956.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D21299.id60956.diff
View Options
Index: kern/vfs_default.c
===================================================================
--- kern/vfs_default.c
+++ kern/vfs_default.c
@@ -43,6 +43,7 @@
#include <sys/buf.h>
#include <sys/conf.h>
#include <sys/event.h>
+#include <sys/filio.h>
#include <sys/kernel.h>
#include <sys/limits.h>
#include <sys/lock.h>
@@ -86,6 +87,7 @@
static int vop_stdcopy_file_range(struct vop_copy_file_range_args *ap);
static int vop_stdfdatasync(struct vop_fdatasync_args *ap);
static int vop_stdgetpages_async(struct vop_getpages_async_args *ap);
+static int vop_stdioctl(struct vop_ioctl_args *ap);
/*
* This vnode table stores what we want to do if the filesystem doesn't
@@ -118,7 +120,7 @@
.vop_getpages_async = vop_stdgetpages_async,
.vop_getwritemount = vop_stdgetwritemount,
.vop_inactive = VOP_NULL,
- .vop_ioctl = VOP_ENOTTY,
+ .vop_ioctl = vop_stdioctl,
.vop_kqfilter = vop_stdkqfilter,
.vop_islocked = vop_stdislocked,
.vop_lock1 = vop_stdlock,
@@ -1131,6 +1133,41 @@
error = 0;
}
VI_UNLOCK(vp);
+ return (error);
+}
+
+static int
+vop_stdioctl(struct vop_ioctl_args *ap)
+{
+ struct vnode *vp;
+ struct vattr va;
+ off_t *offp;
+ int error;
+
+ switch (ap->a_command) {
+ case FIOSEEKDATA:
+ case FIOSEEKHOLE:
+ vp = ap->a_vp;
+ error = vn_lock(vp, LK_SHARED);
+ if (error != 0)
+ return (EBADF);
+ if (vp->v_type == VREG)
+ error = VOP_GETATTR(vp, &va, ap->a_cred);
+ else
+ error = ENOTTY;
+ if (error == 0) {
+ offp = ap->a_data;
+ if (*offp < 0 || *offp >= va.va_size)
+ error = ENXIO;
+ else if (ap->a_command == FIOSEEKHOLE)
+ *offp = va.va_size;
+ }
+ VOP_UNLOCK(vp, 0);
+ break;
+ default:
+ error = ENOTTY;
+ break;
+ }
return (error);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 18, 1:23 AM (8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29866294
Default Alt Text
D21299.id60956.diff (1 KB)
Attached To
Mode
D21299: Add a vop_stdioctl() that does the trivial algorithm for FIOSEEKDATA/FIOSEEKHOLE
Attached
Detach File
Event Timeline
Log In to Comment