diff mbox series

[6/9] vm_event: Move struct vm_event_domain to vm_event.c

Message ID d50c5737dcff7f3225fe507322bb10d104a6e6b4.1559224640.git.ppircalabu@bitdefender.com (mailing list archive)
State Superseded
Headers show
Series Per vcpu vm_event channels | expand

Commit Message

Petre Ovidiu PIRCALABU May 30, 2019, 2:18 p.m. UTC
The vm_event_domain members are not accessed outside vm_event.c so it's
better to hide de implementation details.

Signed-off-by: Petre Pircalabu <ppircalabu@bitdefender.com>
---
 xen/common/vm_event.c   | 27 +++++++++++++++++++++++++++
 xen/include/xen/sched.h | 27 +--------------------------
 2 files changed, 28 insertions(+), 26 deletions(-)

Comments

Andrew Cooper May 31, 2019, 11:44 p.m. UTC | #1
On 30/05/2019 07:18, Petre Pircalabu wrote:
> The vm_event_domain members are not accessed outside vm_event.c so it's
> better to hide de implementation details.
>
> Signed-off-by: Petre Pircalabu <ppircalabu@bitdefender.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

Are there any files which now no longer need to include sched.h ? 
(Probably not, but it is worth checking)
Petre Ovidiu PIRCALABU June 3, 2019, 11:28 a.m. UTC | #2
On Fri, 2019-05-31 at 16:44 -0700, Andrew Cooper wrote:
> On 30/05/2019 07:18, Petre Pircalabu wrote:
> > The vm_event_domain members are not accessed outside vm_event.c so
> > it's
> > better to hide de implementation details.
> > 
> > Signed-off-by: Petre Pircalabu <ppircalabu@bitdefender.com>
> 
> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
> 
> Are there any files which now no longer need to include sched.h ? 
> (Probably not, but it is worth checking)
> 
> ________________________
> This email was scanned by Bitdefender

The "xen/sched.h header can be removed from the "xen/vm_event.h"
include list by fw declaring "struct domain" and "struct
vm_event_domain".
The vm_event clients (monitor, mem_sharing, mem_paging) need to include
"sched.h" because they need access to the "struct domain" details.

Many thanks,
Petre
Tamas K Lengyel June 5, 2019, 3:53 p.m. UTC | #3
On Thu, May 30, 2019 at 8:18 AM Petre Pircalabu
<ppircalabu@bitdefender.com> wrote:
>
> The vm_event_domain members are not accessed outside vm_event.c so it's
> better to hide de implementation details.
>
> Signed-off-by: Petre Pircalabu <ppircalabu@bitdefender.com>

Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
diff mbox series

Patch

diff --git a/xen/common/vm_event.c b/xen/common/vm_event.c
index 3e87bbc..02c5853 100644
--- a/xen/common/vm_event.c
+++ b/xen/common/vm_event.c
@@ -39,6 +39,33 @@ 
 #define vm_event_ring_lock(_ved)       spin_lock(&(_ved)->ring_lock)
 #define vm_event_ring_unlock(_ved)     spin_unlock(&(_ved)->ring_lock)
 
+/* VM event */
+struct vm_event_domain
+{
+    /* Domain reference */
+    struct domain *d;
+    /* ring lock */
+    spinlock_t ring_lock;
+    /* The ring has 64 entries */
+    unsigned char foreign_producers;
+    unsigned char target_producers;
+    /* shared ring page */
+    void *ring_page;
+    struct page_info *ring_pg_struct;
+    /* front-end ring */
+    vm_event_front_ring_t front_ring;
+    /* event channel port (vcpu0 only) */
+    int xen_port;
+    /* vm_event bit for vcpu->pause_flags */
+    int pause_flag;
+    /* list of vcpus waiting for room in the ring */
+    struct waitqueue_head wq;
+    /* the number of vCPUs blocked */
+    unsigned int blocked;
+    /* The last vcpu woken up */
+    unsigned int last_vcpu_wake_up;
+};
+
 static int vm_event_enable(
     struct domain *d,
     struct xen_domctl_vm_event_op *vec,
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 7dee022..207fbc4 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -279,32 +279,7 @@  struct vcpu
 #define domain_lock(d) spin_lock_recursive(&(d)->domain_lock)
 #define domain_unlock(d) spin_unlock_recursive(&(d)->domain_lock)
 
-/* VM event */
-struct vm_event_domain
-{
-    /* Domain reference */
-    struct domain *d;
-    /* ring lock */
-    spinlock_t ring_lock;
-    /* The ring has 64 entries */
-    unsigned char foreign_producers;
-    unsigned char target_producers;
-    /* shared ring page */
-    void *ring_page;
-    struct page_info *ring_pg_struct;
-    /* front-end ring */
-    vm_event_front_ring_t front_ring;
-    /* event channel port (vcpu0 only) */
-    int xen_port;
-    /* vm_event bit for vcpu->pause_flags */
-    int pause_flag;
-    /* list of vcpus waiting for room in the ring */
-    struct waitqueue_head wq;
-    /* the number of vCPUs blocked */
-    unsigned int blocked;
-    /* The last vcpu woken up */
-    unsigned int last_vcpu_wake_up;
-};
+struct vm_event_domain;
 
 struct evtchn_port_ops;