[Top][All Lists]

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

Re: stat for block device files

From: Marcus Brinkmann
Subject: Re: stat for block device files
Date: Sat, 30 Sep 2000 17:00:09 +0200
User-agent: Mutt/1.1.4i

On Sat, Sep 30, 2000 at 10:48:00AM +0900, OKUJI Yoshinori wrote:
>   Does stat return a correct size even for a block device file
> (i.e. a file "settrans"ed with storeio) on GNU/Hurd? I'm not sure,
> since I have no GNU/Hurd machine at hand for now. If yes, I think the
> grub shell can get correct geometries even on Hurd, with code like
> this:
> stat("/dev/hd0", &st);
> total_sectors = st.st_size >> 9;

You have to open the device for this to work:

storeio/storeio.c (trivfs_modify_stat):

  if (open)
    /* An open device.  */
      struct store *store = open->dev->store;
      vm_size_t size = store->size;

      if (store->block_size > 1)
        st->st_blksize = store->block_size;

      st->st_size = size;


      st->st_blksize = 0;
      st->st_size = 0;


I don't know if stat with a filename opens the file, I don't think so.
I can make a test when I reboot next time.


`Rhubarb is no Egyptian god.' Debian http://www.debian.org Check Key server 
Marcus Brinkmann              GNU    http://www.gnu.org    for public PGP Key 
address@hidden,     address@hidden    PGP Key ID 36E7CD09
http://homepage.ruhr-uni-bochum.de/Marcus.Brinkmann/       address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]