From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:52649) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h56en-0004eO-17 for guix-patches@gnu.org; Sat, 16 Mar 2019 06:35:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h56P8-0001fW-6Y for guix-patches@gnu.org; Sat, 16 Mar 2019 06:19:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60485) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h56P7-0001fO-Uh for guix-patches@gnu.org; Sat, 16 Mar 2019 06:19:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h56P7-0007tQ-PP for guix-patches@gnu.org; Sat, 16 Mar 2019 06:19:01 -0400 Subject: [bug#34863] [WIP] syscalls: Add loop device interface. Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20190314220823.30769-1-dannym@scratchpost.org> <20190315171306.777c88bd@scratchpost.org> Date: Sat, 16 Mar 2019 11:18:12 +0100 In-Reply-To: <20190315171306.777c88bd@scratchpost.org> (Danny Milosavljevic's message of "Fri, 15 Mar 2019 17:13:06 +0100") Message-ID: <877ecz15sr.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Danny Milosavljevic Cc: 34863@debbugs.gnu.org Hi! Danny Milosavljevic skribis: >> +(define (set-loop-device-status loop-file status) >> + (let ((buf (make-bytevector sizeof-loop-info64))) >> + (apply write-loop-info64! buf status) ; TODO: Be more user-friendly. > > I don't know how instantiate a C structure given an assoc list. Help? You have to extract the fields from STATUS and then pass them in the right order to =E2=80=98write-loop-info64!=E2=80=99: (let-syntax ((field (syntax-rules () ((_ field) (assoc-ref status 'field))))) (write-loop-info64! buf (field lo-device) (field lo-inode) (field lo-rdevice) =E2=80=A6)) However, given the number of fields, you might want to define a Scheme record type, as is done for =E2=80=98%statfs=E2=80=99 and . HTH! Ludo=E2=80=99.