mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
tools: add '--blocksize' option for C-based tools
This patch adds '--blocksize' command line option for guestfish and other C-based tools. This option allows specifying disk sector size.
This commit is contained in:
committed by
Richard W.M. Jones
parent
94843f155a
commit
6b6bb44ebc
@@ -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 \
|
||||
$<
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -21,4 +21,5 @@ set -e
|
||||
$TEST_FUNCTIONS
|
||||
skip_if_skipped
|
||||
|
||||
$top_srcdir/podcheck.pl "$srcdir/virt-alignment-scan.pod" virt-alignment-scan
|
||||
$top_srcdir/podcheck.pl "$srcdir/virt-alignment-scan.pod" virt-alignment-scan \
|
||||
--path $top_srcdir/common/options
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 \
|
||||
$<
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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) {
|
||||
|
||||
8
cat/ls.c
8
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 &&
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -126,6 +126,8 @@ See also I<--long>.
|
||||
|
||||
Display block devices.
|
||||
|
||||
__INCLUDE:blocksize-option.pod__
|
||||
|
||||
=item B<-c> URI
|
||||
|
||||
=item B<--connect> URI
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
2
common
2
common
Submodule common updated: ea10827b4c...c33e0036c7
@@ -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 \
|
||||
$<
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -20,4 +20,5 @@ set -e
|
||||
|
||||
$TEST_FUNCTIONS
|
||||
|
||||
$top_srcdir/podcheck.pl "$srcdir/virt-df.pod" virt-df
|
||||
$top_srcdir/podcheck.pl "$srcdir/virt-df.pod" virt-df \
|
||||
--path $top_srcdir/common/options
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 \
|
||||
$<
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -21,4 +21,5 @@ set -e
|
||||
$TEST_FUNCTIONS
|
||||
skip_if_skipped
|
||||
|
||||
$top_srcdir/podcheck.pl "$srcdir/virt-format.pod" virt-format
|
||||
$top_srcdir/podcheck.pl "$srcdir/virt-format.pod" virt-format \
|
||||
--path $top_srcdir/common/options
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 \
|
||||
$<
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -22,4 +22,5 @@ $TEST_FUNCTIONS
|
||||
skip_if_skipped
|
||||
|
||||
$top_srcdir/podcheck.pl "$srcdir/virt-rescue.pod" virt-rescue \
|
||||
--path $top_srcdir/common/options \
|
||||
--ignore=--suggest
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user