import: add generic enum for choosing between tar + raw downloads
This commit is contained in:
@@ -126,9 +126,16 @@ int import_url_change_suffix(
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char* const import_type_table[_IMPORT_TYPE_MAX] = {
|
||||
[IMPORT_RAW] = "raw",
|
||||
[IMPORT_TAR] = "tar",
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(import_type, ImportType);
|
||||
|
||||
static const char* const import_verify_table[_IMPORT_VERIFY_MAX] = {
|
||||
[IMPORT_VERIFY_NO] = "no",
|
||||
[IMPORT_VERIFY_CHECKSUM] = "checksum",
|
||||
[IMPORT_VERIFY_NO] = "no",
|
||||
[IMPORT_VERIFY_CHECKSUM] = "checksum",
|
||||
[IMPORT_VERIFY_SIGNATURE] = "signature",
|
||||
};
|
||||
|
||||
|
||||
@@ -5,6 +5,13 @@
|
||||
|
||||
#include "macro.h"
|
||||
|
||||
typedef enum ImportType {
|
||||
IMPORT_RAW,
|
||||
IMPORT_TAR,
|
||||
_IMPORT_TYPE_MAX,
|
||||
_IMPORT_TYPE_INVALID = -EINVAL,
|
||||
} ImportType;
|
||||
|
||||
typedef enum ImportVerify {
|
||||
IMPORT_VERIFY_NO,
|
||||
IMPORT_VERIFY_CHECKSUM,
|
||||
@@ -25,6 +32,9 @@ static inline int import_url_append_component(const char *url, const char *suffi
|
||||
return import_url_change_suffix(url, 0, suffix, ret);
|
||||
}
|
||||
|
||||
const char* import_type_to_string(ImportType v) _const_;
|
||||
ImportType import_type_from_string(const char *s) _pure_;
|
||||
|
||||
const char* import_verify_to_string(ImportVerify v) _const_;
|
||||
ImportVerify import_verify_from_string(const char *s) _pure_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user