- patches.arch/x86_mce_intel_decode_physical_address.patch:
[linux-flexiantxendom0-3.2.10.git] / include / xen / xenbus.h
index 705f19b..43e2d7d 100644 (file)
@@ -40,7 +40,6 @@
 #include <linux/completion.h>
 #include <linux/init.h>
 #include <linux/slab.h>
-#include <linux/err.h>
 #include <xen/interface/xen.h>
 #include <xen/interface/grant_table.h>
 #include <xen/interface/io/xenbus.h>
@@ -57,21 +56,8 @@ struct xenbus_watch
        /* Callback (executed in a process context with no locks held). */
        void (*callback)(struct xenbus_watch *,
                         const char **vec, unsigned int len);
-
-#if defined(CONFIG_XEN) || defined(HAVE_XEN_PLATFORM_COMPAT_H)
-       /* See XBWF_ definitions below. */
-       unsigned long flags;
-#endif
 };
 
-#if defined(CONFIG_XEN) || defined(HAVE_XEN_PLATFORM_COMPAT_H)
-/*
- * Execute callback in its own kthread. Useful if the callback is long
- * running or heavily serialised, to avoid taking out the main xenwatch thread
- * for a long period of time (or even unwittingly causing a deadlock).
- */
-#define XBWF_new_thread        1
-#endif
 
 /* A xenbus device. */
 struct xenbus_device {
@@ -98,21 +84,17 @@ struct xenbus_device_id
 
 /* A xenbus driver. */
 struct xenbus_driver {
-       const char *name;
+       char *name;
+       struct module *owner;
        const struct xenbus_device_id *ids;
        int (*probe)(struct xenbus_device *dev,
                     const struct xenbus_device_id *id);
        void (*otherend_changed)(struct xenbus_device *dev,
                                 enum xenbus_state backend_state);
        int (*remove)(struct xenbus_device *dev);
-#if !defined(CONFIG_XEN) && !defined(MODULE)
        int (*suspend)(struct xenbus_device *dev, pm_message_t state);
-#else
-       int (*suspend)(struct xenbus_device *dev);
-       int (*suspend_cancel)(struct xenbus_device *dev);
-#endif
        int (*resume)(struct xenbus_device *dev);
-       int (*uevent)(struct xenbus_device *, struct kobj_uevent_env *);
+       int (*uevent)(struct xenbus_device *, char **, int, char *, int);
        struct device_driver driver;
        int (*read_otherend_details)(struct xenbus_device *dev);
        int (*is_ready)(struct xenbus_device *dev);
@@ -130,6 +112,7 @@ int __must_check __xenbus_register_frontend(struct xenbus_driver *drv,
 static inline int __must_check
 xenbus_register_frontend(struct xenbus_driver *drv)
 {
+       WARN_ON(drv->owner != THIS_MODULE);
        return __xenbus_register_frontend(drv, THIS_MODULE, KBUILD_MODNAME);
 }
 
@@ -139,6 +122,7 @@ int __must_check __xenbus_register_backend(struct xenbus_driver *drv,
 static inline int __must_check
 xenbus_register_backend(struct xenbus_driver *drv)
 {
+       WARN_ON(drv->owner != THIS_MODULE);
        return __xenbus_register_backend(drv, THIS_MODULE, KBUILD_MODNAME);
 }
 
@@ -181,6 +165,7 @@ int xenbus_printf(struct xenbus_transaction t,
 int xenbus_gather(struct xenbus_transaction t, const char *dir, ...);
 
 /* notifer routines for when the xenstore comes up */
+extern int xenstored_ready;
 int register_xenstore_notifier(struct notifier_block *nb);
 void unregister_xenstore_notifier(struct notifier_block *nb);
 
@@ -193,9 +178,12 @@ void xs_suspend_cancel(void);
 /* Used by xenbus_dev to borrow kernel's store connection. */
 void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg);
 
+struct work_struct;
+
 /* Prepare for domain suspend: then resume or cancel the suspend. */
 void xenbus_suspend(void);
 void xenbus_resume(void);
+void xenbus_probe(struct work_struct *);
 void xenbus_suspend_cancel(void);
 
 #define XENBUS_IS_ERR_READ(str) ({                     \
@@ -208,134 +196,38 @@ void xenbus_suspend_cancel(void);
 
 #define XENBUS_EXIST_ERR(err) ((err) == -ENOENT || (err) == -ERANGE)
 
-
-/**
- * Register a watch on the given path, using the given xenbus_watch structure
- * for storage, and the given callback function as the callback.  Return 0 on
- * success, or -errno on error.  On success, the given path will be saved as
- * watch->node, and remains the caller's to free.  On error, watch->node will
- * be NULL, the device will switch to XenbusStateClosing, and the error will
- * be saved in the store.
- */
 int xenbus_watch_path(struct xenbus_device *dev, const char *path,
                      struct xenbus_watch *watch,
                      void (*callback)(struct xenbus_watch *,
                                       const char **, unsigned int));
-
-
-#if defined(CONFIG_XEN) || defined(HAVE_XEN_PLATFORM_COMPAT_H)
-/**
- * Register a watch on the given path/path2, using the given xenbus_watch
- * structure for storage, and the given callback function as the callback.
- * Return 0 on success, or -errno on error.  On success, the watched path
- * (path/path2) will be saved as watch->node, and becomes the caller's to
- * kfree().  On error, watch->node will be NULL, so the caller has nothing to
- * free, the device will switch to XenbusStateClosing, and the error will be
- * saved in the store.
- */
-int xenbus_watch_path2(struct xenbus_device *dev, const char *path,
-                      const char *path2, struct xenbus_watch *watch,
-                      void (*callback)(struct xenbus_watch *,
-                                       const char **, unsigned int));
-#else
 int xenbus_watch_pathfmt(struct xenbus_device *dev, struct xenbus_watch *watch,
                         void (*callback)(struct xenbus_watch *,
                                          const char **, unsigned int),
                         const char *pathfmt, ...)
        __attribute__ ((format (printf, 4, 5)));
-#endif
 
-/**
- * Advertise in the store a change of the given driver to the given new_state.
- * Return 0 on success, or -errno on error.  On error, the device will switch
- * to XenbusStateClosing, and the error will be saved in the store.
- */
 int xenbus_switch_state(struct xenbus_device *dev, enum xenbus_state new_state);
-
-
-/**
- * Grant access to the given ring_mfn to the peer of the given device.  Return
- * 0 on success, or -errno on error.  On error, the device will switch to
- * XenbusStateClosing, and the error will be saved in the store.
- */
 int xenbus_grant_ring(struct xenbus_device *dev, unsigned long ring_mfn);
-
-
-/**
- * Map a page of memory into this domain from another domain's grant table.
- * xenbus_map_ring_valloc allocates a page of virtual address space, maps the
- * page to that address, and sets *vaddr to that address.
- * xenbus_map_ring does not allocate the virtual address space (you must do
- * this yourself!). It only maps in the page to the specified address.
- * Returns 0 on success, and GNTST_* (see xen/include/interface/grant_table.h)
- * or -ENOMEM on error. If an error is returned, device will switch to
- * XenbusStateClosing and the error message will be saved in XenStore.
- */
-struct vm_struct *xenbus_map_ring_valloc(struct xenbus_device *dev,
-                                        int gnt_ref);
+int xenbus_map_ring_valloc(struct xenbus_device *dev,
+                          int gnt_ref, void **vaddr);
 int xenbus_map_ring(struct xenbus_device *dev, int gnt_ref,
                           grant_handle_t *handle, void *vaddr);
 
-
-/**
- * Unmap a page of memory in this domain that was imported from another domain.
- * Use xenbus_unmap_ring_vfree if you mapped in your memory with
- * xenbus_map_ring_valloc (it will free the virtual address space).
- * Returns 0 on success and returns GNTST_* on error
- * (see xen/include/interface/grant_table.h).
- */
-int xenbus_unmap_ring_vfree(struct xenbus_device *dev, struct vm_struct *);
+int xenbus_unmap_ring_vfree(struct xenbus_device *dev, void *vaddr);
 int xenbus_unmap_ring(struct xenbus_device *dev,
                      grant_handle_t handle, void *vaddr);
 
-
-/**
- * Allocate an event channel for the given xenbus_device, assigning the newly
- * created local port to *port.  Return 0 on success, or -errno on error.  On
- * error, the device will switch to XenbusStateClosing, and the error will be
- * saved in the store.
- */
 int xenbus_alloc_evtchn(struct xenbus_device *dev, int *port);
-
-
-/**
- * Free an existing event channel. Returns 0 on success or -errno on error.
- */
+int xenbus_bind_evtchn(struct xenbus_device *dev, int remote_port, int *port);
 int xenbus_free_evtchn(struct xenbus_device *dev, int port);
 
-
-/**
- * Return the state of the driver rooted at the given store path, or
- * XenbusStateUnknown if no state can be read.
- */
 enum xenbus_state xenbus_read_driver_state(const char *path);
 
-
-/***
- * Report the given negative errno into the store, along with the given
- * formatted message.
- */
-void xenbus_dev_error(struct xenbus_device *dev, int err, const char *fmt,
-                     ...);
-
-
-/***
- * Equivalent to xenbus_dev_error(dev, err, fmt, args), followed by
- * xenbus_switch_state(dev, NULL, XenbusStateClosing) to schedule an orderly
- * closedown of this driver and its peer.
- */
-void xenbus_dev_fatal(struct xenbus_device *dev, int err, const char *fmt,
-                     ...);
-
-#if defined(CONFIG_XEN) || defined(MODULE)
-int xenbus_dev_init(void);
-#endif
+void xenbus_dev_error(struct xenbus_device *dev, int err, const char *fmt, ...);
+void xenbus_dev_fatal(struct xenbus_device *dev, int err, const char *fmt, ...);
 
 const char *xenbus_strstate(enum xenbus_state state);
 int xenbus_dev_is_online(struct xenbus_device *dev);
 int xenbus_frontend_closed(struct xenbus_device *dev);
 
-int xenbus_for_each_backend(void *arg, int (*fn)(struct device *, void *));
-int xenbus_for_each_frontend(void *arg, int (*fn)(struct device *, void *));
-
 #endif /* _XEN_XENBUS_H */