Traditionally the mount command has looked for a ":" to separate the
authorChuck Lever <chuck.lever@oracle.com>
Tue, 15 Jul 2008 17:51:07 +0000 (13:51 -0400)
committerSteve Dickson <steved@redhat.com>
Tue, 15 Jul 2008 17:51:07 +0000 (13:51 -0400)
commit1d61a1116198714f50b081daecc663625124403d
treebdf3566279bd8a12821dc7547f9685882d32e7f4
parent586a66451679e25c47cb8cd65a0c6a0c44148920
Traditionally the mount command has looked for a ":" to separate the
server's hostname from the export path in the mounted on device name,
like this:

 mount server:/export /mounted/on/dir

The server's hostname is "server" and the export path is "/export".

You can also substitute a specific IPv4 network address for the server
hostname, like this:

 mount 192.168.0.55:/export /mounted/on/dir

Raw IPv6 addresses present a problem, however, because they look something
like this:

 fe80::200:5aff:fe00:30b

Note the use of colons.

To get around the presence of colons, copy the Solaris convention used for
raw NFS server IPv6 addresses, which is to wrap the raw IPv6 address with
square brackets.  This is also suggested in RFC 4038.

Introduce a new device name parser that can support traditional device
names and square brackets.  Place the parser in a separate source file
so both the mount and umount paths can derive the server's hostname and
export pathname the same way.

Bonus points: add a check for NFS URLs and display an appropriate error
message in that case.  This is cleaner than failing with "unknown host:
nfs".

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/mount/Makefile.am
utils/mount/nfsumount.c
utils/mount/parse_dev.c [new file with mode: 0644]
utils/mount/parse_dev.h [new file with mode: 0644]
utils/mount/stropts.c