diff -ur ntfsprogs-2.0.0/include/ntfs/device.h ntfsprogs-2.0.0-offset/include/ntfs/device.h --- ntfsprogs-2.0.0/include/ntfs/device.h 2007-09-26 13:28:40.000000000 -0500 +++ ntfsprogs-2.0.0-offset/include/ntfs/device.h 2009-11-29 22:13:50.184588111 -0600 @@ -73,6 +73,7 @@ struct ntfs_device_operations *d_ops; /* Device operations. */ unsigned long d_state; /* State of the device. */ char *d_name; /* Name of device. */ + s64 d_part_offset; /* Start offset of partition. */ void *d_private; /* Private data used by the device operations. */ }; diff -ur ntfsprogs-2.0.0/include/ntfs/volume.h ntfsprogs-2.0.0-offset/include/ntfs/volume.h --- ntfsprogs-2.0.0/include/ntfs/volume.h 2007-09-27 07:32:20.000000000 -0500 +++ ntfsprogs-2.0.0-offset/include/ntfs/volume.h 2009-11-29 22:13:50.185016054 -0600 @@ -236,7 +236,8 @@ ntfs_mount_flags flags); extern int ntfs_device_umount(ntfs_volume *vol, const BOOL force); -extern ntfs_volume *ntfs_mount(const char *name, ntfs_mount_flags flags); +extern ntfs_volume *ntfs_mount(const char *name, s64 part_offset, + ntfs_mount_flags flags); extern int ntfs_umount(ntfs_volume *vol, const BOOL force); extern int ntfs_version_is_supported(ntfs_volume *vol); diff -ur ntfsprogs-2.0.0/libntfs/gnome-vfs-method.c ntfsprogs-2.0.0-offset/libntfs/gnome-vfs-method.c --- ntfsprogs-2.0.0/libntfs/gnome-vfs-method.c 2007-09-26 13:28:34.000000000 -0500 +++ ntfsprogs-2.0.0-offset/libntfs/gnome-vfs-method.c 2009-11-29 22:13:50.185504228 -0600 @@ -162,7 +162,7 @@ return GNOME_VFS_ERROR_INVALID_URI; } - if (!(volume = ntfs_mount(uri->parent->text, + if (!(volume = ntfs_mount(uri->parent->text, 0, NTFS_MNT_RDONLY))) { g_free(uri_parent_string); return GNOME_VFS_ERROR_WRONG_FORMAT; diff -ur ntfsprogs-2.0.0/libntfs/unix_io.c ntfsprogs-2.0.0-offset/libntfs/unix_io.c --- ntfsprogs-2.0.0/libntfs/unix_io.c 2007-09-26 13:28:34.000000000 -0500 +++ ntfsprogs-2.0.0-offset/libntfs/unix_io.c 2009-11-29 22:13:50.185778041 -0600 @@ -119,6 +119,7 @@ NDevSetBlock(dev); /* Set our open flag. */ NDevSetOpen(dev); + lseek(DEV_FD(dev), dev->d_part_offset, SEEK_SET); return 0; err_out: free(dev->d_private); @@ -175,7 +176,15 @@ static s64 ntfs_device_unix_io_seek(struct ntfs_device *dev, s64 offset, int whence) { - return lseek(DEV_FD(dev), offset, whence); + if (whence == SEEK_SET) { + return lseek(DEV_FD(dev), dev->d_part_offset + offset, whence); + } else { + /** + * FIXME: should take into account the end offset but + * it is never used. + */ + return lseek(DEV_FD(dev), offset, whence); + } } /** @@ -229,7 +238,7 @@ static s64 ntfs_device_unix_io_pread(struct ntfs_device *dev, void *buf, s64 count, s64 offset) { - return pread(DEV_FD(dev), buf, count, offset); + return pread(DEV_FD(dev), buf, count, dev->d_part_offset + offset); } /** @@ -251,7 +260,7 @@ return -1; } NDevSetDirty(dev); - return pwrite(DEV_FD(dev), buf, count, offset); + return pwrite(DEV_FD(dev), buf, count, dev->d_part_offset + offset); } /** diff -ur ntfsprogs-2.0.0/libntfs/volume.c ntfsprogs-2.0.0-offset/libntfs/volume.c --- ntfsprogs-2.0.0/libntfs/volume.c 2007-09-27 07:55:33.000000000 -0500 +++ ntfsprogs-2.0.0-offset/libntfs/volume.c 2009-11-29 22:13:50.186456724 -0600 @@ -1314,6 +1314,7 @@ * soon as the function returns. */ ntfs_volume *ntfs_mount(const char *name __attribute__((unused)), + s64 part_offset __attribute__((unused)), ntfs_mount_flags flags __attribute__((unused))) { #ifndef NO_NTFS_DEVICE_DEFAULT_IO_OPS @@ -1324,6 +1325,9 @@ dev = ntfs_device_alloc(name, 0, &ntfs_device_default_io_ops, NULL); if (!dev) return NULL; + + dev->d_part_offset = part_offset; + /* Call ntfs_device_mount() to do the actual mount. */ vol = ntfs_device_mount(dev, flags); if (!vol) { diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfscat.8.in ntfsprogs-2.0.0-offset/ntfsprogs/ntfscat.8.in --- ntfsprogs-2.0.0/ntfsprogs/ntfscat.8.in 2007-09-26 13:31:55.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfscat.8.in 2009-11-29 22:13:50.186738457 -0600 @@ -70,6 +70,9 @@ \fB\-i\fR, \fB\-\-inode\fR NUM Specify a file by its inode number instead of its name. .TP +\fB\-O\fR, \fB\-\-offset\fR BYTES +Offset, in bytes, of the NTFS partition from the start of the device. +.TP \fB\-f\fR, \fB\-\-force\fR This will override some sensible defaults, such as not using a mounted volume. Use this option with caution. diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfscat.c ntfsprogs-2.0.0-offset/ntfsprogs/ntfscat.c --- ntfsprogs-2.0.0/ntfsprogs/ntfscat.c 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfscat.c 2009-11-29 22:13:50.187057077 -0600 @@ -82,7 +82,8 @@ ntfs_log_info("\nUsage: %s [options] device [file]\n\n" " -a, --attribute TYPE Display this attribute type\n" " -n, --attribute-name NAME Display this attribute name\n" - " -i, --inode NUM Display this inode\n\n" + " -i, --inode NUM Display this inode\n" + " -O, --offset BYTES Partition Offset\n\n" " -f, --force Use less caution\n" " -h, --help Print this help\n" " -q, --quiet Less output\n" @@ -166,6 +167,7 @@ { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, { "inode", required_argument, NULL, 'i' }, + { "offset", required_argument, NULL, 'O' }, { "quiet", no_argument, NULL, 'q' }, { "version", no_argument, NULL, 'V' }, { "verbose", no_argument, NULL, 'v' }, @@ -186,6 +188,7 @@ opts.attr = cpu_to_le32(-1); opts.attr_name = NULL; opts.attr_name_len = 0; + opts.part_offset = -1; while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) { switch (c) { @@ -257,6 +260,11 @@ case 'r': opts.raw = TRUE; break; + case 'O': + if (!utils_parse_llong(optarg, "partition offset", + &opts.part_offset)) + err++; + break; default: ntfs_log_error("Unknown option '%s'.\n", argv[optind-1]); err++; @@ -410,8 +418,9 @@ utils_set_locale(); - vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY | - (opts.force ? NTFS_MNT_FORCE : 0)); + vol = utils_mount_volume(opts.device, + (opts.part_offset == -1 ? 0 : opts.part_offset), + NTFS_MNT_RDONLY | (opts.force ? NTFS_MNT_FORCE : 0)); if (!vol) { ntfs_log_perror("ERROR: couldn't mount volume"); return 1; diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfscat.h ntfsprogs-2.0.0-offset/ntfsprogs/ntfscat.h --- ntfsprogs-2.0.0/ntfsprogs/ntfscat.h 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfscat.h 2009-11-29 22:13:50.187271777 -0600 @@ -39,6 +39,7 @@ int quiet; /* Less output */ int verbose; /* Extra output */ BOOL raw; /* Raw data output */ + s64 part_offset; /* Partition offset */ }; #endif /* _NTFSCAT_H_ */ diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfsclone.8.in ntfsprogs-2.0.0-offset/ntfsprogs/ntfsclone.8.in --- ntfsprogs-2.0.0/ntfsprogs/ntfsclone.8.in 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfsclone.8.in 2009-11-29 22:13:50.187596049 -0600 @@ -219,6 +219,9 @@ (for NTFS experts). Moreover only cloning to a file is allowed. You can't metadata\-only clone to a device, image or standard output. .TP +\fB\-\-offset\fR BYTES +Offset, in bytes, of the NTFS partition from the start of the device. +.TP \fB\-\-ignore\-fs\-check\fR Ignore the result of the filesystem consistency check. This option is allowed to be used only with the diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfsclone.c ntfsprogs-2.0.0-offset/ntfsprogs/ntfsclone.c --- ntfsprogs-2.0.0/ntfsprogs/ntfsclone.c 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfsclone.c 2009-11-29 22:19:18.340412137 -0600 @@ -116,7 +116,12 @@ int restore_image; char *output; char *volume; +#if defined(__sun) && defined(__unix) + struct statvfs stfs; +#else struct statfs stfs; +#endif + s64 part_offset; } opt; struct bitmap { @@ -292,6 +297,7 @@ " -r, --restore-image Restore from the special image format\n" " --rescue Continue after disk read errors\n" " -m, --metadata Clone *only* metadata (for NTFS experts)\n" + " --offset BYTES Partition offset\n" " --ignore-fs-check Ignore the filesystem check result\n" " -f, --force Force to progress (DANGEROUS)\n" " -h, --help Display this help\n" @@ -323,12 +329,14 @@ { "ignore-fs-check", no_argument, NULL, 'C' }, { "rescue", no_argument, NULL, 'R' }, { "save-image", no_argument, NULL, 's' }, + { "offset", required_argument, NULL, 'P' }, { NULL, 0, NULL, 0 } }; int c; memset(&opt, 0, sizeof(opt)); + opt.part_offset = -1; while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) { switch (c) { @@ -368,6 +376,11 @@ case 's': opt.save_image++; break; + case 'P': + if (!utils_parse_llong(optarg, "partition offset", + &opt.part_offset)) + usage(); + break; default: err_printf("Unknown option '%s'.\n", argv[optind-1]); usage(); @@ -588,13 +601,14 @@ } if (write_all(&fd_out, buff, csize) == -1) { - int err = errno; perr_printf("Write failed"); - if (err == EIO && opt.stfs.f_type == 0x517b) +#if !(defined(__sun) && defined(__unix)) + if (errno == EIO && opt.stfs.f_type == 0x517b) Printf("Apparently you tried to clone to a remote " "Windows computer but they don't\nhave " "efficient sparse file handling by default. " "Please try a different method.\n"); +#endif /* !(defined(__sun) && defined(__unix)) */ exit(1); } } @@ -1380,7 +1394,9 @@ { check_if_mounted(opt.volume, new_mntflag); - if (!(vol = ntfs_mount(opt.volume, new_mntflag))) { + if (!(vol = ntfs_mount(opt.volume, + (opt.part_offset == -1 ? 0 : opt.part_offset), + new_mntflag))) { int err = errno; @@ -1486,6 +1502,33 @@ static void set_filesize(s64 filesize) { + +#if defined(__sun) && defined(__unix) + + if (fstatvfs(fd_out, &opt.stfs) == -1) + Printf("WARNING: Couldn't get filesystem type: " + "%s\n", strerror(errno)); + + if (strcmp(opt.stfs.f_basetype, "pcfs") == 0) + Printf("WARNING: You're using PCFS, it does not support " + "sparse files so the next operation might take " + "a while. You should consider using the more " + "efficient --save-image option of ntfsclone. Use " + "the --restore-image option to restore the image.\n"); + + if (ftruncate(fd_out, filesize) == -1) { + int err = errno; + perr_printf("ftruncate failed for file '%s'", opt.output); + Printf("Destination filesystem type is %s\n", + opt.stfs.f_basetype); + if (err == EFBIG || (err == EINVAL && filesize > 0)) + Printf("Your system or the destination filesystem " + "doesn't support large files.\n"); + exit(1); + } + +#else /* ! (defined(__sun) && defined(__unix)) */ + long fs_type = 0; /* Unknown filesystem type */ if (fstatfs(fd_out, &opt.stfs) == -1) @@ -1528,6 +1571,8 @@ } exit(1); } + +#endif /* defined(__sun) && defined(__unix) */ } static s64 open_image(void) diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfscluster.8.in ntfsprogs-2.0.0-offset/ntfsprogs/ntfscluster.8.in --- ntfsprogs-2.0.0/ntfsprogs/ntfscluster.8.in 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfscluster.8.in 2009-11-29 22:13:50.188527202 -0600 @@ -54,6 +54,9 @@ \fB\-F\fR, \fB\-\-filename\fR NAME Show information about this file. .TP +\fB\-O\fR, \fB\-\-offset\fR BYTES +Offset, in bytes, of the NTFS partition from the start of the device. +.TP \fB\-f\fR, \fB\-\-force\fR This will override some sensible defaults, such as not working with a mounted volume. Use this option with caution. diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfscluster.c ntfsprogs-2.0.0-offset/ntfsprogs/ntfscluster.c --- ntfsprogs-2.0.0/ntfsprogs/ntfscluster.c 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfscluster.c 2009-11-29 22:13:50.188864579 -0600 @@ -90,6 +90,7 @@ " -I, --inode NUM Show information about this inode\n" " -F, --filename NAME Show information about this file\n" /* " -l, --last Find the last file on the volume\n" */ + " -O, --offset BYTES Partition offset\n" "\n" " -f, --force Use less caution\n" " -q, --quiet Less output\n" @@ -119,6 +120,7 @@ { "help", no_argument, NULL, 'h' }, { "info", no_argument, NULL, 'i' }, { "inode", required_argument, NULL, 'I' }, + { "offset", required_argument, NULL, 'O' }, { "last", no_argument, NULL, 'l' }, { "quiet", no_argument, NULL, 'q' }, { "sector", required_argument, NULL, 's' }, @@ -139,6 +141,7 @@ opts.action = act_none; opts.range_begin = -1; opts.range_end = -1; + opts.part_offset = -1; while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) { switch (c) { @@ -218,6 +221,11 @@ case 'V': ver++; break; + case 'O': + if (!utils_parse_llong(optarg, "partition offset", + &opts.part_offset)) + err++; + break; default: if ((optopt == 'c') || (optopt == 's')) ntfs_log_error("Option '%s' requires an argument.\n", argv[optind-1]); @@ -492,8 +500,9 @@ utils_set_locale(); - vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY | - (opts.force ? NTFS_MNT_FORCE : 0)); + vol = utils_mount_volume(opts.device, + (opts.part_offset == -1 ? 0 : opts.part_offset), + NTFS_MNT_RDONLY | (opts.force ? NTFS_MNT_FORCE : 0)); if (!vol) return 1; diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfscluster.h ntfsprogs-2.0.0-offset/ntfsprogs/ntfscluster.h --- ntfsprogs-2.0.0/ntfsprogs/ntfscluster.h 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfscluster.h 2009-11-29 22:13:50.189083220 -0600 @@ -48,6 +48,7 @@ u64 inode; /* Inode to examine */ s64 range_begin; /* Look for objects in this range */ s64 range_end; + s64 part_offset; /* Partition offset */ }; struct match { diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfscmp.c ntfsprogs-2.0.0-offset/ntfsprogs/ntfscmp.c --- ntfsprogs-2.0.0/ntfsprogs/ntfscmp.c 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfscmp.c 2009-11-29 22:13:50.189546158 -0600 @@ -960,7 +960,7 @@ "You must 'umount' it first.\n", volume); } - vol = ntfs_mount(volume, NTFS_MNT_RDONLY); + vol = ntfs_mount(volume, 0, NTFS_MNT_RDONLY); if (vol == NULL) { int err = errno; diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfscp.8.in ntfsprogs-2.0.0-offset/ntfsprogs/ntfscp.8.in --- ntfsprogs-2.0.0/ntfsprogs/ntfscp.8.in 2007-09-24 13:56:16.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfscp.8.in 2009-11-29 22:13:50.189802584 -0600 @@ -38,6 +38,9 @@ .I destination as inode number. .TP +\fB\-O\fR, \fB\-\-offset\fR BYTES +Offset, in bytes, of the NTFS partition from the start of the device. +.TP \fB\-N\fR, \fB\-\-attr\-name\fR NAME Write to attribute with this name. .TP diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfscp.c ntfsprogs-2.0.0-offset/ntfsprogs/ntfscp.c --- ntfsprogs-2.0.0/ntfsprogs/ntfscp.c 2007-09-24 13:48:43.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfscp.c 2009-11-29 22:13:50.190144200 -0600 @@ -68,6 +68,7 @@ int noaction; /* Do not write to disk */ ATTR_TYPES attribute; /* Write to this attribute. */ int inode; /* Treat dest_file as inode number. */ + s64 part_offset; /* Partition offset */ }; static const char *EXEC_NAME = "ntfscp"; @@ -103,6 +104,7 @@ ntfs_log_info("\nUsage: %s [options] device src_file dest_file\n\n" " -a, --attribute NUM Write to this attribute\n" " -i, --inode Treat dest_file as inode number\n" + " -O, --offset BYTES Partition offset\n" " -f, --force Use less caution\n" " -h, --help Print this help\n" " -N, --attr-name NAME Write to attribute with this name\n" @@ -129,6 +131,7 @@ static const struct option lopt[] = { { "attribute", required_argument, NULL, 'a' }, { "inode", no_argument, NULL, 'i' }, + { "offset", required_argument, NULL, 'O' }, { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, { "attr-name", required_argument, NULL, 'N' }, @@ -153,6 +156,7 @@ opts.attr_name = NULL; opts.inode = 0; opts.attribute = AT_DATA; + opts.part_offset = -1; opterr = 0; /* We'll handle the errors, thank you. */ @@ -223,6 +227,11 @@ opts.verbose++; ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE); break; + case 'O': + if (!utils_parse_llong(optarg, "partition offset", + &opts.part_offset)) + err++; + break; default: ntfs_log_error("Unknown option '%s'.\n", argv[optind - 1]); @@ -350,7 +359,8 @@ if (opts.force) flags |= NTFS_MNT_FORCE; - vol = utils_mount_volume(opts.device, flags); + vol = utils_mount_volume(opts.device, + (opts.part_offset == -1 ? 0 : opts.part_offset), flags); if (!vol) { ntfs_log_perror("ERROR: couldn't mount volume"); return 1; diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfsdecrypt.c ntfsprogs-2.0.0-offset/ntfsprogs/ntfsdecrypt.c --- ntfsprogs-2.0.0/ntfsprogs/ntfsdecrypt.c 2007-09-27 08:40:43.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfsdecrypt.c 2009-11-29 22:13:50.190727220 -0600 @@ -130,6 +130,7 @@ int force; /* Override common sense */ int quiet; /* Less output */ int verbose; /* Extra output */ + s64 part_offset; /* Partition offset */ }; static const char *EXEC_NAME = "ntfsdecrypt"; @@ -169,6 +170,7 @@ ntfs_log_info("\nUsage: %s [options] -k name.pfx device [file]\n\n" " -i, --inode num Display this inode\n\n" " -k --keyfile name.pfx Use file name as the user's private key file.\n" + " -O --offset BYTES Partition offset\n" " -f --force Use less caution\n" " -h --help Print this help\n" " -q --quiet Less output\n" @@ -195,6 +197,7 @@ {"help", no_argument, NULL, 'h'}, {"inode", required_argument, NULL, 'i'}, {"keyfile", required_argument, NULL, 'k'}, + {"offset", required_argument, NULL, 'O'}, {"quiet", no_argument, NULL, 'q'}, {"version", no_argument, NULL, 'V'}, {"verbose", no_argument, NULL, 'v'}, @@ -209,6 +212,7 @@ opterr = 0; /* We'll handle the errors, thank you. */ opts.inode = -1; + opts.part_offset = -1; while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) { switch (c) { @@ -260,6 +264,11 @@ opts.verbose++; ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE); break; + case 'O': + if (!utils_parse_llong(optarg, "partition offset", + &opts.part_offset)) + err++; + break; default: ntfs_log_error("Unknown option '%s'.\n", argv[optind - 1]); @@ -1452,8 +1461,9 @@ return 1; } /* Mount the ntfs volume. */ - vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY | - (opts.force ? NTFS_MNT_FORCE : 0)); + vol = utils_mount_volume(opts.device, + (opts.part_offset == -1 ? 0 : opts.part_offset), + 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); diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfsfix.8.in ntfsprogs-2.0.0-offset/ntfsprogs/ntfsfix.8.in --- ntfsprogs-2.0.0/ntfsprogs/ntfsfix.8.in 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfsfix.8.in 2009-11-29 22:13:50.190981567 -0600 @@ -37,6 +37,9 @@ .BR "\-f \-v" . Long named options can be abbreviated to any unique prefix of their name. .TP +\fB\-O\fR, \fB\-\-offset\fR BYTES +Offset, in bytes, of the NTFS partition from the start of the device. +.TP \fB\-h\fR, \fB\-\-help\fR Show a list of options with a brief description of each one. .TP diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfsfix.c ntfsprogs-2.0.0-offset/ntfsprogs/ntfsfix.c --- ntfsprogs-2.0.0/ntfsprogs/ntfsfix.c 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfsfix.c 2009-11-29 22:13:50.191326158 -0600 @@ -86,6 +86,7 @@ static struct { char *volume; + s64 part_offset; } opt; /** @@ -99,6 +100,7 @@ "Usage: %s [options] device\n" " Attempt to fix an NTFS partition.\n" "\n" + " -O, --offset BYTES Partition offset\n" " -h, --help Display this help\n" " -V, --version Display version information\n" "\n" @@ -133,12 +135,14 @@ int c; static const char *sopt = "-hV"; static const struct option lopt[] = { - { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, 'V' }, + { "offset", required_argument, NULL, 'O' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, { NULL, 0, NULL, 0 } }; memset(&opt, 0, sizeof(opt)); + opt.part_offset = -1; while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) { switch (c) { @@ -150,6 +154,11 @@ usage(); } break; + case 'O': + if (!utils_parse_llong(optarg, "partition offset", + &opt.part_offset)) + usage(); + break; case 'h': case '?': usage(); @@ -496,7 +505,8 @@ opt.volume); /* Attempt a full mount first. */ ntfs_log_info("Mounting volume... "); - vol = ntfs_mount(opt.volume, 0); + vol = ntfs_mount(opt.volume, + (opt.part_offset == -1 ? 0 : opt.part_offset), 0); if (vol) { ntfs_log_info(OK); ntfs_log_info("Processing of $MFT and $MFTMirr completed " @@ -505,7 +515,7 @@ ntfs_log_info(FAILED); if (fix_mount() < 0) exit(1); - vol = ntfs_mount(opt.volume, 0); + vol = ntfs_mount(opt.volume, 0, 0); if (!vol) { ntfs_log_perror("Remount failed"); exit(1); diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfsinfo.8.in ntfsprogs-2.0.0-offset/ntfsprogs/ntfsinfo.8.in --- ntfsprogs-2.0.0/ntfsprogs/ntfsinfo.8.in 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfsinfo.8.in 2009-11-29 22:13:50.191554172 -0600 @@ -55,6 +55,9 @@ \fB\-t\fR, \fB\-\-notime\fR Do not display timestamps in the output. .TP +\fB\-O\fR, \fB\-\-offset\fR BYTES +Offset, in bytes, of the NTFS partition from the start of the device. +.TP \fB\-v\fR, \fB\-\-verbose\fR Increase the amount of output that .B ntfsinfo diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfsinfo.c ntfsprogs-2.0.0-offset/ntfsprogs/ntfsinfo.c --- ntfsprogs-2.0.0/ntfsprogs/ntfsinfo.c 2007-09-28 17:11:50.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfsinfo.c 2009-11-29 22:13:50.192376512 -0600 @@ -92,6 +92,7 @@ int force; /* Override common sense */ int notime; /* Don't report timestamps at all */ int mft; /* Dump information about the volume as well */ + s64 part_offset; /* Partition offset */ } opts; /** @@ -127,16 +128,17 @@ static void usage(void) { printf("\nUsage: %s [options] device\n" - " -i, --inode NUM Display information about this inode\n" - " -F, --file FILE Display information about this file (absolute path)\n" - " -m, --mft Dump information about the volume\n" - " -t, --notime Don't report timestamps\n" + " -i, --inode NUM Display information about this inode\n" + " -F, --file FILE Display information about this file (absolute path)\n" + " -m, --mft Dump information about the volume\n" + " -t, --notime Don't report timestamps\n" + " -O, --offset BYTES Partition offset\n" "\n" - " -f, --force Use less caution\n" - " -q, --quiet Less output\n" - " -v, --verbose More output\n" - " -V, --version Display version information\n" - " -h, --help Display this help\n" + " -f, --force Use less caution\n" + " -q, --quiet Less output\n" + " -v, --verbose More output\n" + " -V, --version Display version information\n" + " -h, --help Display this help\n" #ifdef DEBUG " -d, --debug Show debug information\n" #endif @@ -165,6 +167,7 @@ { "help", no_argument, NULL, 'h' }, { "inode", required_argument, NULL, 'i' }, { "file", required_argument, NULL, 'F' }, + { "offset", required_argument, NULL, 'O' }, { "quiet", no_argument, NULL, 'q' }, { "verbose", no_argument, NULL, 'v' }, { "version", no_argument, NULL, 'V' }, @@ -183,6 +186,7 @@ opts.inode = -1; opts.filename = NULL; + opts.part_offset = -1; while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) { switch (c) { @@ -256,6 +260,11 @@ "argument.\n", argv[optind-1]); err++; break; + case 'O': + if (!utils_parse_llong(optarg, "partition offset", + &opts.part_offset)) + err++; + break; default: ntfs_log_error("Unhandled option case: %d.\n", c); err++; @@ -2251,8 +2260,9 @@ utils_set_locale(); - vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY | - (opts.force ? NTFS_MNT_FORCE : 0)); + vol = utils_mount_volume(opts.device, + (opts.part_offset == -1 ? 0 : opts.part_offset), + NTFS_MNT_RDONLY | (opts.force ? NTFS_MNT_FORCE : 0)); if (!vol) { printf("Failed to open '%s'.\n", opts.device); exit(1); diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfslabel.8.in ntfsprogs-2.0.0-offset/ntfsprogs/ntfslabel.8.in --- ntfsprogs-2.0.0/ntfsprogs/ntfslabel.8.in 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfslabel.8.in 2009-11-29 22:13:50.192636739 -0600 @@ -51,6 +51,9 @@ .BR "\-f \-v" . Long named options can be abbreviated to any unique prefix of their name. .TP +\fB\-O\fR, \fB\-\-offset\fR BYTES +Offset, in bytes, of the NTFS partition from the start of the device. +.TP \fB\-f\fR, \fB\-\-force\fR This will override some sensible defaults, such as not working with a mounted volume. Use this option with caution. diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfslabel.c ntfsprogs-2.0.0-offset/ntfsprogs/ntfslabel.c --- ntfsprogs-2.0.0/ntfsprogs/ntfslabel.c 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfslabel.c 2009-11-29 22:13:50.192960400 -0600 @@ -59,6 +59,7 @@ int verbose; /* Extra output */ int force; /* Override common sense */ int noaction; /* Do not write to disk */ + s64 part_offset; /* Partition offset */ } opts; /** @@ -90,12 +91,13 @@ static void usage(void) { ntfs_log_info("\nUsage: %s [options] device [label]\n" - " -n, --no-action Do not write to disk\n" - " -f, --force Use less caution\n" - " -q, --quiet Less output\n" - " -v, --verbose More output\n" - " -V, --version Display version information\n" - " -h, --help Display this help\n\n", + " -O, --offset BYTES Partition offset\n" + " -n, --no-action Do not write to disk\n" + " -f, --force Use less caution\n" + " -q, --quiet Less output\n" + " -v, --verbose More output\n" + " -V, --version Display version information\n" + " -h, --help Display this help\n\n", EXEC_NAME); ntfs_log_info("%s%s\n", ntfs_bugs, ntfs_home); } @@ -113,6 +115,7 @@ { static const char *sopt = "-fh?nqvV"; static const struct option lopt[] = { + { "offset", required_argument, NULL, 'O' }, { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, { "no-action", no_argument, NULL, 'n' }, @@ -129,6 +132,7 @@ int levels = 0; opterr = 0; /* We'll handle the errors, thank you. */ + opts.part_offset = -1; while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) { switch (c) { @@ -166,6 +170,11 @@ case 'V': ver++; break; + case 'O': + if (!utils_parse_llong(optarg, "partition offset", + &opts.part_offset)) + err++; + break; default: ntfs_log_error("Unknown option '%s'.\n", argv[optind-1]); err++; @@ -395,6 +404,7 @@ opts.noaction++; vol = utils_mount_volume(opts.device, + (opts.part_offset == -1 ? 0 : opts.part_offset), (opts.noaction ? NTFS_MNT_RDONLY : 0) | (opts.force ? NTFS_MNT_FORCE : 0)); if (!vol) diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfsls.8.in ntfsprogs-2.0.0-offset/ntfsprogs/ntfsls.8.in --- ntfsprogs-2.0.0/ntfsprogs/ntfsls.8.in 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfsls.8.in 2009-11-29 22:13:50.193220009 -0600 @@ -41,6 +41,12 @@ .B \-\-long ] [ +.B \-O +| +.B \-\-offset +.I BYTES +] +[ .B \-p | .B \-\-path @@ -119,6 +125,9 @@ \fB\-l\fR, \fB\-\-long\fR Use a long listing format. .TP +\fB\-O\fR, \fB\-\-offset\fR BYTES +Offset, in bytes, of the NTFS partition from the start of the device. +.TP \fB\-p\fR, \fB\-\-path\fR PATH The directory whose contents to list or the file (including the path) about which to display information. diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfsls.c ntfsprogs-2.0.0-offset/ntfsprogs/ntfsls.c --- ntfsprogs-2.0.0/ntfsprogs/ntfsls.c 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfsls.c 2009-11-29 22:13:50.193613488 -0600 @@ -118,6 +118,7 @@ int classify; int recursive; const char *path; + s64 part_offset; } opts; typedef struct { @@ -166,6 +167,7 @@ " -h, --help Display this help\n" " -i, --inode Display inode numbers\n" " -l, --long Display long info\n" + " -O, --offset BYTES Partition offset\n" " -p, --path PATH Directory whose contents to list\n" " -q, --quiet Less output\n" " -R, --recursive Recursively list subdirectories\n" @@ -200,6 +202,7 @@ { "help", no_argument, NULL, 'h' }, { "inode", no_argument, NULL, 'i' }, { "long", no_argument, NULL, 'l' }, + { "offset", required_argument, NULL, 'O' }, { "path", required_argument, NULL, 'p' }, { "recursive", no_argument, NULL, 'R' }, { "quiet", no_argument, NULL, 'q' }, @@ -221,6 +224,7 @@ memset(&opts, 0, sizeof(opts)); opts.device = NULL; opts.path = "/"; + opts.part_offset = -1; while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) { switch (c) { @@ -277,6 +281,11 @@ case 'R': opts.recursive++; break; + case 'O': + if (!utils_parse_llong(optarg, "partition offset", + &opts.part_offset)) + err++; + break; default: ntfs_log_error("Unknown option '%s'.\n", argv[optind - 1]); err++; @@ -651,8 +660,9 @@ utils_set_locale(); - vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY | - (opts.force ? NTFS_MNT_FORCE : 0)); + vol = utils_mount_volume(opts.device, + (opts.part_offset == -1 ? 0 : opts.part_offset), + NTFS_MNT_RDONLY | (opts.force ? NTFS_MNT_FORCE : 0)); if (!vol) { // FIXME: Print error... (AIA) return 2; diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfsresize.8.in ntfsprogs-2.0.0-offset/ntfsprogs/ntfsresize.8.in --- ntfsprogs-2.0.0/ntfsprogs/ntfsresize.8.in 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfsresize.8.in 2009-11-29 22:13:50.193972749 -0600 @@ -147,6 +147,9 @@ .B \-\-no\-action first. .TP +\fB\-O\fR, \fB\-\-offset\fR BYTES +Offset, in bytes, of the NTFS partition from the start of the device. +.TP \fB\-f\fR, \fB\-\-force\fR Forces ntfsresize to proceed with the resize operation even if the filesystem is marked for consistency check. diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfsresize.c ntfsprogs-2.0.0-offset/ntfsprogs/ntfsresize.c --- ntfsprogs-2.0.0/ntfsprogs/ntfsresize.c 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfsresize.c 2009-11-29 22:13:50.194777898 -0600 @@ -136,6 +136,7 @@ int badsectors; s64 bytes; char *volume; + s64 part_offset; } opt; struct bitmap { @@ -312,6 +313,7 @@ "\n" " -i, --info Estimate the smallest shrunken size possible\n" " -s, --size SIZE Resize volume to SIZE[k|M|G] bytes\n" + " -O, --offset BYTES Partition offset\n" "\n" " -n, --no-action Do not write to disk\n" " -b, --bad-sectors Support disks having bad sectors\n" @@ -447,6 +449,7 @@ { "info", no_argument, NULL, 'i' }, { "no-action", no_argument, NULL, 'n' }, { "no-progress-bar", no_argument, NULL, 'P' }, + { "offset", required_argument, NULL, 'O' }, { "size", required_argument, NULL, 's' }, { "verbose", no_argument, NULL, 'v' }, { "version", no_argument, NULL, 'V' }, @@ -460,6 +463,7 @@ memset(&opt, 0, sizeof(opt)); opt.show_progress = 1; + opt.part_offset = -1; while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) { switch (c) { @@ -504,6 +508,11 @@ case 'V': ver++; break; + case 'O': + if (!utils_parse_llong(optarg, "partition offset", + &opt.part_offset)) + err++; + break; default: if (optopt == 's') { printf("Option '%s' requires an argument.\n", argv[optind-1]); @@ -2243,7 +2252,9 @@ * volume at all. We will do the logfile emptying and dirty setting * later if needed. */ - if (!(vol = ntfs_mount(opt.volume, opt.ro_flag | NTFS_MNT_FORENSIC))) { + if (!(vol = ntfs_mount(opt.volume, + (opt.part_offset == -1 ? 0 : opt.part_offset), + opt.ro_flag | NTFS_MNT_FORENSIC))) { int err = errno; perr_printf("Opening '%s' as NTFS failed", opt.volume); diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfsundelete.8.in ntfsprogs-2.0.0-offset/ntfsprogs/ntfsundelete.8.in --- ntfsprogs-2.0.0/ntfsprogs/ntfsundelete.8.in 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfsundelete.8.in 2009-11-29 22:13:50.195115907 -0600 @@ -219,6 +219,9 @@ be given as number using a suffix of d, w, m, y for days, weeks, months or years ago. .TP +\fB\-\-offset\fR BYTES +Offset, in bytes, of the NTFS partition from the start of the device. +.TP \fB\-T\fR, \fB\-\-truncate\fR If .B ntfsundelete diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfsundelete.c ntfsprogs-2.0.0-offset/ntfsprogs/ntfsundelete.c --- ntfsprogs-2.0.0/ntfsprogs/ntfsundelete.c 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfsundelete.c 2009-11-29 22:13:50.195809167 -0600 @@ -248,6 +248,7 @@ " -C, --case Case sensitive matching\n" " -S, --size RANGE Match files of this size\n" " -t, --time SINCE Last referenced since this time\n" + " --offset BYTES Partition offset\n" "\n" " -u, --undelete Undelete mode\n" " -i, --inodes RANGE Recover these inodes\n" @@ -446,6 +447,7 @@ { "scan", no_argument, NULL, 's' }, { "size", required_argument, NULL, 'S' }, { "time", required_argument, NULL, 't' }, + { "offset", required_argument, NULL, 'F' }, { "truncate", no_argument, NULL, 'T' }, { "undelete", no_argument, NULL, 'u' }, { "verbose", no_argument, NULL, 'v' }, @@ -462,10 +464,11 @@ opterr = 0; /* We'll handle the errors, thank you. */ - opts.mode = MODE_NONE; - opts.uinode = -1; - opts.percent = -1; - opts.fillbyte = -1; + opts.mode = MODE_NONE; + opts.uinode = -1; + opts.percent = -1; + opts.fillbyte = -1; + opts.part_offset = -1; while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) { switch (c) { case 1: /* A non-option argument */ @@ -607,6 +610,11 @@ case 'V': ver++; break; + case 'F': + if (!utils_parse_llong(optarg, "partition offset", + &opts.part_offset)) + err++; + break; default: if (((optopt == 'b') || (optopt == 'c') || (optopt == 'd') || (optopt == 'm') || @@ -2155,8 +2163,9 @@ utils_set_locale(); - vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY | - (opts.force ? NTFS_MNT_FORCE : 0)); + vol = utils_mount_volume(opts.device, + (opts.part_offset == -1 ? 0 : opts.part_offset), + NTFS_MNT_RDONLY | (opts.force ? NTFS_MNT_FORCE : 0)); if (!vol) return 1; diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfsundelete.h ntfsprogs-2.0.0-offset/ntfsprogs/ntfsundelete.h --- ntfsprogs-2.0.0/ntfsprogs/ntfsundelete.h 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfsundelete.h 2009-11-29 22:13:50.196065438 -0600 @@ -58,6 +58,7 @@ s64 mft_begin; /* Range for mft copy */ s64 mft_end; char fillbyte; /* Use for unrecoverable sections */ + s64 part_offset; /* Partition offset */ }; struct filename { diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfswipe.c ntfsprogs-2.0.0-offset/ntfsprogs/ntfswipe.c --- ntfsprogs-2.0.0/ntfsprogs/ntfswipe.c 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfswipe.c 2009-11-29 22:13:50.196557796 -0600 @@ -87,26 +87,27 @@ static void usage(void) { ntfs_log_info("\nUsage: %s [options] device\n" - " -i --info Show volume information (default)\n" + " -i --info Show volume information (default)\n" + " -O --offset BYTES Partition offset\n" "\n" - " -d --directory Wipe directory indexes\n" - " -l --logfile Wipe the logfile (journal)\n" - " -m --mft Wipe mft space\n" - " -p --pagefile Wipe pagefile (swap space)\n" - " -t --tails Wipe file tails\n" - " -u --unused Wipe unused clusters\n" + " -d --directory Wipe directory indexes\n" + " -l --logfile Wipe the logfile (journal)\n" + " -m --mft Wipe mft space\n" + " -p --pagefile Wipe pagefile (swap space)\n" + " -t --tails Wipe file tails\n" + " -u --unused Wipe unused clusters\n" "\n" - " -a --all Wipe all unused space\n" + " -a --all Wipe all unused space\n" "\n" - " -c num --count num Number of times to write(default = 1)\n" - " -b list --bytes list List of values to write(default = 0)\n" + " -c num --count num Number of times to write(default = 1)\n" + " -b list --bytes list List of values to write(default = 0)\n" "\n" - " -n --no-action Do not write to disk\n" - " -f --force Use less caution\n" - " -q --quiet Less output\n" - " -v --verbose More output\n" - " -V --version Version information\n" - " -h --help Print this help\n\n", + " -n --no-action Do not write to disk\n" + " -f --force Use less caution\n" + " -q --quiet Less output\n" + " -v --verbose More output\n" + " -V --version Version information\n" + " -h --help Print this help\n\n", EXEC_NAME); ntfs_log_info("%s%s\n", ntfs_bugs, ntfs_home); } @@ -200,6 +201,7 @@ { "mft", no_argument, NULL, 'm' }, { "no-action", no_argument, NULL, 'n' }, //{ "no-wait", no_argument, NULL, 0 }, + { "offset", required_argument, NULL, 'O' }, { "pagefile", no_argument, NULL, 'p' }, { "quiet", no_argument, NULL, 'q' }, { "tails", no_argument, NULL, 't' }, @@ -219,6 +221,7 @@ opterr = 0; /* We'll handle the errors, thank you. */ opts.count = 1; + opts.part_offset = -1; while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) { switch (c) { @@ -303,6 +306,11 @@ case 'V': ver++; break; + case 'O': + if (!utils_parse_llong(optarg, "partition offset", + &opts.part_offset)) + err++; + break; default: if ((optopt == 'b') || (optopt == 'c')) { ntfs_log_error("Option '%s' requires an argument.\n", argv[optind-1]); @@ -1344,7 +1352,8 @@ if (opts.force) flags |= NTFS_MNT_FORCE; - vol = utils_mount_volume(opts.device, flags); + vol = utils_mount_volume(opts.device, + (opts.part_offset == -1 ? 0 : opts.part_offset), flags); if (!vol) goto free; diff -ur ntfsprogs-2.0.0/ntfsprogs/ntfswipe.h ntfsprogs-2.0.0-offset/ntfsprogs/ntfswipe.h --- ntfsprogs-2.0.0/ntfsprogs/ntfswipe.h 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/ntfswipe.h 2009-11-29 22:13:50.196785614 -0600 @@ -47,6 +47,7 @@ int pagefile; /* Wipe pagefile (swap space) */ int tails; /* Wipe file tails */ int unused; /* Wipe unused clusters */ + s64 part_offset; /* Partition offset */ }; #endif /* _NTFSWIPE_H_ */ diff -ur ntfsprogs-2.0.0/ntfsprogs/utils.c ntfsprogs-2.0.0-offset/ntfsprogs/utils.c --- ntfsprogs-2.0.0/ntfsprogs/utils.c 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/utils.c 2009-11-29 22:13:50.197249195 -0600 @@ -145,6 +145,34 @@ } /** + * utils_parse_llong + */ +BOOL utils_parse_llong(const char *string, const char *name, + long long *num) +{ + char *end = NULL; + long long tmp; + + if (!string || !name || !num) + return FALSE; + + if (*num >= 0) { + ntfs_log_error("You may only specify the %s once.\n", name); + return FALSE; + } + + tmp = strtoll(string, &end, 0); + if (end && *end) { + ntfs_log_error("Cannot understand the %s '%s'.\n", name, + string); + return FALSE; + } else { + *num = tmp; + return TRUE; + } +} + +/** * utils_valid_device - Perform some safety checks on the device, before start * @name: Full pathname of the device/file to work with * @force: Continue regardless of problems @@ -205,7 +233,8 @@ /** * utils_mount_volume - Mount an NTFS volume */ -ntfs_volume * utils_mount_volume(const char *device, ntfs_mount_flags flags) +ntfs_volume * utils_mount_volume(const char *device, + s64 part_offset, ntfs_mount_flags flags) { ntfs_volume *vol; @@ -214,10 +243,11 @@ return NULL; } + /* FIXME: utils_valid_device should check partition offset as well */ if (!utils_valid_device(device, flags & NTFS_MNT_FORCE)) return NULL; - vol = ntfs_mount(device, flags); + vol = ntfs_mount(device, part_offset, flags); if (!vol) { ntfs_log_perror("Failed to mount '%s'", device); if (errno == EINVAL) diff -ur ntfsprogs-2.0.0/ntfsprogs/utils.h ntfsprogs-2.0.0-offset/ntfsprogs/utils.h --- ntfsprogs-2.0.0/ntfsprogs/utils.h 2007-09-19 11:51:09.000000000 -0500 +++ ntfsprogs-2.0.0-offset/ntfsprogs/utils.h 2009-11-29 22:13:50.197525849 -0600 @@ -43,6 +43,7 @@ extern const char *ntfs_gpl; int utils_set_locale(void); +BOOL utils_parse_llong(const char *string, const char *name, long long *num); int utils_parse_size(const char *value, s64 *size, BOOL scale); int utils_parse_range(const char *string, s64 *start, s64 *finish, BOOL scale); int utils_inode_get_name(ntfs_inode *inode, char *buffer, int bufsize); @@ -56,7 +57,7 @@ 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, ntfs_mount_flags flags); +ntfs_volume * utils_mount_volume(const char *device, s64 part_offset, ntfs_mount_flags flags); /** * defines...