WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] minios: get VBD CD/removable/RO info

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] minios: get VBD CD/removable/RO info
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 20 Mar 2008 11:40:11 -0700
Delivery-date: Thu, 20 Mar 2008 11:40:12 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1206035282 0
# Node ID 491a3b62ae5b697485e8f6eaf1da1f9ba1ef1ab3
# Parent  f4a92f0db20fda98a633c149e3396c005a759a77
minios: get VBD CD/removable/RO info

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
---
 extras/mini-os/blkfront.c         |    5 ++++-
 extras/mini-os/include/blkfront.h |    2 +-
 extras/mini-os/kernel.c           |   11 ++++++++++-
 tools/ioemu/block-vbd.c           |    3 ++-
 4 files changed, 17 insertions(+), 4 deletions(-)

diff -r f4a92f0db20f -r 491a3b62ae5b extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c Thu Mar 20 17:47:33 2008 +0000
+++ b/extras/mini-os/blkfront.c Thu Mar 20 17:48:02 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 f4a92f0db20f -r 491a3b62ae5b extras/mini-os/include/blkfront.h
--- a/extras/mini-os/include/blkfront.h Thu Mar 20 17:47:33 2008 +0000
+++ b/extras/mini-os/include/blkfront.h Thu Mar 20 17:48:02 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 f4a92f0db20f -r 491a3b62ae5b extras/mini-os/kernel.c
--- a/extras/mini-os/kernel.c   Thu Mar 20 17:47:33 2008 +0000
+++ b/extras/mini-os/kernel.c   Thu Mar 20 17:48:02 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 f4a92f0db20f -r 491a3b62ae5b tools/ioemu/block-vbd.c
--- a/tools/ioemu/block-vbd.c   Thu Mar 20 17:47:33 2008 +0000
+++ b/tools/ioemu/block-vbd.c   Thu Mar 20 17:48:02 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;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] minios: get VBD CD/removable/RO info, Xen patchbot-unstable <=