Skip to contentSkip to conversation

libmpathcmd: reinstate ABI 1.0.0

PATCH In review Martin Wilck 2 participants 3 messages Aug 13, 2024 – Aug 14, 2024 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 libmpathcmd: reinstate ABI 1.0.0

__mpath_connect() was part of our public ABI. Instead of removing it completely, define it as a weak alias of the new mpath_connect__(). This way, programs linked against previous versions of libmpathcmd will continue to work.

This shouldn't interfere with general symbol naming rules, as a weak symbol won't override a library symbol of the same name.

---
 libmpathcmd/libmpathcmd.version | 12 ++++++++----
 libmpathcmd/mpath_cmd.c         |  3 +++
 2 files changed, 11 insertions(+), 4 deletions(-)
libmpathcmd/libmpathcmd.version +8 -4
index a786c25..81bdb2b 100644
@@ -10,16 +10,20 @@
  *
  * See libmultipath.version for general policy about version numbers.
  */
-LIBMPATHCMD_2.0.0 {
+
+LIBMPATHCMD_1.0.0 {
 global:
 	mpath_connect;
-	mpath_connect__;
+	__mpath_connect;
 	mpath_disconnect;
 	mpath_process_cmd;
 	mpath_recv_reply;
 	mpath_recv_reply_len;
 	mpath_recv_reply_data;
 	mpath_send_cmd;
-local:
-	*;
 };
+
+LIBMPATHCMD_1.1.0 {
+global:
+	mpath_connect__;
+} LIBMPATHCMD_1.0.0;
libmpathcmd/mpath_cmd.c +3 -0
index 1fa036c..a38e8b6 100644
@@ -133,6 +133,9 @@ int mpath_connect__(int nonblocking)
 	return fd;
 }
 
+extern int __mpath_connect(int)
+	__attribute__((weak, alias("mpath_connect__")));
+
 /*
  * connect to a unix domain socket
  */
Signature · 1 line
2.46.0
#1 lore raw

PATCH 2/2 libmpathpersist: reinstate ABI 2.1.0

__mpath_persistent_reserve_{in,out}() were part of our public ABI. Instead of removing them completely, define it as a weak aliases.
This way, programs linked against previous versions of libmpathpersist will continue to work.

This shouldn't interfere with general symbol naming rules, as a weak symbol won't override a library symbol of the same name.

---
 libmpathpersist/libmpathpersist.version | 17 ++++++++++++-----
 libmpathpersist/mpath_persist.c         |  6 ++++++
 2 files changed, 18 insertions(+), 5 deletions(-)
libmpathpersist/libmpathpersist.version +12 -5
index f467d99..c7ddafb 100644
@@ -10,23 +10,30 @@
  *
  * See libmultipath.version for general policy about version numbers.
  */
-LIBMPATHPERSIST_3.0.0 {
+/* Previous API for backward compatibility */
+LIBMPATHPERSIST_2.1.0 {
 global:
-	/* public API as defined in mpath_persist.h */
 	libmpathpersist_exit;
 	libmpathpersist_init;
 	mpath_lib_exit;
 	mpath_lib_init;
 	mpath_mx_alloc_len;
 	mpath_persistent_reserve_free_vecs;
-	mpath_persistent_reserve_in__;
+	__mpath_persistent_reserve_in;
 	mpath_persistent_reserve_in;
 	mpath_persistent_reserve_init_vecs;
-	mpath_persistent_reserve_out__;
+	__mpath_persistent_reserve_out;
 	mpath_persistent_reserve_out;
-local: *;
+local:
+	*;
 };
 
+LIBMPATHPERSIST_2.2.0 {
+global:
+	mpath_persistent_reserve_in__;
+	mpath_persistent_reserve_out__;
+} LIBMPATHPERSIST_2.1.0;
+
 __LIBMPATHPERSIST_INT_1.0.0 {
 	/* Internal use by multipath-tools */
 	dumpHex;
libmpathpersist/mpath_persist.c +6 -0
index ace91d7..f5267eb 100644
@@ -127,6 +127,8 @@ int mpath_persistent_reserve_in__(int fd, int rq_servact,
 					      resp, noisy);
 }
 
+extern int __mpath_persistent_reserve_in(int, int, struct prin_resp *, int)
+	__attribute__((weak, alias("mpath_persistent_reserve_in__")));
 
 int mpath_persistent_reserve_out__( int fd, int rq_servact, int rq_scope,
 	unsigned int rq_type, struct prout_param_descriptor *paramp, int noisy)
@@ -136,6 +138,10 @@ int mpath_persistent_reserve_out__( int fd, int rq_servact, int rq_scope,
 					       noisy);
 }
 
+extern int __mpath_persistent_reserve_out(int, int, int, unsigned int,
+					  struct prout_param_descriptor *, int)
+	__attribute__((weak, alias("mpath_persistent_reserve_out__")));
+
 int mpath_persistent_reserve_in (int fd, int rq_servact,
 	struct prin_resp *resp, int noisy, int verbose)
 {
Signature · 1 line
2.46.0
maintainer Tested-by Reviewed-by on v1 1/2
#2 lore raw
In reply to Martin Wilck

On Tue, Aug 13, 2024 at 11:40:45AM +0200, Martin Wilck wrote:

For the set:

Quoted 59 lines

__mpath_connect() was part of our public ABI. Instead of removing it completely, define it as a weak alias of the new mpath_connect__(). This way, programs linked against previous versions of libmpathcmd will continue to work.

This shouldn't interfere with general symbol naming rules, as a weak symbol won't override a library symbol of the same name.

---
 libmpathcmd/libmpathcmd.version | 12 ++++++++----
 libmpathcmd/mpath_cmd.c         |  3 +++
 2 files changed, 11 insertions(+), 4 deletions(-)
libmpathcmd/libmpathcmd.version +8 -4
index a786c25..81bdb2b 100644
@@ -10,16 +10,20 @@
  *
  * See libmultipath.version for general policy about version numbers.
  */
-LIBMPATHCMD_2.0.0 {
+
+LIBMPATHCMD_1.0.0 {
 global:
 	mpath_connect;
-	mpath_connect__;
+	__mpath_connect;
 	mpath_disconnect;
 	mpath_process_cmd;
 	mpath_recv_reply;
 	mpath_recv_reply_len;
 	mpath_recv_reply_data;
 	mpath_send_cmd;
-local:
-	*;
 };
+
+LIBMPATHCMD_1.1.0 {
+global:
+	mpath_connect__;
+} LIBMPATHCMD_1.0.0;
libmpathcmd/mpath_cmd.c +3 -0
index 1fa036c..a38e8b6 100644
@@ -133,6 +133,9 @@ int mpath_connect__(int nonblocking)
 	return fd;
 }
 
+extern int __mpath_connect(int)
+	__attribute__((weak, alias("mpath_connect__")));
+
 /*
  * connect to a unix domain socket
  */
Signature · 1 line
2.46.0