Discussion:
mount system call for nullfs
Alfonso Sabato Siciliano
2018-04-13 01:30:32 UTC
Permalink
Hello,

I would use "mount" system call

int mount(const char *type, const char *dir, int flags, void *data);

to mount a nullfs, the problem is about *data;

Where can I find docs? Example? Code?

(the implementation of mount_nullfs(8) uses nmount syscall so it is not
usefulI;

I put a string "/mount_from_dir" then errno = 45, so I think it should be a
struct)

Thanks
Alfonso
Theron Tarigo
2018-04-13 02:30:17 UTC
Permalink
Post by Alfonso Sabato Siciliano
Hello,
I would use "mount" system call
int mount(const char *type, const char *dir, int flags, void *data);
to mount a nullfs, the problem is about *data;
Where can I find docs? Example? Code?
Hi Alfonso,

The MOUNT(2) manual says:

     The data argument is a pointer to a structure that contains the type
     specific arguments to mount.  The format for these argument
structures is
     described in the manual page for each file system.  By convention file
     system manual pages are named by prefixing ``mount_'' to the name
of the
     file system as returned by lsvfs(1).  Thus the NFS file system is
     described by the mount_nfs(8) manual page.  It should be noted that a
     manual page for default file systems, known as UFS and UFS2, does not
     exist.

Try looking at /usr/src/sbin/mount_nullfs/ for example.

Cheers,
Theron
Theron Tarigo
2018-04-13 02:40:05 UTC
Permalink
Post by Alfonso Sabato Siciliano
(the implementation of mount_nullfs(8) uses nmount syscall so it is not
usefulI;
Why would mount instead of nmount be more useful?

/usr/src/sbin/mount/mount.c notes that

        /* XXX: We need to get away from implementing external mount
         *      programs for every filesystem, and move towards having
         *      each filesystem properly implement the nmount() system
call.
         */

It might be that mount_nullfs only works at the moment with the
nmount-based implementation, in which case you would need to work around
this.
alfix86
2018-04-19 15:20:23 UTC
Permalink
Post by Alfonso Sabato Siciliano
I would use "mount" system call
int mount(const char *type, const char *dir, int flags, void *data);
to mount a nullfs, the problem is about *data;
Where can I find docs? Example? Code?
I solved,
The *data [0] was in FreeBSD4:

struct null_args {
char *target; /* Target of loopback */
};

but was deleted [1], so I'll use nmount

[0] http://fxr.watson.org/fxr/source/miscfs/nullfs/null.h?v=FREEBSD4
[1] https://svnweb.freebsd.org/base/head/sys/fs/nullfs/null.h?r1=65467&r2=97186
--
alfix86 <***@gmail.com>
Theron Tarigo
2018-04-19 23:34:21 UTC
Permalink
On 04/19/18 11:20, alfix86 wrote:
...
Post by alfix86
but was deleted [1], so I'll use nmount
[0] http://fxr.watson.org/fxr/source/miscfs/nullfs/null.h?v=FREEBSD4
[1] https://svnweb.freebsd.org/base/head/sys/fs/nullfs/null.h?r1=65467&r2=97186
There is in fact a suggestion that mount() system call be removed entirely:
https://wiki.freebsd.org/IdeasPage#Userspace_mount.28.29_implementation
Loading...