Implement support for block and char dev nodes, fifos and sockets.
[project/make_ext4fs.git] / make_ext4fs.c
index fa04263..3623426 100644 (file)
@@ -44,7 +44,6 @@
 /* TODO: Not implemented:
    Allocating blocks in the same block group as the file inode
    Hash or binary tree directories
-   Special files: sockets, devices, fifos
  */
 
 static int filter_dot(const struct dirent *d)
@@ -235,6 +234,11 @@ static u32 build_directory_structure(const char *full_path, const char *dir_path
                        free(subdir_dir_path);
                } else if (dentries[i].file_type == EXT4_FT_SYMLINK) {
                        entry_inode = make_link(dentries[i].link);
+               } else if (dentries[i].file_type == EXT4_FT_CHRDEV ||
+                          dentries[i].file_type == EXT4_FT_BLKDEV ||
+                          dentries[i].file_type == EXT4_FT_SOCK ||
+                          dentries[i].file_type == EXT4_FT_FIFO) {
+                       entry_inode = make_special(dentries[i].full_path);
                } else {
                        error("unknown file type on %s", dentries[i].path);
                        entry_inode = 0;