Replace NULL xenbus transaction by a specific XBT_NULL value.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
This commit is contained in:
vhanquez@kneesa.uk.xensource.com committed 2006-01-10 15:05:05 +00:00
1 parent 86bf018541
commit e92fb45b06
18 files changed
+61 -56

No files matched your search

@@ -298,7 +298,7 @@ static void vcpu_hotplug(unsigned int cpu)
return;
sprintf(dir, "cpu/%d", cpu);
err = xenbus_scanf(NULL, dir, "availability", "%s", state);
err = xenbus_scanf(XBT_NULL, dir, "availability", "%s", state);
if (err != 1) {
printk(KERN_ERR "XENBUS: Unable to read cpu state\n");
return;
@@ -354,7 +354,7 @@ static void watch_target(struct xenbus_watch *watch,
unsigned long long new_target;
int err;
err = xenbus_scanf(NULL, "memory", "target", "%llu", &new_target);
err = xenbus_scanf(XBT_NULL, "memory", "target", "%llu", &new_target);
if (err != 1) {
/* This is ok (for domain0 at least) - so just return */
return;
@@ -145,7 +145,7 @@ static int blkback_probe(struct xenbus_device *dev,
if (err)
goto fail;
err = xenbus_switch_state(dev, NULL, XenbusStateInitWait);
err = xenbus_switch_state(dev, XBT_NULL, XenbusStateInitWait);
if (err)
goto fail;
@@ -175,7 +175,7 @@ static void backend_changed(struct xenbus_watch *watch,
DPRINTK("");
err = xenbus_scanf(NULL, dev->nodename, "physical-device", "%x:%x",
err = xenbus_scanf(XBT_NULL, dev->nodename, "physical-device", "%x:%x",
&major, &minor);
if (XENBUS_EXIST_ERR(err)) {
/* Since this watch will fire once immediately after it is
@@ -197,7 +197,7 @@ static void backend_changed(struct xenbus_watch *watch,
return;
}
be->mode = xenbus_read(NULL, dev->nodename, "mode", NULL);
be->mode = xenbus_read(XBT_NULL, dev->nodename, "mode", NULL);
if (IS_ERR(be->mode)) {
err = PTR_ERR(be->mode);
be->mode = NULL;
@@ -268,7 +268,7 @@ static void frontend_changed(struct xenbus_device *dev,
break;
case XenbusStateClosing:
xenbus_switch_state(dev, NULL, XenbusStateClosing);
xenbus_switch_state(dev, XBT_NULL, XenbusStateClosing);
break;
case XenbusStateClosed:
@@ -366,7 +366,7 @@ static int connect_ring(struct backend_info *be)
DPRINTK("%s", dev->otherend);
err = xenbus_gather(NULL, dev->otherend, "ring-ref", "%lu", &ring_ref,
err = xenbus_gather(XBT_NULL, dev->otherend, "ring-ref", "%lu", &ring_ref,
"event-channel", "%u", &evtchn, NULL);
if (err) {
xenbus_dev_fatal(dev, err,
@@ -91,7 +91,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(NULL, dev->nodename,
err = xenbus_scanf(XBT_NULL, dev->nodename,
"virtual-device", "%i", &vdevice);
if (err != 1) {
xenbus_dev_fatal(dev, err, "reading virtual-device");
@@ -319,7 +319,7 @@ static void connect(struct blkfront_info *info)
DPRINTK("blkfront.c:connect:%s.\n", info->xbdev->otherend);
err = xenbus_gather(NULL, info->xbdev->otherend,
err = xenbus_gather(XBT_NULL, info->xbdev->otherend,
"sectors", "%lu", &sectors,
"info", "%u", &binfo,
"sector-size", "%lu", &sector_size,
@@ -338,7 +338,7 @@ static void connect(struct blkfront_info *info)
return;
}
(void)xenbus_switch_state(info->xbdev, NULL, XenbusStateConnected);
(void)xenbus_switch_state(info->xbdev, XBT_NULL, XenbusStateConnected);
/* Kick pending requests. */
spin_lock_irq(&blkif_io_lock);
@@ -367,7 +367,7 @@ static void blkfront_closing(struct xenbus_device *dev)
info->mi = NULL;
}
xenbus_switch_state(dev, NULL, XenbusStateClosed);
xenbus_switch_state(dev, XBT_NULL, XenbusStateClosed);
}
@@ -775,7 +775,7 @@ static void blkif_recover(struct blkfront_info *info)
kfree(copy);
(void)xenbus_switch_state(info->xbdev, NULL, XenbusStateConnected);
(void)xenbus_switch_state(info->xbdev, XBT_NULL, XenbusStateConnected);
/* Now safe for us to use the shared ring */
spin_lock_irq(&blkif_io_lock);
@@ -38,7 +38,7 @@ int xen_net_read_mac(struct xenbus_device *dev, u8 mac[])
char *s;
int i;
char *e;
char *macstr = xenbus_read(NULL, dev->nodename, "mac", NULL);
char *macstr = xenbus_read(XBT_NULL, dev->nodename, "mac", NULL);
if (IS_ERR(macstr)) {
return PTR_ERR(macstr);
}
@@ -93,7 +93,7 @@ static int netback_probe(struct xenbus_device *dev,
if (err)
goto fail;
err = xenbus_switch_state(dev, NULL, XenbusStateInitWait);
err = xenbus_switch_state(dev, XBT_NULL, XenbusStateInitWait);
if (err) {
goto fail;
}
@@ -122,7 +122,7 @@ static int netback_hotplug(struct xenbus_device *xdev, char **envp,
DPRINTK("netback_hotplug");
val = xenbus_read(NULL, xdev->nodename, "script", NULL);
val = xenbus_read(XBT_NULL, xdev->nodename, "script", NULL);
if (IS_ERR(val)) {
int err = PTR_ERR(val);
xenbus_dev_fatal(xdev, err, "reading script");
@@ -160,7 +160,7 @@ static void backend_changed(struct xenbus_watch *watch,
DPRINTK("");
err = xenbus_scanf(NULL, dev->nodename, "handle", "%li", &handle);
err = xenbus_scanf(XBT_NULL, 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
@@ -212,7 +212,7 @@ static void frontend_changed(struct xenbus_device *dev,
break;
case XenbusStateClosing:
xenbus_switch_state(dev, NULL, XenbusStateClosing);
xenbus_switch_state(dev, XBT_NULL, XenbusStateClosing);
break;
case XenbusStateClosed:
@@ -256,7 +256,7 @@ static void connect(struct backend_info *be)
return;
}
xenbus_switch_state(dev, NULL, XenbusStateConnected);
xenbus_switch_state(dev, XBT_NULL, XenbusStateConnected);
}
@@ -269,7 +269,7 @@ static int connect_rings(struct backend_info *be)
DPRINTK("");
err = xenbus_gather(NULL, dev->otherend,
err = xenbus_gather(XBT_NULL, dev->otherend,
"tx-ring-ref", "%lu", &tx_ring_ref,
"rx-ring-ref", "%lu", &rx_ring_ref,
"event-channel", "%u", &evtchn, NULL);
@@ -212,7 +212,7 @@ static int netfront_probe(struct xenbus_device *dev,
struct netfront_info *info;
unsigned int handle;
err = xenbus_scanf(NULL, dev->nodename, "handle", "%u", &handle);
err = xenbus_scanf(XBT_NULL, dev->nodename, "handle", "%u", &handle);
if (err != 1) {
xenbus_dev_fatal(dev, err, "reading handle");
return err;
@@ -1199,7 +1199,7 @@ static void netfront_closing(struct xenbus_device *dev)
close_netdev(info);
xenbus_switch_state(dev, NULL, XenbusStateClosed);
xenbus_switch_state(dev, XBT_NULL, XenbusStateClosed);
}
@@ -275,7 +275,7 @@ static int connect_ring(struct backend_info *be)
unsigned int evtchn;
int err;
err = xenbus_gather(NULL, dev->otherend,
err = xenbus_gather(XBT_NULL, dev->otherend,
"ring-ref", "%lu", &ring_ref,
"event-channel", "%u", &evtchn, NULL);
if (err) {
@@ -152,7 +152,7 @@ void _dev_error(struct xenbus_device *dev, int err, const char *fmt,
goto fail;
}
if (xenbus_write(NULL, path_buffer, "error", printf_buffer) != 0) {
if (xenbus_write(XBT_NULL, path_buffer, "error", printf_buffer) != 0) {
printk("xenbus: failed to write error node for %s (%s)\n",
dev->nodename, printf_buffer);
goto fail;
@@ -187,7 +187,7 @@ void xenbus_dev_fatal(struct xenbus_device *dev, int err, const char *fmt,
_dev_error(dev, err, fmt, ap);
va_end(ap);
xenbus_switch_state(dev, NULL, XenbusStateClosing);
xenbus_switch_state(dev, XBT_NULL, XenbusStateClosing);
}
EXPORT_SYMBOL(xenbus_dev_fatal);
@@ -223,7 +223,7 @@ XenbusState xenbus_read_driver_state(const char *path)
{
XenbusState result;
int err = xenbus_gather(NULL, path, "state", "%d", &result, NULL);
int err = xenbus_gather(XBT_NULL, path, "state", "%d", &result, NULL);
if (err)
result = XenbusStateClosed;
@@ -115,7 +115,7 @@ static int frontend_bus_id(char bus_id[BUS_ID_SIZE], const char *nodename)
static int read_otherend_details(struct xenbus_device *xendev,
char *id_node, char *path_node)
{
int err = xenbus_gather(NULL, xendev->nodename,
int err = xenbus_gather(XBT_NULL, xendev->nodename,
id_node, "%i", &xendev->otherend_id,
path_node, NULL, &xendev->otherend,
NULL);
@@ -126,7 +126,7 @@ static int read_otherend_details(struct xenbus_device *xendev,
return err;
}
if (strlen(xendev->otherend) == 0 ||
!xenbus_exists(NULL, xendev->otherend, "")) {
!xenbus_exists(XBT_NULL, xendev->otherend, "")) {
xenbus_dev_fatal(xendev, -ENOENT, "missing other end from %s",
xendev->nodename);
kfree(xendev->otherend);
@@ -200,14 +200,14 @@ static int backend_bus_id(char bus_id[BUS_ID_SIZE], const char *nodename)
devid = strrchr(nodename, '/') + 1;
err = xenbus_gather(NULL, nodename, "frontend-id", "%i", &domid,
err = xenbus_gather(XBT_NULL, nodename, "frontend-id", "%i", &domid,
"frontend", NULL, &frontend,
NULL);
if (err)
return err;
if (strlen(frontend) == 0)
err = -ERANGE;
if (!err && !xenbus_exists(NULL, frontend, ""))
if (!err && !xenbus_exists(XBT_NULL, frontend, ""))
err = -ENOENT;
kfree(frontend);
@@ -373,7 +373,7 @@ static int xenbus_dev_probe(struct device *_dev)
return 0;
fail:
xenbus_dev_error(dev, err, "xenbus_dev_probe on %s", dev->nodename);
xenbus_switch_state(dev, NULL, XenbusStateClosed);
xenbus_switch_state(dev, XBT_NULL, XenbusStateClosed);
return -ENODEV;
}
@@ -391,7 +391,7 @@ static int xenbus_dev_remove(struct device *_dev)
if (drv->remove)
drv->remove(dev);
xenbus_switch_state(dev, NULL, XenbusStateClosed);
xenbus_switch_state(dev, XBT_NULL, XenbusStateClosed);
return 0;
}
@@ -643,7 +643,7 @@ static int xenbus_probe_backend(const char *type, const char *domid)
if (!nodename)
return -ENOMEM;
dir = xenbus_directory(NULL, nodename, "", &dir_n);
dir = xenbus_directory(XBT_NULL, nodename, "", &dir_n);
if (IS_ERR(dir)) {
kfree(nodename);
return PTR_ERR(dir);
@@ -666,7 +666,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(NULL, bus->root, type, &dir_n);
dir = xenbus_directory(XBT_NULL, bus->root, type, &dir_n);
if (IS_ERR(dir))
return PTR_ERR(dir);
@@ -685,7 +685,7 @@ static int xenbus_probe_devices(struct xen_bus_type *bus)
char **dir;
unsigned int i, dir_n;
dir = xenbus_directory(NULL, bus->root, "", &dir_n);
dir = xenbus_directory(XBT_NULL, bus->root, "", &dir_n);
if (IS_ERR(dir))
return PTR_ERR(dir);
@@ -731,7 +731,7 @@ static void dev_changed(const char *node, struct xen_bus_type *bus)
if (char_count(node, '/') < 2)
return;
exists = xenbus_exists(NULL, node, "");
exists = xenbus_exists(XBT_NULL, node, "");
if (!exists) {
xenbus_cleanup_devices(node, &bus->bus);
return;
@@ -431,7 +431,7 @@ struct xenbus_transaction *xenbus_transaction_start(void)
down_read(&xs_state.suspend_mutex);
id_str = xs_single(NULL, XS_TRANSACTION_START, "", NULL);
id_str = xs_single(XBT_NULL, XS_TRANSACTION_START, "", NULL);
if (IS_ERR(id_str)) {
up_read(&xs_state.suspend_mutex);
return (struct xenbus_transaction *)id_str;
@@ -553,7 +553,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(NULL, XS_WATCH, iov,
return xs_error(xs_talkv(XBT_NULL, XS_WATCH, iov,
ARRAY_SIZE(iov), NULL));
}
@@ -566,7 +566,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(NULL, XS_UNWATCH, iov,
return xs_error(xs_talkv(XBT_NULL, XS_UNWATCH, iov,
ARRAY_SIZE(iov), NULL));
}
@@ -37,6 +37,8 @@
#include <asm-xen/xen-public/io/xenbus.h>
#include <asm-xen/xen-public/io/xs_wire.h>
#define XBT_NULL NULL
/* Register callback to watch this node. */
struct xenbus_watch
{
+2 -2
View File
@@ -220,7 +220,7 @@ int main(int argc, char **argv)
if (path == NULL)
err(ENOMEM, "realloc");
strcat(path, "/console/tty");
str_pty = xs_read(xs, NULL, path, &len);
str_pty = xs_read(xs, XBT_NULL, path, &len);
/* FIXME consoled currently does not assume domain-0 doesn't have a
console which is good when we break domain-0 up. To keep us
@@ -245,7 +245,7 @@ int main(int argc, char **argv)
struct timeval tv = { 0, 500 };
select(0, NULL, NULL, NULL, &tv); /* pause briefly */
str_pty = xs_read(xs, NULL, path, &len);
str_pty = xs_read(xs, XBT_NULL, path, &len);
}
if (str_pty == NULL) {
+3 -3
View File
@@ -174,7 +174,7 @@ static int domain_create_tty(struct domain *dom)
success = asprintf(&path, "%s/limit", dom->conspath) != -1;
if (!success)
goto out;
data = xs_read(xs, NULL, path, &len);
data = xs_read(xs, XBT_NULL, path, &len);
if (data) {
dom->buffer.max_capacity = strtoul(data, 0, 0);
free(data);
@@ -184,7 +184,7 @@ static int domain_create_tty(struct domain *dom)
success = asprintf(&path, "%s/tty", dom->conspath) != -1;
if (!success)
goto out;
success = xs_write(xs, NULL, path, slave, strlen(slave));
success = xs_write(xs, XBT_NULL, path, slave, strlen(slave));
free(path);
if (!success)
goto out;
@@ -214,7 +214,7 @@ int xs_gather(struct xs_handle *xs, const char *dir, ...)
char *p;
asprintf(&path, "%s/%s", dir, name);
p = xs_read(xs, NULL, path, NULL);
p = xs_read(xs, XBT_NULL, path, NULL);
free(path);
if (p == NULL) {
ret = ENOENT;
+7 -7
View File
@@ -560,7 +560,7 @@ bool xs_watch(struct xs_handle *h, const char *path, const char *token)
iov[1].iov_base = (void *)token;
iov[1].iov_len = strlen(token) + 1;
return xs_bool(xs_talkv(h, NULL, XS_WATCH, iov,
return xs_bool(xs_talkv(h, XBT_NULL, XS_WATCH, iov,
ARRAY_SIZE(iov), NULL));
}
@@ -627,7 +627,7 @@ bool xs_unwatch(struct xs_handle *h, const char *path, const char *token)
iov[1].iov_base = (char *)token;
iov[1].iov_len = strlen(token) + 1;
return xs_bool(xs_talkv(h, NULL, XS_UNWATCH, iov,
return xs_bool(xs_talkv(h, XBT_NULL, XS_UNWATCH, iov,
ARRAY_SIZE(iov), NULL));
}
@@ -641,7 +641,7 @@ struct xs_transaction_handle *xs_transaction_start(struct xs_handle *h)
char *id_str;
unsigned long id;
id_str = xs_single(h, NULL, XS_TRANSACTION_START, "", NULL);
id_str = xs_single(h, XBT_NULL, XS_TRANSACTION_START, "", NULL);
if (id_str == NULL)
return NULL;
@@ -693,7 +693,7 @@ bool xs_introduce_domain(struct xs_handle *h,
iov[2].iov_base = eventchn_str;
iov[2].iov_len = strlen(eventchn_str) + 1;
return xs_bool(xs_talkv(h, NULL, XS_INTRODUCE, iov,
return xs_bool(xs_talkv(h, XBT_NULL, XS_INTRODUCE, iov,
ARRAY_SIZE(iov), NULL));
}
@@ -705,7 +705,7 @@ static void * single_with_domid(struct xs_handle *h,
sprintf(domid_str, "%u", domid);
return xs_single(h, NULL, type, domid_str, NULL);
return xs_single(h, XBT_NULL, type, domid_str, NULL);
}
bool xs_release_domain(struct xs_handle *h, unsigned int domid)
@@ -719,7 +719,7 @@ char *xs_get_domain_path(struct xs_handle *h, unsigned int domid)
sprintf(domid_str, "%u", domid);
return xs_single(h, NULL, XS_GET_DOMAIN_PATH, domid_str, NULL);
return xs_single(h, XBT_NULL, XS_GET_DOMAIN_PATH, domid_str, NULL);
}
bool xs_is_domain_introduced(struct xs_handle *h, unsigned int domid)
@@ -739,7 +739,7 @@ char *xs_debug_command(struct xs_handle *h, const char *cmd,
iov[1].iov_base = data;
iov[1].iov_len = len;
return xs_talkv(h, NULL, XS_DEBUG, iov,
return xs_talkv(h, XBT_NULL, XS_DEBUG, iov,
ARRAY_SIZE(iov), NULL);
}
+2
View File
@@ -22,6 +22,8 @@
#include <xs_lib.h>
#define XBT_NULL NULL
struct xs_handle;
struct xs_transaction_handle;
+5 -4
View File
@@ -37,12 +37,13 @@
#include <sys/time.h>
#include "utils.h"
#include "xs_lib.h"
#include "xs.h"
#include "list.h"
#define XSTEST
static struct xs_handle *handles[10] = { NULL };
static struct xs_transaction_handle *txh[10] = { NULL };
static struct xs_transaction_handle *txh[10] = { XBT_NULL };
static unsigned int timeout_ms = 500;
static bool timeout_suppressed = true;
@@ -492,7 +493,7 @@ static void do_unwatch(unsigned int handle, const char *node, const char *token)
static void do_start(unsigned int handle)
{
txh[handle] = xs_transaction_start(handles[handle]);
if (txh[handle] == NULL)
if (txh[handle] == XBT_NULL)
failed(handle);
}
@@ -500,7 +501,7 @@ static void do_end(unsigned int handle, bool abort)
{
if (!xs_transaction_end(handles[handle], txh[handle], abort))
failed(handle);
txh[handle] = NULL;
txh[handle] = XBT_NULL;
}
static void do_introduce(unsigned int handle,
@@ -718,7 +719,7 @@ static void do_command(unsigned int default_handle, char *line)
else if (streq(command, "close")) {
xs_daemon_close(handles[handle]);
handles[handle] = NULL;
txh[handle] = NULL;
txh[handle] = XBT_NULL;
} else if (streq(command, "start"))
do_start(handle);
else if (streq(command, "commit"))
+2 -2
View File
@@ -11,7 +11,7 @@ void print_dir(struct xs_handle *h, char *path, int cur_depth)
int i;
unsigned int num, len;
e = xs_directory(h, NULL, path, &num);
e = xs_directory(h, XBT_NULL, path, &num);
if (e == NULL)
err(1, "xs_directory (%s)", path);
@@ -22,7 +22,7 @@ void print_dir(struct xs_handle *h, char *path, int cur_depth)
sprintf(newpath, "%s%s%s", path,
path[strlen(path)-1] == '/' ? "" : "/",
e[i]);
val = xs_read(h, NULL, newpath, &len);
val = xs_read(h, XBT_NULL, newpath, &len);
if (val == NULL)
printf(":\n");
else if ((unsigned)len > (151 - strlen(e[i])))
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.