libparted 3.6
Loading...
Searching...
No Matches
pt-limit.c
Go to the documentation of this file.
1/* ANSI-C code produced by gperf version 3.1 */
2/* Command-line: gperf -C -N pt_limit_lookup -n -t -s 6 -k '*' --language=ANSI-C pt-limit.gperf */
3
4#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
5 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
6 && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
7 && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
8 && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
9 && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
10 && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
11 && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
12 && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
13 && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
14 && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
15 && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
16 && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
17 && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
18 && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
19 && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
20 && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
21 && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
22 && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
23 && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
24 && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
25 && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
26 && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
27/* The character set is not based on ISO-646. */
28#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
29#endif
30
31#line 1 "pt-limit.gperf"
32struct partition_limit
33{
34 char const *name;
35 uint64_t max_start_sector;
36 uint64_t max_length;
37};
38
39#define TOTAL_KEYWORDS 11
40#define MIN_WORD_LENGTH 3
41#define MAX_WORD_LENGTH 5
42#define MIN_HASH_VALUE 5
43#define MAX_HASH_VALUE 55
44/* maximum key range = 51, duplicates = 0 */
45
46#ifdef __GNUC__
47__inline
48#else
49#ifdef __cplusplus
50inline
51#endif
52#endif
53static unsigned int
54hash (register const char *str, register size_t len)
55{
56 static const unsigned char asso_values[] =
57 {
58 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
59 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
60 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
61 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
62 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
63 56, 56, 56, 56, 56, 56, 10, 5, 56, 56,
64 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
65 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
66 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
67 56, 56, 56, 56, 56, 56, 56, 5, 40, 40,
68 5, 56, 56, 5, 20, 0, 56, 56, 15, 0,
69 15, 10, 0, 56, 0, 5, 0, 10, 15, 56,
70 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
71 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
72 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
73 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
74 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
75 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
76 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
77 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
78 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
79 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
80 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
81 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
82 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
83 56, 56, 56, 56, 56, 56
84 };
85 register unsigned int hval = 0;
86
87 switch (len)
88 {
89 default:
90 hval += asso_values[(unsigned char)str[4]];
91 /*FALLTHROUGH*/
92 case 4:
93 hval += asso_values[(unsigned char)str[3]];
94 /*FALLTHROUGH*/
95 case 3:
96 hval += asso_values[(unsigned char)str[2]];
97 /*FALLTHROUGH*/
98 case 2:
99 hval += asso_values[(unsigned char)str[1]];
100 /*FALLTHROUGH*/
101 case 1:
102 hval += asso_values[(unsigned char)str[0]];
103 break;
104 }
105 return hval;
106}
107
108const struct partition_limit *
109pt_limit_lookup (register const char *str, register size_t len)
110{
111 static const struct partition_limit wordlist[] =
112 {
113 {""}, {""}, {""}, {""}, {""},
114#line 10 "pt-limit.gperf"
115 {"gpt",UINT64_MAX,UINT64_MAX},
116 {""}, {""}, {""}, {""},
117#line 28 "pt-limit.gperf"
118 {"atari",INT32_MAX,INT32_MAX},
119 {""}, {""}, {""}, {""},
120#line 27 "pt-limit.gperf"
121 {"amiga",UINT32_MAX,UINT32_MAX},
122 {""}, {""}, {""}, {""},
123#line 8 "pt-limit.gperf"
124 {"dasd",UINT32_MAX,UINT32_MAX},
125 {""}, {""}, {""}, {""},
126#line 12 "pt-limit.gperf"
127 {"msdos",UINT32_MAX,UINT32_MAX},
128 {""}, {""}, {""}, {""},
129#line 18 "pt-limit.gperf"
130 {"sun",128ULL*UINT32_MAX,UINT32_MAX},
131 {""}, {""}, {""}, {""},
132#line 23 "pt-limit.gperf"
133 {"loop",UINT64_MAX,UINT64_MAX},
134 {""}, {""}, {""}, {""},
135#line 9 "pt-limit.gperf"
136 {"dvh",UINT32_MAX,UINT32_MAX},
137 {""}, {""}, {""}, {""},
138#line 11 "pt-limit.gperf"
139 {"mac",UINT32_MAX,UINT32_MAX},
140 {""}, {""}, {""}, {""},
141#line 20 "pt-limit.gperf"
142 {"bsd",UINT32_MAX,UINT32_MAX},
143 {""}, {""}, {""}, {""},
144#line 24 "pt-limit.gperf"
145 {"pc98",UINT32_MAX,UINT32_MAX}
146 };
147
148 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
149 {
150 register unsigned int key = hash (str, len);
151
152 if (key <= MAX_HASH_VALUE)
153 {
154 register const char *s = wordlist[key].name;
155
156 if (*str == *s && !strcmp (str + 1, s + 1))
157 return &wordlist[key];
158 }
159 }
160 return 0;
161}