[LINUX][XENBUS] replace xenbus_transaction_t with an opaque transaction ID.

xenbus_transaction_t -> struct xenbus_transaction, which just contains
a single u32.  Also renamed XBT_NULL to XBT_NIL to emphasize that it
isn't a NULL pointer, but a NIL transaction ID.  Compile and boot tested.

Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
[chrisw: updated for xen-unstable from patchqueue]
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
This commit is contained in:
kaf24@firebug.cl.cam.ac.uk committed 2006-06-09 14:25:46 +01:00
1 parent 40c3d9a1be
commit 92fffc0727
16 files changed
+87 -83

No files matched your search

@@ -274,7 +274,7 @@ static int talk_to_backend(struct xenbus_device *dev,
{
const char *message = NULL;
int err;
xenbus_transaction_t xbt;
struct xenbus_transaction xbt;
err = setup_tpmring(dev, tp);
if (err) {
@@ -369,7 +369,7 @@ static int tpmfront_probe(struct xenbus_device *dev,
if (!tp)
return -ENOMEM;
err = xenbus_scanf(XBT_NULL, dev->nodename,
err = xenbus_scanf(XBT_NIL, dev->nodename,
"handle", "%i", &handle);
if (XENBUS_EXIST_ERR(err))
return err;
@@ -378,7 +378,7 @@ static void watch_target(struct xenbus_watch *watch,
unsigned long long new_target;
int err;
err = xenbus_scanf(XBT_NULL, "memory", "target", "%llu", &new_target);
err = xenbus_scanf(XBT_NIL, "memory", "target", "%llu", &new_target);
if (err != 1) {
/* This is ok (for domain0 at least) - so just return */
return;
@@ -186,7 +186,7 @@ static void backend_changed(struct xenbus_watch *watch,
DPRINTK("");
err = xenbus_scanf(XBT_NULL, dev->nodename, "physical-device", "%x:%x",
err = xenbus_scanf(XBT_NIL, dev->nodename, "physical-device", "%x:%x",
&major, &minor);
if (XENBUS_EXIST_ERR(err)) {
/* Since this watch will fire once immediately after it is
@@ -208,7 +208,7 @@ static void backend_changed(struct xenbus_watch *watch,
return;
}
be->mode = xenbus_read(XBT_NULL, dev->nodename, "mode", NULL);
be->mode = xenbus_read(XBT_NIL, dev->nodename, "mode", NULL);
if (IS_ERR(be->mode)) {
err = PTR_ERR(be->mode);
be->mode = NULL;
@@ -299,7 +299,7 @@ static void frontend_changed(struct xenbus_device *dev,
*/
static void connect(struct backend_info *be)
{
xenbus_transaction_t xbt;
struct xenbus_transaction xbt;
int err;
struct xenbus_device *dev = be->dev;
@@ -364,7 +364,7 @@ static int connect_ring(struct backend_info *be)
DPRINTK("%s", dev->otherend);
err = xenbus_gather(XBT_NULL, dev->otherend, "ring-ref", "%lu", &ring_ref,
err = xenbus_gather(XBT_NIL, dev->otherend, "ring-ref", "%lu", &ring_ref,
"event-channel", "%u", &evtchn, NULL);
if (err) {
xenbus_dev_fatal(dev, err,
@@ -83,7 +83,7 @@ static int blkfront_probe(struct xenbus_device *dev,
struct blkfront_info *info;
/* FIXME: Use dynamic device id if this is not set. */
err = xenbus_scanf(XBT_NULL, dev->nodename,
err = xenbus_scanf(XBT_NIL, dev->nodename,
"virtual-device", "%i", &vdevice);
if (err != 1) {
xenbus_dev_fatal(dev, err, "reading virtual-device");
@@ -148,7 +148,7 @@ static int talk_to_backend(struct xenbus_device *dev,
struct blkfront_info *info)
{
const char *message = NULL;
xenbus_transaction_t xbt;
struct xenbus_transaction xbt;
int err;
/* Create shared ring, alloc event channel. */
@@ -303,7 +303,7 @@ static void connect(struct blkfront_info *info)
DPRINTK("blkfront.c:connect:%s.\n", info->xbdev->otherend);
err = xenbus_gather(XBT_NULL, info->xbdev->otherend,
err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
"sectors", "%lu", &sectors,
"info", "%u", &binfo,
"sector-size", "%lu", &sector_size,
@@ -34,7 +34,7 @@ static void vcpu_hotplug(unsigned int cpu)
return;
sprintf(dir, "cpu/%d", cpu);
err = xenbus_scanf(XBT_NULL, dir, "availability", "%s", state);
err = xenbus_scanf(XBT_NIL, dir, "availability", "%s", state);
if (err != 1) {
printk(KERN_ERR "XENBUS: Unable to read cpu state\n");
return;
@@ -250,7 +250,7 @@ static void shutdown_handler(struct xenbus_watch *watch,
const char **vec, unsigned int len)
{
char *str;
xenbus_transaction_t xbt;
struct xenbus_transaction xbt;
int err;
if (shutting_down != SHUTDOWN_INVALID)
@@ -298,7 +298,7 @@ static void sysrq_handler(struct xenbus_watch *watch, const char **vec,
unsigned int len)
{
char sysrq_key = '\0';
xenbus_transaction_t xbt;
struct xenbus_transaction xbt;
int err;
again:
@@ -70,7 +70,7 @@ static int netback_probe(struct xenbus_device *dev,
const struct xenbus_device_id *id)
{
const char *message;
xenbus_transaction_t xbt;
struct xenbus_transaction xbt;
int err;
struct backend_info *be = kzalloc(sizeof(struct backend_info),
GFP_KERNEL);
@@ -141,7 +141,7 @@ static int netback_uevent(struct xenbus_device *xdev, char **envp,
DPRINTK("netback_uevent");
val = xenbus_read(XBT_NULL, xdev->nodename, "script", NULL);
val = xenbus_read(XBT_NIL, xdev->nodename, "script", NULL);
if (IS_ERR(val)) {
int err = PTR_ERR(val);
xenbus_dev_fatal(xdev, err, "reading script");
@@ -177,7 +177,7 @@ static void backend_changed(struct xenbus_watch *watch,
DPRINTK("");
err = xenbus_scanf(XBT_NULL, dev->nodename, "handle", "%li", &handle);
err = xenbus_scanf(XBT_NIL, dev->nodename, "handle", "%li", &handle);
if (XENBUS_EXIST_ERR(err)) {
/* Since this watch will fire once immediately after it is
registered, we expect this. Ignore it, and wait for the
@@ -268,7 +268,7 @@ static void xen_net_read_rate(struct xenbus_device *dev,
*bytes = ~0UL;
*usec = 0;
ratestr = xenbus_read(XBT_NULL, dev->nodename, "rate", NULL);
ratestr = xenbus_read(XBT_NIL, dev->nodename, "rate", NULL);
if (IS_ERR(ratestr))
return;
@@ -298,7 +298,7 @@ static int xen_net_read_mac(struct xenbus_device *dev, u8 mac[])
char *s, *e, *macstr;
int i;
macstr = s = xenbus_read(XBT_NULL, dev->nodename, "mac", NULL);
macstr = s = xenbus_read(XBT_NIL, dev->nodename, "mac", NULL);
if (IS_ERR(macstr))
return PTR_ERR(macstr);
@@ -347,7 +347,7 @@ static int connect_rings(struct backend_info *be)
DPRINTK("");
err = xenbus_gather(XBT_NULL, dev->otherend,
err = xenbus_gather(XBT_NIL, dev->otherend,
"tx-ring-ref", "%lu", &tx_ring_ref,
"rx-ring-ref", "%lu", &rx_ring_ref,
"event-channel", "%u", &evtchn, NULL);
@@ -193,7 +193,7 @@ static int __devinit netfront_probe(struct xenbus_device *dev,
struct netfront_info *info;
unsigned int handle;
err = xenbus_scanf(XBT_NULL, dev->nodename, "handle", "%u", &handle);
err = xenbus_scanf(XBT_NIL, dev->nodename, "handle", "%u", &handle);
if (err != 1) {
xenbus_dev_fatal(dev, err, "reading handle");
return err;
@@ -243,7 +243,7 @@ static int xen_net_read_mac(struct xenbus_device *dev, u8 mac[])
char *s, *e, *macstr;
int i;
macstr = s = xenbus_read(XBT_NULL, dev->nodename, "mac", NULL);
macstr = s = xenbus_read(XBT_NIL, dev->nodename, "mac", NULL);
if (IS_ERR(macstr))
return PTR_ERR(macstr);
@@ -265,7 +265,7 @@ static int talk_to_backend(struct xenbus_device *dev,
struct netfront_info *info)
{
const char *message;
xenbus_transaction_t xbt;
struct xenbus_transaction xbt;
int err;
err = xen_net_read_mac(dev, info->mac);
@@ -1057,7 +1057,7 @@ static int xennet_set_sg(struct net_device *dev, u32 data)
struct netfront_info *np = netdev_priv(dev);
int val;
if (xenbus_scanf(XBT_NULL, np->xbdev->otherend, "feature-sg",
if (xenbus_scanf(XBT_NIL, np->xbdev->otherend, "feature-sg",
"%d", &val) < 0)
val = 0;
if (!val)
@@ -125,7 +125,7 @@ static int pciback_attach(struct pciback_device *pdev)
dev_dbg(&pdev->xdev->dev, "Reading frontend config\n");
err = xenbus_gather(XBT_NULL, pdev->xdev->otherend,
err = xenbus_gather(XBT_NIL, pdev->xdev->otherend,
"pci-op-ref", "%u", &gnt_ref,
"event-channel", "%u", &remote_evtchn,
"magic", NULL, &magic, NULL);
@@ -200,7 +200,7 @@ static int pciback_publish_pci_root(struct pciback_device *pdev,
dev_dbg(&pdev->xdev->dev, "Publishing pci roots\n");
err = xenbus_scanf(XBT_NULL, pdev->xdev->nodename,
err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename,
"root_num", "%d", &root_num);
if (err == 0 || err == -ENOENT)
root_num = 0;
@@ -215,7 +215,7 @@ static int pciback_publish_pci_root(struct pciback_device *pdev,
goto out;
}
err = xenbus_scanf(XBT_NULL, pdev->xdev->nodename,
err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename,
str, "%x:%x", &d, &b);
if (err < 0)
goto out;
@@ -239,12 +239,12 @@ static int pciback_publish_pci_root(struct pciback_device *pdev,
dev_dbg(&pdev->xdev->dev, "writing root %d at %04x:%02x\n",
root_num, domain, bus);
err = xenbus_printf(XBT_NULL, pdev->xdev->nodename, str,
err = xenbus_printf(XBT_NIL, pdev->xdev->nodename, str,
"%04x:%02x", domain, bus);
if (err)
goto out;
err = xenbus_printf(XBT_NULL, pdev->xdev->nodename,
err = xenbus_printf(XBT_NIL, pdev->xdev->nodename,
"root_num", "%d", (root_num + 1));
out:
@@ -306,7 +306,7 @@ static int pciback_setup_backend(struct pciback_device *pdev)
dev_dbg(&pdev->xdev->dev, "getting be setup\n");
err = xenbus_scanf(XBT_NULL, pdev->xdev->nodename, "num_devs", "%d",
err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, "num_devs", "%d",
&num_devs);
if (err != 1) {
if (err >= 0)
@@ -326,7 +326,7 @@ static int pciback_setup_backend(struct pciback_device *pdev)
goto out;
}
err = xenbus_scanf(XBT_NULL, pdev->xdev->nodename, dev_str,
err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, dev_str,
"%x:%x:%x.%x", &domain, &bus, &slot, &func);
if (err < 0) {
xenbus_dev_fatal(pdev->xdev, err,
@@ -67,7 +67,7 @@ static void free_pdev(struct pcifront_device *pdev)
static int pcifront_publish_info(struct pcifront_device *pdev)
{
int err = 0;
xenbus_transaction_t trans;
struct xenbus_transaction trans;
err = xenbus_grant_ring(pdev->xdev, virt_to_mfn(pdev->sh_info));
if (err < 0)
@@ -143,7 +143,7 @@ static int pcifront_try_connect(struct pcifront_device *pdev)
goto out;
}
err = xenbus_scanf(XBT_NULL, pdev->xdev->otherend,
err = xenbus_scanf(XBT_NIL, pdev->xdev->otherend,
"root_num", "%d", &num_roots);
if (err == -ENOENT) {
xenbus_dev_error(pdev->xdev, err,
@@ -165,7 +165,7 @@ static int pcifront_try_connect(struct pcifront_device *pdev)
goto out;
}
err = xenbus_scanf(XBT_NULL, pdev->xdev->otherend, str,
err = xenbus_scanf(XBT_NIL, pdev->xdev->otherend, str,
"%x:%x", &domain, &bus);
if (err != 2) {
if (err >= 0)
@@ -110,7 +110,7 @@ static void backend_changed(struct xenbus_watch *watch,
= container_of(watch, struct backend_info, backend_watch);
struct xenbus_device *dev = be->dev;
err = xenbus_scanf(XBT_NULL, dev->nodename,
err = xenbus_scanf(XBT_NIL, dev->nodename,
"instance","%li", &instance);
if (XENBUS_EXIST_ERR(err)) {
return;
@@ -204,7 +204,7 @@ static void maybe_connect(struct backend_info *be)
static void connect(struct backend_info *be)
{
xenbus_transaction_t xbt;
struct xenbus_transaction xbt;
int err;
struct xenbus_device *dev = be->dev;
unsigned long ready = 1;
@@ -245,7 +245,7 @@ static int connect_ring(struct backend_info *be)
unsigned int evtchn;
int err;
err = xenbus_gather(XBT_NULL, dev->otherend,
err = xenbus_gather(XBT_NIL, dev->otherend,
"ring-ref", "%lu", &ring_ref,
"event-channel", "%u", &evtchn, NULL);
if (err) {
@@ -106,12 +106,12 @@ int xenbus_switch_state(struct xenbus_device *dev, enum xenbus_state state)
if (state == dev->state)
return 0;
err = xenbus_scanf(XBT_NULL, dev->nodename, "state", "%d",
err = xenbus_scanf(XBT_NIL, dev->nodename, "state", "%d",
&current_state);
if (err != 1)
return 0;
err = xenbus_printf(XBT_NULL, dev->nodename, "state", "%d", state);
err = xenbus_printf(XBT_NIL, dev->nodename, "state", "%d", state);
if (err) {
if (state != XenbusStateClosing) /* Avoid looping */
xenbus_dev_fatal(dev, err, "writing new state");
@@ -162,7 +162,7 @@ void _dev_error(struct xenbus_device *dev, int err, const char *fmt,
goto fail;
}
if (xenbus_write(XBT_NULL, path_buffer, "error", printf_buffer) != 0) {
if (xenbus_write(XBT_NIL, path_buffer, "error", printf_buffer) != 0) {
printk("xenbus: failed to write error node for %s (%s)\n",
dev->nodename, printf_buffer);
goto fail;
@@ -272,7 +272,7 @@ int xenbus_free_evtchn(struct xenbus_device *dev, int port)
enum xenbus_state xenbus_read_driver_state(const char *path)
{
enum xenbus_state result;
int err = xenbus_gather(XBT_NULL, path, "state", "%d", &result, NULL);
int err = xenbus_gather(XBT_NIL, path, "state", "%d", &result, NULL);
if (err)
result = XenbusStateClosed;
@@ -51,7 +51,7 @@
struct xenbus_dev_transaction {
struct list_head list;
xenbus_transaction_t handle;
struct xenbus_transaction handle;
};
struct xenbus_dev_data {
@@ -154,11 +154,11 @@ static ssize_t xenbus_dev_write(struct file *filp,
}
if (msg_type == XS_TRANSACTION_START) {
trans->handle = simple_strtoul(reply, NULL, 0);
trans->handle.id = simple_strtoul(reply, NULL, 0);
list_add(&trans->list, &u->transactions);
} else if (msg_type == XS_TRANSACTION_END) {
list_for_each_entry(trans, &u->transactions, list)
if (trans->handle == u->u.msg.tx_id)
if (trans->handle.id == u->u.msg.tx_id)
break;
BUG_ON(&trans->list == &u->transactions);
list_del(&trans->list);
@@ -128,7 +128,7 @@ static void free_otherend_watch(struct xenbus_device *dev)
static int read_otherend_details(struct xenbus_device *xendev,
char *id_node, char *path_node)
{
int err = xenbus_gather(XBT_NULL, xendev->nodename,
int err = xenbus_gather(XBT_NIL, xendev->nodename,
id_node, "%i", &xendev->otherend_id,
path_node, NULL, &xendev->otherend,
NULL);
@@ -139,7 +139,7 @@ static int read_otherend_details(struct xenbus_device *xendev,
return err;
}
if (strlen(xendev->otherend) == 0 ||
!xenbus_exists(XBT_NULL, xendev->otherend, "")) {
!xenbus_exists(XBT_NIL, xendev->otherend, "")) {
xenbus_dev_fatal(xendev, -ENOENT, "missing other end from %s",
xendev->nodename);
free_otherend_details(xendev);
@@ -195,14 +195,14 @@ static int backend_bus_id(char bus_id[BUS_ID_SIZE], const char *nodename)
devid = strrchr(nodename, '/') + 1;
err = xenbus_gather(XBT_NULL, nodename, "frontend-id", "%i", &domid,
err = xenbus_gather(XBT_NIL, nodename, "frontend-id", "%i", &domid,
"frontend", NULL, &frontend,
NULL);
if (err)
return err;
if (strlen(frontend) == 0)
err = -ERANGE;
if (!err && !xenbus_exists(XBT_NULL, frontend, ""))
if (!err && !xenbus_exists(XBT_NIL, frontend, ""))
err = -ENOENT;
kfree(frontend);
@@ -634,7 +634,7 @@ static int xenbus_probe_backend(const char *type, const char *domid)
if (!nodename)
return -ENOMEM;
dir = xenbus_directory(XBT_NULL, nodename, "", &dir_n);
dir = xenbus_directory(XBT_NIL, nodename, "", &dir_n);
if (IS_ERR(dir)) {
kfree(nodename);
return PTR_ERR(dir);
@@ -657,7 +657,7 @@ static int xenbus_probe_device_type(struct xen_bus_type *bus, const char *type)
unsigned int dir_n = 0;
int i;
dir = xenbus_directory(XBT_NULL, bus->root, type, &dir_n);
dir = xenbus_directory(XBT_NIL, bus->root, type, &dir_n);
if (IS_ERR(dir))
return PTR_ERR(dir);
@@ -676,7 +676,7 @@ static int xenbus_probe_devices(struct xen_bus_type *bus)
char **dir;
unsigned int i, dir_n;
dir = xenbus_directory(XBT_NULL, bus->root, "", &dir_n);
dir = xenbus_directory(XBT_NIL, bus->root, "", &dir_n);
if (IS_ERR(dir))
return PTR_ERR(dir);
@@ -722,7 +722,7 @@ static void dev_changed(const char *node, struct xen_bus_type *bus)
if (char_count(node, '/') < 2)
return;
exists = xenbus_exists(XBT_NULL, node, "");
exists = xenbus_exists(XBT_NIL, node, "");
if (!exists) {
xenbus_cleanup_devices(node, &bus->bus);
return;
@@ -192,7 +192,7 @@ void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg)
}
/* Send message to xs, get kmalloc'ed reply. ERR_PTR() on error. */
static void *xs_talkv(xenbus_transaction_t t,
static void *xs_talkv(struct xenbus_transaction t,
enum xsd_sockmsg_type type,
const struct kvec *iovec,
unsigned int num_vecs,
@@ -203,7 +203,7 @@ static void *xs_talkv(xenbus_transaction_t t,
unsigned int i;
int err;
msg.tx_id = t;
msg.tx_id = t.id;
msg.req_id = 0;
msg.type = type;
msg.len = 0;
@@ -251,7 +251,7 @@ static void *xs_talkv(xenbus_transaction_t t,
}
/* Simplified version of xs_talkv: single message. */
static void *xs_single(xenbus_transaction_t t,
static void *xs_single(struct xenbus_transaction t,
enum xsd_sockmsg_type type,
const char *string,
unsigned int *len)
@@ -318,7 +318,7 @@ static char **split(char *strings, unsigned int len, unsigned int *num)
return ret;
}
char **xenbus_directory(xenbus_transaction_t t,
char **xenbus_directory(struct xenbus_transaction t,
const char *dir, const char *node, unsigned int *num)
{
char *strings, *path;
@@ -338,7 +338,7 @@ char **xenbus_directory(xenbus_transaction_t t,
EXPORT_SYMBOL_GPL(xenbus_directory);
/* Check if a path exists. Return 1 if it does. */
int xenbus_exists(xenbus_transaction_t t,
int xenbus_exists(struct xenbus_transaction t,
const char *dir, const char *node)
{
char **d;
@@ -356,7 +356,7 @@ EXPORT_SYMBOL_GPL(xenbus_exists);
* Returns a kmalloced value: call free() on it after use.
* len indicates length in bytes.
*/
void *xenbus_read(xenbus_transaction_t t,
void *xenbus_read(struct xenbus_transaction t,
const char *dir, const char *node, unsigned int *len)
{
char *path;
@@ -375,7 +375,7 @@ EXPORT_SYMBOL_GPL(xenbus_read);
/* Write the value of a single file.
* Returns -err on failure.
*/
int xenbus_write(xenbus_transaction_t t,
int xenbus_write(struct xenbus_transaction t,
const char *dir, const char *node, const char *string)
{
const char *path;
@@ -398,7 +398,7 @@ int xenbus_write(xenbus_transaction_t t,
EXPORT_SYMBOL_GPL(xenbus_write);
/* Create a new directory. */
int xenbus_mkdir(xenbus_transaction_t t,
int xenbus_mkdir(struct xenbus_transaction t,
const char *dir, const char *node)
{
char *path;
@@ -415,7 +415,7 @@ int xenbus_mkdir(xenbus_transaction_t t,
EXPORT_SYMBOL_GPL(xenbus_mkdir);
/* Destroy a file or directory (directories must be empty). */
int xenbus_rm(xenbus_transaction_t t, const char *dir, const char *node)
int xenbus_rm(struct xenbus_transaction t, const char *dir, const char *node)
{
char *path;
int ret;
@@ -433,19 +433,19 @@ EXPORT_SYMBOL_GPL(xenbus_rm);
/* Start a transaction: changes by others will not be seen during this
* transaction, and changes will not be visible to others until end.
*/
int xenbus_transaction_start(xenbus_transaction_t *t)
int xenbus_transaction_start(struct xenbus_transaction *t)
{
char *id_str;
down_read(&xs_state.suspend_mutex);
id_str = xs_single(XBT_NULL, XS_TRANSACTION_START, "", NULL);
id_str = xs_single(XBT_NIL, XS_TRANSACTION_START, "", NULL);
if (IS_ERR(id_str)) {
up_read(&xs_state.suspend_mutex);
return PTR_ERR(id_str);
}
*t = simple_strtoul(id_str, NULL, 0);
t->id = simple_strtoul(id_str, NULL, 0);
kfree(id_str);
return 0;
}
@@ -454,7 +454,7 @@ EXPORT_SYMBOL_GPL(xenbus_transaction_start);
/* End a transaction.
* If abandon is true, transaction is discarded instead of committed.
*/
int xenbus_transaction_end(xenbus_transaction_t t, int abort)
int xenbus_transaction_end(struct xenbus_transaction t, int abort)
{
char abortstr[2];
int err;
@@ -473,7 +473,7 @@ int xenbus_transaction_end(xenbus_transaction_t t, int abort)
EXPORT_SYMBOL_GPL(xenbus_transaction_end);
/* Single read and scanf: returns -errno or num scanned. */
int xenbus_scanf(xenbus_transaction_t t,
int xenbus_scanf(struct xenbus_transaction t,
const char *dir, const char *node, const char *fmt, ...)
{
va_list ap;
@@ -496,7 +496,7 @@ int xenbus_scanf(xenbus_transaction_t t,
EXPORT_SYMBOL_GPL(xenbus_scanf);
/* Single printf and write: returns -errno or 0. */
int xenbus_printf(xenbus_transaction_t t,
int xenbus_printf(struct xenbus_transaction t,
const char *dir, const char *node, const char *fmt, ...)
{
va_list ap;
@@ -522,7 +522,7 @@ int xenbus_printf(xenbus_transaction_t t,
EXPORT_SYMBOL_GPL(xenbus_printf);
/* Takes tuples of names, scanf-style args, and void **, NULL terminated. */
int xenbus_gather(xenbus_transaction_t t, const char *dir, ...)
int xenbus_gather(struct xenbus_transaction t, const char *dir, ...)
{
va_list ap;
const char *name;
@@ -560,7 +560,7 @@ static int xs_watch(const char *path, const char *token)
iov[1].iov_base = (void *)token;
iov[1].iov_len = strlen(token) + 1;
return xs_error(xs_talkv(XBT_NULL, XS_WATCH, iov,
return xs_error(xs_talkv(XBT_NIL, XS_WATCH, iov,
ARRAY_SIZE(iov), NULL));
}
@@ -573,7 +573,7 @@ static int xs_unwatch(const char *path, const char *token)
iov[1].iov_base = (char *)token;
iov[1].iov_len = strlen(token) + 1;
return xs_error(xs_talkv(XBT_NULL, XS_UNWATCH, iov,
return xs_error(xs_talkv(XBT_NIL, XS_UNWATCH, iov,
ARRAY_SIZE(iov), NULL));
}
+18 -14
View File
@@ -42,8 +42,6 @@
#include <xen/interface/io/xenbus.h>
#include <xen/interface/io/xs_wire.h>
#define XBT_NULL 0
/* Register callback to watch this node. */
struct xenbus_watch
{
@@ -115,35 +113,41 @@ int xenbus_register_frontend(struct xenbus_driver *drv);
int xenbus_register_backend(struct xenbus_driver *drv);
void xenbus_unregister_driver(struct xenbus_driver *drv);
typedef u32 xenbus_transaction_t;
struct xenbus_transaction
{
u32 id;
};
char **xenbus_directory(xenbus_transaction_t t,
/* Nil transaction ID. */
#define XBT_NIL ((struct xenbus_transaction) { 0 })
char **xenbus_directory(struct xenbus_transaction t,
const char *dir, const char *node, unsigned int *num);
void *xenbus_read(xenbus_transaction_t t,
void *xenbus_read(struct xenbus_transaction t,
const char *dir, const char *node, unsigned int *len);
int xenbus_write(xenbus_transaction_t t,
int xenbus_write(struct xenbus_transaction t,
const char *dir, const char *node, const char *string);
int xenbus_mkdir(xenbus_transaction_t t,
int xenbus_mkdir(struct xenbus_transaction t,
const char *dir, const char *node);
int xenbus_exists(xenbus_transaction_t t,
int xenbus_exists(struct xenbus_transaction t,
const char *dir, const char *node);
int xenbus_rm(xenbus_transaction_t t, const char *dir, const char *node);
int xenbus_transaction_start(xenbus_transaction_t *t);
int xenbus_transaction_end(xenbus_transaction_t t, int abort);
int xenbus_rm(struct xenbus_transaction t, const char *dir, const char *node);
int xenbus_transaction_start(struct xenbus_transaction *t);
int xenbus_transaction_end(struct xenbus_transaction t, int abort);
/* Single read and scanf: returns -errno or num scanned if > 0. */
int xenbus_scanf(xenbus_transaction_t t,
int xenbus_scanf(struct xenbus_transaction t,
const char *dir, const char *node, const char *fmt, ...)
__attribute__((format(scanf, 4, 5)));
/* Single printf and write: returns -errno or 0. */
int xenbus_printf(xenbus_transaction_t t,
int xenbus_printf(struct xenbus_transaction t,
const char *dir, const char *node, const char *fmt, ...)
__attribute__((format(printf, 4, 5)));
/* Generic read function: NULL-terminated triples of name,
* sprintf-style type string, and pointer. Returns 0 or errno.*/
int xenbus_gather(xenbus_transaction_t t, const char *dir, ...);
int xenbus_gather(struct xenbus_transaction t, const char *dir, ...);
/* notifer routines for when the xenstore comes up */
int register_xenstore_notifier(struct notifier_block *nb);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.