]>
Commit | Line | Data |
---|---|---|
9e95aa12 KZ |
1 | /* |
2 | * SPDX-License-Identifier: GPL-2.0-or-later | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * Copyright (C) 2014-2023 Karel Zak <kzak@redhat.com> | |
10 | */ | |
152788aa KZ |
11 | #ifndef UTIL_LINUX_FDISK_LIST_H |
12 | #define UTIL_LINUX_FDISK_LIST_H | |
13 | ||
14 | extern void list_disklabel(struct fdisk_context *cxt); | |
35ca5118 | 15 | extern void list_disk_identifier(struct fdisk_context *cxt); |
152788aa | 16 | extern void list_disk_geometry(struct fdisk_context *cxt); |
0efd951c | 17 | extern void list_freespace(struct fdisk_context *cxt); |
9bdcf863 KZ |
18 | extern int list_freespace_get_table( |
19 | struct fdisk_context *cxt, | |
20 | struct fdisk_table **tb0, | |
21 | size_t *best0); | |
152788aa | 22 | |
d464e2f0 | 23 | extern char *next_proc_partition(FILE **f); |
cb776288 SN |
24 | extern int print_device_pt(struct fdisk_context *cxt, char *device, int warnme, int verify, int separator); |
25 | extern int print_device_freespace(struct fdisk_context *cxt, char *device, int warnme, int separator); | |
0efd951c | 26 | |
d2c47697 | 27 | extern void print_all_devices_pt(struct fdisk_context *cxt, int verify); |
0efd951c | 28 | extern void print_all_devices_freespace(struct fdisk_context *cxt); |
152788aa | 29 | |
fff8ad58 KZ |
30 | extern void list_available_columns(FILE *out); |
31 | extern int *init_fields(struct fdisk_context *cxt, const char *str, size_t *n); | |
32 | ||
cb9a4b00 KZ |
33 | |
34 | /* used by fdisk and sfdisk */ | |
35 | enum { | |
36 | WIPEMODE_AUTO = 0, | |
37 | WIPEMODE_NEVER = 1, | |
38 | WIPEMODE_ALWAYS = 2 | |
39 | }; | |
40 | ||
41 | static inline int wipemode_from_string(const char *str) | |
42 | { | |
43 | size_t i; | |
44 | static const char *modes[] = { | |
45 | [WIPEMODE_AUTO] = "auto", | |
46 | [WIPEMODE_NEVER] = "never", | |
47 | [WIPEMODE_ALWAYS] = "always" | |
48 | }; | |
49 | ||
50 | if (!str || !*str) | |
51 | return -EINVAL; | |
52 | ||
53 | for (i = 0; i < ARRAY_SIZE(modes); i++) { | |
54 | if (strcasecmp(str, modes[i]) == 0) | |
55 | return i; | |
56 | } | |
57 | ||
58 | return -EINVAL; | |
59 | } | |
60 | ||
152788aa | 61 | #endif /* UTIL_LINUX_FDISK_LIST_H */ |