mount system call

Hi all,

I want to use the mount system call in my application to mount NFS and
CIFS filesystems.
What are the arguments of

mount (const char* /spec/, const char* /dir/, int /flags/, const char*
/type/, const void* data, /int /datalen )

in these cases ?
I guess that ‘spec’ is NULL, ‘dir’ is the mounting point, type is “nfs”
or “cifs” but what I need to put in flags and data ?

How can I known the mounted filesystems by program ?

I can’t find anything related to these topics in documentation.

Best regards.
Pierre

If you assume that fs-nfs3 or fs-cifs is running, then the call is pretty
straightforward.

For nfs
mStat = mount(“exported directory”,
“mount point”,
_MOUNT_ENUMERATE ,
“nfs”,
“ver3”,
-1);
I use _MOUNT_ENUMERATE to autodetect.
The cifs version should be similar.

I’d like to see the answer to part 2. I just use access() to see if the
files I expect to have mounted are there.

“Pierre AUBERT” <p.aubert@staubli.com> wrote in message
news:bk9890$dai$1@inn.qnx.com

Hi all,

I want to use the mount system call in my application to mount NFS and
CIFS filesystems.
What are the arguments of

mount (const char* /spec/, const char* /dir/, int /flags/, const char*
/type/, const void* data, /int /datalen )

in these cases ?
I guess that ‘spec’ is NULL, ‘dir’ is the mounting point, type is “nfs”
or “cifs” but what I need to put in flags and data ?

How can I known the mounted filesystems by program ?

I can’t find anything related to these topics in documentation.

Best regards.
Pierre

Pierre AUBERT wrote:

Hi all,

I want to use the mount system call in my application to mount NFS and
CIFS filesystems.
What are the arguments of

mount (const char* /spec/, const char* /dir/, int /flags/, const char*
/type/, const void* data, /int /datalen )

in these cases ?

spec is the machine and export you wish to mount, ie
//netbiosname:ipaddr:/export (for a cifs mount)

dir is the directory where you wish it to be mounted

flags are any control flags you wish to use for the mounting, as
described in our online documentation:

http://www.qnx.com/developer/docs/momentics621_docs/neutrino/lib_ref/m/mount.html

type would be “cifs” or “nfs”

data and datalen are any options you wish to pass to the mount. For
example, if you’re doing a cifs mount, a good data would be “-o
login,password”.


Cheers,
-Barry

Barry Beldam wrote:

Pierre AUBERT wrote:

spec is the machine and export you wish to mount, ie
//netbiosname:ipaddr:/export (for a cifs mount)

dir is the directory where you wish it to be mounted

flags are any control flags you wish to use for the mounting, as
described in our online documentation:

http://www.qnx.com/developer/docs/momentics621_docs/neutrino/lib_ref/m/mount.html

type would be “cifs” or “nfs”

data and datalen are any options you wish to pass to the mount. For
example, if you’re doing a cifs mount, a good data would be “-o
login,password”.

Thank you very much for this answer, it works. Thanks also to David for

his answer.

Now, I’d like to know how to get the list of the mounted filesystems
inside of a program ?

Best regards

Pierre AUBERT <p.aubert@staubli.com> wrote:

Now, I’d like to know how to get the list of the mounted filesystems
inside of a program ?

popen(“df”) is probably the only documented way; there is an
undocumented interface via “/proc/mount/” if you are keen/brave
and willing to experiment …

John Garvey wrote:

Pierre AUBERT <> p.aubert@staubli.com> > wrote:


Now, I’d like to know how to get the list of the mounted filesystems
inside of a program ?



popen(“df”) is probably the only documented way;

If I must use a popen, I think it’s better to use a popen(“mount”) …



there is an
undocumented interface via “/proc/mount/” if you are keen/brave
and willing to experiment …



Why not. I’ve tried a ls -l /proc/mount. What is the meaning of the

differents fields in
entries like
0,1,1,10,11
0,1,1,11,0
0,1,1,2,-1
0,1,1,3,-1
0,118800,1,0,4
0,122897,7,0,11
0,16394,1,0,11
0,40971,1,0,11
0,4100,4,0,11
0,4100,4,3,0
0,557079,1,0,11

Can you explain a little how to decode entries in /proc/mount ?


Best regards

These are node/pid/chid/handle/file type of the manager who is attached that
path.

-xtang

Pierre AUBERT <p.aubert@staubli.com> wrote in message
news:bkf1cf$i4o$1@inn.qnx.com

Why not. I’ve tried a ls -l /proc/mount. What is the meaning of the
differents fields in
entries like
0,1,1,10,11
0,1,1,11,0
0,1,1,2,-1
0,1,1,3,-1
0,118800,1,0,4
0,122897,7,0,11
0,16394,1,0,11
0,40971,1,0,11
0,4100,4,0,11
0,4100,4,3,0
0,557079,1,0,11

Can you explain a little how to decode entries in /proc/mount ?


Best regards

David Kuechenmeister wrote:

For nfs
mStat = mount(“exported directory”,
“mount point”,
_MOUNT_ENUMERATE ,
“nfs”,
“ver3”,
-1);
I use _MOUNT_ENUMERATE to autodetect.
The cifs version should be similar.

What would be the right call to mount a protocol like ‘npm-qnet.so’?

I tried several things, but I didn’t succeed … here’s my last try:

rc = mount ( “/lib/dll/npm-qnet.so”, NULL, 0, “io-net”,“host=myname”, -1 );

but I always get ‘Invalid argument’ as error code.


Thanks for any help!

Karsten.


| / | __ ) | Karsten.Hoffmann@mbs-software.de MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|| ||// Mobile: +49-172-3812373 D-47809 Krefeld

Karsten P. Hoffmann wrote:

What would be the right call to mount a protocol like ‘npm-qnet.so’?

I tried several things, but I didn’t succeed … here’s my last try:

rc = mount ( “/lib/dll/npm-qnet.so”, NULL, 0, “io-net”,“host=myname”, -1
);

I got an reply from someone in a forum on ‘www.openqnx.com’ (great thing,
though I hate HTML based BBSs :wink: ):

The right call would be:

rc = mount ( “/lib/dll/npm-qnet.so”, “/”, _MFLAGS_OCB, “io-net”,
“host=myname”, -1);

Since this is not very ‘intuitive’, I’ll try to recommend QSSL to append
a similar example to their ‘mount()’-doc …


| / | __ ) | Karsten.Hoffmann@mbs-software.de MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|| ||// Mobile: +49-172-3812373 D-47809 Krefeld