Displaying 14 results from an estimated 14 matches for "guestfs_mountable_device".
2016 Feb 26
1
Displaying mountables in the error output of guestfish etc
...e -DGUESTFS_PRIVATE=1
all over the place. So that's a bad idea.
I think probably the way to solve this is with new public APIs for
returning the device and volume name from a mountable. Similar to
guestfs_internal_parse_mountable in fact, but a public API that we
commit to.
char *device = guestfs_mountable_device (g, const char *mountable);
char *volume = guestfs_mountable_volume (g, const char *mountable);
If a mountable doesn't have a (sub-)volume, the second API should
probably return a well-defined errno (ESRCH or ENOENT?).
The code in fish/options.c then just has to:
foreach fs in guestfs_l...
2016 Jun 08
1
[PATCH] filesystems: don't try to get the size of btrfs subvolume
....c
index f1c2852..f679517 100644
--- a/cat/filesystems.c
+++ b/cat/filesystems.c
@@ -476,9 +476,27 @@ do_output_filesystems (void)
}
}
if ((columns & COLUMN_SIZE)) {
- size = guestfs_blockdev_getsize64 (g, fses[i]);
- if (size == -1)
+ CLEANUP_FREE char *device = guestfs_mountable_device (g, fses[i]);
+ CLEANUP_FREE char *subvolume = NULL;
+
+ guestfs_push_error_handler (g, NULL, NULL);
+
+ subvolume = guestfs_mountable_subvolume (g, fses[i]);
+ if (subvolume == NULL && guestfs_last_errno (g) != EINVAL) {
+ fprintf (stderr,
+ _(&qu...
2016 Jun 15
1
[PATCH v2] filesystems: don't try to get the size of btrfs subvolume
....c
index f1c2852..cfdac86 100644
--- a/cat/filesystems.c
+++ b/cat/filesystems.c
@@ -476,9 +476,28 @@ do_output_filesystems (void)
}
}
if ((columns & COLUMN_SIZE)) {
- size = guestfs_blockdev_getsize64 (g, fses[i]);
- if (size == -1)
+ CLEANUP_FREE char *device = guestfs_mountable_device (g, fses[i]);
+ CLEANUP_FREE char *subvolume = NULL;
+
+ guestfs_push_error_handler (g, NULL, NULL);
+
+ subvolume = guestfs_mountable_subvolume (g, fses[i]);
+ if (subvolume == NULL && guestfs_last_errno (g) != EINVAL) {
+ fprintf (stderr,
+ _(&qu...
2016 Mar 01
6
[PATCH 0/3] btrfs subvolumes display fix
Hey there!
Here are a few patches to fix unrelated things: one fixes the configure for older
ncurses releases having no pkg-config files. The other two are fixing what Richard
mentioned about guestfs subvolumes display
Cédric Bosdonnat (3):
configure: handle older version of ncurses
api: add mountable_device and mountable_subvolume
fish: fix btrfs subvolumes display in error case
2016 Mar 08
7
[PATCH v2 0/3] btrfs subvolumes display fix
Hi all,
Here is version 2 of the patch series, including the changes for Pino's remarks.
Cédric Bosdonnat (3):
configure: handle older version of ncurses
api: add mountable_device and mountable_subvolume
fish: fix btrfs subvolumes display in error case
fish/options.c | 28 ++++++++++++++++++++++++++-
generator/actions.ml | 26 +++++++++++++++++++++++++
2016 Mar 08
5
[PATCH v3 0/3] btrfs subvolumes display fix
Hi there,
Latest and greatest version including all new remarks from both Pino and Rich.
Cédric Bosdonnat (3):
configure: handle older version of ncurses
api: add mountable_device and mountable_subvolume
fish: fix btrfs subvolumes display in error case
fish/options.c | 28 ++++++++++++++++++++++++++-
generator/actions.ml | 26 +++++++++++++++++++++++++
m4/guestfs_libraries.m4
2016 Mar 01
0
[PATCH 3/3] fish: fix btrfs subvolumes display in error case
...c
@@ -280,7 +280,20 @@ display_mountpoints_on_failure (const char *mp_device,
guestfs_int_program_name);
for (i = 0; fses[i] != NULL; i += 2) {
- CLEANUP_FREE char *p = guestfs_canonical_device_name (g, fses[i]);
+ CLEANUP_FREE char *p = NULL;
+ CLEANUP_FREE char *device = guestfs_mountable_device(g, fses[i]);
+ CLEANUP_FREE char *volume = guestfs_mountable_subvolume(g, fses[i]);
+
+ /* Reformat the internal btrfsvol string into a valid mount option */
+ if (device && volume && guestfs_last_errno (g) != EINVAL) {
+ if (asprintf (&p, "%s:/:subvol=%s"...
2016 Mar 08
0
[PATCH v2 3/3] fish: fix btrfs subvolumes display in error case
...c
@@ -280,7 +280,33 @@ display_mountpoints_on_failure (const char *mp_device,
guestfs_int_program_name);
for (i = 0; fses[i] != NULL; i += 2) {
- CLEANUP_FREE char *p = guestfs_canonical_device_name (g, fses[i]);
+ CLEANUP_FREE char *p = NULL;
+ CLEANUP_FREE char *device = guestfs_mountable_device(g, fses[i]);
+ CLEANUP_FREE char *subvolume = NULL;
+ int subvolume_errno;
+
+ guestfs_push_error_handler (g, NULL, NULL);
+
+ subvolume = guestfs_mountable_subvolume(g, fses[i]);
+ if (subvolume == NULL && guestfs_last_errno (g) != EINVAL) {
+ fprintf (stderr,
+...
2016 Jul 07
0
Re: list-filesystems and btrfs snapshots
On Thu, 2016-07-07 at 16:45 +0300, Maxim Perevedentsev wrote:
> Do I understand right that the right way of skipping btrfs subvolumes is
> guestfs_mountable_device(fs) != NULL && guestfs_mountable_subvolume(fs)
> != NULL.
Yes, that's the way to go.
--
Cedric
2016 Mar 01
2
Re: [PATCH 3/3] fish: fix btrfs subvolumes display in error case
..._mountpoints_on_failure (const char *mp_device,
> guestfs_int_program_name);
>
> for (i = 0; fses[i] != NULL; i += 2) {
> - CLEANUP_FREE char *p = guestfs_canonical_device_name (g, fses[i]);
> + CLEANUP_FREE char *p = NULL;
> + CLEANUP_FREE char *device = guestfs_mountable_device(g, fses[i]);
> + CLEANUP_FREE char *volume = guestfs_mountable_subvolume(g, fses[i]);
If guestfs_mountable_subvolume fails, then an error is issued to the
error handler set: you need to push a temporary null error handler to
avoid that:
CLEANUP_FREE char *subvolume = NULL;
int subvolume...
2016 Mar 01
0
[PATCH 2/3] api: add mountable_device and mountable_subvolume
...ume", [Mountable "mountable"], [];
+ shortdesc = "extract the subvolume part of a mountable";
+ longdesc = "\
+Returns the subvolume path of a mountable. Btrfs subvolumes
+mountables are a combination of both the device name and the
+subvolume path (see also C<guestfs_mountable_device> to extract
+the device of the mountable).
+
+If the mountable has no subvolume part, then the errno (see
+C<guestfs_last_errno>) is set to C<EINVAL>." };
+
+ { defaults with
name = "set_network"; added = (1, 5, 4);
style = RErr, [Bool "network"],...
2016 Mar 08
0
[PATCH v2 2/3] api: add mountable_device and mountable_subvolume
...ume", [Mountable "mountable"], [];
+ shortdesc = "extract the subvolume part of a mountable";
+ longdesc = "\
+Returns the subvolume path of a mountable. Btrfs subvolumes
+mountables are a combination of both the device name and the
+subvolume path (see also C<guestfs_mountable_device> to extract
+the device of the mountable).
+
+If the mountable does not represent a btrfs subvolume, then
+this function fails and the errno is set to EINVAL." };
+
+ { defaults with
name = "set_network"; added = (1, 5, 4);
style = RErr, [Bool "network"], [];...
2016 Mar 08
0
[PATCH v3 2/3] api: add mountable_device and mountable_subvolume
...ume", [Mountable "mountable"], [];
+ shortdesc = "extract the subvolume part of a mountable";
+ longdesc = "\
+Returns the subvolume path of a mountable. Btrfs subvolumes
+mountables are a combination of both the device name and the
+subvolume path (see also C<guestfs_mountable_device> to extract
+the device of the mountable).
+
+If the mountable does not represent a btrfs subvolume, then
+this function fails and the C<errno> is set to C<EINVAL>." };
+
+ { defaults with
name = "set_network"; added = (1, 5, 4);
style = RErr, [Bool "ne...
2017 Feb 18
8
[PATCH 0/6] generator: Split up generator/actions.ml
Split up the huge generator/actions.ml into several smaller files.
Rich.