Merge remote-tracking branch 'origin/master' into isa/arm64
[lunaix-os.git] / lunaix-os / kernel / fs / mount.c
index 0f3b3fb7d42e807c22394ee354a5a342511f5ceb..c673e8418b6866541d8b413e68e5c72ea689806e 100644 (file)
@@ -288,6 +288,7 @@ __DEFINE_LXSYSCALL4(int,
                     int,
                     options)
 {
                     int,
                     options)
 {
+    struct device* device = NULL;
     struct v_dnode *dev = NULL, *mnt = NULL;
     int errno = 0;
 
     struct v_dnode *dev = NULL, *mnt = NULL;
     int errno = 0;
 
@@ -308,16 +309,14 @@ __DEFINE_LXSYSCALL4(int,
         goto done;
     }
 
         goto done;
     }
 
-    // By our convention.
-    // XXX could we do better?
-    struct device* device = NULL;
-
     if (dev) {
         if (!check_voldev_node(dev->inode)) {
             errno = ENOTDEV;
             goto done;
         }
     if (dev) {
         if (!check_voldev_node(dev->inode)) {
             errno = ENOTDEV;
             goto done;
         }
-        device = (struct device*)dev->inode->data;
+
+        device = resolve_device(dev->inode->data);
+        assert(device);
     }
 
     errno = vfs_mount_at(fstype, device, mnt, options);
     }
 
     errno = vfs_mount_at(fstype, device, mnt, options);