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

From: Alan Cox
Date: Tue Apr 19 2011 - 04:43:48 EST


> 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.

> 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.

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