|
Add sxpr function for installing a new type.: msg#00331emulators.xen.cvs
ChangeSet 1.1159.267.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:03:34 -05:00 +++ b/tools/libxutil/sxpr.c 2005-03-25 07:03:34 -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:03:34 -05:00 +++ b/tools/libxutil/sxpr.h 2005-03-25 07:03:34 -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 |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Add support for specifying the interface name to be used by a netif: 00331, BitKeeper Bot |
|---|---|
| Next by Date: | Merge http://xen.bkbits.net:8080/xen-2.0-testing.bk: 00331, BitKeeper Bot |
| Previous by Thread: | Add support for specifying the interface name to be used by a netifi: 00331, BitKeeper Bot |
| Next by Thread: | Add sxpr function for installing a new type.: 00331, BitKeeper Bot |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | Mail Home | sitemap | FAQ | advertise |