File: enum_multiple_template_files.ref

package info (click to toggle)
easygen 5.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 848 kB
  • sloc: sh: 14; makefile: 13
file content (35 lines) | stat: -rw-r--r-- 680 bytes parent folder | download | duplicates (3)
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

// Simplified enumeration of available RAID devices
enum raid_type {
	RAID0 = 100,
	RAID1,
};

/** Try to extract an enum raid_type value from @str; fall back to "RAID0". */
const enum raid_type
str_to_raid_type(const char const *str)
{
	if (strcasecmp(str, "RAID0") == 0) {
		return RAID0;
	} else if (strcasecmp(str, "RAID-0") == 0) {
		return RAID0;
	} else if (strcasecmp(str, "RAID1") == 0) {
		return RAID1;
	} else if (strcasecmp(str, "RAID-1") == 0) {
		return RAID1;
	}
	return RAID0;
}

/** Stringer function for raid_type. */
const char *
raid_type_to_str(const enum raid_type val)
{
	switch (val) {
	case RAID0:
		return "RAID0";
	case RAID1:
		return "RAID1";
	}
}