From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bartosz Golaszewski Subject: Re: [RFC] libgpiod public API reviews needed Date: Tue, 23 Jan 2018 16:14:21 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: Received: from mail-oi0-f47.google.com ([209.85.218.47]:42337 "EHLO mail-oi0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750960AbeAWPOW (ORCPT ); Tue, 23 Jan 2018 10:14:22 -0500 Received: by mail-oi0-f47.google.com with SMTP id c8so542579oiy.9 for ; Tue, 23 Jan 2018 07:14:22 -0800 (PST) In-Reply-To: Sender: linux-gpio-owner@vger.kernel.org List-Id: linux-gpio@vger.kernel.org To: Arnd Bergmann Cc: Linus Walleij , linux-gpio@vger.kernel.org, Andy Shevchenko , Clemens Gruber , Thierry Reding , Peter Rosin , Lars-Peter Clausen 2018-01-22 12:12 GMT+01:00 Arnd Bergmann : > On Mon, Jan 22, 2018 at 12:02 PM, Bartosz Golaszewski wrote: >> 2018-01-22 10:25 GMT+01:00 Arnd Bergmann : >>> >>> - on x86, the structures are incompatible between 32-bit and 64-bit >>> user space, as the former has no padding. >> >> Is this really an issue? Do distros really ship the same bytecode for >> 32 and 64 bit architecures? I have never run into such problems >> despite having used different python bindings for C libraries (I'm not >> sure however how many of them dealt with any visible C structs). > > It's a huge issue, yes. You should be able to run an 32-bit distro > or just a standalone 32-bit binary with a 64-bit kernel. This driver > is otherwise written carefully to allow that, and it will work on all > other architectures AFAICT, just not on x86. > Besides using struct timespec, I have other structs in gpiod.h which would pose problems for ctypes-based python bindings - for example struct gpiod_line_request_config which contains a pointer (C string). If instead of using ctypes, I'd just use python's C extension modules, is there any other trap caused by different data layout between 32 and 64 bit architectures that I should be aware of? Also: if python bindings are the only victim of that - I'm ok with timespec. It's up to bindings to provide a correct interface after all, isn't it? Best regards, Bartosz Golaszewski