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:13 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2014-02-10 09:02:21 +0100
commit3ea30d9ce892a66d5161acd8afb24b755e3f2045 (patch)
treee2ae37aadce7f986fc3d8015b942746b52b9da3b /fs/nfs.c
parentf97f4b6571d1297973f08b9f921778e0b2e7f064 (diff)
downloadbarebox-3ea30d9ce892a66d5161acd8afb24b755e3f2045.tar.gz
barebox-3ea30d9ce892a66d5161acd8afb24b755e3f2045.tar.xz
nfs: parse nfsport and mount port from file system options
This allows to use unfs3 on the server side which doesn't integrate into portmap/rpcbind which results in the port not being impossible to lookup via rpc calls to the portmap program. Use it like: mount -t nfs -o port=2703,mountport=2703 192.168.77.157:/root /mnt/nfs 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.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/fs/nfs.c b/fs/nfs.c
index ab33c91ef0..046cd4d76c 100644
--- a/fs/nfs.c
+++ b/fs/nfs.c
@@ -36,6 +36,8 @@
#include <sizes.h>
#include <byteorder.h>
+#include "parseopt.h"
+
#define SUNRPC_PORT 111
#define PROG_PORTMAP 100000
@@ -1339,19 +1341,27 @@ static int nfs_probe(struct device_d *dev)
/* Need a priviliged source port */
net_udp_bind(npriv->con, 1000);
- ret = rpc_lookup_req(npriv, PROG_MOUNT, 3);
- if (ret < 0) {
- printf("lookup mount port failed with %d\n", ret);
- goto err2;
+ parseopt_hu(fsdev->options, "mountport", &npriv->mount_port);
+ if (!npriv->mount_port) {
+ ret = rpc_lookup_req(npriv, PROG_MOUNT, 3);
+ if (ret < 0) {
+ printf("lookup mount port failed with %d\n", ret);
+ goto err2;
+ }
+ npriv->mount_port = ret;
}
- npriv->mount_port = ret;
-
- ret = rpc_lookup_req(npriv, PROG_NFS, 3);
- if (ret < 0) {
- printf("lookup nfs port failed with %d\n", ret);
- goto err2;
+ debug("mount port: %hu\n", npriv->mount_port);
+
+ parseopt_hu(fsdev->options, "port", &npriv->nfs_port);
+ if (!npriv->nfs_port) {
+ ret = rpc_lookup_req(npriv, PROG_NFS, 3);
+ if (ret < 0) {
+ printf("lookup nfs port failed with %d\n", ret);
+ goto err2;
+ }
+ npriv->nfs_port = ret;
}
- npriv->nfs_port = ret;
+ debug("nfs port: %d\n", npriv->nfs_port);
ret = nfs_mount_req(npriv);
if (ret) {