[Libguestfs] [PATCH V2 2/2] xfs_growfs: drop the unstructed output

Wanlong Gao gaowanlong at cn.fujitsu.com
Mon Aug 20 08:17:01 UTC 2012


Just drop the unstructed output since we can get the structed info
from xfs_info instead.

Signed-off-by: Wanlong Gao <gaowanlong at cn.fujitsu.com>
---
 daemon/xfs.c                   | 13 ++++++-------
 generator/generator_actions.ml |  2 +-
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/daemon/xfs.c b/daemon/xfs.c
index df01917..12ed600 100644
--- a/daemon/xfs.c
+++ b/daemon/xfs.c
@@ -351,7 +351,7 @@ error:
   return ret;
 }
 
-char *
+int
 do_xfs_growfs (const char *path,
                int datasec, int logsec, int rtsec,
                int64_t datasize, int64_t logsize, int64_t rtsize,
@@ -359,7 +359,7 @@ do_xfs_growfs (const char *path,
 {
   int r;
   char *buf;
-  char *out = NULL, *err = NULL;
+  char *err = NULL;
   const char *argv[MAX_ARGS];
   char datasize_s[64];
   char logsize_s[64];
@@ -371,7 +371,7 @@ do_xfs_growfs (const char *path,
   buf = sysroot_path (path);
   if (buf == NULL) {
     reply_with_perror ("malloc");
-    return NULL;
+    return -1;
   }
 
   ADD_ARG (argv, i, "xfs_growfs");
@@ -444,7 +444,7 @@ do_xfs_growfs (const char *path,
   ADD_ARG (argv, i, buf);
   ADD_ARG (argv, i, NULL);
 
-  r = commandv (&out, &err, argv);
+  r = commandv (NULL, &err, argv);
   free (buf);
   if (r == -1) {
     reply_with_error ("%s: %s", path, err);
@@ -452,13 +452,12 @@ do_xfs_growfs (const char *path,
   }
 
   free (err);
-  return out;
+  return 0;
 
 error:
   if (buf) free (buf);
   if (err) free (err);
-  if (out) free (out);
-  return NULL;
+  return -1;
 }
 
 int
diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml
index ebda464..562f785 100644
--- a/generator/generator_actions.ml
+++ b/generator/generator_actions.ml
@@ -9299,7 +9299,7 @@ in the returned structure is defined by the API." };
 
   { defaults with
     name = "xfs_growfs";
-    style = RString "info", [Pathname "path"], [OBool "datasec"; OBool "logsec"; OBool "rtsec"; OInt64 "datasize"; OInt64 "logsize"; OInt64 "rtsize"; OInt64 "rtextsize"; OInt "maxpct"];
+    style = RErr, [Pathname "path"], [OBool "datasec"; OBool "logsec"; OBool "rtsec"; OInt64 "datasize"; OInt64 "logsize"; OInt64 "rtsize"; OInt64 "rtextsize"; OInt "maxpct"];
     proc_nr = Some 343;
     optional = Some "xfs";
     tests = [
-- 
1.7.12




More information about the Libguestfs mailing list