2017-02-09 20:39:56 +07:00
|
|
|
/*
|
|
|
|
* Private include for xenbus communications.
|
2007-07-18 08:37:06 +07:00
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Rusty Russell, IBM Corporation
|
|
|
|
* Copyright (C) 2005 XenSource Ltd.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License version 2
|
|
|
|
* as published by the Free Software Foundation; or, when distributed
|
|
|
|
* separately from the Linux kernel or incorporated into other
|
|
|
|
* software packages, subject to the following license:
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this source file (the "Software"), to deal in the Software without
|
|
|
|
* restriction, including without limitation the rights to use, copy, modify,
|
|
|
|
* merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
|
|
|
* and to permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
|
|
* IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2017-02-09 20:39:56 +07:00
|
|
|
#ifndef _XENBUS_XENBUS_H
|
|
|
|
#define _XENBUS_XENBUS_H
|
2007-07-18 08:37:06 +07:00
|
|
|
|
2017-02-09 20:39:58 +07:00
|
|
|
#include <linux/mutex.h>
|
|
|
|
#include <linux/uio.h>
|
|
|
|
#include <xen/xenbus.h>
|
|
|
|
|
2009-01-07 01:44:34 +07:00
|
|
|
#define XEN_BUS_ID_SIZE 20
|
|
|
|
|
2011-07-26 18:17:01 +07:00
|
|
|
struct xen_bus_type {
|
2007-07-18 08:37:06 +07:00
|
|
|
char *root;
|
|
|
|
unsigned int levels;
|
2009-01-07 01:44:34 +07:00
|
|
|
int (*get_bus_id)(char bus_id[XEN_BUS_ID_SIZE], const char *nodename);
|
2010-12-10 21:39:15 +07:00
|
|
|
int (*probe)(struct xen_bus_type *bus, const char *type,
|
|
|
|
const char *dir);
|
2017-02-09 20:39:57 +07:00
|
|
|
void (*otherend_changed)(struct xenbus_watch *watch, const char *path,
|
|
|
|
const char *token);
|
2007-07-18 08:37:06 +07:00
|
|
|
struct bus_type bus;
|
|
|
|
};
|
|
|
|
|
2013-05-29 00:09:55 +07:00
|
|
|
enum xenstore_init {
|
|
|
|
XS_UNKNOWN,
|
|
|
|
XS_PV,
|
|
|
|
XS_HVM,
|
|
|
|
XS_LOCAL,
|
|
|
|
};
|
|
|
|
|
2017-02-09 20:39:58 +07:00
|
|
|
struct xs_watch_event {
|
|
|
|
struct list_head list;
|
|
|
|
unsigned int len;
|
|
|
|
struct xenbus_watch *handle;
|
|
|
|
const char *path;
|
|
|
|
const char *token;
|
|
|
|
char body[];
|
|
|
|
};
|
|
|
|
|
|
|
|
enum xb_req_state {
|
|
|
|
xb_req_state_queued,
|
|
|
|
xb_req_state_wait_reply,
|
|
|
|
xb_req_state_got_reply,
|
|
|
|
xb_req_state_aborted
|
|
|
|
};
|
|
|
|
|
|
|
|
struct xb_req_data {
|
|
|
|
struct list_head list;
|
|
|
|
wait_queue_head_t wq;
|
|
|
|
struct xsd_sockmsg msg;
|
2018-02-03 00:42:33 +07:00
|
|
|
uint32_t caller_req_id;
|
2017-02-09 20:39:58 +07:00
|
|
|
enum xsd_sockmsg_type type;
|
|
|
|
char *body;
|
|
|
|
const struct kvec *vec;
|
|
|
|
int num_vecs;
|
|
|
|
int err;
|
|
|
|
enum xb_req_state state;
|
|
|
|
void (*cb)(struct xb_req_data *);
|
|
|
|
void *par;
|
|
|
|
};
|
|
|
|
|
2017-02-09 20:39:56 +07:00
|
|
|
extern enum xenstore_init xen_store_domain_type;
|
2013-10-07 13:55:49 +07:00
|
|
|
extern const struct attribute_group *xenbus_dev_groups[];
|
2017-02-09 20:39:58 +07:00
|
|
|
extern struct mutex xs_response_mutex;
|
|
|
|
extern struct list_head xs_reply_list;
|
|
|
|
extern struct list_head xb_write_list;
|
|
|
|
extern wait_queue_head_t xb_waitq;
|
|
|
|
extern struct mutex xb_write_mutex;
|
2011-06-29 19:39:26 +07:00
|
|
|
|
2017-02-09 20:39:56 +07:00
|
|
|
int xs_init(void);
|
|
|
|
int xb_init_comms(void);
|
|
|
|
void xb_deinit_comms(void);
|
2017-02-09 20:39:58 +07:00
|
|
|
int xs_watch_msg(struct xs_watch_event *event);
|
|
|
|
void xs_request_exit(struct xb_req_data *req);
|
2017-02-09 20:39:56 +07:00
|
|
|
|
|
|
|
int xenbus_match(struct device *_dev, struct device_driver *_drv);
|
|
|
|
int xenbus_dev_probe(struct device *_dev);
|
|
|
|
int xenbus_dev_remove(struct device *_dev);
|
|
|
|
int xenbus_register_driver_common(struct xenbus_driver *drv,
|
|
|
|
struct xen_bus_type *bus,
|
|
|
|
struct module *owner,
|
|
|
|
const char *mod_name);
|
|
|
|
int xenbus_probe_node(struct xen_bus_type *bus,
|
|
|
|
const char *type,
|
|
|
|
const char *nodename);
|
|
|
|
int xenbus_probe_devices(struct xen_bus_type *bus);
|
2007-07-18 08:37:06 +07:00
|
|
|
|
2017-02-09 20:39:56 +07:00
|
|
|
void xenbus_dev_changed(const char *node, struct xen_bus_type *bus);
|
2007-07-18 08:37:06 +07:00
|
|
|
|
2017-02-09 20:39:56 +07:00
|
|
|
void xenbus_dev_shutdown(struct device *_dev);
|
2009-02-10 03:05:51 +07:00
|
|
|
|
2017-02-09 20:39:56 +07:00
|
|
|
int xenbus_dev_suspend(struct device *dev);
|
|
|
|
int xenbus_dev_resume(struct device *dev);
|
|
|
|
int xenbus_dev_cancel(struct device *dev);
|
2009-02-10 03:05:51 +07:00
|
|
|
|
2017-02-09 20:39:56 +07:00
|
|
|
void xenbus_otherend_changed(struct xenbus_watch *watch,
|
2017-02-09 20:39:57 +07:00
|
|
|
const char *path, const char *token,
|
2017-02-09 20:39:56 +07:00
|
|
|
int ignore_on_shutdown);
|
2009-02-10 03:05:51 +07:00
|
|
|
|
2017-02-09 20:39:56 +07:00
|
|
|
int xenbus_read_otherend_details(struct xenbus_device *xendev,
|
|
|
|
char *id_node, char *path_node);
|
2009-02-10 03:05:51 +07:00
|
|
|
|
2011-12-20 02:55:14 +07:00
|
|
|
void xenbus_ring_ops_init(void);
|
|
|
|
|
2017-02-09 20:39:58 +07:00
|
|
|
int xenbus_dev_request_and_reply(struct xsd_sockmsg *msg, void *par);
|
|
|
|
void xenbus_dev_queue_reply(struct xb_req_data *req);
|
2017-02-09 20:39:56 +07:00
|
|
|
|
2007-07-18 08:37:06 +07:00
|
|
|
#endif
|