mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
labels: move ntfslabel to ntfs.c
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
This commit is contained in:
committed by
Pino Toscano
parent
d5a60f2148
commit
5c6be8846f
@@ -281,6 +281,7 @@ extern int btrfs_set_uuid_random (const char *device);
|
||||
|
||||
/*-- in ntfs.c --*/
|
||||
extern char *ntfs_get_label (const char *device);
|
||||
extern int ntfs_set_label (const char *device, const char *label);
|
||||
|
||||
/*-- in swap.c --*/
|
||||
extern int swap_set_uuid (const char *device, const char *uuid);
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "optgroups.h"
|
||||
|
||||
GUESTFSD_EXT_CMD(str_dosfslabel, dosfslabel);
|
||||
GUESTFSD_EXT_CMD(str_ntfslabel, ntfslabel);
|
||||
GUESTFSD_EXT_CMD(str_xfs_admin, xfs_admin);
|
||||
|
||||
static int
|
||||
@@ -46,25 +45,6 @@ dosfslabel (const char *device, const char *label)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
ntfslabel (const char *device, const char *label)
|
||||
{
|
||||
int r;
|
||||
CLEANUP_FREE char *err = NULL;
|
||||
|
||||
/* XXX We should check if the label is longer than 128 unicode
|
||||
* characters and return an error. This is not so easy since we
|
||||
* don't have the required libraries.
|
||||
*/
|
||||
r = command (NULL, &err, str_ntfslabel, device, label, NULL);
|
||||
if (r == -1) {
|
||||
reply_with_error ("%s", err);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
xfslabel (const char *device, const char *label)
|
||||
{
|
||||
@@ -116,7 +96,7 @@ do_set_label (const mountable_t *mountable, const char *label)
|
||||
r = do_set_e2label (mountable->device, label);
|
||||
|
||||
else if (STREQ (vfs_type, "ntfs"))
|
||||
r = ntfslabel (mountable->device, label);
|
||||
r = ntfs_set_label (mountable->device, label);
|
||||
|
||||
else if (STREQ (vfs_type, "xfs"))
|
||||
r = xfslabel (mountable->device, label);
|
||||
|
||||
@@ -70,6 +70,25 @@ ntfs_get_label (const char *device)
|
||||
return out;
|
||||
}
|
||||
|
||||
int
|
||||
ntfs_set_label (const char *device, const char *label)
|
||||
{
|
||||
int r;
|
||||
CLEANUP_FREE char *err = NULL;
|
||||
|
||||
/* XXX We should check if the label is longer than 128 unicode
|
||||
* characters and return an error. This is not so easy since we
|
||||
* don't have the required libraries.
|
||||
*/
|
||||
r = command (NULL, &err, str_ntfslabel, device, label, NULL);
|
||||
if (r == -1) {
|
||||
reply_with_error ("%s", err);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
do_ntfs_3g_probe (int rw, const char *device)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user