FILE
xenbus.h
File preview with syntax highlighting.
linux-6.19.14/drivers/xen/xenbus/xenbus.h
1/* 2 * Private include for xenbus communications. 3 * 4 * Copyright (C) 2005 Rusty Russell, IBM Corporation 5 * Copyright (C) 2005 XenSource Ltd. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License version 2 9 * as published by the Free Software Foundation; or, when distributed 10 * separately from the Linux kernel or incorporated into other 11 * software packages, subject to the following license: 12 * 13 * Permission is hereby granted, free of charge, to any person obtaining a copy 14 * of this source file (the "Software"), to deal in the Software without 15 * restriction, including without limitation the rights to use, copy, modify, 16 * merge, publish, distribute, sublicense, and/or sell copies of the Software, 17 * and to permit persons to whom the Software is furnished to do so, subject to 18 * the following conditions: 19 * 20 * The above copyright notice and this permission notice shall be included in 21 * all copies or substantial portions of the Software. 22 * 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 29 * IN THE SOFTWARE. 30 */ 31 32#ifndef _XENBUS_XENBUS_H 33#define _XENBUS_XENBUS_H 34 35#include <linux/mutex.h> 36#include <linux/uio.h> 37#include <xen/xenbus.h> 38 39#define XEN_BUS_ID_SIZE 20 40 41struct xen_bus_type { 42 char *root; 43 unsigned int levels; 44 int (*get_bus_id)(char bus_id[XEN_BUS_ID_SIZE], const char *nodename); 45 int (*probe)(struct xen_bus_type *bus, const char *type, 46 const char *dir); 47 bool (*otherend_will_handle)(struct xenbus_watch *watch, 48 const char *path, const char *token); 49 void (*otherend_changed)(struct xenbus_watch *watch, const char *path, 50 const char *token); 51 struct bus_type bus; 52}; 53 54enum xenstore_init { 55 XS_UNKNOWN, 56 XS_PV, 57 XS_HVM, 58 XS_LOCAL, 59}; 60 61struct xs_watch_event { 62 struct list_head list; 63 unsigned int len; 64 struct xenbus_watch *handle; 65 const char *path; 66 const char *token; 67 char body[]; 68}; 69 70enum xb_req_state { 71 xb_req_state_queued, 72 xb_req_state_wait_reply, 73 xb_req_state_got_reply, 74 xb_req_state_aborted 75}; 76 77struct xb_req_data { 78 struct list_head list; 79 wait_queue_head_t wq; 80 struct kref kref; 81 struct xsd_sockmsg msg; 82 uint32_t caller_req_id; 83 enum xsd_sockmsg_type type; 84 char *body; 85 const struct kvec *vec; 86 int num_vecs; 87 int err; 88 enum xb_req_state state; 89 bool user_req; 90 void (*cb)(struct xb_req_data *); 91 void *par; 92}; 93 94extern enum xenstore_init xen_store_domain_type; 95extern const struct attribute_group *xenbus_dev_groups[]; 96extern struct mutex xs_response_mutex; 97extern struct list_head xs_reply_list; 98extern struct list_head xb_write_list; 99extern wait_queue_head_t xb_waitq; 100extern struct mutex xb_write_mutex; 101 102int xs_init(void); 103int xb_init_comms(void); 104void xb_deinit_comms(void); 105int xs_watch_msg(struct xs_watch_event *event); 106void xs_request_exit(struct xb_req_data *req); 107void xs_free_req(struct kref *kref); 108 109int xenbus_match(struct device *_dev, const struct device_driver *_drv); 110int xenbus_dev_probe(struct device *_dev); 111void xenbus_dev_remove(struct device *_dev); 112int xenbus_register_driver_common(struct xenbus_driver *drv, 113 struct xen_bus_type *bus, 114 struct module *owner, 115 const char *mod_name); 116int xenbus_probe_node(struct xen_bus_type *bus, 117 const char *type, 118 const char *nodename); 119int xenbus_probe_devices(struct xen_bus_type *bus); 120 121void xenbus_dev_changed(const char *node, struct xen_bus_type *bus); 122 123int xenbus_dev_suspend(struct device *dev); 124int xenbus_dev_resume(struct device *dev); 125int xenbus_dev_cancel(struct device *dev); 126 127void xenbus_otherend_changed(struct xenbus_watch *watch, 128 const char *path, const char *token, 129 int ignore_on_shutdown); 130 131int xenbus_read_otherend_details(struct xenbus_device *xendev, 132 char *id_node, char *path_node); 133 134void xenbus_ring_ops_init(void); 135 136int xenbus_dev_request_and_reply(struct xsd_sockmsg *msg, void *par); 137void xenbus_dev_queue_reply(struct xb_req_data *req); 138 139extern unsigned int xb_dev_generation_id; 140 141#endif
~/
Read-only file preview.