summaryrefslogtreecommitdiff
path: root/server.c
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@wdc.com>2018-03-14 08:31:37 -0700
committerBart Van Assche <bart.vanassche@wdc.com>2018-03-15 09:56:43 -0700
commit971caeb177d3bc4f65fa31381bbfb83710bfc690 (patch)
tree6db1790b74eeb37d57582689e655f313faa4546e /server.c
parentae626d4ead6416adf464cf209cdf3e8b85d58190 (diff)
downloadfio-971caeb177d3bc4f65fa31381bbfb83710bfc690.tar.gz
fio-971caeb177d3bc4f65fa31381bbfb83710bfc690.tar.bz2
Rename fio_mutex into fio_sem
Since fio_mutex implements a semaphore, rename fio_mutex into fio_sem. Rename those fio_sem instances that have 'mutex' embedded in their name. Rename the mutex.h and .c source files into fio_sem.h and .c respectively. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Diffstat (limited to 'server.c')
-rw-r--r--server.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/server.c b/server.c
index 959786f8..65d4484e 100644
--- a/server.c
+++ b/server.c
@@ -74,7 +74,7 @@ struct fio_fork_item {
};
struct cmd_reply {
- struct fio_mutex lock;
+ struct fio_sem lock;
void *data;
size_t size;
int error;
@@ -108,12 +108,12 @@ static const char *fio_server_ops[FIO_NET_CMD_NR] = {
static void sk_lock(struct sk_out *sk_out)
{
- fio_mutex_down(&sk_out->lock);
+ fio_sem_down(&sk_out->lock);
}
static void sk_unlock(struct sk_out *sk_out)
{
- fio_mutex_up(&sk_out->lock);
+ fio_sem_up(&sk_out->lock);
}
void sk_out_assign(struct sk_out *sk_out)
@@ -129,9 +129,9 @@ void sk_out_assign(struct sk_out *sk_out)
static void sk_out_free(struct sk_out *sk_out)
{
- __fio_mutex_remove(&sk_out->lock);
- __fio_mutex_remove(&sk_out->wait);
- __fio_mutex_remove(&sk_out->xmit);
+ __fio_sem_remove(&sk_out->lock);
+ __fio_sem_remove(&sk_out->wait);
+ __fio_sem_remove(&sk_out->xmit);
sfree(sk_out);
}
@@ -558,7 +558,7 @@ static void fio_net_queue_entry(struct sk_entry *entry)
flist_add_tail(&entry->list, &sk_out->list);
sk_unlock(sk_out);
- fio_mutex_up(&sk_out->wait);
+ fio_sem_up(&sk_out->wait);
}
}
@@ -1039,7 +1039,7 @@ static int handle_command(struct sk_out *sk_out, struct flist_head *job_list,
memcpy(rep->data, in->data, in->size);
}
}
- fio_mutex_up(&rep->lock);
+ fio_sem_up(&rep->lock);
break;
}
default:
@@ -1138,7 +1138,7 @@ static int handle_sk_entry(struct sk_out *sk_out, struct sk_entry *entry)
{
int ret;
- fio_mutex_down(&sk_out->xmit);
+ fio_sem_down(&sk_out->xmit);
if (entry->flags & SK_F_VEC)
ret = send_vec_entry(sk_out, entry);
@@ -1150,7 +1150,7 @@ static int handle_sk_entry(struct sk_out *sk_out, struct sk_entry *entry)
entry->size, &entry->tag, NULL);
}
- fio_mutex_up(&sk_out->xmit);
+ fio_sem_up(&sk_out->xmit);
if (ret)
log_err("fio: failed handling cmd %s\n", fio_server_op(entry->opcode));
@@ -1215,7 +1215,7 @@ static int handle_connection(struct sk_out *sk_out)
break;
} else if (!ret) {
fio_server_check_jobs(&job_list);
- fio_mutex_down_timeout(&sk_out->wait, timeout);
+ fio_sem_down_timeout(&sk_out->wait, timeout);
continue;
}
@@ -1361,9 +1361,9 @@ static int accept_loop(int listen_sk)
sk_out = smalloc(sizeof(*sk_out));
sk_out->sk = sk;
INIT_FLIST_HEAD(&sk_out->list);
- __fio_mutex_init(&sk_out->lock, FIO_MUTEX_UNLOCKED);
- __fio_mutex_init(&sk_out->wait, FIO_MUTEX_LOCKED);
- __fio_mutex_init(&sk_out->xmit, FIO_MUTEX_UNLOCKED);
+ __fio_sem_init(&sk_out->lock, FIO_SEM_UNLOCKED);
+ __fio_sem_init(&sk_out->wait, FIO_SEM_LOCKED);
+ __fio_sem_init(&sk_out->xmit, FIO_SEM_UNLOCKED);
pid = fork();
if (pid) {
@@ -2033,7 +2033,7 @@ int fio_server_get_verify_state(const char *name, int threadnumber,
if (!rep)
return ENOMEM;
- __fio_mutex_init(&rep->lock, FIO_MUTEX_LOCKED);
+ __fio_sem_init(&rep->lock, FIO_SEM_LOCKED);
rep->data = NULL;
rep->error = 0;
@@ -2046,7 +2046,7 @@ int fio_server_get_verify_state(const char *name, int threadnumber,
/*
* Wait for the backend to receive the reply
*/
- if (fio_mutex_down_timeout(&rep->lock, 10000)) {
+ if (fio_sem_down_timeout(&rep->lock, 10000)) {
log_err("fio: timed out waiting for reply\n");
ret = ETIMEDOUT;
goto fail;
@@ -2083,7 +2083,7 @@ fail:
*datap = data;
sfree(rep->data);
- __fio_mutex_remove(&rep->lock);
+ __fio_sem_remove(&rep->lock);
sfree(rep);
return ret;
}