+static const char *disk_type_to_prefix_string(SkDiskType type) {
+
+ /* %STRINGPOOLSTART% */
+ static const char* const map[_SK_DISK_TYPE_MAX] = {
+ [SK_DISK_TYPE_ATA_PASSTHROUGH_16] = "sat16",
+ [SK_DISK_TYPE_ATA_PASSTHROUGH_12] = "sat12",
+ [SK_DISK_TYPE_LINUX_IDE] = "linux-ide",
+ [SK_DISK_TYPE_SUNPLUS] = "sunplus",
+ [SK_DISK_TYPE_JMICRON] = "jmicron",
+ [SK_DISK_TYPE_NONE] = "none",
+ [SK_DISK_TYPE_AUTO] = "auto",
+ };
+ /* %STRINGPOOLSTOP% */
+
+ if (type >= _SK_DISK_TYPE_MAX)
+ return NULL;
+
+ return _P(map[type]);
+}
+
+static const char *disk_type_from_string(const char *s, SkDiskType *type) {
+ unsigned u;
+
+ assert(s);
+ assert(type);
+
+ for (u = 0; u < _SK_DISK_TYPE_MAX; u++) {
+ const char *t;
+ size_t l;
+
+ if (!(t = disk_type_to_prefix_string(u)))
+ continue;
+
+ l = strlen(t);
+
+ if (strncmp(s, t, l))
+ continue;
+
+ if (s[l] != ':')
+ continue;
+
+ *type = u;
+
+ return s + l + 1;
+ }
+
+ return NULL;
+}
+