r15854: more talloc_set_destructor() typesafe fixes
authorAndrew Tridgell <tridge@samba.org>
Wed, 24 May 2006 07:34:11 +0000 (07:34 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:08:32 +0000 (14:08 -0500)
(This used to be commit 61c6100617589ac6df4f527877241464cacbf8b3)

29 files changed:
source4/lib/events/events_liboop.c
source4/lib/events/events_standard.c
source4/lib/ldb/ldb_ldap/ldb_ldap.c
source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
source4/lib/ldb/modules/paged_results.c
source4/lib/ldb/modules/skel.c
source4/lib/messaging/messaging.c
source4/lib/registry/reg_backend_ldb.c
source4/lib/socket/socket.c
source4/lib/stream/packet.c
source4/lib/tls/tls.c
source4/lib/util/unix_privs.c
source4/libcli/cldap/cldap.c
source4/libcli/dgram/mailslot.c
source4/libcli/ldap/ldap_client.c
source4/libcli/nbt/nbtsocket.c
source4/libcli/raw/clitransport.c
source4/libcli/resolve/host.c
source4/libcli/smb2/transport.c
source4/libcli/wrepl/winsrepl.c
source4/librpc/rpc/dcerpc.c
source4/ntvfs/cifs/vfs_cifs.c
source4/ntvfs/common/notify.c
source4/ntvfs/common/opendb.c
source4/ntvfs/ipc/vfs_ipc.c
source4/ntvfs/posix/pvfs_dirlist.c
source4/ntvfs/posix/pvfs_notify.c
source4/ntvfs/posix/pvfs_open.c

index c81449e65e9cf9e12af43368317497719d438f2b..53238662f0cafdbadea900781251948e38258762 100644 (file)
@@ -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);
index ff11afe5d552e13116eb0fc004b1b364d246a52c..5d59f1b885cbaea7c46f5cc99e121b918fb27228 100644 (file)
@@ -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;
 }
index 8bfff117da38e0d37b68a9b33f5ce742c2d97eca..bbfb1de104a4d5499f73ac94e42d2766cf3ed453 100644 (file)
@@ -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;
 }
index bcb830c38d496bfd8c585252e4b4e872b18ab42e..06b76e812d6b5a27eaef8721903718488c21a354 100644 (file)
@@ -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);
        }
index d4fc67c2d401c5db25a0ad6787dbb6f2ae713763..fdce36b24ca7c7073f4f739531c0139706200ba3 100644 (file)
@@ -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;
index 5ce062868ec13a5f79d995f36b14096ba1e4366b..1b002716a537e953a0e42f7eaf6951d6d0b4548d 100644 (file)
@@ -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;
        }
index 0089433b37a44bb9ecb3bcb898a4effed5835017..2f3c2e8b57acd872468ad542d67d63c6c517dcc5 100644 (file)
@@ -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);
index bf06d68a3386911e66d8e89db81d12b2ff3b35dd..6bd331c24733fca1cdee6f3ea359f4633bbc6f35 100644 (file)
@@ -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;
 }
index ec185cd65bcc41e6580c121707008f7cdecc3810..a8c054cc165ddef4c78ba2a932d5e73c7cd53a1f 100644 (file)
@@ -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; */
 
index b7d4431c945de96aa285fc729cca7d64c81a212b..e1f8bb4d8685060409b8875ed610f6a4d90804f9 100644 (file)
@@ -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);
        }
index 1da7f5706b9706e1a0f205041b6bedb2c64b9bf8..e06f4985eff5e398a6d9bacc0ef2cc81c47a8cb4 100644 (file)
@@ -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
index 2872669948e7208bb5801f085e96896c7648ece7..936c18c0c6c9da2108f6e0a582c964be1908baeb 100644 (file)
@@ -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) {
index c94cf619a3af0550bcbd9a6294d2199b4dd57896..bf3e61ba2d3ac91566c87f88faae0091da787bbd 100644 (file)
@@ -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");
index 58beb1b64228b3abbc0301b79e304d0505550f12..03e690ef182365d571098be1a4635f02b4830c06 100644 (file)
@@ -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);
        }
index 467289bcee3d7b634900293ee8f5c7769c6db884..775f6623708f628457a96bf1ecefd14494524361 100644 (file)
 /*
   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;
 }
index 8d815c71039f21be8d738c6ea32ae295df959ff6..07b7f2b412d0e2c12ba6cac19355e8b51eb28cba 100644 (file)
@@ -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);
        }
index 50da8168e072a6b59337a43898cbeb96cd9a3629..7bdeb834f96dbb5a79bd108658ada421dfe53411 100644 (file)
 /*
   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);
        }
index 2ad155e9b9543f8165a6f02afab00764f720ad38..fc257b909811078cc1145d7f598330150e97d1fc 100644 (file)
@@ -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);
        }
index 781ea957dfd934a97f3e823349cb98ef9cbe777a..18188f7c1c9a6b943c5636a566d87f9bcd573f21 100644 (file)
@@ -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);
index 6567ad4de72d9729487d4c8be7f46a47d8874fcb..9b6a39171d1a1f370367b8f7a7740c66e45de822 100644 (file)
@@ -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);
        }
index c37d5f98731fdcfabd1623983d823a8aa156733b..a1735c547cffe5ee70adf4b279808f021232c78e 100644 (file)
@@ -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,
index a1ce11c749ece36a7e1a913459dd6ccd862b4418..70c60b100a4a40d53b2f36cd4f2bd7fe8297da5f 100644 (file)
@@ -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;
 }
index 2b4f9bb8c59a28b16fc0daf00e2079a82acea346..47b89ff662cade996dd65424241bad7e3e7a0a41 100644 (file)
@@ -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;
 }
index 57cbce38632e51ccff504b88bac0af87b7a7582c..222bd7a92756a6f34d02e84581b9f92ba7336017 100644 (file)
@@ -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;
index 395e6c6dbf346023de96cecd18bb1fd644587698..d83ecdc6f2ad51bbfcae8be829836b7f0e21899f 100644 (file)
@@ -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;
 }
index 2e7c538c3fb553c3ec85b706b38b7ee5dc2d46cf..03e026e4239a7478abe5f4daf239890c052b3354 100644 (file)
@@ -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;
 }
index 517f5b68d0e8ee0f1466e5f4fa120dc91b936bfc..c351f6ba41a60ea525bc1219e69ba7686f391601 100644 (file)
@@ -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;
 }
index bd1e1b9d89b4b76c7ea6dcd6afa7ae2a138aa69e..64aeac0696adea64754ed02489f4cc37c02d2307 100644 (file)
@@ -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);
index 2102de29f5303bc035acf73eb50ad42ac04c8a6d..74f9b44c5c2df66215be3ebaf53fb04f37c06de9 100644 (file)
@@ -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;