]> git.ipfire.org Git - thirdparty/util-linux.git/blame - 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
CommitLineData
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
14extern void list_disklabel(struct fdisk_context *cxt);
35ca5118 15extern void list_disk_identifier(struct fdisk_context *cxt);
152788aa 16extern void list_disk_geometry(struct fdisk_context *cxt);
0efd951c 17extern void list_freespace(struct fdisk_context *cxt);
9bdcf863
KZ
18extern int list_freespace_get_table(
19 struct fdisk_context *cxt,
20 struct fdisk_table **tb0,
21 size_t *best0);
152788aa 22
d464e2f0 23extern char *next_proc_partition(FILE **f);
cb776288
SN
24extern int print_device_pt(struct fdisk_context *cxt, char *device, int warnme, int verify, int separator);
25extern int print_device_freespace(struct fdisk_context *cxt, char *device, int warnme, int separator);
0efd951c 26
d2c47697 27extern void print_all_devices_pt(struct fdisk_context *cxt, int verify);
0efd951c 28extern void print_all_devices_freespace(struct fdisk_context *cxt);
152788aa 29
fff8ad58
KZ
30extern void list_available_columns(FILE *out);
31extern int *init_fields(struct fdisk_context *cxt, const char *str, size_t *n);
32
cb9a4b00
KZ
33
34/* used by fdisk and sfdisk */
35enum {
36 WIPEMODE_AUTO = 0,
37 WIPEMODE_NEVER = 1,
38 WIPEMODE_ALWAYS = 2
39};
40
41static 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 */