File: fdisk-list.h

package info (click to toggle)
util-linux 2.41-5
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 95,208 kB
  • sloc: ansic: 179,016; sh: 22,689; yacc: 1,284; makefile: 528; xml: 422; python: 316; lex: 89; ruby: 75; csh: 37; exp: 19; sed: 16; perl: 15; sql: 9
file content (63 lines) | stat: -rw-r--r-- 1,831 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 * SPDX-License-Identifier: GPL-2.0-or-later
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Copyright (C) 2014-2023 Karel Zak <kzak@redhat.com>
 */
#ifndef UTIL_LINUX_FDISK_LIST_H
#define UTIL_LINUX_FDISK_LIST_H

#include "cctype.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 int list_freespace_get_table(
				struct fdisk_context *cxt,
				struct fdisk_table **tb0,
				size_t *best0);

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 *const modes[] = {
		[WIPEMODE_AUTO]   = "auto",
		[WIPEMODE_NEVER]  = "never",
		[WIPEMODE_ALWAYS] = "always"
	};

	if (!str || !*str)
		return -EINVAL;

	for (i = 0; i < ARRAY_SIZE(modes); i++) {
		if (c_strcasecmp(str, modes[i]) == 0)
			return i;
	}

	return -EINVAL;
}

#endif /* UTIL_LINUX_FDISK_LIST_H */