Hi,

I wonder how to get size of character device that referenced mtd partition
block device? As I see bchlib_setup in drivers/bch/bchlib_setup.c fills
block geometry info to bchlib_s structure (number of sectors and sector
size) that then stored as i_private to inode.

This inode is part of the root pseudo file system and when user call stat()
code leads to inode_stat function in fs/vfs/fs_stat.c that fills only file
attributes info (st_mode).

I suppose here inode_stat also could fill size of file in bytes (st_size)
based on geometry from i_private bchlib_s structure.

But how to correctly determine that device is BCH here, to be sure that
casting to bchlib_s will be correct? INODE_IS_BLOCK(inode) is obviously not
enough criteria.

I'm not good in inode stuff, so maybe this is stupid idea, but could I
check file_operations functions pointers to be equal to certain functions
of BCH? Something like:
    if (inode->u.i_ops->read == bch_read) {}

Anyway it would be done, fs_stat will be depended on BCH driver. But I
suppose it is not right, is it?

p.s. also I suppose same thing is related to block devices themselves, they
could provide geometry info to determine file size for stat().

Thanks for any thoughts!

-- 
With regards, Oleg.

Reply via email to