diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c index 86016bb1..7ea0c1cc 100644 --- a/src/ntfs-3g.c +++ b/src/ntfs-3g.c @@ -1616,7 +1616,7 @@ static int ntfs_fuse_init(void) return 0; } -static ntfs_volume *ntfs_open(const char *device, int blkdev) +static ntfs_volume *ntfs_open(const char *device, char *mntpoint, int blkdev) { unsigned long flags = 0; @@ -1627,7 +1627,7 @@ static ntfs_volume *ntfs_open(const char *device, int blkdev) if (ctx->noatime) flags |= MS_NOATIME; - ctx->vol = utils_mount_volume(device, flags, ctx->force); + ctx->vol = utils_mount_volume(device, mntpoint, flags, ctx->force); return ctx->vol; } @@ -2131,7 +2131,7 @@ int main(int argc, char *argv[]) if (S_ISBLK(sbuf.st_mode) && (fstype != FSTYPE_FUSE)) use_blkdev = 1; - if (!ntfs_open(opts.device, use_blkdev)) + if (!ntfs_open(opts.device, opts.mnt_point, use_blkdev)) goto err_out; if (use_blkdev) diff --git a/src/utils.c b/src/utils.c index a35288fc..bef7ef19 100644 --- a/src/utils.c +++ b/src/utils.c @@ -117,6 +117,17 @@ static const char *fakeraid_msg = "different device under /dev/mapper, (e.g. /dev/mapper/nvidia_eahaabcc1)\n" "to mount NTFS. Please see the 'dmraid' documentation for help.\n"; +static const char *dirty_volume_msg = +"Volume is scheduled for check. Please boot into Windows TWICE, or\n" +"use the 'force' mount option. For example type on the command line:\n" +"\n" +" mount -t ntfs-3g %s %s -o force\n" +"\n" +"Or add the option to the relevant row in the /etc/fstab file:\n" +"\n" +" %s %s ntfs-3g defaults,force 0 0\n" +"\n"; + /** * utils_set_locale */ @@ -134,8 +145,8 @@ int utils_set_locale(void) } } -ntfs_volume *utils_mount_volume(const char *volume, unsigned long flags, - BOOL force) +ntfs_volume *utils_mount_volume(const char *volume, const char *mntpoint, + unsigned long flags, BOOL force) { ntfs_volume *vol; @@ -162,9 +173,8 @@ ntfs_volume *utils_mount_volume(const char *volume, unsigned long flags, if (vol->flags & VOLUME_IS_DIRTY) { if (!force) { - ntfs_log_error("Volume is scheduled for check.\nPlease " - "boot into Windows TWICE, or use the " - "'force' mount option.\n"); + ntfs_log_error(dirty_volume_msg, volume, mntpoint, + volume, mntpoint); ntfs_umount(vol, FALSE); return NULL; diff --git a/src/utils.h b/src/utils.h index 527dd435..4d0fdcd6 100644 --- a/src/utils.h +++ b/src/utils.h @@ -55,7 +55,8 @@ 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, const char *mntpoint, + unsigned long flags, BOOL force); /** * defines...