[Libguestfs] [PATCH libnbd 2/4] api: Rename nbd_connect_socket_activation -> nbd_connect_systemd_socket_activation.

Richard W.M. Jones rjones at redhat.com
Fri Oct 4 19:50:08 UTC 2019


While the new name is quite long, the purpose is to prevent confusion
with a proposed new API to be called nbd_connect_socket.

Note that this API was never in a released stable version of libnbd so
we can change it at will during development.
---
 docs/libnbd.pod             |  4 ++--
 examples/open-qcow2.c       |  3 ++-
 generator/generator         | 14 +++++++-------
 interop/dirty-bitmap.c      |  2 +-
 interop/interop.c           |  2 +-
 interop/socket-activation.c |  2 +-
 interop/structured-read.c   |  2 +-
 lib/connect.c               |  8 +++++---
 8 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/docs/libnbd.pod b/docs/libnbd.pod
index dfd8735..ef4c7de 100644
--- a/docs/libnbd.pod
+++ b/docs/libnbd.pod
@@ -438,8 +438,8 @@ testing.
 Some NBD servers — notably L<nbdkit(1)> and L<qemu-nbd(1)> — support
 systemd socket activation allowing libnbd to pass a socket to the
 subprocess.  This works very similarly to L<nbd_connect_command(3)>
-described above, but you must use L<nbd_connect_socket_activation(3)>
-instead.
+described above, but you must use
+L<nbd_connect_systemd_socket_activation(3)> instead.
 
 =head1 EXPORTS AND FLAGS
 
diff --git a/examples/open-qcow2.c b/examples/open-qcow2.c
index 27c0e1f..79572f1 100644
--- a/examples/open-qcow2.c
+++ b/examples/open-qcow2.c
@@ -37,7 +37,8 @@ main (int argc, char *argv[])
     (char *) filename,
     NULL
   };
-  if (nbd_connect_socket_activation (nbd, args) == -1) {
+  if (nbd_connect_systemd_socket_activation (nbd,
+                                             args) == -1) {
     fprintf (stderr, "%s\n", nbd_get_error ());
     exit (EXIT_FAILURE);
   }
diff --git a/generator/generator b/generator/generator
index ad1cb6b..c7464d5 100755
--- a/generator/generator
+++ b/generator/generator
@@ -95,7 +95,7 @@ type external_event =
   | CmdConnectUnix              (* [nbd_aio_connect_unix] *)
   | CmdConnectTCP               (* [nbd_aio_connect_tcp] *)
   | CmdConnectCommand           (* [nbd_aio_connect_command] *)
-  | CmdConnectSA                (* [nbd_aio_connect_socket_activation] *)
+  | CmdConnectSA                (* [nbd_aio_connect_systemd_socket_activation]*)
   | CmdIssue                    (* issuing an NBD command *)
 
 type location = string * int    (* source location: file, line number *)
@@ -275,7 +275,7 @@ and connect_command_state_machine = [
   };
 ]
 
-(* State machine implementing [nbd_aio_connect_socket_activation]. *)
+(* State machine implementing [nbd_aio_connect_systemd_socket_activation]. *)
 and connect_sa_state_machine = [
   State {
     default_state with
@@ -1528,7 +1528,7 @@ is killed.";
     example = Some "examples/connect-command.c";
   };
 
-  "connect_socket_activation", {
+  "connect_systemd_socket_activation", {
     default_call with
     args = [ StringList "argv" ]; ret = RErr;
     permitted_states = [ Created ];
@@ -2161,7 +2161,7 @@ and completed the NBD handshake by calling L<nbd_aio_is_ready(3)>,
 on the connection.";
   };
 
-  "aio_connect_socket_activation", {
+  "aio_connect_systemd_socket_activation", {
     default_call with
     args = [ StringList "argv" ]; ret = RErr;
     permitted_states = [ Created ];
@@ -2169,7 +2169,7 @@ on the connection.";
     longdesc = "\
 Run the command as a subprocess and begin connecting to it using
 systemd socket activation.  Parameters behave as documented in
-L<nbd_connect_socket_activation(3)>.
+L<nbd_connect_systemd_socket_activation(3)>.
 
 You can check if the connection is still connecting by calling
 L<nbd_aio_is_connecting(3)>, or if it has connected to the server
@@ -2756,8 +2756,8 @@ let first_version = [
   "get_protocol", (1, 2);
   "set_handshake_flags", (1, 2);
   "get_handshake_flags", (1, 2);
-  "connect_socket_activation", (1, 2);
-  "aio_connect_socket_activation", (1, 2);
+  "connect_systemd_socket_activation", (1, 2);
+  "aio_connect_systemd_socket_activation", (1, 2);
 
   (* These calls are proposed for a future version of libnbd, but
    * have not been added to any released version so far.
diff --git a/interop/dirty-bitmap.c b/interop/dirty-bitmap.c
index a300388..5f9fa12 100644
--- a/interop/dirty-bitmap.c
+++ b/interop/dirty-bitmap.c
@@ -123,7 +123,7 @@ main (int argc, char *argv[])
   nbd_add_meta_context (nbd, LIBNBD_CONTEXT_BASE_ALLOCATION);
   nbd_add_meta_context (nbd, bitmap);
 
-  if (nbd_connect_socket_activation (nbd, &argv[2]) == -1) {
+  if (nbd_connect_systemd_socket_activation (nbd, &argv[2]) == -1) {
     fprintf (stderr, "%s\n", nbd_get_error ());
     exit (EXIT_FAILURE);
   }
diff --git a/interop/interop.c b/interop/interop.c
index c0140a0..5428544 100644
--- a/interop/interop.c
+++ b/interop/interop.c
@@ -100,7 +100,7 @@ main (int argc, char *argv[])
 
   /* Start the server. */
 #if SOCKET_ACTIVATION
-#define NBD_CONNECT nbd_connect_socket_activation
+#define NBD_CONNECT nbd_connect_systemd_socket_activation
 #else
 #define NBD_CONNECT nbd_connect_command
 #endif
diff --git a/interop/socket-activation.c b/interop/socket-activation.c
index db6f6ca..8fe2cfa 100644
--- a/interop/socket-activation.c
+++ b/interop/socket-activation.c
@@ -56,7 +56,7 @@ main (int argc, char *argv[])
   }
 
   char *args[] = { SERVER, SERVER_PARAMS, NULL };
-  if (nbd_connect_socket_activation (nbd, args) == -1) {
+  if (nbd_connect_systemd_socket_activation (nbd, args) == -1) {
     fprintf (stderr, "%s\n", nbd_get_error ());
     goto out;
   }
diff --git a/interop/structured-read.c b/interop/structured-read.c
index 6e85b65..13ec4f2 100644
--- a/interop/structured-read.c
+++ b/interop/structured-read.c
@@ -119,7 +119,7 @@ main (int argc, char *argv[])
     exit (EXIT_FAILURE);
   }
 
-  if (nbd_connect_socket_activation (nbd, &argv[1]) == -1) {
+  if (nbd_connect_systemd_socket_activation (nbd, &argv[1]) == -1) {
     fprintf (stderr, "%s\n", nbd_get_error ());
     exit (EXIT_FAILURE);
   }
diff --git a/lib/connect.c b/lib/connect.c
index c1cbef7..d648dd3 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -114,9 +114,10 @@ nbd_unlocked_connect_command (struct nbd_handle *h, char **argv)
 
 /* Connect to a local command, use systemd socket activation. */
 int
-nbd_unlocked_connect_socket_activation (struct nbd_handle *h, char **argv)
+nbd_unlocked_connect_systemd_socket_activation (struct nbd_handle *h,
+                                                char **argv)
 {
-  if (nbd_unlocked_aio_connect_socket_activation (h, argv) == -1)
+  if (nbd_unlocked_aio_connect_systemd_socket_activation (h, argv) == -1)
     return -1;
 
   return wait_until_connected (h);
@@ -417,7 +418,8 @@ nbd_unlocked_aio_connect_command (struct nbd_handle *h, char **argv)
 }
 
 int
-nbd_unlocked_aio_connect_socket_activation (struct nbd_handle *h, char **argv)
+nbd_unlocked_aio_connect_systemd_socket_activation (struct nbd_handle *h,
+                                                    char **argv)
 {
   char **copy;
 
-- 
2.23.0




More information about the Libguestfs mailing list