rpms/ntfsprogs/devel ntfsprogs-2.0.0-mbonly-info.patch, NONE, 1.1 ntfsprogs.spec, 1.9, 1.10
Tom Callaway (spot)
fedora-extras-commits at redhat.com
Fri Feb 1 21:27:48 UTC 2008
Author: spot
Update of /cvs/pkgs/rpms/ntfsprogs/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12080
Modified Files:
ntfsprogs.spec
Added Files:
ntfsprogs-2.0.0-mbonly-info.patch
Log Message:
add info-mbonly option, needed for anaconda ntfs resizing
ntfsprogs-2.0.0-mbonly-info.patch:
--- NEW FILE ntfsprogs-2.0.0-mbonly-info.patch ---
diff -up ./ntfsprogs/ntfsresize.8.in.jk ./ntfsprogs/ntfsresize.8.in
--- ./ntfsprogs/ntfsresize.8.in.jk 2008-02-01 14:39:27.000000000 -0500
+++ ./ntfsprogs/ntfsresize.8.in 2008-02-01 14:43:23.000000000 -0500
@@ -8,7 +8,7 @@ ntfsresize \- resize an NTFS filesystem
.SH SYNOPSIS
.B ntfsresize
[\fIOPTIONS\fR]
-.B \-\-info
+.B \-\-info(\-mb\-only)
.I DEVICE
.br
.B ntfsresize
@@ -45,7 +45,7 @@ conforms to the SI, ATA, IEEE standards
by using k=10^3, M=10^6 and G=10^9.
If both
-.B \-\-info
+.B \-\-info(\-mb\-only)
and
.B \-\-size
are omitted then the
@@ -133,6 +133,10 @@ that Windows might need about 50\-100 MB
This option never causes any changes to the filesystem, the partition is
opened read\-only.
.TP
+\fB\-m\fR, \fB\-\-info\-mb\-only\fR
+Like the info option, only print out the shrinkable size in MB. Print nothing
+if the shrink size is the same as the original size (in MB).
+.TP
\fB\-s\fR, \fB\-\-size\fR SIZE\fR[\fBk\fR|\fBM\fR|\fBG\fR]
Resize filesystem to \fISIZE\fR[\fBk\fR|\fBM\fR|\fBG\fR] bytes.
The optional modifiers
diff -up ./ntfsprogs/ntfsresize.c.jk ./ntfsprogs/ntfsresize.c
--- ./ntfsprogs/ntfsresize.c.jk 2008-02-01 14:29:39.000000000 -0500
+++ ./ntfsprogs/ntfsresize.c 2008-02-01 15:46:23.000000000 -0500
@@ -132,6 +132,7 @@ static struct {
int ro_flag;
int force;
int info;
+ int infombonly;
int show_progress;
int badsectors;
s64 bytes;
@@ -311,6 +312,7 @@ static void usage(void)
" Resize an NTFS volume non-destructively, safely move any data if needed.\n"
"\n"
" -i, --info Estimate the smallest shrunken size possible\n"
+ " -m, --info-mb-only Estimate the smallest shrunken size possible, output size in MB only\n"
" -s, --size SIZE Resize volume to SIZE[k|M|G] bytes\n"
"\n"
" -n, --no-action Do not write to disk\n"
@@ -436,7 +438,7 @@ static s64 get_new_volume_size(char *s)
*/
static int parse_options(int argc, char **argv)
{
- static const char *sopt = "-bdfhinPs:vV";
+ static const char *sopt = "-bdfhimnPs:vV";
static const struct option lopt[] = {
{ "bad-sectors",no_argument, NULL, 'b' },
#ifdef DEBUG
@@ -445,6 +447,7 @@ static int parse_options(int argc, char
{ "force", no_argument, NULL, 'f' },
{ "help", no_argument, NULL, 'h' },
{ "info", no_argument, NULL, 'i' },
+ { "info-mb-only", no_argument, NULL, 'm' },
{ "no-action", no_argument, NULL, 'n' },
{ "no-progress-bar", no_argument, NULL, 'P' },
{ "size", required_argument, NULL, 's' },
@@ -485,6 +488,9 @@ static int parse_options(int argc, char
case 'i':
opt.info++;
break;
+ case 'm':
+ opt.infombonly++;
+ break;
case 'n':
opt.ro_flag = NTFS_MNT_RDONLY;
break;
@@ -521,10 +527,10 @@ static int parse_options(int argc, char
printf("You must specify exactly one device.\n");
err++;
}
- if (opt.info) {
+ if (opt.info || opt.infombonly) {
opt.ro_flag = NTFS_MNT_RDONLY;
if (opt.bytes) {
- printf(NERR_PREFIX "Options --info and --size "
+ printf(NERR_PREFIX "Options --info(-mb-only) and --size "
"can't be used together.\n");
usage();
}
@@ -577,19 +583,29 @@ static void print_advise(ntfs_volume *vo
freed_mb = freed_b / NTFS_MBYTE;
/* WARNING: don't modify the text, external tools grep for it */
- printf("You might resize at %lld bytes ", (long long)new_b);
+ if (!opt.infombonly)
+ printf("You might resize at %lld bytes ", (long long)new_b);
if ((new_mb * NTFS_MBYTE) < old_b)
- printf("or %lld MB ", (long long)new_mb);
+ if (!opt.infombonly)
+ printf("or %lld MB ", (long long)new_mb);
+ else
+ printf("%lld\n", (long long)new_mb);
- printf("(freeing ");
+ if (!opt.infombonly)
+ printf("(freeing ");
if (freed_mb && (old_mb - new_mb))
- printf("%lld MB", (long long)(old_mb - new_mb));
+ if (!opt.infombonly)
+ printf("%lld MB", (long long)(old_mb - new_mb));
else
- printf("%lld bytes", (long long)freed_b);
- printf(").\n");
-
- printf("Please make a test run using both the -n and -s options "
- "before real resizing!\n");
+ if (!opt.infombonly)
+ printf("%lld bytes", (long long)freed_b);
+ if (!opt.infombonly)
+ printf(").\n");
+
+ if (!opt.infombonly) {
+ printf("Please make a test run using both the -n and -s options "
+ "before real resizing!\n");
+ }
}
static void rl_set(runlist *rl, VCN vcn, LCN lcn, s64 len)
@@ -736,7 +752,7 @@ static void collect_relocation_info(ntfs
start = new_vol_size;
len = lcn_length - (new_vol_size - lcn);
- if (!opt.info && (inode == FILE_MFTMirr)) {
+ if ((!opt.info && !opt.infombonly) && (inode == FILE_MFTMirr)) {
err_printf("$MFTMirr can't be split up yet. Please try "
"a different size.\n");
print_advise(resize->vol, lcn + lcn_length - 1);
@@ -746,7 +762,7 @@ static void collect_relocation_info(ntfs
resize->relocations += len;
- if (!opt.info || !resize->new_volume_size)
+ if ((!opt.info && !opt.infombonly) || !resize->new_volume_size)
return;
printf("Relocation needed for inode %8lld attr 0x%x LCN 0x%08llx "
@@ -876,7 +892,8 @@ static void compare_bitmaps(ntfs_volume
int backup_boot = 0;
u8 bm[NTFS_BUF_SIZE];
- printf("Accounting clusters ...\n");
+ if (!opt.infombonly)
+ printf("Accounting clusters ...\n");
pos = 0;
while (1) {
@@ -999,7 +1016,8 @@ static int build_allocation_bitmap(ntfs_
int pb_flags = 0; /* progress bar flags */
/* WARNING: don't modify the text, external tools grep for it */
- printf("Checking filesystem consistency ...\n");
+ if (!opt.infombonly)
+ printf("Checking filesystem consistency ...\n");
if (fsck->flags & NTFSCK_PROGBAR)
pb_flags |= NTFS_PROGBAR;
@@ -1010,7 +1028,8 @@ static int build_allocation_bitmap(ntfs_
progress_init(&progress, inode, nr_mft_records - 1, pb_flags);
for (; inode < nr_mft_records; inode++) {
- progress_update(&progress, inode);
+ if (!opt.infombonly)
+ progress_update(&progress, inode);
if ((ni = ntfs_inode_open(vol, (MFT_REF)inode)) == NULL) {
/* FIXME: continue only if it make sense, e.g.
@@ -1079,7 +1098,8 @@ static void set_resize_constraints(ntfs_
s64 nr_mft_records, inode;
ntfs_inode *ni;
- printf("Collecting resizing constraints ...\n");
+ if (!opt.infombonly)
+ printf("Collecting resizing constraints ...\n");
nr_mft_records = resize->vol->mft_na->initialized_size >>
resize->vol->mft_record_size_bits;
@@ -1784,7 +1804,6 @@ static void advise_on_resize(ntfs_resize
print_advise(vol, resize->last_unsupp);
}
-
static void rl_expand(runlist **rl, const VCN last_vcn)
{
int len;
@@ -2198,9 +2217,11 @@ static void print_disk_usage(ntfs_volume
used = nr_used_clusters * vol->cluster_size;
/* WARNING: don't modify the text, external tools grep for it */
- printf("Space in use : %lld MB (%.1f%%)\n",
- (long long)rounded_up_division(used, NTFS_MBYTE),
- 100.0 * ((float)used / total));
+ if (!opt.infombonly) {
+ printf("Space in use : %lld MB (%.1f%%)\n",
+ (long long)rounded_up_division(used, NTFS_MBYTE),
+ 100.0 * ((float)used / total));
+ }
}
static void print_num_of_relocations(ntfs_resize_t *resize)
@@ -2269,14 +2290,18 @@ static ntfs_volume *mount_volume(void)
err_exit("Cluster size %u is too large!\n",
(unsigned int)vol->cluster_size);
- printf("Device name : %s\n", opt.volume);
- printf("NTFS volume version: %d.%d\n", vol->major_ver, vol->minor_ver);
+ if (!opt.infombonly) {
+ printf("Device name : %s\n", opt.volume);
+ printf("NTFS volume version: %d.%d\n", vol->major_ver, vol->minor_ver);
+ }
if (ntfs_version_is_supported(vol))
perr_exit("Unknown NTFS version");
+ if (!opt.infombonly) {
printf("Cluster size : %u bytes\n",
(unsigned int)vol->cluster_size);
print_vol_size("Current volume size", vol_size(vol, vol->nr_clusters));
+ }
return vol;
}
@@ -2326,7 +2351,7 @@ static void check_resize_constraints(ntf
err_exit("Volume is full. To shrink it, "
"delete unused files.\n");
- if (opt.info)
+ if (opt.info || opt.infombonly)
return;
/* FIXME: reserve some extra space so Windows can boot ... */
@@ -2396,14 +2421,15 @@ int main(int argc, char **argv)
if (device_size <= 0)
err_exit("Couldn't get device size (%lld)!\n", device_size);
- print_vol_size("Current device size", device_size);
+ if (!opt.infombonly)
+ print_vol_size("Current device size", device_size);
if (device_size < vol->nr_clusters * vol->cluster_size)
err_exit("Current NTFS volume size is bigger than the device "
"size!\nCorrupt partition table or incorrect device "
"partitioning?\n");
- if (!opt.bytes && !opt.info)
+ if (!opt.bytes && !opt.info && !opt.infombonly)
opt.bytes = device_size;
/* Take the integer part: don't make the volume bigger than requested */
@@ -2414,7 +2440,7 @@ int main(int argc, char **argv)
if (new_size)
--new_size;
- if (!opt.info) {
+ if (!opt.info && !opt.infombonly) {
print_vol_size("New volume size ", vol_size(vol, new_size));
if (device_size < opt.bytes)
err_exit("New size can't be bigger than the device size"
@@ -2422,7 +2448,7 @@ int main(int argc, char **argv)
"enlarge the device size by e.g. fdisk.\n");
}
- if (!opt.info && (new_size == vol->nr_clusters ||
+ if (!opt.info && !opt.infombonly && (new_size == vol->nr_clusters ||
(opt.bytes == device_size &&
new_size == vol->nr_clusters - 1))) {
printf("Nothing to do: NTFS volume size is already OK.\n");
@@ -2455,7 +2481,7 @@ int main(int argc, char **argv)
set_disk_usage_constraint(&resize);
check_resize_constraints(&resize);
- if (opt.info) {
+ if (opt.info || opt.infombonly) {
advise_on_resize(&resize);
exit(0);
}
Index: ntfsprogs.spec
===================================================================
RCS file: /cvs/pkgs/rpms/ntfsprogs/devel/ntfsprogs.spec,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ntfsprogs.spec 1 Dec 2007 03:12:19 -0000 1.9
+++ ntfsprogs.spec 1 Feb 2008 21:27:08 -0000 1.10
@@ -1,10 +1,11 @@
Name: ntfsprogs
Version: 2.0.0
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: NTFS filesystem libraries and utilities
Source0: http://download.sf.net/linux-ntfs/%{name}-%{version}.tar.bz2
Patch0: ntfsprogs-2.0.0-build-extras-by-default.patch
Patch1: ntfsprogs-2.0.0-glibc27-open.patch
+Patch2: ntfsprogs-2.0.0-mbonly-info.patch
License: GPLv2+
URL: http://www.linux-ntfs.org/
Group: System Environment/Base
@@ -44,6 +45,7 @@
%setup -q
%patch0 -p1
%patch1 -p1
+%patch2 -p1
%build
# If we need to enable the fuse module, we'd change this.
@@ -111,10 +113,13 @@
%{_libdir}/gnome-vfs-2.0/modules/libntfs-gnomevfs.so
%changelog
-* Fri Nov 30 2007 Tom "spot" Callaway <tcallawa at redhat.com> 2.0-2
+* Fri Feb 1 2008 Tom "spot" Callaway <tcallawa at redhat.com> 2.0.0-3
+- add new option for mbinfo only (Jesse Keating)
+
+* Fri Nov 30 2007 Tom "spot" Callaway <tcallawa at redhat.com> 2.0.0-2
- excludearch ppc ppc64
-* Fri Nov 30 2007 Tom "spot" Callaway <tcallawa at redhat.com> 2.0-1
+* Fri Nov 30 2007 Tom "spot" Callaway <tcallawa at redhat.com> 2.0.0-1
- bump to 2.0
* Fri Aug 24 2007 Tom "spot" Callaway <tcallawa at redhat.com> 1.13.1-7.2
More information about the fedora-extras-commits
mailing list