this is used to allow for a composite function to complete without
going through any state transitions. When that happens the caller
has had no opportunity to fill in the async callback fields
- (ctx->async.fn and ctx->async.private) which means the usual way of
+ (ctx->async.fn and ctx->async.private_data) which means the usual way of
dealing with composite functions doesn't work. To cope with this,
we trigger a timer event that will happen then the event loop is
re-entered. This gives the caller a chance to setup the callback,
{
if (composite_nomem(new_req, ctx)) return;
new_req->async.fn = continuation;
- new_req->async.private = private_data;
+ new_req->async.private_data = private_data;
}
_PUBLIC_ void composite_continue_smb2(struct composite_context *ctx,
void *private_data)
{
transport->oplock.handler = handler;
- transport->oplock.private = private_data;
+ transport->oplock.private_data = private_data;
}
transport,
next,
idle_handler, transport);
- transport->idle.func(transport, transport->idle.private);
+ transport->idle.func(transport, transport->idle.private_data);
}
/*
void *private_data)
{
transport->idle.func = idle_func;
- transport->idle.private = private_data;
+ transport->idle.private_data = private_data;
transport->idle.period = period;
if (transport->socket->event.te != NULL) {
for a packet */
struct {
void (*func)(struct smbcli_transport *, void *);
- void *private;
+ void *private_data;
uint_t period;
} idle;
bool (*handler)(struct smbcli_transport *transport,
uint16_t tid, uint16_t fnum, uint8_t level, void *private_data);
/* private data passed to the oplock handler */
- void *private;
+ void *private_data;
} oplock;
/* a list of async requests that are pending for receive on this connection */
*/
struct {
void (*fn)(struct smbcli_request *);
- void *private;
+ void *private_data;
} async;
};
uint16_t tid = SVAL(hdr, HDR_TID);
uint16_t fnum = SVAL(vwv,VWV(2));
uint8_t level = CVAL(vwv,VWV(3)+1);
- transport->oplock.handler(transport, tid, fnum, level, transport->oplock.private);
+ transport->oplock.handler(transport, tid, fnum, level, transport->oplock.private_data);
}
return true;
/* set the handler */
state->req->async.fn = appendacl_handler;
- state->req->async.private = c;
+ state->req->async.private_data = c;
state->stage = APPENDACL_GET;
talloc_free (state->io_open);
/* call handler when done setting new security descriptor on file */
state->req->async.fn = appendacl_handler;
- state->req->async.private = c;
+ state->req->async.private_data = c;
state->stage = APPENDACL_SET;
talloc_free (state->io_fileinfo);
/* set the handler */
state->req->async.fn = appendacl_handler;
- state->req->async.private = c;
+ state->req->async.private_data = c;
state->stage = APPENDACL_GETAGAIN;
talloc_free (state->io_setfileinfo);
/* call the handler */
state->req->async.fn = appendacl_handler;
- state->req->async.private = c;
+ state->req->async.private_data = c;
state->stage = APPENDACL_CLOSEPATH;
talloc_free (state->io_fileinfo);
*/
static void appendacl_handler(struct smbcli_request *req)
{
- struct composite_context *c = (struct composite_context *)req->async.private;
+ struct composite_context *c = (struct composite_context *)req->async.private_data;
struct appendacl_state *state = talloc_get_type(c->private_data, struct appendacl_state);
/* when this handler is called, the stage indicates what
/* setup the callback handler */
state->req->async.fn = appendacl_handler;
- state->req->async.private = c;
+ state->req->async.private_data = c;
state->stage = APPENDACL_OPENPATH;
return c;
}
state->req->async.fn = request_handler;
- state->req->async.private = c;
+ state->req->async.private_data = c;
state->stage = CONNECT_TCON;
return NT_STATUS_OK;
}
state->req->async.fn = request_handler;
- state->req->async.private = c;
+ state->req->async.private_data = c;
state->stage = CONNECT_TCON;
return NT_STATUS_OK;
NT_STATUS_HAVE_NO_MEMORY(state->req);
state->req->async.fn = request_handler;
- state->req->async.private = c;
+ state->req->async.private_data = c;
state->stage = CONNECT_NEGPROT;
return NT_STATUS_OK;
NT_STATUS_HAVE_NO_MEMORY(state->req);
state->req->async.fn = request_handler;
- state->req->async.private = c;
+ state->req->async.private_data = c;
state->stage = CONNECT_SESSION_REQUEST;
return NT_STATUS_OK;
*/
static void request_handler(struct smbcli_request *req)
{
- struct composite_context *c = talloc_get_type(req->async.private,
+ struct composite_context *c = talloc_get_type(req->async.private_data,
struct composite_context);
state_handler(c);
}
state->fsinfo);
NT_STATUS_HAVE_NO_MEMORY(state->req);
- state->req->async.private = c;
+ state->req->async.private_data = c;
state->req->async.fn = fsinfo_raw_handler;
state->stage = FSINFO_QUERY;
*/
static void fsinfo_raw_handler(struct smbcli_request *req)
{
- struct composite_context *c = talloc_get_type(req->async.private,
+ struct composite_context *c = talloc_get_type(req->async.private_data,
struct composite_context);
fsinfo_state_handler(c);
}
/* call the handler again when the close is done */
state->req->async.fn = loadfile_handler;
- state->req->async.private = c;
+ state->req->async.private_data = c;
state->stage = LOADFILE_CLOSE;
return NT_STATUS_OK;
/* call the handler again when the first read is done */
state->req->async.fn = loadfile_handler;
- state->req->async.private = c;
+ state->req->async.private_data = c;
state->stage = LOADFILE_READ;
talloc_free(state->io_open);
/* call the handler again when the read is done */
state->req->async.fn = loadfile_handler;
- state->req->async.private = c;
+ state->req->async.private_data = c;
return NT_STATUS_OK;
}
*/
static void loadfile_handler(struct smbcli_request *req)
{
- struct composite_context *c = (struct composite_context *)req->async.private;
+ struct composite_context *c = (struct composite_context *)req->async.private_data;
struct loadfile_state *state = talloc_get_type(c->private_data, struct loadfile_state);
/* when this handler is called, the stage indicates what
/* setup the callback handler */
state->req->async.fn = loadfile_handler;
- state->req->async.private = c;
+ state->req->async.private_data = c;
state->stage = LOADFILE_OPEN;
return c;
/* call the handler again when the close is done */
state->stage = SAVEFILE_CLOSE;
state->req->async.fn = savefile_handler;
- state->req->async.private = c;
+ state->req->async.private_data = c;
return NT_STATUS_OK;
}
/* call the handler again when the first write is done */
state->stage = SAVEFILE_WRITE;
state->req->async.fn = savefile_handler;
- state->req->async.private = c;
+ state->req->async.private_data = c;
talloc_free(state->io_open);
return NT_STATUS_OK;
/* call the handler again when the write is done */
state->req->async.fn = savefile_handler;
- state->req->async.private = c;
+ state->req->async.private_data = c;
return NT_STATUS_OK;
}
*/
static void savefile_handler(struct smbcli_request *req)
{
- struct composite_context *c = (struct composite_context *)req->async.private;
+ struct composite_context *c = (struct composite_context *)req->async.private_data;
struct savefile_state *state = talloc_get_type(c->private_data, struct savefile_state);
/* when this handler is called, the stage indicates what
/* setup the callback handler */
state->req->async.fn = savefile_handler;
- state->req->async.private = c;
+ state->req->async.private_data = c;
c->private_data = state;
return c;
*/
static void request_handler(struct smbcli_request *req)
{
- struct composite_context *c = (struct composite_context *)req->async.private;
+ struct composite_context *c = (struct composite_context *)req->async.private_data;
struct sesssetup_state *state = talloc_get_type(c->private_data, struct sesssetup_state);
struct smbcli_session *session = req->session;
DATA_BLOB session_key = data_blob(NULL, 0);
uint16_t frag_length;
NTSTATUS status;
- state = talloc_get_type(req->async.private, struct smb_read_state);
+ state = talloc_get_type(req->async.private_data, struct smb_read_state);
smb = talloc_get_type(state->c->transport.private_data, struct smb_private);
io = state->io;
}
state->req->async.fn = smb_read_callback;
- state->req->async.private = state;
+ state->req->async.private_data = state;
}
/*
}
req->async.fn = smb_read_callback;
- req->async.private = state;
+ req->async.private_data = state;
state->req = req;
*/
static void smb_trans_callback(struct smbcli_request *req)
{
- struct smb_trans_state *state = (struct smb_trans_state *)req->async.private;
+ struct smb_trans_state *state = (struct smb_trans_state *)req->async.private_data;
struct dcerpc_connection *c = state->c;
NTSTATUS status;
}
state->req->async.fn = smb_trans_callback;
- state->req->async.private = state;
+ state->req->async.private_data = state;
talloc_steal(state, state->req);
*/
static void smb_write_callback(struct smbcli_request *req)
{
- struct dcerpc_connection *c = (struct dcerpc_connection *)req->async.private;
+ struct dcerpc_connection *c = (struct dcerpc_connection *)req->async.private_data;
if (!NT_STATUS_IS_OK(req->status)) {
DEBUG(0,("dcerpc_smb: write callback error\n"));
}
req->async.fn = smb_write_callback;
- req->async.private = c;
+ req->async.private_data = c;
if (trigger_read) {
send_read_request(c);
static void pipe_open_recv(struct smbcli_request *req)
{
- struct pipe_open_smb_state *state = talloc_get_type(req->async.private,
+ struct pipe_open_smb_state *state = talloc_get_type(req->async.private_data,
struct pipe_open_smb_state);
struct composite_context *ctx = state->ctx;
struct dcerpc_connection *c = state->c;
*/
static void async_simple(struct smbcli_request *c_req)
{
- struct async_info *async = c_req->async.private;
+ struct async_info *async = c_req->async.private_data;
struct ntvfs_request *req = async->req;
req->async_states->status = smbcli_request_simple_recv(c_req);
talloc_free(async);
async->cvfs = p; \
async->c_req = c_req; \
DLIST_ADD(p->pending, async); \
- c_req->async.private = async; \
+ c_req->async.private_data = async; \
talloc_set_destructor(async, async_info_destructor); \
} \
c_req->async.fn = async_fn; \
*/
static void async_ioctl(struct smbcli_request *c_req)
{
- struct async_info *async = c_req->async.private;
+ struct async_info *async = c_req->async.private_data;
struct ntvfs_request *req = async->req;
req->async_states->status = smb_raw_ioctl_recv(c_req, req, async->parms);
talloc_free(async);
*/
static void async_qpathinfo(struct smbcli_request *c_req)
{
- struct async_info *async = c_req->async.private;
+ struct async_info *async = c_req->async.private_data;
struct ntvfs_request *req = async->req;
req->async_states->status = smb_raw_pathinfo_recv(c_req, req, async->parms);
talloc_free(async);
*/
static void async_qfileinfo(struct smbcli_request *c_req)
{
- struct async_info *async = c_req->async.private;
+ struct async_info *async = c_req->async.private_data;
struct ntvfs_request *req = async->req;
req->async_states->status = smb_raw_fileinfo_recv(c_req, req, async->parms);
talloc_free(async);
*/
static void async_open(struct smbcli_request *c_req)
{
- struct async_info *async = c_req->async.private;
+ struct async_info *async = c_req->async.private_data;
struct cvfs_private *cvfs = async->cvfs;
struct ntvfs_request *req = async->req;
struct cvfs_file *f = async->f;
*/
static void async_read(struct smbcli_request *c_req)
{
- struct async_info *async = c_req->async.private;
+ struct async_info *async = c_req->async.private_data;
struct ntvfs_request *req = async->req;
req->async_states->status = smb_raw_read_recv(c_req, async->parms);
talloc_free(async);
*/
static void async_write(struct smbcli_request *c_req)
{
- struct async_info *async = c_req->async.private;
+ struct async_info *async = c_req->async.private_data;
struct ntvfs_request *req = async->req;
req->async_states->status = smb_raw_write_recv(c_req, async->parms);
talloc_free(async);
*/
static void async_seek(struct smbcli_request *c_req)
{
- struct async_info *async = c_req->async.private;
+ struct async_info *async = c_req->async.private_data;
struct ntvfs_request *req = async->req;
req->async_states->status = smb_raw_seek_recv(c_req, async->parms);
talloc_free(async);
*/
static void async_fsinfo(struct smbcli_request *c_req)
{
- struct async_info *async = c_req->async.private;
+ struct async_info *async = c_req->async.private_data;
struct ntvfs_request *req = async->req;
req->async_states->status = smb_raw_fsinfo_recv(c_req, req, async->parms);
talloc_free(async);
*/
static void async_trans2(struct smbcli_request *c_req)
{
- struct async_info *async = c_req->async.private;
+ struct async_info *async = c_req->async.private_data;
struct ntvfs_request *req = async->req;
req->async_states->status = smb_raw_trans2_recv(c_req, req, async->parms);
talloc_free(async);
*/
static void async_changenotify(struct smbcli_request *c_req)
{
- struct async_info *async = c_req->async.private;
+ struct async_info *async = c_req->async.private_data;
struct ntvfs_request *req = async->req;
req->async_states->status = smb_raw_changenotify_recv(c_req, req, async->parms);
talloc_free(async);
NT_STATUS_HAVE_NO_MEMORY(req);
/*register the callback function!*/
req->async.fn = benchrw_callback;
- req->async.private = state;
+ req->async.private_data = state;
return NT_STATUS_OK;
}
static void benchrw_rw_callback(struct smbcli_request *req)
{
- struct benchrw_state *state = req->async.private;
+ struct benchrw_state *state = req->async.private_data;
struct torture_context *tctx = state->tctx;
if (!NT_STATUS_IS_OK(req->status)) {
NT_STATUS_HAVE_NO_MEMORY(req);
/*register the callback function!*/
req->async.fn = benchrw_rw_callback;
- req->async.private = state;
+ req->async.private_data = state;
return NT_STATUS_OK;
}
/*register the callback function!*/
req->async.fn = benchrw_callback;
- req->async.private = state;
+ req->async.private_data = state;
return NT_STATUS_OK;
}
/*register the callback function!*/
req->async.fn = benchrw_callback;
- req->async.private = state;
+ req->async.private_data = state;
return NT_STATUS_OK;
}
*/
static void benchrw_callback(struct smbcli_request *req)
{
- struct benchrw_state *state = req->async.private;
+ struct benchrw_state *state = req->async.private_data;
struct torture_context *tctx = state->tctx;
/*dont send new requests when torture_numops is reached*/
req = smb_raw_mkdir_send(state[i]->cli,&parms);
/* register callback fn + private data */
req->async.fn = benchrw_callback;
- req->async.private=state[i];
+ req->async.private_data=state[i];
break;
/* error occured , finish */
case ERROR:
}
req->async.fn = oplock_handler_close_recv_smb;
- req->async.private = NULL;
+ req->async.private_data = NULL;
return true;
}
DEBUG(0,("Failed to setup lock\n"));
lock_failed++;
}
- state->req->async.private = state;
+ state->req->async.private_data = state;
state->req->async.fn = lock_completion;
}
*/
static void lock_completion(struct smbcli_request *req)
{
- struct benchlock_state *state = (struct benchlock_state *)req->async.private;
+ struct benchlock_state *state = (struct benchlock_state *)req->async.private_data;
NTSTATUS status = smbcli_request_simple_recv(req);
state->req = NULL;
if (!NT_STATUS_IS_OK(status)) {
static void echo_completion(struct smbcli_request *req)
{
- struct benchlock_state *state = (struct benchlock_state *)req->async.private;
+ struct benchlock_state *state = (struct benchlock_state *)req->async.private_data;
NTSTATUS status = smbcli_request_simple_recv(req);
if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE) ||
NT_STATUS_EQUAL(status, NT_STATUS_LOCAL_DISCONNECT)) {
p.in.size = 0;
p.in.data = NULL;
req = smb_raw_echo_send(state[i].tree->session->transport, &p);
- req->async.private = &state[i];
+ req->async.private_data = &state[i];
req->async.fn = echo_completion;
}
}
*/
static void setoffline_callback(struct smbcli_request *req)
{
- struct offline_state *state = req->async.private;
+ struct offline_state *state = req->async.private_data;
NTSTATUS status;
status = smbcli_request_simple_recv(req);
*/
static void getoffline_callback(struct smbcli_request *req)
{
- struct offline_state *state = req->async.private;
+ struct offline_state *state = req->async.private_data;
NTSTATUS status;
union smb_fileinfo io;
}
state->req->async.fn = setoffline_callback;
- state->req->async.private = state;
+ state->req->async.private_data = state;
break;
}
}
state->req->async.fn = getoffline_callback;
- state->req->async.private = state;
+ state->req->async.private_data = state;
break;
}
static void echo_completion(struct smbcli_request *req)
{
- struct offline_state *state = (struct offline_state *)req->async.private;
+ struct offline_state *state = (struct offline_state *)req->async.private_data;
NTSTATUS status = smbcli_request_simple_recv(req);
if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE) ||
NT_STATUS_EQUAL(status, NT_STATUS_LOCAL_DISCONNECT)) {
p.in.size = 0;
p.in.data = NULL;
req = smb_raw_echo_send(state[i].tree->session->transport, &p);
- req->async.private = &state[i];
+ req->async.private_data = &state[i];
req->async.fn = echo_completion;
}
}
state->req_open = smb_raw_open_send(state->tree, &state->open_parms);
state->req_open->async.fn = open_completed;
- state->req_open->async.private = state;
+ state->req_open->async.private_data = state;
}
state->req_close = smb_raw_close_send(state->tree, &state->close_parms);
state->req_close->async.fn = close_completed;
- state->req_close->async.private = state;
+ state->req_close->async.private_data = state;
}
/*
*/
static void open_completed(struct smbcli_request *req)
{
- struct benchopen_state *state = (struct benchopen_state *)req->async.private;
+ struct benchopen_state *state = (struct benchopen_state *)req->async.private_data;
TALLOC_CTX *tmp_ctx = talloc_new(state->mem_ctx);
NTSTATUS status;
state->open_retries++;
state->req_open = smb_raw_open_send(state->tree, &state->open_parms);
state->req_open->async.fn = open_completed;
- state->req_open->async.private = state;
+ state->req_open->async.private_data = state;
return;
}
*/
static void close_completed(struct smbcli_request *req)
{
- struct benchopen_state *state = (struct benchopen_state *)req->async.private;
+ struct benchopen_state *state = (struct benchopen_state *)req->async.private_data;
NTSTATUS status = smbcli_request_simple_recv(req);
state->req_close = NULL;
static void echo_completion(struct smbcli_request *req)
{
- struct benchopen_state *state = (struct benchopen_state *)req->async.private;
+ struct benchopen_state *state = (struct benchopen_state *)req->async.private_data;
NTSTATUS status = smbcli_request_simple_recv(req);
if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE) ||
NT_STATUS_EQUAL(status, NT_STATUS_LOCAL_DISCONNECT)) {
p.in.size = 0;
p.in.data = NULL;
req = smb_raw_echo_send(state[i].tree->session->transport, &p);
- req->async.private = &state[i];
+ req->async.private_data = &state[i];
req->async.fn = echo_completion;
}
}
}
req->async.fn = oplock_handler_close_recv;
- req->async.private = NULL;
+ req->async.private_data = NULL;
return true;
}