[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] blktap2: Add tap_ctl_find_minor



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1276154802 -3600
# Node ID 9abf7f50fdc42a80c677c2773b16e1b180033f89
# Parent  a34358c64b63c803fcf51c8b31718946d172eccd
blktap2: Add tap_ctl_find_minor

Slack 'tap-ctl find -t <type> -f <path>'.

Signed-off-by: Daniel Stodden <daniel.stodden@xxxxxxxxxx>
---
 tools/blktap2/control/tap-ctl-list.c |   30 ++++++++++++++++++++++++++++++
 tools/blktap2/control/tap-ctl.h      |    1 +
 2 files changed, 31 insertions(+)

diff -r a34358c64b63 -r 9abf7f50fdc4 tools/blktap2/control/tap-ctl-list.c
--- a/tools/blktap2/control/tap-ctl-list.c      Thu Jun 10 08:25:55 2010 +0100
+++ b/tools/blktap2/control/tap-ctl-list.c      Thu Jun 10 08:26:42 2010 +0100
@@ -504,3 +504,33 @@ out:
 
        return err;
 }
+
+int
+tap_ctl_find_minor(const char *type, const char *path)
+{
+       tap_list_t **list, **_entry;
+       int minor, err;
+
+       err = tap_ctl_list(&list);
+       if (err)
+               return err;
+
+       minor = -1;
+
+       for (_entry = list; *_entry != NULL; ++_entry) {
+               tap_list_t *entry  = *_entry;
+
+               if (type && (!entry->type || strcmp(entry->type, type)))
+                       continue;
+
+               if (path && (!entry->path || strcmp(entry->path, path)))
+                       continue;
+
+               minor = entry->minor;
+               break;
+       }
+
+       tap_ctl_free_list(list);
+
+       return minor >= 0 ? minor : -ENOENT;
+}
diff -r a34358c64b63 -r 9abf7f50fdc4 tools/blktap2/control/tap-ctl.h
--- a/tools/blktap2/control/tap-ctl.h   Thu Jun 10 08:25:55 2010 +0100
+++ b/tools/blktap2/control/tap-ctl.h   Thu Jun 10 08:26:42 2010 +0100
@@ -77,6 +77,7 @@ int tap_ctl_get_driver_id(const char *ha
 
 int tap_ctl_list(tap_list_t ***list);
 void tap_ctl_free_list(tap_list_t **list);
+int tap_ctl_find_minor(const char *type, const char *path);
 
 int tap_ctl_allocate(int *minor, char **devname);
 int tap_ctl_free(const int minor);

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.