diff options
author | Miguel de Icaza <miguel@nuclecu.unam.mx> | 1997-08-06 19:14:48 +0000 |
---|---|---|
committer | Miguel de Icaza <miguel@nuclecu.unam.mx> | 1997-08-06 19:14:48 +0000 |
commit | e2819e52a162873ff5061de81bb749831bdb5de9 (patch) | |
tree | 6067ea700202750ba335a423696f2972700e5f76 /fs/proc | |
parent | 17a005074429bbf143e40401f405ae4363e56828 (diff) |
Merge to 2.1.38.
IMPORTANT NOTE: I could not figure out what information is the
one that should be used for the following files (ie, those
that were in our tree, or those that came from Linus' patch),
please, check these:
include/asm-mips/jazz.h
include/asm-mips/jazzdma.h
include/asm-mips/ioctls.h
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/array.c | 5 | ||||
-rw-r--r-- | fs/proc/link.c | 17 | ||||
-rw-r--r-- | fs/proc/openpromfs.c | 79 | ||||
-rw-r--r-- | fs/proc/root.c | 8 |
4 files changed, 46 insertions, 63 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c index 773b96873..21fefe4a7 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c @@ -495,6 +495,8 @@ static unsigned long get_wchan(struct task_struct *p) fp = *(unsigned long *) fp; } while (count++ < 16); } +#elif defined(__powerpc__) + return (p->tss.wchan); #endif return 0; @@ -521,6 +523,9 @@ static unsigned long get_wchan(struct task_struct *p) eip = ((struct pt_regs *) (tsk)->tss.esp0)->pc; \ eip; }) #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->tss.usp) +#elif defined(__powerpc__) +#define KSTK_EIP(tsk) ((tsk)->tss.regs->nip) +#define KSTK_ESP(tsk) ((tsk)->tss.regs->gpr[1]) #elif defined (__sparc_v9__) # define KSTK_EIP(tsk) ((tsk)->tss.kregs->tpc) # define KSTK_ESP(tsk) ((tsk)->tss.kregs->u_regs[UREG_FP]) diff --git a/fs/proc/link.c b/fs/proc/link.c index c25fd702b..0c189dcc3 100644 --- a/fs/proc/link.c +++ b/fs/proc/link.c @@ -138,15 +138,18 @@ static int proc_readlink(struct inode * inode, char * buffer, int buflen) if (!IS_ERR(dentry)) { error = -ENOENT; if (dentry) { - char * tmp = (char*)__get_free_page(GFP_KERNEL); - int len = d_path(dentry, current->fs->root, tmp); - int min = buflen<PAGE_SIZE ? buflen : PAGE_SIZE; - if(len <= min) - min = len+1; + char * tmp = (char*)__get_free_page(GFP_KERNEL), *path; + int len; + + path = d_path(dentry, tmp, PAGE_SIZE); + len = tmp + PAGE_SIZE - path; + + if (len < buflen) + buflen = len; dput(dentry); - copy_to_user(buffer, tmp, min); + copy_to_user(buffer, path, buflen); free_page((unsigned long)tmp); - error = len; + error = buflen; } } return error; diff --git a/fs/proc/openpromfs.c b/fs/proc/openpromfs.c index 346e72ed1..5d98507f0 100644 --- a/fs/proc/openpromfs.c +++ b/fs/proc/openpromfs.c @@ -1,4 +1,4 @@ -/* $Id: openpromfs.c,v 1.18 1997/07/17 02:24:01 davem Exp $ +/* $Id: openpromfs.c,v 1.20 1997/07/22 06:40:07 davem Exp $ * openpromfs.c: /proc/openprom handling routines * * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) @@ -54,12 +54,10 @@ static struct openpromfs_dev **devices; #define NODE2INO(node) (node + PROC_OPENPROM_FIRST) #define NODEP2INO(no) (no + PROC_OPENPROM_FIRST + last_node) -static int openpromfs_create (struct inode *, const char *, int, int, - struct inode **); +static int openpromfs_create (struct inode *, struct dentry *, int); static int openpromfs_readdir(struct inode *, struct file *, void *, filldir_t); -static int openpromfs_lookup(struct inode *, const char *, int, - struct inode **); -static int openpromfs_unlink (struct inode *, const char *, int); +static int openpromfs_lookup(struct inode *, struct dentry *dentry); +static int openpromfs_unlink (struct inode *, struct dentry *dentry); static long nodenum_read(struct inode *inode, struct file *file, char *buf, unsigned long count) @@ -602,8 +600,7 @@ static int lookup_children(u16 n, const char * name, int len) return 0; } -static int openpromfs_lookup(struct inode * dir, const char * name, int len, - struct inode ** result) +static int openpromfs_lookup(struct inode * dir, struct dentry *dentry) { int ino = 0; #define OPFSL_DIR 0 @@ -613,40 +610,21 @@ static int openpromfs_lookup(struct inode * dir, const char * name, int len, int type = 0; char buffer[128]; char *p; + const char *name; u32 n; u16 dirnode; + unsigned int len; int i; struct inode *inode; struct openpromfs_dev *d = NULL; char buffer2[64]; - *result = NULL; - if (!dir || !S_ISDIR(dir->i_mode)) { - iput(dir); - return -ENOTDIR; - } - *result = dir; - if (!len) return 0; - if (name [0] == '.') { - if (len == 1) - return 0; - if (name [1] == '.' && len == 2) { - if (dir->i_ino == PROC_OPENPROM) { - inode = proc_get_inode (dir->i_sb, - PROC_ROOT_INO, - &proc_root); - iput(dir); - if (!inode) - return -EINVAL; - *result = inode; - return 0; - } - ino = NODE2INO(NODE(dir->i_ino).parent); - type = OPFSL_DIR; - } else if (len == 5 && !strncmp (name + 1, "node", 4)) { - ino = NODEP2INO(NODE(dir->i_ino).first_prop); - type = OPFSL_NODENUM; - } + inode = NULL; + name = dentry->d_name.name; + len = dentry->d_name.len; + if (name [0] == '.' && len == 5 && !strncmp (name + 1, "node", 4)) { + ino = NODEP2INO(NODE(dir->i_ino).first_prop); + type = OPFSL_NODENUM; } if (!ino) { u16 node = NODE(dir->i_ino).child; @@ -712,13 +690,10 @@ static int openpromfs_lookup(struct inode * dir, const char * name, int len, ino = lookup_children (NODE(dir->i_ino).child, name, len); if (ino) type = OPFSL_DIR; - else { - iput(dir); + else return -ENOENT; - } } inode = proc_get_inode (dir->i_sb, ino, 0); - iput(dir); if (!inode) return -EINVAL; switch (type) { @@ -762,7 +737,7 @@ static int openpromfs_lookup(struct inode * dir, const char * name, int len, inode->i_rdev = d->rdev; break; } - *result = inode; + d_add(dentry, inode); return 0; } @@ -858,16 +833,14 @@ static int openpromfs_readdir(struct inode * inode, struct file * filp, return 0; } -static int openpromfs_create (struct inode *dir, const char *name, int len, - int mode, struct inode **result) +static int openpromfs_create (struct inode *dir, struct dentry *dentry, int mode) { char *p; struct inode *inode; - *result = NULL; if (!dir) return -ENOENT; - if (len > 256) { + if (dentry->d_name.len > 256) { iput (dir); return -EINVAL; } @@ -875,13 +848,13 @@ static int openpromfs_create (struct inode *dir, const char *name, int len, iput (dir); return -EIO; } - p = kmalloc (len + 1, GFP_KERNEL); + p = kmalloc (dentry->d_name.len + 1, GFP_KERNEL); if (!p) { iput (dir); return -ENOMEM; } - strncpy (p, name, len); - p [len] = 0; + strncpy (p, dentry->d_name.name, dentry->d_name.len); + p [dentry->d_name.len] = 0; alias_names [aliases_nodes++] = p; inode = proc_get_inode (dir->i_sb, NODEP2INO(NODE(dir->i_ino).first_prop) @@ -895,17 +868,19 @@ static int openpromfs_create (struct inode *dir, const char *name, int len, if (inode->i_size < 0) inode->i_size = 0; inode->u.generic_ip = (void *)(long)(((u16)aliases) | (((u16)(aliases_nodes - 1)) << 16)); - *result = inode; + d_instantiate(dentry, inode); return 0; } -static int openpromfs_unlink (struct inode *dir, const char *name, int len) +static int openpromfs_unlink (struct inode *dir, struct dentry *dentry) { + unsigned int len; char *p; + const char *name; int i; - if (!dir) - return -ENOENT; + name = dentry->d_name.name; + len = dentry->d_name.len; for (i = 0; i < aliases_nodes; i++) if ((strlen (alias_names [i]) == len) && !strncmp (name, alias_names[i], len)) { @@ -919,7 +894,7 @@ static int openpromfs_unlink (struct inode *dir, const char *name, int len) buffer [10 + len] = 0; prom_feval (buffer); } - iput (dir); + d_delete(dentry); return 0; } diff --git a/fs/proc/root.c b/fs/proc/root.c index 2b456ca57..544e74d05 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c @@ -151,14 +151,14 @@ struct proc_dir_entry proc_sys_root = { #if defined(CONFIG_SUN_OPENPROMFS) || defined(CONFIG_SUN_OPENPROMFS_MODULE) static int (*proc_openprom_defreaddir_ptr)(struct inode *, struct file *, void *, filldir_t); -static int (*proc_openprom_deflookup_ptr)(struct inode *, struct qstr *, struct inode **); +static int (*proc_openprom_deflookup_ptr)(struct inode *, struct dentry *); void (*proc_openprom_use)(struct inode *, int) = 0; static struct openpromfs_dev *proc_openprom_devices = NULL; static ino_t proc_openpromdev_ino = PROC_OPENPROMD_FIRST; struct inode_operations * proc_openprom_register(int (*readdir)(struct inode *, struct file *, void *, filldir_t), - int (*lookup)(struct inode *, struct qstr *, struct inode **), + int (*lookup)(struct inode *, struct dentry *), void (*use)(struct inode *, int), struct openpromfs_dev ***devices) { @@ -220,13 +220,13 @@ proc_openprom_defreaddir(struct inode * inode, struct file * filp, } static int -proc_openprom_deflookup(struct inode * dir, struct qstr *str, struct inode ** result) +proc_openprom_deflookup(struct inode * dir, struct dentry *dentry) { request_module("openpromfs"); if (proc_openprom_inode_operations.lookup != proc_openprom_deflookup) return proc_openprom_inode_operations.lookup - (dir, str, result); + (dir, dentry); return -ENOENT; } #endif |