From 76a14666e0fb550663f669acd4d7e629e07f812b Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 6 Mar 2005 13:32:33 +0000 Subject: [PATCH] * As read_pos() and write_pos() are supposed to be platform functions, they return the respective error codes. * Fixed the open mode conversion function. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11597 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/file_systems/fs_shell/sysdep.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/tests/add-ons/kernel/file_systems/fs_shell/sysdep.c b/src/tests/add-ons/kernel/file_systems/fs_shell/sysdep.c index a796cdbbaf..95512660ec 100644 --- a/src/tests/add-ons/kernel/file_systems/fs_shell/sysdep.c +++ b/src/tests/add-ons/kernel/file_systems/fs_shell/sysdep.c @@ -20,6 +20,8 @@ #include #include +#include "stat_util.h" + // Let the FS think, we are the root user. uid_t @@ -144,7 +146,8 @@ read_pos(int fd, fs_off_t _pos, void *data, size_t nbytes) if (lseek(fd, pos, SEEK_SET) < 0) { perror("read lseek"); - return FS_EINVAL; + errno = EINVAL; + return -1; } ret = read(fd, data, nbytes); @@ -165,7 +168,8 @@ write_pos(int fd, fs_off_t _pos, const void *data, size_t nbytes) if (lseek(fd, pos, SEEK_SET) < 0) { perror("read lseek"); - return FS_EINVAL; + errno = EINVAL; + return -1; } ret = write(fd, data, nbytes); @@ -284,7 +288,7 @@ to_platform_open_mode(int myMode) } // the flags - SET_OPEN_MODE_FLAG(O_CLOEXEC, MY_O_CLOEXEC) + //SET_OPEN_MODE_FLAG(O_CLOEXEC, MY_O_CLOEXEC) SET_OPEN_MODE_FLAG(O_NONBLOCK, MY_O_NONBLOCK) SET_OPEN_MODE_FLAG(O_EXCL, MY_O_EXCL) SET_OPEN_MODE_FLAG(O_CREAT, MY_O_CREAT) @@ -292,13 +296,12 @@ to_platform_open_mode(int myMode) SET_OPEN_MODE_FLAG(O_APPEND, MY_O_APPEND) SET_OPEN_MODE_FLAG(O_NOCTTY, MY_O_NOCTTY) SET_OPEN_MODE_FLAG(O_NOTRAVERSE, MY_O_NOTRAVERSE) - SET_OPEN_MODE_FLAG(O_ACCMODE, MY_O_ACCMODE) - SET_OPEN_MODE_FLAG(O_TEXT, MY_O_TEXT) - SET_OPEN_MODE_FLAG(O_BINARY, MY_O_BINARY) + //SET_OPEN_MODE_FLAG(O_TEXT, MY_O_TEXT) + //SET_OPEN_MODE_FLAG(O_BINARY, MY_O_BINARY) #undef SET_OPEN_MODE_FLAG - return myFlags; + return mode; }