summaryrefslogtreecommitdiffstats
path: root/fdisks/fdiskbsdlabel.c
diff options
context:
space:
mode:
authorDavidlohr Bueso2012-07-08 23:40:27 +0200
committerKarel Zak2012-07-16 17:59:52 +0200
commitb8855c868fce518d5f7c0aafb63accf99506643c (patch)
tree37e8cdbf301804d37b0822cd05202dba24b70bf3 /fdisks/fdiskbsdlabel.c
parentbuild-sys: add -Werror to UL_WARN_ADD test (diff)
downloadkernel-qcow2-util-linux-b8855c868fce518d5f7c0aafb63accf99506643c.tar.gz
kernel-qcow2-util-linux-b8855c868fce518d5f7c0aafb63accf99506643c.tar.xz
kernel-qcow2-util-linux-b8855c868fce518d5f7c0aafb63accf99506643c.zip
fdisk: API: add label probing functionality
This patch sets the initial layout for label specific operations. A new fdisk_label structure is created that will hold all these ops, like new, delete, write and probe, among others. For now only probing is implemented. Once this design is established, a copy of the probed label will be copied to the main context structure, where calling the specific functions will save 'disklabel' checks. Debugging support is added as well. This patch passes regression tests and manually passes bsd, sun, dos and sgi labels probes. Reviewed-by: Petr Uzel <petr.uzel@suse.cz> Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Diffstat (limited to 'fdisks/fdiskbsdlabel.c')
-rw-r--r--fdisks/fdiskbsdlabel.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fdisks/fdiskbsdlabel.c b/fdisks/fdiskbsdlabel.c
index 53c8ad512..9ede3ef76 100644
--- a/fdisks/fdiskbsdlabel.c
+++ b/fdisks/fdiskbsdlabel.c
@@ -109,7 +109,7 @@ static struct xbsd_disklabel xbsd_dlabel;
* Note: often reformatting with DOS-type label leaves the BSD magic,
* so this does not mean that there is a BSD disk label.
*/
-int
+static int
check_osf_label(struct fdisk_context *cxt) {
if (xbsd_readlabel (cxt, NULL, &xbsd_dlabel) == 0)
return 0;
@@ -845,3 +845,9 @@ alpha_bootblock_checksum (char *boot)
dp[63] = sum;
}
#endif /* __alpha__ */
+
+const struct fdisk_label bsd_label =
+{
+ .name = "bsd",
+ .probe = check_osf_label
+};