All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libxl/json: don't expose internal functions
@ 2025-11-25  9:11 Jan Beulich
  2025-11-27 14:27 ` Anthony PERARD
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2025-11-25  9:11 UTC (permalink / raw)
  To: xen-devel@lists.xenproject.org; +Cc: Anthony PERARD, Juergen Gross

Ideally internal function declarations wouldn't live in a non-private
header. If already they need to, they should be hidden as much as
possible. That is (a) their declarations shouldn't be exposed and (b) the
symbols shouldn't appear in the shared library's dynamic symbol table.
Gate the declarations upon _hidden actually being defined (rather than
providing an empty fallback), and apply _hidden also to the libyail
variants.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
Some lines end up being too long, but I don't know what libxl's approach
would be to avoid this. Plus the libjson-c counterparts have similar line
length issues.

--- a/tools/include/libxl_json.h
+++ b/tools/include/libxl_json.h
@@ -28,10 +28,9 @@
 #endif
 #endif
 
+#ifdef _hidden /* Don't expose internal function decls. */
+
 #ifdef HAVE_LIBJSONC
-#ifndef _hidden
-#define _hidden
-#endif
 _hidden int libxl__uint64_gen_jso(json_object **jso_r, uint64_t val);
 _hidden int libxl_defbool_gen_jso(json_object **jso_r, libxl_defbool *p);
 _hidden int libxl_uuid_gen_jso(json_object **jso_r, libxl_uuid *p);
@@ -44,20 +43,24 @@ _hidden int libxl_hwcap_gen_jso(json_obj
 _hidden int libxl_ms_vm_genid_gen_jso(json_object **jso_r, libxl_ms_vm_genid *p);
 #endif
 #if defined(HAVE_LIBYAJL)
-yajl_gen_status libxl__uint64_gen_json(yajl_gen hand, uint64_t val);
-yajl_gen_status libxl_defbool_gen_json(yajl_gen hand, libxl_defbool *p);
-yajl_gen_status libxl_uuid_gen_json(yajl_gen hand, libxl_uuid *p);
-yajl_gen_status libxl_mac_gen_json(yajl_gen hand, libxl_mac *p);
-yajl_gen_status libxl_bitmap_gen_json(yajl_gen hand, libxl_bitmap *p);
-yajl_gen_status libxl_cpuid_policy_list_gen_json(yajl_gen hand,
-                                                 libxl_cpuid_policy_list *p);
-yajl_gen_status libxl_string_list_gen_json(yajl_gen hand, libxl_string_list *p);
-yajl_gen_status libxl_key_value_list_gen_json(yajl_gen hand,
-                                              libxl_key_value_list *p);
-yajl_gen_status libxl_hwcap_gen_json(yajl_gen hand, libxl_hwcap *p);
-yajl_gen_status libxl_ms_vm_genid_gen_json(yajl_gen hand, libxl_ms_vm_genid *p);
+_hidden yajl_gen_status libxl__uint64_gen_json(yajl_gen hand, uint64_t val);
+_hidden yajl_gen_status libxl_defbool_gen_json(yajl_gen hand, libxl_defbool *p);
+_hidden yajl_gen_status libxl_uuid_gen_json(yajl_gen hand, libxl_uuid *p);
+_hidden yajl_gen_status libxl_mac_gen_json(yajl_gen hand, libxl_mac *p);
+_hidden yajl_gen_status libxl_bitmap_gen_json(yajl_gen hand, libxl_bitmap *p);
+_hidden yajl_gen_status libxl_cpuid_policy_list_gen_json(yajl_gen hand,
+                                                         libxl_cpuid_policy_list *p);
+_hidden yajl_gen_status libxl_string_list_gen_json(yajl_gen hand,
+                                                   libxl_string_list *p);
+_hidden yajl_gen_status libxl_key_value_list_gen_json(yajl_gen hand,
+                                                      libxl_key_value_list *p);
+_hidden yajl_gen_status libxl_hwcap_gen_json(yajl_gen hand, libxl_hwcap *p);
+_hidden yajl_gen_status libxl_ms_vm_genid_gen_json(yajl_gen hand,
+                                                   libxl_ms_vm_genid *p);
 #endif
 
+#endif /* _hidden */
+
 #include <_libxl_types_json.h>
 
 /* YAJL version check */


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-27 15:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-25  9:11 [PATCH] libxl/json: don't expose internal functions Jan Beulich
2025-11-27 14:27 ` Anthony PERARD
2025-11-27 15:11   ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.