From 6054051a9d8a5eee4141ca4b12aa5b7d1f36f56d Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 19 Jul 2012 14:28:15 +0100 Subject: fish: Rename fish/virt.c to fish/domain.c This file handles the -d option for guestfish and other C command line utilities. Renaming this file makes it less confusing. --- align/Makefile.am | 4 ++-- cat/Makefile.am | 4 ++-- df/Makefile.am | 4 ++-- edit/Makefile.am | 4 ++-- fish/Makefile.am | 4 ++-- fish/domain.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++ fish/virt.c | 58 --------------------------------------------------- format/Makefile.am | 4 ++-- fuse/Makefile.am | 4 ++-- inspector/Makefile.am | 4 ++-- po/POTFILES | 2 +- rescue/Makefile.am | 4 ++-- 12 files changed, 77 insertions(+), 77 deletions(-) create mode 100644 fish/domain.c delete mode 100644 fish/virt.c diff --git a/align/Makefile.am b/align/Makefile.am index 3e1cc893..13409e8f 100644 --- a/align/Makefile.am +++ b/align/Makefile.am @@ -26,11 +26,11 @@ bin_PROGRAMS = virt-alignment-scan SHARED_SOURCE_FILES = \ ../fish/config.c \ + ../fish/domain.c \ ../fish/inspect.c \ ../fish/keys.c \ ../fish/options.h \ - ../fish/options.c \ - ../fish/virt.c + ../fish/options.c virt_alignment_scan_SOURCES = \ $(SHARED_SOURCE_FILES) \ diff --git a/cat/Makefile.am b/cat/Makefile.am index e3250ae9..f7c763ac 100644 --- a/cat/Makefile.am +++ b/cat/Makefile.am @@ -31,11 +31,11 @@ bin_PROGRAMS = virt-cat virt-filesystems virt-ls SHARED_SOURCE_FILES = \ ../fish/config.c \ + ../fish/domain.c \ ../fish/inspect.c \ ../fish/keys.c \ ../fish/options.h \ - ../fish/options.c \ - ../fish/virt.c + ../fish/options.c virt_cat_SOURCES = \ $(SHARED_SOURCE_FILES) \ diff --git a/df/Makefile.am b/df/Makefile.am index 7776110a..8f239e81 100644 --- a/df/Makefile.am +++ b/df/Makefile.am @@ -28,11 +28,11 @@ bin_PROGRAMS = virt-df SHARED_SOURCE_FILES = \ ../fish/config.c \ + ../fish/domain.c \ ../fish/inspect.c \ ../fish/keys.c \ ../fish/options.h \ - ../fish/options.c \ - ../fish/virt.c + ../fish/options.c virt_df_SOURCES = \ $(SHARED_SOURCE_FILES) \ diff --git a/edit/Makefile.am b/edit/Makefile.am index 889d6d9a..ee9af97a 100644 --- a/edit/Makefile.am +++ b/edit/Makefile.am @@ -27,11 +27,11 @@ bin_PROGRAMS = virt-edit SHARED_SOURCE_FILES = \ ../fish/config.c \ + ../fish/domain.c \ ../fish/inspect.c \ ../fish/keys.c \ ../fish/options.h \ - ../fish/options.c \ - ../fish/virt.c + ../fish/options.c virt_edit_SOURCES = \ $(SHARED_SOURCE_FILES) \ diff --git a/fish/Makefile.am b/fish/Makefile.am index abf1b8ed..8e45294a 100644 --- a/fish/Makefile.am +++ b/fish/Makefile.am @@ -64,13 +64,13 @@ EXTRA_DIST = \ # files must not include other guestfish files. SHARED_SOURCE_FILES = \ config.c \ + domain.c \ inspect.c \ keys.c \ options.h \ options.c \ progress.h \ - progress.c \ - virt.c + progress.c guestfish_SOURCES = \ $(generator_built) \ diff --git a/fish/domain.c b/fish/domain.c new file mode 100644 index 00000000..083ea656 --- /dev/null +++ b/fish/domain.c @@ -0,0 +1,58 @@ +/* libguestfs - guestfish and guestmount shared option parsing + * Copyright (C) 2010 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include + +#include +#include +#include +#include + +#include "guestfs.h" + +#include "options.h" + +/* Implements the guts of the '-d' option. + * Returns the number of drives added (> 0), or -1 for failure. + */ +int +add_libvirt_drives (const char *guest) +{ + struct guestfs_add_domain_argv optargs = { .bitmask = 0 }; + + if (libvirt_uri) { + optargs.bitmask |= GUESTFS_ADD_DOMAIN_LIBVIRTURI_BITMASK; + optargs.libvirturi = libvirt_uri; + } + if (read_only) { + optargs.bitmask |= GUESTFS_ADD_DOMAIN_READONLY_BITMASK; + optargs.readonly = 1; + } + if (live) { + optargs.bitmask |= GUESTFS_ADD_DOMAIN_LIVE_BITMASK; + optargs.live = 1; + } + + optargs.bitmask |= GUESTFS_ADD_DOMAIN_ALLOWUUID_BITMASK; + optargs.allowuuid = 1; + + optargs.bitmask |= GUESTFS_ADD_DOMAIN_READONLYDISK_BITMASK; + optargs.readonlydisk = "read"; + + return guestfs_add_domain_argv (g, guest, &optargs); +} diff --git a/fish/virt.c b/fish/virt.c deleted file mode 100644 index 083ea656..00000000 --- a/fish/virt.c +++ /dev/null @@ -1,58 +0,0 @@ -/* libguestfs - guestfish and guestmount shared option parsing - * Copyright (C) 2010 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include - -#include -#include -#include -#include - -#include "guestfs.h" - -#include "options.h" - -/* Implements the guts of the '-d' option. - * Returns the number of drives added (> 0), or -1 for failure. - */ -int -add_libvirt_drives (const char *guest) -{ - struct guestfs_add_domain_argv optargs = { .bitmask = 0 }; - - if (libvirt_uri) { - optargs.bitmask |= GUESTFS_ADD_DOMAIN_LIBVIRTURI_BITMASK; - optargs.libvirturi = libvirt_uri; - } - if (read_only) { - optargs.bitmask |= GUESTFS_ADD_DOMAIN_READONLY_BITMASK; - optargs.readonly = 1; - } - if (live) { - optargs.bitmask |= GUESTFS_ADD_DOMAIN_LIVE_BITMASK; - optargs.live = 1; - } - - optargs.bitmask |= GUESTFS_ADD_DOMAIN_ALLOWUUID_BITMASK; - optargs.allowuuid = 1; - - optargs.bitmask |= GUESTFS_ADD_DOMAIN_READONLYDISK_BITMASK; - optargs.readonlydisk = "read"; - - return guestfs_add_domain_argv (g, guest, &optargs); -} diff --git a/format/Makefile.am b/format/Makefile.am index 05b14ec9..2aba2132 100644 --- a/format/Makefile.am +++ b/format/Makefile.am @@ -26,11 +26,11 @@ bin_PROGRAMS = virt-format SHARED_SOURCE_FILES = \ ../fish/config.c \ + ../fish/domain.c \ ../fish/inspect.c \ ../fish/keys.c \ ../fish/options.h \ - ../fish/options.c \ - ../fish/virt.c + ../fish/options.c virt_format_SOURCES = \ $(SHARED_SOURCE_FILES) \ diff --git a/fuse/Makefile.am b/fuse/Makefile.am index 442451a0..1793a7cd 100644 --- a/fuse/Makefile.am +++ b/fuse/Makefile.am @@ -29,11 +29,11 @@ bin_PROGRAMS = guestmount # between guestfish and guestmount. SHARED_SOURCE_FILES = \ ../fish/config.c \ + ../fish/domain.c \ ../fish/inspect.c \ ../fish/keys.c \ ../fish/options.h \ - ../fish/options.c \ - ../fish/virt.c + ../fish/options.c guestmount_SOURCES = \ $(SHARED_SOURCE_FILES) \ diff --git a/inspector/Makefile.am b/inspector/Makefile.am index 54a551c6..ce3aca94 100644 --- a/inspector/Makefile.am +++ b/inspector/Makefile.am @@ -51,11 +51,11 @@ bin_PROGRAMS = virt-inspector SHARED_SOURCE_FILES = \ ../fish/config.c \ + ../fish/domain.c \ ../fish/inspect.c \ ../fish/keys.c \ ../fish/options.h \ - ../fish/options.c \ - ../fish/virt.c + ../fish/options.c virt_inspector_SOURCES = \ $(SHARED_SOURCE_FILES) \ diff --git a/po/POTFILES b/po/POTFILES index ec33744b..4bbe2d10 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -102,6 +102,7 @@ fish/config.c fish/copy.c fish/destpaths.c fish/display.c +fish/domain.c fish/echo.c fish/edit.c fish/event-names.c @@ -130,7 +131,6 @@ fish/setenv.c fish/supported.c fish/tilde.c fish/time.c -fish/virt.c format/format.c fuse/guestmount.c gobject/src/optargs-add_domain.c diff --git a/rescue/Makefile.am b/rescue/Makefile.am index 328df7e6..af2d1965 100644 --- a/rescue/Makefile.am +++ b/rescue/Makefile.am @@ -26,11 +26,11 @@ bin_PROGRAMS = virt-rescue SHARED_SOURCE_FILES = \ ../fish/config.c \ + ../fish/domain.c \ ../fish/inspect.c \ ../fish/keys.c \ ../fish/options.h \ - ../fish/options.c \ - ../fish/virt.c + ../fish/options.c virt_rescue_SOURCES = \ $(SHARED_SOURCE_FILES) \ -- cgit