Re: [PATCH 0/1] Implement /dev/byte (a generic byte source similiarto /dev/zero)

From: Alexander Holler
Date: Tue Apr 19 2011 - 05:05:27 EST


Hello,

Am 19.04.2011 10:44, schrieb Alan Cox:
As for /dev/zero there are many other possible reasons to use such a
device, besides filling something with a value. For me it's as
reasonable as dev/zero, just that it offers a bit more flexibility and
provides another, at least for me useful, default value. Maybe
/dev/nzero would have been a good name too. ;)

/dev/zero exists not to put \0's into files as such but because it is
very useful to be able to map the zero page (a read only, or
copy-on-write blank page) into programs. The mmap is the reason it is
there.

Thanks for the explanation.

But I don't really care about inclusion into the kernel, it's just
something I had lying around (and needed only marginally work to
finalize as a proper patch) and I thought someone else could find it
usefull and I should share that here.

Implementationwise I think I would have gone for allocating a new device
and range of 256 minors - that would avoid the funky stuff setting what
it fills with as you'd just fill with the minor number.

I thought about that too, but that would have been to easy (and static). ;)

And the usage of file descriptors was the only idea I've come up with, which is multitasking and multiuser aware.

Regards,

Alexander
--
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/