LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jan Engelhardt <jengelh@computergmbh.de>
To: "Hans-Jürgen Koch" <hjk@linutronix.de>
Cc: Andi Kleen <andi@firstfloor.org>,
	Jasper Bryant-Greene <jasper@unix.geek.nz>,
	rzryyvzy <rzryyvzy@trashmail.net>,
	linux-kernel@vger.kernel.org
Subject: Re: Is there a "blackhole" /dev/null directory?
Date: Thu, 14 Feb 2008 16:23:37 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.64.0802141620330.694@fbirervta.pbzchgretzou.qr> (raw)
In-Reply-To: <20080214161942.55ce5089@dilbert.local>


On Feb 14 2008 16:19, Hans-Jürgen Koch wrote:
>> 
>> Q: What if a program attempts to mkdir /dev/nullmnt/foo to just
>>    create a file /dev/nullmnt/foo/barfile?
>> A: /dev/nullmnt/foo must continue to exist or be accepted for a while,
>>    or perhaps for eternity.
>
>Well, the problem seems to be that a "directory" is not just data but
>also contains metadata. While it's easy to write data to /dev/null, you
>cannot simply discard metadata associated with a directory. So, such a
>"/dev/null-directory" would have to remember metadata (at least all
>created filenames including subdirectories) in the same way as other
>filesystems do. Only file _content_ can be discarded.

Not even that. Suppose a userspace program (whose output you'd like
to discard) does:

int main(void)
{
	int fd = open("/nullmnt/foo.txt", O_WRONLY | O_CREAT | O_EXCL);

	/* write lots of nonsensical data that we don't need anyway */
	write(fd, "Hello Wor(l)d", 13);

	if (lseek(fd, 0, SEEK_SET) < 0) {
		/* should not happen */
		fprintf(stderr, "Huh, did we write to a pipe or cdev?\n");
		abort();
	}

	/* verify */
	char buf[13];
	read(fd, buf, 13);
	if (memcmp(buf, "Hello Wor(l)d", 13) != 0)
		fprintf(stderr, "Aïe, disk corruption!\n");
}

>To be honest, I still cannot see many sensible usecases for that...

I agree.

  reply	other threads:[~2008-02-14 15:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-14  9:30 rzryyvzy
2008-02-14  9:39 ` Jasper Bryant-Greene
2008-02-14  9:46   ` Andi Kleen
2008-02-14 15:00     ` Jan Engelhardt
2008-02-14 15:19       ` Hans-Jürgen Koch
2008-02-14 15:23         ` Jan Engelhardt [this message]
2008-02-14 15:30           ` Hans-Jürgen Koch
2008-02-15 19:25       ` Bill Davidsen
2008-02-14 12:16   ` Mika Lawando
2008-02-14 15:06     ` linux-os (Dick Johnson)
     [not found] <9WIJE-1Nr-11@gated-at.bofh.it>
2008-02-14 17:16 ` Bodo Eggert
     [not found] ` <9WIJO-1Nr-19@gated-at.bofh.it>
     [not found]   ` <9WITv-286-21@gated-at.bofh.it>
     [not found]     ` <9WNTa-2x3-17@gated-at.bofh.it>
     [not found]       ` <9WOch-2Wk-3@gated-at.bofh.it>
2008-02-15  1:15         ` Bodo Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0802141620330.694@fbirervta.pbzchgretzou.qr \
    --to=jengelh@computergmbh.de \
    --cc=andi@firstfloor.org \
    --cc=hjk@linutronix.de \
    --cc=jasper@unix.geek.nz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rzryyvzy@trashmail.net \
    --subject='Re: Is there a "blackhole" /dev/null directory?' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).