all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Danny Milosavljevic <dannym@scratchpost.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 34863@debbugs.gnu.org
Subject: [bug#34863] [WIP] syscalls: Add loop device interface.
Date: Sat, 16 Mar 2019 12:17:09 +0100	[thread overview]
Message-ID: <20190316121709.27c979dc@scratchpost.org> (raw)
In-Reply-To: <87k1gzyuwy.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2139 bytes --]

Hi Ludo :)

On Sat, 16 Mar 2019 11:29:17 +0100
Ludovic Courtès <ludo@gnu.org> wrote:

> What will be the use for this?  I prefer to make sure we only add code
> that is actually going to be used.  :-)

See "boot multiple Gnu/Linux Distributions from one USB key" on the guix-devel
list.  This would make it possible to loop-mount stuff at boot.

> Like I wrote, a record may be more appropriate than an alist here.
> Also, no need to repeat ‘lo-’ in the parameter names.

Sure.

> > +(define (allocate-new-loop-device control-file)
> > +  "Allocates a new loop device and returns an FD for it.
> > +CONTROL-FILE should be an open file \"/dev/loop-control\".  
> 
> Nitpick: s/an FD/a file descriptor/
> s/an open file/an open port for/
> 
> > +      (open-io-file (string-append "/dev/loop" (number->string ret))))  
> 
> I didn’t know about ‘open-io-file’ and indeed, it’s undocumented.  So
> I’d suggest using ‘open-file’ instead to be on the safe side.

Do you mean 

  open-file ... "r+"

?

>Note that BACKING-FILE, the port, can be closed when it’s GC’d, which as
>a side effect would close its associated file descriptor.  Is this OK or
>does the FD have to remain open for the lifetime of the loopback device?

I don't know, but guess it's okay for it to be closed again (the
"losetup" process doesn't keep running for long either and the loop device
is fine).

> > +(let ((loop-device (allocate-new-loop-device (open-io-file "/dev/loop-control"))))
> > +  (set-loop-device-backing-file loop-device (open-input-file "tests/syscalls.scm"))
> > +  (set-loop-device-status loop-device (get-loop-device-status loop-device)))  
> 
> You’re missing a ‘test-assert’ or similar.  

What would I be asserting?  I found no function to test whether an
exception was raised or not (or to just assert that no exception was
raised).  So I resorted to that.

>Also, isn’t ‘loop-device’ a
> number?  Then the ‘set-loop-device-*’ calls fail with wrong-type-arg,
> no?

It's actually a port now and the comment in allocate-new-loop-device is
outdated.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2019-03-16 11:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-14 22:08 [bug#34863] [WIP] syscalls: Add loop device interface Danny Milosavljevic
2019-03-15 16:13 ` Danny Milosavljevic
2019-03-16 10:18   ` Ludovic Courtès
2019-03-16 10:29 ` Ludovic Courtès
2019-03-16 11:17   ` Danny Milosavljevic [this message]
2019-03-18  8:42     ` Ludovic Courtès
2019-04-10 14:56       ` Ludovic Courtès
2019-05-21 14:51       ` Ludovic Courtès

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=20190316121709.27c979dc@scratchpost.org \
    --to=dannym@scratchpost.org \
    --cc=34863@debbugs.gnu.org \
    --cc=ludo@gnu.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.