diff options
author | Paolo Bonzini | 2020-08-18 11:55:47 +0200 |
---|---|---|
committer | Paolo Bonzini | 2020-09-30 19:11:36 +0200 |
commit | f4f5ed2cbde65acaa1bd88d00cc23fa8bf6b5ed9 (patch) | |
tree | 360170b2967cd6586b9c32744c3b16671b283880 /include/qemu | |
parent | oslib-posix: default exec_dir to bindir (diff) | |
download | qemu-f4f5ed2cbde65acaa1bd88d00cc23fa8bf6b5ed9.tar.gz qemu-f4f5ed2cbde65acaa1bd88d00cc23fa8bf6b5ed9.tar.xz qemu-f4f5ed2cbde65acaa1bd88d00cc23fa8bf6b5ed9.zip |
cutils: introduce get_relocated_path
Add the function that will compute a relocated version of the
directories in CONFIG_QEMU_*DIR and CONFIG_QEMU_*PATH.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/qemu')
-rw-r--r-- | include/qemu/cutils.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h index eb59852dfd..3a86ec0321 100644 --- a/include/qemu/cutils.h +++ b/include/qemu/cutils.h @@ -184,4 +184,16 @@ int uleb128_decode_small(const uint8_t *in, uint32_t *n); */ int qemu_pstrcmp0(const char **str1, const char **str2); + +/** + * get_relocated_path: + * @dir: the directory (typically a `CONFIG_*DIR` variable) to be relocated. + * + * Returns a path for @dir that uses the directory of the running executable + * as the prefix. For example, if `bindir` is `/usr/bin` and @dir is + * `/usr/share/qemu`, the function will append `../share/qemu` to the + * directory that contains the running executable and return the result. + */ +char *get_relocated_path(const char *dir); + #endif |