LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
Search this Thread
Old 06-01-2009, 03:56 AM   #1
bitzsk
LQ Newbie
 
Registered: Apr 2009
Posts: 15

Rep: Reputation: 0
in linux kernel,how to get the sector info of a file?


hi, i can use filp_open("/bin/ls", O_RDONLY, 0); to open a file. the return type is struct file. do you know next how to get the sector number of the file "ls"? thanks!
 
Old 06-03-2009, 09:37 PM   #2
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 116Reputation: 116
Map the file to an inode, then map the inode to a disk sector. Note that, in order to do this, you need to know the filesystem type involved, and any sort of device mapping (RAID, etc.) will add another layer of complexity. With hardware RAID, you would be unable to ever learn the physical sectors on which the file is stored.
 
Old 06-04-2009, 12:23 AM   #3
bitzsk
LQ Newbie
 
Registered: Apr 2009
Posts: 15

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Matir View Post
Map the file to an inode, then map the inode to a disk sector. Note that, in order to do this, you need to know the filesystem type involved, and any sort of device mapping (RAID, etc.) will add another layer of complexity. With hardware RAID, you would be unable to ever learn the physical sectors on which the file is stored.
thanks very much! my file system type is ext3

Last edited by bitzsk; 06-04-2009 at 12:24 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
If I know the sector position and file size, is this sufficient to recover a file? jsstevenson Linux - General 2 09-29-2008 10:35 AM
Gnome/Nautilus issues Beagle-Tracker, file transfer info, replace file info, popup. Mysticle31 Linux - Software 0 01-08-2008 05:30 PM
Convert an info file(bash.info.gz) to a single html file Darwish Linux - Software 2 09-24-2005 06:51 AM
linux kernel: end_request: I/O error, dev fd0 sector 0 calutateo Linux - Software 4 05-30-2005 11:36 PM
Cannot see Kernel Config Info, and my Swap File...Won't! fastvfr Debian 1 09-07-2004 03:37 AM


All times are GMT -5. The time now is 11:17 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration