Displaying 4 results from an estimated 4 matches for "can_xxx".
2019 Nov 22
4
Re: [PATCH nbdkit v2 03/10] python: Implement nbdkit API version 2.
...e in line with the
fact that in C code it is a #define constant rather than a function
pointer callback. But it is that much more glue code to figure out how
to check for a python global variable, compared to the glue code we
already have for calling a python function.
>
> Same for all can_xxx functions, NBD does not support changing any of
> these anyway
> after negotiation.
While can_xxx functions are somewhat dynamic (we only call them once per
connection, but connection A can be readonly while connection B is
read-write, changing the can_write result, for example). So those...
2019 Nov 22
0
Re: [PATCH nbdkit v2 03/10] python: Implement nbdkit API version 2.
...that in C code it is a #define constant rather than a function
> pointer callback. But it is that much more glue code to figure out how
> to check for a python global variable, compared to the glue code we
> already have for calling a python function.
>
> >
> > Same for all can_xxx functions, NBD does not support changing any of
> > these anyway
> > after negotiation.
>
> While can_xxx functions are somewhat dynamic (we only call them once per
> connection, but connection A can be readonly while connection B is
> read-write, changing the can_write resu...
2019 Nov 22
0
Re: [PATCH nbdkit v2 03/10] python: Implement nbdkit API version 2.
...t; + return 2
>
> Matches the C counterpart of #define NBDKIT_API_VERSION 2 at the top of
> a plugin.
This is the same thing I was thinking about. This makes it more clear
that the api
version is constant, and not something the plugin should change while
it is being used.
Same for all can_xxx functions, NBD does not support changing any of
these anyway
after negotiation.
v2 is an opportunity to do this change if we want to.
...
> > -def pread(h, count, offset):
> > +def pread(h, count, offset, flags):
> > global disk
> > return disk[offset:offset+co...
2019 Nov 22
8
Re: [PATCH nbdkit v2 03/10] python: Implement nbdkit API version 2.
On 11/22/19 1:53 PM, Richard W.M. Jones wrote:
> To avoid breaking existing plugins, Python plugins wishing to use
> version 2 of the API must opt in by declaring:
>
> def api_version():
> return 2
>
> (Plugins which do not do this are assumed to want API version 1).
Could we also permit the python code to declare a global variable
instead of a function? But a