Thread (9 messages) 9 messages, 6 authors, 2011-11-09

Getting a block from a block device?

From: Manish Katiyar <hidden>
Date: 2011-11-08 15:18:13

Possibly related (same subject, not in this thread)

On Tue, Nov 8, 2011 at 6:02 AM, Dan Luedtke [off-list ref] wrote:
Thanks for all the answers!
quoted
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.
quoted
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?
quoted
That's an old assignment from my uni.
Wow, exactly what I needed! Thanks for this starting point.
quoted
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.
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help