Re: your own filesystem

2012-09-05 Thread s...@bestmx.ru
hi, all
(thanx for the links to the books)

i have added few handlers to 
my_vnops.c file (that originally was null_vnops.c of nullfs)

and (with intention to involve my handlers into execution flow)
i have extended struct vop_ops (last 4 lines):

struct vop_ops my_vnode_vops = {
.vop_nresolve = null_nresolve,
.vop_ncreate =  null_ncreate,
.vop_nmkdir =   null_nmkdir,
.vop_nmknod =   null_nmknod,
.vop_nlink =null_nlink,
.vop_nsymlink = null_nsymlink,
.vop_nwhiteout =null_nwhiteout,
.vop_nremove =  null_nremove,
.vop_nrmdir =   null_nrmdir,
.vop_nrename =  null_nrename,
.vop_mountctl = null_mountctl,
.vop_open = my_open,
.vop_read = my_read,
.vop_write =my_write,
.vop_access =   my_access
};

then i have noticed that my_*() handlers were never called no matter what 
operations i perform on my test subject.

the question is:
(1) What am i doing wrong?
(2) Is there any official description what is a purpose of each handler in 
struct vop_ops and WHEN it shall be called?


Re: your own filesystem

2012-09-02 Thread Sascha Wildner

On Sun, 02 Sep 2012 12:48:55 +0200, s...@bestmx.ru s...@bestmx.ru wrote:


Hi, all

i have tried to create my own nullfs using the original nullfs as a  
template. and i failed.


first of all i rename it (as thorougly as i could)
then successfully make it
then put myfs.ko to /boot/kernel/
then kldload myfs
and got File already exists error

it looks like i possibly have missed the module identifier somewhere but  
i can not locate...


plese! help.


How does the VFS_SET() part look in your *_vfsops.c?

Sascha


Re: your own filesystem

2012-09-02 Thread s...@bestmx.ru

  it looks like i possibly have missed the module identifier somewhere but  
  i can not locate...
 
  plese! help.
 
 How does the VFS_SET() part look in your *_vfsops.c?
 
 Sascha


VFS_SET(null_vfsops, null, VFCF_LOOPBACK);
MODULE_VERSION(myfs, 1);


Re: your own filesystem

2012-09-02 Thread Sascha Wildner

On Sun, 02 Sep 2012 13:08:31 +0200, s...@bestmx.ru s...@bestmx.ru wrote:



 it looks like i possibly have missed the module identifier somewhere  
but

 i can not locate...

 plese! help.

How does the VFS_SET() part look in your *_vfsops.c?

Sascha



VFS_SET(null_vfsops, null, VFCF_LOOPBACK);
MODULE_VERSION(myfs, 1);


Rename null_vfsops structure to myfs_vfsops and use:

VFS_SET(myfs_vfsops, myfs, VFCF_LOOPBACK);


Re: your own filesystem

2012-09-02 Thread s...@bestmx.ru

   it looks like i possibly have missed the module identifier somewhere  
  but
   i can not locate...
  
   plese! help.
 
  How does the VFS_SET() part look in your *_vfsops.c?
 
  Sascha
 
 
  VFS_SET(null_vfsops, null, VFCF_LOOPBACK);
  MODULE_VERSION(myfs, 1);
 
 Rename null_vfsops structure to myfs_vfsops and use:
 
 VFS_SET(myfs_vfsops, myfs, VFCF_LOOPBACK);


thanx! it works

i have kldload my module.
now i am confused about how to call it's functions?
(excuse me for the stupid question)
how can i call the mount (if it has been created?)


Re: your own filesystem

2012-09-02 Thread Sascha Wildner

On Sun, 02 Sep 2012 13:45:51 +0200, s...@bestmx.ru s...@bestmx.ru wrote:



  it looks like i possibly have missed the module identifier  
somewhere

 but
  i can not locate...
 
  plese! help.

 How does the VFS_SET() part look in your *_vfsops.c?

 Sascha


 VFS_SET(null_vfsops, null, VFCF_LOOPBACK);
 MODULE_VERSION(myfs, 1);

Rename null_vfsops structure to myfs_vfsops and use:

VFS_SET(myfs_vfsops, myfs, VFCF_LOOPBACK);



thanx! it works

i have kldload my module.
now i am confused about how to call it's functions?
(excuse me for the stupid question)
how can i call the mount (if it has been created?)


Not 100% sure what you mean but I guess the next step would be to copy  
mount_null(8) to mount_myfs(8) and adjust it so it acts on myfs.


Sascha


Re: your own filesystem

2012-09-02 Thread s...@bestmx.ru
hi again

i have some progress here and the next question arises:

is there any detailed manual on nullfs and/or stackable filesystems...
with function specifications, flowcharts etc...

...or at least proper keywords for google.


Re: your own filesystem

2012-09-02 Thread Raimundo Santos
On 2 September 2012 08:54, Sascha Wildner s...@online.de wrote:
 On Sun, 02 Sep 2012 13:45:51 +0200, s...@bestmx.ru s...@bestmx.ru wrote:

 i have kldload my module.
 now i am confused about how to call it's functions?
 (excuse me for the stupid question)
 how can i call the mount (if it has been created?)


 Not 100% sure what you mean but I guess the next step would be to copy
 mount_null(8) to mount_myfs(8) and adjust it so it acts on myfs.

Yeap, to have a working FS you need a way to the layered approach know
about that FS.

By layered approach I mean the way unix has, at least for the past
twenty years, organazied the access to FS: via VFS.

In a roughly way: you have to mount, under the 'laws' of VFS, a FS,
which means put an access point/node in the hierarchy of the actual
all FSs tree. Direct to the point: VFS abstracts all the fundamental
operations over your FS, so other apps do not have to know how to
access specificaly the yours.

disclaimer 1: I am yet a novice in this subject.
disclaimer 2: I am very sorry about my English...
-- 

Raimundo A. P. Santos
Bacharelando em Informática
ICMC - USP



Re: your own filesystem

2012-09-02 Thread Francois Tigeot
On Sun, Sep 02, 2012 at 08:27:44PM +0400, s...@bestmx.ru wrote:
 
 is there any detailed manual on nullfs and/or stackable filesystems...
 with function specifications, flowcharts etc...

This paper could be useful:

Vnodes: An Architecture for Multiple File System Types in Sun UNIX
S.R. Kleiman
Sun Microsystems

Published around 1986 if I'm not mistaken.

-- 
Francois Tigeot


Re: your own filesystem

2012-09-02 Thread Raimundo Santos
On 2 September 2012 13:27, s...@bestmx.ru s...@bestmx.ru wrote:
 hi again

 i have some progress here and the next question arises:

 is there any detailed manual on nullfs and/or stackable filesystems...
 with function specifications, flowcharts etc...

 ...or at least proper keywords for google.

I do not use it so often as I wish, but the book about Design and
Implementation of FreeBSD, by McKusick, could tell you something. And
a very proper keyword is: VFS - standing for: Virtual File System.

I am in the long path of learning this things by trying to fix a
little but annoyng bug in the NTFS driver. A very nice correction was
made by tuxillo for a much more large problem, and efforts was made to
mitigate locking problems (you can see that with the git log, a friend
of a developer!), but a problem persists: when a try to copy a large
file (above 2GB), cp says back to me 'Argument list too long' and
'ntfs_strategy: ntfs_readattr failed' apears a lot in
/var/log/messages.

Trying to figure out what is going on, I am now stuck at my absence of
knowledge about how buffering and Virtual Memory works in
DragonFlyBSD. Just looking at the OS description we can see that it
has crucial differences compared to FreeBSD, but the ideas behind, at
a very general speech, are the same: resource management.

Another nice reference is the Andrew Tanenbaum book, Modern Operating
Systems, where he presents and discuss a lot about this very general
concepts.

Hope it helps!

-- 

Raimundo A. P. Santos
Bacharelando em Informática
ICMC - USP