linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marco Stornelli <marco.stornelli@gmail.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Vladimir Davydov <vdavydov@parallels.com>,
	linux-kernel@vger.kernel.org,
	Linux FS Devel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 12/19] pramfs: symlink operations
Date: Sat, 07 Sep 2013 18:09:27 +0200	[thread overview]
Message-ID: <522B4FB7.9050107@gmail.com> (raw)
In-Reply-To: <20130907144118.GA13318@ZenIV.linux.org.uk>

Il 07/09/2013 16:41, Al Viro ha scritto:
> On Sat, Sep 07, 2013 at 10:29:15AM +0200, Marco Stornelli wrote:
>> +static int pram_readlink(struct dentry *dentry, char __user *buffer, int buflen)
>> +{
>> +	struct inode *inode = dentry->d_inode;
>> +	struct super_block *sb = inode->i_sb;
>> +	u64 block;
>> +	char *blockp;
>> +
>> +	block = pram_find_data_block(inode, 0);
>> +	blockp = pram_get_block(sb, block);
>> +	return vfs_readlink(dentry, buffer, buflen, blockp);
>> +}
>
>> +static void *pram_follow_link(struct dentry *dentry, struct nameidata *nd)
>> +{
>> +	struct inode *inode = dentry->d_inode;
>> +	struct super_block *sb = inode->i_sb;
>> +	off_t block;
>> +	int status;
>> +	char *blockp;
>> +
>> +	block = pram_find_data_block(inode, 0);
>> +	blockp = pram_get_block(sb, block);
>> +	status = vfs_follow_link(nd, blockp);
>> +	return ERR_PTR(status);
>> +}
>
> Just nd_set_link(nd, blockp) instead of that vfs_follow_link() and be
> done with that; that way you can use generic_readlink() instead of
> pram_readlink() *and* get lower stack footprint on traversing them.
>
>

Yep, you're right (as usual :))

Marco

      reply	other threads:[~2013-09-07 16:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-07  8:29 [PATCH 12/19] pramfs: symlink operations Marco Stornelli
2013-09-07 14:41 ` Al Viro
2013-09-07 16:09   ` Marco Stornelli [this message]

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=522B4FB7.9050107@gmail.com \
    --to=marco.stornelli@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vdavydov@parallels.com \
    --cc=viro@ZenIV.linux.org.uk \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).