qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] multiboot: Support commas in module parameters
@ 2011-04-18 21:10 Adam Lackorzynski
  0 siblings, 0 replies; 7+ messages in thread
From: Adam Lackorzynski @ 2011-04-18 21:10 UTC (permalink / raw)
  To: qemu-devel

Support commas in the parameter list of modules, by using double commas
(via get_opt_value()).

Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
---
 hw/multiboot.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/hw/multiboot.c b/hw/multiboot.c
index 394ed01..7d5cb22 100644
--- a/hw/multiboot.c
+++ b/hw/multiboot.c
@@ -97,11 +97,11 @@ typedef struct {
 
 static uint32_t mb_add_cmdline(MultibootState *s, const char *cmdline)
 {
-    int len = strlen(cmdline) + 1;
     target_phys_addr_t p = s->offset_cmdlines;
+    char *b = (char *)s->mb_buf + p;
 
-    pstrcpy((char *)s->mb_buf + p, len, cmdline);
-    s->offset_cmdlines += len;
+    get_opt_value(b, strlen(cmdline) + 1, cmdline);
+    s->offset_cmdlines += strlen(b) + 1;
     return s->mb_buf_phys + p;
 }
 
@@ -238,7 +238,7 @@ int load_multiboot(void *fw_cfg,
         const char *r = initrd_filename;
         mbs.mb_buf_size += strlen(r) + 1;
         mbs.mb_mods_avail = 1;
-        while ((r = strchr(r, ','))) {
+        while (*(r = get_opt_value(NULL, 0, r))) {
            mbs.mb_mods_avail++;
            r++;
         }
@@ -252,7 +252,7 @@ int load_multiboot(void *fw_cfg,
     mbs.offset_cmdlines = mbs.offset_mbinfo + mbs.mb_mods_avail * MB_MOD_SIZE;
 
     if (initrd_filename) {
-        char *next_initrd;
+        char *next_initrd, not_last;
 
         mbs.offset_mods = mbs.mb_buf_size;
 
@@ -261,9 +261,9 @@ int load_multiboot(void *fw_cfg,
             int mb_mod_length;
             uint32_t offs = mbs.mb_buf_size;
 
-            next_initrd = strchr(initrd_filename, ',');
-            if (next_initrd)
-                *next_initrd = '\0';
+            next_initrd = (char *)get_opt_value(NULL, 0, initrd_filename);
+            not_last = *next_initrd;
+            *next_initrd = '\0';
             /* if a space comes after the module filename, treat everything
                after that as parameters */
             target_phys_addr_t c = mb_add_cmdline(&mbs, initrd_filename);
@@ -287,7 +287,7 @@ int load_multiboot(void *fw_cfg,
                      (char *)mbs.mb_buf + offs,
                      (char *)mbs.mb_buf + offs + mb_mod_length, c);
             initrd_filename = next_initrd+1;
-        } while (next_initrd);
+        } while (not_last);
     }
 
     /* Commandline support */
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH] multiboot: Support commas in module parameters
@ 2011-05-01 18:56 Adam Lackorzynski
  0 siblings, 0 replies; 7+ messages in thread
From: Adam Lackorzynski @ 2011-05-01 18:56 UTC (permalink / raw)
  To: qemu-devel

Support commas in the parameter list of multiboot modules, by using double
commas (via get_opt_value()).

Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
---
 hw/multiboot.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/hw/multiboot.c b/hw/multiboot.c
index 394ed01..7d5cb22 100644
--- a/hw/multiboot.c
+++ b/hw/multiboot.c
@@ -97,11 +97,11 @@ typedef struct {
 
 static uint32_t mb_add_cmdline(MultibootState *s, const char *cmdline)
 {
-    int len = strlen(cmdline) + 1;
     target_phys_addr_t p = s->offset_cmdlines;
+    char *b = (char *)s->mb_buf + p;
 
-    pstrcpy((char *)s->mb_buf + p, len, cmdline);
-    s->offset_cmdlines += len;
+    get_opt_value(b, strlen(cmdline) + 1, cmdline);
+    s->offset_cmdlines += strlen(b) + 1;
     return s->mb_buf_phys + p;
 }
 
@@ -238,7 +238,7 @@ int load_multiboot(void *fw_cfg,
         const char *r = initrd_filename;
         mbs.mb_buf_size += strlen(r) + 1;
         mbs.mb_mods_avail = 1;
-        while ((r = strchr(r, ','))) {
+        while (*(r = get_opt_value(NULL, 0, r))) {
            mbs.mb_mods_avail++;
            r++;
         }
@@ -252,7 +252,7 @@ int load_multiboot(void *fw_cfg,
     mbs.offset_cmdlines = mbs.offset_mbinfo + mbs.mb_mods_avail * MB_MOD_SIZE;
 
     if (initrd_filename) {
-        char *next_initrd;
+        char *next_initrd, not_last;
 
         mbs.offset_mods = mbs.mb_buf_size;
 
@@ -261,9 +261,9 @@ int load_multiboot(void *fw_cfg,
             int mb_mod_length;
             uint32_t offs = mbs.mb_buf_size;
 
-            next_initrd = strchr(initrd_filename, ',');
-            if (next_initrd)
-                *next_initrd = '\0';
+            next_initrd = (char *)get_opt_value(NULL, 0, initrd_filename);
+            not_last = *next_initrd;
+            *next_initrd = '\0';
             /* if a space comes after the module filename, treat everything
                after that as parameters */
             target_phys_addr_t c = mb_add_cmdline(&mbs, initrd_filename);
@@ -287,7 +287,7 @@ int load_multiboot(void *fw_cfg,
                      (char *)mbs.mb_buf + offs,
                      (char *)mbs.mb_buf + offs + mb_mod_length, c);
             initrd_filename = next_initrd+1;
-        } while (next_initrd);
+        } while (not_last);
     }
 
     /* Commandline support */
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH] multiboot: Support commas in module parameters
@ 2011-05-21  9:35 Adam Lackorzynski
  0 siblings, 0 replies; 7+ messages in thread
From: Adam Lackorzynski @ 2011-05-21  9:35 UTC (permalink / raw)
  To: qemu-devel

Support commas in the parameter list of multiboot modules, by using double
commas (via get_opt_value()).

Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
---
 hw/multiboot.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/hw/multiboot.c b/hw/multiboot.c
index 394ed01..7d5cb22 100644
--- a/hw/multiboot.c
+++ b/hw/multiboot.c
@@ -97,11 +97,11 @@ typedef struct {
 
 static uint32_t mb_add_cmdline(MultibootState *s, const char *cmdline)
 {
-    int len = strlen(cmdline) + 1;
     target_phys_addr_t p = s->offset_cmdlines;
+    char *b = (char *)s->mb_buf + p;
 
-    pstrcpy((char *)s->mb_buf + p, len, cmdline);
-    s->offset_cmdlines += len;
+    get_opt_value(b, strlen(cmdline) + 1, cmdline);
+    s->offset_cmdlines += strlen(b) + 1;
     return s->mb_buf_phys + p;
 }
 
@@ -238,7 +238,7 @@ int load_multiboot(void *fw_cfg,
         const char *r = initrd_filename;
         mbs.mb_buf_size += strlen(r) + 1;
         mbs.mb_mods_avail = 1;
-        while ((r = strchr(r, ','))) {
+        while (*(r = get_opt_value(NULL, 0, r))) {
            mbs.mb_mods_avail++;
            r++;
         }
@@ -252,7 +252,7 @@ int load_multiboot(void *fw_cfg,
     mbs.offset_cmdlines = mbs.offset_mbinfo + mbs.mb_mods_avail * MB_MOD_SIZE;
 
     if (initrd_filename) {
-        char *next_initrd;
+        char *next_initrd, not_last;
 
         mbs.offset_mods = mbs.mb_buf_size;
 
@@ -261,9 +261,9 @@ int load_multiboot(void *fw_cfg,
             int mb_mod_length;
             uint32_t offs = mbs.mb_buf_size;
 
-            next_initrd = strchr(initrd_filename, ',');
-            if (next_initrd)
-                *next_initrd = '\0';
+            next_initrd = (char *)get_opt_value(NULL, 0, initrd_filename);
+            not_last = *next_initrd;
+            *next_initrd = '\0';
             /* if a space comes after the module filename, treat everything
                after that as parameters */
             target_phys_addr_t c = mb_add_cmdline(&mbs, initrd_filename);
@@ -287,7 +287,7 @@ int load_multiboot(void *fw_cfg,
                      (char *)mbs.mb_buf + offs,
                      (char *)mbs.mb_buf + offs + mb_mod_length, c);
             initrd_filename = next_initrd+1;
-        } while (next_initrd);
+        } while (not_last);
     }
 
     /* Commandline support */
-- 
1.7.5.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH] multiboot: Support commas in module parameters
@ 2011-06-17  6:51 Adam Lackorzynski
  2011-06-17 10:53 ` Kevin Wolf
  0 siblings, 1 reply; 7+ messages in thread
From: Adam Lackorzynski @ 2011-06-17  6:51 UTC (permalink / raw)
  To: qemu-devel

Support commas in the parameter list of multiboot modules, by using double
commas (via get_opt_value()).

Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
---
 hw/multiboot.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/hw/multiboot.c b/hw/multiboot.c
index 6e6cfb9..2426e84 100644
--- a/hw/multiboot.c
+++ b/hw/multiboot.c
@@ -97,11 +97,11 @@ typedef struct {
 
 static uint32_t mb_add_cmdline(MultibootState *s, const char *cmdline)
 {
-    int len = strlen(cmdline) + 1;
     target_phys_addr_t p = s->offset_cmdlines;
+    char *b = (char *)s->mb_buf + p;
 
-    pstrcpy((char *)s->mb_buf + p, len, cmdline);
-    s->offset_cmdlines += len;
+    get_opt_value(b, strlen(cmdline) + 1, cmdline);
+    s->offset_cmdlines += strlen(b) + 1;
     return s->mb_buf_phys + p;
 }
 
@@ -238,7 +238,7 @@ int load_multiboot(void *fw_cfg,
         const char *r = initrd_filename;
         mbs.mb_buf_size += strlen(r) + 1;
         mbs.mb_mods_avail = 1;
-        while ((r = strchr(r, ','))) {
+        while (*(r = get_opt_value(NULL, 0, r))) {
            mbs.mb_mods_avail++;
            r++;
         }
@@ -252,7 +252,7 @@ int load_multiboot(void *fw_cfg,
     mbs.offset_cmdlines = mbs.offset_mbinfo + mbs.mb_mods_avail * MB_MOD_SIZE;
 
     if (initrd_filename) {
-        char *next_initrd;
+        char *next_initrd, not_last;
 
         mbs.offset_mods = mbs.mb_buf_size;
 
@@ -261,9 +261,9 @@ int load_multiboot(void *fw_cfg,
             int mb_mod_length;
             uint32_t offs = mbs.mb_buf_size;
 
-            next_initrd = strchr(initrd_filename, ',');
-            if (next_initrd)
-                *next_initrd = '\0';
+            next_initrd = (char *)get_opt_value(NULL, 0, initrd_filename);
+            not_last = *next_initrd;
+            *next_initrd = '\0';
             /* if a space comes after the module filename, treat everything
                after that as parameters */
             target_phys_addr_t c = mb_add_cmdline(&mbs, initrd_filename);
@@ -287,7 +287,7 @@ int load_multiboot(void *fw_cfg,
                      (char *)mbs.mb_buf + offs,
                      (char *)mbs.mb_buf + offs + mb_mod_length, c);
             initrd_filename = next_initrd+1;
-        } while (next_initrd);
+        } while (not_last);
     }
 
     /* Commandline support */
-- 
1.7.5.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] multiboot: Support commas in module parameters
  2011-06-17  6:51 Adam Lackorzynski
@ 2011-06-17 10:53 ` Kevin Wolf
  0 siblings, 0 replies; 7+ messages in thread
From: Kevin Wolf @ 2011-06-17 10:53 UTC (permalink / raw)
  To: Adam Lackorzynski; +Cc: qemu-devel

Am 17.06.2011 08:51, schrieb Adam Lackorzynski:
> Support commas in the parameter list of multiboot modules, by using double
> commas (via get_opt_value()).
> 
> Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>

The one thing the commit message doesn't mention is that this change
requires that commas in -kernel must be escaped by doubling, too.
Anyway, I think this behaviour is acceptable.

Reviewed-by: Kevin Wolf <kwolf@redhat.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH] multiboot: Support commas in module parameters
@ 2011-07-06  8:03 Adam Lackorzynski
  2011-07-23 16:14 ` Anthony Liguori
  0 siblings, 1 reply; 7+ messages in thread
From: Adam Lackorzynski @ 2011-07-06  8:03 UTC (permalink / raw)
  To: qemu-devel

Support commas in the parameter list of multiboot modules as well as for the
kernel command line, by using double commas (via get_opt_value()).

Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/multiboot.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/hw/multiboot.c b/hw/multiboot.c
index 6e6cfb9..2426e84 100644
--- a/hw/multiboot.c
+++ b/hw/multiboot.c
@@ -97,11 +97,11 @@ typedef struct {
 
 static uint32_t mb_add_cmdline(MultibootState *s, const char *cmdline)
 {
-    int len = strlen(cmdline) + 1;
     target_phys_addr_t p = s->offset_cmdlines;
+    char *b = (char *)s->mb_buf + p;
 
-    pstrcpy((char *)s->mb_buf + p, len, cmdline);
-    s->offset_cmdlines += len;
+    get_opt_value(b, strlen(cmdline) + 1, cmdline);
+    s->offset_cmdlines += strlen(b) + 1;
     return s->mb_buf_phys + p;
 }
 
@@ -238,7 +238,7 @@ int load_multiboot(void *fw_cfg,
         const char *r = initrd_filename;
         mbs.mb_buf_size += strlen(r) + 1;
         mbs.mb_mods_avail = 1;
-        while ((r = strchr(r, ','))) {
+        while (*(r = get_opt_value(NULL, 0, r))) {
            mbs.mb_mods_avail++;
            r++;
         }
@@ -252,7 +252,7 @@ int load_multiboot(void *fw_cfg,
     mbs.offset_cmdlines = mbs.offset_mbinfo + mbs.mb_mods_avail * MB_MOD_SIZE;
 
     if (initrd_filename) {
-        char *next_initrd;
+        char *next_initrd, not_last;
 
         mbs.offset_mods = mbs.mb_buf_size;
 
@@ -261,9 +261,9 @@ int load_multiboot(void *fw_cfg,
             int mb_mod_length;
             uint32_t offs = mbs.mb_buf_size;
 
-            next_initrd = strchr(initrd_filename, ',');
-            if (next_initrd)
-                *next_initrd = '\0';
+            next_initrd = (char *)get_opt_value(NULL, 0, initrd_filename);
+            not_last = *next_initrd;
+            *next_initrd = '\0';
             /* if a space comes after the module filename, treat everything
                after that as parameters */
             target_phys_addr_t c = mb_add_cmdline(&mbs, initrd_filename);
@@ -287,7 +287,7 @@ int load_multiboot(void *fw_cfg,
                      (char *)mbs.mb_buf + offs,
                      (char *)mbs.mb_buf + offs + mb_mod_length, c);
             initrd_filename = next_initrd+1;
-        } while (next_initrd);
+        } while (not_last);
     }
 
     /* Commandline support */
-- 
1.7.5.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] multiboot: Support commas in module parameters
  2011-07-06  8:03 [Qemu-devel] [PATCH] multiboot: Support commas in module parameters Adam Lackorzynski
@ 2011-07-23 16:14 ` Anthony Liguori
  0 siblings, 0 replies; 7+ messages in thread
From: Anthony Liguori @ 2011-07-23 16:14 UTC (permalink / raw)
  To: Adam Lackorzynski; +Cc: qemu-devel

On 07/06/2011 03:03 AM, Adam Lackorzynski wrote:
> Support commas in the parameter list of multiboot modules as well as for the
> kernel command line, by using double commas (via get_opt_value()).
>
> Signed-off-by: Adam Lackorzynski<adam@os.inf.tu-dresden.de>
> Reviewed-by: Kevin Wolf<kwolf@redhat.com>

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>   hw/multiboot.c |   18 +++++++++---------
>   1 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/hw/multiboot.c b/hw/multiboot.c
> index 6e6cfb9..2426e84 100644
> --- a/hw/multiboot.c
> +++ b/hw/multiboot.c
> @@ -97,11 +97,11 @@ typedef struct {
>
>   static uint32_t mb_add_cmdline(MultibootState *s, const char *cmdline)
>   {
> -    int len = strlen(cmdline) + 1;
>       target_phys_addr_t p = s->offset_cmdlines;
> +    char *b = (char *)s->mb_buf + p;
>
> -    pstrcpy((char *)s->mb_buf + p, len, cmdline);
> -    s->offset_cmdlines += len;
> +    get_opt_value(b, strlen(cmdline) + 1, cmdline);
> +    s->offset_cmdlines += strlen(b) + 1;
>       return s->mb_buf_phys + p;
>   }
>
> @@ -238,7 +238,7 @@ int load_multiboot(void *fw_cfg,
>           const char *r = initrd_filename;
>           mbs.mb_buf_size += strlen(r) + 1;
>           mbs.mb_mods_avail = 1;
> -        while ((r = strchr(r, ','))) {
> +        while (*(r = get_opt_value(NULL, 0, r))) {
>              mbs.mb_mods_avail++;
>              r++;
>           }
> @@ -252,7 +252,7 @@ int load_multiboot(void *fw_cfg,
>       mbs.offset_cmdlines = mbs.offset_mbinfo + mbs.mb_mods_avail * MB_MOD_SIZE;
>
>       if (initrd_filename) {
> -        char *next_initrd;
> +        char *next_initrd, not_last;
>
>           mbs.offset_mods = mbs.mb_buf_size;
>
> @@ -261,9 +261,9 @@ int load_multiboot(void *fw_cfg,
>               int mb_mod_length;
>               uint32_t offs = mbs.mb_buf_size;
>
> -            next_initrd = strchr(initrd_filename, ',');
> -            if (next_initrd)
> -                *next_initrd = '\0';
> +            next_initrd = (char *)get_opt_value(NULL, 0, initrd_filename);
> +            not_last = *next_initrd;
> +            *next_initrd = '\0';
>               /* if a space comes after the module filename, treat everything
>                  after that as parameters */
>               target_phys_addr_t c = mb_add_cmdline(&mbs, initrd_filename);
> @@ -287,7 +287,7 @@ int load_multiboot(void *fw_cfg,
>                        (char *)mbs.mb_buf + offs,
>                        (char *)mbs.mb_buf + offs + mb_mod_length, c);
>               initrd_filename = next_initrd+1;
> -        } while (next_initrd);
> +        } while (not_last);
>       }
>
>       /* Commandline support */

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-07-23 16:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-06  8:03 [Qemu-devel] [PATCH] multiboot: Support commas in module parameters Adam Lackorzynski
2011-07-23 16:14 ` Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2011-06-17  6:51 Adam Lackorzynski
2011-06-17 10:53 ` Kevin Wolf
2011-05-21  9:35 Adam Lackorzynski
2011-05-01 18:56 Adam Lackorzynski
2011-04-18 21:10 Adam Lackorzynski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).