Skip to contentSkip to conversation

mini-os: Make utility function get_self_id() public

PATCH In review Yosuke Iwamatsu 2 participants 2 messages Dec 16, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 mini-os: Make utility function get_self_id() public

Thanks,
-----------------------
Yosuke Iwamatsu
NEC Corporation

mini-os: Make utility function get_self_id() in fs-front.c public.

extras/mini-os/fs-front.c +1 -13
diff -r 6595393a3d28 extras/mini-os/fs-front.c
@@ -867,18 +867,6 @@ moretodo:
     if(more) goto moretodo;
     
     in_irq = 0;
-}
-
-/* Small utility function to figure out our domain id */
-static domid_t get_self_id(void)
-{
-    char *dom_id;
-    domid_t ret; 
-
-    BUG_ON(xenbus_read(XBT_NIL, "domid", &dom_id));
-    sscanf(dom_id, "%d", &ret);
-
-    return ret;
 }
 
 static void alloc_request_table(struct fs_import *import)
@@ -1066,7 +1054,7 @@ static int init_fs_import(struct fs_impo
     unmask_evtchn(import->local_port);
 
     
-    self_id = get_self_id(); 
+    self_id = xenbus_get_self_id(); 
     /* Write the frontend info to a node in our Xenbus */
     sprintf(nodename, "/local/domain/%d/device/vfs/%d", 
                         self_id, import->import_id);
extras/mini-os/include/xenbus.h +3 -0
diff -r 6595393a3d28 extras/mini-os/include/xenbus.h
@@ -91,6 +91,9 @@ char* xenbus_printf(xenbus_transaction_t
                                   const char* fmt, ...)
                    __attribute__((__format__(printf, 4, 5)));
 
+/* Utility function to figure out our domain id */
+domid_t xenbus_get_self_id(void);
+
 /* Reset the XenBus system. */
 void fini_xenbus(void);
 
extras/mini-os/xenbus/xenbus.c +11 -0
diff -r 6595393a3d28 extras/mini-os/xenbus/xenbus.c
@@ -666,6 +666,17 @@ char* xenbus_printf(xenbus_transaction_t
     return xenbus_write(xbt,fullpath,val);
 }
 
+domid_t xenbus_get_self_id(void)
+{
+    char *dom_id;
+    domid_t ret;
+
+    BUG_ON(xenbus_read(XBT_NIL, "domid", &dom_id));
+    sscanf(dom_id, "%d", &ret);
+
+    return ret;
+}
+
 static void do_ls_test(const char *pre)
 {
     char **dirs, *msg;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

This however can be useful by itself.

mini-os: Make utility function get_self_id() in fs-front.c public.

extras/mini-os/fs-front.c +1 -13
diff -r 6595393a3d28 extras/mini-os/fs-front.c
@@ -867,18 +867,6 @@ moretodo:
     if(more) goto moretodo;
     
     in_irq = 0;
-}
-
-/* Small utility function to figure out our domain id */
-static domid_t get_self_id(void)
-{
-    char *dom_id;
-    domid_t ret; 
-
-    BUG_ON(xenbus_read(XBT_NIL, "domid", &dom_id));
-    sscanf(dom_id, "%d", &ret);
-
-    return ret;
 }
 
 static void alloc_request_table(struct fs_import *import)
@@ -1066,7 +1054,7 @@ static int init_fs_import(struct fs_impo
     unmask_evtchn(import->local_port);
 
     
-    self_id = get_self_id(); 
+    self_id = xenbus_get_self_id(); 
     /* Write the frontend info to a node in our Xenbus */
     sprintf(nodename, "/local/domain/%d/device/vfs/%d", 
                         self_id, import->import_id);
extras/mini-os/include/xenbus.h +3 -0
diff -r 6595393a3d28 extras/mini-os/include/xenbus.h
@@ -91,6 +91,9 @@ char* xenbus_printf(xenbus_transaction_t
                                   const char* fmt, ...)
                    __attribute__((__format__(printf, 4, 5)));
 
+/* Utility function to figure out our domain id */
+domid_t xenbus_get_self_id(void);
+
 /* Reset the XenBus system. */
 void fini_xenbus(void);
 
extras/mini-os/xenbus/xenbus.c +11 -0
diff -r 6595393a3d28 extras/mini-os/xenbus/xenbus.c
@@ -666,6 +666,17 @@ char* xenbus_printf(xenbus_transaction_t
     return xenbus_write(xbt,fullpath,val);
 }
 
+domid_t xenbus_get_self_id(void)
+{
+    char *dom_id;
+    domid_t ret;
+
+    BUG_ON(xenbus_read(XBT_NIL, "domid", &dom_id));
+    sscanf(dom_id, "%d", &ret);
+
+    return ret;
+}
+
 static void do_ls_test(const char *pre)
 {
     char **dirs, *msg;

mini-os: Make utility function get_self_id() in fs-front.c public.

extras/mini-os/fs-front.c +1 -13
diff -r 6595393a3d28 extras/mini-os/fs-front.c
@@ -867,18 +867,6 @@ moretodo:
     if(more) goto moretodo;
     
     in_irq = 0;
-}
-
-/* Small utility function to figure out our domain id */
-static domid_t get_self_id(void)
-{
-    char *dom_id;
-    domid_t ret; 
-
-    BUG_ON(xenbus_read(XBT_NIL, "domid", &dom_id));
-    sscanf(dom_id, "%d", &ret);
-
-    return ret;
 }
 
 static void alloc_request_table(struct fs_import *import)
@@ -1066,7 +1054,7 @@ static int init_fs_import(struct fs_impo
     unmask_evtchn(import->local_port);
 
     
-    self_id = get_self_id(); 
+    self_id = xenbus_get_self_id(); 
     /* Write the frontend info to a node in our Xenbus */
     sprintf(nodename, "/local/domain/%d/device/vfs/%d", 
                         self_id, import->import_id);
extras/mini-os/include/xenbus.h +3 -0
diff -r 6595393a3d28 extras/mini-os/include/xenbus.h
@@ -91,6 +91,9 @@ char* xenbus_printf(xenbus_transaction_t
                                   const char* fmt, ...)
                    __attribute__((__format__(printf, 4, 5)));
 
+/* Utility function to figure out our domain id */
+domid_t xenbus_get_self_id(void);
+
 /* Reset the XenBus system. */
 void fini_xenbus(void);
 
extras/mini-os/xenbus/xenbus.c +11 -0
diff -r 6595393a3d28 extras/mini-os/xenbus/xenbus.c
@@ -666,6 +666,17 @@ char* xenbus_printf(xenbus_transaction_t
     return xenbus_write(xbt,fullpath,val);
 }
 
+domid_t xenbus_get_self_id(void)
+{
+    char *dom_id;
+    domid_t ret;
+
+    BUG_ON(xenbus_read(XBT_NIL, "domid", &dom_id));
+    sscanf(dom_id, "%d", &ret);
+
+    return ret;
+}
+
 static void do_ls_test(const char *pre)
 {
     char **dirs, *msg;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel