diff options
author | Davidlohr Bueso | 2012-07-08 23:40:27 +0200 |
---|---|---|
committer | Karel Zak | 2012-07-16 17:59:52 +0200 |
commit | b8855c868fce518d5f7c0aafb63accf99506643c (patch) | |
tree | 37e8cdbf301804d37b0822cd05202dba24b70bf3 /fdisks/fdisk.h | |
parent | build-sys: add -Werror to UL_WARN_ADD test (diff) | |
download | kernel-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/fdisk.h')
-rw-r--r-- | fdisks/fdisk.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/fdisks/fdisk.h b/fdisks/fdisk.h index 51a63b228..64a8147e6 100644 --- a/fdisks/fdisk.h +++ b/fdisks/fdisk.h @@ -37,6 +37,7 @@ #define FDISK_DEBUG_CONTEXT (1 << 2) #define FDISK_DEBUG_TOPOLOGY (1 << 3) #define FDISK_DEBUG_GEOMETRY (1 << 4) +#define FDISK_DEBUG_LABEL (1 << 5) #define FDISK_DEBUG_ALL 0xFFFF # define ON_DBG(m, x) do { \ @@ -125,6 +126,24 @@ struct fdisk_context { struct fdisk_geometry geom; }; +/* + * Label specific operations + */ +struct fdisk_label { + const char *name; + int (*probe)(struct fdisk_context *cxt); +}; + +/* + * labels + */ +extern const struct fdisk_label aix_label; +extern const struct fdisk_label dos_label; +extern const struct fdisk_label bsd_label; +extern const struct fdisk_label mac_label; +extern const struct fdisk_label sun_label; +extern const struct fdisk_label sgi_label; + extern struct fdisk_context *fdisk_new_context_from_filename(const char *fname, int readonly); extern int fdisk_dev_has_topology(struct fdisk_context *cxt); extern int fdisk_dev_sectsz_is_default(struct fdisk_context *cxt); |