From: Nikolay Ivanets <stenavin(a)gmail.com>
This patch adds '--blocksize' command line option for guestfish and
other C-based tools. This option allows specifying disk sector size.
---
align/Makefile.am | 1 +
align/scan.c | 8 ++++++++
align/virt-alignment-scan.pod | 2 ++
cat/Makefile.am | 1 +
cat/cat.c | 8 ++++++++
cat/filesystems.c | 8 ++++++++
cat/log.c | 8 ++++++++
cat/ls.c | 8 ++++++++
cat/tail.c | 8 ++++++++
cat/virt-cat.pod | 2 ++
cat/virt-filesystems.pod | 2 ++
cat/virt-log.pod | 2 ++
cat/virt-ls.pod | 2 ++
cat/virt-tail.pod | 2 ++
df/Makefile.am | 1 +
df/main.c | 8 ++++++++
df/virt-df.pod | 2 ++
diff/diff.c | 8 ++++++++
diff/virt-diff.pod | 2 ++
edit/edit.c | 8 ++++++++
edit/virt-edit.pod | 2 ++
fish/fish.c | 8 ++++++++
fish/guestfish.pod | 2 ++
format/Makefile.am | 1 +
format/format.c | 8 ++++++++
format/virt-format.pod | 2 ++
fuse/guestmount.c | 8 ++++++++
fuse/guestmount.pod | 2 ++
inspector/inspector.c | 8 ++++++++
inspector/virt-inspector.pod | 2 ++
rescue/Makefile.am | 1 +
rescue/rescue.c | 8 ++++++++
rescue/virt-rescue.pod | 2 ++
33 files changed, 145 insertions(+)
diff --git a/align/Makefile.am b/align/Makefile.am
index 1c698561b..6ff4aa3bf 100644
--- a/align/Makefile.am
+++ b/align/Makefile.am
@@ -66,6 +66,7 @@ stamp-virt-alignment-scan.pod: virt-alignment-scan.pod
$(PODWRAPPER) \
--man virt-alignment-scan.1 \
--html $(top_builddir)/website/virt-alignment-scan.1.html \
+ --path $(top_srcdir)/common/options \
--license GPLv2+ \
--warning safe \
$<
diff --git a/align/scan.c b/align/scan.c
index b9f29868c..7209bc02a 100644
--- a/align/scan.c
+++ b/align/scan.c
@@ -87,6 +87,8 @@ usage (int status)
" %s [--options] -a disk.img [-a disk.img ...]\n"
"Options:\n"
" -a|--add image Add image\n"
+ " --blocksize[=512|4096]\n"
+ " Set sector size of the disk for -a
option\n"
" -c|--connect uri Specify libvirt URI for -d option\n"
" -d|--domain guest Add disks from libvirt guest\n"
" --format[=raw|..] Force disk format for -a option\n"
@@ -116,6 +118,7 @@ main (int argc, char *argv[])
static const char options[] = "a:c:d:P:qvVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
+ { "blocksize", 2, 0, 0 },
{ "connect", 1, 0, 'c' },
{ "domain", 1, 0, 'd' },
{ "format", 2, 0, 0 },
@@ -131,6 +134,8 @@ main (int argc, char *argv[])
struct drv *drvs = NULL;
const char *format = NULL;
bool format_consumed = true;
+ int blocksize = 0;
+ bool blocksize_consumed = true;
int c;
int option_index;
int exit_code;
@@ -153,6 +158,8 @@ main (int argc, char *argv[])
display_short_options (options);
else if (STREQ (long_options[option_index].name, "format")) {
OPTION_format;
+ } else if (STREQ (long_options[option_index].name, "blocksize")) {
+ OPTION_blocksize;
} else if (STREQ (long_options[option_index].name, "uuid")) {
uuid = 1;
} else
@@ -215,6 +222,7 @@ main (int argc, char *argv[])
usage (EXIT_FAILURE);
CHECK_OPTION_format_consumed;
+ CHECK_OPTION_blocksize_consumed;
/* virt-alignment-scan has two modes. If the user didn't specify
* any drives, then we do the scan on every libvirt guest. That's
diff --git a/align/virt-alignment-scan.pod b/align/virt-alignment-scan.pod
index 19953546e..83645f4d0 100644
--- a/align/virt-alignment-scan.pod
+++ b/align/virt-alignment-scan.pod
@@ -121,6 +121,8 @@ force a particular format use the I<--format=..> option.
Add a remote disk. See L<guestfish(1)/ADDING REMOTE STORAGE>.
+__INCLUDE:blocksize-option.pod__
+
=item B<-c> URI
=item B<--connect> URI
diff --git a/cat/Makefile.am b/cat/Makefile.am
index 1d013e8dd..01e13abda 100644
--- a/cat/Makefile.am
+++ b/cat/Makefile.am
@@ -200,6 +200,7 @@ stamp-virt-filesystems.pod: virt-filesystems.pod
$(PODWRAPPER) \
--man virt-filesystems.1 \
--html $(top_builddir)/website/virt-filesystems.1.html \
+ --path $(top_srcdir)/common/options \
--license GPLv2+ \
--warning safe \
$<
diff --git a/cat/cat.c b/cat/cat.c
index 4f0d7035e..a968640ce 100644
--- a/cat/cat.c
+++ b/cat/cat.c
@@ -66,6 +66,8 @@ usage (int status)
" %s [--options] -a disk.img [-a disk.img ...] file [file
...]\n"
"Options:\n"
" -a|--add image Add image\n"
+ " --blocksize[=512|4096]\n"
+ " Set sector size of the disk for -a
option\n"
" -c|--connect uri Specify libvirt URI for -d option\n"
" -d|--domain guest Add disks from libvirt guest\n"
" --echo-keys Don't turn off echo for
passphrases\n"
@@ -97,6 +99,7 @@ main (int argc, char *argv[])
static const char options[] = "a:c:d:m:vVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
+ { "blocksize", 2, 0, 0 },
{ "connect", 1, 0, 'c' },
{ "domain", 1, 0, 'd' },
{ "echo-keys", 0, 0, 0 },
@@ -118,6 +121,8 @@ main (int argc, char *argv[])
char *p;
const char *format = NULL;
bool format_consumed = true;
+ int blocksize = 0;
+ bool blocksize_consumed = true;
int c;
int r;
int option_index;
@@ -143,6 +148,8 @@ main (int argc, char *argv[])
echo_keys = 1;
} else if (STREQ (long_options[option_index].name, "format")) {
OPTION_format;
+ } else if (STREQ (long_options[option_index].name, "blocksize")) {
+ OPTION_blocksize;
} else if (STREQ (long_options[option_index].name, "key")) {
OPTION_key;
} else
@@ -232,6 +239,7 @@ main (int argc, char *argv[])
usage (EXIT_FAILURE);
CHECK_OPTION_format_consumed;
+ CHECK_OPTION_blocksize_consumed;
/* User must have specified some drives. */
if (drvs == NULL) {
diff --git a/cat/filesystems.c b/cat/filesystems.c
index 74e994169..cec3c4e47 100644
--- a/cat/filesystems.c
+++ b/cat/filesystems.c
@@ -104,6 +104,8 @@ usage (int status)
" --all Display everything\n"
" --blkdevs|--block-devices\n"
" Display block devices\n"
+ " --blocksize[=512|4096]\n"
+ " Set sector size of the disk for -a
option\n"
" -c|--connect uri Specify libvirt URI for -d option\n"
" --csv Output as Comma-Separated Values\n"
" -d|--domain guest Add disks from libvirt guest\n"
@@ -149,6 +151,7 @@ main (int argc, char *argv[])
{ "all", 0, 0, 0 },
{ "blkdevs", 0, 0, 0 },
{ "block-devices", 0, 0, 0 },
+ { "blocksize", 2, 0, 0 },
{ "connect", 1, 0, 'c' },
{ "csv", 0, 0, 0 },
{ "domain", 1, 0, 'd' },
@@ -183,6 +186,8 @@ main (int argc, char *argv[])
struct drv *drvs = NULL;
const char *format = NULL;
bool format_consumed = true;
+ int blocksize = 0;
+ bool blocksize_consumed = true;
int c;
int option_index;
int no_title = 0; /* --no-title */
@@ -210,6 +215,8 @@ main (int argc, char *argv[])
echo_keys = 1;
} else if (STREQ (long_options[option_index].name, "format")) {
OPTION_format;
+ } else if (STREQ (long_options[option_index].name, "blocksize")) {
+ OPTION_blocksize;
} else if (STREQ (long_options[option_index].name, "all")) {
output = OUTPUT_ALL;
} else if (STREQ (long_options[option_index].name, "blkdevs") ||
@@ -306,6 +313,7 @@ main (int argc, char *argv[])
}
CHECK_OPTION_format_consumed;
+ CHECK_OPTION_blocksize_consumed;
/* -h and --csv doesn't make sense. Spreadsheets will corrupt these
* fields. (RHBZ#600977).
diff --git a/cat/log.c b/cat/log.c
index f8a5c85f2..92081d7ec 100644
--- a/cat/log.c
+++ b/cat/log.c
@@ -76,6 +76,8 @@ usage (int status)
" %s [--options] -a disk.img [-a disk.img ...]\n"
"Options:\n"
" -a|--add image Add image\n"
+ " --blocksize[=512|4096]\n"
+ " Set sector size of the disk for -a
option\n"
" -c|--connect uri Specify libvirt URI for -d option\n"
" -d|--domain guest Add disks from libvirt guest\n"
" --echo-keys Don't turn off echo for
passphrases\n"
@@ -105,6 +107,7 @@ main (int argc, char *argv[])
static const char options[] = "a:c:d:vVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
+ { "blocksize", 2, 0, 0 },
{ "connect", 1, 0, 'c' },
{ "domain", 1, 0, 'd' },
{ "echo-keys", 0, 0, 0 },
@@ -121,6 +124,8 @@ main (int argc, char *argv[])
struct drv *drvs = NULL;
const char *format = NULL;
bool format_consumed = true;
+ int blocksize = 0;
+ bool blocksize_consumed = true;
int c;
int r;
int option_index;
@@ -146,6 +151,8 @@ main (int argc, char *argv[])
echo_keys = 1;
} else if (STREQ (long_options[option_index].name, "format")) {
OPTION_format;
+ } else if (STREQ (long_options[option_index].name, "blocksize")) {
+ OPTION_blocksize;
} else if (STREQ (long_options[option_index].name, "key")) {
OPTION_key;
} else
@@ -204,6 +211,7 @@ main (int argc, char *argv[])
}
CHECK_OPTION_format_consumed;
+ CHECK_OPTION_blocksize_consumed;
/* User must have specified some drives. */
if (drvs == NULL) {
diff --git a/cat/ls.c b/cat/ls.c
index 055939a80..c113bcaa2 100644
--- a/cat/ls.c
+++ b/cat/ls.c
@@ -104,6 +104,8 @@ usage (int status)
" %s [--options] -a disk.img [-a disk.img ...] dir [dir ...]\n"
"Options:\n"
" -a|--add image Add image\n"
+ " --blocksize[=512|4096]\n"
+ " Set sector size of the disk for -a
option\n"
" --checksum[=...] Display file checksums\n"
" -c|--connect uri Specify libvirt URI for -d option\n"
" --csv Comma-Separated Values output\n"
@@ -149,6 +151,7 @@ main (int argc, char *argv[])
static const char options[] = "a:c:d:hlm:RvVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
+ { "blocksize", 2, 0, 0 },
{ "checksum", 2, 0, 0 },
{ "checksums", 2, 0, 0 },
{ "csv", 0, 0, 0 },
@@ -185,6 +188,8 @@ main (int argc, char *argv[])
char *p;
const char *format = NULL;
bool format_consumed = true;
+ int blocksize = 0;
+ bool blocksize_consumed = true;
int c;
int option_index;
#define MODE_LS_L 1
@@ -213,6 +218,8 @@ main (int argc, char *argv[])
echo_keys = 1;
} else if (STREQ (long_options[option_index].name, "format")) {
OPTION_format;
+ } else if (STREQ (long_options[option_index].name, "blocksize")) {
+ OPTION_blocksize;
} else if (STREQ (long_options[option_index].name, "checksum") ||
STREQ (long_options[option_index].name, "checksums")) {
if (!optarg || STREQ (optarg, ""))
@@ -338,6 +345,7 @@ main (int argc, char *argv[])
assert (live == 0);
CHECK_OPTION_format_consumed;
+ CHECK_OPTION_blocksize_consumed;
/* Many flags only apply to -lR mode. */
if (mode != MODE_LS_LR &&
diff --git a/cat/tail.c b/cat/tail.c
index 9e3af7c7d..e80dab836 100644
--- a/cat/tail.c
+++ b/cat/tail.c
@@ -73,6 +73,8 @@ usage (int status)
" %s [--options] -a disk.img [-a disk.img ...] file [file
...]\n"
"Options:\n"
" -a|--add image Add image\n"
+ " --blocksize[=512|4096]\n"
+ " Set sector size of the disk for -a
option\n"
" -c|--connect uri Specify libvirt URI for -d option\n"
" -d|--domain guest Add disks from libvirt guest\n"
" --echo-keys Don't turn off echo for
passphrases\n"
@@ -105,6 +107,7 @@ main (int argc, char *argv[])
static const char options[] = "a:c:d:fm:vVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
+ { "blocksize", 2, 0, 0 },
{ "connect", 1, 0, 'c' },
{ "domain", 1, 0, 'd' },
{ "echo-keys", 0, 0, 0 },
@@ -126,6 +129,8 @@ main (int argc, char *argv[])
char *p;
const char *format = NULL;
bool format_consumed = true;
+ int blocksize = 0;
+ bool blocksize_consumed = true;
int c;
int r;
int option_index;
@@ -151,6 +156,8 @@ main (int argc, char *argv[])
echo_keys = 1;
} else if (STREQ (long_options[option_index].name, "format")) {
OPTION_format;
+ } else if (STREQ (long_options[option_index].name, "blocksize")) {
+ OPTION_blocksize;
} else if (STREQ (long_options[option_index].name, "key")) {
OPTION_key;
} else
@@ -217,6 +224,7 @@ main (int argc, char *argv[])
}
CHECK_OPTION_format_consumed;
+ CHECK_OPTION_blocksize_consumed;
/* User must have specified some drives. */
if (drvs == NULL) {
diff --git a/cat/virt-cat.pod b/cat/virt-cat.pod
index 0c4ce4b77..b2c481107 100644
--- a/cat/virt-cat.pod
+++ b/cat/virt-cat.pod
@@ -73,6 +73,8 @@ force a particular format use the I<--format=..> option.
Add a remote disk. See L<guestfish(1)/ADDING REMOTE STORAGE>.
+__INCLUDE:blocksize-option.pod__
+
=item B<-c> URI
=item B<--connect> URI
diff --git a/cat/virt-filesystems.pod b/cat/virt-filesystems.pod
index a3a0fb29a..c800cd82f 100644
--- a/cat/virt-filesystems.pod
+++ b/cat/virt-filesystems.pod
@@ -126,6 +126,8 @@ See also I<--long>.
Display block devices.
+__INCLUDE:blocksize-option.pod__
+
=item B<-c> URI
=item B<--connect> URI
diff --git a/cat/virt-log.pod b/cat/virt-log.pod
index a6b37662e..dc4a714a1 100644
--- a/cat/virt-log.pod
+++ b/cat/virt-log.pod
@@ -57,6 +57,8 @@ force a particular format use the I<--format=..> option.
Add a remote disk. See L<guestfish(1)/ADDING REMOTE STORAGE>.
+__INCLUDE:blocksize-option.pod__
+
=item B<-c> URI
=item B<--connect> URI
diff --git a/cat/virt-ls.pod b/cat/virt-ls.pod
index 53141b2c6..da1c2e244 100644
--- a/cat/virt-ls.pod
+++ b/cat/virt-ls.pod
@@ -271,6 +271,8 @@ force a particular format use the I<--format=..> option.
Add a remote disk. See L<guestfish(1)/ADDING REMOTE STORAGE>.
+__INCLUDE:blocksize-option.pod__
+
=item B<--checksum>
=item B<--checksum=crc|md5|sha1|sha224|sha256|sha384|sha512>
diff --git a/cat/virt-tail.pod b/cat/virt-tail.pod
index 9f72ce3f7..89099772f 100644
--- a/cat/virt-tail.pod
+++ b/cat/virt-tail.pod
@@ -68,6 +68,8 @@ force a particular format use the I<--format=..> option.
Add a remote disk. See L<guestfish(1)/ADDING REMOTE STORAGE>.
+__INCLUDE:blocksize-option.pod__
+
=item B<-c> URI
=item B<--connect> URI
diff --git a/df/Makefile.am b/df/Makefile.am
index 92493f123..78dccda90 100644
--- a/df/Makefile.am
+++ b/df/Makefile.am
@@ -70,6 +70,7 @@ stamp-virt-df.pod: virt-df.pod
$(PODWRAPPER) \
--man virt-df.1 \
--html $(top_builddir)/website/virt-df.1.html \
+ --path $(top_srcdir)/common/options \
--license GPLv2+ \
--warning safe \
$<
diff --git a/df/main.c b/df/main.c
index bbb2ddb61..e80b97015 100644
--- a/df/main.c
+++ b/df/main.c
@@ -79,6 +79,8 @@ usage (int status)
" %s [--options] -a disk.img [-a disk.img ...]\n"
"Options:\n"
" -a|--add image Add image\n"
+ " --blocksize[=512|4096]\n"
+ " Set sector size of the disk for -a
option\n"
" -c|--connect uri Specify libvirt URI for -d option\n"
" --csv Output as Comma-Separated Values\n"
" -d|--domain guest Add disks from libvirt guest\n"
@@ -111,6 +113,7 @@ main (int argc, char *argv[])
static const char options[] = "a:c:d:hiP:vVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
+ { "blocksize", 2, 0, 0 },
{ "connect", 1, 0, 'c' },
{ "csv", 0, 0, 0 },
{ "domain", 1, 0, 'd' },
@@ -130,6 +133,8 @@ main (int argc, char *argv[])
struct drv *drv;
const char *format = NULL;
bool format_consumed = true;
+ int blocksize = 0;
+ bool blocksize_consumed = true;
int c;
int option_index;
size_t max_threads = 0;
@@ -151,6 +156,8 @@ main (int argc, char *argv[])
display_short_options (options);
else if (STREQ (long_options[option_index].name, "format")) {
OPTION_format;
+ } else if (STREQ (long_options[option_index].name, "blocksize")) {
+ OPTION_blocksize;
} else if (STREQ (long_options[option_index].name, "csv")) {
csv = 1;
} else if (STREQ (long_options[option_index].name, "one-per-guest")) {
@@ -251,6 +258,7 @@ main (int argc, char *argv[])
usage (EXIT_FAILURE);
CHECK_OPTION_format_consumed;
+ CHECK_OPTION_blocksize_consumed;
/* -h and --csv doesn't make sense. Spreadsheets will corrupt these
* fields. (RHBZ#600977).
diff --git a/df/virt-df.pod b/df/virt-df.pod
index de6e6b4e5..947481dac 100644
--- a/df/virt-df.pod
+++ b/df/virt-df.pod
@@ -93,6 +93,8 @@ force a particular format use the I<--format=..> option.
Add a remote disk. See L<guestfish(1)/ADDING REMOTE STORAGE>.
+__INCLUDE:blocksize-option.pod__
+
=item B<-c> URI
=item B<--connect> URI
diff --git a/diff/diff.c b/diff/diff.c
index c04b5f185..6544e5b9e 100644
--- a/diff/diff.c
+++ b/diff/diff.c
@@ -116,6 +116,8 @@ usage (int status)
" --all Same as: --extra-stats --times --uids
--xattrs\n"
" --atime Don't ignore access time changes\n"
" -A image Add image from second guest\n"
+ " --blocksize[=512|4096]\n"
+ " Set sector size of the disk for -a or -A
option\n"
" --checksum[=...] Use checksum of file content\n"
" -c|--connect uri Specify libvirt URI for -d option\n"
" --csv Comma-Separated Values output\n"
@@ -163,6 +165,7 @@ main (int argc, char *argv[])
{ "add", 1, 0, 'a' },
{ "all", 0, 0, 0 },
{ "atime", 0, 0, 0 },
+ { "blocksize", 2, 0, 0 },
{ "checksum", 2, 0, 0 },
{ "checksums", 2, 0, 0 },
{ "csv", 0, 0, 0 },
@@ -201,6 +204,8 @@ main (int argc, char *argv[])
struct drv *drvs2 = NULL; /* Second guest. */
const char *format = NULL;
bool format_consumed = true;
+ int blocksize = 0;
+ bool blocksize_consumed = true;
int c;
int option_index;
struct tree *tree1, *tree2;
@@ -232,6 +237,8 @@ main (int argc, char *argv[])
echo_keys = 1;
} else if (STREQ (long_options[option_index].name, "format")) {
OPTION_format;
+ } else if (STREQ (long_options[option_index].name, "blocksize")) {
+ OPTION_blocksize;
} else if (STREQ (long_options[option_index].name, "all")) {
enable_extra_stats = enable_times = enable_uids = enable_xattrs = 1;
} else if (STREQ (long_options[option_index].name, "atime")) {
@@ -366,6 +373,7 @@ main (int argc, char *argv[])
assert (live == 0);
CHECK_OPTION_format_consumed;
+ CHECK_OPTION_blocksize_consumed;
unsigned errors = 0;
diff --git a/diff/virt-diff.pod b/diff/virt-diff.pod
index 0500598bd..78fdf5ecf 100644
--- a/diff/virt-diff.pod
+++ b/diff/virt-diff.pod
@@ -73,6 +73,8 @@ as well.
Add a disk image from the second virtual machine.
+__INCLUDE:blocksize-option.pod__
+
=item B<--checksum>
=item B<--checksum=crc|md5|sha1|sha224|sha256|sha384|sha512>
diff --git a/edit/edit.c b/edit/edit.c
index 4b9f1bed1..9a4cad2e3 100644
--- a/edit/edit.c
+++ b/edit/edit.c
@@ -76,6 +76,8 @@ usage (int status)
"Options:\n"
" -a|--add image Add image\n"
" -b|--backup .ext Backup original as original.ext\n"
+ " --blocksize[=512|4096]\n"
+ " Set sector size of the disk for -a
option\n"
" -c|--connect uri Specify libvirt URI for -d option\n"
" -d|--domain guest Add disks from libvirt guest\n"
" --echo-keys Don't turn off echo for
passphrases\n"
@@ -109,6 +111,7 @@ main (int argc, char *argv[])
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "backup", 1, 0, 'b' },
+ { "blocksize", 2, 0, 0 },
{ "connect", 1, 0, 'c' },
{ "domain", 1, 0, 'd' },
{ "echo-keys", 0, 0, 0 },
@@ -132,6 +135,8 @@ main (int argc, char *argv[])
char *p;
const char *format = NULL;
bool format_consumed = true;
+ int blocksize = 0;
+ bool blocksize_consumed = true;
int c;
int option_index;
struct key_store *ks = NULL;
@@ -156,6 +161,8 @@ main (int argc, char *argv[])
echo_keys = 1;
} else if (STREQ (long_options[option_index].name, "format")) {
OPTION_format;
+ } else if (STREQ (long_options[option_index].name, "blocksize")) {
+ OPTION_blocksize;
} else if (STREQ (long_options[option_index].name, "key")) {
OPTION_key;
} else
@@ -257,6 +264,7 @@ main (int argc, char *argv[])
usage (EXIT_FAILURE);
CHECK_OPTION_format_consumed;
+ CHECK_OPTION_blocksize_consumed;
/* User must have specified some drives. */
if (drvs == NULL) {
diff --git a/edit/virt-edit.pod b/edit/virt-edit.pod
index 4909a7df1..715e17b7d 100644
--- a/edit/virt-edit.pod
+++ b/edit/virt-edit.pod
@@ -90,6 +90,8 @@ so you would write:
By default, no backup file is made.
+__INCLUDE:blocksize-option.pod__
+
=item B<-c> URI
=item B<--connect> URI
diff --git a/fish/fish.c b/fish/fish.c
index 2070e370e..07379eb30 100644
--- a/fish/fish.c
+++ b/fish/fish.c
@@ -124,6 +124,8 @@ usage (int status)
" -h|--cmd-help List available commands\n"
" -h|--cmd-help cmd Display detailed help on ‘cmd’\n"
" -a|--add image Add image\n"
+ " --blocksize[=512|4096]\n"
+ " Set sector size of the disk for -a
option\n"
" -c|--connect uri Specify libvirt URI for -d option\n"
" --csh Make --listen csh-compatible\n"
" -d|--domain guest Add disks from libvirt guest\n"
@@ -190,6 +192,7 @@ main (int argc, char *argv[])
static const char options[] = "a:c:d:Df:h::im:nN:rvVwx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
+ { "blocksize", 2, 0, 0 },
{ "cmd-help", 2, 0, 'h' },
{ "connect", 1, 0, 'c' },
{ "csh", 0, 0, 0 },
@@ -228,6 +231,8 @@ main (int argc, char *argv[])
char *p, *file = NULL;
const char *format = NULL;
bool format_consumed = true;
+ int blocksize = 0;
+ bool blocksize_consumed = true;
int c;
int option_index;
struct sigaction sa;
@@ -285,6 +290,8 @@ main (int argc, char *argv[])
echo_keys = 1;
} else if (STREQ (long_options[option_index].name, "format")) {
OPTION_format;
+ } else if (STREQ (long_options[option_index].name, "blocksize")) {
+ OPTION_blocksize;
} else if (STREQ (long_options[option_index].name, "csh")) {
remote_control_csh = 1;
} else if (STREQ (long_options[option_index].name, "live")) {
@@ -468,6 +475,7 @@ main (int argc, char *argv[])
}
CHECK_OPTION_format_consumed;
+ CHECK_OPTION_blocksize_consumed;
/* If we've got drives to add, add them now. */
add_drives (drvs);
diff --git a/fish/guestfish.pod b/fish/guestfish.pod
index 1904b640c..d18f80dd7 100644
--- a/fish/guestfish.pod
+++ b/fish/guestfish.pod
@@ -181,6 +181,8 @@ with C<format:...> if the I<--format=...> flag was given.
Add a remote disk. See L</ADDING REMOTE STORAGE>.
+__INCLUDE:blocksize-option.pod__
+
=item B<-c> URI
=item B<--connect> URI
diff --git a/format/Makefile.am b/format/Makefile.am
index 125c57184..01a04dde4 100644
--- a/format/Makefile.am
+++ b/format/Makefile.am
@@ -60,6 +60,7 @@ stamp-virt-format.pod: virt-format.pod
$(PODWRAPPER) \
--man virt-format.1 \
--html $(top_builddir)/website/virt-format.1.html \
+ --path $(top_srcdir)/common/options \
--license GPLv2+ \
--warning general \
$<
diff --git a/format/format.c b/format/format.c
index 5453fc7e1..57e843c06 100644
--- a/format/format.c
+++ b/format/format.c
@@ -80,6 +80,8 @@ usage (int status)
" %s [--options] -a disk.img [-a disk.img ...]\n"
"Options:\n"
" -a|--add image Add image\n"
+ " --blocksize[=512|4096]\n"
+ " Set sector size of the disk for -a
option\n"
" --filesystem=.. Create empty filesystem\n"
" --format[=raw|..] Force disk format for -a option\n"
" --help Display brief help\n"
@@ -112,6 +114,7 @@ main (int argc, char *argv[])
static const char options[] = "a:vVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
+ { "blocksize", 2, 0, 0 },
{ "filesystem", 1, 0, 0 },
{ "format", 2, 0, 0 },
{ "help", 0, 0, HELP_OPTION },
@@ -128,6 +131,8 @@ main (int argc, char *argv[])
struct drv *drvs = NULL;
const char *format = NULL;
bool format_consumed = true;
+ int blocksize = 0;
+ bool blocksize_consumed = true;
int c;
int option_index;
int retry, retries;
@@ -148,6 +153,8 @@ main (int argc, char *argv[])
display_short_options (options);
else if (STREQ (long_options[option_index].name, "format")) {
OPTION_format;
+ } else if (STREQ (long_options[option_index].name, "blocksize")) {
+ OPTION_blocksize;
} else if (STREQ (long_options[option_index].name, "filesystem")) {
if (STREQ (optarg, "none"))
filesystem = NULL;
@@ -233,6 +240,7 @@ main (int argc, char *argv[])
}
CHECK_OPTION_format_consumed;
+ CHECK_OPTION_blocksize_consumed;
/* The user didn't specify any drives to format. */
if (drvs == NULL) {
diff --git a/format/virt-format.pod b/format/virt-format.pod
index 11b4409a7..3b482710b 100644
--- a/format/virt-format.pod
+++ b/format/virt-format.pod
@@ -79,6 +79,8 @@ B<Any existing data on the disk is erased.>
Add a remote disk. See L<guestfish(1)/ADDING REMOTE STORAGE>.
+__INCLUDE:blocksize-option.pod__
+
=item B<--filesystem=ext3|ntfs|vfat|...>
Create an empty filesystem of the specified type. Many filesystem
diff --git a/fuse/guestmount.c b/fuse/guestmount.c
index 6c35bcca7..73c79d6af 100644
--- a/fuse/guestmount.c
+++ b/fuse/guestmount.c
@@ -110,6 +110,8 @@ usage (int status)
" %s [--options] mountpoint\n"
"Options:\n"
" -a|--add image Add image\n"
+ " --blocksize[=512|4096]\n"
+ " Set sector size of the disk for -a
option\n"
" -c|--connect uri Specify libvirt URI for -d option\n"
" --dir-cache-timeout Set readdir cache timeout (default 5
sec)\n"
" -d|--domain guest Add disks from libvirt guest\n"
@@ -157,6 +159,7 @@ main (int argc, char *argv[])
static const char options[] = "a:c:d:im:no:rvVwx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
+ { "blocksize", 2, 0, 0 },
{ "connect", 1, 0, 'c' },
{ "dir-cache-timeout", 1, 0, 0 },
{ "domain", 1, 0, 'd' },
@@ -191,6 +194,8 @@ main (int argc, char *argv[])
char *p;
const char *format = NULL;
bool format_consumed = true;
+ int blocksize = 0;
+ bool blocksize_consumed = true;
int c, r;
int option_index;
struct sigaction sa;
@@ -235,6 +240,8 @@ main (int argc, char *argv[])
/* nothing */
} else if (STREQ (long_options[option_index].name, "format")) {
OPTION_format;
+ } else if (STREQ (long_options[option_index].name, "blocksize")) {
+ OPTION_blocksize;
} else if (STREQ (long_options[option_index].name, "keys-from-stdin")) {
keys_from_stdin = 1;
} else if (STREQ (long_options[option_index].name, "echo-keys")) {
@@ -316,6 +323,7 @@ main (int argc, char *argv[])
}
CHECK_OPTION_format_consumed;
+ CHECK_OPTION_blocksize_consumed;
/* Check we have the right options. */
if (!live) {
diff --git a/fuse/guestmount.pod b/fuse/guestmount.pod
index d4e12e641..b8bfe0db1 100644
--- a/fuse/guestmount.pod
+++ b/fuse/guestmount.pod
@@ -172,6 +172,8 @@ force a particular format use the I<--format=..> option.
Add a remote disk. See L<guestfish(1)/ADDING REMOTE STORAGE>.
+__INCLUDE:blocksize-option.pod__
+
=item B<-c> URI
=item B<--connect> URI
diff --git a/inspector/inspector.c b/inspector/inspector.c
index fa8e721ff..bbfe87452 100644
--- a/inspector/inspector.c
+++ b/inspector/inspector.c
@@ -92,6 +92,8 @@ usage (int status)
" %s [--options] -a disk.img [-a disk.img ...]\n"
"Options:\n"
" -a|--add image Add image\n"
+ " --blocksize[=512|4096]\n"
+ " Set sector size of the disk for -a
option\n"
" -c|--connect uri Specify libvirt URI for -d option\n"
" -d|--domain guest Add disks from libvirt guest\n"
" --echo-keys Don't turn off echo for
passphrases\n"
@@ -124,6 +126,7 @@ main (int argc, char *argv[])
static const char options[] = "a:c:d:vVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
+ { "blocksize", 2, 0, 0 },
{ "connect", 1, 0, 'c' },
{ "domain", 1, 0, 'd' },
{ "echo-keys", 0, 0, 0 },
@@ -144,6 +147,8 @@ main (int argc, char *argv[])
struct drv *drv;
const char *format = NULL;
bool format_consumed = true;
+ int blocksize = 0;
+ bool blocksize_consumed = true;
int c;
int option_index;
struct key_store *ks = NULL;
@@ -168,6 +173,8 @@ main (int argc, char *argv[])
echo_keys = 1;
} else if (STREQ (long_options[option_index].name, "format")) {
OPTION_format;
+ } else if (STREQ (long_options[option_index].name, "blocksize")) {
+ OPTION_blocksize;
} else if (STREQ (long_options[option_index].name, "xpath")) {
xpath = optarg;
} else if (STREQ (long_options[option_index].name, "no-applications")) {
@@ -262,6 +269,7 @@ main (int argc, char *argv[])
}
CHECK_OPTION_format_consumed;
+ CHECK_OPTION_blocksize_consumed;
/* XPath is modal: no drives should be specified. There must be
* one extra parameter on the command line.
diff --git a/inspector/virt-inspector.pod b/inspector/virt-inspector.pod
index 24fbf2e08..e201db4d5 100644
--- a/inspector/virt-inspector.pod
+++ b/inspector/virt-inspector.pod
@@ -74,6 +74,8 @@ force a particular format use the I<--format=..> option.
Add a remote disk. See L<guestfish(1)/ADDING REMOTE STORAGE>.
+__INCLUDE:blocksize-option.pod__
+
=item B<-c> URI
=item B<--connect> URI
diff --git a/rescue/Makefile.am b/rescue/Makefile.am
index 8ceb57fb4..4018bc215 100644
--- a/rescue/Makefile.am
+++ b/rescue/Makefile.am
@@ -66,6 +66,7 @@ stamp-virt-rescue.pod: virt-rescue.pod
$(PODWRAPPER) \
--man virt-rescue.1 \
--html $(top_builddir)/website/virt-rescue.1.html \
+ --path $(top_srcdir)/common/options \
--license GPLv2+ \
--warning ro-option \
$<
diff --git a/rescue/rescue.c b/rescue/rescue.c
index 419242381..25c3ed88d 100644
--- a/rescue/rescue.c
+++ b/rescue/rescue.c
@@ -88,6 +88,8 @@ usage (int status)
"Options:\n"
" -a|--add image Add image\n"
" --append kernelopts Append kernel options\n"
+ " --blocksize[=512|4096]\n"
+ " Set sector size of the disk for -a
option\n"
" -c|--connect uri Specify libvirt URI for -d option\n"
" -d|--domain guest Add disks from libvirt guest\n"
" -e ^x|none Set or disable escape key (default
^])\n"
@@ -127,6 +129,7 @@ main (int argc, char *argv[])
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "append", 1, 0, 0 },
+ { "blocksize", 2, 0, 0 },
{ "connect", 1, 0, 'c' },
{ "domain", 1, 0, 'd' },
{ "format", 2, 0, 0 },
@@ -154,6 +157,8 @@ main (int argc, char *argv[])
char *p;
const char *format = NULL;
bool format_consumed = true;
+ int blocksize = 0;
+ bool blocksize_consumed = true;
int c;
int option_index;
int network = 0;
@@ -187,6 +192,8 @@ main (int argc, char *argv[])
network = 1;
} else if (STREQ (long_options[option_index].name, "format")) {
OPTION_format;
+ } else if (STREQ (long_options[option_index].name, "blocksize")) {
+ OPTION_blocksize;
} else if (STREQ (long_options[option_index].name, "smp")) {
if (sscanf (optarg, "%d", &smp) != 1)
error (EXIT_FAILURE, 0,
@@ -334,6 +341,7 @@ main (int argc, char *argv[])
}
CHECK_OPTION_format_consumed;
+ CHECK_OPTION_blocksize_consumed;
/* User must have specified some drives. */
if (drvs == NULL) {
diff --git a/rescue/virt-rescue.pod b/rescue/virt-rescue.pod
index c7be8b8af..4b3c4c1f3 100644
--- a/rescue/virt-rescue.pod
+++ b/rescue/virt-rescue.pod
@@ -112,6 +112,8 @@ Add a remote disk. See L<guestfish(1)/ADDING REMOTE STORAGE>.
Pass additional options to the rescue kernel.
+__INCLUDE:blocksize-option.pod__
+
=item B<-c> URI
=item B<--connect> URI
--
2.17.2