From 23beb95042ddaa38da74d34b0d43bb5e760cb782 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. (cherry picked from commit 6054051a9d8a5eee4141ca4b12aa5b7d1f36f56d) --- 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.in | 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 e74b4dfc..4b5f8014 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 d2660c7a..8e7b44e8 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 fc08ee8c..3d334041 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 26876a92..d5911a89 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 a69dc4d1..c679242e 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 5d1dfb00..634d0f9f 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 32df4e8a..09d886ad 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 20d64094..cb50fdb9 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.in b/po/POTFILES.in index 4fa609b7..63527544 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -96,6 +96,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 @@ -124,7 +125,6 @@ fish/setenv.c fish/supported.c fish/tilde.c fish/time.c -fish/virt.c format/format.c fuse/dircache.c fuse/guestmount.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