You could write a short program yourself to do the mounting, if you have a
compiler handy. (And you probably do; a minimal compiler setup is typically
available during the boot process nowadays in case there's an unexpected change
to system hardware and there's a need to recompile a kernel module in order to
boot the system.) The syscall is used much the same way that the command-line
function is used, you just have to deal with a C-like rather than textual
API. The command-line tool is basically just argument-parsing (which you
don't need if you're writing a program to do one specific mount), maintaining
the fstab (not crucial, especially if you're doing things by hand; you can use
/proc/mounts instead), and handling special cases that aren't needed in the
basic case of just mounting a filesystem to get the system
running. There's still a lot of stuff going on in mount(8) (for people
unaware of standard Linux/UNIX naming, the (8) indicates a command-line tool for
use in system administration, and refers to chapter 8 of the original manual)
that isn't part of the trivial system call; it's understandable why someone
might want to copy it rather than replicating it. I don't see an obvious reason
why, if you wanted to add a closed-source filesystem to Linux without breaking
any laws, you wouldn't just write a driver for the kernel and let the standard
mount command in util-linux talk to it, though. (It probably wouldn't need
modification; it's designed to be generic enough to handle filesystems it wasn't
programmed to know about unless they're very weird, and even for the ones
that are, it can act as a front end and call another program as its
backend.) [ Reply to This | Parent | # ]
|