[PATCH v3 1/2] Modify the function: analyze_line, make it more flexible
by Cao jin
Mofify the function from a fixed delimiter to a variable. So,
it can be used in more APIs later. Also modified the existing
callers
Signed-off-by: Cao jin <caoj.fnst(a)cn.fujitsu.com>
---
daemon/btrfs.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 39392f7..caa28ca 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -853,11 +853,10 @@ do_btrfs_fsck (const char *device, int64_t superblock, int repair)
* returns the next position following \n.
*/
static char *
-analyze_line (char *line, char **key, char **value)
+analyze_line (char *line, char **key, char **value, char delimiter)
{
char *p = line;
char *next = NULL;
- char delimiter = ':';
char *del_pos = NULL;
if (!line || *line == '\0') {
@@ -964,7 +963,7 @@ do_btrfs_subvolume_show (const char *subvolume)
* snapshots/test3
*
*/
- p = analyze_line(out, &key, &value);
+ p = analyze_line(out, &key, &value, ':');
if (!p) {
reply_with_error ("truncated output: %s", out);
return NULL;
@@ -984,7 +983,7 @@ do_btrfs_subvolume_show (const char *subvolume)
}
/* Read the lines and split into "key: value". */
- p = analyze_line(p, &key, &value);
+ p = analyze_line(p, &key, &value, ':');
while (key) {
/* snapshot is special, see the output above */
if (STREQLEN (key, "Snapshot(s)", sizeof ("Snapshot(s)") - 1)) {
@@ -994,7 +993,7 @@ do_btrfs_subvolume_show (const char *subvolume)
if (add_string (&ret, key) == -1)
return NULL;
- p = analyze_line(p, &key, &value);
+ p = analyze_line(p, &key, &value, ':');
while (key && !value) {
ss = realloc (ss, ss_len + strlen (key) + 1);
@@ -1008,7 +1007,7 @@ do_btrfs_subvolume_show (const char *subvolume)
ss_len += strlen (key);
ss[ss_len] = '\0';
- p = analyze_line(p, &key, &value);
+ p = analyze_line(p, &key, &value, ':');
}
if (ss) {
@@ -1031,7 +1030,7 @@ do_btrfs_subvolume_show (const char *subvolume)
return NULL;
}
- p = analyze_line(p, &key, &value);
+ p = analyze_line(p, &key, &value, ':');
}
}
@@ -2083,3 +2082,4 @@ do_btrfs_image (char *const *sources, const char *image,
return 0;
}
+
--
2.1.0
9 years, 5 months
[PATCH] uuid: add support to change uuid of btrfs partition
by Chen Hanxiao
btrfs-progs v4.1 add support to change uuid of btrfs fs.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
daemon/uuids.c | 19 +++++++++++++++++--
generator/actions.ml | 4 ++++
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/daemon/uuids.c b/daemon/uuids.c
index 06b33e9..c18cb55 100644
--- a/daemon/uuids.c
+++ b/daemon/uuids.c
@@ -30,6 +30,7 @@
GUESTFSD_EXT_CMD(str_tune2fs, tune2fs);
GUESTFSD_EXT_CMD(str_xfs_admin, xfs_admin);
GUESTFSD_EXT_CMD(str_swaplabel, swaplabel);
+GUESTFSD_EXT_CMD(str_btrfstune, btrfstune);
static int
e2uuid (const char *device, const char *uuid)
@@ -91,6 +92,21 @@ swapuuid (const char *device, const char *uuid)
return 0;
}
+static int
+btrfsuuid (const char *device, const char *uuid)
+{
+ int r;
+ CLEANUP_FREE char *err = NULL;
+
+ r = command (NULL, &err, str_btrfstune, "-f", "-U", uuid, device, NULL);
+ if (r == -1) {
+ reply_with_error ("%s", err);
+ return -1;
+ }
+
+ return 0;
+}
+
int
do_set_uuid (const char *device, const char *uuid)
{
@@ -111,8 +127,7 @@ do_set_uuid (const char *device, const char *uuid)
r = swapuuid (device, uuid);
else if (STREQ (vfs_type, "btrfs")) {
- reply_with_error ("btrfs filesystems' UUID cannot be changed");
- r = -1;
+ r = btrfsuuid (device, uuid);
}
else {
diff --git a/generator/actions.ml b/generator/actions.ml
index d5e5ccf..ca77c87 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -11774,6 +11774,10 @@ parameter. In future we may allow other flags to be adjusted." };
InitBasicFS, Always, TestResultString (
[["set_uuid"; "/dev/sda1"; uuid];
["vfs_uuid"; "/dev/sda1"]], uuid), [];
+ InitPartition, Always, TestResultString (
+ [["mkfs_btrfs"; "/dev/sda1"; ""; ""; "NOARG"; ""; "NOARG"; "NOARG"; ""; ""];
+ ["set_uuid"; "/dev/sda1"; uuid];
+ ["vfs_uuid"; "/dev/sda1"]], uuid), [];
]);
shortdesc = "set the filesystem UUID";
longdesc = "\
--
2.1.0
9 years, 5 months
[PATCH] btrfs: remove redundant whitespace
by Chen Hanxiao
s/ =/ =
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
daemon/btrfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 8b5779a..306cade 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -512,7 +512,7 @@ do_btrfs_subvolume_list (const mountable_t *fs)
goto error;
}
- struct guestfs_int_btrfssubvolume *this =
+ struct guestfs_int_btrfssubvolume *this =
&ret->guestfs_int_btrfssubvolume_list_val[i];
#if __WORDSIZE == 64
@@ -1298,7 +1298,7 @@ do_btrfs_qgroup_show (const char *path)
for (i = 0; i < nr_qgroups; ++i) {
char *line = lines[i + 2];
- struct guestfs_int_btrfsqgroup *this =
+ struct guestfs_int_btrfsqgroup *this =
&ret->guestfs_int_btrfsqgroup_list_val[i];
uint64_t dummy1, dummy2;
char *p;
--
2.1.0
9 years, 5 months
Question about "btrfs send/receive" cmd
by Cao jin
Hi,
I am considering implement "btrfs send/receive" API in libguestfs.
But seems its usual condition is incremental backup which is pretty
complicated (see 5.7.1:
http://docs.oracle.com/cd/E37670_01/E37355/html/ol_sendrecv_btrfs.html)
and not suitable for implementation as I think.
So I am considering, does it make sense to implement a simplest form:
$ btrfs send -f sent_file subvol
$ btrfs receive -f sent_file mountpoint
which just backup a subvolume and restore it.
Anyone have suggestions?
--
Yours Sincerely,
Cao Jin
9 years, 5 months
[PATCH] v2v: Support loading virtio-win drivers from virtio-win.iso (RHBZ#1234351).
by Richard W.M. Jones
This makes several changes to the handling of virtio-win drivers:
The VIRTIO_WIN_DIR environment variable has been renamed
VIRTIO_WIN (but you can still use the old name).
You can point the VIRTIO_WIN either at a RHEL virtio-win directory
(ie. /usr/share/virtio-win), OR at a loopback-mounted virtio-win ISO,
OR at the virtio-win.iso file itself. In the latter case, libguestfs
is used to open the ISO file and read drivers from it.
The code is more flexible about the pathnames of drivers, because the
paths in the ISO are completely different from the paths in RHEL
/usr/share/virtio-win.
---
v2v/convert_windows.ml | 163 +++++++++++++++++++++----------------------------
v2v/utils.ml | 125 +++++++++++++++++++++++++++++++++++++
v2v/virt-v2v.pod | 9 ++-
3 files changed, 202 insertions(+), 95 deletions(-)
diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml
index d373dba..504cc26 100644
--- a/v2v/convert_windows.ml
+++ b/v2v/convert_windows.ml
@@ -47,9 +47,12 @@ let convert ~keep_serial_console (g : G.guestfs) inspect source =
try Sys.getenv "VIRT_TOOLS_DATA_DIR"
with Not_found -> Config.datadir // "virt-tools" in
- let virtio_win_dir =
- try Sys.getenv "VIRTIO_WIN_DIR"
- with Not_found -> Config.datadir // "virtio-win" in
+ let virtio_win =
+ try Sys.getenv "VIRTIO_WIN"
+ with Not_found ->
+ try Sys.getenv "VIRTIO_WIN_DIR" (* old name for VIRTIO_WIN *)
+ with Not_found ->
+ Config.datadir // "virtio-win" in
(* Check if RHEV-APT exists. This is optional. *)
let rhev_apt_exe = virt_tools_data_dir // "rhev-apt.exe" in
@@ -233,101 +236,77 @@ echo uninstalling Xen PV driver
let driverdir = sprintf "%s/Drivers/VirtIO" systemroot in
g#mkdir_p driverdir;
- (* See if the drivers for this guest are available in virtio_win_dir. *)
- let path =
- match inspect.i_arch,
- inspect.i_major_version, inspect.i_minor_version,
- inspect.i_product_variant with
- | "i386", 5, 1, _ ->
- Some (virtio_win_dir // "drivers/i386/WinXP")
- | "i386", 5, 2, _ ->
- Some (virtio_win_dir // "drivers/i386/Win2003")
- | "i386", 6, 0, _ ->
- Some (virtio_win_dir // "drivers/i386/Win2008")
- | "i386", 6, 1, _ ->
- Some (virtio_win_dir // "drivers/i386/Win7")
- | "i386", 6, 2, _ ->
- Some (virtio_win_dir // "drivers/i386/Win8")
- | "i386", 6, 3, _ ->
- Some (virtio_win_dir // "drivers/i386/Win8.1")
+ (* Load the list of drivers available. *)
+ let drivers = find_virtio_win_drivers virtio_win in
- | "x86_64", 5, 2, _ ->
- Some (virtio_win_dir // "drivers/amd64/Win2003")
- | "x86_64", 6, 0, _ ->
- Some (virtio_win_dir // "drivers/amd64/Win2008")
- | "x86_64", 6, 1, "Client" ->
- Some (virtio_win_dir // "drivers/amd64/Win7")
- | "x86_64", 6, 1, "Server" ->
- Some (virtio_win_dir // "drivers/amd64/Win2008R2")
- | "x86_64", 6, 2, "Client" ->
- Some (virtio_win_dir // "drivers/amd64/Win8")
- | "x86_64", 6, 2, "Server" ->
- Some (virtio_win_dir // "drivers/amd64/Win2012")
- | "x86_64", 6, 3, "Client" ->
- Some (virtio_win_dir // "drivers/amd64/Win8.1")
- | "x86_64", 6, 3, "Server" ->
- Some (virtio_win_dir // "drivers/amd64/Win2012R2")
+ (* Filter out only drivers matching the current guest. *)
+ let drivers =
+ List.filter (
+ fun { vwd_os_arch = arch;
+ vwd_os_major = os_major; vwd_os_minor = os_minor;
+ vwd_os_variant = os_variant } ->
+ arch = inspect.i_arch &&
+ os_major = inspect.i_major_version &&
+ os_minor = inspect.i_minor_version &&
+ (match os_variant with
+ | Vwd_client -> inspect.i_product_variant = "Client"
+ | Vwd_server -> inspect.i_product_variant = "Server"
+ | Vwd_any_variant -> true)
+ ) drivers in
- | _ ->
- None in
+ match drivers with
+ | [] ->
+ warning (f_"there are no virtio drivers available for this version of Windows (%d.%d %s %s). virt-v2v looks for drivers in %s\n\nThe guest will be configured to use slower emulated devices.")
+ inspect.i_major_version inspect.i_minor_version
+ inspect.i_arch inspect.i_product_variant
+ virtio_win;
+ ( IDE, RTL8139 )
- let path =
- match path with
- | None -> None
- | Some path ->
- if is_directory path then Some path else None in
+ | drivers ->
+ (* Can we install the block driver? *)
+ let block : guestcaps_block_type =
+ try
+ let viostor_sys_file =
+ List.find
+ (fun { vwd_filename = filename } -> filename = "viostor.sys")
+ drivers in
+ (* Get the actual file contents of the .sys file. *)
+ let content = viostor_sys_file.vwd_get_contents () in
+ let target = sprintf "%s/system32/drivers/viostor.sys" systemroot in
+ let target = g#case_sensitive_path target in
+ g#write target content;
+ add_viostor_to_critical_device_database root current_cs;
+ Virtio_blk
+ with Not_found ->
+ warning (f_"there is no viostor (virtio block device) driver for this version of Windows (%d.%d %s). virt-v2v looks for this driver in %s\n\nThe guest will be configured to use a slower emulated device.")
+ inspect.i_major_version inspect.i_minor_version
+ inspect.i_arch virtio_win;
+ IDE in
- match path with
- | None ->
- warning (f_"there are no virtio drivers available for this version of Windows (%d.%d %s %s). virt-v2v looks for drivers in %s\n\nThe guest will be configured to use slower emulated devices.")
- inspect.i_major_version inspect.i_minor_version
- inspect.i_arch inspect.i_product_variant
- virtio_win_dir;
- ( IDE, RTL8139 )
+ (* Can we install the virtio-net driver? *)
+ let net : guestcaps_net_type =
+ if not (List.exists
+ (fun { vwd_filename = filename } -> filename = "netkvm.inf")
+ drivers) then (
+ warning (f_"there is no virtio network driver for this version of Windows (%d.%d %s). virt-v2v looks for this driver in %s\n\nThe guest will be configured to use a slower emulated device.")
+ inspect.i_major_version inspect.i_minor_version
+ inspect.i_arch virtio_win;
+ RTL8139
+ )
+ else
+ (* It will be installed at firstboot. *)
+ Virtio_net in
- | Some path ->
- (* Can we install the block driver? *)
- let block : guestcaps_block_type =
- let block_path = path // "viostor.sys" in
- if not (Sys.file_exists block_path) then (
- warning (f_"there is no viostor (virtio block device) driver for this version of Windows (%d.%d %s). virt-v2v looks for this driver here: %s\n\nThe guest will be configured to use a slower emulated device.")
- inspect.i_major_version inspect.i_minor_version
- inspect.i_arch block_path;
- IDE
- )
- else (
- let target = sprintf "%s/system32/drivers/viostor.sys" systemroot in
- let target = g#case_sensitive_path target in
- g#upload block_path target;
- add_viostor_to_critical_device_database root current_cs;
- Virtio_blk
- ) in
+ (* Copy all the drivers to the driverdir. They will be
+ * installed at firstboot.
+ *)
+ List.iter (
+ fun driver ->
+ let content = driver.vwd_get_contents () in
+ g#write (driverdir // driver.vwd_filename) content
+ ) drivers;
- (* Can we install the virtio-net driver? *)
- let net : guestcaps_net_type =
- let net_path = path // "netkvm.inf" in
- if not (Sys.file_exists net_path) then (
- warning (f_"there is no virtio network driver for this version of Windows (%d.%d %s). virt-v2v looks for this driver here: %s\n\nThe guest will be configured to use a slower emulated device.")
- inspect.i_major_version inspect.i_minor_version
- inspect.i_arch net_path;
- RTL8139
- )
- else
- (* It will be installed at firstboot. *)
- Virtio_net in
-
- (* Copy the drivers to the driverdir. They will be installed at
- * firstboot.
- *)
- let files = Sys.readdir path in
- let files = Array.to_list files in
- let files = List.sort compare files in
- List.iter (
- fun file ->
- g#upload (path // file) (driverdir // file)
- ) files;
-
- (block, net)
+ (block, net)
and add_viostor_to_critical_device_database root current_cs =
let { i_major_version = major; i_minor_version = minor;
diff --git a/v2v/utils.ml b/v2v/utils.ml
index 43052bd..8189ed2 100644
--- a/v2v/utils.ml
+++ b/v2v/utils.ml
@@ -109,6 +109,131 @@ let find_uefi_firmware guest_arch =
in
loop files
+(* Find virtio-win driver files from an unpacked or mounted virtio-win
+ * directory, or from a virtio-win.iso file. The location of drivers
+ varies between releases of virtio-win and also across Fedora and
+ RHEL so try to be robust to changes.
+ *)
+type virtio_win_driver_file = {
+ (* Base filename, eg. "netkvm.sys" *)
+ vwd_filename : string;
+ (* Return the contents of this file. *)
+ vwd_get_contents : unit -> string;
+
+ (* Various fields that classify this driver: *)
+
+ vwd_os_major : int; (* Windows version. *)
+ vwd_os_minor : int;
+ vwd_os_variant : vwd_os_variant;
+ vwd_os_arch : string; (* Architecture, eg "i386", "x86_64". *)
+ vwd_extension : string; (* File extension, eg. "sys", "inf" *)
+}
+and vwd_os_variant = Vwd_client | Vwd_server | Vwd_any_variant
+
+let find_virtio_win_drivers virtio_win =
+ let is_regular_file path = (* NB: follows symlinks. *)
+ try (Unix.stat path).Unix.st_kind = Unix.S_REG
+ with Unix.Unix_error _ -> false
+ in
+
+ let files =
+ if is_directory virtio_win then (
+ let cmd = sprintf "cd %s && find -type f" (quote virtio_win) in
+ let paths = external_command cmd in
+ List.map (
+ fun path ->
+ path,
+ Filename.basename path,
+ fun () -> read_whole_file (virtio_win // path)
+ ) paths
+ )
+ else if is_regular_file virtio_win then (
+ try
+ let g = new Guestfs.guestfs () in
+ if trace () then g#set_trace true;
+ if verbose () then g#set_verbose true;
+ g#add_drive_opts virtio_win ~readonly:true;
+ g#launch ();
+ g#mount_ro "/dev/sda" "/";
+ let paths = g#find "/" in
+ let paths = Array.to_list paths in
+ let paths = List.map ((^) "/") paths in
+ let paths = List.filter (g#is_file ~followsymlinks:false) paths in
+ List.map (
+ fun path ->
+ let i = String.rindex path '/' in
+ let len = String.length path in
+ let basename = String.sub path (i+1) (len - (i+1)) in
+ (path,
+ basename,
+ fun () -> g#read_file path)
+ ) paths
+ with Guestfs.Error msg ->
+ error (f_"%s: cannot open virtio-win ISO file: %s") virtio_win msg
+ )
+ else [] in
+
+ let files =
+ filter_map (
+ fun (path, basename, get_contents) ->
+ try
+ let extension =
+ let i = String.rindex path '.' in
+ let len = String.length path in
+ String.sub path (i+1) (len - (i+1)) in
+
+ (* Skip files without specific extensions. *)
+ if extension <> "cat" && extension <> "inf" &&
+ extension <> "pdb" && extension <> "sys" then
+ raise Not_found;
+
+ (* Using the full path, work out what version of Windows
+ * this driver is for. Paths can be things like:
+ * "NetKVM/2k12R2/amd64/netkvm.sys" or
+ * "./drivers/amd64/Win2012R2/netkvm.sys".
+ *)
+ let pathelem elem = string_find path ("/" ^ elem ^ "/") >= 0 in
+ let arch =
+ if pathelem "x86" || pathelem "i386" then "i386"
+ else if pathelem "amd64" then "x86_64"
+ else raise Not_found in
+ let os_major, os_minor, os_variant =
+ if pathelem "xp" || pathelem "WinXP" then
+ (5, 1, Vwd_any_variant)
+ else if pathelem "2k3" || pathelem "Win2003" then
+ (5, 2, Vwd_any_variant)
+ else if pathelem "2k8" || pathelem "Win2008" then
+ (6, 0, Vwd_any_variant)
+ else if pathelem "w7" || pathelem "Win7" then
+ (6, 1, Vwd_client)
+ else if pathelem "2k8R2" || pathelem "Win2008" then
+ (6, 1, Vwd_server)
+ else if pathelem "w8" || pathelem "Win8" then
+ (6, 2, Vwd_client)
+ else if pathelem "2k12" || pathelem "Win2012" then
+ (6, 2, Vwd_server)
+ else if pathelem "w8.1" || pathelem "Win8.1" then
+ (6, 3, Vwd_client)
+ else if pathelem "2k12R2" || pathelem "Win2012R2" then
+ (6, 3, Vwd_server)
+ else
+ raise Not_found in
+
+ Some {
+ vwd_filename = basename;
+ vwd_get_contents = get_contents;
+ vwd_os_major = os_major;
+ vwd_os_minor = os_minor;
+ vwd_os_variant = os_variant;
+ vwd_os_arch = arch;
+ vwd_extension = extension;
+ }
+
+ with Not_found -> None
+ ) files in
+
+ files
+
let compare_app2_versions app1 app2 =
let i = compare app1.Guestfs.app2_epoch app2.Guestfs.app2_epoch in
if i <> 0 then i
diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
index f5dfe24..ef2dee1 100644
--- a/v2v/virt-v2v.pod
+++ b/v2v/virt-v2v.pod
@@ -726,7 +726,7 @@ below.
OpenSUSE 10 kernel >= 2.6.25.5-1.1
Windows Drivers are installed from the directory pointed to by
- "VIRTIO_WIN_DIR" environment variable
+ "VIRTIO_WIN" environment variable
(/usr/share/virtio-win by default) if present
=head1 RHEL 4
@@ -1605,10 +1605,13 @@ not distributed with virt-v2v.
=back
-=item C<VIRTIO_WIN_DIR>
+=item C<VIRTIO_WIN>
This is where VirtIO drivers for Windows are searched for
-(F</usr/share/virtio-win> if unset). See L<ENABLING VIRTIO>.
+(F</usr/share/virtio-win> if unset). It can be a directory I<or>
+point to F<virtio-win.iso> (CD ROM image containing drivers).
+
+See L<ENABLING VIRTIO>.
=back
--
2.3.1
9 years, 5 months
[PATCH] btrfs: fix leak in btrfs_balance_status
by Chen Hanxiao
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
daemon/btrfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 050bf18..8b5779a 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -1688,8 +1688,8 @@ do_btrfs_balance_status (const char *path)
size_t i = 0;
CLEANUP_FREE char *path_buf = NULL;
CLEANUP_FREE char *err = NULL;
+ CLEANUP_FREE char *out = NULL;
CLEANUP_FREE_STRING_LIST char **lines = NULL;
- char *out;
int r;
guestfs_int_btrfsbalance *ret;
size_t nlines;
--
2.1.0
9 years, 5 months
[PATCH v2 1/2] Modify the function: analyze_line, make it more flexible
by Cao jin
Mofify the function from a fixed delimiter to a variable. So,
it can be used in more APIs later. Also modified the existing
callers
Signed-off-by: Cao jin <caoj.fnst(a)cn.fujitsu.com>
---
daemon/btrfs.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 39392f7..caa28ca 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -853,11 +853,10 @@ do_btrfs_fsck (const char *device, int64_t superblock, int repair)
* returns the next position following \n.
*/
static char *
-analyze_line (char *line, char **key, char **value)
+analyze_line (char *line, char **key, char **value, char delimiter)
{
char *p = line;
char *next = NULL;
- char delimiter = ':';
char *del_pos = NULL;
if (!line || *line == '\0') {
@@ -964,7 +963,7 @@ do_btrfs_subvolume_show (const char *subvolume)
* snapshots/test3
*
*/
- p = analyze_line(out, &key, &value);
+ p = analyze_line(out, &key, &value, ':');
if (!p) {
reply_with_error ("truncated output: %s", out);
return NULL;
@@ -984,7 +983,7 @@ do_btrfs_subvolume_show (const char *subvolume)
}
/* Read the lines and split into "key: value". */
- p = analyze_line(p, &key, &value);
+ p = analyze_line(p, &key, &value, ':');
while (key) {
/* snapshot is special, see the output above */
if (STREQLEN (key, "Snapshot(s)", sizeof ("Snapshot(s)") - 1)) {
@@ -994,7 +993,7 @@ do_btrfs_subvolume_show (const char *subvolume)
if (add_string (&ret, key) == -1)
return NULL;
- p = analyze_line(p, &key, &value);
+ p = analyze_line(p, &key, &value, ':');
while (key && !value) {
ss = realloc (ss, ss_len + strlen (key) + 1);
@@ -1008,7 +1007,7 @@ do_btrfs_subvolume_show (const char *subvolume)
ss_len += strlen (key);
ss[ss_len] = '\0';
- p = analyze_line(p, &key, &value);
+ p = analyze_line(p, &key, &value, ':');
}
if (ss) {
@@ -1031,7 +1030,7 @@ do_btrfs_subvolume_show (const char *subvolume)
return NULL;
}
- p = analyze_line(p, &key, &value);
+ p = analyze_line(p, &key, &value, ':');
}
}
@@ -2083,3 +2082,4 @@ do_btrfs_image (char *const *sources, const char *image,
return 0;
}
+
--
2.1.0
9 years, 5 months
[PATCH] v2v: remove unused sources and libraries
by Pino Toscano
---
v2v/Makefile.am | 20 +-------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
index 03f818c..0dd9d9b 100644
--- a/v2v/Makefile.am
+++ b/v2v/Makefile.am
@@ -97,12 +97,7 @@ SOURCES_ML = \
v2v.ml
SOURCES_C = \
- $(top_srcdir)/fish/progress.c \
- $(top_srcdir)/fish/file-edit.c \
- $(top_srcdir)/mllib/progress-c.c \
$(top_srcdir)/mllib/mkdtemp-c.c \
- $(top_srcdir)/customize/crypt-c.c \
- $(top_srcdir)/customize/perl_edit-c.c \
domainxml-c.c \
kvmuid-c.c \
utils-c.c \
@@ -117,8 +112,7 @@ virt_v2v_CPPFLAGS = \
-I. \
-I$(top_builddir) \
-I$(shell $(OCAMLC) -where) \
- -I$(top_srcdir)/src \
- -I$(top_srcdir)/fish
+ -I$(top_srcdir)/src
virt_v2v_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(LIBXML2_CFLAGS) \
@@ -129,20 +123,10 @@ BOBJECTS = \
$(top_builddir)/mllib/common_gettext.cmo \
$(top_builddir)/mllib/common_utils.cmo \
$(top_builddir)/mllib/regedit.cmo \
- $(top_builddir)/mllib/progress.cmo \
$(top_builddir)/mllib/mkdtemp.cmo \
$(top_builddir)/mllib/JSON.cmo \
$(top_builddir)/customize/customize_utils.cmo \
- $(top_builddir)/customize/urandom.cmo \
- $(top_builddir)/customize/random_seed.cmo \
- $(top_builddir)/customize/hostname.cmo \
- $(top_builddir)/customize/timezone.cmo \
$(top_builddir)/customize/firstboot.cmo \
- $(top_builddir)/customize/perl_edit.cmo \
- $(top_builddir)/customize/crypt.cmo \
- $(top_builddir)/customize/password.cmo \
- $(top_builddir)/customize/ssh_key.cmo \
- $(top_builddir)/customize/customize_run.cmo \
$(SOURCES_ML:.ml=.cmo)
XOBJECTS = $(BOBJECTS:.cmo=.cmx)
@@ -162,8 +146,6 @@ endif
OCAMLCLIBS = \
-lutils \
- $(LIBTINFO_LIBS) \
- $(LIBCRYPT_LIBS) \
$(LIBVIRT_LIBS) \
$(LIBXML2_LIBS) \
$(LIBINTL) \
--
2.1.0
9 years, 5 months