New API: mdadm-create for creating MD devices.
[libguestfs.git] / daemon / btrfs.c
index 619ab50..a20ee08 100644 (file)
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <config.h>
@@ -28,6 +28,8 @@
 #include "actions.h"
 #include "optgroups.h"
 
+#define MAX_ARGS 64
+
 int
 optgroup_btrfs_available (void)
 {
@@ -41,13 +43,13 @@ do_btrfs_filesystem_resize (const char *filesystem, int64_t size)
   char *buf;
   char *err;
   int r;
-  const char *argv[16];
+  const char *argv[MAX_ARGS];
   size_t i = 0;
   char size_str[32];
 
-  argv[i++] = "btrfs";
-  argv[i++] = "filesystem";
-  argv[i++] = "resize";
+  ADD_ARG (argv, i, "btrfs");
+  ADD_ARG (argv, i, "filesystem");
+  ADD_ARG (argv, i, "resize");
 
   if (optargs_bitmask & GUESTFS_BTRFS_FILESYSTEM_RESIZE_SIZE_BITMASK) {
     if (size <= 0) {
@@ -56,10 +58,10 @@ do_btrfs_filesystem_resize (const char *filesystem, int64_t size)
     }
 
     snprintf (size_str, sizeof size_str, "%" PRIi64, size);
-    argv[i++] = size_str;
+    ADD_ARG (argv, i, size_str);
   }
   else
-    argv[i++] = "max";
+    ADD_ARG (argv, i, "max");
 
   buf = sysroot_path (filesystem);
   if (!buf) {
@@ -67,8 +69,8 @@ do_btrfs_filesystem_resize (const char *filesystem, int64_t size)
     return -1;
   }
 
-  argv[i++] = buf;
-  argv[i++] = NULL;
+  ADD_ARG (argv, i, buf);
+  ADD_ARG (argv, i, NULL);
 
   r = commandv (NULL, &err, argv);
   free (buf);