Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 93178
b: refs/heads/master
c: 1d78d70
h: refs/heads/master
v: v3
  • Loading branch information
Christian Limpach authored and Ingo Molnar committed Apr 24, 2008
1 parent 55d088d commit 8f21d3c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 53f0e8afcb0d57cfaff06b89eb8b5302f167577e
refs/heads/master: 1d78d7055629e3f6300d6b8d7028259ee2bffc0e
11 changes: 11 additions & 0 deletions trunk/drivers/block/xen-blkfront.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ struct blkfront_info
struct blk_shadow shadow[BLK_RING_SIZE];
unsigned long shadow_free;
int feature_barrier;
int is_ready;

/**
* The number of people holding this device open. We won't allow a
Expand Down Expand Up @@ -839,6 +840,8 @@ static void blkfront_connect(struct blkfront_info *info)
spin_unlock_irq(&blkif_io_lock);

add_disk(info->gd);

info->is_ready = 1;
}

/**
Expand Down Expand Up @@ -931,6 +934,13 @@ static int blkfront_remove(struct xenbus_device *dev)
return 0;
}

static int blkfront_is_ready(struct xenbus_device *dev)
{
struct blkfront_info *info = dev->dev.driver_data;

return info->is_ready;
}

static int blkif_open(struct inode *inode, struct file *filep)
{
struct blkfront_info *info = inode->i_bdev->bd_disk->private_data;
Expand Down Expand Up @@ -977,6 +987,7 @@ static struct xenbus_driver blkfront = {
.remove = blkfront_remove,
.resume = blkfront_resume,
.otherend_changed = backend_changed,
.is_ready = blkfront_is_ready,
};

static int __init xlblk_init(void)
Expand Down
5 changes: 4 additions & 1 deletion trunk/drivers/xen/xenbus/xenbus_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,7 @@ static int is_disconnected_device(struct device *dev, void *data)
{
struct xenbus_device *xendev = to_xenbus_device(dev);
struct device_driver *drv = data;
struct xenbus_driver *xendrv;

/*
* A device with no driver will never connect. We care only about
Expand All @@ -858,7 +859,9 @@ static int is_disconnected_device(struct device *dev, void *data)
if (drv && (dev->driver != drv))
return 0;

return (xendev->state != XenbusStateConnected);
xendrv = to_xenbus_driver(dev->driver);
return (xendev->state != XenbusStateConnected ||
(xendrv->is_ready && !xendrv->is_ready(xendev)));
}

static int exists_disconnected_device(struct device_driver *drv)
Expand Down
1 change: 1 addition & 0 deletions trunk/include/xen/xenbus.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ struct xenbus_driver {
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);
};

static inline struct xenbus_driver *to_xenbus_driver(struct device_driver *drv)
Expand Down

0 comments on commit 8f21d3c

Please sign in to comment.