Util-Linux Archive on lore.kernel.org
 help / color / Atom feed
From: Karel Zak <kzak@redhat.com>
To: Stanislav Brabec <sbrabec@suse.cz>
Cc: util-linux@vger.kernel.org, Martin Wilck <martin.wilck@suse.com>
Subject: Re: [PATCH] blockdev: Don't fail on missing start sector
Date: Mon, 1 Jun 2020 10:13:49 +0200
Message-ID: <20200601081349.uirtbn2u2bfztnq4@ws.net.home> (raw)
In-Reply-To: <a7a4f974-8a32-efb3-0ba3-a25e77145946@suse.cz>

On Mon, Jun 01, 2020 at 01:35:44AM +0200, Stanislav Brabec wrote:
> Device mapper devices don't provide start sector.

for which type of the device/mapping? I'd like to reproduce this

> It causes "blockdev --report" error:
> blockdev: /dev/dm-9: failed to read partition start from sysfs: No such
> file or directory
> There is no reliable way to detect a geometry in this case.
> Report N/A instead.

I guess the "start" file missing in the sysfs/ in this case, right?

>              if (ul_path_read_u64(pc, &start, "start") != 0)
> -                err(EXIT_FAILURE,
> -                    _("%s: failed to read partition start from sysfs"),
> -                    device);
> +                /* TRANSLATORS: Start sector not available. Max. 10
> letters. */
> +                sprintf(start_str, "%10s", _("N/A"));
>          }
>          ul_unref_path(pc);
>      }
> +    if (start_str[0] == 0)
> +        sprintf(start_str, "%10ju", start);

Maybe we ca use ul_path_read_buffer() rather than ul_path_read_u64() to keep 
it as string and to avoid sprintf().


 Karel Zak  <kzak@redhat.com>

  reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-31 23:35 Stanislav Brabec
2020-06-01  8:13 ` Karel Zak [this message]
2020-06-02  1:52   ` Stanislav Brabec
2020-06-03 15:16 ` Karel Zak
2020-06-05  8:06   ` Karel Zak
2020-06-13 20:52     ` Stanislav Brabec

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200601081349.uirtbn2u2bfztnq4@ws.net.home \
    --to=kzak@redhat.com \
    --cc=martin.wilck@suse.com \
    --cc=sbrabec@suse.cz \
    --cc=util-linux@vger.kernel.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Util-Linux Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/util-linux/0 util-linux/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 util-linux util-linux/ https://lore.kernel.org/util-linux \
	public-inbox-index util-linux

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git