#include "config.h"
-#ifdef WITH_NTFS_3G
#include <ntfs-3g/endians.h>
#include <ntfs-3g/types.h>
-#endif
#include "wimlib_internal.h"
-#ifdef WITH_NTFS_3G
#include "dentry.h"
#include "lookup_table.h"
#include "io.h"
struct sd_set *sd_set;
const struct capture_config *config;
ntfs_volume **ntfs_vol_p;
- int flags;
+ int add_image_flags;
+ wimlib_progress_func_t progress_func;
};
static int
struct sd_set *sd_set,
const struct capture_config *config,
ntfs_volume **ntfs_vol_p,
- int flags);
+ int add_image_flags,
+ wimlib_progress_func_t progress_func);
static int wim_ntfs_capture_filldir(void *dirent, const ntfschar *name,
const int name_len, const int name_type,
ni, ctx->path, path_len, name_type,
ctx->lookup_table, ctx->sd_set,
ctx->config, ctx->ntfs_vol_p,
- ctx->flags);
+ ctx->add_image_flags,
+ ctx->progress_func);
if (child)
dentry_add_child(ctx->parent, child);
struct sd_set *sd_set,
const struct capture_config *config,
ntfs_volume **ntfs_vol_p,
- int flags)
+ int add_image_flags,
+ wimlib_progress_func_t progress_func)
{
u32 attributes;
int mrec_flags;
char dos_name_utf8[64];
struct dentry *root;
+ if (exclude_path(path, config, false)) {
+ if ((add_image_flags & WIMLIB_ADD_IMAGE_FLAG_VERBOSE)
+ && progress_func)
+ {
+ union wimlib_progress_info info;
+ info.scan.cur_path = path;
+ info.scan.excluded = true;
+ progress_func(WIMLIB_PROGRESS_MSG_SCAN_DENTRY, &info);
+ }
+ *root_p = NULL;
+ return 0;
+ }
+
mrec_flags = ni->mrec->flags;
struct SECURITY_CONTEXT ctx;
memset(&ctx, 0, sizeof(ctx));
return WIMLIB_ERR_NTFS_3G;
}
- if (exclude_path(path, config, false)) {
- if (flags & WIMLIB_ADD_IMAGE_FLAG_VERBOSE) {
- const char *file_type;
- if (attributes & MFT_RECORD_IS_DIRECTORY)
- file_type = "directory";
- else
- file_type = "file";
- printf("Excluding %s `%s' from capture\n",
- file_type, path);
- }
- *root_p = NULL;
- return 0;
+ if ((add_image_flags & WIMLIB_ADD_IMAGE_FLAG_VERBOSE)
+ && progress_func)
+ {
+ union wimlib_progress_info info;
+ info.scan.cur_path = path;
+ info.scan.excluded = false;
+ progress_func(WIMLIB_PROGRESS_MSG_SCAN_DENTRY, &info);
}
- if (flags & WIMLIB_ADD_IMAGE_FLAG_VERBOSE)
- printf("Scanning `%s'\n", path);
-
root = new_dentry_with_timeless_inode(path_basename(path));
if (!root)
return WIMLIB_ERR_NOMEM;
.sd_set = sd_set,
.config = config,
.ntfs_vol_p = ntfs_vol_p,
- .flags = flags,
+ .add_image_flags = add_image_flags,
+ .progress_func = progress_func,
};
ret = ntfs_readdir(ni, &pos, &ctx, wim_ntfs_capture_filldir);
if (ret != 0) {
return ret;
}
-static int build_dentry_tree_ntfs(struct dentry **root_p,
- const char *device,
- struct lookup_table *lookup_table,
- struct wim_security_data *sd,
- const struct capture_config *config,
- int flags,
- void *extra_arg)
+int build_dentry_tree_ntfs(struct dentry **root_p,
+ const char *device,
+ struct lookup_table *lookup_table,
+ struct wim_security_data *sd,
+ const struct capture_config *config,
+ int add_image_flags,
+ wimlib_progress_func_t progress_func,
+ void *extra_arg)
{
ntfs_volume *vol;
ntfs_inode *root_ni;
ret = build_dentry_tree_ntfs_recursive(root_p, NULL, root_ni, path, 1,
FILE_NAME_POSIX, lookup_table,
&sd_set, config, ntfs_vol_p,
- flags);
+ add_image_flags,
+ progress_func);
out_cleanup:
FREE(path);
ntfs_inode_close(root_ni);
}
return ret;
}
-
-
-
-WIMLIBAPI int wimlib_add_image_from_ntfs_volume(WIMStruct *w,
- const char *device,
- const char *name,
- const char *config_str,
- size_t config_len,
- int flags)
-{
- if (flags & (WIMLIB_ADD_IMAGE_FLAG_DEREFERENCE)) {
- ERROR("Cannot dereference files when capturing directly from NTFS");
- return WIMLIB_ERR_INVALID_PARAM;
- }
- return do_add_image(w, device, name, config_str, config_len, flags,
- build_dentry_tree_ntfs, &w->ntfs_vol);
-}
-
-#else /* WITH_NTFS_3G */
-WIMLIBAPI int wimlib_add_image_from_ntfs_volume(WIMStruct *w,
- const char *device,
- const char *name,
- const char *config_str,
- size_t config_len,
- int flags)
-{
- ERROR("wimlib was compiled without support for NTFS-3g, so");
- ERROR("we cannot capture a WIM image directly from a NTFS volume");
- return WIMLIB_ERR_UNSUPPORTED;
-}
-#endif /* WITH_NTFS_3G */