From: Ian Campbell Date: Tue, 18 Oct 2011 09:35:55 +0000 (+0100) Subject: libxl: add a comment describing the device interfaces. X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=134fa16eb6a18b50725a5b4fa84b5284e9acddd4;p=xen.git libxl: add a comment describing the device interfaces. Subsequent patches will endeavour to make reality match this defined interface. Signed-off-by: Ian Campbell Acked-by: Ian Jackson Committed-by: Ian Jackson --- diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index eb697c7464..bb02c9905b 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -379,6 +379,65 @@ libxl_dominfo * libxl_list_domain(libxl_ctx*, int *nb_domain); libxl_cpupoolinfo * libxl_list_cpupool(libxl_ctx*, int *nb_pool); libxl_vminfo * libxl_list_vm(libxl_ctx *ctx, int *nb_vm); +/* + * Devices + * ======= + * + * Each device is represented by a libxl_device_ data structure + * which is defined via the IDL. In addition some devices have an + * additional data type libxl_device__getinfo which contains + * further runtime information about the device. + * + * A common set of methods are available for each device type. These + * are described below. + * + * Querying + * -------- + * + * libxl_device__list(ctx, domid, nr): + * + * Returns an array of libxl_device_ length nr representing + * the devices attached to the specified domain. + * + * libxl_device__getinfo(ctx, domid, device, info): + * + * Initialises info with details of the given device which must be + * attached to the specified domain. + * + * Creation / Control + * ------------------ + * + * libxl_device__init(ctx, device): + * + * Initalises device to a default configuration. + * + * libxl_device__add(ctx, domid, device): + * + * Adds the given device to the specified domain. This can be called + * while the guest is running (hotplug) or before boot (coldplug). + * + * This function only sets up the device but does not wait for the + * domain to connect to the device and therefore cannot block on the + * guest. + * + * libxl_device__remove(ctx, domid, device): + * + * Removes the given device from the specified domain by performing + * an orderly unplug with guest co-operation. This requires that the + * guest is running. + * + * This method is currently synchronous and therefore can block + * while interacting with the guest. + * + * libxl_device__destroy(ctx, domid, device): + * + * Removes the given device from the specified domain without guest + * co-operation. It is guest specific what affect this will have on + * a running guest. + * + * This function does not interact with the guest and therefore + * cannot block on the guest. + */ int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk); int libxl_device_disk_del(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk, int wait); libxl_device_disk *libxl_device_disk_list(libxl_ctx *ctx, uint32_t domid, int *num);