summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAlexander Viro <viro@math.psu.edu>2002-03-14 23:05:58 -0800
committerLinus Torvalds <torvalds@home.transmeta.com>2002-03-14 23:05:58 -0800
commit5e689743c7569951575e7da6ea2c2ea1ef9d08ab (patch)
tree0494bfdcaf4b804e695a0e8348887fdd536d841a /drivers
parent4ce937cb16368dc68ccbbef7490666385502cd44 (diff)
[PATCH] fs/libfs.c
Linus, I've taken a bunch of common methods into fs/libfs.c and killed the (duplicated) instances in filesystems. There will be more - ideally I'd like to get a library that would make writing small filesystems trivial.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hotplug/pci_hotplug_core.c19
-rw-r--r--drivers/usb/inode.c27
2 files changed, 6 insertions, 40 deletions
diff --git a/drivers/hotplug/pci_hotplug_core.c b/drivers/hotplug/pci_hotplug_core.c
index f7b9b553b919..7accd88b290c 100644
--- a/drivers/hotplug/pci_hotplug_core.c
+++ b/drivers/hotplug/pci_hotplug_core.c
@@ -76,7 +76,6 @@ struct hotplug_slot_core {
};
static struct super_operations pcihpfs_ops;
-static struct file_operations pcihpfs_dir_operations;
static struct file_operations default_file_operations;
static struct inode_operations pcihpfs_dir_inode_operations;
static struct vfsmount *pcihpfs_mount; /* one of the mounts of our fs for reference counting */
@@ -95,13 +94,6 @@ static int pcihpfs_statfs (struct super_block *sb, struct statfs *buf)
return 0;
}
-/* SMP-safe */
-static struct dentry *pcihpfs_lookup (struct inode *dir, struct dentry *dentry)
-{
- d_add(dentry, NULL);
- return NULL;
-}
-
static struct inode *pcihpfs_get_inode (struct super_block *sb, int mode, int dev)
{
struct inode *inode = new_inode(sb);
@@ -123,7 +115,7 @@ static struct inode *pcihpfs_get_inode (struct super_block *sb, int mode, int de
break;
case S_IFDIR:
inode->i_op = &pcihpfs_dir_inode_operations;
- inode->i_fop = &pcihpfs_dir_operations;
+ inode->i_fop = &simple_dir_operations;
break;
}
}
@@ -241,11 +233,6 @@ static int default_open (struct inode *inode, struct file *filp)
return 0;
}
-static struct file_operations pcihpfs_dir_operations = {
- read: generic_read_dir,
- readdir: dcache_readdir,
-};
-
static struct file_operations default_file_operations = {
read: default_read_file,
write: default_write_file,
@@ -302,7 +289,7 @@ static struct file_operations test_file_operations = {
static struct inode_operations pcihpfs_dir_inode_operations = {
create: pcihpfs_create,
- lookup: pcihpfs_lookup,
+ lookup: simple_lookup,
unlink: pcihpfs_unlink,
mkdir: pcihpfs_mkdir,
rmdir: pcihpfs_rmdir,
@@ -310,7 +297,7 @@ static struct inode_operations pcihpfs_dir_inode_operations = {
};
static struct super_operations pcihpfs_ops = {
- statfs: pcihpfs_statfs,
+ statfs: simple_statfs,
put_inode: force_delete,
};
diff --git a/drivers/usb/inode.c b/drivers/usb/inode.c
index 38fdc944219f..329462ed7ee5 100644
--- a/drivers/usb/inode.c
+++ b/drivers/usb/inode.c
@@ -40,7 +40,6 @@
#include <asm/byteorder.h>
static struct super_operations usbfs_ops;
-static struct file_operations usbfs_dir_operations;
static struct file_operations default_file_operations;
static struct inode_operations usbfs_dir_inode_operations;
static struct vfsmount *usbfs_mount;
@@ -141,21 +140,6 @@ static int parse_options(struct super_block *s, char *data)
/* --------------------------------------------------------------------- */
-/* SMP-safe */
-static struct dentry *usbfs_lookup (struct inode *dir, struct dentry *dentry)
-{
- d_add(dentry, NULL);
- return NULL;
-}
-
-static int usbfs_statfs(struct super_block *sb, struct statfs *buf)
-{
- buf->f_type = USBDEVICE_SUPER_MAGIC;
- buf->f_bsize = PAGE_CACHE_SIZE;
- buf->f_namelen = NAME_MAX;
- return 0;
-}
-
static struct inode *usbfs_get_inode (struct super_block *sb, int mode, int dev)
{
struct inode *inode = new_inode(sb);
@@ -177,7 +161,7 @@ static struct inode *usbfs_get_inode (struct super_block *sb, int mode, int dev)
break;
case S_IFDIR:
inode->i_op = &usbfs_dir_inode_operations;
- inode->i_fop = &usbfs_dir_operations;
+ inode->i_fop = &simple_dir_operations;
break;
}
}
@@ -296,11 +280,6 @@ static int default_open (struct inode *inode, struct file *filp)
return 0;
}
-static struct file_operations usbfs_dir_operations = {
- read: generic_read_dir,
- readdir: dcache_readdir,
-};
-
static struct file_operations default_file_operations = {
read: default_read_file,
write: default_write_file,
@@ -310,14 +289,14 @@ static struct file_operations default_file_operations = {
static struct inode_operations usbfs_dir_inode_operations = {
create: usbfs_create,
- lookup: usbfs_lookup,
+ lookup: simple_lookup,
unlink: usbfs_unlink,
mkdir: usbfs_mkdir,
rmdir: usbfs_rmdir,
};
static struct super_operations usbfs_ops = {
- statfs: usbfs_statfs,
+ statfs: simple_statfs,
put_inode: force_delete,
};