#include "lib/async_req/async_sock.h"
#include "lib/util/tevent_unix.h"
-struct file_pload_state {
+struct file_ploadv_state {
struct tevent_context *ev;
size_t maxsize;
int fd;
uint8_t *buf;
};
-static int file_pload_state_destructor(struct file_pload_state *s);
-static void file_pload_readable(struct tevent_req *subreq);
+static int file_ploadv_state_destructor(struct file_ploadv_state *s);
+static void file_ploadv_readable(struct tevent_req *subreq);
struct tevent_req *file_ploadv_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
char * const argl[], size_t maxsize)
{
struct tevent_req *req = NULL, *subreq = NULL;
- struct file_pload_state *state = NULL;
+ struct file_ploadv_state *state = NULL;
- req = tevent_req_create(mem_ctx, &state, struct file_pload_state);
+ req = tevent_req_create(mem_ctx, &state, struct file_ploadv_state);
if (req == NULL) {
return NULL;
}
tevent_req_error(req, errno);
return tevent_req_post(req, ev);
}
- talloc_set_destructor(state, file_pload_state_destructor);
+ talloc_set_destructor(state, file_ploadv_state_destructor);
subreq = wait_for_read_send(state, state->ev, state->fd, false);
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
}
- tevent_req_set_callback(subreq, file_pload_readable, req);
+ tevent_req_set_callback(subreq, file_ploadv_readable, req);
return req;
}
-static int file_pload_state_destructor(struct file_pload_state *s)
+static int file_ploadv_state_destructor(struct file_ploadv_state *s)
{
if (s->fd != -1) {
sys_pclose(s->fd);
return 0;
}
-static void file_pload_readable(struct tevent_req *subreq)
+static void file_ploadv_readable(struct tevent_req *subreq)
{
struct tevent_req *req = tevent_req_callback_data(
subreq, struct tevent_req);
- struct file_pload_state *state = tevent_req_data(
- req, struct file_pload_state);
+ struct file_ploadv_state *state = tevent_req_data(
+ req, struct file_ploadv_state);
uint8_t buf[1024];
uint8_t *tmp;
ssize_t nread;
if (tevent_req_nomem(subreq, req)) {
return;
}
- tevent_req_set_callback(subreq, file_pload_readable, req);
+ tevent_req_set_callback(subreq, file_ploadv_readable, req);
}
-int file_pload_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
+int file_ploadv_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
uint8_t **buf)
{
- struct file_pload_state *state = tevent_req_data(
- req, struct file_pload_state);
+ struct file_ploadv_state *state = tevent_req_data(
+ req, struct file_ploadv_state);
int err;
if (tevent_req_is_unix_error(req, &err)) {
req, struct idmap_script_xid2sid_state);
int ret;
- ret = file_pload_recv(subreq, state, &state->out);
+ ret = file_ploadv_recv(subreq, state, &state->out);
TALLOC_FREE(subreq);
if (tevent_req_error(req, ret)) {
return;
req, struct idmap_script_sid2xid_state);
int ret;
- ret = file_pload_recv(subreq, state, &state->out);
+ ret = file_ploadv_recv(subreq, state, &state->out);
TALLOC_FREE(subreq);
if (tevent_req_error(req, ret)) {
return;