mirror of
https://github.com/qemu/qemu.git
synced 2024-12-28 14:43:49 +08:00
1a6ed33cc5
'warn' (default): Only log an error message (once) on host if more than one device is shared by same export, except of that just ignore this config error though. This is the default behaviour for not breaking existing installations implying that they really know what they are doing. 'forbid': Like 'warn', but except of just logging an error this also denies access of guest to additional devices. 'remap': Allows to share more than one device per export by remapping inodes from host to guest appropriately. To support multiple devices on the 9p share, and avoid qid path collisions we take the device id as input to generate a unique QID path. The lowest 48 bits of the path will be set equal to the file inode, and the top bits will be uniquely assigned based on the top 16 bits of the inode and the device id. Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com> [CS: - Rebased to https://github.com/gkurz/qemu/commits/9p-next (SHA1 7fc4c49e91). - Added virtfs option 'multidevs', original patch simply did the inode remapping without being asked. - Updated hash calls to new xxhash API. - Updated docs for new option 'multidevs'. - Fixed v9fs_do_readdir() not having remapped inodes. - Log error message when running out of prefixes in qid_path_prefixmap(). - Fixed definition of QPATH_INO_MASK. - Wrapped qpp_table initialization to dedicated qpp_table_init() function. - Dropped unnecessary parantheses in qpp_lookup_func(). - Dropped unnecessary g_malloc0() result checks. ] Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com> [groug: - Moved "multidevs" parsing to the local backend. - Added hint to invalid multidevs option error. - Turn "remap" into "x-remap". ] Signed-off-by: Greg Kurz <groug@kaod.org>
107 lines
2.6 KiB
C
107 lines
2.6 KiB
C
/*
|
|
* 9p
|
|
*
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or
|
|
* later. See the COPYING file in the top-level directory.
|
|
*/
|
|
|
|
#include "qemu/osdep.h"
|
|
#include "qemu/config-file.h"
|
|
#include "qemu/option.h"
|
|
#include "qemu/module.h"
|
|
#include "qemu/throttle-options.h"
|
|
|
|
static QemuOptsList qemu_fsdev_opts = {
|
|
.name = "fsdev",
|
|
.implied_opt_name = "fsdriver",
|
|
.head = QTAILQ_HEAD_INITIALIZER(qemu_fsdev_opts.head),
|
|
.desc = {
|
|
{
|
|
.name = "fsdriver",
|
|
.type = QEMU_OPT_STRING,
|
|
}, {
|
|
.name = "path",
|
|
.type = QEMU_OPT_STRING,
|
|
}, {
|
|
.name = "security_model",
|
|
.type = QEMU_OPT_STRING,
|
|
}, {
|
|
.name = "writeout",
|
|
.type = QEMU_OPT_STRING,
|
|
}, {
|
|
.name = "readonly",
|
|
.type = QEMU_OPT_BOOL,
|
|
}, {
|
|
.name = "multidevs",
|
|
.type = QEMU_OPT_STRING,
|
|
}, {
|
|
.name = "socket",
|
|
.type = QEMU_OPT_STRING,
|
|
}, {
|
|
.name = "sock_fd",
|
|
.type = QEMU_OPT_NUMBER,
|
|
}, {
|
|
.name = "fmode",
|
|
.type = QEMU_OPT_NUMBER,
|
|
}, {
|
|
.name = "dmode",
|
|
.type = QEMU_OPT_NUMBER,
|
|
},
|
|
|
|
THROTTLE_OPTS,
|
|
|
|
{ /*End of list */ }
|
|
},
|
|
};
|
|
|
|
static QemuOptsList qemu_virtfs_opts = {
|
|
.name = "virtfs",
|
|
.implied_opt_name = "fsdriver",
|
|
.head = QTAILQ_HEAD_INITIALIZER(qemu_virtfs_opts.head),
|
|
.desc = {
|
|
{
|
|
.name = "fsdriver",
|
|
.type = QEMU_OPT_STRING,
|
|
}, {
|
|
.name = "path",
|
|
.type = QEMU_OPT_STRING,
|
|
}, {
|
|
.name = "mount_tag",
|
|
.type = QEMU_OPT_STRING,
|
|
}, {
|
|
.name = "security_model",
|
|
.type = QEMU_OPT_STRING,
|
|
}, {
|
|
.name = "writeout",
|
|
.type = QEMU_OPT_STRING,
|
|
}, {
|
|
.name = "readonly",
|
|
.type = QEMU_OPT_BOOL,
|
|
}, {
|
|
.name = "multidevs",
|
|
.type = QEMU_OPT_STRING,
|
|
}, {
|
|
.name = "socket",
|
|
.type = QEMU_OPT_STRING,
|
|
}, {
|
|
.name = "sock_fd",
|
|
.type = QEMU_OPT_NUMBER,
|
|
}, {
|
|
.name = "fmode",
|
|
.type = QEMU_OPT_NUMBER,
|
|
}, {
|
|
.name = "dmode",
|
|
.type = QEMU_OPT_NUMBER,
|
|
},
|
|
|
|
{ /*End of list */ }
|
|
},
|
|
};
|
|
|
|
static void fsdev_register_config(void)
|
|
{
|
|
qemu_add_opts(&qemu_fsdev_opts);
|
|
qemu_add_opts(&qemu_virtfs_opts);
|
|
}
|
|
opts_init(fsdev_register_config);
|