/* Update P->M and M->P tables. */
set_phys_to_machine(pfn, frame_list[i]);
xen_machphys_update(frame_list[i], pfn);
-
+
/* Link back into the page tables if not highmem. */
if (pfn < max_low_pfn) {
int ret;
if (err != 1) {
/* This is ok (for domain0 at least) - so just return */
return;
- }
-
+ }
+
/* The given memory/target value is in KiB, so it needs converting to
- pages. PAGE_SHIFT converts bytes to pages, hence PAGE_SHIFT - 10.
- */
+ * pages. PAGE_SHIFT converts bytes to pages, hence PAGE_SHIFT - 10.
+ */
set_new_target(new_target >> (PAGE_SHIFT - 10));
-
}
static int balloon_init_watcher(struct notifier_block *notifier,
- unsigned long event,
- void *data)
+ unsigned long event,
+ void *data)
{
int err;
printk(KERN_ERR "Failed to set balloon watcher\n");
return NOTIFY_DONE;
-
}
static int balloon_write(struct file *file, const char __user *buffer,
- unsigned long count, void *data)
+ unsigned long count, void *data)
{
char memstring[64], *endchar;
unsigned long long target_bytes;
}
static int balloon_read(char *page, char **start, off_t off,
- int count, int *eof, void *data)
+ int count, int *eof, void *data)
{
int len;
blkif_request_t *req,
pending_req_t *pending_req);
static void make_response(blkif_t *blkif, unsigned long id,
- unsigned short op, int st);
+ unsigned short op, int st);
/******************************************************************
* misc small helpers
bio = biolist[nbio++] = bio_alloc(GFP_KERNEL, nseg-i);
if (unlikely(bio == NULL))
goto fail_put_bio;
-
+
bio->bi_bdev = preq.bdev;
bio->bi_private = pending_req;
bio->bi_end_io = end_block_io_op;
static void make_response(blkif_t *blkif, unsigned long id,
- unsigned short op, int st)
+ unsigned short op, int st)
{
blkif_response_t *resp;
unsigned long flags;
#include <xen/gnttab.h>
#include <xen/driver_util.h>
-#define DPRINTK(_f, _a...) pr_debug("(file=%s, line=%d) " _f, \
- __FILE__ , __LINE__ , ## _a )
+#define DPRINTK(_f, _a...) \
+ pr_debug("(file=%s, line=%d) " _f, \
+ __FILE__ , __LINE__ , ## _a )
struct vbd {
blkif_vdev_t handle; /* what the domain refers to this vbd as */
err = xlvbd_add(sectors, info->vdevice, binfo, sector_size, info);
if (err) {
xenbus_dev_fatal(info->xbdev, err, "xlvbd_add at %s",
- info->xbdev->otherend);
+ info->xbdev->otherend);
return;
}
int blkif_ioctl(struct inode *inode, struct file *filep,
- unsigned command, unsigned long argument)
+ unsigned command, unsigned long argument)
{
int i;
#include <asm/uaccess.h>
#if 1
-#define IPRINTK(fmt, args...) \
- printk(KERN_INFO "xen_blk: " fmt, ##args)
+#define IPRINTK(fmt, args...) \
+ printk(KERN_INFO "xen_blk: " fmt, ##args)
#else
#define IPRINTK(fmt, args...) ((void)0)
#endif
#if 1
-#define WPRINTK(fmt, args...) \
- printk(KERN_WARNING "xen_blk: " fmt, ##args)
+#define WPRINTK(fmt, args...) \
+ printk(KERN_WARNING "xen_blk: " fmt, ##args)
#else
#define WPRINTK(fmt, args...) ((void)0)
#endif
extern int blkif_open(struct inode *inode, struct file *filep);
extern int blkif_release(struct inode *inode, struct file *filep);
extern int blkif_ioctl(struct inode *inode, struct file *filep,
- unsigned command, unsigned long argument);
+ unsigned command, unsigned long argument);
extern int blkif_getgeo(struct block_device *, struct hd_geometry *);
extern int blkif_check(dev_t dev);
extern int blkif_revalidate(dev_t dev);
static inline int uncached_access(struct file *file)
{
- if (file->f_flags & O_SYNC)
- return 1;
- /* Xen sets correct MTRR type on non-RAM for us. */
- return 0;
+ if (file->f_flags & O_SYNC)
+ return 1;
+ /* Xen sets correct MTRR type on non-RAM for us. */
+ return 0;
}
/*
/* Privileged receive callback and transmit kicker. */
static irqreturn_t xencons_priv_interrupt(int irq, void *dev_id,
- struct pt_regs *regs)
+ struct pt_regs *regs)
{
static char rbuf[16];
int l;
u16 flags;
/*
- * If a transfer is not even yet started, try to reclaim the grant
- * reference and return failure (== 0).
- */
+ * If a transfer is not even yet started, try to reclaim the grant
+ * reference and return failure (== 0).
+ */
while (!((flags = shared[ref].flags) & GTF_transfer_committed)) {
if (synch_cmpxchg(&shared[ref].flags, flags, 0) == flags)
return 0;
};
static int setup_shutdown_watcher(struct notifier_block *notifier,
- unsigned long event,
- void *data)
+ unsigned long event,
+ void *data)
{
int err;
}
static ssize_t evtchn_read(struct file *file, char __user *buf,
- size_t count, loff_t *ppos)
+ size_t count, loff_t *ppos)
{
int rc;
unsigned int c, p, bytes1 = 0, bytes2 = 0;
}
static ssize_t evtchn_write(struct file *file, const char __user *buf,
- size_t count, loff_t *ppos)
+ size_t count, loff_t *ppos)
{
int rc, i;
evtchn_port_t *kbuf = (evtchn_port_t *)__get_free_page(GFP_KERNEL);
}
static int evtchn_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg)
+ unsigned int cmd, unsigned long arg)
{
int rc;
struct per_user_data *u = file->private_data;
#include <xen/gnttab.h>
#include <xen/driver_util.h>
-#define DPRINTK(_f, _a...) pr_debug("(file=%s, line=%d) " _f, \
- __FILE__ , __LINE__ , ## _a )
-#define IPRINTK(fmt, args...) \
- printk(KERN_INFO "xen_net: " fmt, ##args)
-#define WPRINTK(fmt, args...) \
- printk(KERN_WARNING "xen_net: " fmt, ##args)
+#define DPRINTK(_f, _a...) \
+ pr_debug("(file=%s, line=%d) " _f, \
+ __FILE__ , __LINE__ , ## _a )
+#define IPRINTK(fmt, args...) \
+ printk(KERN_INFO "xen_net: " fmt, ##args)
+#define WPRINTK(fmt, args...) \
+ printk(KERN_WARNING "xen_net: " fmt, ##args)
typedef struct netif_st {
/* Unique identifier for this interface. */
* Initialise a dummy MAC address. We choose the numerically
* largest non-broadcast address to prevent the address getting
* stolen by an Ethernet bridge for STP purposes.
- * (FE:FF:FF:FF:FF:FF)
+ * (FE:FF:FF:FF:FF:FF)
*/
memset(dev->dev_addr, 0xFF, ETH_ALEN);
dev->dev_addr[0] &= ~0x01;
static void netif_idx_release(u16 pending_idx);
static void netif_page_release(struct page *page);
static void make_tx_response(netif_t *netif,
- u16 id,
- s8 st);
+ u16 id,
+ s8 st);
static int make_rx_response(netif_t *netif,
- u16 id,
- s8 st,
- u16 offset,
- u16 size,
- u16 flags);
+ u16 id,
+ s8 st,
+ u16 offset,
+ u16 size,
+ u16 flags);
static void net_tx_action(unsigned long unused);
static DECLARE_TASKLET(net_tx_tasklet, net_tx_action, 0);
DPRINTK("Bad status %d from grant transfer to DOM%u\n",
gop->status, netif->domid);
/*
- * Page no longer belongs to us unless GNTST_bad_page,
- * but that should be a fatal error anyway.
- */
+ * Page no longer belongs to us unless GNTST_bad_page,
+ * but that should be a fatal error anyway.
+ */
BUG_ON(gop->status == GNTST_bad_page);
status = NETIF_RSP_ERROR;
}
make_tx_response(netif, pending_tx_info[pending_idx].req.id,
NETIF_RSP_OKAY);
-
+
pending_ring[MASK_PEND_IDX(pending_prod++)] = pending_idx;
netif_put(netif);
}
static void make_tx_response(netif_t *netif,
- u16 id,
- s8 st)
+ u16 id,
+ s8 st)
{
RING_IDX i = netif->tx.rsp_prod_pvt;
netif_tx_response_t *resp;
}
static int make_rx_response(netif_t *netif,
- u16 id,
- s8 st,
- u16 offset,
- u16 size,
- u16 flags)
+ u16 id,
+ s8 st,
+ u16 offset,
+ u16 size,
+ u16 flags)
{
RING_IDX i = netif->rx.rsp_prod_pvt;
netif_rx_response_t *resp;
return id;
}
-#define DPRINTK(fmt, args...) pr_debug("netfront (%s:%d) " fmt, \
- __FUNCTION__, __LINE__, ##args)
+#define DPRINTK(fmt, args...) \
+ pr_debug("netfront (%s:%d) " fmt, \
+ __FUNCTION__, __LINE__, ##args)
#define IPRINTK(fmt, args...) \
printk(KERN_INFO "netfront: " fmt, ##args)
#define WPRINTK(fmt, args...) \
printk(KERN_WARNING "netfront: " fmt, ##args)
-
static int talk_to_backend(struct xenbus_device *, struct netfront_info *);
static int setup_device(struct xenbus_device *, struct netfront_info *);
static struct net_device *create_netdev(int, struct xenbus_device *);
rx = RING_GET_RESPONSE(&np->rx, i);
/*
- * This definitely indicates a bug, either in this driver or
- * in the backend driver. In future this should flag the bad
- * situation to the system controller to reboot the backed.
- */
+ * This definitely indicates a bug, either in this driver or in
+ * the backend driver. In future this should flag the bad
+ * situation to the system controller to reboot the backed.
+ */
if ((ref = np->grant_rx_ref[rx->id]) == GRANT_INVALID_REF) {
WPRINTK("Bad rx response id %d.\n", rx->id);
work_done--;
static DECLARE_BITMAP(hypercall_permission_map, NR_HYPERCALLS);
static int privcmd_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long data)
+ unsigned int cmd, unsigned long data)
{
int ret = -ENOSYS;
void __user *udata = (void __user *) data;
};
static int capabilities_read(char *page, char **start, off_t off,
- int count, int *eof, void *data)
+ int count, int *eof, void *data)
{
int len = 0;
*page = 0;
#include <asm/io.h>
#include <asm/pgalloc.h>
-#define DPRINTK(_f, _a...) pr_debug("(file=%s, line=%d) " _f, \
- __FILE__ , __LINE__ , ## _a )
+#define DPRINTK(_f, _a...) \
+ pr_debug("(file=%s, line=%d) " _f, \
+ __FILE__ , __LINE__ , ## _a )
typedef struct tpmif_st {
struct list_head tpmif_list;
int vtpm_release_packets(tpmif_t * tpmif, int send_msgs);
#define tpmif_get(_b) (atomic_inc(&(_b)->refcnt))
-#define tpmif_put(_b) \
- do { \
- if ( atomic_dec_and_test(&(_b)->refcnt) ) \
- tpmif_disconnect_complete(_b); \
- } while (0)
-
+#define tpmif_put(_b) \
+ do { \
+ if (atomic_dec_and_test(&(_b)->refcnt)) \
+ tpmif_disconnect_complete(_b); \
+ } while (0)
extern int num_frontends;
static void connect(struct backend_info *be);
static int connect_ring(struct backend_info *be);
static void backend_changed(struct xenbus_watch *watch,
- const char **vec, unsigned int len);
+ const char **vec, unsigned int len);
static void frontend_changed(struct xenbus_device *dev,
- enum xenbus_state frontend_state);
+ enum xenbus_state frontend_state);
static int tpmback_remove(struct xenbus_device *dev)
{
}
static int tpmback_probe(struct xenbus_device *dev,
- const struct xenbus_device_id *id)
+ const struct xenbus_device_id *id)
{
int err;
struct backend_info *be = kzalloc(sizeof(struct backend_info),
- GFP_KERNEL);
+ GFP_KERNEL);
if (!be) {
xenbus_dev_fatal(dev, -ENOMEM,
- "allocating backend structure");
+ "allocating backend structure");
return -ENOMEM;
}
dev->dev.driver_data = be;
err = xenbus_watch_path2(dev, dev->nodename,
- "instance", &be->backend_watch,
- backend_changed);
+ "instance", &be->backend_watch,
+ backend_changed);
if (err) {
goto fail;
}
static void backend_changed(struct xenbus_watch *watch,
- const char **vec, unsigned int len)
+ const char **vec, unsigned int len)
{
int err;
long instance;
struct xenbus_device *dev = be->dev;
err = xenbus_scanf(XBT_NIL, dev->nodename,
- "instance","%li", &instance);
+ "instance","%li", &instance);
if (XENBUS_EXIST_ERR(err)) {
return;
}
static void frontend_changed(struct xenbus_device *dev,
- enum xenbus_state frontend_state)
+ enum xenbus_state frontend_state)
{
struct backend_info *be = dev->dev.driver_data;
int err;
case XenbusStateInitWait:
default:
xenbus_dev_fatal(dev, -EINVAL,
- "saw state %d at frontend",
- frontend_state);
+ "saw state %d at frontend",
+ frontend_state);
break;
}
}
* Notify the vTPM manager about a new front-end.
*/
err = tpmif_vtpm_open(be->tpmif,
- be->frontend_id,
- be->instance);
+ be->frontend_id,
+ be->instance);
if (err) {
xenbus_dev_error(be->dev, err,
- "queueing vtpm open packet");
+ "queueing vtpm open packet");
/*
* Should close down this device and notify FE
* about closure.
}
err = xenbus_printf(xbt, be->dev->nodename,
- "ready", "%lu", ready);
+ "ready", "%lu", ready);
if (err) {
xenbus_dev_fatal(be->dev, err, "writing 'ready'");
goto abort;
int err;
err = xenbus_gather(XBT_NIL, dev->otherend,
- "ring-ref", "%lu", &ring_ref,
+ "ring-ref", "%lu", &ring_ref,
"event-channel", "%u", &evtchn, NULL);
if (err) {
xenbus_dev_error(dev, err,
if (!be->tpmif) {
be->tpmif = tpmif_find(dev->otherend_id,
- be->instance);
+ be->instance);
if (IS_ERR(be->tpmif)) {
err = PTR_ERR(be->tpmif);
be->tpmif = NULL;
err = tpmif_map(be->tpmif, ring_ref, evtchn);
if (err) {
xenbus_dev_error(dev, err,
- "mapping shared-frame %lu port %u",
- ring_ref, evtchn);
+ "mapping shared-frame %lu port %u",
+ ring_ref, evtchn);
return err;
}
}
* IN THE SOFTWARE.
*/
-#define DPRINTK(fmt, args...) \
- pr_debug("xenbus_probe (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args)
+#define DPRINTK(fmt, args...) \
+ pr_debug("xenbus_probe (%s:%d) " fmt ".\n", \
+ __FUNCTION__, __LINE__, ##args)
#include <linux/kernel.h>
#include <linux/err.h>
dev->bus_id, err);
return err;
}
-
+
xdev->state = XenbusStateInitialising;
-
+
if (drv->resume) {
err = drv->resume(xdev);
- if (err) {
- printk(KERN_WARNING
- "xenbus: resume %s failed: %i\n",
- dev->bus_id, err);
- return err;
- }
- }
+ if (err) {
+ printk(KERN_WARNING
+ "xenbus: resume %s failed: %i\n",
+ dev->bus_id, err);
+ return err;
+ }
+ }
err = watch_otherend(xdev);
if (err) {
}
static int xsd_kva_read(char *page, char **start, off_t off,
- int count, int *eof, void *data)
+ int count, int *eof, void *data)
{
int len;
free_page(page);
/*
- * Do not unregister the xenbus front/backend buses here. The
- * buses must exist because front/backend drivers will use
- * them when they are registered.
- */
+ * Do not unregister the xenbus front/backend buses here. The buses
+ * must exist because front/backend drivers will use them when they are
+ * registered.
+ */
return err;
}