From c3c6ad0a0be88d057b4f87a81277bf3ec232df39 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 30 Apr 2007 17:19:19 +0000 Subject: [PATCH] BeOS build fixes: * On BeOS compatible host platforms we must not include BeOSBuildCompatibility.h, but HaikuBuildCompatibility.h. * Fixed errno usage in command_cp.cpp. * Fixed fssh_ioctl(). * fssh_set_sem_owner() doesn't invoke BeOS's set_sem_owner() anymore or otherwise the FS's semaphores are assigned to the kernel. * Commented out functions that don't exist under BeOS (and aren't used anyway). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20934 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tools/fs_shell/atomic.cpp | 2 +- src/tools/fs_shell/command_cp.cpp | 6 +++--- src/tools/fs_shell/compatibility.h | 17 +++++++++++++++++ src/tools/fs_shell/errno.cpp | 2 +- src/tools/fs_shell/fssh.h | 3 +-- src/tools/fs_shell/sem.cpp | 6 ++++-- src/tools/fs_shell/stat.cpp | 2 +- src/tools/fs_shell/stat_util.cpp | 2 +- src/tools/fs_shell/string.cpp | 10 +++++++++- src/tools/fs_shell/thread.cpp | 2 +- src/tools/fs_shell/time.cpp | 2 +- src/tools/fs_shell/uio.cpp | 2 +- src/tools/fs_shell/unistd.cpp | 21 +++++++++++---------- 13 files changed, 52 insertions(+), 25 deletions(-) create mode 100644 src/tools/fs_shell/compatibility.h diff --git a/src/tools/fs_shell/atomic.cpp b/src/tools/fs_shell/atomic.cpp index ba6a0589ef..c6c9fd9c3a 100644 --- a/src/tools/fs_shell/atomic.cpp +++ b/src/tools/fs_shell/atomic.cpp @@ -3,7 +3,7 @@ * Distributed under the terms of the MIT License. */ -#include +#include "compatibility.h" #include diff --git a/src/tools/fs_shell/command_cp.cpp b/src/tools/fs_shell/command_cp.cpp index 9a9d620ce7..b86f8cb0da 100644 --- a/src/tools/fs_shell/command_cp.cpp +++ b/src/tools/fs_shell/command_cp.cpp @@ -3,7 +3,7 @@ * Distributed under the terms of the MIT License. */ -#include +#include "compatibility.h" #include "command_cp.h" @@ -160,7 +160,7 @@ public: if (!fAttrDir) return 0; - errno = 0; + fssh_set_errno(FSSH_B_OK); struct dirent *entry = fs_read_attr_dir(fAttrDir); if (!entry) return fssh_get_errno(); @@ -242,7 +242,7 @@ public: virtual fssh_ssize_t GetNextEntry(struct fssh_dirent *entry, int size) { - errno = 0; + fssh_set_errno(FSSH_B_OK); struct dirent *hostEntry = readdir(fDir); if (!hostEntry) return fssh_get_errno(); diff --git a/src/tools/fs_shell/compatibility.h b/src/tools/fs_shell/compatibility.h new file mode 100644 index 0000000000..f0ddde9ce4 --- /dev/null +++ b/src/tools/fs_shell/compatibility.h @@ -0,0 +1,17 @@ +/* + * Copyright 2007, Ingo Weinhold, bonefish@cs.tu-berlin.de. + * Distributed under the terms of the MIT License. + */ +#ifndef _FSSH_COMPATIBILITY_H +#define _FSSH_COMPATIBILITY_H + +#ifdef __BEOS__ +# ifndef HAIKU_HOST_PLATFORM_HAIKU +# include +# endif +#else +# include +#endif + +#endif // _FSSH_COMPATIBILITY_H + diff --git a/src/tools/fs_shell/errno.cpp b/src/tools/fs_shell/errno.cpp index 36802bfc87..bd73565f5e 100644 --- a/src/tools/fs_shell/errno.cpp +++ b/src/tools/fs_shell/errno.cpp @@ -3,7 +3,7 @@ * Distributed under the terms of the MIT License. */ -#include +#include "compatibility.h" #include "fssh_errno.h" diff --git a/src/tools/fs_shell/fssh.h b/src/tools/fs_shell/fssh.h index f35247fba0..43c8f17b2b 100644 --- a/src/tools/fs_shell/fssh.h +++ b/src/tools/fs_shell/fssh.h @@ -6,8 +6,7 @@ #ifndef _FSSH_FSSH_H #define _FSSH_FSSH_H - -#include +#include "compatibility.h" #include #include diff --git a/src/tools/fs_shell/sem.cpp b/src/tools/fs_shell/sem.cpp index de90cf2147..8d3d8e775d 100644 --- a/src/tools/fs_shell/sem.cpp +++ b/src/tools/fs_shell/sem.cpp @@ -3,7 +3,7 @@ * Distributed under the terms of the MIT License. */ -#include +#include "compatibility.h" #include @@ -78,7 +78,9 @@ fssh_get_sem_count(fssh_sem_id id, int32_t *threadCount) fssh_status_t fssh_set_sem_owner(fssh_sem_id id, fssh_team_id team) { - return set_sem_owner(id, team); + // return set_sem_owner(id, team); + // The FS shell is the kernel and no other teams exist. + return FSSH_B_OK; } diff --git a/src/tools/fs_shell/stat.cpp b/src/tools/fs_shell/stat.cpp index dce6b6c7d6..a5a935c28b 100644 --- a/src/tools/fs_shell/stat.cpp +++ b/src/tools/fs_shell/stat.cpp @@ -3,7 +3,7 @@ * Distributed under the terms of the MIT License. */ -#include +#include "compatibility.h" #include "fssh_stat.h" diff --git a/src/tools/fs_shell/stat_util.cpp b/src/tools/fs_shell/stat_util.cpp index 02ede9d025..0bd4b37e64 100644 --- a/src/tools/fs_shell/stat_util.cpp +++ b/src/tools/fs_shell/stat_util.cpp @@ -3,7 +3,7 @@ * Distributed under the terms of the MIT License. */ -#include +#include "compatibility.h" #include "stat_util.h" diff --git a/src/tools/fs_shell/string.cpp b/src/tools/fs_shell/string.cpp index da431d65cc..3194dba634 100644 --- a/src/tools/fs_shell/string.cpp +++ b/src/tools/fs_shell/string.cpp @@ -3,7 +3,7 @@ * Distributed under the terms of the MIT License. */ -#include +#include "compatibility.h" #include "fssh_string.h" @@ -31,11 +31,13 @@ fssh_memcpy(void *dest, const void *source, fssh_size_t length) } +#if 0 void* fssh_memccpy(void *dest, const void *source, int stopByte, fssh_size_t length) { return memccpy(dest, source, stopByte, length); } +#endif // 0 void* @@ -209,11 +211,13 @@ fssh_strncasecmp(const char *string1, const char *string2, fssh_size_t length) } +#if 0 char* fssh_strcasestr(const char *string, const char *searchString) { return strcasestr(string, searchString); } +#endif // 0 char* @@ -269,15 +273,19 @@ fssh_ffs(int i) } +#if 0 char* fssh_index(const char *s, int c) { return index(s, c); } +#endif // 0 +#if 0 char* fssh_rindex(char const *s, int c) { return rindex(s, c); } +#endif // 0 diff --git a/src/tools/fs_shell/thread.cpp b/src/tools/fs_shell/thread.cpp index b6b2e39032..bbf424f082 100644 --- a/src/tools/fs_shell/thread.cpp +++ b/src/tools/fs_shell/thread.cpp @@ -3,7 +3,7 @@ * Distributed under the terms of the MIT License. */ -#include +#include "compatibility.h" #include "fssh_os.h" diff --git a/src/tools/fs_shell/time.cpp b/src/tools/fs_shell/time.cpp index f64b41287f..c5c78b6d81 100644 --- a/src/tools/fs_shell/time.cpp +++ b/src/tools/fs_shell/time.cpp @@ -3,7 +3,7 @@ * Distributed under the terms of the MIT License. */ -#include +#include "compatibility.h" #include "fssh_os.h" #include "fssh_time.h" diff --git a/src/tools/fs_shell/uio.cpp b/src/tools/fs_shell/uio.cpp index f90511c12a..32fdd811e5 100644 --- a/src/tools/fs_shell/uio.cpp +++ b/src/tools/fs_shell/uio.cpp @@ -3,7 +3,7 @@ * Distributed under the terms of the MIT License. */ -#include +#include "compatibility.h" #include "fssh_uio.h" diff --git a/src/tools/fs_shell/unistd.cpp b/src/tools/fs_shell/unistd.cpp index 0a37334698..1eb0d3b40f 100644 --- a/src/tools/fs_shell/unistd.cpp +++ b/src/tools/fs_shell/unistd.cpp @@ -3,7 +3,7 @@ * Distributed under the terms of the MIT License. */ -#include +#include "compatibility.h" #include "fssh_unistd.h" @@ -88,17 +88,18 @@ fssh_ioctl(int fd, unsigned long op, ...) = va_arg(list, fssh_device_geometry*); #ifdef __BEOS__ - if (ioctl(fd, B_GET_GEOMETRY, systemGeometry) == 0) { + device_geometry systemGeometry; + if (ioctl(fd, B_GET_GEOMETRY, &systemGeometry) == 0) { geometry->bytes_per_sector - = systemGeometry->bytes_per_sector; + = systemGeometry.bytes_per_sector; geometry->sectors_per_track - = systemGeometry->sectors_per_track; - geometry->cylinder_count = systemGeometry->cylinder_count; - geometry->head_count = systemGeometry->head_count; - geometry->device_type = systemGeometry->device_type; - geometry->removable = systemGeometry->removable; - geometry->read_only = systemGeometry->read_only; - geometry->write_once = systemGeometry->write_once; + = systemGeometry.sectors_per_track; + geometry->cylinder_count = systemGeometry.cylinder_count; + geometry->head_count = systemGeometry.head_count; + geometry->device_type = systemGeometry.device_type; + geometry->removable = systemGeometry.removable; + geometry->read_only = systemGeometry.read_only; + geometry->write_once = systemGeometry.write_once; error = B_OK; } else error = errno;