[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0703091014210.10832@woody.linux-foundation.org>
Date: Fri, 9 Mar 2007 10:22:25 -0800 (PST)
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Eric Dumazet <dada1@...mosbay.com>
cc: Andrew Morton <akpm@...ux-foundation.org>,
Christoph Hellwig <hch@...radead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH, take2] VFS : Delay the dentry name generation on sockets
and pipes.
On Fri, 9 Mar 2007, Eric Dumazet wrote:
>
> CAUTION : d_path() logic is quite tricky.
> The correct way to return for example "Hello" is to put it
> at the end of the buffer, and returns a pointer to the first char.
Yeah, it's subtle, since it wants to use a single buffer, and not copy
things around too much.
But can I ask you to do a take3, and simply have a helper function like
char *dynamic_dname(struct dentry *dentry, char *buffer, int len,
const char *fmt, ...)
{
va_list args;
char temp[64];
int i;
va_start(args, fmt);
i = vsnprintf(tmp,sizeof(tmp),fmt,args) + 1;
va_end(args);
if (i > len)
return ERR_PTR(-ENAMETOOLONG);
buffer += len - i;
memcpy(buffer, tmp, i);
return buffer;
}
and just require that everybody use that function.
Then the pipe code would just become
static char *pipefs_dname(struct dentry *dentry, char *buffer, int buflen)
{
return dynamic_dname(dentry, buffer, buflen, ""pipe:[%lu]", dentry->d_inode->i_ino);
}
and you're done, and you have only *one* place in the VFS layer
(preferably right next to d_path() itself) that cares about the
subtle issues that we have.
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists