add System Compression support
[wimlib] / src / unix_capture.c
index 4e7c036..2843c36 100644 (file)
@@ -180,13 +180,12 @@ unix_scan_directory(struct wim_dentry *dir_dentry,
                        break;
                }
 
-               if (entry->d_name[0] == '.' &&
-                   (entry->d_name[1] == '\0' ||
-                    (entry->d_name[1] == '.' && entry->d_name[2] == '\0')))
+               name_len = strlen(entry->d_name);
+
+               if (should_ignore_filename(entry->d_name, name_len))
                        continue;
 
                full_path[full_path_len] = '/';
-               name_len = strlen(entry->d_name);
                memcpy(&full_path[full_path_len + 1], entry->d_name, name_len + 1);
                ret = unix_build_dentry_tree_recursive(&child,
                                                       full_path,
@@ -197,8 +196,7 @@ unix_scan_directory(struct wim_dentry *dir_dentry,
                full_path[full_path_len] = '\0';
                if (ret)
                        break;
-               if (child)
-                       dentry_add_child(dir_dentry, child);
+               attach_scanned_tree(dir_dentry, child, params->blob_table);
        }
        closedir(dir);
        return ret;
@@ -277,7 +275,7 @@ unix_relativize_link_target(char *target, u64 ino, u64 dev)
        return target;
 }
 
-static int
+static noinline_for_stack int
 unix_scan_symlink(const char *full_path, int dirfd, const char *relpath,
                  struct wim_inode *inode, struct capture_params *params)
 {
@@ -348,10 +346,10 @@ unix_build_dentry_tree_recursive(struct wim_dentry **tree_ret,
        struct stat stbuf;
        int stat_flags;
 
-       ret = try_exclude(full_path, full_path_len, params);
-       if (ret < 0) /* Excluded? */
+       ret = try_exclude(full_path, params);
+       if (unlikely(ret < 0)) /* Excluded? */
                goto out_progress;
-       if (ret > 0) /* Error? */
+       if (unlikely(ret > 0)) /* Error? */
                goto out;
 
        if (params->add_flags & (WIMLIB_ADD_FLAG_DEREFERENCE |
@@ -390,8 +388,7 @@ unix_build_dentry_tree_recursive(struct wim_dentry **tree_ret,
        }
 
        ret = inode_table_new_dentry(params->inode_table, relpath,
-                                    stbuf.st_ino, stbuf.st_dev,
-                                    S_ISDIR(stbuf.st_mode), &tree);
+                                    stbuf.st_ino, stbuf.st_dev, false, &tree);
        if (ret)
                goto out;