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
Erik Larsson 2010-12-02 07:56:29 +01:00
parent dd3d394010
commit f5f3878a8e
6 changed files with 12 additions and 6 deletions

View File

@ -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);

View File

@ -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;
{

View File

@ -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... ");
/*

View File

@ -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");

View File

@ -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) {

View File

@ -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);