diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 02:42:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 02:42:50 +0000 |
commit | 8cb83eee5a58b1fad74c34094ce3afb9e430b5a4 (patch) | |
tree | a9b2e7baeca1be40eb734371e3c8b11b02294497 /disk-utils/fdisk-list.h | |
parent | Initial commit. (diff) | |
download | util-linux-upstream.tar.xz util-linux-upstream.zip |
Adding upstream version 2.33.1.upstream/2.33.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'disk-utils/fdisk-list.h')
-rw-r--r-- | disk-utils/fdisk-list.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/disk-utils/fdisk-list.h b/disk-utils/fdisk-list.h new file mode 100644 index 0000000..4ed5c25 --- /dev/null +++ b/disk-utils/fdisk-list.h @@ -0,0 +1,47 @@ +#ifndef UTIL_LINUX_FDISK_LIST_H +#define UTIL_LINUX_FDISK_LIST_H + +extern void list_disklabel(struct fdisk_context *cxt); +extern void list_disk_identifier(struct fdisk_context *cxt); +extern void list_disk_geometry(struct fdisk_context *cxt); +extern void list_freespace(struct fdisk_context *cxt); + +extern char *next_proc_partition(FILE **f); +extern int print_device_pt(struct fdisk_context *cxt, char *device, int warnme, int verify); +extern int print_device_freespace(struct fdisk_context *cxt, char *device, int warnme); + +extern void print_all_devices_pt(struct fdisk_context *cxt, int verify); +extern void print_all_devices_freespace(struct fdisk_context *cxt); + +extern void list_available_columns(FILE *out); +extern int *init_fields(struct fdisk_context *cxt, const char *str, size_t *n); + + +/* used by fdisk and sfdisk */ +enum { + WIPEMODE_AUTO = 0, + WIPEMODE_NEVER = 1, + WIPEMODE_ALWAYS = 2 +}; + +static inline int wipemode_from_string(const char *str) +{ + size_t i; + static const char *modes[] = { + [WIPEMODE_AUTO] = "auto", + [WIPEMODE_NEVER] = "never", + [WIPEMODE_ALWAYS] = "always" + }; + + if (!str || !*str) + return -EINVAL; + + for (i = 0; i < ARRAY_SIZE(modes); i++) { + if (strcasecmp(str, modes[i]) == 0) + return i; + } + + return -EINVAL; +} + +#endif /* UTIL_LINUX_FDISK_LIST_H */ |