diff mbox series

[16/41] throttle-groups: Move ThrottleGroup typedef to header

Message ID 20200813222625.243136-17-ehabkost@redhat.com
State New
Headers show
Series qom: Automated conversion of type checking boilerplate | expand

Commit Message

Eduardo Habkost Aug. 13, 2020, 10:26 p.m. UTC
Move typedef closer to the type check macros, to make it easier
to convert the code to OBJECT_DEFINE_TYPE() in the future.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/block/throttle-groups.h | 1 +
 block/throttle-groups.c         | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Philippe Mathieu-Daudé Aug. 14, 2020, 6:01 p.m. UTC | #1
On 8/14/20 12:26 AM, Eduardo Habkost wrote:
> Move typedef closer to the type check macros, to make it easier
> to convert the code to OBJECT_DEFINE_TYPE() in the future.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  include/block/throttle-groups.h | 1 +
>  block/throttle-groups.c         | 4 ++--
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/include/block/throttle-groups.h b/include/block/throttle-groups.h
> index 712a8e64b4..5e77db700f 100644
> --- a/include/block/throttle-groups.h
> +++ b/include/block/throttle-groups.h
> @@ -59,6 +59,7 @@ typedef struct ThrottleGroupMember {
>  } ThrottleGroupMember;
>  
>  #define TYPE_THROTTLE_GROUP "throttle-group"
> +typedef struct ThrottleGroup ThrottleGroup;
>  #define THROTTLE_GROUP(obj) OBJECT_CHECK(ThrottleGroup, (obj), TYPE_THROTTLE_GROUP)
>  
>  const char *throttle_group_get_name(ThrottleGroupMember *tgm);
> diff --git a/block/throttle-groups.c b/block/throttle-groups.c
> index 98fea7fd47..4e28365d8d 100644
> --- a/block/throttle-groups.c
> +++ b/block/throttle-groups.c
> @@ -63,7 +63,7 @@ static void timer_cb(ThrottleGroupMember *tgm, bool is_write);
>   * access some other ThrottleGroupMember's timers only after verifying that
>   * that ThrottleGroupMember has throttled requests in the queue.
>   */
> -typedef struct ThrottleGroup {
> +struct ThrottleGroup {
>      Object parent_obj;
>  
>      /* refuse individual property change if initialization is complete */
> @@ -79,7 +79,7 @@ typedef struct ThrottleGroup {
>  
>      /* This field is protected by the global QEMU mutex */
>      QTAILQ_ENTRY(ThrottleGroup) list;
> -} ThrottleGroup;
> +};
>  
>  /* This is protected by the global QEMU mutex */
>  static QTAILQ_HEAD(, ThrottleGroup) throttle_groups =
>
Daniel P. Berrangé Aug. 17, 2020, 3:59 p.m. UTC | #2
On Thu, Aug 13, 2020 at 06:26:00PM -0400, Eduardo Habkost wrote:
> Move typedef closer to the type check macros, to make it easier
> to convert the code to OBJECT_DEFINE_TYPE() in the future.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  include/block/throttle-groups.h | 1 +
>  block/throttle-groups.c         | 4 ++--
>  2 files changed, 3 insertions(+), 2 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
diff mbox series

Patch

diff --git a/include/block/throttle-groups.h b/include/block/throttle-groups.h
index 712a8e64b4..5e77db700f 100644
--- a/include/block/throttle-groups.h
+++ b/include/block/throttle-groups.h
@@ -59,6 +59,7 @@  typedef struct ThrottleGroupMember {
 } ThrottleGroupMember;
 
 #define TYPE_THROTTLE_GROUP "throttle-group"
+typedef struct ThrottleGroup ThrottleGroup;
 #define THROTTLE_GROUP(obj) OBJECT_CHECK(ThrottleGroup, (obj), TYPE_THROTTLE_GROUP)
 
 const char *throttle_group_get_name(ThrottleGroupMember *tgm);
diff --git a/block/throttle-groups.c b/block/throttle-groups.c
index 98fea7fd47..4e28365d8d 100644
--- a/block/throttle-groups.c
+++ b/block/throttle-groups.c
@@ -63,7 +63,7 @@  static void timer_cb(ThrottleGroupMember *tgm, bool is_write);
  * access some other ThrottleGroupMember's timers only after verifying that
  * that ThrottleGroupMember has throttled requests in the queue.
  */
-typedef struct ThrottleGroup {
+struct ThrottleGroup {
     Object parent_obj;
 
     /* refuse individual property change if initialization is complete */
@@ -79,7 +79,7 @@  typedef struct ThrottleGroup {
 
     /* This field is protected by the global QEMU mutex */
     QTAILQ_ENTRY(ThrottleGroup) list;
-} ThrottleGroup;
+};
 
 /* This is protected by the global QEMU mutex */
 static QTAILQ_HEAD(, ThrottleGroup) throttle_groups =