From 378c18e5f024ac5a8aef4cb40d7c9aa9633d144c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 16:30:35 +0200 Subject: Adding upstream version 2.38.1. Signed-off-by: Daniel Baumann --- disk-utils/fdisk-list.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 disk-utils/fdisk-list.h (limited to 'disk-utils/fdisk-list.h') diff --git a/disk-utils/fdisk-list.h b/disk-utils/fdisk-list.h new file mode 100644 index 0000000..6c75528 --- /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, int separator); +extern int print_device_freespace(struct fdisk_context *cxt, char *device, int warnme, int separator); + +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 */ -- cgit v1.2.3