Signed-off-by: Chen Hanxiao <chenhanx...@cn.fujitsu.com>
---
 daemon/daemon.h |  1 +
 daemon/labels.c | 22 +---------------------
 daemon/ntfs.c   | 19 +++++++++++++++++++
 3 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/daemon/daemon.h b/daemon/daemon.h
index 0731b09..7a4b97f 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -282,6 +282,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);
diff --git a/daemon/labels.c b/daemon/labels.c
index 1fadba4..d3e3f55 100644
--- a/daemon/labels.c
+++ b/daemon/labels.c
@@ -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
@@ -47,25 +46,6 @@ dosfslabel (const char *device, const char *label)
 }
 
 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)
 {
   int r;
@@ -116,7 +96,7 @@ do_set_label (const mountable_t *mountable, const char 
*label)
     r = ext_set_label (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);
diff --git a/daemon/ntfs.c b/daemon/ntfs.c
index 0f63391..1ead159 100644
--- a/daemon/ntfs.c
+++ b/daemon/ntfs.c
@@ -71,6 +71,25 @@ ntfs_get_label (const char *device)
 }
 
 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)
 {
   CLEANUP_FREE char *err = NULL;
-- 
2.1.0

_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs

Reply via email to