aboutsummaryrefslogtreecommitdiff
path: root/util-linux/mount.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-11-10 16:53:35 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2011-11-10 16:53:35 +0100
commita86e02492d7700ce8cb4108f53646dfb025c2dff (patch)
treef14b9aa002cec6351214bbfccdd49bf4a1de9c59 /util-linux/mount.c
parentfae473c81b98a1b2290b7efcd4ee9a8ebbb3b1e6 (diff)
downloadbusybox-w32-a86e02492d7700ce8cb4108f53646dfb025c2dff.tar.gz
busybox-w32-a86e02492d7700ce8cb4108f53646dfb025c2dff.tar.bz2
busybox-w32-a86e02492d7700ce8cb4108f53646dfb025c2dff.zip
mount: make FEATURE_MOUNT_NFS not needed for Linux 2.6.23+
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/mount.c')
-rw-r--r--util-linux/mount.c47
1 files changed, 41 insertions, 6 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 1dd4c0c43..7ae1981c8 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -1144,7 +1144,7 @@ static NOINLINE int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
1144 pathname = s + 1; 1144 pathname = s + 1;
1145 *s = '\0'; 1145 *s = '\0';
1146 /* Ignore all but first hostname in replicated mounts 1146 /* Ignore all but first hostname in replicated mounts
1147 until they can be fully supported. (mack@sgi.com) */ 1147 * until they can be fully supported. (mack@sgi.com) */
1148 s = strchr(hostname, ','); 1148 s = strchr(hostname, ',');
1149 if (s) { 1149 if (s) {
1150 *s = '\0'; 1150 *s = '\0';
@@ -1683,7 +1683,6 @@ static NOINLINE int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
1683 1683
1684 /* Perform actual mount */ 1684 /* Perform actual mount */
1685 do_mount: 1685 do_mount:
1686 mp->mnt_type = (char*)"nfs";
1687 retval = mount_it_now(mp, vfsflags, (char*)&data); 1686 retval = mount_it_now(mp, vfsflags, (char*)&data);
1688 goto ret; 1687 goto ret;
1689 1688
@@ -1708,8 +1707,43 @@ static NOINLINE int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
1708 1707
1709#else // !ENABLE_FEATURE_MOUNT_NFS 1708#else // !ENABLE_FEATURE_MOUNT_NFS
1710 1709
1711// Never called. Call should be optimized out. 1710/* Linux 2.6.23+ supports nfs mounts with options passed as a string.
1712int nfsmount(struct mntent *mp, long vfsflags, char *filteropts); 1711 * For older kernels, you must build busybox with ENABLE_FEATURE_MOUNT_NFS.
1712 * (However, note that then you lose any chances that NFS over IPv6 would work).
1713 */
1714static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
1715{
1716 len_and_sockaddr *lsa;
1717 char *opts;
1718 char *end;
1719 char *dotted;
1720 int ret;
1721
1722# if ENABLE_FEATURE_IPV6
1723 end = strchr(mp->mnt_fsname, ']');
1724 if (end && end[1] == ':')
1725 end++;
1726 else
1727# endif
1728 /* mount_main() guarantees that ':' is there */
1729 end = strchr(mp->mnt_fsname, ':');
1730
1731 *end = '\0';
1732 lsa = xdotted2sockaddr(mp->mnt_fsname, /*port:*/ 0);
1733 *end = ':';
1734 dotted = xmalloc_sockaddr2dotted_noport(&lsa->u.sa);
1735 if (ENABLE_FEATURE_CLEAN_UP) free(lsa);
1736 opts = xasprintf("%s%saddr=%s",
1737 filteropts ? filteropts : "",
1738 filteropts ? "," : "",
1739 dotted
1740 );
1741 if (ENABLE_FEATURE_CLEAN_UP) free(dotted);
1742 ret = mount_it_now(mp, vfsflags, opts);
1743 if (ENABLE_FEATURE_CLEAN_UP) free(opts);
1744
1745 return ret;
1746}
1713 1747
1714#endif // !ENABLE_FEATURE_MOUNT_NFS 1748#endif // !ENABLE_FEATURE_MOUNT_NFS
1715 1749
@@ -1800,10 +1834,11 @@ static int singlemount(struct mntent *mp, int ignore_busy)
1800 } 1834 }
1801 1835
1802 // Might this be an NFS filesystem? 1836 // Might this be an NFS filesystem?
1803 if (ENABLE_FEATURE_MOUNT_NFS 1837 if ((!mp->mnt_type || strncmp(mp->mnt_type, "nfs", 3) == 0)
1804 && (!mp->mnt_type || strcmp(mp->mnt_type, "nfs") == 0)
1805 && strchr(mp->mnt_fsname, ':') != NULL 1838 && strchr(mp->mnt_fsname, ':') != NULL
1806 ) { 1839 ) {
1840 if (!mp->mnt_type)
1841 mp->mnt_type = (char*)"nfs";
1807 rc = nfsmount(mp, vfsflags, filteropts); 1842 rc = nfsmount(mp, vfsflags, filteropts);
1808 goto report_error; 1843 goto report_error;
1809 } 1844 }