Re: vfsmount

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

 



Hi Rohit,

Take a look into how get_empty_filp() is implemented (fs/file_table.c).

get_empty_file()
{
        It calls kmem_cache_zalloc() to allocate memory for the struct file *. This function sets the allocated memory to 0.
        Then it sets few of the fields of struct file like
                           f_count = 1
                           f_uid = current_task->fsuid
                           f_gid = current_task->fsgid
        and then returns the struct file *.
}

It does not set any other fields that's the reason you get f_vfsmnt as NULL.

get_empty_file() just creates a new and empty struct file, it does not accept any file system to associate with. There could be number of file systems on the machine. So, it won't associate by himself to any filesystem.

Thanks and Regards,
Prasad

On Mon, Sep 22, 2008 at 10:27 PM, Rohit Sharma <imreckless@xxxxxxxxx> wrote:
I am interested in getting the vfsmount structure of the mounted file
system from my module.
I used filp = get_empty_filp() (filp is file pointer)
function to create an empty file object (as this contains pointer to
vfsmount structure)
file object has a field f_vfsmnt which points to the vfsmount structure
i am storing this in my own my_vfsmnt structure of type vfsmount.
my_vfsmnt = filp->f_vfsmnt
but i am getting my_vfsmnt as NULL ??

is there any other way of getting the vfsmount structure ??
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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