VFS and mount

VFS and mount

Post by Petric Fran » Thu, 14 Jun 2001 08:58:39



Hello,

i am writing a filesystem driver (vfs).
I am getting it working with hardcoded values.

i can do a
  mount -t <filesystem type> anything <mountpoint>

The problem i have actually is where this <anything> is going to.
Or, in other words, where i can get the value of <anything> in my
driver.

regards
  Petric Frank

 
 
 

VFS and mount

Post by Alexander Vi » Thu, 14 Jun 2001 09:39:07



Quote:>Hello,

>i am writing a filesystem driver (vfs).

as in "not on a block device"?

Quote:>I am getting it working with hardcoded values.

>i can do a
>  mount -t <filesystem type> anything <mountpoint>

>The problem i have actually is where this <anything> is going to.

Currently - nowhere. IOW, you can't use it. It will change in 2.5.early,
but that requires API change.

Advice: for the time being use -o something=<anything>. _That_ will be
passed to ->read_super() (in "data" argument).

Currently you can (after read_super() is done) try to find that <anything>,
but that's pretty much an accident and it's very likely to be gone by the
time when 2.4.6-final will be released.  Again, the right way to do it
is to wait for 2.5 and use -o until then.

 
 
 

VFS and mount

Post by Petric Fran » Thu, 14 Jun 2001 16:30:30


Hello Alexander,



> >Hello,

> >i am writing a filesystem driver (vfs).

> as in "not on a block device"?

> >I am getting it working with hardcoded values.

> >i can do a
> >  mount -t <filesystem type> anything <mountpoint>

> >The problem i have actually is where this <anything> is going to.

> Currently - nowhere. IOW, you can't use it. It will change in 2.5.early,
> but that requires API change.

> Advice: for the time being use -o something=<anything>. _That_ will be
> passed to ->read_super() (in "data" argument).

> Currently you can (after read_super() is done) try to find that <anything>,
> but that's pretty much an accident and it's very likely to be gone by the
> time when 2.4.6-final will be released.  Again, the right way to do it
> is to wait for 2.5 and use -o until then.

But how is Samba doing it ?
As i digged out recently you can do a
  mount -t smbfs //MACHINE/SHARE <mount point>

(ok, i should ask this a samba newsgroup)

regards
  Petric

 
 
 

VFS and mount

Post by Alexander Vi » Thu, 14 Jun 2001 17:26:58




Quote:>But how is Samba doing it ?
>As i digged out recently you can do a
>  mount -t smbfs //MACHINE/SHARE <mount point>

Do strace on it. You'll see that it's special-cased in mount - it
calls a separate helper (mount.smb) which passes it in the same
way normal mount would pass -o <options>.

Sure, you can modify /bin/mount so that it would recognize your
syntax as a special case (or call a separate program that would
do the same). But that has nothing to kernel...

--
"You're one of those condescending Unix computer users!"
"Here's a nickel, kid.  Get yourself a better computer" - Dilbert.

 
 
 

VFS and mount

Post by Petric Fran » Thu, 14 Jun 2001 18:34:59


Hello Alexander,




> >But how is Samba doing it ?
> >As i digged out recently you can do a
> >  mount -t smbfs //MACHINE/SHARE <mount point>

> Do strace on it. You'll see that it's special-cased in mount - it
> calls a separate helper (mount.smb) which passes it in the same
> way normal mount would pass -o <options>.

Thanks.
I'll have a look to the mount source. I've seen a file named mount.smbfs
which does the mount for samba.
Maybe there is a generic rule in mount to call mount.<filesystem> if
available ...

regards
  Petric

 
 
 

VFS and mount

Post by Kasper Dupon » Sat, 16 Jun 2001 22:32:24




> >Hello,

> >i am writing a filesystem driver (vfs).

> as in "not on a block device"?

> >I am getting it working with hardcoded values.

> >i can do a
> >  mount -t <filesystem type> anything <mountpoint>

> >The problem i have actually is where this <anything> is going to.

> Currently - nowhere. IOW, you can't use it. It will change in 2.5.early,
> but that requires API change.

Since it does show up in /proc/mounts it must
exist somewhere.

--
Kasper Dupont

 
 
 

VFS and mount

Post by Petric Fran » Sun, 17 Jun 2001 00:51:16


Reply to my own post ...

Petric Frank schrieb:

> Hello Alexander,




> > >But how is Samba doing it ?
> > >As i digged out recently you can do a
> > >  mount -t smbfs //MACHINE/SHARE <mount point>

> > Do strace on it. You'll see that it's special-cased in mount - it
> > calls a separate helper (mount.smb) which passes it in the same
> > way normal mount would pass -o <options>.

> Thanks.
> I'll have a look to the mount source. I've seen a file named mount.smbfs
> which does the mount for samba.
> Maybe there is a generic rule in mount to call mount.<filesystem> if
> available ...

The generic rule is indeed the one i thought above.
mount is searching for a /bin/mount.<filesystem> file and if it is there
he calls it.
Here (in my distribution) it calls in case of samba the script
mount.smbfs which calls smbmount.
This one converts the parameters and calls smbmnt.
smbmnt does a system call mount (see man 2 mount) which passes in the
first parameter '//MACHINE/SHARE' (as like the original mount does).

Here i am stuck actually. I was not able to find the source of this
function. Is there anyone here in this echo which can give me a hint
where to find it ?

regards
  Petric

 
 
 

VFS and mount

Post by Alexander Vi » Sun, 17 Jun 2001 00:16:55




Quote:>> Currently - nowhere. IOW, you can't use it. It will change in 2.5.early,
>> but that requires API change.

>Since it does show up in /proc/mounts it must
>exist somewhere.

Sure. In struct vfsmount. Which is unavailable when superblock is read.
For damn good reasons.

--
"You're one of those condescending Unix computer users!"
"Here's a nickel, kid.  Get yourself a better computer" - Dilbert.

 
 
 

VFS and mount

Post by Kasper Dupon » Tue, 19 Jun 2001 00:34:27



> Reply to my own post ...

> Petric Frank schrieb:

> > Hello Alexander,




> > > >But how is Samba doing it ?
> > > >As i digged out recently you can do a
> > > >  mount -t smbfs //MACHINE/SHARE <mount point>

> > > Do strace on it. You'll see that it's special-cased in mount - it
> > > calls a separate helper (mount.smb) which passes it in the same
> > > way normal mount would pass -o <options>.

> > Thanks.
> > I'll have a look to the mount source. I've seen a file named mount.smbfs
> > which does the mount for samba.
> > Maybe there is a generic rule in mount to call mount.<filesystem> if
> > available ...

> The generic rule is indeed the one i thought above.
> mount is searching for a /bin/mount.<filesystem> file and if it is there
> he calls it.
> Here (in my distribution) it calls in case of samba the script
> mount.smbfs which calls smbmount.
> This one converts the parameters and calls smbmnt.
> smbmnt does a system call mount (see man 2 mount) which passes in the
> first parameter '//MACHINE/SHARE' (as like the original mount does).

> Here i am stuck actually. I was not able to find the source of this
> function. Is there anyone here in this echo which can give me a hint
> where to find it ?

> regards
>   Petric

Is it sys_mount() that you are looking for?

find /usr/src/linux-2.4.1 -type f | xargs grep -l sys_mount
/usr/src/linux-2.4.1/fs/super.c

--
Kasper Dupont