git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git]
/
fs
/
hppfs
/
hppfs_kern.c
diff --git
a/fs/hppfs/hppfs_kern.c
b/fs/hppfs/hppfs_kern.c
index
f8e0cbd
..
5e6363b
100644
(file)
--- a/
fs/hppfs/hppfs_kern.c
+++ b/
fs/hppfs/hppfs_kern.c
@@
-4,6
+4,7
@@
*/
#include <linux/fs.h>
*/
#include <linux/fs.h>
+#include <linux/file.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
@@
-37,7
+38,7
@@
struct hppfs_inode_info {
static inline struct hppfs_inode_info *HPPFS_I(struct inode *inode)
{
static inline struct hppfs_inode_info *HPPFS_I(struct inode *inode)
{
- return
(list_entry(inode, struct hppfs_inode_info, vfs_inode)
);
+ return
container_of(inode, struct hppfs_inode_info, vfs_inode
);
}
#define HPPFS_SUPER_MAGIC 0xb00000ee
}
#define HPPFS_SUPER_MAGIC 0xb00000ee
@@
-170,12
+171,12
@@
static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry,
err = -ENOMEM;
parent = HPPFS_I(ino)->proc_dentry;
err = -ENOMEM;
parent = HPPFS_I(ino)->proc_dentry;
-
down(&parent->d_inode->i_sem
);
+
mutex_lock(&parent->d_inode->i_mutex
);
proc_dentry = d_lookup(parent, &dentry->d_name);
if(proc_dentry == NULL){
proc_dentry = d_alloc(parent, &dentry->d_name);
if(proc_dentry == NULL){
proc_dentry = d_lookup(parent, &dentry->d_name);
if(proc_dentry == NULL){
proc_dentry = d_alloc(parent, &dentry->d_name);
if(proc_dentry == NULL){
-
up(&parent->d_inode->i_sem
);
+
mutex_unlock(&parent->d_inode->i_mutex
);
goto out;
}
new = (*parent->d_inode->i_op->lookup)(parent->d_inode,
goto out;
}
new = (*parent->d_inode->i_op->lookup)(parent->d_inode,
@@
-185,7
+186,7
@@
static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry,
proc_dentry = new;
}
}
proc_dentry = new;
}
}
-
up(&parent->d_inode->i_sem
);
+
mutex_unlock(&parent->d_inode->i_mutex
);
if(IS_ERR(proc_dentry))
return(proc_dentry);
if(IS_ERR(proc_dentry))
return(proc_dentry);
@@
-215,10
+216,10
@@
static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry,
static struct inode_operations hppfs_file_iops = {
};
static struct inode_operations hppfs_file_iops = {
};
-static ssize_t read_proc(struct file *file, char *buf, ssize_t count,
+static ssize_t read_proc(struct file *file, char
__user
*buf, ssize_t count,
loff_t *ppos, int is_user)
{
loff_t *ppos, int is_user)
{
- ssize_t (*read)(struct file *, char *, size_t, loff_t *);
+ ssize_t (*read)(struct file *, char
__user
*, size_t, loff_t *);
ssize_t n;
read = file->f_dentry->d_inode->i_fop->read;
ssize_t n;
read = file->f_dentry->d_inode->i_fop->read;
@@
-232,10
+233,10
@@
static ssize_t read_proc(struct file *file, char *buf, ssize_t count,
set_fs(USER_DS);
if(ppos) *ppos = file->f_pos;
set_fs(USER_DS);
if(ppos) *ppos = file->f_pos;
- return
(n)
;
+ return
n
;
}
}
-static ssize_t hppfs_read_file(int fd, char *buf, ssize_t count)
+static ssize_t hppfs_read_file(int fd, char
__user
*buf, ssize_t count)
{
ssize_t n;
int cur, err;
{
ssize_t n;
int cur, err;
@@
-253,7
+254,7
@@
static ssize_t hppfs_read_file(int fd, char *buf, ssize_t count)
err = os_read_file(fd, new_buf, cur);
if(err < 0){
printk("hppfs_read : read failed, errno = %d\n",
err = os_read_file(fd, new_buf, cur);
if(err < 0){
printk("hppfs_read : read failed, errno = %d\n",
-
count
);
+
err
);
n = err;
goto out_free;
}
n = err;
goto out_free;
}
@@
-270,10
+271,10
@@
static ssize_t hppfs_read_file(int fd, char *buf, ssize_t count)
out_free:
kfree(new_buf);
out:
out_free:
kfree(new_buf);
out:
- return
(n)
;
+ return
n
;
}
}
-static ssize_t hppfs_read(struct file *file, char *buf, size_t count,
+static ssize_t hppfs_read(struct file *file, char
__user
*buf, size_t count,
loff_t *ppos)
{
struct hppfs_private *hppfs = file->private_data;
loff_t *ppos)
{
struct hppfs_private *hppfs = file->private_data;
@@
-312,12
+313,12
@@
static ssize_t hppfs_read(struct file *file, char *buf, size_t count,
return(count);
}
return(count);
}
-static ssize_t hppfs_write(struct file *file, const char *buf, size_t len,
+static ssize_t hppfs_write(struct file *file, const char
__user
*buf, size_t len,
loff_t *ppos)
{
struct hppfs_private *data = file->private_data;
struct file *proc_file = data->proc_file;
loff_t *ppos)
{
struct hppfs_private *data = file->private_data;
struct file *proc_file = data->proc_file;
- ssize_t (*write)(struct file *, const char *, size_t, loff_t *);
+ ssize_t (*write)(struct file *, const char
__user
*, size_t, loff_t *);
int err;
write = proc_file->f_dentry->d_inode->i_fop->write;
int err;
write = proc_file->f_dentry->d_inode->i_fop->write;
@@
-491,7
+492,7
@@
static int hppfs_open(struct inode *inode, struct file *file)
fd = open_host_sock(host_file, &filter);
if(fd > 0){
data->contents = hppfs_get_data(fd, filter,
fd = open_host_sock(host_file, &filter);
if(fd > 0){
data->contents = hppfs_get_data(fd, filter,
-
&
data->proc_file,
+ data->proc_file,
file, &data->len);
if(!IS_ERR(data->contents))
data->host_fd = fd;
file, &data->len);
if(!IS_ERR(data->contents))
data->host_fd = fd;
@@
-543,7
+544,7
@@
static int hppfs_dir_open(struct inode *inode, struct file *file)
static loff_t hppfs_llseek(struct file *file, loff_t off, int where)
{
struct hppfs_private *data = file->private_data;
static loff_t hppfs_llseek(struct file *file, loff_t off, int where)
{
struct hppfs_private *data = file->private_data;
- struct file *proc_file =
&
data->proc_file;
+ struct file *proc_file = data->proc_file;
loff_t (*llseek)(struct file *, loff_t, int);
loff_t ret;
loff_t (*llseek)(struct file *, loff_t, int);
loff_t ret;
@@
-557,7
+558,7
@@
static loff_t hppfs_llseek(struct file *file, loff_t off, int where)
return(default_llseek(file, off, where));
}
return(default_llseek(file, off, where));
}
-static struct file_operations hppfs_file_fops = {
+static
const
struct file_operations hppfs_file_fops = {
.owner = NULL,
.llseek = hppfs_llseek,
.read = hppfs_read,
.owner = NULL,
.llseek = hppfs_llseek,
.read = hppfs_read,
@@
-586,7
+587,7
@@
static int hppfs_filldir(void *d, const char *name, int size,
static int hppfs_readdir(struct file *file, void *ent, filldir_t filldir)
{
struct hppfs_private *data = file->private_data;
static int hppfs_readdir(struct file *file, void *ent, filldir_t filldir)
{
struct hppfs_private *data = file->private_data;
- struct file *proc_file =
&
data->proc_file;
+ struct file *proc_file = data->proc_file;
int (*readdir)(struct file *, void *, filldir_t);
struct hppfs_dirent dirent = ((struct hppfs_dirent)
{ .vfs_dirent = ent,
int (*readdir)(struct file *, void *, filldir_t);
struct hppfs_dirent dirent = ((struct hppfs_dirent)
{ .vfs_dirent = ent,
@@
-608,7
+609,7
@@
static int hppfs_fsync(struct file *file, struct dentry *dentry, int datasync)
return(0);
}
return(0);
}
-static struct file_operations hppfs_dir_fops = {
+static
const
struct file_operations hppfs_dir_fops = {
.owner = NULL,
.readdir = hppfs_readdir,
.open = hppfs_dir_open,
.owner = NULL,
.readdir = hppfs_readdir,
.open = hppfs_dir_open,
@@
-657,46
+658,40
@@
static struct super_operations hppfs_sbops = {
.statfs = hppfs_statfs,
};
.statfs = hppfs_statfs,
};
-static int hppfs_readlink(struct dentry *dentry, char *buffer, int buflen)
+static int hppfs_readlink(struct dentry *dentry, char
__user
*buffer, int buflen)
{
struct file *proc_file;
struct dentry *proc_dentry;
{
struct file *proc_file;
struct dentry *proc_dentry;
- int (*readlink)(struct dentry *, char *, int);
- int err, n;
+ int ret;
proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY);
proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY);
- err = PTR_ERR(proc_dentry);
- if(IS_ERR(proc_dentry))
- return(err);
+ if (IS_ERR(proc_file))
+ return PTR_ERR(proc_file);
- readlink = proc_dentry->d_inode->i_op->readlink;
- n = (*readlink)(proc_dentry, buffer, buflen);
+ ret = proc_dentry->d_inode->i_op->readlink(proc_dentry, buffer, buflen);
fput(proc_file);
fput(proc_file);
- return
(n)
;
+ return
ret
;
}
}
-static
int
hppfs_follow_link(struct dentry *dentry, struct nameidata *nd)
+static
void*
hppfs_follow_link(struct dentry *dentry, struct nameidata *nd)
{
struct file *proc_file;
struct dentry *proc_dentry;
{
struct file *proc_file;
struct dentry *proc_dentry;
- int (*follow_link)(struct dentry *, struct nameidata *);
- int err, n;
+ void *ret;
proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY);
proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY);
- err = PTR_ERR(proc_dentry);
- if(IS_ERR(proc_dentry))
- return(err);
+ if (IS_ERR(proc_file))
+ return proc_file;
- follow_link = proc_dentry->d_inode->i_op->follow_link;
- n = (*follow_link)(proc_dentry, nd);
+ ret = proc_dentry->d_inode->i_op->follow_link(proc_dentry, nd);
fput(proc_file);
fput(proc_file);
- return
(n)
;
+ return
ret
;
}
static struct inode_operations hppfs_dir_iops = {
}
static struct inode_operations hppfs_dir_iops = {