From: Samuel Thibault <samuel.thibault@eu.citrix.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] minios: get VBD CD/removable/RO info
Date: Thu, 20 Mar 2008 17:17:04 +0000 [thread overview]
Message-ID: <20080320171704.GE11225@implementation.uk.xensource.com> (raw)
minios: get VBD CD/removable/RO info
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
diff -r b0527d995dee extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c Thu Mar 20 17:12:39 2008 +0000
+++ b/extras/mini-os/blkfront.c Thu Mar 20 17:14:36 2008 +0000
@@ -70,7 +70,7 @@ void blkfront_handler(evtchn_port_t port
wake_up(&blkfront_queue);
}
-struct blkfront_dev *init_blkfront(char *nodename, uint64_t *sectors, unsigned *sector_size, int *mode)
+struct blkfront_dev *init_blkfront(char *nodename, uint64_t *sectors, unsigned *sector_size, int *mode, int *info)
{
xenbus_transaction_t xbt;
char* err;
@@ -175,6 +175,9 @@ done:
xenbus_wait_for_value(path,"4");
xenbus_unwatch_path(XBT_NIL, path);
+
+ snprintf(path, sizeof(path), "%s/info", dev->backend);
+ *info = xenbus_read_integer(path);
snprintf(path, sizeof(path), "%s/sectors", dev->backend);
// FIXME: read_integer returns an int, so disk size limited to 1TB for now
diff -r b0527d995dee extras/mini-os/include/blkfront.h
--- a/extras/mini-os/include/blkfront.h Thu Mar 20 17:12:39 2008 +0000
+++ b/extras/mini-os/include/blkfront.h Thu Mar 20 17:14:36 2008 +0000
@@ -15,7 +15,7 @@ struct blkfront_aiocb
void (*aio_cb)(struct blkfront_aiocb *aiocb, int ret);
};
-struct blkfront_dev *init_blkfront(char *nodename, uint64_t *sectors, unsigned *sector_size, int *mode);
+struct blkfront_dev *init_blkfront(char *nodename, uint64_t *sectors, unsigned *sector_size, int *mode, int *info);
#ifdef HAVE_LIBC
int blkfront_open(struct blkfront_dev *dev);
#endif
diff -r b0527d995dee extras/mini-os/kernel.c
--- a/extras/mini-os/kernel.c Thu Mar 20 17:12:39 2008 +0000
+++ b/extras/mini-os/kernel.c Thu Mar 20 17:14:36 2008 +0000
@@ -207,9 +207,18 @@ static void blkfront_thread(void *p)
static void blkfront_thread(void *p)
{
time_t lasttime = 0;
- blk_dev = init_blkfront(NULL, &blk_sectors, &blk_sector_size, &blk_mode);
+ int blk_info;
+
+ blk_dev = init_blkfront(NULL, &blk_sectors, &blk_sector_size, &blk_mode, &blk_info);
if (!blk_dev)
return;
+
+ if (blk_info & VDISK_CDROM)
+ printk("Block device is a CDROM\n");
+ if (blk_info & VDISK_REMOVABLE)
+ printk("Block device is removable\n");
+ if (blk_info & VDISK_READONLY)
+ printk("Block device is read-only\n");
#ifdef BLKTEST_WRITE
if (blk_mode == O_RDWR) {
diff -r b0527d995dee tools/ioemu/block-vbd.c
--- a/tools/ioemu/block-vbd.c Thu Mar 20 17:12:39 2008 +0000
+++ b/tools/ioemu/block-vbd.c Thu Mar 20 17:14:36 2008 +0000
@@ -51,6 +51,7 @@ typedef struct BDRVVbdState {
int fd;
int type;
int mode;
+ int info;
uint64_t sectors;
unsigned sector_size;
QEMU_LIST_ENTRY(BDRVVbdState) list;
@@ -80,7 +81,7 @@ static int vbd_open(BlockDriverState *bs
//handy to test posix access
//return -EIO;
- s->dev = init_blkfront((char *) filename, &s->sectors, &s->sector_size, &s->mode);
+ s->dev = init_blkfront((char *) filename, &s->sectors, &s->sector_size, &s->mode, &s->info);
if (!s->dev)
return -EIO;
reply other threads:[~2008-03-20 17:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080320171704.GE11225@implementation.uk.xensource.com \
--to=samuel.thibault@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.