Added set_flags() support where needed. devfs now uses the ioctl() mechanism

via B_SET_(NON)BLOCKING_IO to notify the device about any access mode changes.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9199 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2004-10-05 13:24:12 +00:00
parent 752c2e981e
commit c7a0c0f9e1
4 changed files with 30 additions and 0 deletions
+1
View File
@@ -977,6 +977,7 @@ file_system_info gBootFileSystem = {
/* common */
&bootfs_ioctl,
NULL, // set_flags
&bootfs_fsync,
NULL, // read_link
+17
View File
@@ -1138,6 +1138,22 @@ devfs_ioctl(fs_volume _fs, fs_vnode _vnode, fs_cookie _cookie, ulong op, void *b
}
static status_t
devfs_set_flags(fs_volume _fs, fs_vnode _vnode, fs_cookie _cookie, int flags)
{
struct devfs_vnode *vnode = (struct devfs_vnode *)_vnode;
struct devfs_cookie *cookie = (struct devfs_cookie *)_cookie;
// we need to pass the O_NONBLOCK flag to the underlying device
if (!S_ISCHR(vnode->stream.type))
return B_NOT_ALLOWED;
return vnode->stream.u.dev.info->control(cookie->u.dev.dcookie, flags & O_NONBLOCK ?
B_SET_NONBLOCKING_IO : B_SET_BLOCKING_IO, NULL, 0);
}
static bool
devfs_can_page(fs_volume _fs, fs_vnode _vnode, fs_cookie cookie)
{
@@ -1360,6 +1376,7 @@ file_system_info gDeviceFileSystem = {
/* common */
&devfs_ioctl,
&devfs_set_flags,
&devfs_fsync,
NULL, // read_link
+11
View File
@@ -1289,6 +1289,16 @@ pipefs_ioctl(fs_volume _volume, fs_vnode _vnode, fs_cookie _cookie, ulong op,
}
static status_t
pipefs_set_flags(fs_volume _volume, fs_vnode _vnode, fs_cookie _cookie, int flags)
{
file_cookie *cookie = (file_cookie *)_cookie;
cookie->open_mode = (cookie->open_mode & ~(O_APPEND | O_NONBLOCK)) | flags;
return B_OK;
}
static bool
pipefs_can_page(fs_volume _volume, fs_vnode _v, fs_cookie cookie)
{
@@ -1432,6 +1442,7 @@ file_system_info gPipeFileSystem = {
/* common */
&pipefs_ioctl,
&pipefs_set_flags,
&pipefs_fsync,
NULL, // fs_read_link()
+1
View File
@@ -1021,6 +1021,7 @@ file_system_info gRootFileSystem = {
/* common */
&rootfs_ioctl,
NULL, // fs_set_flags()
&rootfs_fsync,
&rootfs_read_link,