guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#34863] [WIP] syscalls: Add loop device interface.


From: Ludovic Courtès
Subject: [bug#34863] [WIP] syscalls: Add loop device interface.
Date: Sat, 16 Mar 2019 11:18:12 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Hi!

Danny Milosavljevic <address@hidden> 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’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]