]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
sync: export sync_wait() and sync_wake()
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 29 Jan 2021 12:28:23 +0000 (13:28 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 29 Jan 2021 12:28:23 +0000 (13:28 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/sync.c
src/lxc/sync.h

index 7ccdb71fc53ba0d7691bcc50b13845e8ffa0e7b9..c9733967fdb08ea82a7cef099ab6cd876d662115 100644 (file)
@@ -17,7 +17,7 @@
 
 lxc_log_define(sync, lxc);
 
-static int __sync_wait(int fd, int sequence)
+int sync_wait(int fd, int sequence)
 {
        int sync = -1;
        ssize_t ret;
@@ -41,7 +41,7 @@ static int __sync_wait(int fd, int sequence)
        return 0;
 }
 
-static int __sync_wake(int fd, int sequence)
+int sync_wake(int fd, int sequence)
 {
        int sync = sequence;
 
@@ -53,10 +53,10 @@ static int __sync_wake(int fd, int sequence)
 
 static int __sync_barrier(int fd, int sequence)
 {
-       if (__sync_wake(fd, sequence))
+       if (sync_wake(fd, sequence))
                return -1;
 
-       return __sync_wait(fd, sequence + 1);
+       return sync_wait(fd, sequence + 1);
 }
 
 int lxc_sync_barrier_parent(struct lxc_handler *handler, int sequence)
@@ -76,25 +76,25 @@ int lxc_sync_barrier_child(struct lxc_handler *handler, int sequence)
 int lxc_sync_wake_parent(struct lxc_handler *handler, int sequence)
 {
        TRACE("Child waking parent with sequence %s", sync_to_string(sequence));
-       return __sync_wake(handler->sync_sock[0], sequence);
+       return sync_wake(handler->sync_sock[0], sequence);
 }
 
 int lxc_sync_wait_parent(struct lxc_handler *handler, int sequence)
 {
        TRACE("Parent waiting for child with sequence %s", sync_to_string(sequence));
-       return __sync_wait(handler->sync_sock[0], sequence);
+       return sync_wait(handler->sync_sock[0], sequence);
 }
 
 int lxc_sync_wait_child(struct lxc_handler *handler, int sequence)
 {
        TRACE("Child waiting for parent with sequence %s", sync_to_string(sequence));
-       return __sync_wait(handler->sync_sock[1], sequence);
+       return sync_wait(handler->sync_sock[1], sequence);
 }
 
 int lxc_sync_wake_child(struct lxc_handler *handler, int sequence)
 {
        TRACE("Child waking parent with sequence %s", sync_to_string(sequence));
-       return __sync_wake(handler->sync_sock[1], sequence);
+       return sync_wake(handler->sync_sock[1], sequence);
 }
 
 int lxc_sync_init(struct lxc_handler *handler)
index 944853f63143468c4942a7d8b4166cc9e90b8425..55ebfaca703be1b4f53d3c33268ef2c17f18c3b3 100644 (file)
@@ -58,5 +58,7 @@ __hidden extern int lxc_sync_wake_parent(struct lxc_handler *, int);
 __hidden extern int lxc_sync_wait_parent(struct lxc_handler *, int);
 __hidden extern int lxc_sync_barrier_parent(struct lxc_handler *, int);
 __hidden extern int lxc_sync_barrier_child(struct lxc_handler *, int);
+__hidden extern int sync_wait(int fd, int sequence);
+__hidden extern int sync_wake(int fd, int sequence);
 
 #endif /* __LXC_SYNC_H */