feat: fstat now handle symbolic link
[lunaix-os.git] / lunaix-os / kernel / fs / iso9660 / directory.c
index 1d35978b06f84b3ead66688b1b661a875bb13a38..9f4d988f8c39606fd7f7e1160ecbff0bbfe433f5 100644 (file)
@@ -6,7 +6,7 @@
 
 #include <klibc/string.h>
 
-#include <sys/dirent_defs.h>
+#include <usr/lunaix/dirent_defs.h>
 
 extern struct cake_pile* drec_cache_pile;
 
@@ -52,10 +52,12 @@ done:
         u32_t l = drec->name.len;
         while (l < (u32_t)-1 && drec->name.content[l--] != ';')
             ;
+
         l = (l + 1) ? l : drec->name.len;
         l = MIN(l, ISO9660_IDLEN - 1);
 
-        strncpy(cache->name_val, drec->name.content, l);
+        strncpy(cache->name_val, (const char*)drec->name.content, l);
+
         cache->name = HSTR(cache->name_val, l);
         hstr_rehash(&cache->name, HSTR_FULL_HASH);
     }
@@ -64,7 +66,7 @@ done:
 int
 iso9660_setup_dnode(struct v_dnode* dnode, struct v_inode* inode)
 {
-    if (!(inode->itype & VFS_IFDIR)) {
+    if ((inode->itype & F_FILE)) {
         vfs_assign_inode(dnode, inode);
         return 0;
     }
@@ -86,7 +88,8 @@ iso9660_setup_dnode(struct v_dnode* dnode, struct v_inode* inode)
     do {
         if (blk_offset >= ISO9660_BLKSZ - sizeof(struct iso_drecord)) {
             current_pos += ISO9660_BLKSZ;
-            errno = dev->read(dev, records, blk + current_pos, ISO9660_BLKSZ);
+            errno =
+              dev->ops.read(dev, records, blk + current_pos, ISO9660_BLKSZ);
             if (errno < 0) {
                 errno = EIO;
                 goto done;