If a mount helper is used, only argopts (given on commandline) are
passed to the helper via -o parameter. Option strings from fstab are
ignored.
This patch replaces global argopts pointer with a character array
fsopts. A maximum length for filesytem options is #defined (used by
fsopts and data), and argument/mntent options are length-checked to fit.
A filesystem with too long an option string will print an error, cause
mount to exit with an error status, and not attempt to mount the
filesystem. This obviates the need for overflow checking of data in
parseopts(), though it hasn't been removed.
To be honest, I had a little misunderstanding of the fallocate(1)-
utility.
It turns out that it only adds preallocated space if the length
exceeds the size of an already existing file.
No truncation happens.
Thus, I fixed the wording accordingly.
1) Simplify the manpage. Just refer to fallocate(2) and stop trying
to list supported file systems. This can change and everbody
with common sense can bring up the relevant manpages of a given
operating system himself.
Use the num-semantics.
2) Use estrtonum() instead of estrtol().
3) Allow multiple arguments.
Reword manpage to be more general (you do not only eject CD-ROM-drives,
but BluRay-drives, floppy drives, LaserDisk-readers, toaster, whatever).
Allow to specify multiple devices in the command line. Doesn't add
LOC (the few more lines added are due to stricter error-checking)
and might become handy for somebody in the future while not
breaking scripts that assume only one argument.
Crying like GNU coreutils when more than one device is given is
not suckless:
$ eject /dev/sr0 /dev/sr1
eject: too many arguments
- helper support (mount.type).
- helpers need to be in $PATH, if needed we can add a check for
/sbin/mount.XXXX
- pass -B, -M, -R to helper, its more reliable to pass these named
options with -o however.
- allow prefix "no" for which type no action should be taken:
mount -a -t nonfs,ext4
fix bugs:
- dont modify me->mnt_opts (used strtok).
rule to make ubase-box and setup symlinks for $BIN
some (maybe) interesting info:
$ make LDFLAGS="-s -static" CFLAGS="-Os" PREFIX=/ DESTDIR=`pwd`/static-normal install
$ make LDFLAGS="-s -static" CFLAGS="-Os" PREFIX=/ DESTDIR=`pwd`/static-box ubase-box-install
$ du -sk static-normal/ static-box
1776 static-normal
356 static-box
- use getmntent_r instead of getmntent: because getmntent was nested it
overwrote the previous internal mntent structure.
- check mounted() first, if not try to mount: this also makes sure filesystems
were not mounted multiple times (like tmpfs) and errno is not overwritten in
mounted(). For this reason also mount() errno EBUSY can't be used (tested).