summaryrefslogtreecommitdiffstats
path: root/fs/nfs.c
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2014-02-07 22:28:07 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2014-02-10 09:02:20 +0100
commit0f2c0a7edd5073162f0206ccde18304b7876f1b1 (patch)
treef3501cb68ec5fc49721e6e7d375a124559afe0a7 /fs/nfs.c
parent2897531de67756b1b359cc5c91a27970cd189086 (diff)
downloadbarebox-0f2c0a7edd5073162f0206ccde18304b7876f1b1.tar.gz
barebox-0f2c0a7edd5073162f0206ccde18304b7876f1b1.tar.xz
nfs: simplify rpc_lookup_req
Instead of letting rpc_lookup_req set mount_port and nfs_port, let it return the port found and let the caller use that information. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs/nfs.c')
-rw-r--r--fs/nfs.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/fs/nfs.c b/fs/nfs.c
index 54dda261c0..761bfd6267 100644
--- a/fs/nfs.c
+++ b/fs/nfs.c
@@ -374,22 +374,8 @@ static int rpc_lookup_req(struct nfs_priv *npriv, int prog, int ver)
if (ret)
return ret;
- port = net_read_uint32((uint32_t *)(nfs_packet + sizeof(struct rpc_reply)));
-
- switch (prog) {
- case PROG_MOUNT:
- npriv->mount_port = ntohl(port);
- debug("mount port: %d\n", npriv->mount_port);
- break;
- case PROG_NFS:
- npriv->nfs_port = ntohl(port);
- debug("nfs port: %d\n", npriv->nfs_port);
- break;
- default:
- return -EINVAL;
- }
-
- return 0;
+ port = ntohl(net_read_uint32(nfs_packet + sizeof(struct rpc_reply)));
+ return port;
}
/*
@@ -1000,16 +986,18 @@ static int nfs_probe(struct device_d *dev)
net_udp_bind(npriv->con, 1000);
ret = rpc_lookup_req(npriv, PROG_MOUNT, 2);
- if (ret) {
+ if (ret < 0) {
printf("lookup mount port failed with %d\n", ret);
goto err2;
}
+ npriv->mount_port = ret;
ret = rpc_lookup_req(npriv, PROG_NFS, 2);
- if (ret) {
+ if (ret < 0) {
printf("lookup nfs port failed with %d\n", ret);
goto err2;
}
+ npriv->nfs_port = ret;
ret = nfs_mount_req(npriv);
if (ret) {