Re: loopback on block device

From: Helge Hafting
Date: Thu Oct 28 2004 - 04:51:07 EST


On Wed, Oct 27, 2004 at 02:42:48PM -0500, Lei Yang wrote:
> Why /dev/ram0 is a file? Can you get into more details? For example, if
> I want to do some system level programming and write to a /dev/ram0, how
> do I do it?
>

I don't think you need an example. You can open it in exactly
the same way as you open regular files like /etc/resolv.conf.

ie.
FILE *f = fopen("/dev/ram0", "rw");
Then use fseek, fwrite and fread as usual.

Helge Hafting
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/