* both impossible due to the lock on directory.
*/
-int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir)
+static inline int do_dcache_readdir_filter(struct file * filp,
+ void * dirent, filldir_t filldir, int (*filter)(struct dentry *dentry))
{
struct dentry *dentry = filp->f_dentry;
struct dentry *cursor = filp->private_data;
next = list_entry(p, struct dentry, d_child);
if (d_unhashed(next) || !next->d_inode)
continue;
+ if (filter && !filter(next))
+ continue;
spin_unlock(&dcache_lock);
if (filldir(dirent, next->d_name.name, next->d_name.len, filp->f_pos, next->d_inode->i_ino, dt_type(next->d_inode)) < 0)
return 0;
}
+int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir)
+{
+ return do_dcache_readdir_filter(filp, dirent, filldir, NULL);
+}
+
+int dcache_readdir_filter(struct file * filp, void * dirent, filldir_t filldir,
+ int (*filter)(struct dentry *))
+{
+ return do_dcache_readdir_filter(filp, dirent, filldir, filter);
+}
+
+
ssize_t generic_read_dir(struct file *filp, char __user *buf, size_t siz, loff_t *ppos)
{
return -EISDIR;
EXPORT_SYMBOL(dcache_dir_lseek);
EXPORT_SYMBOL(dcache_dir_open);
EXPORT_SYMBOL(dcache_readdir);
+EXPORT_SYMBOL(dcache_readdir_filter);
EXPORT_SYMBOL(generic_read_dir);
EXPORT_SYMBOL(get_sb_pseudo);
EXPORT_SYMBOL(simple_commit_write);