From 971d30bb201f5c3faff5f575d26882eb79f7955a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 24 May 2006 07:34:11 +0000 Subject: r15854: more talloc_set_destructor() typesafe fixes (This used to be commit 61c6100617589ac6df4f527877241464cacbf8b3) --- source4/lib/events/events_liboop.c | 14 ++++++-------- source4/lib/events/events_standard.c | 12 ++++-------- source4/lib/ldb/ldb_ldap/ldb_ldap.c | 3 +-- source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c | 7 ++----- source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c | 3 +-- source4/lib/ldb/modules/paged_results.c | 4 +--- source4/lib/ldb/modules/skel.c | 3 +-- source4/lib/messaging/messaging.c | 6 ++---- source4/lib/registry/reg_backend_ldb.c | 6 ++---- source4/lib/socket/socket.c | 3 +-- source4/lib/stream/packet.c | 4 +--- source4/lib/tls/tls.c | 3 +-- source4/lib/util/unix_privs.c | 3 +-- source4/libcli/cldap/cldap.c | 3 +-- source4/libcli/dgram/mailslot.c | 5 +---- source4/libcli/ldap/ldap_client.c | 3 +-- source4/libcli/nbt/nbtsocket.c | 6 ++---- source4/libcli/raw/clitransport.c | 7 ++----- source4/libcli/resolve/host.c | 3 +-- source4/libcli/smb2/transport.c | 6 ++---- source4/libcli/wrepl/winsrepl.c | 9 +++------ source4/librpc/rpc/dcerpc.c | 6 ++---- source4/ntvfs/cifs/vfs_cifs.c | 3 +-- source4/ntvfs/common/notify.c | 3 +-- source4/ntvfs/common/opendb.c | 3 +-- source4/ntvfs/ipc/vfs_ipc.c | 3 +-- source4/ntvfs/posix/pvfs_dirlist.c | 3 +-- source4/ntvfs/posix/pvfs_notify.c | 3 +-- source4/ntvfs/posix/pvfs_open.c | 17 +++++------------ 29 files changed, 50 insertions(+), 104 deletions(-) diff --git a/source4/lib/events/events_liboop.c b/source4/lib/events/events_liboop.c index c81449e65e..53238662f0 100644 --- a/source4/lib/events/events_liboop.c +++ b/source4/lib/events/events_liboop.c @@ -35,9 +35,8 @@ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ -static int oop_event_context_destructor(void *ptr) +static int oop_event_context_destructor(struct event_context *ev) { - struct event_context *ev = talloc_get_type(ptr, struct event_context); oop_source_sys *oop_sys = ev->additional_data; oop_sys_delete(oop_sys); @@ -91,9 +90,8 @@ static void *oop_event_fd_handler(oop_source *oop, int fd, oop_event oop_type, v /* destroy an fd_event */ -static int oop_event_fd_destructor(void *ptr) +static int oop_event_fd_destructor(struct fd_event *fde) { - struct fd_event *fde = talloc_get_type(ptr, struct fd_event); struct event_context *ev = fde->event_ctx; oop_source_sys *oop_sys = ev->additional_data; oop_source *oop = oop_sys_source(oop_sys); @@ -174,8 +172,9 @@ static void oop_event_set_fd_flags(struct fd_event *fde, uint16_t flags) fde->flags = flags; } -static int oop_event_timed_destructor(void *ptr); -static int oop_event_timed_deny_destructor(void *ptr) +static int oop_event_timed_destructor(struct timed_event *te); + +static int oop_event_timed_deny_destructor(struct timed_event *te) { return -1; } @@ -197,9 +196,8 @@ static void *oop_event_timed_handler(oop_source *oop, struct timeval t, void *pt /* destroy a timed event */ -static int oop_event_timed_destructor(void *ptr) +static int oop_event_timed_destructor(struct timed_event *te) { - struct timed_event *te = talloc_get_type(ptr, struct timed_event); struct event_context *ev = te->event_ctx; oop_source_sys *oop_sys = ev->additional_data; oop_source *oop = oop_sys_source(oop_sys); diff --git a/source4/lib/events/events_standard.c b/source4/lib/events/events_standard.c index ff11afe5d5..5d59f1b885 100644 --- a/source4/lib/events/events_standard.c +++ b/source4/lib/events/events_standard.c @@ -93,10 +93,8 @@ static uint32_t epoll_map_flags(uint16_t flags) /* free the epoll fd */ -static int epoll_ctx_destructor(void *ptr) +static int epoll_ctx_destructor(struct std_event_context *std_ev) { - struct std_event_context *std_ev = talloc_get_type(ptr, - struct std_event_context); close(std_ev->epoll_fd); std_ev->epoll_fd = -1; return 0; @@ -336,9 +334,8 @@ static void calc_maxfd(struct std_event_context *std_ev) /* destroy an fd_event */ -static int std_event_fd_destructor(void *ptr) +static int std_event_fd_destructor(struct fd_event *fde) { - struct fd_event *fde = talloc_get_type(ptr, struct fd_event); struct event_context *ev = fde->event_ctx; struct std_event_context *std_ev = talloc_get_type(ev->additional_data, struct std_event_context); @@ -420,16 +417,15 @@ static void std_event_set_fd_flags(struct fd_event *fde, uint16_t flags) /* destroy a timed event */ -static int std_event_timed_destructor(void *ptr) +static int std_event_timed_destructor(struct timed_event *te) { - struct timed_event *te = talloc_get_type(ptr, struct timed_event); struct std_event_context *std_ev = talloc_get_type(te->event_ctx->additional_data, struct std_event_context); DLIST_REMOVE(std_ev->timed_events, te); return 0; } -static int std_event_timed_deny_destructor(void *ptr) +static int std_event_timed_deny_destructor(struct timed_event *te) { return -1; } diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c index 8bfff117da..bbfb1de104 100644 --- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c +++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c @@ -1042,9 +1042,8 @@ static const struct ldb_module_ops lldb_ops = { }; -static int lldb_destructor(void *p) +static int lldb_destructor(struct lldb_private *lldb) { - struct lldb_private *lldb = p; ldap_unbind(lldb->ldap); return 0; } diff --git a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c index bcb830c38d..06b76e812d 100644 --- a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c +++ b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c @@ -1963,11 +1963,8 @@ failed: return -1; } -static int -destructor(void *p) -{ - struct lsqlite3_private *lsqlite3 = p; - +static int destructor(struct lsqlite3_private *lsqlite3) +{ if (lsqlite3->sqlite) { sqlite3_close(lsqlite3->sqlite); } diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c b/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c index d4fc67c2d4..fdce36b24c 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c @@ -43,9 +43,8 @@ struct ltdb_wrap { static struct ltdb_wrap *tdb_list; /* destroy the last connection to a tdb */ -static int ltdb_wrap_destructor(void *ctx) +static int ltdb_wrap_destructor(struct ltdb_wrap *w) { - struct ltdb_wrap *w = talloc_get_type(ctx, struct ltdb_wrap); tdb_close(w->tdb); if (w->next) { w->next->prev = w->prev; diff --git a/source4/lib/ldb/modules/paged_results.c b/source4/lib/ldb/modules/paged_results.c index 5ce062868e..1b002716a5 100644 --- a/source4/lib/ldb/modules/paged_results.c +++ b/source4/lib/ldb/modules/paged_results.c @@ -71,10 +71,8 @@ struct private_data { }; -int store_destructor(void *data) +int store_destructor(struct results_store *store) { - struct results_store *store = talloc_get_type(data, struct results_store); - if (store->prev) { store->prev->next = store->next; } diff --git a/source4/lib/ldb/modules/skel.c b/source4/lib/ldb/modules/skel.c index 0089433b37..2f3c2e8b57 100644 --- a/source4/lib/ldb/modules/skel.c +++ b/source4/lib/ldb/modules/skel.c @@ -87,9 +87,8 @@ static int skel_del_trans(struct ldb_module *module) return ldb_next_del_trans(module); } -static int skel_destructor(void *module_ctx) +static int skel_destructor(struct ldb_module *ctx) { - struct ldb_module *ctx = talloc_get_type(module_ctx, struct ldb_module); struct private_data *data = talloc_get_type(ctx->private_data, struct private_data); /* put your clean-up functions here */ if (data->some_private_data) talloc_free(data->some_private_data); diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index bf06d68a33..6bd331c247 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -434,9 +434,8 @@ NTSTATUS messaging_send_ptr(struct messaging_context *msg, uint32_t server, /* destroy the messaging context */ -static int messaging_destructor(void *ptr) +static int messaging_destructor(struct messaging_context *msg) { - struct messaging_context *msg = ptr; unlink(msg->path); while (msg->names && msg->names[0]) { irpc_remove_name(msg, msg->names[0]); @@ -720,9 +719,8 @@ failed: /* destroy a irpc request */ -static int irpc_destructor(void *ptr) +static int irpc_destructor(struct irpc_request *irpc) { - struct irpc_request *irpc = talloc_get_type(ptr, struct irpc_request); idr_remove(irpc->msg_ctx->idr, irpc->callid); return 0; } diff --git a/source4/lib/registry/reg_backend_ldb.c b/source4/lib/registry/reg_backend_ldb.c index ec185cd65b..a8c054cc16 100644 --- a/source4/lib/registry/reg_backend_ldb.c +++ b/source4/lib/registry/reg_backend_ldb.c @@ -32,9 +32,8 @@ struct ldb_key_data int subkey_count, value_count; }; -static int ldb_free_hive (void *_hive) +static int ldb_free_hive (struct registry_hive *hive) { - struct registry_hive *hive = _hive; talloc_free(hive->backend_data); hive->backend_data = NULL; return 0; @@ -96,9 +95,8 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx, TALLOC_CT } -static int reg_close_ldb_key (void *data) +static int reg_close_ldb_key(struct registry_key *key) { - struct registry_key *key = data; struct ldb_key_data *kd = talloc_get_type(key->backend_data, struct ldb_key_data); /* struct ldb_context *c = key->hive->backend_data; */ diff --git a/source4/lib/socket/socket.c b/source4/lib/socket/socket.c index b7d4431c94..e1f8bb4d86 100644 --- a/source4/lib/socket/socket.c +++ b/source4/lib/socket/socket.c @@ -28,9 +28,8 @@ /* auto-close sockets on free */ -static int socket_destructor(void *ptr) +static int socket_destructor(struct socket_context *sock) { - struct socket_context *sock = ptr; if (sock->ops->fn_close) { sock->ops->fn_close(sock); } diff --git a/source4/lib/stream/packet.c b/source4/lib/stream/packet.c index 1da7f5706b..e06f4985ef 100644 --- a/source4/lib/stream/packet.c +++ b/source4/lib/stream/packet.c @@ -60,10 +60,8 @@ struct packet_context { a destructor used when we are processing packets to prevent freeing of this context while it is being used */ -static int packet_destructor(void *p) +static int packet_destructor(struct packet_context *pc) { - struct packet_context *pc = talloc_get_type(p, struct packet_context); - if (pc->busy) { pc->destructor_called = True; /* now we refuse the talloc_free() request. The free will diff --git a/source4/lib/tls/tls.c b/source4/lib/tls/tls.c index 2872669948..936c18c0c6 100644 --- a/source4/lib/tls/tls.c +++ b/source4/lib/tls/tls.c @@ -175,9 +175,8 @@ static ssize_t tls_push(gnutls_transport_ptr ptr, const void *buf, size_t size) /* destroy a tls session */ -static int tls_destructor(void *ptr) +static int tls_destructor(struct tls_context *tls) { - struct tls_context *tls = talloc_get_type(ptr, struct tls_context); int ret; ret = gnutls_bye(tls->session, GNUTLS_SHUT_WR); if (ret < 0) { diff --git a/source4/lib/util/unix_privs.c b/source4/lib/util/unix_privs.c index c94cf619a3..bf3e61ba2d 100644 --- a/source4/lib/util/unix_privs.c +++ b/source4/lib/util/unix_privs.c @@ -49,9 +49,8 @@ struct saved_state { uid_t uid; }; -static int privileges_destructor(void *ptr) +static int privileges_destructor(struct saved_state *s) { - struct saved_state *s = ptr; if (geteuid() != s->uid && seteuid(s->uid) != 0) { smb_panic("Failed to restore privileges"); diff --git a/source4/libcli/cldap/cldap.c b/source4/libcli/cldap/cldap.c index 58beb1b642..03e690ef18 100644 --- a/source4/libcli/cldap/cldap.c +++ b/source4/libcli/cldap/cldap.c @@ -44,9 +44,8 @@ /* destroy a pending request */ -static int cldap_request_destructor(void *ptr) +static int cldap_request_destructor(struct cldap_request *req) { - struct cldap_request *req = talloc_get_type(ptr, struct cldap_request); if (req->state == CLDAP_REQUEST_SEND) { DLIST_REMOVE(req->cldap->send_queue, req); } diff --git a/source4/libcli/dgram/mailslot.c b/source4/libcli/dgram/mailslot.c index 467289bcee..775f662370 100644 --- a/source4/libcli/dgram/mailslot.c +++ b/source4/libcli/dgram/mailslot.c @@ -41,11 +41,8 @@ /* destroy a mailslot handler */ -static int dgram_mailslot_destructor(void *ptr) +static int dgram_mailslot_destructor(struct dgram_mailslot_handler *dgmslot) { - struct dgram_mailslot_handler *dgmslot = - talloc_get_type(ptr, struct dgram_mailslot_handler); - DLIST_REMOVE(dgmslot->dgmsock->mailslot_handlers, dgmslot); return 0; } diff --git a/source4/libcli/ldap/ldap_client.c b/source4/libcli/ldap/ldap_client.c index 8d815c7103..07b7f2b412 100644 --- a/source4/libcli/ldap/ldap_client.c +++ b/source4/libcli/ldap/ldap_client.c @@ -487,9 +487,8 @@ static void ldap_reconnect(struct ldap_connection *conn) } /* destroy an open ldap request */ -static int ldap_request_destructor(void *ptr) +static int ldap_request_destructor(struct ldap_request *req) { - struct ldap_request *req = talloc_get_type(ptr, struct ldap_request); if (req->state == LDAP_REQUEST_PENDING) { DLIST_REMOVE(req->conn->pending, req); } diff --git a/source4/libcli/nbt/nbtsocket.c b/source4/libcli/nbt/nbtsocket.c index 50da8168e0..7bdeb834f9 100644 --- a/source4/libcli/nbt/nbtsocket.c +++ b/source4/libcli/nbt/nbtsocket.c @@ -32,10 +32,8 @@ /* destroy a pending request */ -static int nbt_name_request_destructor(void *ptr) -{ - struct nbt_name_request *req = talloc_get_type(ptr, struct nbt_name_request); - +static int nbt_name_request_destructor(struct nbt_name_request *req) +{ if (req->state == NBT_REQUEST_SEND) { DLIST_REMOVE(req->nbtsock->send_queue, req); } diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c index 2ad155e9b9..fc257b9098 100644 --- a/source4/libcli/raw/clitransport.c +++ b/source4/libcli/raw/clitransport.c @@ -50,10 +50,8 @@ static void smbcli_transport_event_handler(struct event_context *ev, /* destroy a transport */ -static int transport_destructor(void *ptr) +static int transport_destructor(struct smbcli_transport *transport) { - struct smbcli_transport *transport = ptr; - smbcli_transport_dead(transport); return 0; } @@ -538,9 +536,8 @@ static void smbcli_timeout_handler(struct event_context *ev, struct timed_event /* destroy a request */ -static int smbcli_request_destructor(void *ptr) +static int smbcli_request_destructor(struct smbcli_request *req) { - struct smbcli_request *req = talloc_get_type(ptr, struct smbcli_request); if (req->state == SMBCLI_REQUEST_RECV) { DLIST_REMOVE(req->transport->pending_recv, req); } diff --git a/source4/libcli/resolve/host.c b/source4/libcli/resolve/host.c index 781ea957df..18188f7c1c 100644 --- a/source4/libcli/resolve/host.c +++ b/source4/libcli/resolve/host.c @@ -51,9 +51,8 @@ struct host_state { name resolution without leaving a potentially blocking call running in a child */ -static int host_destructor(void *ptr) +static int host_destructor(struct host_state *state) { - struct host_state *state = talloc_get_type(ptr, struct host_state); close(state->child_fd); if (state->child != (pid_t)-1) { kill(state->child, SIGTERM); diff --git a/source4/libcli/smb2/transport.c b/source4/libcli/smb2/transport.c index 6567ad4de7..9b6a39171d 100644 --- a/source4/libcli/smb2/transport.c +++ b/source4/libcli/smb2/transport.c @@ -51,9 +51,8 @@ static void smb2_transport_event_handler(struct event_context *ev, /* destroy a transport */ -static int transport_destructor(void *ptr) +static int transport_destructor(struct smb2_transport *transport) { - struct smb2_transport *transport = ptr; smb2_transport_dead(transport); return 0; } @@ -254,9 +253,8 @@ static void smb2_timeout_handler(struct event_context *ev, struct timed_event *t /* destroy a request */ -static int smb2_request_destructor(void *ptr) +static int smb2_request_destructor(struct smb2_request *req) { - struct smb2_request *req = talloc_get_type(ptr, struct smb2_request); if (req->state == SMB2_REQUEST_RECV) { DLIST_REMOVE(req->transport->pending_recv, req); } diff --git a/source4/libcli/wrepl/winsrepl.c b/source4/libcli/wrepl/winsrepl.c index c37d5f9873..a1735c547c 100644 --- a/source4/libcli/wrepl/winsrepl.c +++ b/source4/libcli/wrepl/winsrepl.c @@ -144,9 +144,8 @@ static void wrepl_error(void *private, NTSTATUS status) /* destroy a wrepl_socket destructor */ -static int wrepl_socket_destructor(void *ptr) +static int wrepl_socket_destructor(struct wrepl_socket *sock) { - struct wrepl_socket *sock = talloc_get_type(ptr, struct wrepl_socket); if (sock->dead) { sock->free_skipped = True; return -1; @@ -244,9 +243,8 @@ failed: /* destroy a wrepl_request */ -static int wrepl_request_destructor(void *ptr) +static int wrepl_request_destructor(struct wrepl_request *req) { - struct wrepl_request *req = talloc_get_type(ptr, struct wrepl_request); if (req->state == WREPL_REQUEST_RECV) { DLIST_REMOVE(req->wrepl_socket->recv_queue, req); } @@ -431,9 +429,8 @@ struct wrepl_send_ctrl_state { struct wrepl_socket *wrepl_sock; }; -static int wrepl_send_ctrl_destructor(void *ptr) +static int wrepl_send_ctrl_destructor(struct wrepl_send_ctrl_state *s) { - struct wrepl_send_ctrl_state *s = talloc_get_type(ptr, struct wrepl_send_ctrl_state); struct wrepl_request *req = s->wrepl_sock->recv_queue; /* check if the request is still in WREPL_STATE_RECV, diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index a1ce11c749..70c60b100a 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -40,9 +40,8 @@ NTSTATUS dcerpc_init(void) static void dcerpc_ship_next_request(struct dcerpc_connection *c); /* destroy a dcerpc connection */ -static int dcerpc_connection_destructor(void *ptr) +static int dcerpc_connection_destructor(struct dcerpc_connection *c) { - struct dcerpc_connection *c = ptr; if (c->transport.shutdown_pipe) { c->transport.shutdown_pipe(c); } @@ -918,9 +917,8 @@ req_done: /* make sure requests are cleaned up */ -static int dcerpc_req_destructor(void *ptr) +static int dcerpc_req_destructor(struct rpc_request *req) { - struct rpc_request *req = ptr; DLIST_REMOVE(req->p->conn->pending, req); return 0; } diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c index 2b4f9bb8c5..47b89ff662 100644 --- a/source4/ntvfs/cifs/vfs_cifs.c +++ b/source4/ntvfs/cifs/vfs_cifs.c @@ -237,9 +237,8 @@ static NTSTATUS cvfs_disconnect(struct ntvfs_module_context *ntvfs) /* destroy an async info structure */ -static int async_info_destructor(void *p) +static int async_info_destructor(struct async_info *async) { - struct async_info *async = talloc_get_type(p, struct async_info); DLIST_REMOVE(async->cvfs->pending, async); return 0; } diff --git a/source4/ntvfs/common/notify.c b/source4/ntvfs/common/notify.c index 57cbce3863..222bd7a927 100644 --- a/source4/ntvfs/common/notify.c +++ b/source4/ntvfs/common/notify.c @@ -63,9 +63,8 @@ static void notify_handler(struct messaging_context *msg_ctx, void *private, /* destroy the notify context */ -static int notify_destructor(void *p) +static int notify_destructor(struct notify_context *notify) { - struct notify_context *notify = talloc_get_type(p, struct notify_context); messaging_deregister(notify->messaging_ctx, MSG_PVFS_NOTIFY, notify); notify_remove_all(notify); return 0; diff --git a/source4/ntvfs/common/opendb.c b/source4/ntvfs/common/opendb.c index 395e6c6dbf..d83ecdc6f2 100644 --- a/source4/ntvfs/common/opendb.c +++ b/source4/ntvfs/common/opendb.c @@ -100,9 +100,8 @@ _PUBLIC_ struct odb_context *odb_init(TALLOC_CTX *mem_ctx, /* destroy a lock on the database */ -static int odb_lock_destructor(void *ptr) +static int odb_lock_destructor(struct odb_lock *lck) { - struct odb_lock *lck = ptr; tdb_chainunlock(lck->odb->w->tdb, lck->key); return 0; } diff --git a/source4/ntvfs/ipc/vfs_ipc.c b/source4/ntvfs/ipc/vfs_ipc.c index 2e7c538c3f..03e026e423 100644 --- a/source4/ntvfs/ipc/vfs_ipc.c +++ b/source4/ntvfs/ipc/vfs_ipc.c @@ -174,9 +174,8 @@ static NTSTATUS ipc_setpathinfo(struct ntvfs_module_context *ntvfs, /* destroy a open pipe structure */ -static int ipc_fd_destructor(void *ptr) +static int ipc_fd_destructor(struct pipe_state *p) { - struct pipe_state *p = ptr; DLIST_REMOVE(p->private->pipe_list, p); return 0; } diff --git a/source4/ntvfs/posix/pvfs_dirlist.c b/source4/ntvfs/posix/pvfs_dirlist.c index 517f5b68d0..c351f6ba41 100644 --- a/source4/ntvfs/posix/pvfs_dirlist.c +++ b/source4/ntvfs/posix/pvfs_dirlist.c @@ -84,9 +84,8 @@ static NTSTATUS pvfs_list_no_wildcard(struct pvfs_state *pvfs, struct pvfs_filen /* destroy an open search */ -static int pvfs_dirlist_destructor(void *ptr) +static int pvfs_dirlist_destructor(struct pvfs_dir *dir) { - struct pvfs_dir *dir = ptr; if (dir->dir) closedir(dir->dir); return 0; } diff --git a/source4/ntvfs/posix/pvfs_notify.c b/source4/ntvfs/posix/pvfs_notify.c index bd1e1b9d89..64aeac0696 100644 --- a/source4/ntvfs/posix/pvfs_notify.c +++ b/source4/ntvfs/posix/pvfs_notify.c @@ -117,9 +117,8 @@ static void pvfs_notify_send(struct pvfs_notify_buffer *notify_buffer, /* destroy a notify buffer. Called when the handle is closed */ -static int pvfs_notify_destructor(void *ptr) +static int pvfs_notify_destructor(struct pvfs_notify_buffer *n) { - struct pvfs_notify_buffer *n = talloc_get_type(ptr, struct pvfs_notify_buffer); notify_remove(n->f->pvfs->notify_context, n); n->f->notify_buffer = NULL; pvfs_notify_send(n, NT_STATUS_OK, True); diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c index 2102de29f5..74f9b44c5c 100644 --- a/source4/ntvfs/posix/pvfs_open.c +++ b/source4/ntvfs/posix/pvfs_open.c @@ -54,9 +54,8 @@ struct pvfs_file *pvfs_find_fd(struct pvfs_state *pvfs, /* cleanup a open directory handle */ -static int pvfs_dir_handle_destructor(void *p) +static int pvfs_dir_handle_destructor(struct pvfs_file_handle *h) { - struct pvfs_file_handle *h = p; int open_count; char *path = NULL; @@ -102,10 +101,8 @@ static int pvfs_dir_handle_destructor(void *p) /* cleanup a open directory fnum */ -static int pvfs_dir_fnum_destructor(void *p) +static int pvfs_dir_fnum_destructor(struct pvfs_file *f) { - struct pvfs_file *f = p; - DLIST_REMOVE(f->pvfs->files.list, f); ntvfs_handle_remove_backend_data(f->ntvfs, f->pvfs->ntvfs); @@ -412,9 +409,8 @@ cleanup_delete: /* destroy a struct pvfs_file_handle */ -static int pvfs_handle_destructor(void *p) +static int pvfs_handle_destructor(struct pvfs_file_handle *h) { - struct pvfs_file_handle *h = p; int open_count; char *path = NULL; @@ -494,10 +490,8 @@ static int pvfs_handle_destructor(void *p) /* destroy a struct pvfs_file */ -static int pvfs_fnum_destructor(void *p) +static int pvfs_fnum_destructor(struct pvfs_file *f) { - struct pvfs_file *f = talloc_get_type(p, struct pvfs_file); - DLIST_REMOVE(f->pvfs->files.list, f); pvfs_lock_close(f->pvfs, f); ntvfs_handle_remove_backend_data(f->ntvfs, f->pvfs->ntvfs); @@ -768,9 +762,8 @@ struct pvfs_open_retry { }; /* destroy a pending open request */ -static int pvfs_retry_destructor(void *ptr) +static int pvfs_retry_destructor(struct pvfs_open_retry *r) { - struct pvfs_open_retry *r = ptr; struct pvfs_state *pvfs = r->ntvfs->private_data; if (r->odb_locking_key.data) { struct odb_lock *lck; -- cgit