Skip to content

Commit

Permalink
bsock.c and msock.c are using dill_ prefix
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
  • Loading branch information
sustrik committed Apr 16, 2018
1 parent e4151d1 commit 8f64280
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
17 changes: 9 additions & 8 deletions bsock.c
Expand Up @@ -25,37 +25,38 @@
#include <errno.h>
#include <stddef.h>

#define DILL_DISABLE_RAW_NAMES
#include "libdillimpl.h"
#include "utils.h"

dill_unique_id(dill_bsock_type);

int dill_bsend(int s, const void *buf, size_t len, int64_t deadline) {
struct bsock_vfs *b = hquery(s, dill_bsock_type);
struct dill_bsock_vfs *b = dill_hquery(s, dill_bsock_type);
if(dill_slow(!b)) return -1;
struct iolist iol = {(void*)buf, len, NULL, 0};
struct dill_iolist iol = {(void*)buf, len, NULL, 0};
return b->bsendl(b, &iol, &iol, deadline);
}

int dill_brecv(int s, void *buf, size_t len, int64_t deadline) {
struct bsock_vfs *b = hquery(s, dill_bsock_type);
struct dill_bsock_vfs *b = dill_hquery(s, dill_bsock_type);
if(dill_slow(!b)) return -1;
struct iolist iol = {buf, len, NULL, 0};
struct dill_iolist iol = {buf, len, NULL, 0};
return b->brecvl(b, &iol, &iol, deadline);
}

int dill_bsendl(int s, struct iolist *first, struct iolist *last,
int dill_bsendl(int s, struct dill_iolist *first, struct dill_iolist *last,
int64_t deadline) {
struct bsock_vfs *b = hquery(s, dill_bsock_type);
struct dill_bsock_vfs *b = dill_hquery(s, dill_bsock_type);
if(dill_slow(!b)) return -1;
if(dill_slow(!first || !last || last->iol_next)) {
errno = EINVAL; return -1;}
return b->bsendl(b, first, last, deadline);
}

int dill_brecvl(int s, struct iolist *first, struct iolist *last,
int dill_brecvl(int s, struct dill_iolist *first, struct dill_iolist *last,
int64_t deadline) {
struct bsock_vfs *b = hquery(s, dill_bsock_type);
struct dill_bsock_vfs *b = dill_hquery(s, dill_bsock_type);
if(dill_slow(!b)) return -1;
if(dill_slow((first && !last) || (!first && last) || last->iol_next)) {
errno = EINVAL; return -1;}
Expand Down
17 changes: 9 additions & 8 deletions msock.c
Expand Up @@ -25,37 +25,38 @@
#include <errno.h>
#include <stddef.h>

#define DILL_DISABLE_RAW_NAMES
#include "libdillimpl.h"
#include "utils.h"

dill_unique_id(dill_msock_type);

int dill_msend(int s, const void *buf, size_t len, int64_t deadline) {
struct msock_vfs *m = hquery(s, dill_msock_type);
struct dill_msock_vfs *m = dill_hquery(s, dill_msock_type);
if(dill_slow(!m)) return -1;
struct iolist iol = {(void*)buf, len, NULL, 0};
struct dill_iolist iol = {(void*)buf, len, NULL, 0};
return m->msendl(m, &iol, &iol, deadline);
}

ssize_t dill_mrecv(int s, void *buf, size_t len, int64_t deadline) {
struct msock_vfs *m = hquery(s, dill_msock_type);
struct dill_msock_vfs *m = dill_hquery(s, dill_msock_type);
if(dill_slow(!m)) return -1;
struct iolist iol = {buf, len, NULL, 0};
struct dill_iolist iol = {buf, len, NULL, 0};
return m->mrecvl(m, &iol, &iol, deadline);
}

int dill_msendl(int s, struct iolist *first, struct iolist *last,
int dill_msendl(int s, struct dill_iolist *first, struct dill_iolist *last,
int64_t deadline) {
struct msock_vfs *m = hquery(s, dill_msock_type);
struct dill_msock_vfs *m = dill_hquery(s, dill_msock_type);
if(dill_slow(!m)) return -1;
if(dill_slow(!first || !last || last->iol_next)) {
errno = EINVAL; return -1;}
return m->msendl(m, first, last, deadline);
}

ssize_t dill_mrecvl(int s, struct iolist *first, struct iolist *last,
ssize_t dill_mrecvl(int s, struct dill_iolist *first, struct dill_iolist *last,
int64_t deadline) {
struct msock_vfs *m = hquery(s, dill_msock_type);
struct dill_msock_vfs *m = dill_hquery(s, dill_msock_type);
if(dill_slow(!m)) return -1;
if(dill_slow((last && last->iol_next) ||
(!first && last) ||
Expand Down

0 comments on commit 8f64280

Please sign in to comment.