[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <522B4FB7.9050107@gmail.com>
Date: Sat, 07 Sep 2013 18:09:27 +0200
From: Marco Stornelli <marco.stornelli@...il.com>
To: Al Viro <viro@...IV.linux.org.uk>
CC: Vladimir Davydov <vdavydov@...allels.com>,
linux-kernel@...r.kernel.org,
Linux FS Devel <linux-fsdevel@...r.kernel.org>
Subject: Re: [PATCH 12/19] pramfs: symlink operations
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
--
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