summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/fdiskP.h
diff options
context:
space:
mode:
authorKarel Zak2016-05-04 12:32:52 +0200
committerKarel Zak2016-05-04 12:32:52 +0200
commit131e38a28ea055548a098611eeba94078a17c19d (patch)
tree73a6f3d50e0b961740f1970d2a7f79abe93f2a3d /libfdisk/src/fdiskP.h
parentlibblkid: make I/O errors on CDROMs non-fatal (diff)
downloadkernel-qcow2-util-linux-131e38a28ea055548a098611eeba94078a17c19d.tar.gz
kernel-qcow2-util-linux-131e38a28ea055548a098611eeba94078a17c19d.tar.xz
kernel-qcow2-util-linux-131e38a28ea055548a098611eeba94078a17c19d.zip
libfdisk: add fdisk_wipe_partition()
Now libfdisk provides functionality wipe disk device only ([s]fdisk option --wipe). This patch allows to probe for filesystems/RAIDs on newly created partitions. It means we can remove signatures before the partition node (device) is created. This reduces udev events and it's unnecessary to call wipefs for all partitions. For example sfdisk --wipe=always --wipe-partitions=always /dev/sda <<< ... EOF is a elegant way how to create new disk layout without any obsolete filesystems/RAIDs. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/fdiskP.h')
-rw-r--r--libfdisk/src/fdiskP.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/libfdisk/src/fdiskP.h b/libfdisk/src/fdiskP.h
index 85c38492a..6444c3d3e 100644
--- a/libfdisk/src/fdiskP.h
+++ b/libfdisk/src/fdiskP.h
@@ -38,6 +38,7 @@
#define LIBFDISK_DEBUG_PARTTYPE (1 << 7)
#define LIBFDISK_DEBUG_TAB (1 << 8)
#define LIBFDISK_DEBUG_SCRIPT (1 << 9)
+#define LIBFDISK_DEBUG_WIPE (1 << 10)
#define LIBFDISK_DEBUG_ALL 0xFFFF
UL_DEBUG_DECLARE_MASK(libfdisk);
@@ -121,6 +122,10 @@ struct fdisk_partition {
char *attrs; /* partition flags/attributes converted to string */
struct fdisk_parttype *type; /* partition type */
+ char *fstype; /* filesystem type */
+ char *fsuuid; /* filesystem uuid */
+ char *fslabel; /* filesystem label */
+
struct list_head parts; /* list of partitions */
/* extra fields for partition_to_string() */
@@ -143,6 +148,7 @@ struct fdisk_partition {
partno_follow_default : 1, /* use default partno */
size_explicit : 1, /* don't align the size */
start_follow_default : 1, /* use default start */
+ fs_probed : 1, /* already probed by blkid */
used : 1, /* partition already used */
wholedisk : 1; /* special system partition */
};
@@ -355,10 +361,10 @@ struct fdisk_context {
display_in_cyl_units : 1, /* for obscure labels */
display_details : 1, /* expert display mode */
protect_bootbits : 1, /* don't zeroize fll irst sector */
- wipe_device : 1, /* wipe device before write */
listonly : 1; /* list partition, nothing else */
char *collision; /* name of already existing FS/PT */
+ struct list_head wipes; /* list of areas to wipe before write */
int sizeunit; /* SIZE fields, FDISK_SIZEUNIT_* */
@@ -389,8 +395,6 @@ struct fdisk_context {
struct fdisk_script *script; /* what we want to follow */
};
-int fdisk_wipe_collisions(struct fdisk_context *cxt);
-
/* context.c */
extern int __fdisk_switch_label(struct fdisk_context *cxt,
struct fdisk_label *lb);
@@ -455,4 +459,10 @@ extern struct dos_partition *fdisk_dos_get_partition(
struct fdisk_context *cxt,
size_t i);
+/* wipe.c */
+void fdisk_free_wipe_areas(struct fdisk_context *cxt);
+int fdisk_set_wipe_area(struct fdisk_context *cxt, uint64_t start, uint64_t size, int enable);
+int fdisk_do_wipe(struct fdisk_context *cxt);
+int fdisk_has_wipe_area(struct fdisk_context *cxt, uint64_t start, uint64_t size);
+
#endif /* _LIBFDISK_PRIVATE_H */