Util-Linux Archive mirror
 help / color / mirror / Atom feed
From: Dragan Simic <dsimic@manjaro.org>
To: Karel Zak <kzak@redhat.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>, util-linux@vger.kernel.org
Subject: Re: [PATCH] loopdev: fix losetup failure with a lost device file
Date: Thu, 19 Oct 2023 02:13:10 +0200	[thread overview]
Message-ID: <f0a016fb4e4319382159a32d474a65ee@manjaro.org> (raw)
In-Reply-To: <20231018175941.f2zysgnq4ibwoyvl@ws.net.home>

On 2023-10-18 19:59, Karel Zak wrote:
> On Thu, Oct 12, 2023 at 02:55:24PM -0700, Junxiao Bi wrote:
>> +	sprintf(path, "/dev/loop%d", nr);
>> +	/* default loop device permission is "brw-rw----" */
>> +	umask(0003);
>> +	ret = mknod(path, S_IFBLK|0660, makedev(major, minor));
>> +	if (ret)
>> +		return -1;
> 
> frankly, it will be challenging to convince me that using mknode in a
> tool like losetup is a good idea. After all these decades, it's still
> not a common practice (although I have see many attempts).  Nodes are
> typically created by udevd by default, following udev rules.
> 
> IMHO, it's better to report the problem (perhaps with a helpful hint)
> as error message and assume that the administrator will address it.

Perhaps a separate exit status could also be returned?  By the way, when 
does actually losetup(8) return 2, as described in the man page?  I'm 
having troubles finding the exact place in the source code where that 
happens.

  parent reply	other threads:[~2023-10-19  0:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-12 21:55 [PATCH] loopdev: fix losetup failure with a lost device file Junxiao Bi
2023-10-17 23:06 ` junxiao.bi
2023-10-18  0:57   ` Dragan Simic
2023-10-18  3:28     ` Junxiao Bi
2023-10-18  6:18 ` Thomas Weißschuh
2023-10-18 22:06   ` junxiao.bi
2023-10-18 17:59 ` Karel Zak
2023-10-18 22:08   ` junxiao.bi
2023-10-19  0:13   ` Dragan Simic [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-10-12 21:54 Junxiao Bi

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=f0a016fb4e4319382159a32d474a65ee@manjaro.org \
    --to=dsimic@manjaro.org \
    --cc=junxiao.bi@oracle.com \
    --cc=kzak@redhat.com \
    --cc=util-linux@vger.kernel.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).