Finding size of a raw device

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

 



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 <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

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!


________________________________________________________________________
Yahoo! India Matrimony: Find your partner online. http://yahoo.shaadi.com/india-matrimony/

--
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