0

How can I tell the size of a file from a kernel module?

I know about vfs_llseek() but I also need an equivalent function to ftell().

LiorGolan
  • 355
  • 1
  • 4
  • 11
  • Possible duplicate of [How do you get the size of a file in the linux kernel?](http://stackoverflow.com/questions/18966071/how-do-you-get-the-size-of-a-file-in-the-linux-kernel) – Fazlin Jun 20 '16 at 11:14

1 Answers1

2

you could tyry to use vfs_llseek with a offset of 0 and whence of SEEK_END: it will go to the end and return the file position (which will be the end of the file)

Likewise for the current position, toy would use offset 0, SEEK_CUR, to return the current position.

lostbard
  • 5,065
  • 1
  • 15
  • 17