]> git.ipfire.org Git - thirdparty/util-linux.git/blob - disk-utils/fdisk-list.h
Merge branch 'meson-more-build-options' of https://github.com/jwillikers/util-linux
[thirdparty/util-linux.git] / disk-utils / fdisk-list.h
1 #ifndef UTIL_LINUX_FDISK_LIST_H
2 #define UTIL_LINUX_FDISK_LIST_H
3
4 extern void list_disklabel(struct fdisk_context *cxt);
5 extern void list_disk_identifier(struct fdisk_context *cxt);
6 extern void list_disk_geometry(struct fdisk_context *cxt);
7 extern void list_freespace(struct fdisk_context *cxt);
8
9 extern char *next_proc_partition(FILE **f);
10 extern int print_device_pt(struct fdisk_context *cxt, char *device, int warnme, int verify);
11 extern int print_device_freespace(struct fdisk_context *cxt, char *device, int warnme);
12
13 extern void print_all_devices_pt(struct fdisk_context *cxt, int verify);
14 extern void print_all_devices_freespace(struct fdisk_context *cxt);
15
16 extern void list_available_columns(FILE *out);
17 extern int *init_fields(struct fdisk_context *cxt, const char *str, size_t *n);
18
19
20 /* used by fdisk and sfdisk */
21 enum {
22 WIPEMODE_AUTO = 0,
23 WIPEMODE_NEVER = 1,
24 WIPEMODE_ALWAYS = 2
25 };
26
27 static inline int wipemode_from_string(const char *str)
28 {
29 size_t i;
30 static const char *modes[] = {
31 [WIPEMODE_AUTO] = "auto",
32 [WIPEMODE_NEVER] = "never",
33 [WIPEMODE_ALWAYS] = "always"
34 };
35
36 if (!str || !*str)
37 return -EINVAL;
38
39 for (i = 0; i < ARRAY_SIZE(modes); i++) {
40 if (strcasecmp(str, modes[i]) == 0)
41 return i;
42 }
43
44 return -EINVAL;
45 }
46
47 #endif /* UTIL_LINUX_FDISK_LIST_H */