aboutsummaryrefslogtreecommitdiff
path: root/include/qemu
diff options
context:
space:
mode:
authorYi Liu <yi.l.liu@intel.com>2023-11-21 16:44:01 +0800
committerCédric Le Goater <clg@redhat.com>2023-12-19 19:03:38 +0100
commitd6b5c4c1b516a8176b74ec35a0af8cf89b04b6c1 (patch)
tree4410f17ee6d5824cf7a85c615fd1faa568d6f092 /include/qemu
parent6e6d8ac62b5b38dc9d4b69ffdf073f0a0b43b7be (diff)
downloadqemu-d6b5c4c1b516a8176b74ec35a0af8cf89b04b6c1.zip
qemu-d6b5c4c1b516a8176b74ec35a0af8cf89b04b6c1.tar.gz
qemu-d6b5c4c1b516a8176b74ec35a0af8cf89b04b6c1.tar.bz2
util/char_dev: Add open_cdev()
/dev/vfio/devices/vfioX may not exist. In that case it is still possible to open /dev/char/$major:$minor instead. Add helper function to abstract the cdev open. Suggested-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Yi Liu <yi.l.liu@intel.com> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Tested-by: Eric Auger <eric.auger@redhat.com> Tested-by: Nicolin Chen <nicolinc@nvidia.com> Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'include/qemu')
-rw-r--r--include/qemu/chardev_open.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/qemu/chardev_open.h b/include/qemu/chardev_open.h
new file mode 100644
index 0000000..64e8fcf
--- /dev/null
+++ b/include/qemu/chardev_open.h
@@ -0,0 +1,16 @@
+/*
+ * QEMU Chardev Helper
+ *
+ * Copyright (C) 2023 Intel Corporation.
+ *
+ * Authors: Yi Liu <yi.l.liu@intel.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_CHARDEV_OPEN_H
+#define QEMU_CHARDEV_OPEN_H
+
+int open_cdev(const char *devpath, dev_t cdev);
+#endif