From f5bebbbb28dc7a149a891f0f1e112fb50bb72664 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 30 Sep 2014 13:59:30 +0200 Subject: util: Emancipate id_wellformed() from QemuOpts IDs have long spread beyond QemuOpts: not everything with an ID necessarily goes through QemuOpts. Commit 9aebf3b is about such a case: block layer names are meant to be well-formed IDs, but some of them don't go through QemuOpts, and thus weren't checked. The commit fixed that the straightforward way: rename the internal QemuOpts helper id_wellformed() to qemu_opts_id_wellformed() and give it external linkage. Instead of using it directly in block.c, the commit adds wrapper bdrv_is_valid_name(), probably to hide the connection to QemuOpts. Go one logical step further: emancipate IDs from QemuOpts. Rename the function back to id_wellformed(), and put it in another file. While there, clean up its value to bool. Peel off the bdrv_is_valid_name() wrapper. [Replaced stray return 0 with return false to match bool returns used elsewhere in id_wellformed(). --Stefan] Signed-off-by: Markus Armbruster Signed-off-by: Stefan Hajnoczi --- include/qemu-common.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/qemu-common.h') diff --git a/include/qemu-common.h b/include/qemu-common.h index dcb57ab4b9..b87e9c2d8b 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -190,6 +190,9 @@ int64_t strtosz_suffix_unit(const char *nptr, char **end, /* used to print char* safely */ #define STR_OR_NULL(str) ((str) ? (str) : "null") +/* id.c */ +bool id_wellformed(const char *id); + /* path.c */ void init_paths(const char *prefix); const char *path(const char *pathname); -- cgit v1.2.1