X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=src%2Fguestfs.pod;h=ccc719d7a0f7572208f58cd687f93efc1e115ee6;hp=4dafb07496295c328ae45917663b7615b3e832b7;hb=25521f17d5b0841a13d66fc515fac0cffe23d9a1;hpb=831b1fc1805e8450202b5c2cf9ab17a163ab0cc5 diff --git a/src/guestfs.pod b/src/guestfs.pod index 4dafb07..ccc719d 100644 --- a/src/guestfs.pod +++ b/src/guestfs.pod @@ -358,6 +358,11 @@ The command will be running in limited memory. =item * +The network may not be available unless you enable it +(see L). + +=item * + Only supports Linux guests (not Windows, BSD, etc). =item * @@ -839,11 +844,11 @@ largest number of results. =head2 guestfs_set_error_handler typedef void (*guestfs_error_handler_cb) (guestfs_h *g, - void *data, + void *opaque, const char *msg); void guestfs_set_error_handler (guestfs_h *g, guestfs_error_handler_cb cb, - void *data); + void *opaque); The callback C will be called if there is an error. The parameters passed to the callback are an opaque data pointer and the @@ -860,7 +865,7 @@ If you set C to C then I handler is called. =head2 guestfs_get_error_handler guestfs_error_handler_cb guestfs_get_error_handler (guestfs_h *g, - void **data_rtn); + void **opaque_rtn); Returns the current error handler callback. @@ -1181,6 +1186,94 @@ languages (eg. if your HLL interpreter has already been cleaned up by the time this is called, and if your callback then jumps into some HLL function). +=head2 guestfs_set_progress_callback + + typedef void (*guestfs_progress_cb) (guestfs_h *g, void *opaque, + int proc_nr, int serial, + uint64_t position, uint64_t total); + void guestfs_set_progress_callback (guestfs_h *g, + guestfs_progress_cb cb, + void *opaque); + +Some long-running operations can generate progress messages. If +this callback is registered, then it will be called each time a +progress message is generated (usually two seconds after the +operation started, and three times per second thereafter until +it completes, although the frequency may change in future versions). + +The callback receives two numbers: C and C. +The units of C are not defined, although for some +operations C may relate in some way to the amount of +data to be transferred (eg. in bytes or megabytes), and +C may be the portion which has been transferred. + +The only defined and stable parts of the API are: + +=over 4 + +=item * + +The callback can display to the user some type of progress bar or +indicator which shows the ratio of C:C. + +=item * + +0 E= C E= C + +=item * + +If any progress notification is sent during a call, then a final +progress notification is always sent when C = C. + +This is to simplify caller code, so callers can easily set the +progress indicator to "100%" at the end of the operation, without +requiring special code to detect this case. + +=back + +The callback also receives the procedure number and serial number of +the call. These are only useful for debugging protocol issues, and +the callback can normally ignore them. The callback may want to +print these numbers in error messages or debugging messages. + +=head1 PRIVATE DATA AREA + +You can attach named pieces of private data to the libguestfs handle, +and fetch them by name for the lifetime of the handle. This is called +the private data area and is only available from the C API. + +To attach a named piece of data, use the following call: + + void guestfs_set_private (guestfs_h *g, const char *key, void *data); + +C is the name to associate with this data, and C is an +arbitrary pointer (which can be C). Any previous item with the +same name is overwritten. + +You can use any C you want, but names beginning with an +underscore character are reserved for internal libguestfs purposes +(for implementing language bindings). It is recommended to prefix the +name with some unique string to avoid collisions with other users. + +To retrieve the pointer, use: + + void *guestfs_get_private (guestfs_h *g, const char *key); + +This function returns C if either no data is found associated +with C, or if the user previously set the C's C +pointer to C. + +Libguestfs does not try to look at or interpret the C pointer in +any way. As far as libguestfs is concerned, it need not be a valid +pointer at all. In particular, libguestfs does I try to free the +data when the handle is closed. If the data must be freed, then the +caller must either free it before calling L or must +set up a close callback to do it (see L, +and note that only one callback can be registered for a handle). + +The private data area is implemented using a hash table, and should be +reasonably efficient for moderate numbers of keys. + =head1 BLOCK DEVICE NAMING In the kernel there is now quite a profusion of schemata for naming