Introduce NTFS_MNT_FORCE instead of third parameter of utils_mount_volume
parent
57cc7904c9
commit
37476cf609
|
@ -60,6 +60,7 @@ typedef enum {
|
|||
NTFS_MNT_FORENSIC = 2,
|
||||
NTFS_MNT_CASE_SENSITIVE = 4,
|
||||
NTFS_MNT_NOT_EXCLUSIVE = 8,
|
||||
NTFS_MNT_FORCE = 16,
|
||||
} ntfs_mount_flags;
|
||||
|
||||
/**
|
||||
|
|
|
@ -410,7 +410,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
utils_set_locale();
|
||||
|
||||
vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY, opts.force);
|
||||
vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY |
|
||||
(opts.force ? NTFS_MNT_FORCE : 0));
|
||||
if (!vol) {
|
||||
ntfs_log_perror("ERROR: couldn't mount volume");
|
||||
return 1;
|
||||
|
|
|
@ -492,7 +492,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
utils_set_locale();
|
||||
|
||||
vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY, opts.force);
|
||||
vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY |
|
||||
(opts.force ? NTFS_MNT_FORCE : 0));
|
||||
if (!vol)
|
||||
return 1;
|
||||
|
||||
|
|
|
@ -345,8 +345,10 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (opts.noaction)
|
||||
flags = NTFS_MNT_RDONLY;
|
||||
if (opts.force)
|
||||
flags |= NTFS_MNT_FORCE;
|
||||
|
||||
vol = utils_mount_volume(opts.device, flags, opts.force);
|
||||
vol = utils_mount_volume(opts.device, flags);
|
||||
if (!vol) {
|
||||
ntfs_log_perror("ERROR: couldn't mount volume");
|
||||
return 1;
|
||||
|
|
|
@ -1307,7 +1307,8 @@ int main(int argc, char *argv[])
|
|||
return 1;
|
||||
}
|
||||
/* Mount the ntfs volume. */
|
||||
vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY, opts.force);
|
||||
vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY |
|
||||
(opts.force ? NTFS_MNT_FORCE : 0));
|
||||
if (!vol) {
|
||||
ntfs_log_error("Failed to mount ntfs volume. Aborting.\n");
|
||||
ntfs_rsa_private_key_release(rsa_key);
|
||||
|
|
|
@ -2246,7 +2246,8 @@ int main(int argc, char **argv)
|
|||
|
||||
utils_set_locale();
|
||||
|
||||
vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY, opts.force);
|
||||
vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY |
|
||||
(opts.force ? NTFS_MNT_FORCE : 0));
|
||||
if (!vol) {
|
||||
printf("Failed to open '%s'.\n", opts.device);
|
||||
exit(1);
|
||||
|
|
|
@ -394,8 +394,9 @@ int main(int argc, char **argv)
|
|||
if (!opts.label)
|
||||
opts.noaction++;
|
||||
|
||||
vol = utils_mount_volume(opts.device, opts.noaction ?
|
||||
NTFS_MNT_RDONLY : 0, opts.force);
|
||||
vol = utils_mount_volume(opts.device,
|
||||
(opts.noaction ? NTFS_MNT_RDONLY : 0) |
|
||||
(opts.force ? NTFS_MNT_FORCE : 0));
|
||||
if (!vol)
|
||||
return 1;
|
||||
|
||||
|
|
|
@ -651,7 +651,8 @@ int main(int argc, char **argv)
|
|||
|
||||
utils_set_locale();
|
||||
|
||||
vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY, opts.force);
|
||||
vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY |
|
||||
(opts.force ? NTFS_MNT_FORCE : 0));
|
||||
if (!vol) {
|
||||
// FIXME: Print error... (AIA)
|
||||
return 2;
|
||||
|
|
|
@ -1662,8 +1662,8 @@ static int ntfs_fuse_mount(void)
|
|||
vol = utils_mount_volume(ctx->device,
|
||||
(ctx->case_insensitive ? 0 : NTFS_MNT_CASE_SENSITIVE) |
|
||||
(ctx->blkdev ? NTFS_MNT_NOT_EXCLUSIVE : 0) |
|
||||
(ctx->ro ? NTFS_MNT_RDONLY : 0),
|
||||
ctx->force);
|
||||
(ctx->force ? NTFS_MNT_FORCE : 0) |
|
||||
(ctx->ro ? NTFS_MNT_RDONLY : 0));
|
||||
if (!vol) {
|
||||
ntfs_log_error("Mount failed.\n");
|
||||
return -1;
|
||||
|
|
|
@ -876,8 +876,10 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (opts.noaction)
|
||||
flags |= NTFS_MNT_RDONLY;
|
||||
if (opts.force)
|
||||
flags |= NTFS_MNT_FORCE;
|
||||
|
||||
vol = utils_mount_volume(opts.device, flags, opts.force);
|
||||
vol = utils_mount_volume(opts.device, flags);
|
||||
if (!vol) {
|
||||
ntfs_log_info("!vol\n");
|
||||
return 1;
|
||||
|
|
|
@ -2155,7 +2155,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
utils_set_locale();
|
||||
|
||||
vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY, opts.force);
|
||||
vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY |
|
||||
(opts.force ? NTFS_MNT_FORCE : 0));
|
||||
if (!vol)
|
||||
return 1;
|
||||
|
||||
|
|
|
@ -1341,8 +1341,10 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (opts.info || opts.noaction)
|
||||
flags = NTFS_MNT_RDONLY;
|
||||
if (opts.force)
|
||||
flags |= NTFS_MNT_FORCE;
|
||||
|
||||
vol = utils_mount_volume(opts.device, flags, opts.force);
|
||||
vol = utils_mount_volume(opts.device, flags);
|
||||
if (!vol)
|
||||
goto free;
|
||||
|
||||
|
|
|
@ -206,8 +206,7 @@ int utils_valid_device(const char *name, int force)
|
|||
/**
|
||||
* utils_mount_volume - Mount an NTFS volume
|
||||
*/
|
||||
ntfs_volume * utils_mount_volume(const char *device, unsigned long flags,
|
||||
BOOL force)
|
||||
ntfs_volume * utils_mount_volume(const char *device, ntfs_mount_flags flags)
|
||||
{
|
||||
ntfs_volume *vol;
|
||||
|
||||
|
@ -216,7 +215,7 @@ ntfs_volume * utils_mount_volume(const char *device, unsigned long flags,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!utils_valid_device(device, force))
|
||||
if (!utils_valid_device(device, flags & NTFS_MNT_FORCE))
|
||||
return NULL;
|
||||
|
||||
vol = ntfs_mount(device, flags);
|
||||
|
@ -238,7 +237,7 @@ ntfs_volume * utils_mount_volume(const char *device, unsigned long flags,
|
|||
}
|
||||
|
||||
if (NVolWasDirty(vol)) {
|
||||
if (!force) {
|
||||
if (!(flags & NTFS_MNT_FORCE)) {
|
||||
ntfs_log_error("%s", dirty_volume_msg);
|
||||
ntfs_umount(vol, FALSE);
|
||||
return NULL;
|
||||
|
|
|
@ -56,7 +56,7 @@ ATTR_RECORD * find_attribute(const ATTR_TYPES type, ntfs_attr_search_ctx *ctx);
|
|||
ATTR_RECORD * find_first_attribute(const ATTR_TYPES type, MFT_RECORD *mft);
|
||||
|
||||
int utils_valid_device(const char *name, int force);
|
||||
ntfs_volume * utils_mount_volume(const char *device, unsigned long flags, BOOL force);
|
||||
ntfs_volume * utils_mount_volume(const char *device, ntfs_mount_flags flags);
|
||||
|
||||
/**
|
||||
* defines...
|
||||
|
|
Loading…
Reference in New Issue