[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 07/10] xen/arm: vpl011: Add a new console type to domain structure in xenconsole
On Mon, 3 Apr 2017, Bhupinder Thakur wrote: > Modify the domain structure to to make console specific fields as an array > indexed > by the console type. Two console types are defined - PV and VCON. > > Signed-off-by: Bhupinder Thakur <bhupinder.thakur@xxxxxxxxxx> > --- > tools/console/daemon/io.c | 24 +++++++++++++++--------- > 1 file changed, 15 insertions(+), 9 deletions(-) > > diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c > index 7e6a886..0cd1fee 100644 > --- a/tools/console/daemon/io.c > +++ b/tools/console/daemon/io.c > @@ -61,6 +61,10 @@ > /* Duration of each time period in ms */ > #define RATE_LIMIT_PERIOD 200 > > +#define MAX_CONSOLE 2 > +#define CONSOLE_TYPE_PV 0 > +#define CONSOLE_TYPE_VCON 1 > + > extern int log_reload; > extern int log_guest; > extern int log_hv; > @@ -91,23 +95,25 @@ struct buffer { > > struct domain { > int domid; > - int master_fd; > - int master_pollfd_idx; > - int slave_fd; > - int log_fd; > + int master_fd[MAX_CONSOLE]; > + int master_pollfd_idx[MAX_CONSOLE]; > + int slave_fd[MAX_CONSOLE]; > + int log_fd[MAX_CONSOLE]; > bool is_dead; > unsigned last_seen; > - struct buffer buffer; > + struct buffer buffer[MAX_CONSOLE]; > struct domain *next; > char *conspath; > - int ring_ref; > - xenevtchn_port_or_error_t local_port; > - xenevtchn_port_or_error_t remote_port; > + int ring_ref[MAX_CONSOLE]; > + xenevtchn_port_or_error_t local_port[MAX_CONSOLE]; > + xenevtchn_port_or_error_t remote_port[MAX_CONSOLE]; > xenevtchn_handle *xce_handle; > int xce_pollfd_idx; > - struct xencons_interface *interface; > + struct xencons_interface *interface[MAX_CONSOLE]; > int event_count; > long long next_period; > + int console_data_pending; > + bool vcon_enabled; I think you need to gather together all the info of one console into a single struct, maybe called struct console. Then you'll have an array of MAX_CONSOLE struct consoles for each domain. Something like: struct console { int master_fd; int master_pollfd_idx; int slave_fd; int log_fd; struct buffer buffer; int ring_ref; xenevtchn_port_or_error_t local_port; xenevtchn_port_or_error_t remote_port; struct xencons_interface *interface; } At that point, you'll be able to generalize all functions in this file, like buffer_append and handle_ring_read, to take a struct console* as argument instead of a struct domain*, and they will work seamlessly on the old pv console and the new vuart console. The for loop in handle_io can figure out which struct console* to pass as parameter. The resulting patch will be much nicer. > }; > > static struct domain *dom_head; > -- > 2.7.4 > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |