Update of /cvsroot/linuxconsole/ruby/linux/fs/gfxfs
In directory usw-pr-cvs1:/tmp/cvs-serv1358/gfxfs
Modified Files:
dir.c super.c
Log Message:
Some gfxfs updates.. (not suitable for usage yet, just for testing..).
f_dentry still needs proper handling..
Index: dir.c
===================================================================
RCS file: /cvsroot/linuxconsole/ruby/linux/fs/gfxfs/dir.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- dir.c 2001/10/06 21:06:32 1.2
+++ dir.c 2001/10/09 19:04:50 1.3
@@ -11,14 +11,84 @@
#include <linux/gfxfs_fs.h>
#include <linux/dcache.h>
+static int gfxfs_link(struct dentry *old_dentry, struct inode *dir,
+ struct dentry *new_dentry)
+{
+ if (S_ISDIR(old_dentry->d_inode->i_mode))
+ return -EPERM;
+
+ old_dentry->d_inode->i_nlink++;
+ atomic_inc(&old_dentry->d_inode->i_count);
+ dget(new_dentry);
+ d_instantiate(new_dentry, old_dentry->d_inode);
+
+ return 0;
+}
+
+static int gfxfs_unlink(struct inode *dir, struct dentry *dentry)
+{
+ struct list_head *list;
+
+ spin_lock(&dcache_lock);
+
+ list_for_each(list, &dentry->d_subdirs) {
+ struct dentry *de = list_entry(list, struct dentry, d_child);
+
+ if (de->d_inode && !d_unhashed(de)) {
+ spin_unlock(&dcache_lock);
+ return -ENOTEMPTY;
+ }
+ }
+
+ spin_unlock(&dcache_lock);
+ dentry->d_inode->i_nlink--;
+ dput(dentry);
+
+ return 0;
+}
+
+static struct dentry *gfxfs_lookup(struct inode *dir, struct dentry *dentry)
+{
+ d_add(dentry, NULL);
+ return NULL;
+}
+
+int gfxfs_mknod(struct inode *dir, struct dentry *dentry, int mode, int dev)
+{
+ struct inode *inode = gfxfs_get_inode(dir->i_sb, mode, dev);
+
+ if (!inode)
+ return -ENOSPC;
+
+ d_instantiate(dentry, inode);
+ dget(dentry);
+
+ return 0;
+}
+
+static int gfxfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
+{
+ return gfxfs_mknod(dir, dentry, mode | S_IFDIR, 0);
+}
+
+static int gfxfs_create(struct inode *dir, struct dentry *dentry, int mode)
+{
+ return gfxfs_mknod(dir, dentry, mode | S_IFREG, 0);
+}
+
/* FIXME: Keep things happy for now, add our own later */
struct file_operations gfxfs_dir_ops = {
read: generic_read_dir,
readdir: dcache_readdir,
};
-/* Ditto */
struct inode_operations gfxfs_dir_inode_ops = {
- /* Empty for now */
+ create: gfxfs_create,
+ link: gfxfs_link,
+ unlink: gfxfs_unlink,
+ mkdir: gfxfs_mkdir,
+ rmdir: gfxfs_unlink,
+ mknod: gfxfs_mknod,
+ lookup: gfxfs_lookup,
};
Index: super.c
===================================================================
RCS file: /cvsroot/linuxconsole/ruby/linux/fs/gfxfs/super.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- super.c 2001/10/06 21:00:43 1.1
+++ super.c 2001/10/09 19:04:50 1.2
@@ -13,9 +13,47 @@
#include <linux/gfxfs_fs.h>
#include <linux/pagemap.h>
#include <linux/dcache.h>
+#include <linux/slab.h>
+#include <linux/string.h>
static struct vfsmount *gfxfs_mnt;
+struct gfxfs_dentry *gfxfs_register_entry(const char *name, int mode,
+ struct gfxfs_dentry *oparent)
+{
+ struct gfxfs_dentry *g_dentry;
+ struct gfxfs_dentry *parent = oparent;
+
+ if (!parent && gfxfs_mnt->mnt_sb) {
+ parent = gfxfs_mnt->mnt_sb->s_root;
+
+ /*
+ * Should hopefully never get here.
+ */
+ if (!parent) {
+ printk(KERN_WARNING "gfxfs: Valid super mount, "
+ "but no valid root inode??\n");
+ return NULL;
+ }
+ }
+
+ g_dentry = kmalloc(sizeof(struct gfxfs_dentry), GFP_KERNEL);
+
+ if (!g_dentry) {
+ printk(KERN_WARNING "gfxfs: Unable to allocate memory\n");
+ return NULL;
+ }
+
+ /* FIXME: f_dentry needs fixing */
+ g_dentry->f_dentry->d_name.name = name;
+ g_dentry->f_dentry->d_name.len = strlen(name);
+ g_dentry->f_dentry->d_name.hash = full_name_hash(name, strlen(name));
+
+ gfxfs_mknod(parent->f_dentry->d_inode, g_dentry->f_dentry, mode, 0);
+
+ return g_dentry;
+}
+
static int gfxfs_statfs(struct super_block *sb, struct statfs *buf)
{
buf->f_type = GFXFS_SUPER_MAGIC;
@@ -27,6 +65,7 @@
static struct super_operations gfxfs_super_ops = {
statfs: gfxfs_statfs,
+ put_inode: force_delete,
};
static struct super_block *gfxfs_read_super(struct super_block *sb,
@@ -81,12 +120,12 @@
unregister_filesystem(&gfxfs_fs_type);
}
-EXPORT_NO_SYMBOLS;
-
MODULE_AUTHOR("Paul Mundt <pm...@mv...>");
MODULE_DESCRIPTION("graphics file system");
MODULE_LICENSE("GPL");
module_init(init_gfxfs_fs);
module_exit(exit_gfxfs_fs);
+
+EXPORT_SYMBOL(gfxfs_register_entry);
|