Getting a block from a block device?

rohan puri rohan.puri15 at gmail.com
Tue Nov 8 23:54:08 EST 2011


On Tue, Nov 8, 2011 at 8:48 PM, Manish Katiyar <mkatiyar at gmail.com> wrote:

> On Tue, Nov 8, 2011 at 6:02 AM, Dan Luedtke <maildanrl at googlemail.com>
> wrote:
> > Thanks for all the answers!
> >
> >> You need to look at other block-based file systems in the kernel
> sources in fs dir for examples and understand how they do it.
> > I looked at fs/minix/* fs/fat/* and peeked into fs/ext2/, but got more
> > confused so I decided to ask for a starting point.
>
> Hi Dan,
>
> You may find https://github.com/mkatiyar/testfs helpful.
>
> >
> >> Also i think if you are interested in reading the first sector
> >> then you can probably check the block/genhd.c file
> >> get the disk (i.e struct genhd) then the partition (struct hdpart)
> >> you will be able to get the first sector.
> > Thanks, a well documented source file. However, shouldn't I get the
> > right partition (I called it block device in previously sent mails,
> > thought of e.g. /dev/sda2 as a device not a partition) from VFS when a
> > user requestes mounting it?
> >
> >> That's an old assignment from my uni.
> > Wow, exactly what I needed! Thanks for this starting point.
> >
> >> I would redirect you to learn about struct gendisk and struct bio.
> > Noted, I will take a look after studying the vvfs-files from Stephens
> link.
> >
> >> Can you tell what are you trying to achieve?
> > I'd like to implement a filesystem as kernel modul (like fat, ext2,
> > ...). The filesystem is a very simple one, based on chained blocks
> > (similar to linked lists in c). I "invented" it when I tried to write
> > a bootloader that does not require a second stage to read an kernel
> > image. (This is all more or less a "because we can"-project, no
> > commercial background, just learning).
> >
> > Once again, thank you guys!
> >
> > Greetings,
> >
> > Dan
> > --
> > Dan Luedtke
> > http://www.danrl.de
> >
> > _______________________________________________
> > Kernelnewbies mailing list
> > Kernelnewbies at kernelnewbies.org
> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >
>
>
>
> --
> Thanks -
> Manish
>

Nice reference manish :)

Regards,
Rohan Puri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20111109/73ec04e4/attachment.html 


More information about the Kernelnewbies mailing list