util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Clarification on blkid_do_safeprobe
@ 2018-03-27 16:28 Tony Asleson
  2018-03-27 16:58 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Tony Asleson @ 2018-03-27 16:28 UTC (permalink / raw)
  To: util-linux

>From looking at the documentation and the code for blkid_do_safeprobe
it's not totally apparent to me that when the function returns -2
(ambivalent) that there is any results which may be retrieved by
utilizing blkid_probe_numof_values and blkid_probe_get_value.

Any clarification on this would be appreciated.  Also, do you only get
the -2 return if BLKID_SUBLKS_BADCSUM is set?

Thanks!
-Tony

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Clarification on blkid_do_safeprobe
  2018-03-27 16:28 Clarification on blkid_do_safeprobe Tony Asleson
@ 2018-03-27 16:58 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2018-03-27 16:58 UTC (permalink / raw)
  To: Tony Asleson; +Cc: util-linux

On Tue, Mar 27, 2018 at 11:28:17AM -0500, Tony Asleson wrote:
> From looking at the documentation and the code for blkid_do_safeprobe
> it's not totally apparent to me that when the function returns -2
> (ambivalent) that there is any results which may be retrieved by
> utilizing blkid_probe_numof_values and blkid_probe_get_value.

After any error blkid_probe_get_value() behavior is undefined. If need
to rescan the device by blkid_do_probe() get all possible results. 

See for example misc-utils/blkid.c:print_udev_ambivalent() where we
compose ID_FS_AMBIVALENT= for udev.

> Any clarification on this would be appreciated.  Also, do you only get
> the -2 return if BLKID_SUBLKS_BADCSUM is set?

You can get -2 when there is more valid superblocks detected on the
same device. The flag BLKID_SUBLKS_BADCSUM may help, but it's not
requirement.

All depends on msfs-like tools, if the tool does not wipe the device
before it creates a new filesystem then you will see more superblocks.

It's unusual now, but years ago it was pretty common. For example it
was possible to create LUKS/VFAT and SWAP on the same device. You can
imagine what happen with our encrypted data after swapon.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-27 16:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-27 16:28 Clarification on blkid_do_safeprobe Tony Asleson
2018-03-27 16:58 ` Karel Zak

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 NNTP newsgroup(s).