Generated code for head/tail commands.
[libguestfs.git] / perl / Guestfs.xs
index 0f90aff..bcd7304 100644 (file)
@@ -724,6 +724,17 @@ PREINIT:
         croak ("add_cdrom: %s", guestfs_last_error (g));
 
 void
+add_drive_ro (g, filename)
+      guestfs_h *g;
+      char *filename;
+PREINIT:
+      int r;
+ PPCODE:
+      r = guestfs_add_drive_ro (g, filename);
+      if (r == -1)
+        croak ("add_drive_ro: %s", guestfs_last_error (g));
+
+void
 config (g, qemuparam, qemuvalue)
       guestfs_h *g;
       char *qemuparam;
@@ -2375,10 +2386,10 @@ PREINIT:
         croak ("pvresize: %s", guestfs_last_error (g));
 
 void
-sfdisk_N (g, device, n, cyls, heads, sectors, line)
+sfdisk_N (g, device, partnum, cyls, heads, sectors, line)
       guestfs_h *g;
       char *device;
-      int n;
+      int partnum;
       int cyls;
       int heads;
       int sectors;
@@ -2386,7 +2397,7 @@ sfdisk_N (g, device, n, cyls, heads, sectors, line)
 PREINIT:
       int r;
  PPCODE:
-      r = guestfs_sfdisk_N (g, device, n, cyls, heads, sectors, line);
+      r = guestfs_sfdisk_N (g, device, partnum, cyls, heads, sectors, line);
       if (r == -1)
         croak ("sfdisk_N: %s", guestfs_last_error (g));
 
@@ -2512,3 +2523,250 @@ PREINIT:
       if (r == -1)
         croak ("e2fsck_f: %s", guestfs_last_error (g));
 
+void
+sleep (g, secs)
+      guestfs_h *g;
+      int secs;
+PREINIT:
+      int r;
+ PPCODE:
+      r = guestfs_sleep (g, secs);
+      if (r == -1)
+        croak ("sleep: %s", guestfs_last_error (g));
+
+SV *
+ntfs_3g_probe (g, rw, device)
+      guestfs_h *g;
+      int rw;
+      char *device;
+PREINIT:
+      int status;
+   CODE:
+      status = guestfs_ntfs_3g_probe (g, rw, device);
+      if (status == -1)
+        croak ("ntfs_3g_probe: %s", guestfs_last_error (g));
+      RETVAL = newSViv (status);
+ OUTPUT:
+      RETVAL
+
+SV *
+sh (g, command)
+      guestfs_h *g;
+      char *command;
+PREINIT:
+      char *output;
+   CODE:
+      output = guestfs_sh (g, command);
+      if (output == NULL)
+        croak ("sh: %s", guestfs_last_error (g));
+      RETVAL = newSVpv (output, 0);
+      free (output);
+ OUTPUT:
+      RETVAL
+
+void
+sh_lines (g, command)
+      guestfs_h *g;
+      char *command;
+PREINIT:
+      char **lines;
+      int i, n;
+ PPCODE:
+      lines = guestfs_sh_lines (g, command);
+      if (lines == NULL)
+        croak ("sh_lines: %s", guestfs_last_error (g));
+      for (n = 0; lines[n] != NULL; ++n) /**/;
+      EXTEND (SP, n);
+      for (i = 0; i < n; ++i) {
+        PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
+        free (lines[i]);
+      }
+      free (lines);
+
+void
+glob_expand (g, pattern)
+      guestfs_h *g;
+      char *pattern;
+PREINIT:
+      char **paths;
+      int i, n;
+ PPCODE:
+      paths = guestfs_glob_expand (g, pattern);
+      if (paths == NULL)
+        croak ("glob_expand: %s", guestfs_last_error (g));
+      for (n = 0; paths[n] != NULL; ++n) /**/;
+      EXTEND (SP, n);
+      for (i = 0; i < n; ++i) {
+        PUSHs (sv_2mortal (newSVpv (paths[i], 0)));
+        free (paths[i]);
+      }
+      free (paths);
+
+void
+scrub_device (g, device)
+      guestfs_h *g;
+      char *device;
+PREINIT:
+      int r;
+ PPCODE:
+      r = guestfs_scrub_device (g, device);
+      if (r == -1)
+        croak ("scrub_device: %s", guestfs_last_error (g));
+
+void
+scrub_file (g, file)
+      guestfs_h *g;
+      char *file;
+PREINIT:
+      int r;
+ PPCODE:
+      r = guestfs_scrub_file (g, file);
+      if (r == -1)
+        croak ("scrub_file: %s", guestfs_last_error (g));
+
+void
+scrub_freespace (g, dir)
+      guestfs_h *g;
+      char *dir;
+PREINIT:
+      int r;
+ PPCODE:
+      r = guestfs_scrub_freespace (g, dir);
+      if (r == -1)
+        croak ("scrub_freespace: %s", guestfs_last_error (g));
+
+SV *
+mkdtemp (g, template)
+      guestfs_h *g;
+      char *template;
+PREINIT:
+      char *dir;
+   CODE:
+      dir = guestfs_mkdtemp (g, template);
+      if (dir == NULL)
+        croak ("mkdtemp: %s", guestfs_last_error (g));
+      RETVAL = newSVpv (dir, 0);
+      free (dir);
+ OUTPUT:
+      RETVAL
+
+SV *
+wc_l (g, path)
+      guestfs_h *g;
+      char *path;
+PREINIT:
+      int lines;
+   CODE:
+      lines = guestfs_wc_l (g, path);
+      if (lines == -1)
+        croak ("wc_l: %s", guestfs_last_error (g));
+      RETVAL = newSViv (lines);
+ OUTPUT:
+      RETVAL
+
+SV *
+wc_w (g, path)
+      guestfs_h *g;
+      char *path;
+PREINIT:
+      int words;
+   CODE:
+      words = guestfs_wc_w (g, path);
+      if (words == -1)
+        croak ("wc_w: %s", guestfs_last_error (g));
+      RETVAL = newSViv (words);
+ OUTPUT:
+      RETVAL
+
+SV *
+wc_c (g, path)
+      guestfs_h *g;
+      char *path;
+PREINIT:
+      int chars;
+   CODE:
+      chars = guestfs_wc_c (g, path);
+      if (chars == -1)
+        croak ("wc_c: %s", guestfs_last_error (g));
+      RETVAL = newSViv (chars);
+ OUTPUT:
+      RETVAL
+
+void
+head (g, path)
+      guestfs_h *g;
+      char *path;
+PREINIT:
+      char **lines;
+      int i, n;
+ PPCODE:
+      lines = guestfs_head (g, path);
+      if (lines == NULL)
+        croak ("head: %s", guestfs_last_error (g));
+      for (n = 0; lines[n] != NULL; ++n) /**/;
+      EXTEND (SP, n);
+      for (i = 0; i < n; ++i) {
+        PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
+        free (lines[i]);
+      }
+      free (lines);
+
+void
+head_n (g, nrlines, path)
+      guestfs_h *g;
+      int nrlines;
+      char *path;
+PREINIT:
+      char **lines;
+      int i, n;
+ PPCODE:
+      lines = guestfs_head_n (g, nrlines, path);
+      if (lines == NULL)
+        croak ("head_n: %s", guestfs_last_error (g));
+      for (n = 0; lines[n] != NULL; ++n) /**/;
+      EXTEND (SP, n);
+      for (i = 0; i < n; ++i) {
+        PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
+        free (lines[i]);
+      }
+      free (lines);
+
+void
+tail (g, path)
+      guestfs_h *g;
+      char *path;
+PREINIT:
+      char **lines;
+      int i, n;
+ PPCODE:
+      lines = guestfs_tail (g, path);
+      if (lines == NULL)
+        croak ("tail: %s", guestfs_last_error (g));
+      for (n = 0; lines[n] != NULL; ++n) /**/;
+      EXTEND (SP, n);
+      for (i = 0; i < n; ++i) {
+        PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
+        free (lines[i]);
+      }
+      free (lines);
+
+void
+tail_n (g, nrlines, path)
+      guestfs_h *g;
+      int nrlines;
+      char *path;
+PREINIT:
+      char **lines;
+      int i, n;
+ PPCODE:
+      lines = guestfs_tail_n (g, nrlines, path);
+      if (lines == NULL)
+        croak ("tail_n: %s", guestfs_last_error (g));
+      for (n = 0; lines[n] != NULL; ++n) /**/;
+      EXTEND (SP, n);
+      for (i = 0; i < n; ++i) {
+        PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
+        free (lines[i]);
+      }
+      free (lines);
+