Skip to contentSkip to conversation

'Not a directory'

DISCUSSION Marcos Dione 4 participants 4 messages May 27, 2002 – May 28, 2002 VFS

lore
Share & tools
lore
#0 lore raw

I'm playing with a new fs developed by myself. I reached the stage
where I can mount the fs and even read the root's inode. but when I try to cd into de mountpoint, chdir(2) complais that 'Not a directory'.

doing a 'ls -l' I see that the mountpoint has the mode, dates and
size of the directory being mounted. the mode is 040755, so I don't see the problem. also, using ramfs as reference, I note that the directory is not inspected in any way, so I think that is not a problem if I didn't developed the super, inode and file ops *yet*.

also, I would *really* appreciate any link to any docs about
implementing filesystems for linux (e.g., what should all the *_ops functions must do, return, etc., which should be reimplemented or which could be ignored or even use the generic_* ones, and so on)

best regards.

#1 lore raw
Quoted 3 lines · Marcos Dione

I'm playing with a new fs developed by myself. I reached the stage
where I can mount the fs and even read the root's inode. but when I try to cd into de mountpoint, chdir(2) complais that 'Not a directory'.

... so go through the code path where it can return -ENOTDIR

Quoted 5 lines

doing a 'ls -l' I see that the mountpoint has the mode, dates and
size of the directory being mounted. the mode is 040755, so I don't see the problem. also, using ramfs as reference, I note that the directory is not inspected in any way, so I think that is not a problem if I didn't developed the super, inode and file ops *yet*.

... what about this check in namei.c:607

                if (lookup_flags & LOOKUP_DIRECTORY) {
                        err = -ENOTDIR;
                        if (!inode->i_op || !inode->i_op->lookup)
                                break;
                }
Quoted 4 lines

also, I would *really* appreciate any link to any docs about
implementing filesystems for linux (e.g., what should all the *_ops functions must do, return, etc., which should be reimplemented or which could be ignored or even use the generic_* ones, and so on)

There are Documentation/filesystems/vfs.txt and Locking files in kernel source, that contain some documentation. And for the rest there is tmpfs, where you can look what things must be done to keep vfs happy (like when to put/get inode/dentry, how to map a page for write and so on).

--------------------------------------------------------------------------------
- Jan Hudec `Bulb' <[email protected]>

#2 lore raw
In reply to Marcos Dione
Quoted 4 lines · Marcos Dione

also, I would *really* appreciate any link to any docs about
implementing filesystems for linux (e.g., what should all the *_ops functions must do, return, etc., which should be reimplemented or which could be ignored or even use the generic_* ones, and so on)

http://www.cse.unsw.edu.au/~neilb/oss/linux-commentary/vfs.html
http://www.moses.uklinux.net/patches/lki.html

The first is a bit out of date but still very valuable.

Best regards,

Anton

Signature · 5 lines
  "I've not lost my mind. It's backed up on tape somewhere." - Unknown
-- 
Anton Altaparmakov <aia21 at cantab.net> (replace at with @)
Linux NTFS Maintainer / IRC: #ntfs on irc.openprojects.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/
#3 lore raw
In reply to Marcos Dione
Quoted 11 lines · Marcos Dione

I'm playing with a new fs developed by myself. I reached the stage
where I can mount the fs and even read the root's inode. but when I try to cd into de mountpoint, chdir(2) complais that 'Not a directory'.

doing a 'ls -l' I see that the mountpoint has the mode, dates and
size of the directory being mounted. the mode is 040755, so I don't see the problem. also, using ramfs as reference, I note that the directory is not inspected in any way, so I think that is not a problem if I didn't developed the super, inode and file ops *yet*.

Quoted 4 lines

also, I would *really* appreciate any link to any docs about
implementing filesystems for linux (e.g., what should all the *_ops functions must do, return, etc., which should be reimplemented or which could be ignored or even use the generic_* ones, and so on)

For a ram based filesystem, there's an ok article in the May issue of Linux Journal on some of the things you need to do for 2.4:

	http://www.linuxjournal.com/article.php?sid=5633

Also take a look at the code for pcihpfs in the 2.4 kernel at drivers/hotplug/pci_hotplug_core.c and driverfs and usbfs in the 2.5 kernel for other examples of ram based filesystems that were based off of ramfs (actually pcihpfs was based off of driverfs which was based off of ramfs...)

Hope this helps,

greg k-h