Hi All,
I was trying to write a sample file system for learning purpose. After mounting the file system and creating a file, say test, I am not able to see the file in the directory list.
This is how I have written inode creation code. Please inform if anything is missing.
struct inode_operations lwfs_i_ops =
{
.lookup = simple_lookup,
.create = create_inode,
} ;
atomic_t counter, subcounter;
int create_inode (struct inode * dir, struct dentry *dentry, int mode, struct nameidata *nd )
{
struct inode *inode = lfs_make_inode (dir->i_sb, mode) ;
if ( !inode )
goto out;
inode->i_fop = &lfs_file_ops ;
inode->i_fop = &lfs_file_ops;
inode->i_private = &counter;
d_add ( dentry, inode) ;
printk ( KERN_INFO "Inode Created." ) ;
return 0 ;
out:
return -1 ;
}
Forgot to add this code.
struct inode *lfs_make_inode(struct super_block *sb, int mode)
{
struct inode *ret = new_inode(sb);
if (ret) {
ret->i_mode = mode;
ret->i_uid = ret->i_gid = 0;
ret->i_blkbits = PAGE_CACHE_SIZE;
ret->i_blocks = 0;
ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
}
return ret;
}
mount -t lwnfs none mnt_pt
echo "test" > mnt+pt/test
ls mnt_pt ================> displays nothing.
Please help...
Thanks in advance.
Thanks and Regards,
Prasad.