[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] xenconsole: Define and use a macro INVALID_XEN_PFN instead of -1



>>> On 17.10.17 at 18:46, <bhupinder.thakur@xxxxxxxxxx> wrote:
> --- a/tools/console/daemon/io.c
> +++ b/tools/console/daemon/io.c
> @@ -658,12 +658,12 @@ static void console_unmap_interface(struct console *con)
>  {
>       if (con->interface == NULL)
>               return;
> -     if (xgt_handle && con->ring_ref == -1)
> +     if (xgt_handle && con->ring_ref == INVALID_XEN_PFN)
>               xengnttab_unmap(xgt_handle, con->interface, 1);
>       else
>               munmap(con->interface, XC_PAGE_SIZE);
>       con->interface = NULL;
> -     con->ring_ref = -1;
> +     con->ring_ref = INVALID_XEN_PFN;
>  }
>   
>  static int console_create_ring(struct console *con)
> @@ -698,7 +698,7 @@ static int console_create_ring(struct console *con)
>       free(type);
>  
>       /* If using ring_ref and it has changed, remap */
> -     if (ring_ref != con->ring_ref && con->ring_ref != -1)
> +     if (ring_ref != con->ring_ref && con->ring_ref != INVALID_XEN_PFN)
>               console_unmap_interface(con);
>  
>       if (!con->interface && xgt_handle && con->use_gnttab) {
> @@ -706,7 +706,7 @@ static int console_create_ring(struct console *con)
>               con->interface = xengnttab_map_grant_ref(xgt_handle,
>                       dom->domid, GNTTAB_RESERVED_CONSOLE,
>                       PROT_READ|PROT_WRITE);
> -             con->ring_ref = -1;
> +             con->ring_ref = INVALID_XEN_PFN;
>       }
>       if (!con->interface) {
>               /* Fall back to xc_map_foreign_range */
> @@ -812,7 +812,7 @@ static int console_init(struct console *con, struct 
> domain *dom, void **data)
>       con->master_pollfd_idx = -1;
>       con->slave_fd = -1;
>       con->log_fd = -1;
> -     con->ring_ref = -1;
> +     con->ring_ref = INVALID_XEN_PFN;
>       con->local_port = -1;
>       con->remote_port = -1;
>       con->xce_pollfd_idx = -1;
> --- a/xen/include/public/xen.h
> +++ b/xen/include/public/xen.h
> @@ -37,6 +37,8 @@
>  #error "Unsupported architecture"
>  #endif
>  
> +#define INVALID_XEN_PFN (~(xen_pfn_t)0)

As said before, the uses of this which you introduce don't warrant
this addition to the public interface (which, if it was added, also
should start with XEN_). I'm not going to NAK such a (corrected)
addition to the public interface, but given the users I'm also not
going to ACK it (but perhaps another REST maintainer would).

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.