mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
Rename pvs -> pvs-full (etc), so we can add simple pvs (etc) commands.
This commit is contained in:
@@ -29,6 +29,6 @@ extern char *do_ll (const char *directory);
|
||||
extern char **do_ls (const char *directory);
|
||||
extern char **do_list_devices ();
|
||||
extern char **do_list_partitions ();
|
||||
extern guestfs_lvm_int_pv_list *do_pvs ();
|
||||
extern guestfs_lvm_int_vg_list *do_vgs ();
|
||||
extern guestfs_lvm_int_lv_list *do_lvs ();
|
||||
extern guestfs_lvm_int_pv_list *do_pvs_full ();
|
||||
extern guestfs_lvm_int_vg_list *do_vgs_full ();
|
||||
extern guestfs_lvm_int_lv_list *do_lvs_full ();
|
||||
|
||||
@@ -32,19 +32,19 @@
|
||||
*/
|
||||
|
||||
guestfs_lvm_int_pv_list *
|
||||
do_pvs (void)
|
||||
do_pvs_full (void)
|
||||
{
|
||||
return parse_command_line_pvs ();
|
||||
}
|
||||
|
||||
guestfs_lvm_int_vg_list *
|
||||
do_vgs (void)
|
||||
do_vgs_full (void)
|
||||
{
|
||||
return parse_command_line_vgs ();
|
||||
}
|
||||
|
||||
guestfs_lvm_int_lv_list *
|
||||
do_lvs (void)
|
||||
do_lvs_full (void)
|
||||
{
|
||||
return parse_command_line_lvs ();
|
||||
}
|
||||
|
||||
@@ -199,49 +199,49 @@ static void list_partitions_stub (XDR *xdr_in)
|
||||
free_strings (r);
|
||||
}
|
||||
|
||||
static void pvs_stub (XDR *xdr_in)
|
||||
static void pvs_full_stub (XDR *xdr_in)
|
||||
{
|
||||
guestfs_lvm_int_pv_list *r;
|
||||
|
||||
r = do_pvs ();
|
||||
r = do_pvs_full ();
|
||||
if (r == NULL)
|
||||
/* do_pvs has already called reply_with_error, so just return */
|
||||
/* do_pvs_full has already called reply_with_error, so just return */
|
||||
return;
|
||||
|
||||
struct guestfs_pvs_ret ret;
|
||||
struct guestfs_pvs_full_ret ret;
|
||||
ret.physvols = *r;
|
||||
reply ((xdrproc_t) &xdr_guestfs_pvs_ret, (char *) &ret);
|
||||
xdr_free ((xdrproc_t) xdr_guestfs_pvs_ret, (char *) &ret);
|
||||
reply ((xdrproc_t) &xdr_guestfs_pvs_full_ret, (char *) &ret);
|
||||
xdr_free ((xdrproc_t) xdr_guestfs_pvs_full_ret, (char *) &ret);
|
||||
}
|
||||
|
||||
static void vgs_stub (XDR *xdr_in)
|
||||
static void vgs_full_stub (XDR *xdr_in)
|
||||
{
|
||||
guestfs_lvm_int_vg_list *r;
|
||||
|
||||
r = do_vgs ();
|
||||
r = do_vgs_full ();
|
||||
if (r == NULL)
|
||||
/* do_vgs has already called reply_with_error, so just return */
|
||||
/* do_vgs_full has already called reply_with_error, so just return */
|
||||
return;
|
||||
|
||||
struct guestfs_vgs_ret ret;
|
||||
struct guestfs_vgs_full_ret ret;
|
||||
ret.volgroups = *r;
|
||||
reply ((xdrproc_t) &xdr_guestfs_vgs_ret, (char *) &ret);
|
||||
xdr_free ((xdrproc_t) xdr_guestfs_vgs_ret, (char *) &ret);
|
||||
reply ((xdrproc_t) &xdr_guestfs_vgs_full_ret, (char *) &ret);
|
||||
xdr_free ((xdrproc_t) xdr_guestfs_vgs_full_ret, (char *) &ret);
|
||||
}
|
||||
|
||||
static void lvs_stub (XDR *xdr_in)
|
||||
static void lvs_full_stub (XDR *xdr_in)
|
||||
{
|
||||
guestfs_lvm_int_lv_list *r;
|
||||
|
||||
r = do_lvs ();
|
||||
r = do_lvs_full ();
|
||||
if (r == NULL)
|
||||
/* do_lvs has already called reply_with_error, so just return */
|
||||
/* do_lvs_full has already called reply_with_error, so just return */
|
||||
return;
|
||||
|
||||
struct guestfs_lvs_ret ret;
|
||||
struct guestfs_lvs_full_ret ret;
|
||||
ret.logvols = *r;
|
||||
reply ((xdrproc_t) &xdr_guestfs_lvs_ret, (char *) &ret);
|
||||
xdr_free ((xdrproc_t) xdr_guestfs_lvs_ret, (char *) &ret);
|
||||
reply ((xdrproc_t) &xdr_guestfs_lvs_full_ret, (char *) &ret);
|
||||
xdr_free ((xdrproc_t) xdr_guestfs_lvs_full_ret, (char *) &ret);
|
||||
}
|
||||
|
||||
void dispatch_incoming_message (XDR *xdr_in)
|
||||
@@ -271,14 +271,14 @@ void dispatch_incoming_message (XDR *xdr_in)
|
||||
case GUESTFS_PROC_LIST_PARTITIONS:
|
||||
list_partitions_stub (xdr_in);
|
||||
break;
|
||||
case GUESTFS_PROC_PVS:
|
||||
pvs_stub (xdr_in);
|
||||
case GUESTFS_PROC_PVS_FULL:
|
||||
pvs_full_stub (xdr_in);
|
||||
break;
|
||||
case GUESTFS_PROC_VGS:
|
||||
vgs_stub (xdr_in);
|
||||
case GUESTFS_PROC_VGS_FULL:
|
||||
vgs_full_stub (xdr_in);
|
||||
break;
|
||||
case GUESTFS_PROC_LVS:
|
||||
lvs_stub (xdr_in);
|
||||
case GUESTFS_PROC_LVS_FULL:
|
||||
lvs_full_stub (xdr_in);
|
||||
break;
|
||||
default:
|
||||
reply_with_error ("dispatch_incoming_message: unknown procedure number %d", proc_nr);
|
||||
|
||||
42
fish/cmds.c
42
fish/cmds.c
@@ -36,12 +36,12 @@ void list_commands (void)
|
||||
printf ("%-20s %s\n", "list-partitions", "list the partitions");
|
||||
printf ("%-20s %s\n", "ll", "list the files in a directory (long format)");
|
||||
printf ("%-20s %s\n", "ls", "list the files in a directory");
|
||||
printf ("%-20s %s\n", "lvs", "list the LVM logical volumes (LVs)");
|
||||
printf ("%-20s %s\n", "lvs-full", "list the LVM logical volumes (LVs)");
|
||||
printf ("%-20s %s\n", "mount", "mount a guest disk at a position in the filesystem");
|
||||
printf ("%-20s %s\n", "pvs", "list the LVM physical volumes (PVs)");
|
||||
printf ("%-20s %s\n", "pvs-full", "list the LVM physical volumes (PVs)");
|
||||
printf ("%-20s %s\n", "sync", "sync disks, writes are flushed through to the disk image");
|
||||
printf ("%-20s %s\n", "touch", "update file timestamps or create a new file");
|
||||
printf ("%-20s %s\n", "vgs", "list the LVM volume groups (VGs)");
|
||||
printf ("%-20s %s\n", "vgs-full", "list the LVM volume groups (VGs)");
|
||||
printf (" Use -h <cmd> / help <cmd> to show detailed help for a command.\n");
|
||||
}
|
||||
|
||||
@@ -71,14 +71,14 @@ void display_command (const char *cmd)
|
||||
if (strcasecmp (cmd, "list_partitions") == 0 || strcasecmp (cmd, "list-partitions") == 0)
|
||||
pod2text ("list-partitions - list the partitions", " list-partitions\n\nList all the partitions detected on all block devices.\n\nThe full partition device names are returned, eg. C</dev/sda1>\n\nThis does not return logical volumes. For that you will need to\ncall C<guestfs_lvs>.");
|
||||
else
|
||||
if (strcasecmp (cmd, "pvs") == 0)
|
||||
pod2text ("pvs - list the LVM physical volumes (PVs)", " pvs\n\nList all the physical volumes detected. This is the equivalent\nof the L<pvs(8)> command.");
|
||||
if (strcasecmp (cmd, "pvs_full") == 0 || strcasecmp (cmd, "pvs-full") == 0)
|
||||
pod2text ("pvs-full - list the LVM physical volumes (PVs)", " pvs-full\n\nList all the physical volumes detected. This is the equivalent\nof the L<pvs(8)> command.");
|
||||
else
|
||||
if (strcasecmp (cmd, "vgs") == 0)
|
||||
pod2text ("vgs - list the LVM volume groups (VGs)", " vgs\n\nList all the volumes groups detected. This is the equivalent\nof the L<vgs(8)> command.");
|
||||
if (strcasecmp (cmd, "vgs_full") == 0 || strcasecmp (cmd, "vgs-full") == 0)
|
||||
pod2text ("vgs-full - list the LVM volume groups (VGs)", " vgs-full\n\nList all the volumes groups detected. This is the equivalent\nof the L<vgs(8)> command.");
|
||||
else
|
||||
if (strcasecmp (cmd, "lvs") == 0)
|
||||
pod2text ("lvs - list the LVM logical volumes (LVs)", " lvs\n\nList all the logical volumes detected. This is the equivalent\nof the L<lvs(8)> command.");
|
||||
if (strcasecmp (cmd, "lvs_full") == 0 || strcasecmp (cmd, "lvs-full") == 0)
|
||||
pod2text ("lvs-full - list the LVM logical volumes (LVs)", " lvs-full\n\nList all the logical volumes detected. This is the equivalent\nof the L<lvs(8)> command.");
|
||||
else
|
||||
display_builtin_command (cmd);
|
||||
}
|
||||
@@ -308,7 +308,7 @@ static int run_list_partitions (const char *cmd, int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int run_pvs (const char *cmd, int argc, char *argv[])
|
||||
static int run_pvs_full (const char *cmd, int argc, char *argv[])
|
||||
{
|
||||
struct guestfs_lvm_pv_list *r;
|
||||
if (argc != 0) {
|
||||
@@ -316,14 +316,14 @@ static int run_pvs (const char *cmd, int argc, char *argv[])
|
||||
fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
|
||||
return -1;
|
||||
}
|
||||
r = guestfs_pvs (g);
|
||||
r = guestfs_pvs_full (g);
|
||||
if (r == NULL) return -1;
|
||||
print_pv_list (r);
|
||||
guestfs_free_lvm_pv_list (r);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int run_vgs (const char *cmd, int argc, char *argv[])
|
||||
static int run_vgs_full (const char *cmd, int argc, char *argv[])
|
||||
{
|
||||
struct guestfs_lvm_vg_list *r;
|
||||
if (argc != 0) {
|
||||
@@ -331,14 +331,14 @@ static int run_vgs (const char *cmd, int argc, char *argv[])
|
||||
fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
|
||||
return -1;
|
||||
}
|
||||
r = guestfs_vgs (g);
|
||||
r = guestfs_vgs_full (g);
|
||||
if (r == NULL) return -1;
|
||||
print_vg_list (r);
|
||||
guestfs_free_lvm_vg_list (r);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int run_lvs (const char *cmd, int argc, char *argv[])
|
||||
static int run_lvs_full (const char *cmd, int argc, char *argv[])
|
||||
{
|
||||
struct guestfs_lvm_lv_list *r;
|
||||
if (argc != 0) {
|
||||
@@ -346,7 +346,7 @@ static int run_lvs (const char *cmd, int argc, char *argv[])
|
||||
fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
|
||||
return -1;
|
||||
}
|
||||
r = guestfs_lvs (g);
|
||||
r = guestfs_lvs_full (g);
|
||||
if (r == NULL) return -1;
|
||||
print_lv_list (r);
|
||||
guestfs_free_lvm_lv_list (r);
|
||||
@@ -379,14 +379,14 @@ int run_action (const char *cmd, int argc, char *argv[])
|
||||
if (strcasecmp (cmd, "list_partitions") == 0 || strcasecmp (cmd, "list-partitions") == 0)
|
||||
return run_list_partitions (cmd, argc, argv);
|
||||
else
|
||||
if (strcasecmp (cmd, "pvs") == 0)
|
||||
return run_pvs (cmd, argc, argv);
|
||||
if (strcasecmp (cmd, "pvs_full") == 0 || strcasecmp (cmd, "pvs-full") == 0)
|
||||
return run_pvs_full (cmd, argc, argv);
|
||||
else
|
||||
if (strcasecmp (cmd, "vgs") == 0)
|
||||
return run_vgs (cmd, argc, argv);
|
||||
if (strcasecmp (cmd, "vgs_full") == 0 || strcasecmp (cmd, "vgs-full") == 0)
|
||||
return run_vgs_full (cmd, argc, argv);
|
||||
else
|
||||
if (strcasecmp (cmd, "lvs") == 0)
|
||||
return run_lvs (cmd, argc, argv);
|
||||
if (strcasecmp (cmd, "lvs_full") == 0 || strcasecmp (cmd, "lvs-full") == 0)
|
||||
return run_lvs_full (cmd, argc, argv);
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "%s: unknown command\n", cmd);
|
||||
|
||||
@@ -75,9 +75,9 @@ This function returns a NULL-terminated array of strings
|
||||
(like L<environ(3)>), or NULL if there was an error.
|
||||
I<The caller must free the strings and the array after use>.
|
||||
|
||||
=head2 guestfs_lvs
|
||||
=head2 guestfs_lvs_full
|
||||
|
||||
struct guestfs_lvm_lv_list *guestfs_lvs (guestfs_h *handle);
|
||||
struct guestfs_lvm_lv_list *guestfs_lvs_full (guestfs_h *handle);
|
||||
|
||||
List all the logical volumes detected. This is the equivalent
|
||||
of the L<lvs(8)> command.
|
||||
@@ -110,9 +110,9 @@ call, in order to improve reliability.
|
||||
|
||||
This function returns 0 on success or -1 on error.
|
||||
|
||||
=head2 guestfs_pvs
|
||||
=head2 guestfs_pvs_full
|
||||
|
||||
struct guestfs_lvm_pv_list *guestfs_pvs (guestfs_h *handle);
|
||||
struct guestfs_lvm_pv_list *guestfs_pvs_full (guestfs_h *handle);
|
||||
|
||||
List all the physical volumes detected. This is the equivalent
|
||||
of the L<pvs(8)> command.
|
||||
@@ -143,9 +143,9 @@ to create a new zero-length file.
|
||||
|
||||
This function returns 0 on success or -1 on error.
|
||||
|
||||
=head2 guestfs_vgs
|
||||
=head2 guestfs_vgs_full
|
||||
|
||||
struct guestfs_lvm_vg_list *guestfs_vgs (guestfs_h *handle);
|
||||
struct guestfs_lvm_vg_list *guestfs_vgs_full (guestfs_h *handle);
|
||||
|
||||
List all the volumes groups detected. This is the equivalent
|
||||
of the L<vgs(8)> command.
|
||||
|
||||
@@ -135,6 +135,7 @@ The full partition device names are returned, eg. C</dev/sda1>
|
||||
This does not return logical volumes. For that you will need to
|
||||
call C<guestfs_lvs>.");
|
||||
|
||||
(*
|
||||
("pvs", (RPVList "physvols", P0), 9, [],
|
||||
"list the LVM physical volumes (PVs)",
|
||||
"\
|
||||
@@ -152,6 +153,25 @@ of the L<vgs(8)> command.");
|
||||
"\
|
||||
List all the logical volumes detected. This is the equivalent
|
||||
of the L<lvs(8)> command.");
|
||||
*)
|
||||
|
||||
("pvs_full", (RPVList "physvols", P0), 12, [],
|
||||
"list the LVM physical volumes (PVs)",
|
||||
"\
|
||||
List all the physical volumes detected. This is the equivalent
|
||||
of the L<pvs(8)> command.");
|
||||
|
||||
("vgs_full", (RVGList "volgroups", P0), 13, [],
|
||||
"list the LVM volume groups (VGs)",
|
||||
"\
|
||||
List all the volumes groups detected. This is the equivalent
|
||||
of the L<vgs(8)> command.");
|
||||
|
||||
("lvs_full", (RLVList "logvols", P0), 14, [],
|
||||
"list the LVM logical volumes (LVs)",
|
||||
"\
|
||||
List all the logical volumes detected. This is the equivalent
|
||||
of the L<lvs(8)> command.");
|
||||
]
|
||||
|
||||
(* Column names and types from LVM PVs/VGs/LVs. *)
|
||||
|
||||
@@ -595,30 +595,30 @@ char **guestfs_list_partitions (guestfs_h *g)
|
||||
return rv.ret.partitions.partitions_val;
|
||||
}
|
||||
|
||||
struct pvs_rv {
|
||||
struct pvs_full_rv {
|
||||
int cb_done; /* flag to indicate callback was called */
|
||||
struct guestfs_message_header hdr;
|
||||
struct guestfs_message_error err;
|
||||
struct guestfs_pvs_ret ret;
|
||||
struct guestfs_pvs_full_ret ret;
|
||||
};
|
||||
|
||||
static void pvs_cb (guestfs_h *g, void *data, XDR *xdr)
|
||||
static void pvs_full_cb (guestfs_h *g, void *data, XDR *xdr)
|
||||
{
|
||||
struct pvs_rv *rv = (struct pvs_rv *) data;
|
||||
struct pvs_full_rv *rv = (struct pvs_full_rv *) data;
|
||||
|
||||
if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
|
||||
error (g, "guestfs_pvs: failed to parse reply header");
|
||||
error (g, "guestfs_pvs_full: failed to parse reply header");
|
||||
return;
|
||||
}
|
||||
if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
|
||||
if (!xdr_guestfs_message_error (xdr, &rv->err)) {
|
||||
error (g, "guestfs_pvs: failed to parse reply error");
|
||||
error (g, "guestfs_pvs_full: failed to parse reply error");
|
||||
return;
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
if (!xdr_guestfs_pvs_ret (xdr, &rv->ret)) {
|
||||
error (g, "guestfs_pvs: failed to parse reply");
|
||||
if (!xdr_guestfs_pvs_full_ret (xdr, &rv->ret)) {
|
||||
error (g, "guestfs_pvs_full: failed to parse reply");
|
||||
return;
|
||||
}
|
||||
done:
|
||||
@@ -626,35 +626,35 @@ static void pvs_cb (guestfs_h *g, void *data, XDR *xdr)
|
||||
main_loop.main_loop_quit (g);
|
||||
}
|
||||
|
||||
struct guestfs_lvm_pv_list *guestfs_pvs (guestfs_h *g)
|
||||
struct guestfs_lvm_pv_list *guestfs_pvs_full (guestfs_h *g)
|
||||
{
|
||||
struct pvs_rv rv;
|
||||
struct pvs_full_rv rv;
|
||||
int serial;
|
||||
|
||||
if (g->state != READY) {
|
||||
error (g, "guestfs_pvs called from the wrong state, %d != READY",
|
||||
error (g, "guestfs_pvs_full called from the wrong state, %d != READY",
|
||||
g->state);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset (&rv, 0, sizeof rv);
|
||||
|
||||
serial = dispatch (g, GUESTFS_PROC_PVS, NULL, NULL);
|
||||
serial = dispatch (g, GUESTFS_PROC_PVS_FULL, NULL, NULL);
|
||||
if (serial == -1)
|
||||
return NULL;
|
||||
|
||||
rv.cb_done = 0;
|
||||
g->reply_cb_internal = pvs_cb;
|
||||
g->reply_cb_internal = pvs_full_cb;
|
||||
g->reply_cb_internal_data = &rv;
|
||||
main_loop.main_loop_run (g);
|
||||
g->reply_cb_internal = NULL;
|
||||
g->reply_cb_internal_data = NULL;
|
||||
if (!rv.cb_done) {
|
||||
error (g, "guestfs_pvs failed, see earlier error messages");
|
||||
error (g, "guestfs_pvs_full failed, see earlier error messages");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_PVS, serial) == -1)
|
||||
if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_PVS_FULL, serial) == -1)
|
||||
return NULL;
|
||||
|
||||
if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
|
||||
@@ -666,30 +666,30 @@ struct guestfs_lvm_pv_list *guestfs_pvs (guestfs_h *g)
|
||||
return safe_memdup (g, &rv.ret.physvols, sizeof (rv.ret.physvols));
|
||||
}
|
||||
|
||||
struct vgs_rv {
|
||||
struct vgs_full_rv {
|
||||
int cb_done; /* flag to indicate callback was called */
|
||||
struct guestfs_message_header hdr;
|
||||
struct guestfs_message_error err;
|
||||
struct guestfs_vgs_ret ret;
|
||||
struct guestfs_vgs_full_ret ret;
|
||||
};
|
||||
|
||||
static void vgs_cb (guestfs_h *g, void *data, XDR *xdr)
|
||||
static void vgs_full_cb (guestfs_h *g, void *data, XDR *xdr)
|
||||
{
|
||||
struct vgs_rv *rv = (struct vgs_rv *) data;
|
||||
struct vgs_full_rv *rv = (struct vgs_full_rv *) data;
|
||||
|
||||
if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
|
||||
error (g, "guestfs_vgs: failed to parse reply header");
|
||||
error (g, "guestfs_vgs_full: failed to parse reply header");
|
||||
return;
|
||||
}
|
||||
if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
|
||||
if (!xdr_guestfs_message_error (xdr, &rv->err)) {
|
||||
error (g, "guestfs_vgs: failed to parse reply error");
|
||||
error (g, "guestfs_vgs_full: failed to parse reply error");
|
||||
return;
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
if (!xdr_guestfs_vgs_ret (xdr, &rv->ret)) {
|
||||
error (g, "guestfs_vgs: failed to parse reply");
|
||||
if (!xdr_guestfs_vgs_full_ret (xdr, &rv->ret)) {
|
||||
error (g, "guestfs_vgs_full: failed to parse reply");
|
||||
return;
|
||||
}
|
||||
done:
|
||||
@@ -697,35 +697,35 @@ static void vgs_cb (guestfs_h *g, void *data, XDR *xdr)
|
||||
main_loop.main_loop_quit (g);
|
||||
}
|
||||
|
||||
struct guestfs_lvm_vg_list *guestfs_vgs (guestfs_h *g)
|
||||
struct guestfs_lvm_vg_list *guestfs_vgs_full (guestfs_h *g)
|
||||
{
|
||||
struct vgs_rv rv;
|
||||
struct vgs_full_rv rv;
|
||||
int serial;
|
||||
|
||||
if (g->state != READY) {
|
||||
error (g, "guestfs_vgs called from the wrong state, %d != READY",
|
||||
error (g, "guestfs_vgs_full called from the wrong state, %d != READY",
|
||||
g->state);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset (&rv, 0, sizeof rv);
|
||||
|
||||
serial = dispatch (g, GUESTFS_PROC_VGS, NULL, NULL);
|
||||
serial = dispatch (g, GUESTFS_PROC_VGS_FULL, NULL, NULL);
|
||||
if (serial == -1)
|
||||
return NULL;
|
||||
|
||||
rv.cb_done = 0;
|
||||
g->reply_cb_internal = vgs_cb;
|
||||
g->reply_cb_internal = vgs_full_cb;
|
||||
g->reply_cb_internal_data = &rv;
|
||||
main_loop.main_loop_run (g);
|
||||
g->reply_cb_internal = NULL;
|
||||
g->reply_cb_internal_data = NULL;
|
||||
if (!rv.cb_done) {
|
||||
error (g, "guestfs_vgs failed, see earlier error messages");
|
||||
error (g, "guestfs_vgs_full failed, see earlier error messages");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_VGS, serial) == -1)
|
||||
if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_VGS_FULL, serial) == -1)
|
||||
return NULL;
|
||||
|
||||
if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
|
||||
@@ -737,30 +737,30 @@ struct guestfs_lvm_vg_list *guestfs_vgs (guestfs_h *g)
|
||||
return safe_memdup (g, &rv.ret.volgroups, sizeof (rv.ret.volgroups));
|
||||
}
|
||||
|
||||
struct lvs_rv {
|
||||
struct lvs_full_rv {
|
||||
int cb_done; /* flag to indicate callback was called */
|
||||
struct guestfs_message_header hdr;
|
||||
struct guestfs_message_error err;
|
||||
struct guestfs_lvs_ret ret;
|
||||
struct guestfs_lvs_full_ret ret;
|
||||
};
|
||||
|
||||
static void lvs_cb (guestfs_h *g, void *data, XDR *xdr)
|
||||
static void lvs_full_cb (guestfs_h *g, void *data, XDR *xdr)
|
||||
{
|
||||
struct lvs_rv *rv = (struct lvs_rv *) data;
|
||||
struct lvs_full_rv *rv = (struct lvs_full_rv *) data;
|
||||
|
||||
if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
|
||||
error (g, "guestfs_lvs: failed to parse reply header");
|
||||
error (g, "guestfs_lvs_full: failed to parse reply header");
|
||||
return;
|
||||
}
|
||||
if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
|
||||
if (!xdr_guestfs_message_error (xdr, &rv->err)) {
|
||||
error (g, "guestfs_lvs: failed to parse reply error");
|
||||
error (g, "guestfs_lvs_full: failed to parse reply error");
|
||||
return;
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
if (!xdr_guestfs_lvs_ret (xdr, &rv->ret)) {
|
||||
error (g, "guestfs_lvs: failed to parse reply");
|
||||
if (!xdr_guestfs_lvs_full_ret (xdr, &rv->ret)) {
|
||||
error (g, "guestfs_lvs_full: failed to parse reply");
|
||||
return;
|
||||
}
|
||||
done:
|
||||
@@ -768,35 +768,35 @@ static void lvs_cb (guestfs_h *g, void *data, XDR *xdr)
|
||||
main_loop.main_loop_quit (g);
|
||||
}
|
||||
|
||||
struct guestfs_lvm_lv_list *guestfs_lvs (guestfs_h *g)
|
||||
struct guestfs_lvm_lv_list *guestfs_lvs_full (guestfs_h *g)
|
||||
{
|
||||
struct lvs_rv rv;
|
||||
struct lvs_full_rv rv;
|
||||
int serial;
|
||||
|
||||
if (g->state != READY) {
|
||||
error (g, "guestfs_lvs called from the wrong state, %d != READY",
|
||||
error (g, "guestfs_lvs_full called from the wrong state, %d != READY",
|
||||
g->state);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset (&rv, 0, sizeof rv);
|
||||
|
||||
serial = dispatch (g, GUESTFS_PROC_LVS, NULL, NULL);
|
||||
serial = dispatch (g, GUESTFS_PROC_LVS_FULL, NULL, NULL);
|
||||
if (serial == -1)
|
||||
return NULL;
|
||||
|
||||
rv.cb_done = 0;
|
||||
g->reply_cb_internal = lvs_cb;
|
||||
g->reply_cb_internal = lvs_full_cb;
|
||||
g->reply_cb_internal_data = &rv;
|
||||
main_loop.main_loop_run (g);
|
||||
g->reply_cb_internal = NULL;
|
||||
g->reply_cb_internal_data = NULL;
|
||||
if (!rv.cb_done) {
|
||||
error (g, "guestfs_lvs failed, see earlier error messages");
|
||||
error (g, "guestfs_lvs_full failed, see earlier error messages");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_LVS, serial) == -1)
|
||||
if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_LVS_FULL, serial) == -1)
|
||||
return NULL;
|
||||
|
||||
if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
|
||||
|
||||
@@ -27,6 +27,6 @@ extern char *guestfs_ll (guestfs_h *handle, const char *directory);
|
||||
extern char **guestfs_ls (guestfs_h *handle, const char *directory);
|
||||
extern char **guestfs_list_devices (guestfs_h *handle);
|
||||
extern char **guestfs_list_partitions (guestfs_h *handle);
|
||||
extern struct guestfs_lvm_pv_list *guestfs_pvs (guestfs_h *handle);
|
||||
extern struct guestfs_lvm_vg_list *guestfs_vgs (guestfs_h *handle);
|
||||
extern struct guestfs_lvm_lv_list *guestfs_lvs (guestfs_h *handle);
|
||||
extern struct guestfs_lvm_pv_list *guestfs_pvs_full (guestfs_h *handle);
|
||||
extern struct guestfs_lvm_vg_list *guestfs_vgs_full (guestfs_h *handle);
|
||||
extern struct guestfs_lvm_lv_list *guestfs_lvs_full (guestfs_h *handle);
|
||||
|
||||
@@ -279,7 +279,7 @@ xdr_guestfs_list_partitions_ret (XDR *xdrs, guestfs_list_partitions_ret *objp)
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_guestfs_pvs_ret (XDR *xdrs, guestfs_pvs_ret *objp)
|
||||
xdr_guestfs_pvs_full_ret (XDR *xdrs, guestfs_pvs_full_ret *objp)
|
||||
{
|
||||
register int32_t *buf;
|
||||
|
||||
@@ -289,7 +289,7 @@ xdr_guestfs_pvs_ret (XDR *xdrs, guestfs_pvs_ret *objp)
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_guestfs_vgs_ret (XDR *xdrs, guestfs_vgs_ret *objp)
|
||||
xdr_guestfs_vgs_full_ret (XDR *xdrs, guestfs_vgs_full_ret *objp)
|
||||
{
|
||||
register int32_t *buf;
|
||||
|
||||
@@ -299,7 +299,7 @@ xdr_guestfs_vgs_ret (XDR *xdrs, guestfs_vgs_ret *objp)
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_guestfs_lvs_ret (XDR *xdrs, guestfs_lvs_ret *objp)
|
||||
xdr_guestfs_lvs_full_ret (XDR *xdrs, guestfs_lvs_full_ret *objp)
|
||||
{
|
||||
register int32_t *buf;
|
||||
|
||||
|
||||
@@ -152,20 +152,20 @@ struct guestfs_list_partitions_ret {
|
||||
};
|
||||
typedef struct guestfs_list_partitions_ret guestfs_list_partitions_ret;
|
||||
|
||||
struct guestfs_pvs_ret {
|
||||
struct guestfs_pvs_full_ret {
|
||||
guestfs_lvm_int_pv_list physvols;
|
||||
};
|
||||
typedef struct guestfs_pvs_ret guestfs_pvs_ret;
|
||||
typedef struct guestfs_pvs_full_ret guestfs_pvs_full_ret;
|
||||
|
||||
struct guestfs_vgs_ret {
|
||||
struct guestfs_vgs_full_ret {
|
||||
guestfs_lvm_int_vg_list volgroups;
|
||||
};
|
||||
typedef struct guestfs_vgs_ret guestfs_vgs_ret;
|
||||
typedef struct guestfs_vgs_full_ret guestfs_vgs_full_ret;
|
||||
|
||||
struct guestfs_lvs_ret {
|
||||
struct guestfs_lvs_full_ret {
|
||||
guestfs_lvm_int_lv_list logvols;
|
||||
};
|
||||
typedef struct guestfs_lvs_ret guestfs_lvs_ret;
|
||||
typedef struct guestfs_lvs_full_ret guestfs_lvs_full_ret;
|
||||
|
||||
enum guestfs_procedure {
|
||||
GUESTFS_PROC_MOUNT = 1,
|
||||
@@ -176,10 +176,10 @@ enum guestfs_procedure {
|
||||
GUESTFS_PROC_LS = 6,
|
||||
GUESTFS_PROC_LIST_DEVICES = 7,
|
||||
GUESTFS_PROC_LIST_PARTITIONS = 8,
|
||||
GUESTFS_PROC_PVS = 9,
|
||||
GUESTFS_PROC_VGS = 10,
|
||||
GUESTFS_PROC_LVS = 11,
|
||||
GUESTFS_PROC_dummy = 11 + 1,
|
||||
GUESTFS_PROC_PVS_FULL = 12,
|
||||
GUESTFS_PROC_VGS_FULL = 13,
|
||||
GUESTFS_PROC_LVS_FULL = 14,
|
||||
GUESTFS_PROC_dummy = 14 + 1,
|
||||
};
|
||||
typedef enum guestfs_procedure guestfs_procedure;
|
||||
#define GUESTFS_MESSAGE_MAX 4194304
|
||||
@@ -234,9 +234,9 @@ extern bool_t xdr_guestfs_ls_args (XDR *, guestfs_ls_args*);
|
||||
extern bool_t xdr_guestfs_ls_ret (XDR *, guestfs_ls_ret*);
|
||||
extern bool_t xdr_guestfs_list_devices_ret (XDR *, guestfs_list_devices_ret*);
|
||||
extern bool_t xdr_guestfs_list_partitions_ret (XDR *, guestfs_list_partitions_ret*);
|
||||
extern bool_t xdr_guestfs_pvs_ret (XDR *, guestfs_pvs_ret*);
|
||||
extern bool_t xdr_guestfs_vgs_ret (XDR *, guestfs_vgs_ret*);
|
||||
extern bool_t xdr_guestfs_lvs_ret (XDR *, guestfs_lvs_ret*);
|
||||
extern bool_t xdr_guestfs_pvs_full_ret (XDR *, guestfs_pvs_full_ret*);
|
||||
extern bool_t xdr_guestfs_vgs_full_ret (XDR *, guestfs_vgs_full_ret*);
|
||||
extern bool_t xdr_guestfs_lvs_full_ret (XDR *, guestfs_lvs_full_ret*);
|
||||
extern bool_t xdr_guestfs_procedure (XDR *, guestfs_procedure*);
|
||||
extern bool_t xdr_guestfs_message_direction (XDR *, guestfs_message_direction*);
|
||||
extern bool_t xdr_guestfs_message_status (XDR *, guestfs_message_status*);
|
||||
@@ -261,9 +261,9 @@ extern bool_t xdr_guestfs_ls_args ();
|
||||
extern bool_t xdr_guestfs_ls_ret ();
|
||||
extern bool_t xdr_guestfs_list_devices_ret ();
|
||||
extern bool_t xdr_guestfs_list_partitions_ret ();
|
||||
extern bool_t xdr_guestfs_pvs_ret ();
|
||||
extern bool_t xdr_guestfs_vgs_ret ();
|
||||
extern bool_t xdr_guestfs_lvs_ret ();
|
||||
extern bool_t xdr_guestfs_pvs_full_ret ();
|
||||
extern bool_t xdr_guestfs_vgs_full_ret ();
|
||||
extern bool_t xdr_guestfs_lvs_full_ret ();
|
||||
extern bool_t xdr_guestfs_procedure ();
|
||||
extern bool_t xdr_guestfs_message_direction ();
|
||||
extern bool_t xdr_guestfs_message_status ();
|
||||
|
||||
@@ -142,21 +142,21 @@ struct guestfs_list_partitions_ret {
|
||||
str partitions<>;
|
||||
};
|
||||
|
||||
/* guestfs_pvs */
|
||||
/* guestfs_pvs_full */
|
||||
|
||||
struct guestfs_pvs_ret {
|
||||
struct guestfs_pvs_full_ret {
|
||||
guestfs_lvm_int_pv_list physvols;
|
||||
};
|
||||
|
||||
/* guestfs_vgs */
|
||||
/* guestfs_vgs_full */
|
||||
|
||||
struct guestfs_vgs_ret {
|
||||
struct guestfs_vgs_full_ret {
|
||||
guestfs_lvm_int_vg_list volgroups;
|
||||
};
|
||||
|
||||
/* guestfs_lvs */
|
||||
/* guestfs_lvs_full */
|
||||
|
||||
struct guestfs_lvs_ret {
|
||||
struct guestfs_lvs_full_ret {
|
||||
guestfs_lvm_int_lv_list logvols;
|
||||
};
|
||||
|
||||
@@ -169,9 +169,9 @@ enum guestfs_procedure {
|
||||
GUESTFS_PROC_LS = 6,
|
||||
GUESTFS_PROC_LIST_DEVICES = 7,
|
||||
GUESTFS_PROC_LIST_PARTITIONS = 8,
|
||||
GUESTFS_PROC_PVS = 9,
|
||||
GUESTFS_PROC_VGS = 10,
|
||||
GUESTFS_PROC_LVS = 11,
|
||||
GUESTFS_PROC_PVS_FULL = 12,
|
||||
GUESTFS_PROC_VGS_FULL = 13,
|
||||
GUESTFS_PROC_LVS_FULL = 14,
|
||||
GUESTFS_PROC_dummy
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user