datadir: Use bundle mechanism

softmmu/datadir.c had its own implementation to find files in the
build tree, but now bundle mechanism provides the unified
implementation which works for datadir and the other files.

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Message-Id: <20220624145039.49929-4-akihiko.odaki@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Akihiko Odaki 2022-06-24 23:50:38 +09:00 committed by Paolo Bonzini
parent cf60ccc330
commit 882084a04a
6 changed files with 15 additions and 69 deletions

View file

@ -158,8 +158,6 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char ***envp)
{
char *target_name;
const char *bindir;
char *datadir;
GString *cmd_line;
gchar *pretty_cmd_line;
bool serialize = false;
@ -174,22 +172,6 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char ***envp)
target_name = strstr(**argv, "-target-");
if (target_name) { /* The binary name specifies the target */
target_name += strlen("-target-");
/*
* With oss-fuzz, the executable is kept in the root of a directory (we
* cannot assume the path). All data (including bios binaries) must be
* in the same dir, or a subdir. Thus, we cannot place the pc-bios so
* that it would be in exec_dir/../pc-bios.
* As a workaround, oss-fuzz allows us to use argv[0] to get the
* location of the executable. Using this we add exec_dir/pc-bios to
* the datadirs.
*/
bindir = qemu_get_exec_dir();
datadir = g_build_filename(bindir, "pc-bios", NULL);
if (g_file_test(datadir, G_FILE_TEST_IS_DIR)) {
qemu_add_data_dir(datadir);
} else {
g_free(datadir);
}
} else if (*argc > 1) { /* The target is specified as an argument */
target_name = (*argv)[1];
if (!strstr(target_name, "--fuzz-target=")) {