]> git.proxmox.com Git - mirror_kronosnet.git/commitdiff
[internal] rename list_rwlock to global_rwlock
authorFabio M. Di Nitto <fdinitto@redhat.com>
Tue, 16 Feb 2016 05:29:43 +0000 (06:29 +0100)
committerFabio M. Di Nitto <fdinitto@redhat.com>
Tue, 16 Feb 2016 05:29:43 +0000 (06:29 +0100)
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
libknet/handle.c
libknet/host.c
libknet/internals.h
libknet/link.c
libknet/logging.c
libknet/threads_dsthandler.c
libknet/threads_heartbeat.c
libknet/threads_pmtud.c
libknet/threads_send_recv.c

index e3d05a0e9f48840324c942e0ea2e7642a8dbc02d..886ada101bd8a3255fb8ceb3d2f7c4e7a8223cc7 100644 (file)
@@ -34,7 +34,7 @@ static int _init_locks(knet_handle_t knet_h)
 {
        int savederrno = 0;
 
-       savederrno = pthread_rwlock_init(&knet_h->list_rwlock, NULL);
+       savederrno = pthread_rwlock_init(&knet_h->global_rwlock, NULL);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HANDLE, "Unable to initialize list rwlock: %s",
                        strerror(savederrno));
@@ -116,7 +116,7 @@ exit_fail:
 static void _destroy_locks(knet_handle_t knet_h)
 {
        knet_h->lock_init_done = 0;
-       pthread_rwlock_destroy(&knet_h->list_rwlock);
+       pthread_rwlock_destroy(&knet_h->global_rwlock);
        pthread_rwlock_destroy(&knet_h->listener_rwlock);
        pthread_rwlock_destroy(&knet_h->host_rwlock);
        pthread_mutex_destroy(&knet_h->host_mutex);
@@ -662,7 +662,7 @@ int knet_handle_free(knet_handle_t knet_h)
                goto exit_nolock;
        }
 
-       savederrno = pthread_rwlock_wrlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_wrlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HANDLE, "Unable to get write lock: %s",
                        strerror(savederrno));
@@ -675,14 +675,14 @@ int knet_handle_free(knet_handle_t knet_h)
                log_err(knet_h, KNET_SUB_HANDLE,
                        "Unable to free handle: host(s) or listener(s) are still active: %s",
                        strerror(savederrno));
-               pthread_rwlock_unlock(&knet_h->list_rwlock);
+               pthread_rwlock_unlock(&knet_h->global_rwlock);
                errno = savederrno;
                return -1;
        }
 
        knet_h->fini_in_progress = 1;
 
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
 
        _stop_threads(knet_h);
        _close_epolls(knet_h);
@@ -721,7 +721,7 @@ int knet_handle_enable_sock_notify(knet_handle_t knet_h,
                return -1;
        }
 
-       savederrno = pthread_rwlock_wrlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_wrlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HANDLE, "Unable to get write lock: %s",
                        strerror(savederrno));
@@ -733,7 +733,7 @@ int knet_handle_enable_sock_notify(knet_handle_t knet_h,
        knet_h->sock_notify_fn = sock_notify_fn;
        log_debug(knet_h, KNET_SUB_HANDLE, "sock_notify_fn enabled");
 
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
 
        return err;
 }
@@ -764,7 +764,7 @@ int knet_handle_add_datafd(knet_handle_t knet_h, int *datafd, int8_t *channel)
                return -1;
        }
 
-       savederrno = pthread_rwlock_wrlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_wrlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HANDLE, "Unable to get write lock: %s",
                        strerror(savederrno));
@@ -874,7 +874,7 @@ int knet_handle_add_datafd(knet_handle_t knet_h, int *datafd, int8_t *channel)
        knet_h->sockfd[*channel].in_use = 1;
 
 out_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -896,7 +896,7 @@ int knet_handle_remove_datafd(knet_handle_t knet_h, int datafd)
                return -1;
        }
 
-       savederrno = pthread_rwlock_wrlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_wrlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HANDLE, "Unable to get write lock: %s",
                        strerror(savederrno));
@@ -938,7 +938,7 @@ int knet_handle_remove_datafd(knet_handle_t knet_h, int datafd)
        memset(&knet_h->sockfd[channel], 0, sizeof(struct knet_sock));
 
 out_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -962,7 +962,7 @@ int knet_handle_get_datafd(knet_handle_t knet_h, const int8_t channel, int *data
                return -1;
        }
 
-       savederrno = pthread_rwlock_rdlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HANDLE, "Unable to get read lock: %s",
                        strerror(savederrno));
@@ -979,7 +979,7 @@ int knet_handle_get_datafd(knet_handle_t knet_h, const int8_t channel, int *data
        *datafd = knet_h->sockfd[channel].sockfd[0];
 
 out_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -1004,7 +1004,7 @@ int knet_handle_get_channel(knet_handle_t knet_h, const int datafd, int8_t *chan
                return -1;
        }
 
-       savederrno = pthread_rwlock_rdlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HANDLE, "Unable to get read lock: %s",
                        strerror(savederrno));
@@ -1029,7 +1029,7 @@ int knet_handle_get_channel(knet_handle_t knet_h, const int datafd, int8_t *chan
        }
 
 out_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -1054,7 +1054,7 @@ int knet_handle_enable_filter(knet_handle_t knet_h,
                return -1;
        }
 
-       savederrno = pthread_rwlock_wrlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_wrlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HANDLE, "Unable to get write lock: %s",
                        strerror(savederrno));
@@ -1070,7 +1070,7 @@ int knet_handle_enable_filter(knet_handle_t knet_h,
                log_debug(knet_h, KNET_SUB_HANDLE, "dst_host_filter_fn disabled");
        }
 
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
 
        return 0;
 }
@@ -1084,7 +1084,7 @@ int knet_handle_setfwd(knet_handle_t knet_h, unsigned int enabled)
                return -1;
        }
 
-       savederrno = pthread_rwlock_wrlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_wrlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HANDLE, "Unable to get write lock: %s",
                        strerror(savederrno));
@@ -1100,7 +1100,7 @@ int knet_handle_setfwd(knet_handle_t knet_h, unsigned int enabled)
                log_debug(knet_h, KNET_SUB_HANDLE, "Data forwarding is disabled");
        }
 
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
 
        return 0;
 }
@@ -1114,7 +1114,7 @@ int knet_handle_pmtud_getfreq(knet_handle_t knet_h, unsigned int *interval)
                return -1;
        }
 
-       savederrno = pthread_rwlock_rdlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HANDLE, "Unable to get write lock: %s",
                        strerror(savederrno));
@@ -1124,7 +1124,7 @@ int knet_handle_pmtud_getfreq(knet_handle_t knet_h, unsigned int *interval)
 
        *interval = knet_h->pmtud_interval;
 
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
 
        return 0;
 }
@@ -1143,7 +1143,7 @@ int knet_handle_pmtud_setfreq(knet_handle_t knet_h, unsigned int interval)
                return -1;
        }
 
-       savederrno = pthread_rwlock_wrlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_wrlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HANDLE, "Unable to get write lock: %s",
                        strerror(savederrno));
@@ -1162,7 +1162,7 @@ int knet_handle_pmtud_setfreq(knet_handle_t knet_h, unsigned int interval)
                pthread_mutex_unlock(&knet_h->pmtud_timer_mutex);
        }
 
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
 
        return 0;
 }
@@ -1181,7 +1181,7 @@ int knet_handle_enable_pmtud_notify(knet_handle_t knet_h,
                return -1;
        }
 
-       savederrno = pthread_rwlock_wrlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_wrlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HANDLE, "Unable to get write lock: %s",
                        strerror(savederrno));
@@ -1197,7 +1197,7 @@ int knet_handle_enable_pmtud_notify(knet_handle_t knet_h,
                log_debug(knet_h, KNET_SUB_HANDLE, "pmtud_notify_fn disabled");
        }
 
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
 
        return 0;
 }
@@ -1213,7 +1213,7 @@ int knet_handle_pmtud_get(knet_handle_t knet_h,
                return -1;
        }
 
-       savederrno = pthread_rwlock_rdlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HANDLE, "Unable to get write lock: %s",
                        strerror(savederrno));
@@ -1224,7 +1224,7 @@ int knet_handle_pmtud_get(knet_handle_t knet_h,
        *link_mtu = knet_h->link_mtu;
        *data_mtu = knet_h->data_mtu;
 
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
 
        return 0;
 }
@@ -1239,7 +1239,7 @@ int knet_handle_crypto(knet_handle_t knet_h, struct knet_handle_crypto_cfg *knet
                return -1;
        }
 
-       savederrno = pthread_rwlock_wrlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_wrlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HANDLE, "Unable to get write lock: %s",
                        strerror(savederrno));
@@ -1264,7 +1264,7 @@ int knet_handle_crypto(knet_handle_t knet_h, struct knet_handle_crypto_cfg *knet
        }
 
 exit_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        return err;
 }
 
@@ -1289,7 +1289,7 @@ ssize_t knet_recv(knet_handle_t knet_h, char *buff, const size_t buff_len, const
                return -1;
        }
 
-       savederrno = pthread_rwlock_rdlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HANDLE, "Unable to get read lock: %s",
                        strerror(savederrno));
@@ -1311,7 +1311,7 @@ ssize_t knet_recv(knet_handle_t knet_h, char *buff, const size_t buff_len, const
        savederrno = errno;
 
 out_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -1342,7 +1342,7 @@ ssize_t knet_send(knet_handle_t knet_h, const char *buff, const size_t buff_len,
                return -1;
        }
 
-       savederrno = pthread_rwlock_rdlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HANDLE, "Unable to get read lock: %s",
                        strerror(savederrno));
@@ -1365,7 +1365,7 @@ ssize_t knet_send(knet_handle_t knet_h, const char *buff, const size_t buff_len,
        savederrno = errno;
 
 out_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
index 8eac35acec0437be17bc59c1ae76cdd8a43441ae..0f594986bc46fe02c0d48a58f3ea81d37f3fdd5f 100644 (file)
@@ -42,7 +42,7 @@ int knet_host_add(knet_handle_t knet_h, uint16_t host_id)
                return -1;
        }
 
-       savederrno = pthread_rwlock_wrlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_wrlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HOST, "Unable to get write lock: %s",
                        strerror(savederrno));
@@ -117,7 +117,7 @@ int knet_host_add(knet_handle_t knet_h, uint16_t host_id)
        _host_list_update(knet_h);
 
 exit_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        if (err < 0) {
                free(host);
        }
@@ -136,7 +136,7 @@ int knet_host_remove(knet_handle_t knet_h, uint16_t host_id)
                return -1;
        }
 
-       savederrno = pthread_rwlock_wrlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_wrlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HOST, "Unable to get write lock: %s",
                        strerror(savederrno));
@@ -194,7 +194,7 @@ int knet_host_remove(knet_handle_t knet_h, uint16_t host_id)
        _host_list_update(knet_h);
 
 exit_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -208,7 +208,7 @@ int knet_host_set_name(knet_handle_t knet_h, uint16_t host_id, const char *name)
                return -1;
        }
 
-       savederrno = pthread_rwlock_wrlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_wrlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HOST, "Unable to get write lock: %s",
                        strerror(savederrno));
@@ -227,7 +227,7 @@ int knet_host_set_name(knet_handle_t knet_h, uint16_t host_id, const char *name)
        snprintf(knet_h->host_index[host_id]->name, KNET_MAX_HOST_LEN - 1, "%s", name);
 
 exit_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -242,7 +242,7 @@ int knet_host_get_name_by_host_id(knet_handle_t knet_h, uint16_t host_id,
                return -1;
        }
 
-       savederrno = pthread_rwlock_rdlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HOST, "Unable to get read lock: %s",
                        strerror(savederrno));
@@ -267,7 +267,7 @@ int knet_host_get_name_by_host_id(knet_handle_t knet_h, uint16_t host_id,
        err = 1;
 
 exit_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -283,7 +283,7 @@ int knet_host_get_id_by_host_name(knet_handle_t knet_h, const char *name,
                return -1;
        }
 
-       savederrno = pthread_rwlock_rdlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HOST, "Unable to get read lock: %s",
                        strerror(savederrno));
@@ -316,7 +316,7 @@ int knet_host_get_id_by_host_name(knet_handle_t knet_h, const char *name,
        }
 
 exit_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -331,7 +331,7 @@ int knet_host_get_host_list(knet_handle_t knet_h,
                return -1;
        }
 
-       savederrno = pthread_rwlock_rdlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HOST, "Unable to get read lock: %s",
                        strerror(savederrno));
@@ -351,7 +351,7 @@ int knet_host_get_host_list(knet_handle_t knet_h,
        *host_ids_entries = knet_h->host_ids_entries;
 
 exit_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -367,7 +367,7 @@ int knet_host_set_policy(knet_handle_t knet_h, uint16_t host_id,
                return -1;
        }
 
-       savederrno = pthread_rwlock_wrlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_wrlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HOST, "Unable to get write lock: %s",
                        strerror(savederrno));
@@ -395,7 +395,7 @@ int knet_host_set_policy(knet_handle_t knet_h, uint16_t host_id,
        }
 
 exit_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -410,7 +410,7 @@ int knet_host_get_policy(knet_handle_t knet_h, uint16_t host_id,
                return -1;
        }
 
-       savederrno = pthread_rwlock_rdlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HOST, "Unable to get read lock: %s",
                        strerror(savederrno));
@@ -429,7 +429,7 @@ int knet_host_get_policy(knet_handle_t knet_h, uint16_t host_id,
        *policy = knet_h->host_index[host_id]->link_handler_policy;
 
 exit_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -450,7 +450,7 @@ int knet_host_get_status(knet_handle_t knet_h, uint16_t host_id,
                return -1;
        }
 
-       savederrno = pthread_rwlock_rdlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HOST, "Unable to get read lock: %s",
                        strerror(savederrno));
@@ -470,7 +470,7 @@ int knet_host_get_status(knet_handle_t knet_h, uint16_t host_id,
        memmove(status, &host->status, sizeof(struct knet_host_status));
 
 exit_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -491,7 +491,7 @@ int knet_host_enable_status_change_notify(knet_handle_t knet_h,
                return -1;
        }
 
-       savederrno = pthread_rwlock_wrlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_wrlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_HOST, "Unable to get write lock: %s",
                        strerror(savederrno));
@@ -507,7 +507,7 @@ int knet_host_enable_status_change_notify(knet_handle_t knet_h,
                log_debug(knet_h, KNET_SUB_HOST, "host_status_change_notify_fn disabled");
        }
 
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
 
        return 0;
 }
index 5fa62bc3fdddd2955549940f534ec25d5fe46dad..088dc111b11254d879f121244a62720b3a150f17 100644 (file)
@@ -144,7 +144,7 @@ struct knet_handle {
        pthread_t dst_link_handler_thread;
        pthread_t pmtud_link_handler_thread;
        int lock_init_done;
-       pthread_rwlock_t list_rwlock;           /* global config lock */
+       pthread_rwlock_t global_rwlock;         /* global config lock */
        pthread_rwlock_t listener_rwlock;       /* listener add/rm lock, can switch to mutex? */
        pthread_rwlock_t host_rwlock;           /* send_host_info lock, can switch to mutex? */
        pthread_mutex_t host_mutex;             /* host mutex for cond wait on pckt send, switch to mutex/sync_send ? */
index 24813a1c6b498eba48fc2baf2b4f6f7e26f6adb1..2af2fe7aed79ea1e672d21b753fc9e66d5bf0ef2 100644 (file)
@@ -65,7 +65,7 @@ int knet_link_set_config(knet_handle_t knet_h, uint16_t host_id, uint8_t link_id
                return -1;
        }
 
-       savederrno = pthread_rwlock_wrlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_wrlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_LINK, "Unable to get write lock: %s",
                        strerror(savederrno));
@@ -147,7 +147,7 @@ exit_unlock:
                link->configured = 1;
                link->pong_count = KNET_LINK_DEFAULT_PONG_COUNT;
        }
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -180,7 +180,7 @@ int knet_link_get_config(knet_handle_t knet_h, uint16_t host_id, uint8_t link_id
                return -1;
        }
 
-       savederrno = pthread_rwlock_rdlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_LINK, "Unable to get read lock: %s",
                        strerror(savederrno));
@@ -217,7 +217,7 @@ int knet_link_get_config(knet_handle_t knet_h, uint16_t host_id, uint8_t link_id
        memmove(dst_addr, &link->dst_addr, sizeof(struct sockaddr_storage));
 
 exit_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -247,7 +247,7 @@ int knet_link_set_enable(knet_handle_t knet_h, uint16_t host_id, uint8_t link_id
         * a read lock is sufficient as all functions invoked by
         * this code are already thread safe.
         */
-       savederrno = pthread_rwlock_rdlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_LINK, "Unable to get read lock: %s",
                        strerror(savederrno));
@@ -337,7 +337,7 @@ int knet_link_set_enable(knet_handle_t knet_h, uint16_t host_id, uint8_t link_id
        link->host_info_up_sent = 0;
 
 exit_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -359,7 +359,7 @@ int knet_link_get_enable(knet_handle_t knet_h, uint16_t host_id, uint8_t link_id
                return -1;
        }
 
-       savederrno = pthread_rwlock_rdlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_LINK, "Unable to get read lock: %s",
                        strerror(savederrno));
@@ -389,7 +389,7 @@ int knet_link_get_enable(knet_handle_t knet_h, uint16_t host_id, uint8_t link_id
        *enabled = link->status.enabled;
 
 exit_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -416,7 +416,7 @@ int knet_link_set_pong_count(knet_handle_t knet_h, uint16_t host_id, uint8_t lin
                return -1;
        }
 
-       savederrno = pthread_rwlock_wrlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_wrlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_LINK, "Unable to get write lock: %s",
                        strerror(savederrno));
@@ -450,7 +450,7 @@ int knet_link_set_pong_count(knet_handle_t knet_h, uint16_t host_id, uint8_t lin
                  host_id, link_id, link->pong_count);
 
 exit_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -477,7 +477,7 @@ int knet_link_get_pong_count(knet_handle_t knet_h, uint16_t host_id, uint8_t lin
                return -1;
        }
 
-       savederrno = pthread_rwlock_rdlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_LINK, "Unable to get read lock: %s",
                        strerror(savederrno));
@@ -507,7 +507,7 @@ int knet_link_get_pong_count(knet_handle_t knet_h, uint16_t host_id, uint8_t lin
        *pong_count = link->pong_count;
 
 exit_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -544,7 +544,7 @@ int knet_link_set_timeout(knet_handle_t knet_h, uint16_t host_id, uint8_t link_i
                return -1;
        }
 
-       savederrno = pthread_rwlock_wrlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_wrlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_LINK, "Unable to get write lock: %s",
                        strerror(savederrno));
@@ -582,7 +582,7 @@ int knet_link_set_timeout(knet_handle_t knet_h, uint16_t host_id, uint8_t link_i
                  host_id, link_id, link->ping_interval, link->pong_timeout, precision);
 
 exit_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -619,7 +619,7 @@ int knet_link_get_timeout(knet_handle_t knet_h, uint16_t host_id, uint8_t link_i
                return -1;
        }
 
-       savederrno = pthread_rwlock_rdlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_LINK, "Unable to get read lock: %s",
                        strerror(savederrno));
@@ -651,7 +651,7 @@ int knet_link_get_timeout(knet_handle_t knet_h, uint16_t host_id, uint8_t link_i
        *precision = link->latency_fix;
 
 exit_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -674,7 +674,7 @@ int knet_link_set_priority(knet_handle_t knet_h, uint16_t host_id, uint8_t link_
                return -1;
        }
 
-       savederrno = pthread_rwlock_wrlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_wrlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_LINK, "Unable to get write lock: %s",
                        strerror(savederrno));
@@ -725,7 +725,7 @@ int knet_link_set_priority(knet_handle_t knet_h, uint16_t host_id, uint8_t link_
                  host_id, link_id, link->priority);
 
 exit_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -752,7 +752,7 @@ int knet_link_get_priority(knet_handle_t knet_h, uint16_t host_id, uint8_t link_
                return -1;
        }
 
-       savederrno = pthread_rwlock_rdlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_LINK, "Unable to get read lock: %s",
                        strerror(savederrno));
@@ -782,7 +782,7 @@ int knet_link_get_priority(knet_handle_t knet_h, uint16_t host_id, uint8_t link_
        *priority = link->priority;
 
 exit_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -809,7 +809,7 @@ int knet_link_get_link_list(knet_handle_t knet_h, uint16_t host_id,
                return -1;
        }
 
-       savederrno = pthread_rwlock_rdlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_LINK, "Unable to get read lock: %s",
                        strerror(savederrno));
@@ -838,7 +838,7 @@ int knet_link_get_link_list(knet_handle_t knet_h, uint16_t host_id,
        *link_ids_entries = count;
 
 exit_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
@@ -865,7 +865,7 @@ int knet_link_get_status(knet_handle_t knet_h, uint16_t host_id, uint8_t link_id
                return -1;
        }
 
-       savederrno = pthread_rwlock_rdlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_LINK, "Unable to get read lock: %s",
                        strerror(savederrno));
@@ -895,7 +895,7 @@ int knet_link_get_status(knet_handle_t knet_h, uint16_t host_id, uint8_t link_id
        memmove(status, &link->status, sizeof(struct knet_link_status));
 
 exit_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        errno = savederrno;
        return err;
 }
index 49a9f9010e8a452c825e84684eebe1b0b33700f1..0e7f4234bbb875b8cd70c5fbf04a6eeb8fe6d38f 100644 (file)
@@ -118,7 +118,7 @@ int knet_log_set_loglevel(knet_handle_t knet_h, uint8_t subsystem,
                return -1;
        }
 
-       savederrno = pthread_rwlock_wrlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_wrlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, subsystem, "Unable to get write lock: %s",
                        strerror(savederrno));
@@ -128,7 +128,7 @@ int knet_log_set_loglevel(knet_handle_t knet_h, uint8_t subsystem,
 
        knet_h->log_levels[subsystem] = level;
 
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        return 0;
 }
 
@@ -152,7 +152,7 @@ int knet_log_get_loglevel(knet_handle_t knet_h, uint8_t subsystem,
                return -1;
        }
 
-       savederrno = pthread_rwlock_rdlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, subsystem, "Unable to get write lock: %s",
                        strerror(savederrno));
@@ -162,7 +162,7 @@ int knet_log_get_loglevel(knet_handle_t knet_h, uint8_t subsystem,
 
        *level = knet_h->log_levels[subsystem];
 
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
        return 0;
 }
 
@@ -189,7 +189,7 @@ void log_msg(knet_handle_t knet_h, uint8_t subsystem, uint8_t msglevel,
         * if we get an EINVAL and locking is initialized, then
         * we are getting a real error and we need to stop
         */
-       err = pthread_rwlock_rdlock(&knet_h->list_rwlock);
+       err = pthread_rwlock_rdlock(&knet_h->global_rwlock);
        if ((err == EINVAL) && (knet_h->lock_init_done))
                return;
 
@@ -204,7 +204,7 @@ void log_msg(knet_handle_t knet_h, uint8_t subsystem, uint8_t msglevel,
         * unlock only if we are holding the lock
         */
        if (!err)
-               pthread_rwlock_unlock(&knet_h->list_rwlock);
+               pthread_rwlock_unlock(&knet_h->global_rwlock);
 
        while (byte_cnt < sizeof(struct knet_log_msg)) {
                len = write(knet_h->logfd, &msg, sizeof(struct knet_log_msg) - byte_cnt);
index ccdb3df58634a7e5bcb439e28a8962c020b380b8..a9b8757985da8e28a9fbc74882c8393c73482d44 100644 (file)
@@ -28,7 +28,7 @@ static void _handle_dst_link_updates(knet_handle_t knet_h)
                return;
        }
 
-       if (pthread_rwlock_rdlock(&knet_h->list_rwlock) != 0) {
+       if (pthread_rwlock_rdlock(&knet_h->global_rwlock) != 0) {
                log_debug(knet_h, KNET_SUB_SWITCH_T, "Unable to get read lock");
                return;
        }
@@ -42,7 +42,7 @@ static void _handle_dst_link_updates(knet_handle_t knet_h)
        _host_dstcache_update_sync(knet_h, host);
 
 out_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
 
        return;
 }
index eaf1cd85391dad5b0482119b0e3302f8179ffb88..3acffd443e8937751b503bd9d93eca222f465dd1 100644 (file)
@@ -100,7 +100,7 @@ void *_handle_heartbt_thread(void *data)
        while (!knet_h->fini_in_progress) {
                usleep(KNET_PING_TIMERES);
 
-               if (pthread_rwlock_rdlock(&knet_h->list_rwlock) != 0) {
+               if (pthread_rwlock_rdlock(&knet_h->global_rwlock) != 0) {
                        log_debug(knet_h, KNET_SUB_HB_T, "Unable to get read lock");
                        continue;
                }
@@ -115,7 +115,7 @@ void *_handle_heartbt_thread(void *data)
                        }
                }
 
-               pthread_rwlock_unlock(&knet_h->list_rwlock);
+               pthread_rwlock_unlock(&knet_h->global_rwlock);
        }
 
        return NULL;
index 8d738941a84a014863dd771b6c3971f7b3145a74..19e0629b6a5375e9a6ff255f21001db89626961e 100644 (file)
@@ -293,7 +293,7 @@ timer_restart:
                if (knet_h->pmtud_fini_requested)
                        continue;
 
-               if (pthread_rwlock_rdlock(&knet_h->list_rwlock) != 0) {
+               if (pthread_rwlock_rdlock(&knet_h->global_rwlock) != 0) {
                        log_debug(knet_h, KNET_SUB_PMTUD_T, "Unable to get read lock");
                        continue;
                }
@@ -346,7 +346,7 @@ timer_restart:
                }
 
 interrupt:
-               pthread_rwlock_unlock(&knet_h->list_rwlock);
+               pthread_rwlock_unlock(&knet_h->global_rwlock);
        }
 
        return NULL;
index 6d03b7051a5e801237d0090971a16206abaf1ec2..01050204b9e3d908b5d39025c35ca898ba0b7d67 100644 (file)
@@ -431,7 +431,7 @@ int knet_send_sync(knet_handle_t knet_h, const char *buff, const size_t buff_len
                return -1;
        }
 
-       savederrno = pthread_rwlock_rdlock(&knet_h->list_rwlock);
+       savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock);
        if (savederrno) {
                log_err(knet_h, KNET_SUB_SEND_T, "Unable to get read lock: %s",
                        strerror(savederrno));
@@ -461,7 +461,7 @@ int knet_send_sync(knet_handle_t knet_h, const char *buff, const size_t buff_len
        pthread_mutex_unlock(&knet_h->tx_mutex);
 
 out:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
 
        errno = savederrno;
        return err;
@@ -474,7 +474,7 @@ static void _handle_send_to_links(knet_handle_t knet_h, int sockfd, int8_t chann
        int msg_recv, i;
        int savederrno, docallback = 0;
 
-       if (pthread_rwlock_rdlock(&knet_h->list_rwlock) != 0) {
+       if (pthread_rwlock_rdlock(&knet_h->global_rwlock) != 0) {
                log_debug(knet_h, KNET_SUB_SEND_T, "Unable to get read lock");
                return;
        }
@@ -517,12 +517,12 @@ static void _handle_send_to_links(knet_handle_t knet_h, int sockfd, int8_t chann
        }
 
 out_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
 
        if (inlen < 0) {
                struct epoll_event ev;
 
-               if (pthread_rwlock_wrlock(&knet_h->list_rwlock) != 0) {
+               if (pthread_rwlock_wrlock(&knet_h->global_rwlock) != 0) {
                        log_debug(knet_h, KNET_SUB_SEND_T, "Unable to get read lock");
                        goto callback;
                }
@@ -537,7 +537,7 @@ out_unlock:
                        knet_h->sockfd[channel].has_error = 1;
                }
 
-               pthread_rwlock_unlock(&knet_h->list_rwlock);
+               pthread_rwlock_unlock(&knet_h->global_rwlock);
        }
 
 callback:
@@ -1128,7 +1128,7 @@ static void _handle_recv_from_links(knet_handle_t knet_h, int sockfd, struct mms
 {
        int i, msg_recv;
 
-       if (pthread_rwlock_rdlock(&knet_h->list_rwlock) != 0) {
+       if (pthread_rwlock_rdlock(&knet_h->global_rwlock) != 0) {
                log_debug(knet_h, KNET_SUB_LINK_T, "Unable to get read lock");
                return;
        }
@@ -1144,7 +1144,7 @@ static void _handle_recv_from_links(knet_handle_t knet_h, int sockfd, struct mms
        }
 
 exit_unlock:
-       pthread_rwlock_unlock(&knet_h->list_rwlock);
+       pthread_rwlock_unlock(&knet_h->global_rwlock);
 }
 
 void *_handle_recv_from_links_thread(void *data)