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] Add sxpr function for installing a new type.

ChangeSet 1.1775.1.7, 2005/03/17 16:29:49+00:00, mjw@xxxxxxxxxxxxxxxxxxx

        Add sxpr function for installing a new type.
        
        Signed-off-by: Mike Wray <mike.wray@xxxxxx>



 sxpr.c |   24 ++++++++++++++++++++++++
 sxpr.h |    1 +
 2 files changed, 25 insertions(+)


diff -Nru a/tools/libxutil/sxpr.c b/tools/libxutil/sxpr.c
--- a/tools/libxutil/sxpr.c     2005-03-25 07:08:55 -05:00
+++ b/tools/libxutil/sxpr.c     2005-03-25 07:08:55 -05:00
@@ -82,6 +82,30 @@
 /** Number of entries in the types array. */
 static int type_sup = sizeof(types)/sizeof(types[0]);
 
+/** Define a type.
+ * The tydef must have a non-zero type code.
+ * It is an error if the type code is out of range or already defined.
+ *
+ * @param tydef type definition
+ * @return 0 on success, error code otherwise
+ */
+int def_sxpr_type(SxprType *tydef){
+    int err = 0;
+    int ty = tydef->type;
+    if(ty < 0 || ty >= type_sup){
+        err = -EINVAL;
+        goto exit;
+    }
+    if(types[ty].type){
+        err = -EEXIST;
+        goto exit;
+    }
+    types[ty] = *tydef;
+  exit:
+    return err;
+    
+}
+
 /** Get the type definition for a given type code.
  *
  * @param ty type code
diff -Nru a/tools/libxutil/sxpr.h b/tools/libxutil/sxpr.h
--- a/tools/libxutil/sxpr.h     2005-03-25 07:08:55 -05:00
+++ b/tools/libxutil/sxpr.h     2005-03-25 07:08:55 -05:00
@@ -307,6 +307,7 @@
 } SxprType;
 
 
+extern int def_sxpr_type(SxprType *tydef);
 extern SxprType *get_sxpr_type(int ty);
 
 /** Free the pointer in an sxpr.


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>