summaryrefslogtreecommitdiffstats
path: root/fdisk/fdisk.h
diff options
context:
space:
mode:
authorDavidlohr Bueso2012-06-17 18:10:07 +0200
committerKarel Zak2012-06-21 08:04:28 +0200
commit38b36353cd1861f47af58a6991f9dfdfbbf34fab (patch)
tree77cdf5065d6de66899b5ee2cd9d6ca333258637b /fdisk/fdisk.h
parentfdisk: API: add topology debug (diff)
downloadkernel-qcow2-util-linux-38b36353cd1861f47af58a6991f9dfdfbbf34fab.tar.gz
kernel-qcow2-util-linux-38b36353cd1861f47af58a6991f9dfdfbbf34fab.tar.xz
kernel-qcow2-util-linux-38b36353cd1861f47af58a6991f9dfdfbbf34fab.zip
fdisk: API: add mbr
This patch adds to the fdisk API the relevant logic to buffers that have MBR. This also serves for future GPT support for the protective MBR. All labels have been updated to have access to the cxt structure for the corresponding buffer. An important observation is that SGI no longer uses the standard qsort(3) function to sort partitions, as it needs access to cxt. To address this, a heap sort implementation from the kernel was added to the label code and adapted to fdisk. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Diffstat (limited to 'fdisk/fdisk.h')
-rw-r--r--fdisk/fdisk.h13
1 files changed, 4 insertions, 9 deletions
diff --git a/fdisk/fdisk.h b/fdisk/fdisk.h
index 9d17cdd76..b4f2814f9 100644
--- a/fdisk/fdisk.h
+++ b/fdisk/fdisk.h
@@ -104,8 +104,9 @@ struct geom {
typedef unsigned long long sector_t;
struct fdisk_context {
- int dev_fd; /* device descriptor */
- char *dev_path; /* device path */
+ int dev_fd; /* device descriptor */
+ char *dev_path; /* device path */
+ unsigned char *mbr; /* buffer with master boot record */
/* topology */
unsigned long io_size; /* I/O size used by fdisk */
@@ -123,6 +124,7 @@ extern struct fdisk_context *fdisk_new_context_from_filename(const char *fname,
extern int fdisk_dev_has_topology(struct fdisk_context *cxt);
extern int fdisk_dev_sectsz_is_default(struct fdisk_context *cxt);
extern void fdisk_free_context(struct fdisk_context *cxt);
+extern void fdisk_mbr_zeroize(struct fdisk_context *cxt);
/* prototypes for fdisk.c */
extern char *disk_device, *line_ptr;
@@ -145,7 +147,6 @@ extern unsigned int read_int(struct fdisk_context *cxt,
extern void print_menu(enum menutype);
extern void print_partition_size(struct fdisk_context *cxt, int num, sector_t start, sector_t stop, int sysid);
-extern void zeroize_mbr_buffer(void);
extern void fill_bounds(sector_t *first, sector_t *last);
extern unsigned int heads, cylinders;
extern sector_t sectors;
@@ -180,12 +181,6 @@ enum labeltype {
};
extern enum labeltype disklabel;
-
-/*
- * Raw disk label. For DOS-type partition tables the MBR,
- * with descriptions of the primary partitions.
- */
-extern unsigned char *MBRbuffer;
extern int MBRbuffer_changed;
extern unsigned long grain;