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>