upgrade to fedora-2.6.12-1.1398.FC4 + vserver 2.0.rc7
[linux-2.6.git] / fs / devpts / inode.c
index 004d7ac..055bbcc 100644 (file)
@@ -21,8 +21,6 @@
 #include <linux/vs_base.h>
 #include <linux/xattr.h>
 
-#define DEVPTS_SUPER_MAGIC 0x1cd1
-
 extern struct xattr_handler devpts_xattr_security_handler;
 
 static struct xattr_handler *devpts_xattr_handlers[] = {
@@ -41,7 +39,7 @@ static int devpts_permission(struct inode *inode, int mask, struct nameidata *nd
        return ret;
 }
 
-struct inode_operations devpts_file_inode_operations = {
+static struct inode_operations devpts_file_inode_operations = {
 #ifdef CONFIG_DEVPTS_FS_XATTR
        .setxattr       = generic_setxattr,
        .getxattr       = generic_getxattr,
@@ -99,58 +97,14 @@ static int devpts_remount(struct super_block *sb, int *flags, char *data)
        return 0;
 }
 
+static int devpts_filter(struct dentry *de)
+{
+       return vx_check(de->d_inode->i_xid, VX_IDENT);
+}
+
 static int devpts_readdir(struct file * filp, void * dirent, filldir_t filldir)
 {
-       struct dentry *dentry = filp->f_dentry;
-       struct dentry *cursor = filp->private_data;
-       struct list_head *p, *q = &cursor->d_child;
-       ino_t ino;
-       int i = filp->f_pos;
-
-       switch (i) {
-               case 0:
-                       ino = dentry->d_inode->i_ino;
-                       if (filldir(dirent, ".", 1, i, ino, DT_DIR) < 0)
-                               break;
-                       filp->f_pos++;
-                       i++;
-                       /* fallthrough */
-               case 1:
-                       ino = parent_ino(dentry);
-                       if (filldir(dirent, "..", 2, i, ino, DT_DIR) < 0)
-                               break;
-                       filp->f_pos++;
-                       i++;
-                       /* fallthrough */
-               default:
-                       spin_lock(&dcache_lock);
-                       if (filp->f_pos == 2) {
-                               list_del(q);
-                               list_add(q, &dentry->d_subdirs);
-                       }
-                       for (p=q->next; p != &dentry->d_subdirs; p=p->next) {
-                               struct dentry *next;
-                               next = list_entry(p, struct dentry, d_child);
-                               if (d_unhashed(next) || !next->d_inode)
-                                       continue;
-                               if (!vx_check(next->d_inode->i_xid, VX_IDENT))
-                                       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_CHR) < 0)
-                                       return 0;
-                               spin_lock(&dcache_lock);
-                               /* next is still alive */
-                               list_del(q);
-                               list_add(q, p);
-                               p = q;
-                               filp->f_pos++;
-                       }
-                       spin_unlock(&dcache_lock);
-       }
-       return 0;
+       return dcache_readdir_filter(filp, dirent, filldir, devpts_filter);
 }
 
 static struct file_operations devpts_dir_operations = {
@@ -176,6 +130,7 @@ devpts_fill_super(struct super_block *s, void *data, int silent)
        s->s_magic = DEVPTS_SUPER_MAGIC;
        s->s_op = &devpts_sops;
        s->s_xattr = devpts_xattr_handlers;
+       s->s_time_gran = 1;
 
        inode = new_inode(s);
        if (!inode)