diff mbox series

[v3,03/13] monitor/hmp: rename device-hotplug.c to block/monitor/block-hmp-cmds.c

Message ID 20200127103647.17761-4-mlevitsk@redhat.com
State New
Headers show
Series RFC: [for 5.0]: HMP monitor handlers cleanups | expand

Commit Message

Maxim Levitsky Jan. 27, 2020, 10:36 a.m. UTC
These days device-hotplug.c only contains the hmp_drive_add
In the next patch, rest of hmp_drive* functions will be moved
there.

Also change the license of that file to GPL2+ since most
of the code that will be moved there is under that license

Also add block-hmp-commands.h to contain prototypes of these
functions

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
---
 MAINTAINERS                                   |  1 +
 Makefile.objs                                 |  2 +-
 block/Makefile.objs                           |  1 +
 block/monitor/Makefile.objs                   |  1 +
 .../monitor/block-hmp-cmds.c                  | 23 ++++---------------
 include/block/block-hmp-commands.h            |  8 +++++++
 include/sysemu/sysemu.h                       |  3 ---
 monitor/misc.c                                |  1 +
 8 files changed, 18 insertions(+), 22 deletions(-)
 create mode 100644 block/monitor/Makefile.objs
 rename device-hotplug.c => block/monitor/block-hmp-cmds.c (55%)
 create mode 100644 include/block/block-hmp-commands.h

Comments

Dr. David Alan Gilbert Jan. 28, 2020, 4:56 p.m. UTC | #1
* Maxim Levitsky (mlevitsk@redhat.com) wrote:
> These days device-hotplug.c only contains the hmp_drive_add
> In the next patch, rest of hmp_drive* functions will be moved
> there.
> 
> Also change the license of that file to GPL2+ since most
> of the code that will be moved there is under that license

How do we check that's OK?

> Also add block-hmp-commands.h to contain prototypes of these
> functions
> 
> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> ---
>  MAINTAINERS                                   |  1 +
>  Makefile.objs                                 |  2 +-
>  block/Makefile.objs                           |  1 +
>  block/monitor/Makefile.objs                   |  1 +
>  .../monitor/block-hmp-cmds.c                  | 23 ++++---------------
>  include/block/block-hmp-commands.h            |  8 +++++++
>  include/sysemu/sysemu.h                       |  3 ---
>  monitor/misc.c                                |  1 +
>  8 files changed, 18 insertions(+), 22 deletions(-)
>  create mode 100644 block/monitor/Makefile.objs
>  rename device-hotplug.c => block/monitor/block-hmp-cmds.c (55%)
>  create mode 100644 include/block/block-hmp-commands.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index f6511d5120..5d50d09ad8 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1882,6 +1882,7 @@ Block QAPI, monitor, command line
>  M: Markus Armbruster <armbru@redhat.com>
>  S: Supported
>  F: blockdev.c
> +F: blockdev-hmp-cmds.c
>  F: block/qapi.c
>  F: qapi/block*.json
>  F: qapi/transaction.json
> diff --git a/Makefile.objs b/Makefile.objs
> index ff396b9209..15209eb6b5 100644
> --- a/Makefile.objs
> +++ b/Makefile.objs
> @@ -48,7 +48,7 @@ common-obj-y += dump/
>  common-obj-y += job-qmp.o
>  common-obj-y += monitor/
>  common-obj-y += net/
> -common-obj-y += qdev-monitor.o device-hotplug.o
> +common-obj-y += qdev-monitor.o
>  common-obj-$(CONFIG_WIN32) += os-win32.o
>  common-obj-$(CONFIG_POSIX) += os-posix.o
>  
> diff --git a/block/Makefile.objs b/block/Makefile.objs
> index 330529b0b7..3f65544a6b 100644
> --- a/block/Makefile.objs
> +++ b/block/Makefile.objs
> @@ -44,6 +44,7 @@ block-obj-y += crypto.o
>  block-obj-y += aio_task.o
>  block-obj-y += backup-top.o
>  block-obj-y += filter-compress.o
> +common-obj-y += monitor/
>  
>  common-obj-y += stream.o
>  
> diff --git a/block/monitor/Makefile.objs b/block/monitor/Makefile.objs
> new file mode 100644
> index 0000000000..0a74f9a8b5
> --- /dev/null
> +++ b/block/monitor/Makefile.objs
> @@ -0,0 +1 @@
> +common-obj-y += block-hmp-cmds.o
> diff --git a/device-hotplug.c b/block/monitor/block-hmp-cmds.c
> similarity index 55%
> rename from device-hotplug.c
> rename to block/monitor/block-hmp-cmds.c
> index 554e4d98db..c65aaa86ea 100644
> --- a/device-hotplug.c
> +++ b/block/monitor/block-hmp-cmds.c
> @@ -1,25 +1,11 @@
>  /*
> - * QEMU device hotplug helpers
> + * Blockdev HMP commands
>   *
>   * Copyright (c) 2004 Fabrice Bellard
>   *
> - * Permission is hereby granted, free of charge, to any person obtaining a copy
> - * of this software and associated documentation files (the "Software"), to deal
> - * in the Software without restriction, including without limitation the rights
> - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> - * copies of the Software, and to permit persons to whom the Software is
> - * furnished to do so, subject to the following conditions:
> - *
> - * The above copyright notice and this permission notice shall be included in
> - * all copies or substantial portions of the Software.
> - *
> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> - * THE SOFTWARE.
> + * This work is licensed under the terms of the GNU GPL, version 2.
> + * or (at your option) any later version.
> + * See the COPYING file in the top-level directory.
>   */
>  
>  #include "qemu/osdep.h"
> @@ -33,6 +19,7 @@
>  #include "sysemu/sysemu.h"
>  #include "monitor/monitor.h"
>  #include "block/block_int.h"
> +#include "block/block-hmp-commands.h"
>  
>  
>  void hmp_drive_add(Monitor *mon, const QDict *qdict)
> diff --git a/include/block/block-hmp-commands.h b/include/block/block-hmp-commands.h
> new file mode 100644
> index 0000000000..4f9033a8a6
> --- /dev/null
> +++ b/include/block/block-hmp-commands.h
> @@ -0,0 +1,8 @@
> +#ifndef BLOCK_HMP_COMMANDS_H
> +#define BLOCK_HMP_COMMANDS_H
> +
> +/* HMP commands related to the block layer*/

Should this file get a copyright header as well?

> +
> +void hmp_drive_add(Monitor *mon, const QDict *qdict);
> +
> +#endif
> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> index 80c57fdc4e..c48635666d 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -68,9 +68,6 @@ extern int nb_option_roms;
>  extern const char *prom_envs[MAX_PROM_ENVS];
>  extern unsigned int nb_prom_envs;
>  
> -/* generic hotplug */
> -void hmp_drive_add(Monitor *mon, const QDict *qdict);
> -
>  /* pcie aer error injection */
>  void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict);
>  
> diff --git a/monitor/misc.c b/monitor/misc.c
> index de1ca4d114..0466c00830 100644
> --- a/monitor/misc.c
> +++ b/monitor/misc.c
> @@ -79,6 +79,7 @@
>  #include "sysemu/cpus.h"
>  #include "qemu/cutils.h"
>  #include "tcg/tcg.h"
> +#include "block/block-hmp-commands.h"
>  
>  #if defined(TARGET_S390X)
>  #include "hw/s390x/storage-keys.h"
> -- 
> 2.17.2
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
Maxim Levitsky Jan. 28, 2020, 7:28 p.m. UTC | #2
On Tue, 2020-01-28 at 16:56 +0000, Dr. David Alan Gilbert wrote:
> * Maxim Levitsky (mlevitsk@redhat.com) wrote:
> > These days device-hotplug.c only contains the hmp_drive_add
> > In the next patch, rest of hmp_drive* functions will be moved
> > there.
> > 
> > Also change the license of that file to GPL2+ since most
> > of the code that will be moved there is under that license
> 
> How do we check that's OK?

Currently that code is BSD licensed, and in next patches I will move
here GPLv2+ code, and as far as I know combining them gives you GPLv2+

I wasn't even aware that we have mixed licenses, and so this change was done
after Markus pointed this out in the previous patchset review.

Best regards,
	Maxim Levitsky

> 
> > Also add block-hmp-commands.h to contain prototypes of these
> > functions
> > 
> > Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> > ---
> >  MAINTAINERS                                   |  1 +
> >  Makefile.objs                                 |  2 +-
> >  block/Makefile.objs                           |  1 +
> >  block/monitor/Makefile.objs                   |  1 +
> >  .../monitor/block-hmp-cmds.c                  | 23 ++++---------------
> >  include/block/block-hmp-commands.h            |  8 +++++++
> >  include/sysemu/sysemu.h                       |  3 ---
> >  monitor/misc.c                                |  1 +
> >  8 files changed, 18 insertions(+), 22 deletions(-)
> >  create mode 100644 block/monitor/Makefile.objs
> >  rename device-hotplug.c => block/monitor/block-hmp-cmds.c (55%)
> >  create mode 100644 include/block/block-hmp-commands.h
> > 
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index f6511d5120..5d50d09ad8 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -1882,6 +1882,7 @@ Block QAPI, monitor, command line
> >  M: Markus Armbruster <armbru@redhat.com>
> >  S: Supported
> >  F: blockdev.c
> > +F: blockdev-hmp-cmds.c
> >  F: block/qapi.c
> >  F: qapi/block*.json
> >  F: qapi/transaction.json
> > diff --git a/Makefile.objs b/Makefile.objs
> > index ff396b9209..15209eb6b5 100644
> > --- a/Makefile.objs
> > +++ b/Makefile.objs
> > @@ -48,7 +48,7 @@ common-obj-y += dump/
> >  common-obj-y += job-qmp.o
> >  common-obj-y += monitor/
> >  common-obj-y += net/
> > -common-obj-y += qdev-monitor.o device-hotplug.o
> > +common-obj-y += qdev-monitor.o
> >  common-obj-$(CONFIG_WIN32) += os-win32.o
> >  common-obj-$(CONFIG_POSIX) += os-posix.o
> >  
> > diff --git a/block/Makefile.objs b/block/Makefile.objs
> > index 330529b0b7..3f65544a6b 100644
> > --- a/block/Makefile.objs
> > +++ b/block/Makefile.objs
> > @@ -44,6 +44,7 @@ block-obj-y += crypto.o
> >  block-obj-y += aio_task.o
> >  block-obj-y += backup-top.o
> >  block-obj-y += filter-compress.o
> > +common-obj-y += monitor/
> >  
> >  common-obj-y += stream.o
> >  
> > diff --git a/block/monitor/Makefile.objs b/block/monitor/Makefile.objs
> > new file mode 100644
> > index 0000000000..0a74f9a8b5
> > --- /dev/null
> > +++ b/block/monitor/Makefile.objs
> > @@ -0,0 +1 @@
> > +common-obj-y += block-hmp-cmds.o
> > diff --git a/device-hotplug.c b/block/monitor/block-hmp-cmds.c
> > similarity index 55%
> > rename from device-hotplug.c
> > rename to block/monitor/block-hmp-cmds.c
> > index 554e4d98db..c65aaa86ea 100644
> > --- a/device-hotplug.c
> > +++ b/block/monitor/block-hmp-cmds.c
> > @@ -1,25 +1,11 @@
> >  /*
> > - * QEMU device hotplug helpers
> > + * Blockdev HMP commands
> >   *
> >   * Copyright (c) 2004 Fabrice Bellard
> >   *
> > - * Permission is hereby granted, free of charge, to any person obtaining a copy
> > - * of this software and associated documentation files (the "Software"), to deal
> > - * in the Software without restriction, including without limitation the rights
> > - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > - * copies of the Software, and to permit persons to whom the Software is
> > - * furnished to do so, subject to the following conditions:
> > - *
> > - * The above copyright notice and this permission notice shall be included in
> > - * all copies or substantial portions of the Software.
> > - *
> > - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> > - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> > - * THE SOFTWARE.
> > + * This work is licensed under the terms of the GNU GPL, version 2.
> > + * or (at your option) any later version.
> > + * See the COPYING file in the top-level directory.
> >   */
> >  
> >  #include "qemu/osdep.h"
> > @@ -33,6 +19,7 @@
> >  #include "sysemu/sysemu.h"
> >  #include "monitor/monitor.h"
> >  #include "block/block_int.h"
> > +#include "block/block-hmp-commands.h"
> >  
> >  
> >  void hmp_drive_add(Monitor *mon, const QDict *qdict)
> > diff --git a/include/block/block-hmp-commands.h b/include/block/block-hmp-commands.h
> > new file mode 100644
> > index 0000000000..4f9033a8a6
> > --- /dev/null
> > +++ b/include/block/block-hmp-commands.h
> > @@ -0,0 +1,8 @@
> > +#ifndef BLOCK_HMP_COMMANDS_H
> > +#define BLOCK_HMP_COMMANDS_H
> > +
> > +/* HMP commands related to the block layer*/
> 
> Should this file get a copyright header as well?
> 
> > +
> > +void hmp_drive_add(Monitor *mon, const QDict *qdict);
> > +
> > +#endif
> > diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> > index 80c57fdc4e..c48635666d 100644
> > --- a/include/sysemu/sysemu.h
> > +++ b/include/sysemu/sysemu.h
> > @@ -68,9 +68,6 @@ extern int nb_option_roms;
> >  extern const char *prom_envs[MAX_PROM_ENVS];
> >  extern unsigned int nb_prom_envs;
> >  
> > -/* generic hotplug */
> > -void hmp_drive_add(Monitor *mon, const QDict *qdict);
> > -
> >  /* pcie aer error injection */
> >  void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict);
> >  
> > diff --git a/monitor/misc.c b/monitor/misc.c
> > index de1ca4d114..0466c00830 100644
> > --- a/monitor/misc.c
> > +++ b/monitor/misc.c
> > @@ -79,6 +79,7 @@
> >  #include "sysemu/cpus.h"
> >  #include "qemu/cutils.h"
> >  #include "tcg/tcg.h"
> > +#include "block/block-hmp-commands.h"
> >  
> >  #if defined(TARGET_S390X)
> >  #include "hw/s390x/storage-keys.h"
> > -- 
> > 2.17.2
> > 
> 
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
Markus Armbruster Jan. 29, 2020, 10:19 a.m. UTC | #3
Maxim Levitsky <mlevitsk@redhat.com> writes:

> On Tue, 2020-01-28 at 16:56 +0000, Dr. David Alan Gilbert wrote:
>> * Maxim Levitsky (mlevitsk@redhat.com) wrote:
>> > These days device-hotplug.c only contains the hmp_drive_add
>> > In the next patch, rest of hmp_drive* functions will be moved
>> > there.
>> > 
>> > Also change the license of that file to GPL2+ since most
>> > of the code that will be moved there is under that license
>> 
>> How do we check that's OK?
>
> Currently that code is BSD licensed, and in next patches I will move
> here GPLv2+ code, and as far as I know combining them gives you GPLv2+

Yes, it does.

I'd change the license in the patch that moves in GPLv2+ code.

> I wasn't even aware that we have mixed licenses, and so this change was done
> after Markus pointed this out in the previous patchset review.
>
> Best regards,
> 	Maxim Levitsky
>
>> 
>> > Also add block-hmp-commands.h to contain prototypes of these
>> > functions
>> > 
>> > Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
>> > ---
>> >  MAINTAINERS                                   |  1 +
>> >  Makefile.objs                                 |  2 +-
>> >  block/Makefile.objs                           |  1 +
>> >  block/monitor/Makefile.objs                   |  1 +
>> >  .../monitor/block-hmp-cmds.c                  | 23 ++++---------------
>> >  include/block/block-hmp-commands.h            |  8 +++++++
>> >  include/sysemu/sysemu.h                       |  3 ---
>> >  monitor/misc.c                                |  1 +
>> >  8 files changed, 18 insertions(+), 22 deletions(-)
>> >  create mode 100644 block/monitor/Makefile.objs
>> >  rename device-hotplug.c => block/monitor/block-hmp-cmds.c (55%)
>> >  create mode 100644 include/block/block-hmp-commands.h
>> > 
>> > diff --git a/MAINTAINERS b/MAINTAINERS
>> > index f6511d5120..5d50d09ad8 100644
>> > --- a/MAINTAINERS
>> > +++ b/MAINTAINERS
>> > @@ -1882,6 +1882,7 @@ Block QAPI, monitor, command line
>> >  M: Markus Armbruster <armbru@redhat.com>
>> >  S: Supported
>> >  F: blockdev.c
>> > +F: blockdev-hmp-cmds.c
>> >  F: block/qapi.c
>> >  F: qapi/block*.json
>> >  F: qapi/transaction.json
>> > diff --git a/Makefile.objs b/Makefile.objs
>> > index ff396b9209..15209eb6b5 100644
>> > --- a/Makefile.objs
>> > +++ b/Makefile.objs
>> > @@ -48,7 +48,7 @@ common-obj-y += dump/
>> >  common-obj-y += job-qmp.o
>> >  common-obj-y += monitor/
>> >  common-obj-y += net/
>> > -common-obj-y += qdev-monitor.o device-hotplug.o
>> > +common-obj-y += qdev-monitor.o
>> >  common-obj-$(CONFIG_WIN32) += os-win32.o
>> >  common-obj-$(CONFIG_POSIX) += os-posix.o
>> >  
>> > diff --git a/block/Makefile.objs b/block/Makefile.objs
>> > index 330529b0b7..3f65544a6b 100644
>> > --- a/block/Makefile.objs
>> > +++ b/block/Makefile.objs
>> > @@ -44,6 +44,7 @@ block-obj-y += crypto.o
>> >  block-obj-y += aio_task.o
>> >  block-obj-y += backup-top.o
>> >  block-obj-y += filter-compress.o
>> > +common-obj-y += monitor/
>> >  
>> >  common-obj-y += stream.o
>> >  
>> > diff --git a/block/monitor/Makefile.objs b/block/monitor/Makefile.objs
>> > new file mode 100644
>> > index 0000000000..0a74f9a8b5
>> > --- /dev/null
>> > +++ b/block/monitor/Makefile.objs
>> > @@ -0,0 +1 @@
>> > +common-obj-y += block-hmp-cmds.o
>> > diff --git a/device-hotplug.c b/block/monitor/block-hmp-cmds.c
>> > similarity index 55%
>> > rename from device-hotplug.c
>> > rename to block/monitor/block-hmp-cmds.c
>> > index 554e4d98db..c65aaa86ea 100644
>> > --- a/device-hotplug.c
>> > +++ b/block/monitor/block-hmp-cmds.c
>> > @@ -1,25 +1,11 @@
>> >  /*
>> > - * QEMU device hotplug helpers
>> > + * Blockdev HMP commands
>> >   *
>> >   * Copyright (c) 2004 Fabrice Bellard
>> >   *
>> > - * Permission is hereby granted, free of charge, to any person obtaining a copy
>> > - * of this software and associated documentation files (the "Software"), to deal
>> > - * in the Software without restriction, including without limitation the rights
>> > - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
>> > - * copies of the Software, and to permit persons to whom the Software is
>> > - * furnished to do so, subject to the following conditions:
>> > - *
>> > - * The above copyright notice and this permission notice shall be included in
>> > - * all copies or substantial portions of the Software.
>> > - *
>> > - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
>> > - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>> > - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
>> > - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
>> > - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
>> > - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
>> > - * THE SOFTWARE.
>> > + * This work is licensed under the terms of the GNU GPL, version 2.
>> > + * or (at your option) any later version.
>> > + * See the COPYING file in the top-level directory.
>> >   */
>> >  
>> >  #include "qemu/osdep.h"
>> > @@ -33,6 +19,7 @@
>> >  #include "sysemu/sysemu.h"
>> >  #include "monitor/monitor.h"
>> >  #include "block/block_int.h"
>> > +#include "block/block-hmp-commands.h"
>> >  
>> >  
>> >  void hmp_drive_add(Monitor *mon, const QDict *qdict)
>> > diff --git a/include/block/block-hmp-commands.h b/include/block/block-hmp-commands.h
>> > new file mode 100644
>> > index 0000000000..4f9033a8a6
>> > --- /dev/null
>> > +++ b/include/block/block-hmp-commands.h
>> > @@ -0,0 +1,8 @@
>> > +#ifndef BLOCK_HMP_COMMANDS_H
>> > +#define BLOCK_HMP_COMMANDS_H
>> > +
>> > +/* HMP commands related to the block layer*/

Space before */, please.

>> Should this file get a copyright header as well?

I think it should.

>> > +
>> > +void hmp_drive_add(Monitor *mon, const QDict *qdict);
>> > +
>> > +#endif
>> > diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
>> > index 80c57fdc4e..c48635666d 100644
>> > --- a/include/sysemu/sysemu.h
>> > +++ b/include/sysemu/sysemu.h
>> > @@ -68,9 +68,6 @@ extern int nb_option_roms;
>> >  extern const char *prom_envs[MAX_PROM_ENVS];
>> >  extern unsigned int nb_prom_envs;
>> >  
>> > -/* generic hotplug */
>> > -void hmp_drive_add(Monitor *mon, const QDict *qdict);
>> > -
>> >  /* pcie aer error injection */
>> >  void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict);
>> >  
>> > diff --git a/monitor/misc.c b/monitor/misc.c
>> > index de1ca4d114..0466c00830 100644
>> > --- a/monitor/misc.c
>> > +++ b/monitor/misc.c
>> > @@ -79,6 +79,7 @@
>> >  #include "sysemu/cpus.h"
>> >  #include "qemu/cutils.h"
>> >  #include "tcg/tcg.h"
>> > +#include "block/block-hmp-commands.h"

Put this next to #include "block/qapi.h", please.

>> >  
>> >  #if defined(TARGET_S390X)
>> >  #include "hw/s390x/storage-keys.h"
>> > -- 
>> > 2.17.2
>> > 

Preferably with my nitpicks addressed:
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Maxim Levitsky Jan. 29, 2020, 11:31 a.m. UTC | #4
On Wed, 2020-01-29 at 11:19 +0100, Markus Armbruster wrote:
> Maxim Levitsky <mlevitsk@redhat.com> writes:
> 
> > On Tue, 2020-01-28 at 16:56 +0000, Dr. David Alan Gilbert wrote:
> > > * Maxim Levitsky (mlevitsk@redhat.com) wrote:
> > > > These days device-hotplug.c only contains the hmp_drive_add
> > > > In the next patch, rest of hmp_drive* functions will be moved
> > > > there.
> > > > 
> > > > Also change the license of that file to GPL2+ since most
> > > > of the code that will be moved there is under that license
> > > 
> > > How do we check that's OK?
> > 
> > Currently that code is BSD licensed, and in next patches I will move
> > here GPLv2+ code, and as far as I know combining them gives you GPLv2+
> 
> Yes, it does.
> 
> I'd change the license in the patch that moves in GPLv2+ code.

All right.
> 
> > I wasn't even aware that we have mixed licenses, and so this change was done
> > after Markus pointed this out in the previous patchset review.
> > 
> > Best regards,
> > 	Maxim Levitsky
> > 
> > > 
> > > > Also add block-hmp-commands.h to contain prototypes of these
> > > > functions
> > > > 
> > > > Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> > > > ---
> > > >  MAINTAINERS                                   |  1 +
> > > >  Makefile.objs                                 |  2 +-
> > > >  block/Makefile.objs                           |  1 +
> > > >  block/monitor/Makefile.objs                   |  1 +
> > > >  .../monitor/block-hmp-cmds.c                  | 23 ++++---------------
> > > >  include/block/block-hmp-commands.h            |  8 +++++++
> > > >  include/sysemu/sysemu.h                       |  3 ---
> > > >  monitor/misc.c                                |  1 +
> > > >  8 files changed, 18 insertions(+), 22 deletions(-)
> > > >  create mode 100644 block/monitor/Makefile.objs
> > > >  rename device-hotplug.c => block/monitor/block-hmp-cmds.c (55%)
> > > >  create mode 100644 include/block/block-hmp-commands.h
> > > > 
> > > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > > index f6511d5120..5d50d09ad8 100644
> > > > --- a/MAINTAINERS
> > > > +++ b/MAINTAINERS
> > > > @@ -1882,6 +1882,7 @@ Block QAPI, monitor, command line
> > > >  M: Markus Armbruster <armbru@redhat.com>
> > > >  S: Supported
> > > >  F: blockdev.c
> > > > +F: blockdev-hmp-cmds.c
> > > >  F: block/qapi.c
> > > >  F: qapi/block*.json
> > > >  F: qapi/transaction.json
> > > > diff --git a/Makefile.objs b/Makefile.objs
> > > > index ff396b9209..15209eb6b5 100644
> > > > --- a/Makefile.objs
> > > > +++ b/Makefile.objs
> > > > @@ -48,7 +48,7 @@ common-obj-y += dump/
> > > >  common-obj-y += job-qmp.o
> > > >  common-obj-y += monitor/
> > > >  common-obj-y += net/
> > > > -common-obj-y += qdev-monitor.o device-hotplug.o
> > > > +common-obj-y += qdev-monitor.o
> > > >  common-obj-$(CONFIG_WIN32) += os-win32.o
> > > >  common-obj-$(CONFIG_POSIX) += os-posix.o
> > > >  
> > > > diff --git a/block/Makefile.objs b/block/Makefile.objs
> > > > index 330529b0b7..3f65544a6b 100644
> > > > --- a/block/Makefile.objs
> > > > +++ b/block/Makefile.objs
> > > > @@ -44,6 +44,7 @@ block-obj-y += crypto.o
> > > >  block-obj-y += aio_task.o
> > > >  block-obj-y += backup-top.o
> > > >  block-obj-y += filter-compress.o
> > > > +common-obj-y += monitor/
> > > >  
> > > >  common-obj-y += stream.o
> > > >  
> > > > diff --git a/block/monitor/Makefile.objs b/block/monitor/Makefile.objs
> > > > new file mode 100644
> > > > index 0000000000..0a74f9a8b5
> > > > --- /dev/null
> > > > +++ b/block/monitor/Makefile.objs
> > > > @@ -0,0 +1 @@
> > > > +common-obj-y += block-hmp-cmds.o
> > > > diff --git a/device-hotplug.c b/block/monitor/block-hmp-cmds.c
> > > > similarity index 55%
> > > > rename from device-hotplug.c
> > > > rename to block/monitor/block-hmp-cmds.c
> > > > index 554e4d98db..c65aaa86ea 100644
> > > > --- a/device-hotplug.c
> > > > +++ b/block/monitor/block-hmp-cmds.c
> > > > @@ -1,25 +1,11 @@
> > > >  /*
> > > > - * QEMU device hotplug helpers
> > > > + * Blockdev HMP commands
> > > >   *
> > > >   * Copyright (c) 2004 Fabrice Bellard
> > > >   *
> > > > - * Permission is hereby granted, free of charge, to any person obtaining a copy
> > > > - * of this software and associated documentation files (the "Software"), to deal
> > > > - * in the Software without restriction, including without limitation the rights
> > > > - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > > > - * copies of the Software, and to permit persons to whom the Software is
> > > > - * furnished to do so, subject to the following conditions:
> > > > - *
> > > > - * The above copyright notice and this permission notice shall be included in
> > > > - * all copies or substantial portions of the Software.
> > > > - *
> > > > - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > > > - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > > > - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> > > > - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > > > - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > > > - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> > > > - * THE SOFTWARE.
> > > > + * This work is licensed under the terms of the GNU GPL, version 2.
> > > > + * or (at your option) any later version.
> > > > + * See the COPYING file in the top-level directory.
> > > >   */
> > > >  
> > > >  #include "qemu/osdep.h"
> > > > @@ -33,6 +19,7 @@
> > > >  #include "sysemu/sysemu.h"
> > > >  #include "monitor/monitor.h"
> > > >  #include "block/block_int.h"
> > > > +#include "block/block-hmp-commands.h"
> > > >  
> > > >  
> > > >  void hmp_drive_add(Monitor *mon, const QDict *qdict)
> > > > diff --git a/include/block/block-hmp-commands.h b/include/block/block-hmp-commands.h
> > > > new file mode 100644
> > > > index 0000000000..4f9033a8a6
> > > > --- /dev/null
> > > > +++ b/include/block/block-hmp-commands.h
> > > > @@ -0,0 +1,8 @@
> > > > +#ifndef BLOCK_HMP_COMMANDS_H
> > > > +#define BLOCK_HMP_COMMANDS_H
> > > > +
> > > > +/* HMP commands related to the block layer*/
> 
> Space before */, please.
No problem!
> 
> > > Should this file get a copyright header as well?
> 
> I think it should.
I'll add. GPLv2+ too I guess.
> 
> > > > +
> > > > +void hmp_drive_add(Monitor *mon, const QDict *qdict);
> > > > +
> > > > +#endif
> > > > diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> > > > index 80c57fdc4e..c48635666d 100644
> > > > --- a/include/sysemu/sysemu.h
> > > > +++ b/include/sysemu/sysemu.h
> > > > @@ -68,9 +68,6 @@ extern int nb_option_roms;
> > > >  extern const char *prom_envs[MAX_PROM_ENVS];
> > > >  extern unsigned int nb_prom_envs;
> > > >  
> > > > -/* generic hotplug */
> > > > -void hmp_drive_add(Monitor *mon, const QDict *qdict);
> > > > -
> > > >  /* pcie aer error injection */
> > > >  void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict);
> > > >  
> > > > diff --git a/monitor/misc.c b/monitor/misc.c
> > > > index de1ca4d114..0466c00830 100644
> > > > --- a/monitor/misc.c
> > > > +++ b/monitor/misc.c
> > > > @@ -79,6 +79,7 @@
> > > >  #include "sysemu/cpus.h"
> > > >  #include "qemu/cutils.h"
> > > >  #include "tcg/tcg.h"
> > > > +#include "block/block-hmp-commands.h"
> 
> Put this next to #include "block/qapi.h", please.
Also no problem!
> 
> > > >  
> > > >  #if defined(TARGET_S390X)
> > > >  #include "hw/s390x/storage-keys.h"
> > > > -- 
> > > > 2.17.2
> > > > 
> 
> Preferably with my nitpicks addressed:
> Reviewed-by: Markus Armbruster <armbru@redhat.com>

Thank you very much for the review.
Best regards,
	Maxim Levitsky
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index f6511d5120..5d50d09ad8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1882,6 +1882,7 @@  Block QAPI, monitor, command line
 M: Markus Armbruster <armbru@redhat.com>
 S: Supported
 F: blockdev.c
+F: blockdev-hmp-cmds.c
 F: block/qapi.c
 F: qapi/block*.json
 F: qapi/transaction.json
diff --git a/Makefile.objs b/Makefile.objs
index ff396b9209..15209eb6b5 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -48,7 +48,7 @@  common-obj-y += dump/
 common-obj-y += job-qmp.o
 common-obj-y += monitor/
 common-obj-y += net/
-common-obj-y += qdev-monitor.o device-hotplug.o
+common-obj-y += qdev-monitor.o
 common-obj-$(CONFIG_WIN32) += os-win32.o
 common-obj-$(CONFIG_POSIX) += os-posix.o
 
diff --git a/block/Makefile.objs b/block/Makefile.objs
index 330529b0b7..3f65544a6b 100644
--- a/block/Makefile.objs
+++ b/block/Makefile.objs
@@ -44,6 +44,7 @@  block-obj-y += crypto.o
 block-obj-y += aio_task.o
 block-obj-y += backup-top.o
 block-obj-y += filter-compress.o
+common-obj-y += monitor/
 
 common-obj-y += stream.o
 
diff --git a/block/monitor/Makefile.objs b/block/monitor/Makefile.objs
new file mode 100644
index 0000000000..0a74f9a8b5
--- /dev/null
+++ b/block/monitor/Makefile.objs
@@ -0,0 +1 @@ 
+common-obj-y += block-hmp-cmds.o
diff --git a/device-hotplug.c b/block/monitor/block-hmp-cmds.c
similarity index 55%
rename from device-hotplug.c
rename to block/monitor/block-hmp-cmds.c
index 554e4d98db..c65aaa86ea 100644
--- a/device-hotplug.c
+++ b/block/monitor/block-hmp-cmds.c
@@ -1,25 +1,11 @@ 
 /*
- * QEMU device hotplug helpers
+ * Blockdev HMP commands
  *
  * Copyright (c) 2004 Fabrice Bellard
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
+ * This work is licensed under the terms of the GNU GPL, version 2.
+ * or (at your option) any later version.
+ * See the COPYING file in the top-level directory.
  */
 
 #include "qemu/osdep.h"
@@ -33,6 +19,7 @@ 
 #include "sysemu/sysemu.h"
 #include "monitor/monitor.h"
 #include "block/block_int.h"
+#include "block/block-hmp-commands.h"
 
 
 void hmp_drive_add(Monitor *mon, const QDict *qdict)
diff --git a/include/block/block-hmp-commands.h b/include/block/block-hmp-commands.h
new file mode 100644
index 0000000000..4f9033a8a6
--- /dev/null
+++ b/include/block/block-hmp-commands.h
@@ -0,0 +1,8 @@ 
+#ifndef BLOCK_HMP_COMMANDS_H
+#define BLOCK_HMP_COMMANDS_H
+
+/* HMP commands related to the block layer*/
+
+void hmp_drive_add(Monitor *mon, const QDict *qdict);
+
+#endif
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 80c57fdc4e..c48635666d 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -68,9 +68,6 @@  extern int nb_option_roms;
 extern const char *prom_envs[MAX_PROM_ENVS];
 extern unsigned int nb_prom_envs;
 
-/* generic hotplug */
-void hmp_drive_add(Monitor *mon, const QDict *qdict);
-
 /* pcie aer error injection */
 void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict);
 
diff --git a/monitor/misc.c b/monitor/misc.c
index de1ca4d114..0466c00830 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -79,6 +79,7 @@ 
 #include "sysemu/cpus.h"
 #include "qemu/cutils.h"
 #include "tcg/tcg.h"
+#include "block/block-hmp-commands.h"
 
 #if defined(TARGET_S390X)
 #include "hw/s390x/storage-keys.h"