On 17:40 Thu 06 Feb , Uwe Kleine-K??nig wrote: > 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@xxxxxxxxxxxxxx> > --- > fs/nfs.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++----------- > 1 file changed, 51 insertions(+), 11 deletions(-) > > diff --git a/fs/nfs.c b/fs/nfs.c > index 8eec63078dd3..50b3744b4551 100644 > --- a/fs/nfs.c > +++ b/fs/nfs.c > @@ -1305,6 +1305,38 @@ static int nfs_stat(struct device_d *dev, const char *filename, struct stat *s) > } > } > > +static void parseopt_hu(const char *options, const char *opt, > + unsigned short *val) > +{ > + const char *start; > + size_t optlen = strlen(opt); > + ulong v; > + char *endp; > + > +again: > + start = strstr(options, opt); > + > + if (!start) > + return; > + > + if (start > options && start[-1] != ',') { > + options = start; > + goto again; > + } > + > + if (start[optlen] != '=') { > + options = start; > + goto again; > + } > + > + v = simple_strtoul(start + optlen + 1, &endp, 0); > + if (v > USHORT_MAX) > + return; > + > + if (*endp == ',' || *endp == '\0') > + *val = v; > +} this should be global > + > static int nfs_probe(struct device_d *dev) > { > struct fs_device_d *fsdev = dev_to_fs_device(dev); > @@ -1340,19 +1372,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, 1); > - 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, 1); > + 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) { > -- > 1.8.5.2 > > > _______________________________________________ > barebox mailing list > barebox@xxxxxxxxxxxxxxxxxxx > http://lists.infradead.org/mailman/listinfo/barebox _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox