# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1334219369 -3600
# Node ID ce1c73db77fb1264de40a9253371158e9c9ae71c
# Parent 14cac8170e122115ef090cb390775b8c356ae643
libxl: mark internal functions hidden
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
diff -r 14cac8170e12 -r ce1c73db77fb tools/libxl/gentypes.py
--- a/tools/libxl/gentypes.py Thu Apr 12 09:12:58 2012 +0100
+++ b/tools/libxl/gentypes.py Thu Apr 12 09:29:29 2012 +0100
@@ -280,22 +280,22 @@ if __name__ == ''__main__'':
for ty in types:
f.write(libxl_C_type_define(ty) + ";\n")
if ty.dispose_fn is not None:
- f.write("void %s(%s);\n" % (ty.dispose_fn,
ty.make_arg("p")))
+ f.write("%svoid %s(%s);\n" % (ty.hidden(), ty.dispose_fn,
ty.make_arg("p")))
if ty.init_fn is not None:
- f.write("void %s(%s);\n" % (ty.init_fn,
ty.make_arg("p")))
+ f.write("%svoid %s(%s);\n" % (ty.hidden(), ty.init_fn,
ty.make_arg("p")))
for field in libxl_init_members(ty):
if not isinstance(field.type, idl.KeyedUnion):
raise Exception("Only KeyedUnion is supported for
member init")
ku = field.type
- f.write("void %s(%s, %s);\n" % (ty.init_fn +
"_" + ku.keyvar.name,
+ f.write("%svoid %s(%s, %s);\n" % (ty.hidden(),
ty.init_fn + "_" + ku.keyvar.name,
ty.make_arg("p"),
ku.keyvar.type.make_arg(ku.keyvar.name)))
if ty.json_fn is not None:
- f.write("char *%s_to_json(libxl_ctx *ctx, %s);\n" %
(ty.typename, ty.make_arg("p")))
+ f.write("%schar *%s_to_json(libxl_ctx *ctx, %s);\n" %
(ty.hidden(), ty.typename, ty.make_arg("p")))
if isinstance(ty, idl.Enumeration):
- f.write("const char *%s_to_string(%s);\n" % (ty.typename,
ty.make_arg("p")))
- f.write("int %s_from_string(const char *s, %s);\n" %
(ty.typename, ty.make_arg("e", passby=idl.PASS_BY_REFERENCE)))
- f.write("extern libxl_enum_string_table
%s_string_table[];\n" % (ty.typename))
+ f.write("%sconst char *%s_to_string(%s);\n" %
(ty.hidden(), ty.typename, ty.make_arg("p")))
+ f.write("%sint %s_from_string(const char *s, %s);\n" %
(ty.hidden(), ty.typename, ty.make_arg("e",
passby=idl.PASS_BY_REFERENCE)))
+ f.write("%sextern libxl_enum_string_table
%s_string_table[];\n" % (ty.hidden(), ty.typename))
f.write("\n")
f.write("""#endif /* %s */\n""" %
(header_define))
@@ -319,7 +319,7 @@ if __name__ == ''__main__'':
""" % (header_json_define, header_json_define, "
".join(sys.argv)))
for ty in [ty for ty in types if ty.json_fn is not None]:
- f.write("yajl_gen_status %s_gen_json(yajl_gen hand, %s);\n" %
(ty.typename, ty.make_arg("p", passby=idl.PASS_BY_REFERENCE)))
+ f.write("%syajl_gen_status %s_gen_json(yajl_gen hand, %s);\n"
% (ty.hidden(), ty.typename, ty.make_arg("p",
passby=idl.PASS_BY_REFERENCE)))
f.write("\n")
f.write("""#endif /* %s */\n""" %
header_json_define)
diff -r 14cac8170e12 -r ce1c73db77fb tools/libxl/idl.py
--- a/tools/libxl/idl.py Thu Apr 12 09:12:58 2012 +0100
+++ b/tools/libxl/idl.py Thu Apr 12 09:29:29 2012 +0100
@@ -19,11 +19,20 @@ def _get_default_namespace():
global _default_namespace
return _default_namespace
+_default_hidden = False
+def hidden(b):
+ global _default_hidden
+ _default_hidden = b
+
+def _get_default_hidden():
+ global _default_hidden
+ return _default_hidden
class Type(object):
def __init__(self, typename, **kwargs):
self.namespace = kwargs.setdefault(''namespace'',
_get_default_namespace())
+ self._hidden = kwargs.setdefault(''hidden'',
_get_default_hidden())
self.dir = kwargs.setdefault(''dir'', DIR_BOTH)
if self.dir not in [DIR_NONE, DIR_IN, DIR_OUT, DIR_BOTH]:
raise ValueError
@@ -67,6 +76,12 @@ class Type(object):
def marshal_out(self):
return self.dir in [DIR_OUT, DIR_BOTH]
+ def hidden(self):
+ if self._hidden:
+ return "_hidden "
+ else:
+ return ""
+
def make_arg(self, n, passby=None):
if passby is None: passby = self.passby
@@ -289,7 +304,7 @@ def parse(f):
globs[n] = t
elif n in [''PASS_BY_REFERENCE'',
''PASS_BY_VALUE'',
''DIR_NONE'', ''DIR_IN'',
''DIR_OUT'', ''DIR_BOTH'',
- ''namespace'']:
+ ''namespace'', ''hidden'']:
globs[n] = t
try:
diff -r 14cac8170e12 -r ce1c73db77fb tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h Thu Apr 12 09:12:58 2012 +0100
+++ b/tools/libxl/libxl_internal.h Thu Apr 12 09:29:29 2012 +0100
@@ -118,7 +118,7 @@ typedef struct libxl__gc libxl__gc;
typedef struct libxl__egc libxl__egc;
typedef struct libxl__ao libxl__ao;
-void libxl__alloc_failed(libxl_ctx *, const char *func,
+_hidden void libxl__alloc_failed(libxl_ctx *, const char *func,
size_t nmemb, size_t size) __attribute__((noreturn));
/* func, size and nmemb are used only in the log message.
* You may pass size==0 if size and nmemb are not meaningful
@@ -184,7 +184,8 @@ typedef struct libxl__ev_watch_slot {
LIBXL_SLIST_ENTRY(struct libxl__ev_watch_slot) empty;
} libxl__ev_watch_slot;
-libxl__ev_xswatch *libxl__watch_slot_contents(libxl__gc *gc, int slotnum);
+_hidden libxl__ev_xswatch *libxl__watch_slot_contents(libxl__gc *gc,
+ int slotnum);
/*
@@ -597,21 +598,21 @@ _hidden void libxl__event_disaster(libxl
/* Fills in, or disposes of, the resources held by, a poller whose
* space the caller has allocated. ctx must be locked. */
-int libxl__poller_init(libxl_ctx *ctx, libxl__poller *p);
-void libxl__poller_dispose(libxl__poller *p);
+_hidden int libxl__poller_init(libxl_ctx *ctx, libxl__poller *p);
+_hidden void libxl__poller_dispose(libxl__poller *p);
/* Obtain a fresh poller from malloc or the idle list, and put it
* away again afterwards. _get can fail, returning NULL.
* ctx must be locked. */
-libxl__poller *libxl__poller_get(libxl_ctx *ctx);
-void libxl__poller_put(libxl_ctx *ctx, libxl__poller *p);
+_hidden libxl__poller *libxl__poller_get(libxl_ctx *ctx);
+_hidden void libxl__poller_put(libxl_ctx *ctx, libxl__poller *p);
/* Notifies whoever is polling using p that they should wake up.
* ctx must be locked. */
-void libxl__poller_wakeup(libxl__egc *egc, libxl__poller *p);
+_hidden void libxl__poller_wakeup(libxl__egc *egc, libxl__poller *p);
-int libxl__atfork_init(libxl_ctx *ctx);
+_hidden int libxl__atfork_init(libxl_ctx *ctx);
/* from xl_dom */
@@ -1356,23 +1357,23 @@ _hidden void libxl__ao__destroy(libxl_ct
*/
typedef struct libxl__carefd libxl__carefd;
-void libxl__carefd_begin(void);
-void libxl__carefd_unlock(void);
+_hidden void libxl__carefd_begin(void);
+_hidden void libxl__carefd_unlock(void);
/* fd may be -1, in which case this returns a dummy libxl__fd_record
* on which it _carefd_close is a no-op. Cannot fail. */
-libxl__carefd *libxl__carefd_record(libxl_ctx *ctx, int fd);
+_hidden libxl__carefd *libxl__carefd_record(libxl_ctx *ctx, int fd);
/* Combines _record and _unlock in a single call. If fd==-1,
* still does the unlock, but returns 0. Cannot fail. */
-libxl__carefd *libxl__carefd_opened(libxl_ctx *ctx, int fd);
+_hidden libxl__carefd *libxl__carefd_opened(libxl_ctx *ctx, int fd);
/* Works just like close(2). You may pass NULL, in which case it''s
* a successful no-op. */
-int libxl__carefd_close(libxl__carefd*);
+_hidden int libxl__carefd_close(libxl__carefd*);
/* You may pass NULL in which case the answer is -1. */
-int libxl__carefd_fd(const libxl__carefd*);
+_hidden int libxl__carefd_fd(const libxl__carefd*);
/* common paths */
_hidden const char *libxl__libexec_path(void);
diff -r 14cac8170e12 -r ce1c73db77fb tools/libxl/libxl_types_internal.idl
--- a/tools/libxl/libxl_types_internal.idl Thu Apr 12 09:12:58 2012 +0100
+++ b/tools/libxl/libxl_types_internal.idl Thu Apr 12 09:29:29 2012 +0100
@@ -1,4 +1,5 @@
namespace("libxl__")
+hidden(True)
libxl_domid = Builtin("domid", namespace="libxl_", json_fn
= "yajl_gen_integer")