Re: [Xen-devel] [PATCH v3 1/3] python: Add binding for xs_fileno()

2017-09-25 Thread Wei Liu
On Fri, Sep 22, 2017 at 07:50:04PM +0200, Marek Marczykowski-Górecki wrote:
> On Fri, Sep 22, 2017 at 05:21:12PM +0100, Euan Harris wrote:
> > xs_fileno() returns a file descriptor which receives events when Xenstore
> > watches fire.   Exposing this in the Python bindings is a prerequisite
> > for writing event-driven clients in Python.
> > 
> > Signed-off-by: Euan Harris 
> > Reviewed-by: Konrad Rzeszutek Wilk 
> > Reviewed-by: Wei Liu 
> 
> Acked-by: Marek Marczykowski-Górecki 

Thanks for the quick turnaround.

I've queued this series up for applying for 4.10.

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


Re: [Xen-devel] [PATCH v3 1/3] python: Add binding for xs_fileno()

2017-09-22 Thread Marek Marczykowski-Górecki
On Fri, Sep 22, 2017 at 05:21:12PM +0100, Euan Harris wrote:
> xs_fileno() returns a file descriptor which receives events when Xenstore
> watches fire.   Exposing this in the Python bindings is a prerequisite
> for writing event-driven clients in Python.
> 
> Signed-off-by: Euan Harris 
> Reviewed-by: Konrad Rzeszutek Wilk 
> Reviewed-by: Wei Liu 

Acked-by: Marek Marczykowski-Górecki 

> ---
> Changed since v2:
>  * Use PyLong_FromLong instead of PyInt_FromLong
> ---
>  tools/python/xen/lowlevel/xs/xs.c | 20 
>  1 file changed, 20 insertions(+)
> 
> diff --git a/tools/python/xen/lowlevel/xs/xs.c 
> b/tools/python/xen/lowlevel/xs/xs.c
> index aba5a20..3a827b0 100644
> --- a/tools/python/xen/lowlevel/xs/xs.c
> +++ b/tools/python/xen/lowlevel/xs/xs.c
> @@ -453,6 +453,25 @@ static PyObject *xspy_watch(XsHandle *self, PyObject 
> *args)
>  }
>  
>  
> +#define xspy_fileno_doc "\n"  \
> + "Return the FD to poll for notifications when watches fire.\n"   \
> + "Returns: [int] file descriptor.\n"\
> + "\n"
> +
> +static PyObject *xspy_fileno(XsHandle *self)
> +{
> +struct xs_handle *xh = xshandle(self);
> +int fd;
> +
> +if (!xh)
> +return NULL;
> +
> +fd = xs_fileno(xh);
> +
> +return PyLong_FromLong(fd);
> +}
> +
> +
>  #define xspy_read_watch_doc "\n" \
>   "Read a watch notification.\n"  \
>   "\n"\
> @@ -887,6 +906,7 @@ static PyMethodDef xshandle_methods[] = {
>  XSPY_METH(release_domain,METH_VARARGS),
>  XSPY_METH(close, METH_NOARGS),
>  XSPY_METH(get_domain_path,   METH_VARARGS),
> +XSPY_METH(fileno,METH_NOARGS),
>  { NULL /* Sentinel. */ },
>  };
>  

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


signature.asc
Description: PGP signature
___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v3 1/3] python: Add binding for xs_fileno()

2017-09-22 Thread Euan Harris
xs_fileno() returns a file descriptor which receives events when Xenstore
watches fire.   Exposing this in the Python bindings is a prerequisite
for writing event-driven clients in Python.

Signed-off-by: Euan Harris 
Reviewed-by: Konrad Rzeszutek Wilk 
Reviewed-by: Wei Liu 
---
Changed since v2:
 * Use PyLong_FromLong instead of PyInt_FromLong
---
 tools/python/xen/lowlevel/xs/xs.c | 20 
 1 file changed, 20 insertions(+)

diff --git a/tools/python/xen/lowlevel/xs/xs.c 
b/tools/python/xen/lowlevel/xs/xs.c
index aba5a20..3a827b0 100644
--- a/tools/python/xen/lowlevel/xs/xs.c
+++ b/tools/python/xen/lowlevel/xs/xs.c
@@ -453,6 +453,25 @@ static PyObject *xspy_watch(XsHandle *self, PyObject *args)
 }
 
 
+#define xspy_fileno_doc "\n"  \
+   "Return the FD to poll for notifications when watches fire.\n"   \
+   "Returns: [int] file descriptor.\n"\
+   "\n"
+
+static PyObject *xspy_fileno(XsHandle *self)
+{
+struct xs_handle *xh = xshandle(self);
+int fd;
+
+if (!xh)
+return NULL;
+
+fd = xs_fileno(xh);
+
+return PyLong_FromLong(fd);
+}
+
+
 #define xspy_read_watch_doc "\n"   \
"Read a watch notification.\n"  \
"\n"\
@@ -887,6 +906,7 @@ static PyMethodDef xshandle_methods[] = {
 XSPY_METH(release_domain,METH_VARARGS),
 XSPY_METH(close, METH_NOARGS),
 XSPY_METH(get_domain_path,   METH_VARARGS),
+XSPY_METH(fileno,METH_NOARGS),
 { NULL /* Sentinel. */ },
 };
 
-- 
1.8.3.1


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