Re: Finding size of a raw device
来源:百度文库 编辑:神马文学网 时间:2024/03/29 03:59:28
Hi ,Probably I found the answer to this .On a filesystem, by doing an lseek the OS cantrack the size of the file via the inodes .Thus, an lseek with SEEK_END would give thefile size , as the inode tables provide theneeded support for the OS .But since a raw device bound to a file is adirect interface , there is no way in whichthe OS can figure out its limits , and thuslseek with SEEK_END would yield a zero .It would be nice if somebody could confirmthe above explanation .Cheers !--- Learnerwrote: > Hi ,>> I was trying to find the size of a raw partition> using the below program , but the output is not> correct. Can anybody suggest how to rectify this> program.>> Is it that "lseek" should be used only on regular> files and not special files ?Is there a proc entry> which reflects the currently bound raw devices ?>> I'am aware that "raw -qa" gives the complete list> of raw devices , but I wanted to know if there is> any other method to do so .>>> PROGRAM :->> #include > #include > #include > #include >> main()> {> int fd ;> int start, end ;>> fd=open( "/dev/raw/raw1", O_RDONLY );>> start=lseek( fd, 0, SEEK_SET );>> printf("The Start pt size is %d \n", start);>> end=lseek( fd, 0, SEEK_END );>> printf("The End pt size is %d \n", end);> }>> OUTPUT :->> The Start pt size is 0> The End pt size is 0>>> Cheers!>>>
Re: Finding size of a raw device
How to determine the size of a raw device (in a C programm)
a comparison of the size of the yahoo and google indices
Raw device - Wikipedia, the free encyclopedia
Little hope of finding landslide survivors
情景对话:Finding a Room 找住房
情景对话:Finding a Room 找住房
Finding the Natural Rhythms and Flows of Work...
真实生活英语Unit1:Finding a Job 找工作
Role of inflammation in the development of re...
《Essential Linux Device Drivers》 第2章 A Peek I...
RAW还是JPEG:佳能篇a
Gold Rush! Thousands of People Traveled to the Klondike in Western Canada in Hopes of Finding Gold
Gold Rush! Thousands of People Traveled to the Klondike in Western Canada in Hopes of Finding Gold
#re
#re
#re
A Definition of a PLE
A gift of thistle
a little of mine
ABCs of a Friend
A Moment of Silence
Scent of a Woman
A Tour of Scala