fprintf (stderr, "warning: \"guestfs_set_busy\" has no tests\n");
fprintf (stderr, "warning: \"guestfs_set_ready\" has no tests\n");
fprintf (stderr, "warning: \"guestfs_end_busy\" has no tests\n");
+ fprintf (stderr, "warning: \"guestfs_set_memsize\" has no tests\n");
+ fprintf (stderr, "warning: \"guestfs_get_memsize\" has no tests\n");
fprintf (stderr, "warning: \"guestfs_ll\" has no tests\n");
fprintf (stderr, "warning: \"guestfs_pvs_full\" has no tests\n");
fprintf (stderr, "warning: \"guestfs_vgs_full\" has no tests\n");
printf ("%-20s %s\n", "get-autosync", "get autosync mode");
printf ("%-20s %s\n", "get-e2label", "get the ext2/3/4 filesystem label");
printf ("%-20s %s\n", "get-e2uuid", "get the ext2/3/4 filesystem UUID");
+ printf ("%-20s %s\n", "get-memsize", "get memory allocated to the qemu subprocess");
printf ("%-20s %s\n", "get-path", "get the search path");
printf ("%-20s %s\n", "get-qemu", "get the qemu binary");
printf ("%-20s %s\n", "get-state", "get the current state");
printf ("%-20s %s\n", "set-autosync", "set autosync mode");
printf ("%-20s %s\n", "set-e2label", "set the ext2/3/4 filesystem label");
printf ("%-20s %s\n", "set-e2uuid", "set the ext2/3/4 filesystem UUID");
+ printf ("%-20s %s\n", "set-memsize", "set memory allocated to the qemu subprocess");
printf ("%-20s %s\n", "set-path", "set the search path");
printf ("%-20s %s\n", "set-qemu", "set the qemu binary");
printf ("%-20s %s\n", "set-verbose", "set verbose mode");
if (strcasecmp (cmd, "get_state") == 0 || strcasecmp (cmd, "get-state") == 0)
pod2text ("get-state - get the current state", " get-state\n\nThis returns the current state as an opaque integer. This is\nonly useful for printing debug and internal error messages.\n\nFor more information on states, see L<guestfs(3)>.");
else
+ if (strcasecmp (cmd, "set_memsize") == 0 || strcasecmp (cmd, "set-memsize") == 0 || strcasecmp (cmd, "memsize") == 0)
+ pod2text ("set-memsize - set memory allocated to the qemu subprocess", " set-memsize <memsize>\n\nThis sets the memory size in megabytes allocated to the\nqemu subprocess. This only has any effect if called before\nC<launch>.\n\nYou can also change this by setting the environment\nvariable C<LIBGUESTFS_MEMSIZE> before the handle is\ncreated.\n\nFor more information on the architecture of libguestfs,\nsee L<guestfs(3)>.\n\nYou can use 'memsize' as an alias for this command.");
+ else
+ if (strcasecmp (cmd, "get_memsize") == 0 || strcasecmp (cmd, "get-memsize") == 0)
+ pod2text ("get-memsize - get memory allocated to the qemu subprocess", " get-memsize\n\nThis gets the memory size in megabytes allocated to the\nqemu subprocess.\n\nIf C<set_memsize> was not called\non this handle, and if C<LIBGUESTFS_MEMSIZE> was not set,\nthen this returns the compiled-in default value for memsize.\n\nFor more information on the architecture of libguestfs,\nsee L<guestfs(3)>.");
+ else
if (strcasecmp (cmd, "mount") == 0)
pod2text ("mount - mount a guest disk at a position in the filesystem", " mount <device> <mountpoint>\n\nMount a guest disk at a position in the filesystem. Block devices\nare named C</dev/sda>, C</dev/sdb> and so on, as they were added to\nthe guest. If those block devices contain partitions, they will have\nthe usual names (eg. C</dev/sda1>). Also LVM C</dev/VG/LV>-style\nnames can be used.\n\nThe rules are the same as for L<mount(2)>: A filesystem must\nfirst be mounted on C</> before others can be mounted. Other\nfilesystems can only be mounted on directories which already\nexist.\n\nThe mounted filesystem is writable, if we have sufficient permissions\non the underlying device.\n\nThe filesystem options C<sync> and C<noatime> are set with this\ncall, in order to improve reliability.");
else
return 0;
}
+static int run_set_memsize (const char *cmd, int argc, char *argv[])
+{
+ int r;
+ int memsize;
+ if (argc != 1) {
+ fprintf (stderr, "%s should have 1 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ memsize = atoi (argv[0]);
+ r = guestfs_set_memsize (g, memsize);
+ return r;
+}
+
+static int run_get_memsize (const char *cmd, int argc, char *argv[])
+{
+ int r;
+ if (argc != 0) {
+ fprintf (stderr, "%s should have 0 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ r = guestfs_get_memsize (g);
+ if (r == -1) return -1;
+ printf ("%d\n", r);
+ return 0;
+}
+
static int run_mount (const char *cmd, int argc, char *argv[])
{
int r;
if (strcasecmp (cmd, "get_state") == 0 || strcasecmp (cmd, "get-state") == 0)
return run_get_state (cmd, argc, argv);
else
+ if (strcasecmp (cmd, "set_memsize") == 0 || strcasecmp (cmd, "set-memsize") == 0 || strcasecmp (cmd, "memsize") == 0)
+ return run_set_memsize (cmd, argc, argv);
+ else
+ if (strcasecmp (cmd, "get_memsize") == 0 || strcasecmp (cmd, "get-memsize") == 0)
+ return run_get_memsize (cmd, argc, argv);
+ else
if (strcasecmp (cmd, "mount") == 0)
return run_mount (cmd, argc, argv);
else
"is-launching",
"is-busy",
"get-state",
+ "set-memsize",
+ "memsize",
+ "get-memsize",
"mount",
"sync",
"touch",
This returns the ext2/3/4 filesystem UUID of the filesystem on
C<device>.
+=head2 get-memsize
+
+ get-memsize
+
+This gets the memory size in megabytes allocated to the
+qemu subprocess.
+
+If C<set-memsize> was not called
+on this handle, and if C<LIBGUESTFS_MEMSIZE> was not set,
+then this returns the compiled-in default value for memsize.
+
+For more information on the architecture of libguestfs,
+see L<guestfs(3)>.
+
=head2 get-path
get-path
You can use either C<tune2fs-l> or C<get-e2uuid>
to return the existing UUID of a filesystem.
+=head2 set-memsize | memsize
+
+ set-memsize memsize
+
+This sets the memory size in megabytes allocated to the
+qemu subprocess. This only has any effect if called before
+C<launch>.
+
+You can also change this by setting the environment
+variable C<LIBGUESTFS_MEMSIZE> before the handle is
+created.
+
+For more information on the architecture of libguestfs,
+see L<guestfs(3)>.
+
=head2 set-path | path
set-path path
This function returns a string, or NULL on error.
I<The caller must free the returned string after use>.
+=head2 guestfs_get_memsize
+
+ int guestfs_get_memsize (guestfs_h *handle);
+
+This gets the memory size in megabytes allocated to the
+qemu subprocess.
+
+If C<guestfs_set_memsize> was not called
+on this handle, and if C<LIBGUESTFS_MEMSIZE> was not set,
+then this returns the compiled-in default value for memsize.
+
+For more information on the architecture of libguestfs,
+see L<guestfs(3)>.
+
+On error this function returns -1.
+
=head2 guestfs_get_path
const char *guestfs_get_path (guestfs_h *handle);
This function returns 0 on success or -1 on error.
+=head2 guestfs_set_memsize
+
+ int guestfs_set_memsize (guestfs_h *handle,
+ int memsize);
+
+This sets the memory size in megabytes allocated to the
+qemu subprocess. This only has any effect if called before
+C<guestfs_launch>.
+
+You can also change this by setting the environment
+variable C<LIBGUESTFS_MEMSIZE> before the handle is
+created.
+
+For more information on the architecture of libguestfs,
+see L<guestfs(3)>.
+
+This function returns 0 on success or -1 on error.
+
=head2 guestfs_set_path
int guestfs_set_path (guestfs_h *handle,
set_busy,
set_ready,
end_busy,
+ set_memsize,
+ get_memsize,
mount,
sync,
touch,
fail err
else return ()
+foreign import ccall unsafe "guestfs_set_memsize" c_set_memsize
+ :: GuestfsP -> CInt -> IO (CInt)
+
+set_memsize :: GuestfsH -> Int -> IO ()
+set_memsize h memsize = do
+ r <- withForeignPtr h (\p -> c_set_memsize p (fromIntegral memsize))
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+
+foreign import ccall unsafe "guestfs_get_memsize" c_get_memsize
+ :: GuestfsP -> IO (CInt)
+
+get_memsize :: GuestfsH -> IO (Int)
+get_memsize h = do
+ r <- withForeignPtr h (\p -> c_get_memsize p)
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return (fromIntegral r)
+
foreign import ccall unsafe "guestfs_mount" c_mount
:: GuestfsP -> CString -> CString -> IO (CInt)
throws LibGuestFSException;
/**
+ * set memory allocated to the qemu subprocess
+ * <p>
+ * This sets the memory size in megabytes allocated to the
+ * qemu subprocess. This only has any effect if called
+ * before "g.launch".
+ * <p>
+ * You can also change this by setting the environment
+ * variable "LIBGUESTFS_MEMSIZE" before the handle is
+ * created.
+ * <p>
+ * For more information on the architecture of libguestfs,
+ * see guestfs(3).
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void set_memsize (int memsize)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("set_memsize: handle is closed");
+ _set_memsize (g, memsize);
+ }
+ private native void _set_memsize (long g, int memsize)
+ throws LibGuestFSException;
+
+ /**
+ * get memory allocated to the qemu subprocess
+ * <p>
+ * This gets the memory size in megabytes allocated to the
+ * qemu subprocess.
+ * <p>
+ * If "g.set_memsize" was not called on this handle, and if
+ * "LIBGUESTFS_MEMSIZE" was not set, then this returns the
+ * compiled-in default value for memsize.
+ * <p>
+ * For more information on the architecture of libguestfs,
+ * see guestfs(3).
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public int get_memsize ()
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("get_memsize: handle is closed");
+ return _get_memsize (g);
+ }
+ private native int _get_memsize (long g)
+ throws LibGuestFSException;
+
+ /**
* mount a guest disk at a position in the filesystem
* <p>
* Mount a guest disk at a position in the filesystem.
}
JNIEXPORT void JNICALL
+Java_com_redhat_et_libguestfs_GuestFS__1set_1memsize
+ (JNIEnv *env, jobject obj, jlong jg, jint jmemsize)
+{
+ guestfs_h *g = (guestfs_h *) (long) jg;
+ int r;
+ int memsize;
+
+ memsize = jmemsize;
+ r = guestfs_set_memsize (g, memsize);
+ if (r == -1) {
+ throw_exception (env, guestfs_last_error (g));
+ return ;
+ }
+}
+
+JNIEXPORT jint JNICALL
+Java_com_redhat_et_libguestfs_GuestFS__1get_1memsize
+ (JNIEnv *env, jobject obj, jlong jg)
+{
+ guestfs_h *g = (guestfs_h *) (long) jg;
+ int r;
+
+ r = guestfs_get_memsize (g);
+ if (r == -1) {
+ throw_exception (env, guestfs_last_error (g));
+ return 0;
+ }
+ return (jint) r;
+}
+
+JNIEXPORT void JNICALL
Java_com_redhat_et_libguestfs_GuestFS__1mount
(JNIEnv *env, jobject obj, jlong jg, jstring jdevice, jstring jmountpoint)
{
external set_busy : t -> unit = "ocaml_guestfs_set_busy"
external set_ready : t -> unit = "ocaml_guestfs_set_ready"
external end_busy : t -> unit = "ocaml_guestfs_end_busy"
+external set_memsize : t -> int -> unit = "ocaml_guestfs_set_memsize"
+external get_memsize : t -> int = "ocaml_guestfs_get_memsize"
external mount : t -> string -> string -> unit = "ocaml_guestfs_mount"
external sync : t -> unit = "ocaml_guestfs_sync"
external touch : t -> string -> unit = "ocaml_guestfs_touch"
val end_busy : t -> unit
(** leave the busy state *)
+val set_memsize : t -> int -> unit
+(** set memory allocated to the qemu subprocess *)
+
+val get_memsize : t -> int
+(** get memory allocated to the qemu subprocess *)
+
val mount : t -> string -> string -> unit
(** mount a guest disk at a position in the filesystem *)
}
CAMLprim value
+ocaml_guestfs_set_memsize (value gv, value memsizev)
+{
+ CAMLparam2 (gv, memsizev);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("set_memsize: used handle after closing it");
+
+ int memsize = Int_val (memsizev);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_set_memsize (g, memsize);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "set_memsize");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_get_memsize (value gv)
+{
+ CAMLparam1 (gv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("get_memsize: used handle after closing it");
+
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_get_memsize (g);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "get_memsize");
+
+ rv = Val_int (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
ocaml_guestfs_mount (value gv, value devicev, value mountpointv)
{
CAMLparam3 (gv, devicev, mountpointv);
croak ("end_busy: %s", guestfs_last_error (g));
void
+set_memsize (g, memsize)
+ guestfs_h *g;
+ int memsize;
+PREINIT:
+ int r;
+ PPCODE:
+ r = guestfs_set_memsize (g, memsize);
+ if (r == -1)
+ croak ("set_memsize: %s", guestfs_last_error (g));
+
+SV *
+get_memsize (g)
+ guestfs_h *g;
+PREINIT:
+ int memsize;
+ CODE:
+ memsize = guestfs_get_memsize (g);
+ if (memsize == -1)
+ croak ("get_memsize: %s", guestfs_last_error (g));
+ RETVAL = newSViv (memsize);
+ OUTPUT:
+ RETVAL
+
+void
mount (g, device, mountpoint)
guestfs_h *g;
char *device;
This returns the ext2/3/4 filesystem UUID of the filesystem on
C<device>.
+=item $memsize = $h->get_memsize ();
+
+This gets the memory size in megabytes allocated to the
+qemu subprocess.
+
+If C<$h-E<gt>set_memsize> was not called
+on this handle, and if C<LIBGUESTFS_MEMSIZE> was not set,
+then this returns the compiled-in default value for memsize.
+
+For more information on the architecture of libguestfs,
+see L<guestfs(3)>.
+
=item $path = $h->get_path ();
Return the current search path.
You can use either C<$h-E<gt>tune2fs_l> or C<$h-E<gt>get_e2uuid>
to return the existing UUID of a filesystem.
+=item $h->set_memsize ($memsize);
+
+This sets the memory size in megabytes allocated to the
+qemu subprocess. This only has any effect if called before
+C<$h-E<gt>launch>.
+
+You can also change this by setting the environment
+variable C<LIBGUESTFS_MEMSIZE> before the handle is
+created.
+
+For more information on the architecture of libguestfs,
+see L<guestfs(3)>.
+
=item $h->set_path ($path);
Set the path that libguestfs searches for kernel and initrd.img.
}
static PyObject *
+py_guestfs_set_memsize (PyObject *self, PyObject *args)
+{
+ PyObject *py_g;
+ guestfs_h *g;
+ PyObject *py_r;
+ int r;
+ int memsize;
+
+ if (!PyArg_ParseTuple (args, (char *) "Oi:guestfs_set_memsize",
+ &py_g, &memsize))
+ return NULL;
+ g = get_handle (py_g);
+
+ r = guestfs_set_memsize (g, memsize);
+ if (r == -1) {
+ PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
+ return NULL;
+ }
+
+ Py_INCREF (Py_None);
+ py_r = Py_None;
+ return py_r;
+}
+
+static PyObject *
+py_guestfs_get_memsize (PyObject *self, PyObject *args)
+{
+ PyObject *py_g;
+ guestfs_h *g;
+ PyObject *py_r;
+ int r;
+
+ if (!PyArg_ParseTuple (args, (char *) "O:guestfs_get_memsize",
+ &py_g))
+ return NULL;
+ g = get_handle (py_g);
+
+ r = guestfs_get_memsize (g);
+ if (r == -1) {
+ PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
+ return NULL;
+ }
+
+ py_r = PyInt_FromLong ((long) r);
+ return py_r;
+}
+
+static PyObject *
py_guestfs_mount (PyObject *self, PyObject *args)
{
PyObject *py_g;
{ (char *) "set_busy", py_guestfs_set_busy, METH_VARARGS, NULL },
{ (char *) "set_ready", py_guestfs_set_ready, METH_VARARGS, NULL },
{ (char *) "end_busy", py_guestfs_end_busy, METH_VARARGS, NULL },
+ { (char *) "set_memsize", py_guestfs_set_memsize, METH_VARARGS, NULL },
+ { (char *) "get_memsize", py_guestfs_get_memsize, METH_VARARGS, NULL },
{ (char *) "mount", py_guestfs_mount, METH_VARARGS, NULL },
{ (char *) "sync", py_guestfs_sync, METH_VARARGS, NULL },
{ (char *) "touch", py_guestfs_touch, METH_VARARGS, NULL },
"""
return libguestfsmod.end_busy (self._o)
+ def set_memsize (self, memsize):
+ u"""This sets the memory size in megabytes allocated to the
+ qemu subprocess. This only has any effect if called
+ before "g.launch".
+
+ You can also change this by setting the environment
+ variable "LIBGUESTFS_MEMSIZE" before the handle is
+ created.
+
+ For more information on the architecture of libguestfs,
+ see guestfs(3).
+ """
+ return libguestfsmod.set_memsize (self._o, memsize)
+
+ def get_memsize (self):
+ u"""This gets the memory size in megabytes allocated to the
+ qemu subprocess.
+
+ If "g.set_memsize" was not called on this handle, and if
+ "LIBGUESTFS_MEMSIZE" was not set, then this returns the
+ compiled-in default value for memsize.
+
+ For more information on the architecture of libguestfs,
+ see guestfs(3).
+ """
+ return libguestfsmod.get_memsize (self._o)
+
def mount (self, device, mountpoint):
u"""Mount a guest disk at a position in the filesystem.
Block devices are named "/dev/sda", "/dev/sdb" and so
return Qnil;
}
+static VALUE ruby_guestfs_set_memsize (VALUE gv, VALUE memsizev)
+{
+ guestfs_h *g;
+ Data_Get_Struct (gv, guestfs_h, g);
+ if (!g)
+ rb_raise (rb_eArgError, "%s: used handle after closing it", "set_memsize");
+
+ int memsize = NUM2INT (memsizev);
+
+ int r;
+
+ r = guestfs_set_memsize (g, memsize);
+ if (r == -1)
+ rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+ return Qnil;
+}
+
+static VALUE ruby_guestfs_get_memsize (VALUE gv)
+{
+ guestfs_h *g;
+ Data_Get_Struct (gv, guestfs_h, g);
+ if (!g)
+ rb_raise (rb_eArgError, "%s: used handle after closing it", "get_memsize");
+
+
+ int r;
+
+ r = guestfs_get_memsize (g);
+ if (r == -1)
+ rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+ return INT2NUM (r);
+}
+
static VALUE ruby_guestfs_mount (VALUE gv, VALUE devicev, VALUE mountpointv)
{
guestfs_h *g;
ruby_guestfs_set_ready, 0);
rb_define_method (c_guestfs, "end_busy",
ruby_guestfs_end_busy, 0);
+ rb_define_method (c_guestfs, "set_memsize",
+ ruby_guestfs_set_memsize, 1);
+ rb_define_method (c_guestfs, "get_memsize",
+ ruby_guestfs_get_memsize, 0);
rb_define_method (c_guestfs, "mount",
ruby_guestfs_mount, 2);
rb_define_method (c_guestfs, "sync",
extern int guestfs_set_busy (guestfs_h *handle);
extern int guestfs_set_ready (guestfs_h *handle);
extern int guestfs_end_busy (guestfs_h *handle);
+extern int guestfs_set_memsize (guestfs_h *handle, int memsize);
+extern int guestfs_get_memsize (guestfs_h *handle);
extern int guestfs_mount (guestfs_h *handle, const char *device, const char *mountpoint);
extern int guestfs_sync (guestfs_h *handle);
extern int guestfs_touch (guestfs_h *handle, const char *path);