diff options
author | Ian Jackson <ian.jackson@eu.citrix.com> | 2011-06-28 12:19:11 +0100 |
---|---|---|
committer | Ian Jackson <ian.jackson@eu.citrix.com> | 2011-06-28 12:19:11 +0100 |
commit | 5c206536adf068f418d19195841ee18eb4537b6e (patch) | |
tree | 4c36fe860600999e481333826196143cd9e0cdd8 /tools/libxl/libxlutil.h | |
parent | eaed6ac8500f4a501ed02cebb4f99b3c8cf94adb (diff) | |
download | xen-5c206536adf068f418d19195841ee18eb4537b6e.tar.gz xen-5c206536adf068f418d19195841ee18eb4537b6e.tar.bz2 xen-5c206536adf068f418d19195841ee18eb4537b6e.zip |
libxl: disks: new xlu_disk_parse function
Introduce new flex/regexp-based parser for disk configuration strings.
Callers will be updated in following patches.
The existing xm command line syntax for block-attach expects multiple
arguments containing different parameters for different parts of the
disk specification, so we supply a parser function which can take
multiple strings and scan them in sequence.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/libxlutil.h')
-rw-r--r-- | tools/libxl/libxlutil.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/libxl/libxlutil.h b/tools/libxl/libxlutil.h index 8a6fcbd803..80c87537ba 100644 --- a/tools/libxl/libxlutil.h +++ b/tools/libxl/libxlutil.h @@ -58,4 +58,27 @@ const char *xlu_cfg_get_listitem(const XLU_ConfigList*, int entry); /* xlu_cfg_get_listitem cannot fail, except that if entry is * out of range it returns 0 (not setting errno) */ + +/* + * Disk specification parsing. + */ + +int xlu_disk_parse(XLU_Config *cfg, int nspecs, const char *const *specs, + libxl_device_disk *disk); + /* disk must have been initialised. + * + * On error, returns errno value. Bad strings cause EINVAL and + * print a message to cfg's report (that's all cfg is used for). + * + * Normally one would pass nspecs==1 and only specs[0]. But it is + * permitted to pass more strings in which case each is parsed as a + * string containing a collection of parameters (but they all refer + * to of the configuration for a single disk). + * + * nspecs==0 is permitted but since it does not specify some mandatory + * properties, it produces a run-time configuration error if the + * resulting disk struct is used with libxl. + */ + + #endif /* LIBXLUTIL_H */ |