Deleted Added
full compact
xenbus.c (214077) xenbus.c (222975)
1/******************************************************************************
2 * Copyright (C) 2005 XenSource Ltd
3 *
4 * This file may be distributed separately from the Linux kernel, or
5 * incorporated into other software packages, subject to the following license:
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this source file (the "Software"), to deal in the Software without

--- 26 unchanged lines hidden (view full) ---

35#if 0
36#define DPRINTK(fmt, args...) \
37 printk("xenbus_client (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args)
38#else
39#define DPRINTK(fmt, args...) ((void)0)
40#endif
41
42#include <sys/cdefs.h>
1/******************************************************************************
2 * Copyright (C) 2005 XenSource Ltd
3 *
4 * This file may be distributed separately from the Linux kernel, or
5 * incorporated into other software packages, subject to the following license:
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this source file (the "Software"), to deal in the Software without

--- 26 unchanged lines hidden (view full) ---

35#if 0
36#define DPRINTK(fmt, args...) \
37 printk("xenbus_client (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args)
38#else
39#define DPRINTK(fmt, args...) ((void)0)
40#endif
41
42#include <sys/cdefs.h>
43__FBSDID("$FreeBSD: head/sys/xen/xenbus/xenbus.c 214077 2010-10-19 20:53:30Z gibbs $");
43__FBSDID("$FreeBSD: head/sys/xen/xenbus/xenbus.c 222975 2011-06-11 04:59:01Z gibbs $");
44
45#include <sys/cdefs.h>
46#include <sys/param.h>
47#include <sys/kernel.h>
48#include <sys/types.h>
49#include <sys/malloc.h>
50#include <sys/libkern.h>
51#include <sys/sbuf.h>

--- 46 unchanged lines hidden (view full) ---

98 [ XenbusStateClosed ] = "Closed",
99 };
100
101 return ((state < (XenbusStateClosed + 1)) ? name[state] : "INVALID");
102}
103
104int
105xenbus_watch_path(device_t dev, char *path, struct xs_watch *watch,
44
45#include <sys/cdefs.h>
46#include <sys/param.h>
47#include <sys/kernel.h>
48#include <sys/types.h>
49#include <sys/malloc.h>
50#include <sys/libkern.h>
51#include <sys/sbuf.h>

--- 46 unchanged lines hidden (view full) ---

98 [ XenbusStateClosed ] = "Closed",
99 };
100
101 return ((state < (XenbusStateClosed + 1)) ? name[state] : "INVALID");
102}
103
104int
105xenbus_watch_path(device_t dev, char *path, struct xs_watch *watch,
106 xs_watch_cb_t *callback)
106 xs_watch_cb_t *callback, uintptr_t callback_data)
107{
108 int error;
109
110 watch->node = path;
111 watch->callback = callback;
107{
108 int error;
109
110 watch->node = path;
111 watch->callback = callback;
112 watch->callback_data = callback_data;
112
113 error = xs_register_watch(watch);
114
115 if (error) {
116 watch->node = NULL;
117 watch->callback = NULL;
118 xenbus_dev_fatal(dev, error, "adding watch on %s", path);
119 }
120
121 return (error);
122}
123
124int
125xenbus_watch_path2(device_t dev, const char *path,
126 const char *path2, struct xs_watch *watch,
113
114 error = xs_register_watch(watch);
115
116 if (error) {
117 watch->node = NULL;
118 watch->callback = NULL;
119 xenbus_dev_fatal(dev, error, "adding watch on %s", path);
120 }
121
122 return (error);
123}
124
125int
126xenbus_watch_path2(device_t dev, const char *path,
127 const char *path2, struct xs_watch *watch,
127 xs_watch_cb_t *callback)
128 xs_watch_cb_t *callback, uintptr_t callback_data)
128{
129 int error;
130 char *state = malloc(strlen(path) + 1 + strlen(path2) + 1,
131 M_XENBUS, M_WAITOK);
132
133 strcpy(state, path);
134 strcat(state, "/");
135 strcat(state, path2);
136
129{
130 int error;
131 char *state = malloc(strlen(path) + 1 + strlen(path2) + 1,
132 M_XENBUS, M_WAITOK);
133
134 strcpy(state, path);
135 strcat(state, "/");
136 strcat(state, path2);
137
137 error = xenbus_watch_path(dev, state, watch, callback);
138 error = xenbus_watch_path(dev, state, watch, callback, callback_data);
138 if (error) {
139 free(state,M_XENBUS);
140 }
141
142 return (error);
143}
144
145void

--- 135 unchanged lines hidden (view full) ---

281 error = xs_gather(XST_NIL, path, "online", "%d", &value, NULL);
282 if (error != 0) {
283 /* Default to not online. */
284 value = 0;
285 }
286
287 return (value);
288}
139 if (error) {
140 free(state,M_XENBUS);
141 }
142
143 return (error);
144}
145
146void

--- 135 unchanged lines hidden (view full) ---

282 error = xs_gather(XST_NIL, path, "online", "%d", &value, NULL);
283 if (error != 0) {
284 /* Default to not online. */
285 value = 0;
286 }
287
288 return (value);
289}
290
291void
292xenbus_localend_changed(device_t dev, const char *path)
293{
294}