[haiku-commits] r37842 - haiku/trunk/src/system/kernel/fs

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 2 Aug 2010 16:17:35 +0200 (CEST)

Author: axeld
Date: 2010-08-02 16:17:35 +0200 (Mon, 02 Aug 2010)
New Revision: 37842
Changeset: http://dev.haiku-os.org/changeset/37842

Modified:
   haiku/trunk/src/system/kernel/fs/fd.cpp
   haiku/trunk/src/system/kernel/fs/vfs.cpp
Log:
* Changed some POSIX error codes to native ones.


Modified: haiku/trunk/src/system/kernel/fs/fd.cpp
===================================================================
--- haiku/trunk/src/system/kernel/fs/fd.cpp     2010-08-02 12:48:30 UTC (rev 
37841)
+++ haiku/trunk/src/system/kernel/fs/fd.cpp     2010-08-02 14:17:35 UTC (rev 
37842)
@@ -1,6 +1,6 @@
 /*
  * Copyright 2009, Ingo Weinhold, ingo_weinhold@xxxxxxx
- * Copyright 2002-2009, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
+ * Copyright 2002-2010, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
  * Distributed under the terms of the MIT License.
  */
 
@@ -518,7 +518,7 @@
        if (descriptor->ops->fd_ioctl)
                status = descriptor->ops->fd_ioctl(descriptor, op, buffer, 
length);
        else
-               status = EOPNOTSUPP;
+               status = B_NOT_SUPPORTED;
 
        put_fd(descriptor);
        return status;
@@ -987,7 +987,7 @@
        if (descriptor->ops->fd_rewind_dir)
                status = descriptor->ops->fd_rewind_dir(descriptor);
        else
-               status = EOPNOTSUPP;
+               status = B_NOT_SUPPORTED;
 
        put_fd(descriptor);
        return status;
@@ -1260,7 +1260,7 @@
                if (retval >= 0)
                        retval = count;
        } else
-               retval = EOPNOTSUPP;
+               retval = B_NOT_SUPPORTED;
 
        put_fd(descriptor);
        return retval;
@@ -1282,7 +1282,7 @@
        if (descriptor->ops->fd_rewind_dir)
                status = descriptor->ops->fd_rewind_dir(descriptor);
        else
-               status = EOPNOTSUPP;
+               status = B_NOT_SUPPORTED;
 
        put_fd(descriptor);
        return status;

Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp
===================================================================
--- haiku/trunk/src/system/kernel/fs/vfs.cpp    2010-08-02 12:48:30 UTC (rev 
37841)
+++ haiku/trunk/src/system/kernel/fs/vfs.cpp    2010-08-02 14:17:35 UTC (rev 
37842)
@@ -1,6 +1,6 @@
 /*
  * Copyright 2005-2009, Ingo Weinhold, ingo_weinhold@xxxxxxx
- * Copyright 2002-2009, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
+ * Copyright 2002-2010, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
  * Distributed under the terms of the MIT License.
  *
  * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@@ -1694,7 +1694,7 @@
                        status_t status;
 
                        if (!HAS_FS_CALL(vnode, read_stat))
-                               return EOPNOTSUPP;
+                               return B_NOT_SUPPORTED;
 
                        status = FS_CALL(vnode, read_stat, &stat);
                        if (status != B_OK)
@@ -2495,7 +2495,7 @@
        // parent directory for the vnode, if the caller let us.
 
        if (parent == NULL)
-               return EOPNOTSUPP;
+               return B_NOT_SUPPORTED;
 
        void* cookie;
 
@@ -4209,7 +4209,7 @@
                if (descriptor->ops->fd_read_stat)
                        status = descriptor->ops->fd_read_stat(descriptor, 
stat);
                else
-                       status = EOPNOTSUPP;
+                       status = B_NOT_SUPPORTED;
 
                put_fd(descriptor);
        }
@@ -4897,7 +4897,7 @@
 vfs_resize_fd_table(struct io_context* context, const int newSize)
 {
        if (newSize <= 0 || newSize > MAX_FD_TABLE_SIZE)
-               return EINVAL;
+               return B_BAD_VALUE;
 
        TIOC(ResizeIOContext(context, newSize));
 
@@ -4911,7 +4911,7 @@
        if (newSize < oldSize) {
                for (int i = oldSize; i-- > newSize;) {
                        if (context->fds[i])
-                               return EBUSY;
+                               return B_BUSY;
                }
        }
 
@@ -4926,7 +4926,7 @@
                + sizeof(struct select_sync*) * newSize
                + newCloseOnExitBitmapSize);
        if (newFDs == NULL)
-               return ENOMEM;
+               return B_NO_MEMORY;
 
        context->fds = newFDs;
        context->select_infos = (select_info**)(context->fds + newSize);
@@ -4962,12 +4962,12 @@
        int     status = B_OK;
 
        if (newSize <= 0 || newSize > MAX_NODE_MONITORS)
-               return EINVAL;
+               return B_BAD_VALUE;
 
        mutex_lock(&context->io_mutex);
 
        if ((size_t)newSize < context->num_monitors) {
-               status = EBUSY;
+               status = B_BUSY;
                goto out;
        }
        context->max_monitors = newSize;
@@ -5196,7 +5196,7 @@
                // it doesn't exist yet -- try to create it
 
                if (!HAS_FS_CALL(directory, create))
-                       return EROFS;
+                       return B_READ_ONLY_DEVICE;
 
                status = FS_CALL(directory, create, name, openMode | O_EXCL, 
perms,
                        &cookie, &newID);
@@ -5275,7 +5275,7 @@
        int status;
 
        if (!HAS_FS_CALL(vnode, open_attr_dir))
-               return EOPNOTSUPP;
+               return B_NOT_SUPPORTED;
 
        status = FS_CALL(vnode, open_attr_dir, &cookie);
        if (status != B_OK)
@@ -5464,7 +5464,7 @@
        if (S_ISDIR(vnode->Type()))
                return B_IS_A_DIRECTORY;
        if (!HAS_FS_CALL(vnode, write))
-               return EROFS;
+               return B_READ_ONLY_DEVICE;
 
        return FS_CALL(vnode, write, descriptor->cookie, pos, buffer, length);
 }
@@ -5505,7 +5505,7 @@
                {
                        // stat() the node
                        if (!HAS_FS_CALL(vnode, read_stat))
-                               return EOPNOTSUPP;
+                               return B_NOT_SUPPORTED;
 
                        struct stat stat;
                        status_t status = FS_CALL(vnode, read_stat, &stat);
@@ -5521,7 +5521,7 @@
 
        // assumes off_t is 64 bits wide
        if (offset > 0 && LONGLONG_MAX - offset < pos)
-               return EOVERFLOW;
+               return B_BUFFER_OVERFLOW;
 
        pos += offset;
        if (pos < 0)
@@ -5580,7 +5580,7 @@
        if (HAS_FS_CALL(vnode, create_dir))
                status = FS_CALL(vnode, create_dir, name, perms);
        else
-               status = EROFS;
+               status = B_READ_ONLY_DEVICE;
 
        put_vnode(vnode);
        return status;
@@ -5604,7 +5604,7 @@
        if (HAS_FS_CALL(vnode, create_dir)) {
                status = FS_CALL(vnode, create_dir, filename, perms);
        } else
-               status = EROFS;
+               status = B_READ_ONLY_DEVICE;
 
        put_vnode(vnode);
        return status;
@@ -5756,7 +5756,7 @@
        struct dirent* buffer, size_t bufferSize, uint32* _count)
 {
        if (!HAS_FS_CALL(vnode, read_dir))
-               return EOPNOTSUPP;
+               return B_NOT_SUPPORTED;
 
        status_t error = FS_CALL(vnode, read_dir, cookie, buffer, bufferSize,
                _count);
@@ -5786,7 +5786,7 @@
                return FS_CALL(vnode, rewind_dir, descriptor->cookie);
        }
 
-       return EOPNOTSUPP;
+       return B_NOT_SUPPORTED;
 }
 
 
@@ -5829,7 +5829,7 @@
        if (HAS_FS_CALL(directory, remove_dir))
                status = FS_CALL(directory, remove_dir, name);
        else
-               status = EROFS;
+               status = B_READ_ONLY_DEVICE;
 
        put_vnode(directory);
        return status;
@@ -5845,7 +5845,7 @@
        if (HAS_FS_CALL(vnode, ioctl))
                return FS_CALL(vnode, ioctl, descriptor->cookie, op, buffer, 
length);
 
-       return EOPNOTSUPP;
+       return B_NOT_SUPPORTED;
 }
 
 
@@ -5916,7 +5916,7 @@
                                status = FS_CALL(vnode, set_flags, 
descriptor->cookie,
                                        (int)argument);
                        } else
-                               status = EOPNOTSUPP;
+                               status = B_NOT_SUPPORTED;
 
                        if (status == B_OK) {
                                // update this descriptor's open_mode field
@@ -6009,7 +6009,7 @@
        if (HAS_FS_CALL(vnode, fsync))
                status = FS_CALL_NO_PARAMS(vnode, fsync);
        else
-               status = EOPNOTSUPP;
+               status = B_NOT_SUPPORTED;
 
        put_fd(descriptor);
        return status;
@@ -6142,7 +6142,7 @@
        if (HAS_FS_CALL(directory, link))
                status = FS_CALL(directory, link, name, vnode);
        else
-               status = EROFS;
+               status = B_READ_ONLY_DEVICE;
 
 err1:
        put_vnode(vnode);
@@ -6170,7 +6170,7 @@
        if (HAS_FS_CALL(vnode, unlink))
                status = FS_CALL(vnode, unlink, filename);
        else
-               status = EROFS;
+               status = B_READ_ONLY_DEVICE;
 
        put_vnode(vnode);
 
@@ -6237,7 +6237,7 @@
        if (HAS_FS_CALL(fromVnode, rename))
                status = FS_CALL(fromVnode, rename, fromName, toVnode, toName);
        else
-               status = EROFS;
+               status = B_READ_ONLY_DEVICE;
 
 err2:
        put_vnode(toVnode);
@@ -6284,7 +6284,7 @@
                vnode, stat, statMask));
 
        if (!HAS_FS_CALL(vnode, write_stat))
-               return EROFS;
+               return B_READ_ONLY_DEVICE;
 
        return FS_CALL(vnode, write_stat, stat, statMask);
 }
@@ -6337,7 +6337,7 @@
        if (HAS_FS_CALL(vnode, write_stat))
                status = FS_CALL(vnode, write_stat, stat, statMask);
        else
-               status = EROFS;
+               status = B_READ_ONLY_DEVICE;
 
        put_vnode(vnode);
 
@@ -6404,7 +6404,7 @@
                return FS_CALL(vnode, read_attr_dir, descriptor->cookie, buffer,
                        bufferSize, _count);
 
-       return EOPNOTSUPP;
+       return B_NOT_SUPPORTED;
 }
 
 
@@ -6418,7 +6418,7 @@
        if (HAS_FS_CALL(vnode, rewind_attr_dir))
                return FS_CALL(vnode, rewind_attr_dir, descriptor->cookie);
 
-       return EOPNOTSUPP;
+       return B_NOT_SUPPORTED;
 }
 
 
@@ -6436,7 +6436,7 @@
                return status;
 
        if (!HAS_FS_CALL(vnode, create_attr)) {
-               status = EROFS;
+               status = B_READ_ONLY_DEVICE;
                goto err;
        }
 
@@ -6476,7 +6476,7 @@
                return status;
 
        if (!HAS_FS_CALL(vnode, open_attr)) {
-               status = EOPNOTSUPP;
+               status = B_NOT_SUPPORTED;
                goto err;
        }
 
@@ -6538,7 +6538,7 @@
                *length));
 
        if (!HAS_FS_CALL(vnode, read_attr))
-               return EOPNOTSUPP;
+               return B_NOT_SUPPORTED;
 
        return FS_CALL(vnode, read_attr, descriptor->cookie, pos, buffer, 
length);
 }
@@ -6552,7 +6552,7 @@
 
        FUNCTION(("attr_write: buf %p, pos %Ld, len %p\n", buffer, pos, 
length));
        if (!HAS_FS_CALL(vnode, write_attr))
-               return EOPNOTSUPP;
+               return B_NOT_SUPPORTED;
 
        return FS_CALL(vnode, write_attr, descriptor->cookie, pos, buffer, 
length);
 }
@@ -6574,7 +6574,7 @@
                {
                        struct vnode* vnode = descriptor->u.vnode;
                        if (!HAS_FS_CALL(vnode, read_stat))
-                               return EOPNOTSUPP;
+                               return B_NOT_SUPPORTED;
 
                        struct stat stat;
                        status_t status = FS_CALL(vnode, read_attr_stat, 
descriptor->cookie,
@@ -6591,7 +6591,7 @@
 
        // assumes off_t is 64 bits wide
        if (offset > 0 && LONGLONG_MAX - offset < pos)
-               return EOVERFLOW;
+               return B_BUFFER_OVERFLOW;
 
        pos += offset;
        if (pos < 0)
@@ -6609,7 +6609,7 @@
        FUNCTION(("attr_read_stat: stat 0x%p\n", stat));
 
        if (!HAS_FS_CALL(vnode, read_attr_stat))
-               return EOPNOTSUPP;
+               return B_NOT_SUPPORTED;
 
        return FS_CALL(vnode, read_attr_stat, descriptor->cookie, stat);
 }
@@ -6624,7 +6624,7 @@
        FUNCTION(("attr_write_stat: stat = %p, statMask %d\n", stat, statMask));
 
        if (!HAS_FS_CALL(vnode, write_attr_stat))
-               return EROFS;
+               return B_READ_ONLY_DEVICE;
 
        return FS_CALL(vnode, write_attr_stat, descriptor->cookie, stat, 
statMask);
 }
@@ -6650,7 +6650,7 @@
        if (HAS_FS_CALL(vnode, remove_attr))
                status = FS_CALL(vnode, remove_attr, name);
        else
-               status = EROFS;
+               status = B_READ_ONLY_DEVICE;
 
        put_fd(descriptor);
 
@@ -6694,7 +6694,7 @@
        if (HAS_FS_CALL(fromVnode, rename_attr)) {
                status = FS_CALL(fromVnode, rename_attr, fromName, toVnode, 
toName);
        } else
-               status = EROFS;
+               status = B_READ_ONLY_DEVICE;
 
 err1:
        put_fd(toDescriptor);
@@ -6718,7 +6718,7 @@
                return status;
 
        if (!HAS_FS_MOUNT_CALL(mount, open_index_dir)) {
-               status = EOPNOTSUPP;
+               status = B_NOT_SUPPORTED;
                goto error;
        }
 
@@ -6781,7 +6781,7 @@
                        bufferSize, _count);
        }
 
-       return EOPNOTSUPP;
+       return B_NOT_SUPPORTED;
 }
 
 
@@ -6793,7 +6793,7 @@
        if (HAS_FS_MOUNT_CALL(mount, rewind_index_dir))
                return FS_MOUNT_CALL(mount, rewind_index_dir, 
descriptor->cookie);
 
-       return EOPNOTSUPP;
+       return B_NOT_SUPPORTED;
 }
 
 
@@ -6810,7 +6810,7 @@
                return status;
 
        if (!HAS_FS_MOUNT_CALL(mount, create_index)) {
-               status = EROFS;
+               status = B_READ_ONLY_DEVICE;
                goto out;
        }
 
@@ -6831,9 +6831,9 @@
        // ToDo: currently unused!
        FUNCTION(("index_read_stat: stat 0x%p\n", stat));
        if (!HAS_FS_CALL(vnode, read_index_stat))
-               return EOPNOTSUPP;
+               return B_NOT_SUPPORTED;
 
-       return EOPNOTSUPP;
+       return B_NOT_SUPPORTED;
        //return FS_CALL(vnode, read_index_stat, descriptor->cookie, stat);
 }
 
@@ -6864,7 +6864,7 @@
                return status;
 
        if (!HAS_FS_MOUNT_CALL(mount, read_index_stat)) {
-               status = EOPNOTSUPP;
+               status = B_NOT_SUPPORTED;
                goto out;
        }
 
@@ -6888,7 +6888,7 @@
                return status;
 
        if (!HAS_FS_MOUNT_CALL(mount, remove_index)) {
-               status = EROFS;
+               status = B_READ_ONLY_DEVICE;
                goto out;
        }
 
@@ -6920,7 +6920,7 @@
                return status;
 
        if (!HAS_FS_MOUNT_CALL(mount, open_query)) {
-               status = EOPNOTSUPP;
+               status = B_NOT_SUPPORTED;
                goto error;
        }
 
@@ -6984,7 +6984,7 @@
                        bufferSize, _count);
        }
 
-       return EOPNOTSUPP;
+       return B_NOT_SUPPORTED;
 }
 
 
@@ -6996,7 +6996,7 @@
        if (HAS_FS_MOUNT_CALL(mount, rewind_query))
                return FS_MOUNT_CALL(mount, rewind_query, descriptor->cookie);
 
-       return EOPNOTSUPP;
+       return B_NOT_SUPPORTED;
 }
 
 
@@ -7182,7 +7182,7 @@
 
                volume->file_system = get_file_system(layerFSName);
                if (volume->file_system == NULL) {
-                       status = ENODEV;
+                       status = B_DEVICE_NOT_FOUND;
                        free(layerFSName);
                        free(volume->file_system_name);
                        free(volume);
@@ -7613,7 +7613,7 @@
        if (HAS_FS_MOUNT_CALL(mount, write_fs_info))
                status = FS_MOUNT_CALL(mount, write_fs_info, info, mask);
        else
-               status = EROFS;
+               status = B_READ_ONLY_DEVICE;
 
        put_mount(mount);
        return status;
@@ -8290,7 +8290,7 @@
                if (descriptor->ops->fd_write_stat)
                        status = descriptor->ops->fd_write_stat(descriptor, 
stat, statMask);
                else
-                       status = EOPNOTSUPP;
+                       status = B_NOT_SUPPORTED;
 
                put_fd(descriptor);
        }
@@ -9202,7 +9202,7 @@
                if (descriptor->ops->fd_read_stat)
                        status = descriptor->ops->fd_read_stat(descriptor, 
&stat);
                else
-                       status = EOPNOTSUPP;
+                       status = B_NOT_SUPPORTED;
 
                put_fd(descriptor);
        }
@@ -9263,7 +9263,7 @@
                        status = descriptor->ops->fd_write_stat(descriptor, 
&stat,
                                statMask);
                } else
-                       status = EOPNOTSUPP;
+                       status = B_NOT_SUPPORTED;
 
                put_fd(descriptor);
        }
@@ -9343,7 +9343,7 @@
        if (descriptor->ops->fd_read_stat)
                status = descriptor->ops->fd_read_stat(descriptor, &stat);
        else
-               status = EOPNOTSUPP;
+               status = B_NOT_SUPPORTED;
 
        put_fd(descriptor);
        _user_close(attr);
@@ -9542,7 +9542,7 @@
 {
        // only root is allowed to chroot()
        if (geteuid() != 0)
-               return EPERM;
+               return B_NOT_ALLOWED;
 
        // alloc path buffer
        KPath pathBuffer(B_PATH_NAME_LENGTH);


Other related posts:

  • » [haiku-commits] r37842 - haiku/trunk/src/system/kernel/fs - axeld