GNU bug report logs - #34863
[WIP] syscalls: Add loop device interface.

Previous Next

Package: guix-patches;

Reported by: Danny Milosavljevic <dannym <at> scratchpost.org>

Date: Thu, 14 Mar 2019 22:09:01 UTC

Severity: normal

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 34863 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: 34863 <at> debbugs.gnu.org
Subject: Re: [bug#34863] [WIP] syscalls: Add loop device interface.
Date: Sat, 16 Mar 2019 11:18:12 +0100
Hi!

Danny Milosavljevic <dannym <at> scratchpost.org> 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 ‘write-loop-info64!’:

  (let-syntax ((field (syntax-rules ()
                        ((_ field) (assoc-ref status 'field)))))
    (write-loop-info64! buf (field lo-device) (field lo-inode)
                        (field lo-rdevice) …))

However, given the number of fields, you might want to define a Scheme
record type, as is done for ‘%statfs’ and <file-system>.

HTH!

Ludo’.




This bug report was last modified 74 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.