From: Ronnie Sahlberg Date: Sat, 3 Sep 2011 01:08:58 +0000 (+1000) Subject: cast the pointer to char * for all calls to bzero X-Git-Tag: upstream/1.9.6^2~325^2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=42f43e48cca9eb9defb671b9d47c5a8ffb5112f0;p=deb_libnfs.git cast the pointer to char * for all calls to bzero --- diff --git a/lib/init.c b/lib/init.c index 5663f25..d83e3ed 100644 --- a/lib/init.c +++ b/lib/init.c @@ -37,7 +37,7 @@ struct rpc_context *rpc_init_context(void) if (rpc == NULL) { return NULL; } - bzero(rpc, sizeof(struct rpc_context)); + bzero((char *)rpc, sizeof(struct rpc_context)); rpc->encodebuflen = 65536; rpc->encodebuf = malloc(rpc->encodebuflen); diff --git a/lib/libnfs.c b/lib/libnfs.c index 7537235..c9ca8c6 100644 --- a/lib/libnfs.c +++ b/lib/libnfs.c @@ -483,7 +483,7 @@ int nfs_mount_async(struct nfs_context *nfs, const char *server, const char *exp rpc_set_error(nfs->rpc, "out of memory. failed to allocate memory for nfs mount data"); return -1; } - bzero(data, sizeof(struct nfs_cb_data)); + bzero((char *)data, sizeof(struct nfs_cb_data)); new_server = strdup(server); new_export = strdup(export); if (nfs->server != NULL) { @@ -604,7 +604,7 @@ static int nfs_lookuppath_async(struct nfs_context *nfs, const char *path, nfs_c rpc_set_error(nfs->rpc, "out of memory: failed to allocate nfs_cb_data structure"); return -1; } - bzero(data, sizeof(struct nfs_cb_data)); + bzero((char *)data, sizeof(struct nfs_cb_data)); data->nfs = nfs; data->cb = cb; data->continue_cb = continue_cb; @@ -767,7 +767,7 @@ static void nfs_open_cb(struct rpc_context *rpc _U_, int status, void *command_d free_nfs_cb_data(data); return; } - bzero(nfsfh, sizeof(struct nfsfh)); + bzero((char *)nfsfh, sizeof(struct nfsfh)); if (data->continue_int & O_SYNC) { nfsfh->is_sync = 1; @@ -921,7 +921,7 @@ int nfs_pread_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, rpc_set_error(nfs->rpc, "out of memory: failed to allocate nfs_cb_data structure"); return -1; } - bzero(data, sizeof(struct nfs_cb_data)); + bzero((char *)data, sizeof(struct nfs_cb_data)); data->nfs = nfs; data->cb = cb; data->private_data = private_data; @@ -967,7 +967,7 @@ int nfs_pread_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, rpc_set_error(nfs->rpc, "out of memory: failed to allocate nfs_mcb_data structure"); return -1; } - bzero(mdata, sizeof(struct nfs_mcb_data)); + bzero((char *)mdata, sizeof(struct nfs_mcb_data)); mdata->data = data; mdata->offset = offset; mdata->count = readcount; @@ -1038,7 +1038,7 @@ int nfs_pwrite_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, rpc_set_error(nfs->rpc, "out of memory: failed to allocate nfs_cb_data structure"); return -1; } - bzero(data, sizeof(struct nfs_cb_data)); + bzero((char *)data, sizeof(struct nfs_cb_data)); data->nfs = nfs; data->cb = cb; data->private_data = private_data; @@ -1097,7 +1097,7 @@ int nfs_fstat_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb, voi rpc_set_error(nfs->rpc, "out of memory: failed to allocate nfs_cb_data structure"); return -1; } - bzero(data, sizeof(struct nfs_cb_data)); + bzero((char *)data, sizeof(struct nfs_cb_data)); data->nfs = nfs; data->cb = cb; data->private_data = private_data; @@ -1154,7 +1154,7 @@ int nfs_fsync_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb, voi rpc_set_error(nfs->rpc, "out of memory: failed to allocate nfs_cb_data structure"); return -1; } - bzero(data, sizeof(struct nfs_cb_data)); + bzero((char *)data, sizeof(struct nfs_cb_data)); data->nfs = nfs; data->cb = cb; data->private_data = private_data; @@ -1213,12 +1213,12 @@ int nfs_ftruncate_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t leng rpc_set_error(nfs->rpc, "out of memory: failed to allocate nfs_cb_data structure"); return -1; } - bzero(data, sizeof(struct nfs_cb_data)); + bzero((char *)data, sizeof(struct nfs_cb_data)); data->nfs = nfs; data->cb = cb; data->private_data = private_data; - bzero(&args, sizeof(SETATTR3args)); + bzero((char *)&args, sizeof(SETATTR3args)); args.object.data.data_len = nfsfh->fh.data.data_len; args.object.data.data_val = nfsfh->fh.data.data_val; args.new_attributes.size.set_it = 1; @@ -1471,7 +1471,7 @@ static void nfs_create_2_cb(struct rpc_context *rpc _U_, int status, void *comma free_nfs_cb_data(data); return; } - bzero(nfsfh, sizeof(struct nfsfh)); + bzero((char *)nfsfh, sizeof(struct nfsfh)); /* steal the filehandle */ nfsfh->fh.data.data_len = data->fh.data.data_len; @@ -1695,7 +1695,7 @@ static void nfs_opendir_cb(struct rpc_context *rpc _U_, int status, void *comman free_nfs_cb_data(data); return; } - bzero(nfsdirent, sizeof(struct nfsdirent)); + bzero((char *)nfsdirent, sizeof(struct nfsdirent)); nfsdirent->name = strdup(entry->name); if (nfsdirent->name == NULL) { data->cb(-ENOMEM, nfs, "Failed to allocate dirent->name", data->private_data); @@ -1749,7 +1749,7 @@ static int nfs_opendir_continue_internal(struct nfs_context *nfs, struct nfs_cb_ { cookieverf3 cv; - bzero(cv, sizeof(cookieverf3)); + bzero((char *)cv, sizeof(cookieverf3)); if (rpc_nfs_readdirplus_async(nfs->rpc, nfs_opendir_cb, &data->fh, 0, (char *)&cv, 8192, data) != 0) { rpc_set_error(nfs->rpc, "RPC error: Failed to send READDIRPLUS call for %s", data->path); data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data); @@ -1768,7 +1768,7 @@ int nfs_opendir_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void rpc_set_error(nfs->rpc, "failed to allocate buffer for nfsdir"); return -1; } - bzero(nfsdir, sizeof(struct nfsdir)); + bzero((char *)nfsdir, sizeof(struct nfsdir)); if (nfs_lookuppath_async(nfs, path, cb, private_data, nfs_opendir_continue_internal, nfsdir, free, 0) != 0) { rpc_set_error(nfs->rpc, "Out of memory: failed to start parsing the path components"); @@ -2042,7 +2042,7 @@ static int nfs_chmod_continue_internal(struct nfs_context *nfs, struct nfs_cb_da { SETATTR3args args; - bzero(&args, sizeof(SETATTR3args)); + bzero((char *)&args, sizeof(SETATTR3args)); args.object.data.data_len = data->fh.data.data_len; args.object.data.data_val = data->fh.data.data_val; args.new_attributes.mode.set_it = 1; @@ -2080,7 +2080,7 @@ int nfs_fchmod_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int mode, nfs rpc_set_error(nfs->rpc, "out of memory. failed to allocate memory for nfs mount data"); return -1; } - bzero(data, sizeof(struct nfs_cb_data)); + bzero((char *)data, sizeof(struct nfs_cb_data)); data->nfs = nfs; data->cb = cb; data->private_data = private_data; @@ -2146,7 +2146,7 @@ static int nfs_chown_continue_internal(struct nfs_context *nfs, struct nfs_cb_da SETATTR3args args; struct nfs_chown_data *chown_data = data->continue_data; - bzero(&args, sizeof(SETATTR3args)); + bzero((char *)&args, sizeof(SETATTR3args)); args.object.data.data_len = data->fh.data.data_len; args.object.data.data_val = data->fh.data.data_val; if (chown_data->uid != (uid_t)-1) { @@ -2213,7 +2213,7 @@ int nfs_fchown_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid, int rpc_set_error(nfs->rpc, "out of memory. failed to allocate memory for fchown data"); return -1; } - bzero(data, sizeof(struct nfs_cb_data)); + bzero((char *)data, sizeof(struct nfs_cb_data)); data->nfs = nfs; data->cb = cb; data->private_data = private_data; @@ -2277,7 +2277,7 @@ static int nfs_utimes_continue_internal(struct nfs_context *nfs, struct nfs_cb_d SETATTR3args args; struct timeval *utimes_data = data->continue_data; - bzero(&args, sizeof(SETATTR3args)); + bzero((char *)&args, sizeof(SETATTR3args)); args.object.data.data_len = data->fh.data.data_len; args.object.data.data_val = data->fh.data.data_val; if (utimes_data != NULL) { @@ -2525,7 +2525,7 @@ int nfs_symlink_async(struct nfs_context *nfs, const char *oldpath, const char * rpc_set_error(nfs->rpc, "Out of memory, failed to allocate buffer for symlink data"); return -1; } - bzero(symlink_data, sizeof(struct nfs_symlink_data)); + bzero((char *)symlink_data, sizeof(struct nfs_symlink_data)); symlink_data->oldpath = strdup(oldpath); if (symlink_data->oldpath == NULL) { @@ -2679,7 +2679,7 @@ int nfs_rename_async(struct nfs_context *nfs, const char *oldpath, const char *n rpc_set_error(nfs->rpc, "Out of memory, failed to allocate buffer for rename data"); return -1; } - bzero(rename_data, sizeof(struct nfs_rename_data)); + bzero((char *)rename_data, sizeof(struct nfs_rename_data)); rename_data->oldpath = strdup(oldpath); if (rename_data->oldpath == NULL) { @@ -2835,7 +2835,7 @@ int nfs_link_async(struct nfs_context *nfs, const char *oldpath, const char *new rpc_set_error(nfs->rpc, "Out of memory, failed to allocate buffer for link data"); return -1; } - bzero(link_data, sizeof(struct nfs_link_data)); + bzero((char *)link_data, sizeof(struct nfs_link_data)); link_data->oldpath = strdup(oldpath); if (link_data->oldpath == NULL) { @@ -3054,7 +3054,7 @@ int mount_getexports_async(struct rpc_context *rpc, const char *server, rpc_cb c if (data == NULL) { return -1; } - bzero(data, sizeof(struct mount_cb_data)); + bzero((char *)data, sizeof(struct mount_cb_data)); data->cb = cb; data->private_data = private_data; data->server = strdup(server); diff --git a/lib/pdu.c b/lib/pdu.c index d6e8232..23698a8 100644 --- a/lib/pdu.c +++ b/lib/pdu.c @@ -41,7 +41,7 @@ struct rpc_pdu *rpc_allocate_pdu(struct rpc_context *rpc, int program, int versi rpc_set_error(rpc, "Out of memory: Failed to allocate pdu structure"); return NULL; } - bzero(pdu, sizeof(struct rpc_pdu)); + bzero((char *)pdu, sizeof(struct rpc_pdu)); pdu->xid = rpc->xid++; pdu->cb = cb; pdu->private_data = private_data; @@ -53,7 +53,7 @@ struct rpc_pdu *rpc_allocate_pdu(struct rpc_context *rpc, int program, int versi xdr_setpos(&pdu->xdr, 4); /* skip past the record marker */ } - bzero(&msg, sizeof(struct rpc_msg)); + bzero((char *)&msg, sizeof(struct rpc_msg)); msg.rm_xid = pdu->xid; msg.rm_direction = CALL; msg.rm_call.cb_rpcvers = RPC_MSG_VERSION; @@ -146,7 +146,7 @@ static int rpc_process_reply(struct rpc_context *rpc, struct rpc_pdu *pdu, XDR * { struct rpc_msg msg; - bzero(&msg, sizeof(struct rpc_msg)); + bzero((char *)&msg, sizeof(struct rpc_msg)); msg.acpted_rply.ar_verf = _null_auth; if (pdu->xdr_decode_bufsize > 0) { if (pdu->xdr_decode_buf != NULL) { @@ -158,7 +158,7 @@ static int rpc_process_reply(struct rpc_context *rpc, struct rpc_pdu *pdu, XDR * pdu->cb(rpc, RPC_STATUS_ERROR, "Failed to allocate buffer for decoding of XDR reply", pdu->private_data); return 0; } - bzero(pdu->xdr_decode_buf, pdu->xdr_decode_bufsize); + bzero((char *)pdu->xdr_decode_buf, pdu->xdr_decode_bufsize); } msg.acpted_rply.ar_results.where = pdu->xdr_decode_buf; msg.acpted_rply.ar_results.proc = pdu->xdr_decode_fn; @@ -210,7 +210,7 @@ int rpc_process_pdu(struct rpc_context *rpc, char *buf, int size) int pos, recordmarker; unsigned int xid; - bzero(&xdr, sizeof(XDR)); + bzero((char *)&xdr, sizeof(XDR)); xdrmem_create(&xdr, buf, size, XDR_DECODE); if (rpc->is_udp == 0) { diff --git a/nfs/nfs.c b/nfs/nfs.c index 5b655cb..1daaa56 100644 --- a/nfs/nfs.c +++ b/nfs/nfs.c @@ -350,7 +350,7 @@ int rpc_nfs_mkdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, return -1; } - bzero(&args, sizeof(MKDIR3args)); + bzero((char *)&args, sizeof(MKDIR3args)); args.where.dir.data.data_len = fh->data.data_len; args.where.dir.data.data_val = fh->data.data_val; args.where.name = dir; @@ -386,7 +386,7 @@ int rpc_nfs_rmdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, return -1; } - bzero(&args, sizeof(RMDIR3args)); + bzero((char *)&args, sizeof(RMDIR3args)); args.object.dir.data.data_len = fh->data.data_len; args.object.dir.data.data_val = fh->data.data_val; args.object.name = dir; @@ -419,7 +419,7 @@ int rpc_nfs_create_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, return -1; } - bzero(&args, sizeof(CREATE3args)); + bzero((char *)&args, sizeof(CREATE3args)); args.where.dir.data.data_len = fh->data.data_len; args.where.dir.data.data_val = fh->data.data_val; args.where.name = file; @@ -456,7 +456,7 @@ int rpc_nfs_remove_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, return -1; } - bzero(&args, sizeof(REMOVE3args)); + bzero((char *)&args, sizeof(REMOVE3args)); args.object.dir.data.data_len = fh->data.data_len; args.object.dir.data.data_val = fh->data.data_val; args.object.name = file; @@ -487,7 +487,7 @@ int rpc_nfs_readdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh return -1; } - bzero(&args, sizeof(READDIR3args)); + bzero((char *)&args, sizeof(READDIR3args)); args.dir.data.data_len = fh->data.data_len; args.dir.data.data_val = fh->data.data_val; args.cookie = cookie; @@ -520,7 +520,7 @@ int rpc_nfs_readdirplus_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 return -1; } - bzero(&args, sizeof(READDIRPLUS3args)); + bzero((char *)&args, sizeof(READDIRPLUS3args)); args.dir.data.data_len = fh->data.data_len; args.dir.data.data_val = fh->data.data_val; args.cookie = cookie; @@ -642,7 +642,7 @@ int rpc_nfs_symlink_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh return -1; } - bzero(&args, sizeof(SYMLINK3args)); + bzero((char *)&args, sizeof(SYMLINK3args)); args.where.dir.data.data_len = fh->data.data_len; args.where.dir.data.data_val = fh->data.data_val; args.where.name = newname; @@ -679,7 +679,7 @@ int rpc_nfs_rename_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *old return -1; } - bzero(&args, sizeof(RENAME3args)); + bzero((char *)&args, sizeof(RENAME3args)); args.from.dir.data.data_len = olddir->data.data_len; args.from.dir.data.data_val = olddir->data.data_val; args.from.name = oldname; @@ -716,7 +716,7 @@ int rpc_nfs_link_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *file, return -1; } - bzero(&args, sizeof(LINK3args)); + bzero((char *)&args, sizeof(LINK3args)); args.file.data.data_len = file->data.data_len; args.file.data.data_val = file->data.data_val; args.link.dir.data.data_len = newdir->data.data_len;