diff options
Diffstat (limited to 'uring.c')
| -rw-r--r-- | uring.c | 90 | 
1 files changed, 45 insertions, 45 deletions
@@ -40,7 +40,7 @@ get_sqe(struct cfg *cfg, struct uring_task *task)  		io_uring_submit(&cfg->uev->uring);  		sqe = io_uring_get_sqe(&cfg->uev->uring);  		if (!sqe) -			perrordie("failed to get an sqe!"); +			die("failed to get an sqe!");  	}  	sqe_count++; @@ -75,7 +75,7 @@ uring_task_refdump(struct uring_task *task)  		memcpy(dst, tmp->name, strlen(tmp->name));  	} -	debug(DBG_REF, "%s (0x%p parent 0x%p free 0x%p fd %i ref %u)\n", +	debug(DBG_REF, "%s (0x%p parent 0x%p free 0x%p fd %i ref %u)",  	      buf, task, task->parent, task->free, task->fd,  	      task->refcount);  } @@ -87,11 +87,11 @@ uring_task_refdump(struct uring_task *task)  void  uring_task_destroy(struct cfg *cfg, struct uring_task *task)  { -	debug(DBG_UR, "task %s (%p), fd %i, refcount %u\n", +	debug(DBG_UR, "task %s (%p), fd %i, refcount %u",  	      task->name, task, task->fd, task->refcount);  	if (!task) { -		error("called with no task\n"); +		error("called with no task");  		return;  	} @@ -112,7 +112,7 @@ uring_task_put(struct cfg *cfg, struct uring_task *task)  {  	struct uring_task *parent = task->parent; -	debug(DBG_REF, "task %s (%p), refcount %u\n", +	debug(DBG_REF, "task %s (%p), refcount %u",  	      task->name, task, task->refcount);  	task->refcount--; @@ -121,7 +121,7 @@ uring_task_put(struct cfg *cfg, struct uring_task *task)  		return;  	if (task->refcount < 0) -		error("Negative refcount!\n"); +		error("Negative refcount!");  	if (task->fd >= 0) {  		uring_task_close_fd(cfg, task); @@ -130,7 +130,7 @@ uring_task_put(struct cfg *cfg, struct uring_task *task)  	}  	if (parent) -		debug(DBG_REF, "putting parent %s (%p)\n", +		debug(DBG_REF, "putting parent %s (%p)",  		      task->parent->name, task->parent);  	if (task->free) @@ -143,11 +143,11 @@ uring_task_put(struct cfg *cfg, struct uring_task *task)  void  uring_task_get(struct cfg *cfg, struct uring_task *task)  { -	debug(DBG_REF, "task %s (%p), refcount %u\n", +	debug(DBG_REF, "task %s (%p), refcount %u",  	      task->name, task, task->refcount);  	if (task->refcount < 0) -		error("Negative refcount!\n"); +		error("Negative refcount!");  	task->refcount++;  } @@ -155,7 +155,7 @@ uring_task_get(struct cfg *cfg, struct uring_task *task)  void  uring_task_set_buf(struct uring_task *task, struct uring_task_buf *tbuf)  { -	debug(DBG_UR, "task %s (%p), buf %p, refcount %u\n", +	debug(DBG_UR, "task %s (%p), buf %p, refcount %u",  	      task->name, task, tbuf, task->refcount);  	if (tbuf) { @@ -174,7 +174,7 @@ uring_task_set_buf(struct uring_task *task, struct uring_task_buf *tbuf)  void  uring_task_set_fd(struct uring_task *task, int fd)  { -	debug(DBG_UR, "task %s (%p), fd %i, refcount %u\n", +	debug(DBG_UR, "task %s (%p), fd %i, refcount %u",  	      task->name, task, fd, task->refcount);  	task->fd = fd; @@ -183,7 +183,7 @@ uring_task_set_fd(struct uring_task *task, int fd)  void  uring_task_close_fd(struct cfg *cfg, struct uring_task *task)  { -	debug(DBG_UR, "task %s (%p), fd %i, refcount %u\n", +	debug(DBG_UR, "task %s (%p), fd %i, refcount %u",  	      task->name, task, task->fd, task->refcount);  	if (task->fd < 0) @@ -229,7 +229,7 @@ uring_task_init(struct uring_task *task, const char *name,  	if (task->parent) {  		debug(DBG_REF, "task %s (%p), refcount %u, " -		      "getting parent %s (%p), refcount %u\n", +		      "getting parent %s (%p), refcount %u",  		      task->name, task, task->refcount,  		      task->parent->name, task->parent, task->parent->refcount);  		uring_task_get(NULL, task->parent); @@ -241,11 +241,11 @@ uring_close(struct cfg *cfg, struct uring_task *task, int fd)  {  	struct io_uring_sqe *sqe; -	debug(DBG_UR, "task %s (%p), fd %i, refcount %u\n", +	debug(DBG_UR, "task %s (%p), fd %i, refcount %u",  	      task->name, task, task->fd, task->refcount);  	if (!task || fd < 0) { -		error("invalid parameters (task: %p (%s), fd: %i)\n", task, task->name, fd); +		error("invalid parameters (task: %p (%s), fd: %i)", task, task->name, fd);  		return;  	} @@ -262,7 +262,7 @@ uring_tbuf_write_cb(struct cfg *cfg, struct uring_task *task, int res)  	if (!task || !task->tbuf || !task->final_cb)  		die("missing parameters"); -	debug(DBG_UR, "task %s (%p), fd %i, refcount %u\n", +	debug(DBG_UR, "task %s (%p), fd %i, refcount %u",  	      task->name, task, task->fd, task->refcount);  	if (res < 0) { @@ -290,11 +290,11 @@ void  uring_tbuf_write(struct cfg *cfg, struct uring_task *task, utask_cb_t final_cb)  {  	if (!task || task->fd < 0 || !task->tbuf || task->tbuf->len < 0) { -		error("invalid parameters\n"); +		error("invalid parameters");  		return;  	} -	debug(DBG_UR, "task %s (%p), fd %i, refcount %u\n", +	debug(DBG_UR, "task %s (%p), fd %i, refcount %u",  	      task->name, task, task->fd, task->refcount);  	task->tbuf->done = 0; @@ -308,11 +308,11 @@ uring_write(struct cfg *cfg, struct uring_task *task, void *buf, size_t len, uta  	struct io_uring_sqe *sqe;  	if (task->fd < 0) { -		error("no fd set\n"); +		error("no fd set");  		return;  	} -	debug(DBG_UR, "task %s (%p), fd %i, refcount %u\n", +	debug(DBG_UR, "task %s (%p), fd %i, refcount %u",  	      task->name, task, task->fd, task->refcount);         	sqe = get_sqe(cfg, task); @@ -327,11 +327,11 @@ uring_tbuf_read_until_cb(struct cfg *cfg, struct uring_task *task, int res)  	int r;  	if (!task || !task->tbuf || !task->final_cb || !task->is_complete_cb) { -		error("invalid parameters\n"); +		error("invalid parameters");  		return;  	} -	debug(DBG_UR, "task %s (%p), fd %i, refcount %u\n", +	debug(DBG_UR, "task %s (%p), fd %i, refcount %u",  	      task->name, task, task->fd, task->refcount);  	if (res < 0) { @@ -369,11 +369,11 @@ uring_tbuf_read_until(struct cfg *cfg, struct uring_task *task,  		      rutask_cb_t is_complete_cb, utask_cb_t final_cb)  {  	if (!task || task->fd < 0 || !task->tbuf || !is_complete_cb || !final_cb) { -		error("%s: invalid parameters\n", __func__); +		error("%s: invalid parameters", __func__);  		return;  	} -	debug(DBG_UR, "task %s (%p), fd %i, refcount %u\n", +	debug(DBG_UR, "task %s (%p), fd %i, refcount %u",  	      task->name, task, task->fd, task->refcount);  	task->tbuf->len = 0; @@ -427,11 +427,11 @@ uring_read_offset(struct cfg *cfg, struct uring_task *task, void *buf, size_t le  	struct io_uring_sqe *sqe;  	if (task->fd < 0) { -		error("uring_read called with no fd set\n"); +		error("uring_read called with no fd set");  		return;  	} -	debug(DBG_UR, "task %s (%p), fd %i, refcount %u\n", +	debug(DBG_UR, "task %s (%p), fd %i, refcount %u",  	      task->name, task, task->fd, task->refcount);  	sqe = get_sqe(cfg, task); @@ -445,7 +445,7 @@ uring_openat(struct cfg *cfg, struct uring_task *task, const char *path, utask_c  {  	struct io_uring_sqe *sqe; -	debug(DBG_UR, "task %s (%p), fd %i, refcount %u\n", +	debug(DBG_UR, "task %s (%p), fd %i, refcount %u",  	      task->name, task, task->fd, task->refcount);  	sqe = get_sqe(cfg, task); @@ -460,11 +460,11 @@ uring_tbuf_recvmsg(struct cfg *cfg, struct uring_task *task, utask_cb_t cb)  	struct io_uring_sqe *sqe;  	if (!task->tbuf) { -		error("called with no tbuf set\n"); +		error("called with no tbuf set");  		return;  	} -	debug(DBG_UR, "task %s (%p), fd %i, refcount %u\n", +	debug(DBG_UR, "task %s (%p), fd %i, refcount %u",  	      task->name, task, task->fd, task->refcount);  	sqe = get_sqe(cfg, task); @@ -483,11 +483,11 @@ uring_tbuf_sendmsg(struct cfg *cfg, struct uring_task *task, utask_cb_t cb)  	struct io_uring_sqe *sqe;  	if (!task->tbuf) { -		error("%s: called with no tbuf set\n", __func__); +		error("%s: called with no tbuf set", __func__);  		return;  	} -	debug(DBG_UR, "task %s (%p), fd %i, refcount %u\n", +	debug(DBG_UR, "task %s (%p), fd %i, refcount %u",  	      task->name, task, task->fd, task->refcount);  	sqe = get_sqe(cfg, task); @@ -505,11 +505,11 @@ uring_connect(struct cfg *cfg, struct uring_task *task, struct saddr *saddr, uta  	struct io_uring_sqe *sqe;  	if (task->fd < 0) { -		error("fd set\n"); +		error("no fd set");  		return;  	} -	debug(DBG_UR, "task %s (%p), fd %i, refcount %u\n", +	debug(DBG_UR, "task %s (%p), fd %i, refcount %u",  	      task->name, task, task->fd, task->refcount);  	sqe = get_sqe(cfg, task); @@ -524,11 +524,11 @@ uring_accept(struct cfg *cfg, struct uring_task *task, struct saddr *saddr, utas  	struct io_uring_sqe *sqe;  	if (task->fd < 0) { -		error("no fd set\n"); +		error("no fd set");  		return;  	} -	debug(DBG_UR, "task %s (%p), fd %i, refcount %u\n", +	debug(DBG_UR, "task %s (%p), fd %i, refcount %u",  	      task->name, task, task->fd, task->refcount);  	sqe = get_sqe(cfg, task); @@ -544,11 +544,11 @@ uring_poll(struct cfg *cfg, struct uring_task *task, short poll_mask, utask_cb_t  	struct io_uring_sqe *sqe;  	if (task->fd < 0) { -		error("uring_poll called with no fd set\n"); +		error("uring_poll called with no fd set");  		return;  	} -	debug(DBG_UR, "task %s (%p), fd %i, refcount %u\n", +	debug(DBG_UR, "task %s (%p), fd %i, refcount %u",  	      task->name, task, task->fd, task->refcount);  	sqe = get_sqe(cfg, task); @@ -567,7 +567,7 @@ uring_poll_cancel(struct cfg *cfg, struct uring_task *task)  		return;  	} -	debug(DBG_UR, "task %s (%p), fd %i, refcount %u\n", +	debug(DBG_UR, "task %s (%p), fd %i, refcount %u",  	      task->name, task, task->fd, task->refcount);  	sqe = get_sqe(cfg, task); @@ -581,7 +581,7 @@ uring_free(struct uring_task *task)  {  	struct uring_ev *uev = container_of(task, struct uring_ev, task); -	debug(DBG_UR, "task %s (%p), fd %i, refcount %u\n", +	debug(DBG_UR, "task %s (%p), fd %i, refcount %u",  	      task->name, task, task->fd, task->refcount);  	io_uring_queue_exit(&uev->uring); @@ -600,7 +600,7 @@ uring_delete(struct cfg *cfg)  {  	struct uring_task *task = &cfg->uev->task; -	debug(DBG_UR, "task %s (%p), fd %i, refcount %u\n", +	debug(DBG_UR, "task %s (%p), fd %i, refcount %u",  	      task->name, task, task->fd, task->refcount);  	uring_task_put(cfg, task); @@ -613,12 +613,12 @@ uring_init(struct cfg *cfg)  	uev = zmalloc(sizeof(*uev));  	if (!uev) -		perrordie("malloc"); +		die("malloc: %m");  	if (io_uring_queue_init_params(4096, &uev->uring, &uev->uring_params) < 0) -		perrordie("io_uring_queue_init_params"); +		die("io_uring_queue_init_params"); -	debug(DBG_UR, "uring initialized, features: 0x%08x\n", +	debug(DBG_UR, "uring initialized, features: 0x%08x",  	      uev->uring_params.features);  	uring_task_init(&uev->task, "uev", &cfg->task, uring_free); @@ -631,7 +631,7 @@ uring_print_cqe(struct cfg *cfg, const char *type, struct uring_task *task,  		struct io_uring_cqe *cqe)  {  	debug(DBG_UR, "got CQE " -	      "(type: %s, res: %i (%s), task: %s (%p), fd: %i, cb: %p)\n", +	      "(type: %s, res: %i (%s), task: %s (%p), fd: %i, cb: %p)",  	      type,  	      cqe->res,  	      cqe->res < 0 ? strerror(-cqe->res) : "ok", @@ -655,7 +655,7 @@ uring_event_loop(struct cfg *cfg)  			if (errno == EINTR)  				continue;  			else -				perrordie("io_uring_wait_cqe"); +				die("io_uring_wait_cqe: %i", r);  		}  		nr = 0;  | 
