All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: Nick Rosbrook <rosbrookn@gmail.com>
Cc: <xen-devel@lists.xenproject.org>, <george.dunlap@citrix.com>,
	"Nick Rosbrook" <rosbrookn@ainfosec.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>, Wei Liu <wl@xen.org>
Subject: Re: [RFC PATCH 1/2] libxl: add Function class to IDL
Date: Fri, 14 Aug 2020 11:52:33 +0100	[thread overview]
Message-ID: <20200814105233.GD2024@perard.uk.xensource.com> (raw)
In-Reply-To: <7e1774dffe69c702f738566abeb04a3a9d29e21b.1595854292.git.rosbrookn@ainfosec.com>

On Mon, Jul 27, 2020 at 09:26:32AM -0400, Nick Rosbrook wrote:
> Add a Function and CtxFunction classes to idl.py to allow generator
> scripts to generate wrappers which are repetitive and straight forward
> when doing so by hand. Examples of such functions are the
> device_add/remove functions.
> 
> To start, a Function has attributes for namespace, name, parameters,
> return type, and an indication if the return value should be interpreted as
> a status code. The CtxFunction class extends this by indicating that a
> libxl_ctx is a required parmeter, and can optionally be an async
> function.
> 
> Also, add logic to idl.parse to return the list of functions found in an
> IDL file. For now, have users of idl.py -- i.e. libxl/gentypes.py and
> golang/xenlight/gengotypes.py -- ignore the list of functions returned.
> 
> Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
> ---
>  
> +class Function(object):
> +    """
> +    A general description of a function signature.
> +
> +    Attributes:
> +      name (str): name of the function, excluding namespace.
> +      params (list of (str,Type)): list of function parameters.
> +      return_type (Type): the Type (if any), returned by the function.
> +      return_is_status (bool): Indicates that the return value should be
> +                               interpreted as an error/status code.

Can we get away without `return_is_status`? Couldn't we try to have
return_type=libxl_error to indicate that return is a kind of status?

> +    """
> +class CtxFunction(Function):
> +    """
> +    A function that requires a libxl_ctx.
> +
> +    Attributes:
> +      is_asyncop (bool): indicates that the function accepts a
> +                         libxl_asyncop_how parameter.

While CtxFunction can be a function that takes `libxl_ctx` as first
parameter, I don't think `is_asyncop` can be used. We can't know if
`ao_how` will be last or not. For some function, `ao_how` is second to
last. So, I guess `ao_how` might need to be listed in `params`

What do you think?

Thanks,

-- 
Anthony PERARD


  reply	other threads:[~2020-08-14 10:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-27 13:26 [RFC PATCH 0/2] add function support to IDL Nick Rosbrook
2020-07-27 13:26 ` [RFC PATCH 1/2] libxl: add Function class " Nick Rosbrook
2020-08-14 10:52   ` Anthony PERARD [this message]
2020-08-17 15:26     ` Nick Rosbrook
2020-07-27 13:26 ` [RFC PATCH 2/2] libxl: prototype libxl_device_nic_add/remove with IDL Nick Rosbrook
2020-08-14 10:57   ` Anthony PERARD
2020-08-17 15:44     ` Nick Rosbrook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200814105233.GD2024@perard.uk.xensource.com \
    --to=anthony.perard@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=rosbrookn@ainfosec.com \
    --cc=rosbrookn@gmail.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.