提交 562f5c89 编写于 作者: F Far

fix: 消除NFS中冗余的打印信息

NFS中部分错误分支打印了一些冗余的DEBUG信息,增加一个宏开关NFS_DEBUG
此宏开关打开时,才打印错误信息。
Signed-off-by: NFar <yesiyuan2@huawei.com>
上级 a67a1d6e
......@@ -55,6 +55,22 @@
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
/****************************************************************************
* Debug
****************************************************************************/
#ifdef NFS_DEBUG
#define nfs_debug_error(format, ...) PRINT_ERR(format, ##__VA_ARGS__)
#define nfs_debug_info(format, ...) PRINTK(format, ##__VA_ARGS__)
#else
#define nfs_debug_error(...)
#define nfs_debug_info(...)
#endif
#define nfs_error(format, ...) PRINT_ERR(format, ##__VA_ARGS__)
#define nfs_info(format, ...) PRINTK(format, ##__VA_ARGS__)
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
......
......@@ -100,7 +100,7 @@ struct nfsstats nfsstats;
entry = (struct entry3 *)malloc(sizeof(struct entry3)); \
if (entry == NULL) \
{ \
PRINT_DEBUG("malloc failed\n"); \
nfs_debug_info("malloc failed\n"); \
error = ENOMEM; \
goto errout_with_memory; \
} \
......@@ -205,7 +205,7 @@ static int nfs_fileupdate(struct nfsmount *nmp, char *filename,
if (error != OK)
{
PRINTK("ERROR: nfs_lookup failed returned: %d\n", error);
nfs_debug_error("nfs_lookup failed returned: %d\n", error);
return error;
}
......@@ -381,7 +381,7 @@ static void nfs_decode_args(struct nfs_mount_parameters *nprmt,
nprmt->retry = NFS_MAXREXMIT + 1; /* Past clip limit */
}
/* Get the maximum amount of data that can be transPRINT_ERRed in one packet */
/* Get the maximum amount of data that can be transferred in one packet */
if ((argp->sotype == SOCK_DGRAM) != 0)
{
......@@ -389,11 +389,11 @@ static void nfs_decode_args(struct nfs_mount_parameters *nprmt,
}
else
{
PRINT_ERR("Only SOCK_DRAM is supported\n");
nfs_debug_error("Only SOCK_DRAM is supported\n");
maxio = NFS_MAXDATA;
}
/* Get the maximum amount of data that can be transPRINT_ERRed in one write transfer */
/* Get the maximum amount of data that can be transferred in one write transfer */
if ((argp->flags & NFSMNT_WSIZE) != 0 && argp->wsize > 0)
{
......@@ -418,7 +418,7 @@ static void nfs_decode_args(struct nfs_mount_parameters *nprmt,
nprmt->wsize = MAXBSIZE;
}
/* Get the maximum amount of data that can be transPRINT_ERRed in one read transfer */
/* Get the maximum amount of data that can be transferred in one read transfer */
if ((argp->flags & NFSMNT_RSIZE) != 0 && argp->rsize > 0)
{
......@@ -443,7 +443,7 @@ static void nfs_decode_args(struct nfs_mount_parameters *nprmt,
nprmt->rsize = MAXBSIZE;
}
/* Get the maximum amount of data that can be transPRINT_ERRed in directory transfer */
/* Get the maximum amount of data that can be transferred in directory transfer */
if ((argp->flags & NFSMNT_READDIRSIZE) != 0 && argp->readdirsize > 0)
{
......@@ -543,7 +543,7 @@ int nfs_bind(struct Vnode *blkdriver, const void *data,
nmp = (struct nfsmount *)malloc(SIZEOF_nfsmount(buflen));
if (!nmp)
{
PRINT_ERR("Failed to allocate mountpoint structure\n");
nfs_debug_error("Failed to allocate mountpoint structure\n");
return -ENOMEM;
}
......@@ -598,14 +598,14 @@ int nfs_bind(struct Vnode *blkdriver, const void *data,
rpc = (struct rpcclnt *)malloc(sizeof(struct rpcclnt));
if (!rpc)
{
PRINT_ERR("Failed to allocate rpc structure\n");
nfs_debug_error("Failed to allocate rpc structure\n");
error = ENOMEM;
goto bad;
}
(void)memset_s(rpc, sizeof(struct rpcclnt), 0, sizeof(struct rpcclnt));
PRINT_INFO("Connecting\n");
nfs_debug_info("Connecting\n");
/* Translate nfsmnt flags -> rpcclnt flags */
......@@ -620,7 +620,7 @@ int nfs_bind(struct Vnode *blkdriver, const void *data,
error = rpcclnt_connect(nmp->nm_rpcclnt);
if (error != OK)
{
PRINTK("ERROR: nfs_connect failed: %d\n", error);
nfs_debug_error("nfs_connect failed: %d\n", error);
goto bad;
}
}
......@@ -643,7 +643,7 @@ int nfs_bind(struct Vnode *blkdriver, const void *data,
(void *)&resok, sizeof(struct rpc_reply_getattr));
if (error)
{
PRINT_ERR("nfs_request failed: %d\n", error);
nfs_debug_error("nfs_request failed: %d\n", error);
goto bad;
}
......@@ -655,7 +655,7 @@ int nfs_bind(struct Vnode *blkdriver, const void *data,
*handle = (void *)nmp;
PRINT_INFO("Successfully mounted\n");
nfs_debug_info("Successfully mounted\n");
return OK;
bad:
......@@ -737,7 +737,7 @@ int nfs_mount(const char *server_ip_and_path, const char *mount_path,
server_ip_addr = (char *)malloc(pos + 1);
if (server_ip_addr == NULL)
{
PRINTK("malloc failure\n");
nfs_debug_info("malloc failure\n");
set_errno(ENOMEM);
goto nfs_mount_out;
}
......@@ -934,7 +934,7 @@ int vfs_nfs_opendir(struct Vnode *node, struct fs_dirent_s *dir)
ret = nfs_checkmount(nmp);
if (ret != OK) {
ret = -ret;
PRINTK("ERROR: nfs_checkmount failed: %d\n", ret);
nfs_debug_error("nfs_checkmount failed: %d\n", ret);
goto errout_with_mutex;
}
nfs_dir = (struct nfsdir_s *)malloc(sizeof(struct nfsdir_s));
......@@ -990,7 +990,7 @@ int vfs_nfs_readdir(struct Vnode *node, struct fs_dirent_s *dir)
error = nfs_checkmount(nmp);
if (error != OK)
{
PRINTK("ERROR: nfs_checkmount failed: %d\n", error);
nfs_debug_error("nfs_checkmount failed: %d\n", error);
goto errout_with_mutex;
}
......@@ -1052,7 +1052,7 @@ int vfs_nfs_readdir(struct Vnode *node, struct fs_dirent_s *dir)
if (error != OK)
{
PRINTK("ERROR: nfs_request failed: %d\n", error);
nfs_debug_error("nfs_request failed: %d\n", error);
goto errout_with_mutex;
}
......@@ -1247,7 +1247,7 @@ int vfs_nfs_readdir(struct Vnode *node, struct fs_dirent_s *dir)
error = nfs_lookup(nmp, dir->fd_dir[i].d_name, &fhandle, &obj_attributes, NULL);
if (error != OK)
{
PRINTK("ERROR: nfs_lookup failed: %d\n", error);
nfs_debug_error("nfs_lookup failed: %d\n", error);
goto errout_with_memory;
}
......@@ -1320,7 +1320,7 @@ int vfs_nfs_rename(struct Vnode *from_vnode, struct Vnode *to_parent,
error = nfs_checkmount(nmp);
if (error != OK)
{
PRINTK("ERROR: nfs_checkmount failed: %d\n", error);
nfs_debug_error("nfs_checkmount failed: %d\n", error);
goto errout_with_mutex;
}
......@@ -1377,7 +1377,7 @@ int vfs_nfs_rename(struct Vnode *from_vnode, struct Vnode *to_parent,
(void *)nmp->nm_iobuffer, nmp->nm_buflen);
if (error != OK)
{
PRINTK("ERROR: nfs_request returned: %d\n", error);
nfs_debug_error("nfs_request returned: %d\n", error);
goto errout_with_mutex;
}
......@@ -1385,7 +1385,7 @@ int vfs_nfs_rename(struct Vnode *from_vnode, struct Vnode *to_parent,
if (error != OK)
{
error = -error;
PRINTK("ERROR: nfs_rename not finish\n");
nfs_debug_error("nfs_rename not finish\n");
goto errout_with_mutex;
}
vfs_nfs_reclaim(from_vnode);
......@@ -1422,7 +1422,7 @@ int vfs_nfs_mkdir(struct Vnode *parent, const char *dirname, mode_t mode, struct
error = nfs_checkmount(nmp);
if (error != OK)
{
PRINTK("ERROR: nfs_checkmount: %d\n", error);
nfs_debug_error("nfs_checkmount: %d\n", error);
goto errout_with_mutex;
}
......@@ -1503,7 +1503,7 @@ int vfs_nfs_mkdir(struct Vnode *parent, const char *dirname, mode_t mode, struct
(void *)nmp->nm_iobuffer, nmp->nm_buflen);
if (error)
{
PRINTK("ERROR: nfs_request failed: %d\n", error);
nfs_debug_error("nfs_request failed: %d\n", error);
goto errout_with_mutex;
}
......@@ -1572,7 +1572,7 @@ int vfs_nfs_write(struct file *filep, const char *buffer, size_t buflen)
error = nfs_checkmount(nmp);
if (error != OK)
{
PRINTK("ERROR: nfs_checkmount failed: %d\n", error);
nfs_debug_error("nfs_checkmount failed: %d\n", error);
goto errout_with_mutex;
}
......@@ -1779,7 +1779,7 @@ off_t vfs_nfs_seek(struct file *filep, off_t offset, int whence)
error = nfs_checkmount(nmp);
if (error != OK)
{
PRINTK("nfs_checkmount failed: %d\n", error);
nfs_debug_info("nfs_checkmount failed: %d\n", error);
goto errout_with_mutex;
}
......@@ -1858,7 +1858,7 @@ ssize_t vfs_nfs_read(struct file *filep, char *buffer, size_t buflen)
error = nfs_checkmount(nmp);
if (error != OK)
{
PRINTK("ERROR: nfs_checkmount failed: %d\n", error);
nfs_debug_error("nfs_checkmount failed: %d\n", error);
goto errout_with_mutex;
}
......@@ -1870,7 +1870,7 @@ ssize_t vfs_nfs_read(struct file *filep, char *buffer, size_t buflen)
error = nfs_fileupdate(nmp, np->n_name, &parent_fhandle, np);
if (error != OK)
{
PRINTK("nfs_fileupdate failed: %d\n", error);
nfs_debug_info("nfs_fileupdate failed: %d\n", error);
goto errout_with_mutex;
}
......@@ -1937,7 +1937,7 @@ ssize_t vfs_nfs_read(struct file *filep, char *buffer, size_t buflen)
(void *)nmp->nm_iobuffer, nmp->nm_buflen);
if (error)
{
PRINTK("ERROR: nfs_request failed: %d\n", error);
nfs_debug_error("nfs_request failed: %d\n", error);
goto errout_with_mutex;
}
......@@ -1993,7 +1993,7 @@ int vfs_nfs_create(struct Vnode *parent, const char *filename, int mode, struct
error = nfs_checkmount(nmp);
if (error != OK)
{
PRINTK("ERROR: nfs_checkmount failed: %d\n", error);
nfs_debug_error("nfs_checkmount failed: %d\n", error);
goto errout_with_mutex;
}
ptr = (uint32_t *)&nmp->nm_msgbuffer.create.create;
......@@ -2102,7 +2102,7 @@ int vfs_nfs_create(struct Vnode *parent, const char *filename, int mode, struct
tmp = *ptr++; /* handle_follows */
if (!tmp)
{
PRINTK("ERROR: no file handle follows\n");
nfs_debug_error("no file handle follows\n");
error = EINVAL;
goto errout_with_mutex;
}
......@@ -2120,7 +2120,7 @@ int vfs_nfs_create(struct Vnode *parent, const char *filename, int mode, struct
tmp = *ptr; /* handle_follows */
if (!tmp)
{
PRINTK("WARNING: no file attributes\n");
nfs_debug_info("WARNING: no file attributes\n");
}
else
{
......@@ -2183,7 +2183,7 @@ int vfs_nfs_unlink(struct Vnode *parent, struct Vnode *target, const char *filen
error = nfs_checkmount(nmp);
if (error != OK)
{
PRINTK("ERROR: nfs_checkmount failed: %d\n", error);
nfs_debug_error("nfs_checkmount failed: %d\n", error);
goto errout_with_mutex;
}
......@@ -2192,7 +2192,7 @@ int vfs_nfs_unlink(struct Vnode *parent, struct Vnode *target, const char *filen
if (target_node->n_type == NFDIR)
{
PRINTK("ERROR: try to remove a directory\n");
nfs_debug_error("try to remove a directory\n");
error = EISDIR;
goto errout_with_mutex;
}
......@@ -2246,7 +2246,7 @@ int vfs_nfs_rmdir(struct Vnode *parent, struct Vnode *target, const char *dirnam
error = nfs_checkmount(nmp);
if (error != OK)
{
PRINTK("ERROR: nfs_checkmount failed: %d\n", error);
nfs_debug_error("nfs_checkmount failed: %d\n", error);
goto errout_with_mutex;
}
......@@ -2255,7 +2255,7 @@ int vfs_nfs_rmdir(struct Vnode *parent, struct Vnode *target, const char *dirnam
if (target_node->n_type != NFDIR)
{
PRINTK("ERROR: try to remove a non-dir\n");
nfs_debug_error("try to remove a non-dir\n");
return -ENOTDIR;
}
......@@ -2500,7 +2500,7 @@ int vfs_nfs_statfs(struct Mount *mountpt, struct statfs *sbp)
error = nfs_checkmount(nmp);
if (error != OK)
{
PRINTK("ERROR: nfs_checkmount failed: %d\n", error);
nfs_debug_error("nfs_checkmount failed: %d\n", error);
goto errout_with_mutex;
}
......@@ -2511,7 +2511,7 @@ int vfs_nfs_statfs(struct Mount *mountpt, struct statfs *sbp)
error = nfs_fsinfo(nmp);
if (error)
{
PRINTK("ERROR: nfs_fsinfo failed: %d\n", error);
nfs_debug_error("nfs_fsinfo failed: %d\n", error);
goto errout_with_mutex;
}
......@@ -2632,7 +2632,7 @@ int vfs_nfs_truncate(struct Vnode *node, off_t length)
if (error != OK)
{
nfs_mux_release(nmp);
PRINTK("ERROR: nfs_request failed: %d\n", error);
nfs_debug_error("nfs_request failed: %d\n", error);
return -error;
}
......@@ -2663,7 +2663,7 @@ static int vfs_nfs_unmount(struct Mount *mnt, struct Vnode **blkDriver)
if (nmp->nm_head != NULL || nmp->nm_dir != NULL)
{
PRINT_ERR("There are open files: %p or directories: %p\n", nmp->nm_head, nmp->nm_dir);
nfs_debug_error("There are open files: %p or directories: %p\n", nmp->nm_head, nmp->nm_dir);
/* This implementation currently only supports unmounting if there are
* no open file references.
......@@ -2678,7 +2678,7 @@ static int vfs_nfs_unmount(struct Mount *mnt, struct Vnode **blkDriver)
error = rpcclnt_umount(nmp->nm_rpcclnt);
if (error)
{
PRINT_ERR("rpcclnt_umount failed: %d\n", error);
nfs_debug_error("rpcclnt_umount failed: %d\n", error);
goto errout_with_mutex;
}
......
......@@ -49,6 +49,7 @@
#include "nfs.h"
#include "nfs_node.h"
#include "xdr_subs.h"
#include "nfs.h"
#undef OK
#define OK 0
......@@ -95,7 +96,7 @@ static inline int nfs_pathsegment(const char **path, char *buffer,
}
else if (nbytes >= NAME_MAX)
{
PRINT_ERR("File name segment is too long: %d\n", *path);
nfs_debug_error("File name segment is too long: %d\n", *path);
return ENAMETOOLONG;
}
else
......@@ -188,7 +189,7 @@ tryagain:
request, reqlen, response, resplen);
if (error != 0)
{
PRINT_ERR("rpcclnt_request failed: %d\n", error);
nfs_error("rpcclnt_request failed: %d\n", error);
return error;
}
......@@ -212,7 +213,7 @@ tryagain:
goto tryagain;
}
PRINT_ERR("NFS error %d from server\n", error);
nfs_debug_error("NFS error %d from server\n", error);
return error;
}
......@@ -251,7 +252,7 @@ int nfs_lookup(struct nfsmount *nmp, const char *filename,
namelen = strlen(filename);
if (namelen > NAME_MAX)
{
PRINT_ERR("Length of the string is too long: %d\n", namelen);
nfs_debug_error("Length of the string is too long: %d\n", namelen);
return E2BIG;
}
......@@ -286,7 +287,7 @@ int nfs_lookup(struct nfsmount *nmp, const char *filename,
if (error)
{
PRINT_ERR("nfs_request failed: %d\n", error);
nfs_debug_error("nfs_request failed: %d\n", error);
return error;
}
......@@ -303,7 +304,7 @@ int nfs_lookup(struct nfsmount *nmp, const char *filename,
value = fxdr_unsigned(uint32_t, value);
if (value > NFSX_V3FHMAX)
{
PRINT_ERR("Bad file handle length: %d\n", value);
nfs_debug_error("Bad file handle length: %d\n", value);
return EIO;
}
......@@ -403,7 +404,7 @@ int nfs_findnode(struct nfsmount *nmp, const char *relpath,
{
/* The filename segment contains is too long. */
PRINT_ERR("nfs_pathsegment of \"%s\" failed after \"%s\": %d\n",
nfs_debug_error("nfs_pathsegment of \"%s\" failed after \"%s\": %d\n",
relpath, buffer, error);
return error;
}
......@@ -413,7 +414,7 @@ int nfs_findnode(struct nfsmount *nmp, const char *relpath,
error = nfs_lookup(nmp, buffer, fhandle, obj_attributes, dir_attributes);
if (error != OK)
{
PRINT_ERR("nfs_lookup of \"%s\" failed at \"%s\": %d\n",
nfs_debug_error("nfs_lookup of \"%s\" failed at \"%s\": %d\n",
relpath, buffer, error);
return error;
}
......@@ -442,7 +443,7 @@ int nfs_findnode(struct nfsmount *nmp, const char *relpath,
{
/* Ooops.. we found something else */
PRINT_ERR("Intermediate segment \"%s\" of \'%s\" is not a directory\n",
nfs_debug_error("Intermediate segment \"%s\" of \'%s\" is not a directory\n",
buffer, path);
return ENOTDIR;
}
......@@ -497,7 +498,7 @@ int nfs_finddir(struct nfsmount *nmp, const char *relpath,
{
/* The filename segment contains is too long. */
PRINT_ERR("nfs_pathsegment of \"%s\" failed after \"%s\": %d\n",
nfs_debug_error("nfs_pathsegment of \"%s\" failed after \"%s\": %d\n",
relpath, filename, error);
return error;
}
......@@ -521,7 +522,7 @@ int nfs_finddir(struct nfsmount *nmp, const char *relpath,
error = nfs_lookup(nmp, filename, fhandle, attributes, NULL);
if (error != OK)
{
PRINT_ERR("fs_lookup of \"%s\" failed at \"%s\": %d\n",
nfs_debug_error("fs_lookup of \"%s\" failed at \"%s\": %d\n",
relpath, filename, error);
return error;
}
......@@ -533,7 +534,7 @@ int nfs_finddir(struct nfsmount *nmp, const char *relpath,
{
/* Ooops.. we found something else */
PRINT_ERR("Intermediate segment \"%s\" of \'%s\" is not a directory\n",
nfs_debug_error("Intermediate segment \"%s\" of \'%s\" is not a directory\n",
filename, path);
return ENOTDIR;
}
......
......@@ -86,6 +86,7 @@
#include "xdr_subs.h"
#include "nfs_proto.h"
#include "rpc.h"
#include "nfs.h"
/****************************************************************************
* Pre-processor Definitions
......@@ -178,7 +179,7 @@ static int rpcclnt_send(struct rpcclnt *rpc, int procid, int prog,
/* psock_sendto failed */
ret = get_errno();
PRINT_ERR("psock_sendto failed: %d\n", ret);
nfs_debug_error("psock_sendto failed: %d\n", ret);
}
return ret;
......@@ -216,13 +217,13 @@ retry:
ret = select(rpc->rc_so + 1, &fdreadset, 0, 0, &timeval);
if (ret == 0)
{
PRINT_DEBUG("ERROR: rpcclnt_receive select nothing\n");
nfs_debug_error("rpcclnt_receive select nothing\n");
return EAGAIN;
}
else if (ret < 0)
{
error = get_errno();
PRINT_DEBUG("ERROR: rpcclnt_receive select error %d\n", error);
nfs_debug_error("rpcclnt_receive select error %d\n", error);
return error;
}
......@@ -230,7 +231,7 @@ retry:
if (nbytes <= (ssize_t)sizeof(xid))
{
error = get_errno();
PRINT_DEBUG("ERROR: psock_recvfrom failed: %d\n", error);
nfs_debug_error("psock_recvfrom failed: %d\n", error);
goto retry;
}
......@@ -242,7 +243,7 @@ retry:
if (fxdr_unsigned(uint32_t, xid) != rpc->xid)
{
PRINT_DEBUG("ERROR: psock_recvfrom a wrong packet\n");
nfs_debug_error("psock_recvfrom a wrong packet\n");
goto retry;
}
......@@ -285,13 +286,13 @@ static int rpcclnt_receive(struct rpcclnt *rpc, struct sockaddr *aname,
ret = select(rpc->rc_so + 1, &fdreadset, 0, 0, &timeval);
if (ret == 0) /* no reply */
{
PRINT_DEBUG("ERROR: rpcclnt_receive select nothing\n");
nfs_debug_error("rpcclnt_receive select nothing\n");
return EAGAIN;
}
else if (ret < 0) /* select error */
{
error = get_errno();
PRINT_DEBUG("ERROR: rpcclnt_receive select error %d\n", error);
nfs_debug_error("rpcclnt_receive select error %d\n", error);
return error;
}
......@@ -299,14 +300,14 @@ static int rpcclnt_receive(struct rpcclnt *rpc, struct sockaddr *aname,
if (nbytes < 0)
{
error = get_errno();
PRINT_DEBUG("ERROR: rpcclnt_receive recvfrom error %d\n", error);
nfs_debug_error("rpcclnt_receive recvfrom error %d\n", error);
return error;
}
else if (nbytes == 0)
{
/* connection closed by peer side */
PRINT_DEBUG("ERROR: rpcclnt_receive connection closed by peer\n");
nfs_debug_error("rpcclnt_receive connection closed by peer\n");
return EIO;
}
else
......@@ -359,7 +360,7 @@ static int rpcclnt_reply(struct rpcclnt *rpc, int procid, int prog,
error = rpcclnt_receive(rpc, rpc->rc_name, procid, prog, reply, resplen);
if (error != 0)
{
PRINT_ERR("rpcclnt_receive returned: %d\n", error);
nfs_debug_error("rpcclnt_receive returned: %d\n", error);
/* For UDP, If we failed because of a timeout, then try sending the CALL
* message again. While for TCP, just return errno.
......@@ -382,7 +383,7 @@ static int rpcclnt_reply(struct rpcclnt *rpc, int procid, int prog,
if (replyheader->rp_direction != rpc_reply)
{
PRINT_ERR("Different RPC REPLY returned\n");
nfs_debug_error("Different RPC REPLY returned\n");
rpc_statistics(rpcinvalid);
error = EPROTO;
}
......@@ -467,7 +468,7 @@ static int rpcclnt_alivecheck(struct rpcclnt *rpc)
ret = select(sockfd + 1, &rfd, NULL, NULL, &timeout);
if (ret < 0)
{
PRINT_DEBUG("ERROR rpc_alivecheck : select failure\n");
nfs_debug_error("rpc_alivecheck : select failure\n");
return get_errno();
}
......@@ -483,7 +484,7 @@ static int rpcclnt_alivecheck(struct rpcclnt *rpc)
}
else
{
PRINT_DEBUG("ERROR rpc_alivecheck : recv unsolocit %d data from server\n", recvlen);
nfs_debug_error("rpc_alivecheck : recv unsolocit %d data from server\n", recvlen);
return ENOTSOCK;
}
}
......@@ -560,7 +561,7 @@ static int rpcclnt_reconnect(struct rpcclnt *rpc, struct sockaddr *saddr)
error = socket(rpc->rc_name->sa_family, rpc->rc_sotype, IPPROTO_TCP);
if (error < 0)
{
PRINT_DEBUG("ERROR: psock_socket failed: %d", get_errno());
nfs_debug_error("psock_socket failed: %d", get_errno());
return -error;
}
......@@ -579,14 +580,14 @@ static int rpcclnt_reconnect(struct rpcclnt *rpc, struct sockaddr *saddr)
if (error < 0)
{
errval = get_errno();
PRINT_DEBUG("ERROR: psock_bind failed: %d\n", errval);
nfs_debug_error("psock_bind failed: %d\n", errval);
}
}
while (errval == EADDRINUSE && trycount > 0);
if (error)
{
PRINT_DEBUG("ERROR: psock_bind failed: %d, port = %d\n", errval, tport);
nfs_debug_error("psock_bind failed: %d, port = %d\n", errval, tport);
goto bad;
}
#endif
......@@ -594,7 +595,7 @@ static int rpcclnt_reconnect(struct rpcclnt *rpc, struct sockaddr *saddr)
if (error < 0)
{
errval = get_errno();
PRINT_DEBUG("ERROR: psock_connect failed [port=%d]: %d\n",
nfs_debug_error("psock_connect failed [port=%d]: %d\n",
ntohs(((struct sockaddr_in *)saddr)->sin_port), errval);
goto bad;
}
......@@ -630,7 +631,7 @@ void rpcclnt_init(void)
rpc_auth_unix = txdr_unsigned(RPCAUTH_UNIX);
rpc_auth_null = txdr_unsigned(RPCAUTH_NULL);
PRINT_INFO("RPC initialized\n");
nfs_debug_info("RPC initialized\n");
}
/****************************************************************************
......@@ -666,7 +667,7 @@ int rpcclnt_connect(struct rpcclnt *rpc)
uint16_t tport = 0;
int errval;
PRINT_INFO("Connecting\n");
nfs_debug_info("Connecting\n");
/* Create the socket */
......@@ -677,7 +678,7 @@ int rpcclnt_connect(struct rpcclnt *rpc)
error = socket(saddr->sa_family, rpc->rc_sotype, NFS_PROTOTYPE);
if (error < 0)
{
PRINT_DEBUG("ERROR: psock_socket failed: %d", get_errno());
nfs_debug_error("psock_socket failed: %d", get_errno());
return -error;
}
......@@ -697,14 +698,14 @@ int rpcclnt_connect(struct rpcclnt *rpc)
if (error < 0)
{
errval = get_errno();
PRINT_ERR("psock_bind failed: %d\n", errval);
nfs_debug_error("psock_bind failed: %d\n", errval);
}
}
while (errval == EADDRINUSE && trycount > 0);
if (error)
{
PRINT_ERR("psock_bind failed: %d, port = %d\n", errval, tport);
nfs_debug_error("psock_bind failed: %d, port = %d\n", errval, tport);
goto bad;
}
......@@ -717,7 +718,7 @@ int rpcclnt_connect(struct rpcclnt *rpc)
if (error < 0)
{
error = get_errno();
PRINT_ERR("psock_connect to PMAP port failed: %d", error);
nfs_debug_error("psock_connect to PMAP port failed: %d", error);
goto bad;
}
......@@ -735,7 +736,7 @@ int rpcclnt_connect(struct rpcclnt *rpc)
(void *)&response.rdata, sizeof(struct rpc_reply_pmap));
if (error != 0)
{
PRINT_ERR("rpcclnt_request failed: %d\n", error);
nfs_error("rpcclnt_request failed: %d\n", error);
goto bad;
}
......@@ -745,7 +746,7 @@ int rpcclnt_connect(struct rpcclnt *rpc)
error = rpcclnt_reconnect(rpc, saddr);
if (error != 0)
{
PRINT_DEBUG("ERROR: rpcclnt_reconnect failed: %d\n", error);
nfs_error("rpcclnt_reconnect failed: %d\n", error);
goto bad;
}
......@@ -773,14 +774,14 @@ int rpcclnt_connect(struct rpcclnt *rpc)
sizeof(struct rpc_reply_mount));
if (error != 0)
{
PRINT_ERR("rpcclnt_request failed: %d\n", error);
nfs_error("rpcclnt_request failed: %d\n", error);
goto bad;
}
error = fxdr_unsigned(uint32_t, response.mdata.mount.status);
if (error != 0)
{
PRINT_ERR("Bad mount status: %d\n", error);
nfs_debug_error("Bad mount status: %d\n", error);
goto bad;
}
......@@ -796,7 +797,7 @@ int rpcclnt_connect(struct rpcclnt *rpc)
error = rpcclnt_reconnect(rpc, saddr);
if (error != 0)
{
PRINT_DEBUG("ERROR: rpcclnt_reconnect failed: %d\n", error);
nfs_error("rpcclnt_reconnect failed: %d\n", error);
goto bad;
}
......@@ -812,7 +813,7 @@ int rpcclnt_connect(struct rpcclnt *rpc)
sizeof(struct rpc_reply_pmap));
if (error != 0)
{
PRINT_ERR("rpcclnt_request failed: %d\n", error);
nfs_error("rpcclnt_request failed: %d\n", error);
goto bad;
}
......@@ -821,7 +822,7 @@ int rpcclnt_connect(struct rpcclnt *rpc)
error = rpcclnt_reconnect(rpc, saddr);
if (error != 0)
{
PRINT_DEBUG("ERROR: rpcclnt_reconnect failed: %d\n", error);
nfs_error("rpcclnt_reconnect failed: %d\n", error);
goto bad;
}
......@@ -888,7 +889,7 @@ int rpcclnt_umount(struct rpcclnt *rpc)
error = rpcclnt_reconnect(rpc, saddr);
if (error != 0)
{
PRINT_DEBUG("ERROR: rpcclnt_reconnect failed: %d\n", error);
nfs_error("rpcclnt_reconnect failed: %d\n", error);
goto bad;
}
......@@ -904,7 +905,7 @@ int rpcclnt_umount(struct rpcclnt *rpc)
sizeof(struct rpc_reply_pmap));
if (error != 0)
{
PRINT_ERR("rpcclnt_request failed: %d\n", error);
nfs_error("rpcclnt_request failed: %d\n", error);
goto bad;
}
......@@ -913,7 +914,7 @@ int rpcclnt_umount(struct rpcclnt *rpc)
error = rpcclnt_reconnect(rpc, saddr);
if (error != 0)
{
PRINT_DEBUG("ERROR: rpcclnt_reconnect failed: %d\n", error);
nfs_error("rpcclnt_reconnect failed: %d\n", error);
goto bad;
}
......@@ -931,7 +932,7 @@ int rpcclnt_umount(struct rpcclnt *rpc)
sizeof(struct rpc_reply_umount));
if (error != 0)
{
PRINT_ERR("rpcclnt_request failed: %d\n", error);
nfs_error("rpcclnt_request failed: %d\n", error);
goto bad;
}
......@@ -1004,7 +1005,7 @@ int rpcclnt_request(struct rpcclnt *rpc, int procnum, int prog,
error = rpcclnt_send(rpc, procnum, prog, request, reqlen);
if (error != OK)
{
PRINT_INFO("ERROR rpcclnt_send failed: %d\n", error);
nfs_debug_info("ERROR rpcclnt_send failed: %d\n", error);
}
/* Wait for the reply from our send */
......@@ -1014,7 +1015,7 @@ int rpcclnt_request(struct rpcclnt *rpc, int procnum, int prog,
error = rpcclnt_reply(rpc, procnum, prog, response, resplen);
if (error != OK)
{
PRINT_INFO("ERROR rpcclnt_reply failed: %d\n", error);
nfs_debug_info("ERROR rpcclnt_reply failed: %d\n", error);
}
}
......@@ -1024,7 +1025,7 @@ int rpcclnt_request(struct rpcclnt *rpc, int procnum, int prog,
if (error != OK)
{
PRINT_ERR("RPC failed: %d\n", error);
nfs_debug_error("RPC failed: %d\n", error);
return error;
}
......@@ -1037,7 +1038,7 @@ int rpcclnt_request(struct rpcclnt *rpc, int procnum, int prog,
error = rpcclnt_alivecheck(rpc);
if (error != OK)
{
PRINT_DEBUG("ERROR rpc_alivecheck failed: %d\n", error);
nfs_debug_error("rpc_alivecheck failed: %d\n", error);
return error;
}
}
......@@ -1049,7 +1050,7 @@ int rpcclnt_request(struct rpcclnt *rpc, int procnum, int prog,
error = rpcclnt_reconnect(rpc, rpc->rc_name);
if (error != OK)
{
PRINT_DEBUG("ERROR rpcclnt_send failed: %d\n", error);
nfs_debug_error("rpcclnt_send failed: %d\n", error);
return error;
}
}
......@@ -1062,7 +1063,7 @@ int rpcclnt_request(struct rpcclnt *rpc, int procnum, int prog,
if (error != OK)
{
rpcclnt_disconnect(rpc);
PRINT_DEBUG("ERROR rpcclnt_send failed: %d\n", error);
nfs_debug_error("rpcclnt_send failed: %d\n", error);
return error;
}
......@@ -1072,7 +1073,7 @@ int rpcclnt_request(struct rpcclnt *rpc, int procnum, int prog,
if (error != OK)
{
rpcclnt_disconnect(rpc);
PRINT_DEBUG("ERROR rpcclnt_reply failed: %d\n", error);
nfs_debug_error("rpcclnt_reply failed: %d\n", error);
return error;
}
......@@ -1089,11 +1090,11 @@ int rpcclnt_request(struct rpcclnt *rpc, int procnum, int prog,
switch (tmp)
{
case RPC_MISMATCH:
PRINT_ERR("RPC_MSGDENIED: RPC_MISMATCH error\n");
nfs_debug_error("RPC_MSGDENIED: RPC_MISMATCH error\n");
return EOPNOTSUPP;
case RPC_AUTHERR:
PRINT_ERR("RPC_MSGDENIED: RPC_AUTHERR error\n");
nfs_debug_error("RPC_MSGDENIED: RPC_AUTHERR error\n");
return EACCES;
default:
......@@ -1108,16 +1109,16 @@ int rpcclnt_request(struct rpcclnt *rpc, int procnum, int prog,
tmp = fxdr_unsigned(uint32_t, replymsg->status);
if (tmp == RPC_SUCCESS)
{
PRINT_INFO("RPC_SUCCESS\n");
nfs_debug_info("RPC_SUCCESS\n");
}
else if (tmp == RPC_PROGMISMATCH)
{
PRINT_ERR("RPC_MSGACCEPTED: RPC_PROGMISMATCH error\n");
nfs_debug_error("RPC_MSGACCEPTED: RPC_PROGMISMATCH error\n");
return EOPNOTSUPP;
}
else if (tmp > 5)
{
PRINT_ERR("Unsupported RPC type: %d\n", tmp);
nfs_debug_error("Unsupported RPC type: %d\n", tmp);
return EOPNOTSUPP;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册