Files
alcove/bin
Michael Santos 244c4f6285 Support mount(2) on Solaris
Mount filesystems using the Solaris-specific version of the mount
interface. Solaris adds an options and options length parameter to
mount which takes a NULL terminated string of comma separated arguments.

On other Unix'es the options are either included in the mount flags
(MS_NOEXEC, ...) or in the data argument (<<"size=128M">> for tmpfs).

The behaviour of mount(2) on Solaris is bizarre: the options argument is
input/output, with the mount options placed in the buffer on return.

If the MS_OPTIONSTR is present in the mount flags and the options buffer
is too small, the mount call returns -1 and ERRNO is set to EOVERFLOW
but the mount actually succeeds! A more robust interface might truncate
the options to the size of the buffer, possibly seting the options
length to the required length and return 0.

Surprisingly, the options buffer can also be too large. This is so
weird, it must be a bug in alcove. If the buffer exceeds a certain size,
mount returns -1 with ERRNO set to EINVAL. The mount fails in this case:

    {error,einval} = alcove:mount(Drv, [Child], "swap", Dir, "tmpfs",
            [ms_optionstr], <<>>, <<"size=16m", 0:(1024*8)>>).

Since Solaris has this extra argument, mount/6,7 has to be extended to
mount/7,8, forcing all platforms to pass in an options parameter. This
parameter is ignored on all platforms except Solaris. The result is that
the mount interface is not the Linux mount(2) interface, it is some weird
hybrid that is awkward to use on all platforms (the interface does not
map to the mount(2) man page on any platform).

The value of the option parameter is also not returned to the caller on
Solaris. Options to fix this include:

* breaking out Solaris mount(2) to a Solaris specific call (mountext or
  whatever)

* checking if opt is non-NULL on return and opt len > 0. If so, return:

    {ok, binary()}

  This extends the mount/7,8 type to:

    ok | {ok,binary()} | {error,posix()}
2014-10-26 10:42:54 -04:00
..
2014-10-17 12:01:09 -04:00
2014-10-26 10:42:54 -04:00