Red Hat Topics - System Calls (or File System Utilities)

This is Interesting: Free IT Magazines  
Home > Archive > Red Hat Topics > April 2005 > System Calls (or File System Utilities)





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author System Calls (or File System Utilities)
Anthropos

2005-04-20, 8:45 pm

Are there system calls (or file system utilities) available in Linux to do
the following:

1. Obtain the data sector addresses for all sectors containing a specific
file's data (not the pointers to the data)?

(Obviously, the pointers for a file contain that information. The
question is: can it be accessed?)

2. Write to a specific sector address?



Scott Lurndal

2005-04-21, 5:46 pm

"Anthropos" <Anthropos@SWBell.net> writes:
>Are there system calls (or file system utilities) available in Linux to do
>the following:
>
>1. Obtain the data sector addresses for all sectors containing a specific
>file's data (not the pointers to the data)?
>

Yes. You can get this information, but depending on the filesystem
(i.e. is it mounted or not), it may be stale by the time you use it. you
would need a fair amount of filesystem expertise to even attempt this.

> (Obviously, the pointers for a file contain that information. The
>question is: can it be accessed?)
>
>2. Write to a specific sector address?


Yes.

One must be very careful to do this only on a non-active (i.e. not mounted)
filesystem. You can read and write any sector by accessing the partition
directly through the appropriate device. Unless you are familiar with the
metadata organization of the filesystem, I wouldn't even try.

Why not just open the file with open(2) and write to it with pwrite(2)?

scott
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com