Re: behaviour of sys_stat

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

 



> In my module I want to get the status of a file. One
> solution is to follow the implementation of sys_stat
> call and write my own routine.
> 
> I tried calling sys_stat from my module, which gives
> me erronos values as output. ( The input to this call
> are user buffers )

You sure don't need to call that. You are in kernel. You can see the inode
structure directly. Just do path_walk (user_path_walk if the name is in
userland buffer) and then look in the inode (d_inode member). You will
have to call i_ops->getattr, if its ever defined anywhere, but AFAIK it's
not used currently - it's just ready if some filesystem ever needed that.
The sys_stat routine is nothing but a glue to user-land.

--------------------------------------------------------------------------------
                  				- Jan Hudec `Bulb' <bulb@ucw.cz>
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[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