patch-2.6.6-vs1.9.0
[linux-2.6.git] / fs / proc / generic.c
index d2c88eb..21e06c9 100644 (file)
@@ -17,6 +17,8 @@
 #include <linux/smp_lock.h>
 #include <linux/init.h>
 #include <linux/idr.h>
+#include <linux/vinline.h>
+#include <linux/vserver/inode.h>
 #include <asm/uaccess.h>
 #include <asm/bitops.h>
 
@@ -348,8 +350,15 @@ static int proc_delete_dentry(struct dentry * dentry)
        return 1;
 }
 
+static int proc_revalidate_dentry(struct dentry *de, struct nameidata *nd)
+{
+       /* maybe add a check if it's really necessary? */
+       return 0;
+}
+
 static struct dentry_operations proc_dentry_operations =
 {
+       .d_revalidate   = proc_revalidate_dentry,
        .d_delete       = proc_delete_dentry,
 };
 
@@ -369,6 +378,8 @@ struct dentry *proc_lookup(struct inode * dir, struct dentry *dentry, struct nam
                for (de = de->subdir; de ; de = de->next) {
                        if (de->namelen != dentry->d_name.len)
                                continue;
+                       if (!vx_hide_check(0, de->vx_flags))
+                               continue;
                        if (!memcmp(dentry->d_name.name, de->name, de->namelen)) {
                                unsigned int ino = de->low_ino;
 
@@ -445,9 +456,12 @@ int proc_readdir(struct file * filp,
                        }
 
                        do {
+                               if (!vx_hide_check(0, de->vx_flags))
+                                       goto skip;
                                if (filldir(dirent, de->name, de->namelen, filp->f_pos,
                                            de->low_ino, de->mode >> 12) < 0)
                                        goto out;
+                       skip:
                                filp->f_pos++;
                                de = de->next;
                        } while (de);
@@ -559,6 +573,7 @@ static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent,
        ent->namelen = len;
        ent->mode = mode;
        ent->nlink = nlink;
+       ent->vx_flags = IATTR_PROC_DEFAULT;
  out:
        return ent;
 }
@@ -579,7 +594,8 @@ struct proc_dir_entry *proc_symlink(const char *name,
                                kfree(ent->data);
                                kfree(ent);
                                ent = NULL;
-                       }
+                       } else
+                               ent->vx_flags = IATTR_PROC_SYMLINK;
                } else {
                        kfree(ent);
                        ent = NULL;