On Mon, Nov 08, 2010 at 12:39:48PM +0000, Matthew Booth wrote:
On 11/08/2010 12:02 PM, Richard W.M. Jones wrote:
>>From 2c4a7ef92a4583a1217213573ad406eb5d745990 Mon Sep 17 00:00:00 2001
>From: Richard W.M. Jones<rjones(a)redhat.com>
>Date: Fri, 5 Nov 2010 18:36:02 +0000
>Subject: [PATCH] fish: Add --rw option (does nothing yet).
>
>This adds the guestfish --rw option, intended in future
>to be required for writing to disk images.
>
>At the moment this does not change the default and so does
>nothing. This patch is intended for backporting to the
>stable branches so that we can start to introduce scripts
>which use 'guestfish --rw'.
>---
> fish/fish.c | 7 ++++++-
> fish/guestfish.pod | 46 ++++++++++++++++++++++++++++++++++++++++------
> fish/options.h | 7 +++++++
> fuse/guestmount.c | 7 ++++++-
> fuse/guestmount.pod | 7 +++++++
> 5 files changed, 66 insertions(+), 8 deletions(-)
>
>--- a/fish/options.h
>+++ b/fish/options.h
>@@ -185,6 +185,13 @@ extern int add_libvirt_drives (const char *guest);
> exit (EXIT_SUCCESS); \
> }
>
>+#define OPTION_w \
>+ if (read_only) { \
>+ fprintf (stderr, _("%s: cannot mix --ro and --rw options\n"), \
>+ program_name); \
>+ exit (EXIT_FAILURE); \
>+ }
>+
This will display an error if the user does:
guestfish --ro --rw
but not:
guestfish --rw --ro
Yeah, I knew that when I was writing it ... The alternative is a bit
more invasive unfortunately. Eventually we need to refactor this
argument sharing code since it's a bit of a macro-hack at the moment.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages.
http://et.redhat.com/~rjones/libguestfs/
See what it can do:
http://et.redhat.com/~rjones/libguestfs/recipes.html