feat: fstat now handle symbolic link
[lunaix-os.git] / lunaix-os / kernel / device / devfs.c
index 2951456ce54a681bf8c9149a878390ee5da3c170..1a49b0519ebdca9882b67baae30cf661ec6a4762 100644 (file)
@@ -73,8 +73,10 @@ devfs_get_itype(struct device* dev)
         itype = VFS_IFDIR;
     } else if (dev_if == DEV_IFVOL) {
         itype |= VFS_IFVOLDEV;
-    } else {
+    } else if (dev_if == DEV_IFSEQ) {
         itype |= VFS_IFSEQDEV;
+    } else {
+        itype |= VFS_IFDEV;
     }
     return itype;
 }
@@ -96,10 +98,10 @@ devfs_mknod(struct v_dnode* dnode, struct device* dev)
 {
     assert(dev);
 
-    struct v_inode* devnod = vfs_i_find(dnode->super_block, dev->dev_id);
+    struct v_inode* devnod = vfs_i_find(dnode->super_block, dev->dev_uid);
     if (!devnod) {
         if ((devnod = vfs_i_alloc(dnode->super_block))) {
-            devnod->id = dev->dev_id;
+            devnod->id = dev->dev_uid;
             devnod->data = dev;
             devnod->itype = devfs_get_itype(dev);
 
@@ -178,6 +180,7 @@ devfs_init()
     fs->mount = devfs_mount;
     fs->unmount = devfs_unmount;
 }
+EXPORT_FILE_SYSTEM(devfs, devfs_init);
 
 struct v_inode_ops devfs_inode_ops = { .dir_lookup = devfs_dirlookup,
                                        .open = default_inode_open,