[openbeos] Re: FS question

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Wed, 16 Jan 2002 15:24:54 +0100 (MET)

> The problem is to make the StorageKit on other FS than BeFS ... FAT.. 
> ReiserFS..
> ie, how to solve the problem of node_refs and entry_refs
> My problem is : how can I initialize eg.: a BDirectory with 
> entry_ref? get_ref_for_path can tranlate from filename/path to
 inode 
and device number with stat(). it's easy. But I didn't find any reverse 
way to make an lookup/mapping from dev.inode number to
> path ( or fildescriptor is would be suitable)

Citing from the sample source code of the iso9660 file system add-on:

/* For each item on the disk (directory, file, etc), your filesystem 
should allocate a vnode struct and 
        pass it back to the kernel when fs_read_vnode is called. This 
struct is then passed back in to 
        your file system by functions that reference an item on the disk. 
You'll need to be able to
        create a vnode from a vnode id, either by hashing the id number or 
encoding the information needed
        to create the vnode in the vnode id itself. Vnode ids are assigned 
by your file system when the
        filesystem walk function is called. For this driver, the block 
number is encoded in the upper bits
        of the vnode id, and the offset within the block in the lower, 
allowing me to just read the info
        to fill in the vnode struct from the disk. When the kernel is done 
with a vnode, it will call 
        fs_write_vnode (somewhat of a misnomer) where you should deallocate 
the struct.
*/

The file system itself handles this translation - so you may introduce 
a vnode layer which is understands linux' file system model (I haven't 
looked at that one, so I don't know the differences).

Adios...
   Axel.



Other related posts: