diff options
author | Kevin Wolf <kwolf@redhat.com> | 2009-05-18 16:42:09 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-05-22 10:50:31 -0500 |
commit | d3f243676addaef6c8d818934565292c698f91cc (patch) | |
tree | 4a834799306873ae91572e893bc66c5ced41d39e /vl.c | |
parent | daa91de28dd011a39b80d76da96c432273fb5bf2 (diff) |
Create qemu-option.h
This patch creates a new header file and the corresponding implementation file
for parsing of parameter strings for options (like used in -drive). Part of
this is code moved from vl.c (so qemu-img can use it later).
The idea is to have a data structure describing all accepted parameters. When
parsing a parameter string, the structure is copied and filled with the
parameter values.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 38 |
1 files changed, 1 insertions, 37 deletions
@@ -156,6 +156,7 @@ int main(int argc, char **argv) #include "migration.h" #include "kvm.h" #include "balloon.h" +#include "qemu-option.h" #include "disas.h" @@ -1809,43 +1810,6 @@ static int socket_init(void) } #endif -const char *get_opt_name(char *buf, int buf_size, const char *p, char delim) -{ - char *q; - - q = buf; - while (*p != '\0' && *p != delim) { - if (q && (q - buf) < buf_size - 1) - *q++ = *p; - p++; - } - if (q) - *q = '\0'; - - return p; -} - -const char *get_opt_value(char *buf, int buf_size, const char *p) -{ - char *q; - - q = buf; - while (*p != '\0') { - if (*p == ',') { - if (*(p + 1) != ',') - break; - p++; - } - if (q && (q - buf) < buf_size - 1) - *q++ = *p; - p++; - } - if (q) - *q = '\0'; - - return p; -} - int get_param_value(char *buf, int buf_size, const char *tag, const char *str) { |