Writing inode_operations->create() function.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 ;
}


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.

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux