[haiku-commits] r39330 - haiku/trunk/src/system/libroot/os/arch/x86

  • From: revol@xxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 6 Nov 2010 23:28:08 +0100 (CET)

Author: mmu_man
Date: 2010-11-06 23:28:07 +0100 (Sat, 06 Nov 2010)
New Revision: 39330
Changeset: http://dev.haiku-os.org/changeset/39330

Modified:
   haiku/trunk/src/system/libroot/os/arch/x86/compatibility.c
Log:
Add mount() and unmount() BeOS compatibility calls. This should help to run 
some old apps like Helios...


Modified: haiku/trunk/src/system/libroot/os/arch/x86/compatibility.c
===================================================================
--- haiku/trunk/src/system/libroot/os/arch/x86/compatibility.c  2010-11-06 
20:49:39 UTC (rev 39329)
+++ haiku/trunk/src/system/libroot/os/arch/x86/compatibility.c  2010-11-06 
22:28:07 UTC (rev 39330)
@@ -11,6 +11,7 @@
 
 #include <SupportDefs.h>
 #include <fs_info.h>
+#include <fs_volume.h>
 
 #include <syscalls.h>
 
@@ -22,6 +23,9 @@
 int _kget_cpu_state_(int cpuNum);
 int _kset_cpu_state_(int cpuNum, int state);
 int _kstatfs_(dev_t device, void *whatever, int fd, const char *path, fs_info 
*info);
+int mount(const char *filesystem, const char *where, const char *device, ulong 
flags,
+       void *parms, int len);
+int unmount(const char *path);
 
 
 int
@@ -98,3 +102,43 @@
 
        return fs_stat_dev(device, info);
 }
+
+
+int
+mount(const char *filesystem, const char *where, const char *device, ulong 
flags,
+       void *parms, int len)
+{
+       status_t err;
+       uint32 mountFlags = 0;
+
+       if (flags & 1)
+               mountFlags |= B_MOUNT_READ_ONLY;
+
+       // we don't support passing (binary) parameters
+       if (parms != NULL || len != 0 || flags & ~1) {
+               errno = B_BAD_VALUE;
+               return -1;
+       }
+
+       err = fs_mount_volume(where, device, filesystem, mountFlags, NULL);
+       if (err < B_OK) {
+               errno = err;
+               return -1;
+       }
+       return err;
+}
+
+
+int
+unmount(const char *path)
+{
+       status_t err;
+
+       err = fs_unmount_volume(path, 0);
+       if (err < B_OK) {
+               errno = err;
+               return -1;
+       }
+       return err;
+}
+


Other related posts: