xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Wieczorkiewicz, Pawel" <wipawel@amazon.de>
To: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
Cc: Wei Liu <wl@xen.org>, Ian Jackson <ian.jackson@eu.citrix.com>,
	xen-devel <xen-devel@lists.xen.org>,
	"Pohlack, Martin" <mpohlack@amazon.de>,
	"Wieczorkiewicz, Pawel" <wipawel@amazon.de>,
	Martin Mazein <amazein@amazon.de>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [Xen-devel] [PATCH livepatch-python 1/1] livepatch: Add python bindings for livepatch operations
Date: Tue, 20 Aug 2019 11:39:58 +0000	[thread overview]
Message-ID: <B83C6BF2-428C-482E-9E0F-1A8DB816DCEE@amazon.com> (raw)
In-Reply-To: <20190819213957.GD1457@mail-itl>


[-- Attachment #1.1: Type: text/plain, Size: 3553 bytes --]

On 19. Aug 2019, at 23:39, Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com<mailto:marmarek@invisiblethingslab.com>> wrote:

On Thu, Aug 15, 2019 at 11:36:46AM +0000, Pawel Wieczorkiewicz wrote:
Extend the XC python bindings library to support also all common
livepatch operations and actions.


…snip...
+
+static PyObject *pyxc_livepatch_action(XcObject *self,
+                                       PyObject *args,
+                                       PyObject *kwds)
+{
+    int (*action_func)(xc_interface *xch, char *name, uint32_t timeout, uint64_t flags);

This makes it dependent on "livepatch: Allow to override inter-modules
buildid dependency" patch. Since it's part of a different series, if
there is going to be v2, please name the dependency explicitly in the
commit message or at least after —.

ACK. Will do.

+    char *name;
+    unsigned int action;
+    uint32_t timeout;
+    uint64_t flags;
+    int rc;
+

…snip...
+static PyObject *pyxc_livepatch_upload(XcObject *self,
+                                       PyObject *args,
+                                       PyObject *kwds)
+{
+    unsigned char *fbuf = MAP_FAILED;
+    char *name, *filename;
+    struct stat buf;
+    int fd = 0, rc;
+    ssize_t len;
+
+    static char *kwd_list[] = { "name", "filename", NULL };
+
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ss", kwd_list,
+                                      &name, &filename))

It would be nice to support Path-like objects on python >= 3.6. See
note about "s" format here:
https://docs.python.org/3/c-api/arg.html#strings-and-buffers

But since it's python 3 only, that would need to be under #if
PY_MAJOR_VERSION >= 3.


I’d prefer to add it as a separate commit (adding it to my TODO).

+        goto error;
+
+    fd = open(filename, O_RDONLY);
+    if ( fd < 0 )
+        goto error;
+
+    if ( stat(filename, &buf) != 0 )
+        goto error;
+

…snip...
+
+    rc = xc_livepatch_list_get_sizes(self->xc_handle, &nr,
+                                     &name_total_size, &metadata_total_size);

This makes it dependent on lp-metadata series. Same note as previously.
BTW for some reason your patch series are not handled as a mail threads,
which makes it harder to look for other patches in the series. Is it
only me?


ACK, Will do.

No, unfortunately it’s me, who incorrectly sent out the series. I divided them
by functionality instead of per repo. I also did not create a cover letter. But,
I got more than one advice how to do it next time.

+    if ( rc )
+        goto error;
+

…snip...
+
+    list = PyList_New(0);

Better use PyList_New(done) and later PyList_SetItem() instead of PyList_Append().


ACK. Will change.

+    name_off = metadata_off = 0;
+    for ( i = 0; i < done; i++ )
+    {
+        PyObject *info_dict, *metadata_list;
+        char *name_str, *metadata_str;
+
…snip...
(m, "LIVEPATCH_STATE_CHECKED", LIVEPATCH_STATE_CHECKED);
+
#if PY_MAJOR_VERSION >= 3
  return m;
#endif

--
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?


Best Regards,
Pawel Wieczorkiewicz



Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Ralf Herbrich
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879



[-- Attachment #1.2: Type: text/html, Size: 10869 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

      parent reply	other threads:[~2019-08-20 11:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-15 11:36 [Xen-devel] [PATCH livepatch-python 1/1] livepatch: Add python bindings for livepatch operations Pawel Wieczorkiewicz
2019-08-16 12:37 ` Wei Liu
2019-08-16 12:57   ` Wieczorkiewicz, Pawel
2019-08-19 21:39 ` Marek Marczykowski-Górecki
2019-08-20 11:12   ` Wieczorkiewicz, Pawel
2019-08-20 11:39   ` Wieczorkiewicz, Pawel [this message]

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=B83C6BF2-428C-482E-9E0F-1A8DB816DCEE@amazon.com \
    --to=wipawel@amazon.de \
    --cc=amazein@amazon.de \
    --cc=ian.jackson@eu.citrix.com \
    --cc=marmarek@invisiblethingslab.com \
    --cc=mpohlack@amazon.de \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).