diff --git a/fs/vfs/vfs_mount.c b/fs/vfs/vfs_mount.c index bcbd0967caec16dab44c367693fea3dafd54f324..63cf5243f1c9e48a9ddc55ffb28dafaa581b7c8c 100755 --- a/fs/vfs/vfs_mount.c +++ b/fs/vfs/vfs_mount.c @@ -44,6 +44,7 @@ #include <osv/prex.h> #include <osv/vnode.h> +#include <osv/device.h> #include "vfs.h" /* @@ -98,14 +99,12 @@ sys_mount(char *dev, char *dir, char *fsname, int flags, void *data) /* Open device. NULL can be specified as a device. */ device = 0; -#if HAVE_DEVICES if (*dev != '\0') { if (strncmp(dev, "/dev/", 5)) return ENOTBLK; if ((error = device_open(dev + 5, DO_RDWR, &device)) != 0) return error; } -#endif MOUNT_LOCK(); @@ -114,7 +113,7 @@ sys_mount(char *dev, char *dir, char *fsname, int flags, void *data) for (n = list_first(head); n != head; n = list_next(n)) { mp = list_entry(n, struct mount, m_link); if (!strcmp(mp->m_path, dir) || - (device && mp->m_dev == (dev_t)device)) { + (device && mp->m_dev == device)) { error = EBUSY; /* Already mounted */ goto err1; } @@ -129,7 +128,7 @@ sys_mount(char *dev, char *dir, char *fsname, int flags, void *data) mp->m_count = 0; mp->m_op = fs->vs_op; mp->m_flags = flags; - mp->m_dev = (dev_t)device; + mp->m_dev = device; strlcpy(mp->m_path, dir, sizeof(mp->m_path)); /* @@ -194,9 +193,7 @@ sys_mount(char *dev, char *dir, char *fsname, int flags, void *data) err2: free(mp); err1: -#if HAVE_DEVICES device_close(device); -#endif MOUNT_UNLOCK(); return error; @@ -246,10 +243,8 @@ sys_umount(char *path) binval(mp->m_dev); #endif -#if HAVE_DEVICES if (mp->m_dev) device_close(mp->m_dev); -#endif free(mp); out: MOUNT_UNLOCK(); diff --git a/include/osv/mount.h b/include/osv/mount.h index ba7364beec39e75db53d71335c7368c0e2ce58b6..b9583cf667fc1743086282e12bf751f263bf63c6 100755 --- a/include/osv/mount.h +++ b/include/osv/mount.h @@ -47,7 +47,7 @@ struct mount { int m_flags; /* mount flag */ int m_count; /* reference count */ char m_path[PATH_MAX]; /* mounted path */ - dev_t m_dev; /* mounted device */ + struct device *m_dev; /* mounted device */ struct vnode *m_root; /* root vnode */ struct vnode *m_covered; /* vnode covered on parent fs */ void *m_data; /* private data for fs */ diff --git a/include/osv/prex.h b/include/osv/prex.h index 3e7b1af4fe4d090604db312971b47979ea8110c7..273eea02cebc22910919d49bc08b9ad6e56a893b 100644 --- a/include/osv/prex.h +++ b/include/osv/prex.h @@ -16,6 +16,8 @@ __BEGIN_DECLS #define FREAD 0x00000001 #define FWRITE 0x00000002 +#define DO_RDWR 0x2 + /* convert from open() flags to/from fflags; convert O_RD/WR to FREAD/FWRITE */ #define FFLAGS(oflags) ((oflags) + 1) #define OFLAGS(fflags) ((fflags) - 1)