#include <linux/idr.h>
#include <linux/namei.h>
#include <linux/bitops.h>
-#include <linux/spinlock.h>
#include <linux/vserver/inode.h>
#include <asm/uaccess.h>
size_t count, loff_t *ppos);
static loff_t proc_file_lseek(struct file *, loff_t, int);
-DEFINE_SPINLOCK(proc_subdir_lock);
-
int proc_match(int len, const char *name, struct proc_dir_entry *de)
{
if (de->namelen != len)
const char *cp = name, *next;
struct proc_dir_entry *de;
int len;
- int rtn = 0;
- spin_lock(&proc_subdir_lock);
de = &proc_root;
while (1) {
next = strchr(cp, '/');
if (proc_match(len, cp, de))
break;
}
- if (!de) {
- rtn = -ENOENT;
- goto out;
- }
+ if (!de)
+ return -ENOENT;
cp += len + 1;
}
*residual = cp;
*ret = de;
-out:
- spin_unlock(&proc_subdir_lock);
- return rtn;
+ return 0;
}
static DEFINE_IDR(proc_inum_idr);
int error = -ENOENT;
lock_kernel();
- spin_lock(&proc_subdir_lock);
de = PDE(dir);
if (de) {
for (de = de->subdir; de ; de = de->next) {
if (!memcmp(dentry->d_name.name, de->name, de->namelen)) {
unsigned int ino = de->low_ino;
- spin_unlock(&proc_subdir_lock);
error = -EINVAL;
inode = proc_get_inode(dir->i_sb, ino, de);
/* generic proc entries belong to the host */
inode->i_xid = 0;
- spin_lock(&proc_subdir_lock);
break;
}
}
}
- spin_unlock(&proc_subdir_lock);
unlock_kernel();
if (inode) {
filp->f_pos++;
/* fall through */
default:
- spin_lock(&proc_subdir_lock);
de = de->subdir;
i -= 2;
for (;;) {
if (!de) {
ret = 1;
- spin_unlock(&proc_subdir_lock);
goto out;
}
if (!i)
do {
if (!vx_hide_check(0, de->vx_flags))
goto skip;
- /* filldir passes info to user space */
- spin_unlock(&proc_subdir_lock);
if (filldir(dirent, de->name, de->namelen, filp->f_pos,
de->low_ino, de->mode >> 12) < 0)
goto out;
- spin_lock(&proc_subdir_lock);
skip:
filp->f_pos++;
de = de->next;
} while (de);
- spin_unlock(&proc_subdir_lock);
}
ret = 1;
out: unlock_kernel();
if (i == 0)
return -EAGAIN;
dp->low_ino = i;
-
- spin_lock(&proc_subdir_lock);
dp->next = dir->subdir;
dp->parent = dir;
dir->subdir = dp;
- spin_unlock(&proc_subdir_lock);
-
if (S_ISDIR(dp->mode)) {
if (dp->proc_iops == NULL) {
dp->proc_fops = &proc_dir_operations;
struct file * filp = list_entry(p, struct file, f_u.fu_list);
struct dentry * dentry = filp->f_dentry;
struct inode * inode;
- const struct file_operations *fops;
+ struct file_operations *fops;
if (dentry->d_op != &proc_dentry_operations)
continue;
if (!parent && xlate_proc_name(name, &parent, &fn) != 0)
goto out;
len = strlen(fn);
-
- spin_lock(&proc_subdir_lock);
for (p = &parent->subdir; *p; p=&(*p)->next ) {
if (!proc_match(len, fn, *p))
continue;
}
break;
}
- spin_unlock(&proc_subdir_lock);
out:
return;
}