mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
labels: use existing do_xfs_admin for xfslabel
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
This commit is contained in:
committed by
Pino Toscano
parent
5c6be8846f
commit
d9b53a2752
@@ -267,6 +267,7 @@ extern int copy_xattrs (const char *src, const char *dest);
|
||||
#define XFS_LABEL_MAX 12
|
||||
extern int xfs_set_uuid (const char *device, const char *uuid);
|
||||
extern int xfs_set_uuid_random (const char *device);
|
||||
extern int xfs_set_label (const char *device, const char *label);
|
||||
|
||||
/*-- debug-bmap.c --*/
|
||||
extern char *debug_bmap (const char *subcmd, size_t argc, char *const *const argv);
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "optgroups.h"
|
||||
|
||||
GUESTFSD_EXT_CMD(str_dosfslabel, dosfslabel);
|
||||
GUESTFSD_EXT_CMD(str_xfs_admin, xfs_admin);
|
||||
|
||||
static int
|
||||
dosfslabel (const char *device, const char *label)
|
||||
@@ -48,9 +47,6 @@ dosfslabel (const char *device, const char *label)
|
||||
static int
|
||||
xfslabel (const char *device, const char *label)
|
||||
{
|
||||
int r;
|
||||
CLEANUP_FREE char *err = NULL;
|
||||
|
||||
/* Don't allow the special value "---". If people want to clear
|
||||
* the label we'll have to add another call to do that.
|
||||
*/
|
||||
@@ -59,19 +55,7 @@ xfslabel (const char *device, const char *label)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strlen (label) > XFS_LABEL_MAX) {
|
||||
reply_with_error ("%s: xfs labels are limited to %d bytes",
|
||||
label, XFS_LABEL_MAX);
|
||||
return -1;
|
||||
}
|
||||
|
||||
r = command (NULL, &err, str_xfs_admin, "-L", label, device, NULL);
|
||||
if (r == -1) {
|
||||
reply_with_error ("%s", err);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return xfs_set_label (device, label);
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -469,6 +469,13 @@ xfs_set_uuid_random (const char *device)
|
||||
return do_xfs_admin (device, 0, 0, 0, 0, 0, NULL, "generate");
|
||||
}
|
||||
|
||||
int
|
||||
xfs_set_label (const char *device, const char *label)
|
||||
{
|
||||
optargs_bitmask = GUESTFS_XFS_ADMIN_LABEL_BITMASK;
|
||||
return do_xfs_admin (device, 0, 0, 0, 0, 0, label, NULL);
|
||||
}
|
||||
|
||||
int
|
||||
do_xfs_admin (const char *device,
|
||||
int extunwritten, int imgfile, int v2log,
|
||||
|
||||
Reference in New Issue
Block a user