From c724beb161ce5f21862e9bb425736efed7532777 Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Wed, 7 Apr 2010 10:07:29 +0000 Subject: NFS: type fixes: some portability cleanup Signed-off-by: Csaba Henk Signed-off-by: Anand V. Avati BUG: 399 (NFS translator with Mount v3 and NFS v3 support) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=399 --- xlators/nfs/lib/src/rpcsvc.c | 16 ++++++++-------- xlators/nfs/server/src/nfs3-helpers.c | 4 ++-- xlators/nfs/server/src/nfs3.c | 22 +++++++++++++--------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/xlators/nfs/lib/src/rpcsvc.c b/xlators/nfs/lib/src/rpcsvc.c index e76ee16087a..47510ad8a35 100644 --- a/xlators/nfs/lib/src/rpcsvc.c +++ b/xlators/nfs/lib/src/rpcsvc.c @@ -1362,7 +1362,7 @@ rpcsvc_record_build_header (char *recordstart, size_t rlen, fraglen = payload + replyhdr.iov_len; gf_log (GF_RPCSVC, GF_LOG_TRACE, "Reply fraglen %zu, payload: %zu, " - "rpc hdr: %ld", fraglen, payload, replyhdr.iov_len); + "rpc hdr: %zu", fraglen, payload, replyhdr.iov_len); /* Since we're not spreading RPC records over mutiple fragments * we just set this fragment as the first and last fragment for this @@ -1398,7 +1398,7 @@ rpcsvc_conn_submit (rpcsvc_conn_t *conn, struct iovec hdr, if ((!conn) || (!hdr.iov_base) || (!hdriob)) return -1; - gf_log (GF_RPCSVC, GF_LOG_TRACE, "Tx Header: %ld, payload: %ld", + gf_log (GF_RPCSVC, GF_LOG_TRACE, "Tx Header: %zu, payload: %zu", hdr.iov_len, msgvec.iov_len); /* Now that we have both the RPC and Program buffers in xdr format * lets hand it to the transmission layer. @@ -1569,7 +1569,7 @@ rpcsvc_submit_generic (rpcsvc_request_t *req, struct iovec msgvec, return -1; conn = req->conn; - gf_log (GF_RPCSVC, GF_LOG_TRACE, "Tx message: %ld", msgvec.iov_len); + gf_log (GF_RPCSVC, GF_LOG_TRACE, "Tx message: %zu", msgvec.iov_len); /* Build the buffer containing the encoded RPC reply. */ replyiob = rpcsvc_record_build_record (req, msgvec.iov_len, &recordhdr); if (!replyiob) { @@ -1623,7 +1623,7 @@ rpcsvc_request_attach_vector (rpcsvc_request_t *req, struct iovec msgvec, if ((!req) || (!msgvec.iov_base)) return -1; - gf_log (GF_RPCSVC, GF_LOG_TRACE, "Tx Vector: %ld", msgvec.iov_len); + gf_log (GF_RPCSVC, GF_LOG_TRACE, "Tx Vector: %zu", msgvec.iov_len); if (finalvector) txflags |= RPCSVC_TXB_LAST; /* We only let the user decide whether this is the last vector for the @@ -2312,7 +2312,7 @@ rpcsvc_record_update_state (rpcsvc_conn_t *conn, ssize_t dataread) * fragment needs. Something is seriously wrong. */ if (dataread > 0) { - gf_log (GF_RPCSVC, GF_LOG_TRACE, "Data Left: %ld", dataread); + gf_log (GF_RPCSVC, GF_LOG_TRACE, "Data Left: %zd", dataread); gf_log (GF_RPCSVC, GF_LOG_ERROR, "Unwanted data read from " " connection."); } @@ -2365,7 +2365,7 @@ rpcsvc_conn_data_poll_in (rpcsvc_conn_t *conn) goto err; dataread = rpcsvc_socket_read (conn->sockfd, readaddr, readsize); - gf_log (GF_RPCSVC, GF_LOG_TRACE, "conn: 0x%lx, readsize: %ld, dataread: %ld", + gf_log (GF_RPCSVC, GF_LOG_TRACE, "conn: 0x%lx, readsize: %zu, dataread: %zd", (long)conn, readsize, dataread); if (dataread > 0) @@ -2414,8 +2414,8 @@ tx_remaining: gf_log (GF_RPCSVC, GF_LOG_TRACE, "Last Tx Buf"); rpcsvc_socket_unblock_tx (conn->sockfd); } - gf_log (GF_RPCSVC, GF_LOG_TRACE, "conn: 0x%lx, Tx request: %ld," - " Tx sent: %ld", (long)conn, writesize, written); + gf_log (GF_RPCSVC, GF_LOG_TRACE, "conn: 0x%lx, Tx request: %zu," + " Tx sent: %zd", (long)conn, writesize, written); /* There was an error transmitting this buffer */ if (written == -1) diff --git a/xlators/nfs/server/src/nfs3-helpers.c b/xlators/nfs/server/src/nfs3-helpers.c index 6b9c452c283..72861dfd0e8 100644 --- a/xlators/nfs/server/src/nfs3-helpers.c +++ b/xlators/nfs/server/src/nfs3-helpers.c @@ -1883,7 +1883,7 @@ nfs3_fdcache_add (struct nfs3_state *nfs3, fd_t *fd) { gf_log (GF_NFS3, GF_LOG_TRACE, "Adding fd: 0x%lx", (long int) fd); - fd_ctx_set (fd, nfs3->nfsx, (uint64_t)fde); + fd_ctx_set (fd, nfs3->nfsx, (uintptr_t)fde); fd_bind (fd); list_add_tail (&fde->list, &nfs3->fdlru); ++nfs3->fdcount; @@ -1945,7 +1945,7 @@ __nfs3_queue_call_state (nfs3_call_state_t *cs) gf_log (GF_NFS3, GF_LOG_TRACE, "Initing inode queue"); INIT_LIST_HEAD (inode_q); - __inode_ctx_put (cs->resolvedloc.inode, cs->nfsx, (uint64_t)inode_q); + __inode_ctx_put (cs->resolvedloc.inode, cs->nfsx, (uintptr_t)inode_q); attach_cs: if (list_empty (inode_q)) { diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c index 4129a188015..712bbcaf382 100644 --- a/xlators/nfs/server/src/nfs3.c +++ b/xlators/nfs/server/src/nfs3.c @@ -3588,17 +3588,17 @@ nfs3svc_readdir_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, nfs3err: if (cs->maxcount == 0) { nfs3_log_readdir_res (rpcsvc_request_xid (cs->req), stat, - op_errno, (uint64_t)cs->fd, + op_errno, (uintptr_t)cs->fd, cs->dircount, is_eof); - nfs3_readdir_reply (cs->req, stat, (uint64_t)cs->fd, + nfs3_readdir_reply (cs->req, stat, (uintptr_t)cs->fd, buf, &cs->entries, cs->dircount, is_eof); } else { nfs3_log_readdirp_res (rpcsvc_request_xid (cs->req), stat, - op_errno, (uint64_t)cs->fd, + op_errno, (uintptr_t)cs->fd, cs->dircount, cs->maxcount, is_eof); nfs3_readdirp_reply (cs->req, stat, &cs->parent, - (uint64_t)cs->fd, buf, + (uintptr_t)cs->fd, buf, &cs->entries, cs->dircount, cs->maxcount, is_eof); } @@ -4546,8 +4546,9 @@ rpcsvc_program_t nfs3prog = { int nfs3_init_options (struct nfs3_state *nfs3, xlator_t *nfsx) { - int ret = -1; - char *optstr = NULL; + int ret = -1; + char *optstr = NULL; + uint64_t size64 = 0; if ((!nfs3) || (!nfsx)) return -1; @@ -4563,7 +4564,8 @@ nfs3_init_options (struct nfs3_state *nfs3, xlator_t *nfsx) goto err; } - ret = gf_string2bytesize (optstr, &nfs3->readsize); + ret = gf_string2bytesize (optstr, &size64); + nfs3->readsize = size64; if (ret == -1) { gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to format" " option: nfs3.read-size"); @@ -4583,7 +4585,8 @@ nfs3_init_options (struct nfs3_state *nfs3, xlator_t *nfsx) goto err; } - ret = gf_string2bytesize (optstr, &nfs3->writesize); + ret = gf_string2bytesize (optstr, &size64); + nfs3->writesize = size64; if (ret == -1) { gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to format" " option: nfs3.write-size"); @@ -4603,7 +4606,8 @@ nfs3_init_options (struct nfs3_state *nfs3, xlator_t *nfsx) goto err; } - ret = gf_string2bytesize (optstr, &nfs3->readdirsize); + ret = gf_string2bytesize (optstr, &size64); + nfs3->readdirsize = size64; if (ret == -1) { gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to format" " option: nfs3.readdir-size"); -- cgit