Patchwork [v4,4/7] qapi: Re-arrange monitor.c functions

login
register
mail settings
Submitter Corey Bryant
Date June 22, 2012, 6:36 p.m.
Message ID <1340390174-7493-5-git-send-email-coreyb@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/166660/
State New
Headers show

Comments

Corey Bryant - June 22, 2012, 6:36 p.m.
Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
---
v4:
 -This patch is new in v4.

 monitor.c |   40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)
Luiz Capitulino - June 26, 2012, 8:45 p.m.
On Fri, 22 Jun 2012 14:36:11 -0400
Corey Bryant <coreyb@linux.vnet.ibm.com> wrote:

> Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
> ---
> v4:
>  -This patch is new in v4.

Can you explain why it's needed?

> 
>  monitor.c |   40 ++++++++++++++++++++--------------------
>  1 file changed, 20 insertions(+), 20 deletions(-)
> 
> diff --git a/monitor.c b/monitor.c
> index 3433c06..153e949 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -2239,26 +2239,6 @@ static int monitor_put_fd(Monitor *mon, const char *fdname, bool replace,
>      return fd;
>  }
>  
> -void qmp_closefd(const char *fdname, Error **errp)
> -{
> -    int fd = monitor_get_fd(cur_mon, fdname, errp);
> -    if (fd != -1) {
> -        close(fd);
> -    }
> -}
> -
> -static void do_loadvm(Monitor *mon, const QDict *qdict)
> -{
> -    int saved_vm_running  = runstate_is_running();
> -    const char *name = qdict_get_str(qdict, "name");
> -
> -    vm_stop(RUN_STATE_RESTORE_VM);
> -
> -    if (load_vmstate(name) == 0 && saved_vm_running) {
> -        vm_start();
> -    }
> -}
> -
>  int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp)
>  {
>      mon_fd_t *monfd;
> @@ -2299,6 +2279,26 @@ void qmp_getfd(const char *fdname, Error **errp)
>      monitor_put_fd(cur_mon, fdname, replace, copy, errp);
>  }
>  
> +void qmp_closefd(const char *fdname, Error **errp)
> +{
> +    int fd = monitor_get_fd(cur_mon, fdname, errp);
> +    if (fd != -1) {
> +        close(fd);
> +    }
> +}
> +
> +static void do_loadvm(Monitor *mon, const QDict *qdict)
> +{
> +    int saved_vm_running  = runstate_is_running();
> +    const char *name = qdict_get_str(qdict, "name");
> +
> +    vm_stop(RUN_STATE_RESTORE_VM);
> +
> +    if (load_vmstate(name) == 0 && saved_vm_running) {
> +        vm_start();
> +    }
> +}
> +
>  /* mon_cmds and info_cmds would be sorted at runtime */
>  static mon_cmd_t mon_cmds[] = {
>  #include "hmp-commands.h"
Corey Bryant - June 26, 2012, 9:16 p.m.
On 06/26/2012 04:45 PM, Luiz Capitulino wrote:
> On Fri, 22 Jun 2012 14:36:11 -0400
> Corey Bryant <coreyb@linux.vnet.ibm.com> wrote:
>
>> Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
>> ---
>> v4:
>>   -This patch is new in v4.
>
> Can you explain why it's needed?
>

This just made patch 3/7 easier to review.

>>
>>   monitor.c |   40 ++++++++++++++++++++--------------------
>>   1 file changed, 20 insertions(+), 20 deletions(-)
>>
>> diff --git a/monitor.c b/monitor.c
>> index 3433c06..153e949 100644
>> --- a/monitor.c
>> +++ b/monitor.c
>> @@ -2239,26 +2239,6 @@ static int monitor_put_fd(Monitor *mon, const char *fdname, bool replace,
>>       return fd;
>>   }
>>
>> -void qmp_closefd(const char *fdname, Error **errp)
>> -{
>> -    int fd = monitor_get_fd(cur_mon, fdname, errp);
>> -    if (fd != -1) {
>> -        close(fd);
>> -    }
>> -}
>> -
>> -static void do_loadvm(Monitor *mon, const QDict *qdict)
>> -{
>> -    int saved_vm_running  = runstate_is_running();
>> -    const char *name = qdict_get_str(qdict, "name");
>> -
>> -    vm_stop(RUN_STATE_RESTORE_VM);
>> -
>> -    if (load_vmstate(name) == 0 && saved_vm_running) {
>> -        vm_start();
>> -    }
>> -}
>> -
>>   int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp)
>>   {
>>       mon_fd_t *monfd;
>> @@ -2299,6 +2279,26 @@ void qmp_getfd(const char *fdname, Error **errp)
>>       monitor_put_fd(cur_mon, fdname, replace, copy, errp);
>>   }
>>
>> +void qmp_closefd(const char *fdname, Error **errp)
>> +{
>> +    int fd = monitor_get_fd(cur_mon, fdname, errp);
>> +    if (fd != -1) {
>> +        close(fd);
>> +    }
>> +}
>> +
>> +static void do_loadvm(Monitor *mon, const QDict *qdict)
>> +{
>> +    int saved_vm_running  = runstate_is_running();
>> +    const char *name = qdict_get_str(qdict, "name");
>> +
>> +    vm_stop(RUN_STATE_RESTORE_VM);
>> +
>> +    if (load_vmstate(name) == 0 && saved_vm_running) {
>> +        vm_start();
>> +    }
>> +}
>> +
>>   /* mon_cmds and info_cmds would be sorted at runtime */
>>   static mon_cmd_t mon_cmds[] = {
>>   #include "hmp-commands.h"
>
>
Luiz Capitulino - June 26, 2012, 9:28 p.m.
On Tue, 26 Jun 2012 17:16:28 -0400
Corey Bryant <coreyb@linux.vnet.ibm.com> wrote:

> 
> 
> On 06/26/2012 04:45 PM, Luiz Capitulino wrote:
> > On Fri, 22 Jun 2012 14:36:11 -0400
> > Corey Bryant <coreyb@linux.vnet.ibm.com> wrote:
> >
> >> Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
> >> ---
> >> v4:
> >>   -This patch is new in v4.
> >
> > Can you explain why it's needed?
> >
> 
> This just made patch 3/7 easier to review.

Better to explain it then and move it to before that patch.

> 
> >>
> >>   monitor.c |   40 ++++++++++++++++++++--------------------
> >>   1 file changed, 20 insertions(+), 20 deletions(-)
> >>
> >> diff --git a/monitor.c b/monitor.c
> >> index 3433c06..153e949 100644
> >> --- a/monitor.c
> >> +++ b/monitor.c
> >> @@ -2239,26 +2239,6 @@ static int monitor_put_fd(Monitor *mon, const char *fdname, bool replace,
> >>       return fd;
> >>   }
> >>
> >> -void qmp_closefd(const char *fdname, Error **errp)
> >> -{
> >> -    int fd = monitor_get_fd(cur_mon, fdname, errp);
> >> -    if (fd != -1) {
> >> -        close(fd);
> >> -    }
> >> -}
> >> -
> >> -static void do_loadvm(Monitor *mon, const QDict *qdict)
> >> -{
> >> -    int saved_vm_running  = runstate_is_running();
> >> -    const char *name = qdict_get_str(qdict, "name");
> >> -
> >> -    vm_stop(RUN_STATE_RESTORE_VM);
> >> -
> >> -    if (load_vmstate(name) == 0 && saved_vm_running) {
> >> -        vm_start();
> >> -    }
> >> -}
> >> -
> >>   int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp)
> >>   {
> >>       mon_fd_t *monfd;
> >> @@ -2299,6 +2279,26 @@ void qmp_getfd(const char *fdname, Error **errp)
> >>       monitor_put_fd(cur_mon, fdname, replace, copy, errp);
> >>   }
> >>
> >> +void qmp_closefd(const char *fdname, Error **errp)
> >> +{
> >> +    int fd = monitor_get_fd(cur_mon, fdname, errp);
> >> +    if (fd != -1) {
> >> +        close(fd);
> >> +    }
> >> +}
> >> +
> >> +static void do_loadvm(Monitor *mon, const QDict *qdict)
> >> +{
> >> +    int saved_vm_running  = runstate_is_running();
> >> +    const char *name = qdict_get_str(qdict, "name");
> >> +
> >> +    vm_stop(RUN_STATE_RESTORE_VM);
> >> +
> >> +    if (load_vmstate(name) == 0 && saved_vm_running) {
> >> +        vm_start();
> >> +    }
> >> +}
> >> +
> >>   /* mon_cmds and info_cmds would be sorted at runtime */
> >>   static mon_cmd_t mon_cmds[] = {
> >>   #include "hmp-commands.h"
> >
> >
>
Corey Bryant - June 26, 2012, 9:55 p.m.
On 06/26/2012 05:28 PM, Luiz Capitulino wrote:
> On Tue, 26 Jun 2012 17:16:28 -0400
> Corey Bryant <coreyb@linux.vnet.ibm.com> wrote:
>
>>
>>
>> On 06/26/2012 04:45 PM, Luiz Capitulino wrote:
>>> On Fri, 22 Jun 2012 14:36:11 -0400
>>> Corey Bryant <coreyb@linux.vnet.ibm.com> wrote:
>>>
>>>> Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
>>>> ---
>>>> v4:
>>>>    -This patch is new in v4.
>>>
>>> Can you explain why it's needed?
>>>
>>
>> This just made patch 3/7 easier to review.
>
> Better to explain it then and move it to before that patch.
>

Sure, I can do that.

>>
>>>>
>>>>    monitor.c |   40 ++++++++++++++++++++--------------------
>>>>    1 file changed, 20 insertions(+), 20 deletions(-)
>>>>
>>>> diff --git a/monitor.c b/monitor.c
>>>> index 3433c06..153e949 100644
>>>> --- a/monitor.c
>>>> +++ b/monitor.c
>>>> @@ -2239,26 +2239,6 @@ static int monitor_put_fd(Monitor *mon, const char *fdname, bool replace,
>>>>        return fd;
>>>>    }
>>>>
>>>> -void qmp_closefd(const char *fdname, Error **errp)
>>>> -{
>>>> -    int fd = monitor_get_fd(cur_mon, fdname, errp);
>>>> -    if (fd != -1) {
>>>> -        close(fd);
>>>> -    }
>>>> -}
>>>> -
>>>> -static void do_loadvm(Monitor *mon, const QDict *qdict)
>>>> -{
>>>> -    int saved_vm_running  = runstate_is_running();
>>>> -    const char *name = qdict_get_str(qdict, "name");
>>>> -
>>>> -    vm_stop(RUN_STATE_RESTORE_VM);
>>>> -
>>>> -    if (load_vmstate(name) == 0 && saved_vm_running) {
>>>> -        vm_start();
>>>> -    }
>>>> -}
>>>> -
>>>>    int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp)
>>>>    {
>>>>        mon_fd_t *monfd;
>>>> @@ -2299,6 +2279,26 @@ void qmp_getfd(const char *fdname, Error **errp)
>>>>        monitor_put_fd(cur_mon, fdname, replace, copy, errp);
>>>>    }
>>>>
>>>> +void qmp_closefd(const char *fdname, Error **errp)
>>>> +{
>>>> +    int fd = monitor_get_fd(cur_mon, fdname, errp);
>>>> +    if (fd != -1) {
>>>> +        close(fd);
>>>> +    }
>>>> +}
>>>> +
>>>> +static void do_loadvm(Monitor *mon, const QDict *qdict)
>>>> +{
>>>> +    int saved_vm_running  = runstate_is_running();
>>>> +    const char *name = qdict_get_str(qdict, "name");
>>>> +
>>>> +    vm_stop(RUN_STATE_RESTORE_VM);
>>>> +
>>>> +    if (load_vmstate(name) == 0 && saved_vm_running) {
>>>> +        vm_start();
>>>> +    }
>>>> +}
>>>> +
>>>>    /* mon_cmds and info_cmds would be sorted at runtime */
>>>>    static mon_cmd_t mon_cmds[] = {
>>>>    #include "hmp-commands.h"
>>>
>>>
>>
>
>

Patch

diff --git a/monitor.c b/monitor.c
index 3433c06..153e949 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2239,26 +2239,6 @@  static int monitor_put_fd(Monitor *mon, const char *fdname, bool replace,
     return fd;
 }
 
-void qmp_closefd(const char *fdname, Error **errp)
-{
-    int fd = monitor_get_fd(cur_mon, fdname, errp);
-    if (fd != -1) {
-        close(fd);
-    }
-}
-
-static void do_loadvm(Monitor *mon, const QDict *qdict)
-{
-    int saved_vm_running  = runstate_is_running();
-    const char *name = qdict_get_str(qdict, "name");
-
-    vm_stop(RUN_STATE_RESTORE_VM);
-
-    if (load_vmstate(name) == 0 && saved_vm_running) {
-        vm_start();
-    }
-}
-
 int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp)
 {
     mon_fd_t *monfd;
@@ -2299,6 +2279,26 @@  void qmp_getfd(const char *fdname, Error **errp)
     monitor_put_fd(cur_mon, fdname, replace, copy, errp);
 }
 
+void qmp_closefd(const char *fdname, Error **errp)
+{
+    int fd = monitor_get_fd(cur_mon, fdname, errp);
+    if (fd != -1) {
+        close(fd);
+    }
+}
+
+static void do_loadvm(Monitor *mon, const QDict *qdict)
+{
+    int saved_vm_running  = runstate_is_running();
+    const char *name = qdict_get_str(qdict, "name");
+
+    vm_stop(RUN_STATE_RESTORE_VM);
+
+    if (load_vmstate(name) == 0 && saved_vm_running) {
+        vm_start();
+    }
+}
+
 /* mon_cmds and info_cmds would be sorted at runtime */
 static mon_cmd_t mon_cmds[] = {
 #include "hmp-commands.h"