Move win32 early signal handling setup to os_setup_signal_handling()
[qemu.git] / fsdev / qemu-fsdev.c
blob813e1f77a45040ff27263c23cbf9a5d7c12e6087
1 /*
2 * Virtio 9p
4 * Copyright IBM, Corp. 2010
6 * Authors:
7 * Gautham R Shenoy <ego@in.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
13 #include <stdio.h>
14 #include <string.h>
15 #include "qemu-fsdev.h"
16 #include "qemu-queue.h"
17 #include "osdep.h"
18 #include "qemu-common.h"
20 static QTAILQ_HEAD(FsTypeEntry_head, FsTypeListEntry) fstype_entries =
21 QTAILQ_HEAD_INITIALIZER(fstype_entries);
23 static FsTypeTable FsTypes[] = {
24 { .name = "local", .ops = &local_ops},
27 int qemu_fsdev_add(QemuOpts *opts)
29 struct FsTypeListEntry *fsle;
30 int i;
32 if (qemu_opts_id(opts) == NULL) {
33 fprintf(stderr, "fsdev: No id specified\n");
34 return -1;
37 for (i = 0; i < ARRAY_SIZE(FsTypes); i++) {
38 if (strcmp(FsTypes[i].name, qemu_opt_get(opts, "fstype")) == 0) {
39 break;
43 if (i == ARRAY_SIZE(FsTypes)) {
44 fprintf(stderr, "fsdev: fstype %s not found\n",
45 qemu_opt_get(opts, "fstype"));
46 return -1;
49 fsle = qemu_malloc(sizeof(*fsle));
51 fsle->fse.fsdev_id = qemu_strdup(qemu_opts_id(opts));
52 fsle->fse.path = qemu_strdup(qemu_opt_get(opts, "path"));
53 fsle->fse.ops = FsTypes[i].ops;
55 QTAILQ_INSERT_TAIL(&fstype_entries, fsle, next);
56 return 0;
60 FsTypeEntry *get_fsdev_fsentry(char *id)
62 struct FsTypeListEntry *fsle;
64 QTAILQ_FOREACH(fsle, &fstype_entries, next) {
65 if (strcmp(fsle->fse.fsdev_id, id) == 0) {
66 return &fsle->fse;
69 return NULL;