Commit 99264544 authored by Patrick Mochel's avatar Patrick Mochel

driverfs: stop using vfs layer for file creation

This is the first of a series of patches to driverfs to _not_ use the vfs layer for file creation
and deletion. 
The VFS layer is allowing files and directories to be removed from userspace, which we don't want 
at all. 

Per Al Viro's suggesting, I am pushing the necessary checks from the vfs_* functions into the 
driverfs functions, and calling them directly from the kernel interface to driverfs.

This is the first, for file creation
parent 086a716c
...@@ -158,8 +158,9 @@ static int driverfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) ...@@ -158,8 +158,9 @@ static int driverfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
static int driverfs_create(struct inode *dir, struct dentry *dentry, int mode) static int driverfs_create(struct inode *dir, struct dentry *dentry, int mode)
{ {
int res; int res;
mode = (mode & S_IALLUGO) | S_IFREG;
dentry->d_op = &driverfs_dentry_file_ops; dentry->d_op = &driverfs_dentry_file_ops;
res = driverfs_mknod(dir, dentry, mode | S_IFREG, 0); res = driverfs_mknod(dir, dentry, mode, 0);
return res; return res;
} }
...@@ -424,7 +425,6 @@ static struct file_operations driverfs_file_operations = { ...@@ -424,7 +425,6 @@ static struct file_operations driverfs_file_operations = {
}; };
static struct inode_operations driverfs_dir_inode_operations = { static struct inode_operations driverfs_dir_inode_operations = {
.create = driverfs_create,
.lookup = simple_lookup, .lookup = simple_lookup,
.unlink = driverfs_unlink, .unlink = driverfs_unlink,
.symlink = driverfs_symlink, .symlink = driverfs_symlink,
...@@ -622,7 +622,7 @@ driverfs_create_file(struct driver_file_entry * entry, ...@@ -622,7 +622,7 @@ driverfs_create_file(struct driver_file_entry * entry,
dentry = lookup_hash(&qstr,parent->dentry); dentry = lookup_hash(&qstr,parent->dentry);
if (!IS_ERR(dentry)) { if (!IS_ERR(dentry)) {
dentry->d_fsdata = (void *)entry; dentry->d_fsdata = (void *)entry;
error = vfs_create(parent->dentry->d_inode,dentry,entry->mode); error = driverfs_create(parent->dentry->d_inode,dentry,entry->mode);
/* Still good? Ok, then fill in the blanks: */ /* Still good? Ok, then fill in the blanks: */
if (!error) { if (!error) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment