]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libblkid: add blkid_probe_step_back()
authorKarel Zak <kzak@redhat.com>
Mon, 4 Feb 2013 10:28:09 +0000 (11:28 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 4 Feb 2013 10:28:09 +0000 (11:28 +0100)
commitcd0fe5c1659d4144610ffd76500002e98b873e0b
tree889cb6f7bd291fbc3b6eb0e690af826fa2288224
parent19a1ca6c0dcf64aa01e24c6b235c81413580804d
libblkid: add blkid_probe_step_back()

It seems that blkid_do_probe() is too high-level solution for some
mkfs programs (for example ext4 mkfs supports "undo" so all write
operations has to be implemented by filesystem specific functions).

The new function blkid_probe_step_back() resets internal libblkid
buffers and move probing stuff one step back. It means that the
previously used probing function will be called again in the next
blkid_do_probe() call. This allows to modify on-disk data and check
for backup superblocks or alternative magic strings. Something like:

  while (blkid_do_probe(pr) == 0) {
    ... get SBMAGIC_OFFSET and SBMAGIC len ...
    ... use your private seek & write() ...

    blkid_probe_step_back(pr);
  }

References: https://bugzilla.redhat.com/show_bug.cgi?id=902512
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/blkid.h.in
libblkid/src/blkid.sym
libblkid/src/probe.c