karelzak/util-linux — pull request #31 by zec (2013-03-02 03:11:01+00:00)
Title: libblkid: fix block size for UDF probe

Quoting my commit message:

> In UDF, Volume Structure Descriptors are always 2048 bytes long (ECMA-167, 3rd ed., §2/9.1), while filesystem sectors are the same size as the sectors of the underlying media (e.g., UDF 2.01 §1.3.2). Before this commit, the block size was estimated from VSD offsets, which gives incorrect answers for non-optical media.

To give an example, I have a UDF partition `/dev/sdb2` on a flash drive, with a block size of 512 bytes; it has a label of **Flashback**. Before this commit, running `blkid` doesn't find the label:

$ ./blkid.static /dev/sdb2
/dev/sdb2: TYPE="udf"

After this commit, I get the following:

$ ./blkid.static /dev/sdb2
/dev/sdb2: LABEL="Flashback" TYPE="udf"

As for DVD images (for which the 'device' block size is 512 bytes but we really want 2048-byte blocks):

$ genisoimage -V Test-GENISOIMG -graft-points -udf -o x.iso config=config lib=lib libblkid=libblkid libuuid=libuuid
$ mkudffs -b 2048 --vid=Test-mkudffs --media-type=dvd --utf8 y.iso 8192
$ ./blkid.static x.iso
x.iso: UUID="2013-03-01-21-21-42-00" LABEL="Test-GENISOIMG" TYPE="udf"
$ ./blkid.static y.iso
y.iso: LABEL="Test-mkudffs" TYPE="udf"

I believe this covers most use-cases.