Replaced all occurrences of the libntfs-specific NVolWasDirty macro with a test for the VOLUME_IS_DIRTY flag in vol->flags.
This is not a perfect conversion. The VOLUME_IS_DIRTY flag reflects the _current_ state of the volume dirty bit and not the mount-time state. However, since libntfs-3g (as opposed to libntfs) does not automatically change the dirty bit on mount and unmount (only when ntfs_volume_write_flags is called explicitly), and these tests are done directly after a mount (ntfsclone.c, ntfscp.c, ntfsresize.c, ntfswipe.c, utils.c) or when the volume is in an appropriate state (ntfsfix.c), the result will be the same.edge.strict_endians
parent
dd3d394010
commit
f5f3878a8e
|
@ -1397,7 +1397,7 @@ static void mount_volume(unsigned long new_mntflag)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
if (NVolWasDirty(vol))
|
||||
if (vol->flags & VOLUME_IS_DIRTY)
|
||||
if (opt.force-- <= 0)
|
||||
err_exit(dirty_volume_msg, opt.volume);
|
||||
|
||||
|
|
|
@ -357,7 +357,7 @@ int main(int argc, char *argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (NVolWasDirty(vol) && !opts.force)
|
||||
if ((vol->flags & VOLUME_IS_DIRTY) && !opts.force)
|
||||
goto umount;
|
||||
|
||||
{
|
||||
|
|
|
@ -248,7 +248,9 @@ static int set_dirty_flag(ntfs_volume *vol)
|
|||
{
|
||||
le16 flags;
|
||||
|
||||
if (NVolWasDirty(vol))
|
||||
/* Porting note: We test for the current state of VOLUME_IS_DIRTY. This
|
||||
* should actually be more appropriate than testing for NVolWasDirty. */
|
||||
if (vol->flags | VOLUME_IS_DIRTY)
|
||||
return 0;
|
||||
ntfs_log_info("Setting required flags on partition... ");
|
||||
/*
|
||||
|
|
|
@ -2262,7 +2262,7 @@ static ntfs_volume *mount_volume(void)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
if (NVolWasDirty(vol))
|
||||
if (vol->flags & VOLUME_IS_DIRTY)
|
||||
if (opt.force-- <= 0)
|
||||
err_exit("Volume is scheduled for check.\nRun chkdsk /f"
|
||||
" and please try again, or see option -f.\n");
|
||||
|
|
|
@ -1348,7 +1348,7 @@ int main(int argc, char *argv[])
|
|||
if (!vol)
|
||||
goto free;
|
||||
|
||||
if (NVolWasDirty(vol) && !opts.force)
|
||||
if ((vol->flags & VOLUME_IS_DIRTY) && !opts.force)
|
||||
goto umount;
|
||||
|
||||
if (opts.info) {
|
||||
|
|
|
@ -237,7 +237,11 @@ ntfs_volume * utils_mount_volume(const char *device, ntfs_mount_flags flags)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (NVolWasDirty(vol)) {
|
||||
/* Porting notes:
|
||||
* libntfs-3g does not record whether the volume log file was dirty
|
||||
* before mount, so we can only warn if the VOLUME_IS_DIRTY flag is set
|
||||
* in VOLUME_INFORMATION. */
|
||||
if (vol->flags & VOLUME_IS_DIRTY) {
|
||||
if (!(flags & NTFS_MNT_FORCE)) {
|
||||
ntfs_log_error("%s", dirty_volume_msg);
|
||||
ntfs_umount(vol, FALSE);
|
||||
|
|
Loading…
Reference in New Issue