On Tue, Jan 12, 2010 at 04:32:44PM -0600, Anthony Liguori wrote: > On 01/11/2010 11:16 AM, Michael S. Tsirkin wrote: >> vhost needs physical addresses for >> ring so expose that structure. >> >> Signed-off-by: Michael S. Tsirkin<m...@redhat.com> >> > > I think accessor functions might make more sense. > > Regards, > > Anthony Liguori
Well, take a look: typedef struct VRing { unsigned int num; target_phys_addr_t desc; target_phys_addr_t avail; target_phys_addr_t used; } VRing; struct VirtQueue { VRing vring; target_phys_addr_t pa; uint16_t last_avail_idx; int inuse; uint16_t vector; void (*handle_output)(VirtIODevice *vdev, VirtQueue *vq); VirtIODevice *vdev; EventNotifier guest_notifier; EventNotifier host_notifier; } (Notifiers are added by patches I will shortly post). We need at least: unsigned int num; target_phys_addr_t desc; target_phys_addr_t avail; target_phys_addr_t used; VRing vring; target_phys_addr_t pa; uint16_t vector; VirtIODevice *vdev; EventNotifier guest_notifier; EventNotifier host_notifier; We do not need: uint16_t last_avail_idx; int inuse; void (*handle_output)(VirtIODevice *vdev, VirtQueue *vq); (last_avail_idx will be needed if we ever want to move a running guest from kernel to userspace or back). IOW, most of VirtQueue needs to be exposed. So - do we really want accessors? -- MST