dazuko-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dazuko-devel] patch for vanilla kernel 2.6.18


From: Lino Sanfilippo
Subject: [Dazuko-devel] patch for vanilla kernel 2.6.18
Date: Tue, 10 Feb 2009 12:04:48 +0100
User-agent: IceDove 1.5.0.14eol (X11/20090105)



Geschäftsführender Gesellschafter: Tjark Auerbach
Sitz der Gesellschaft: Tettnang
Handelsregister: Amtsgericht Ulm, HRB 630992
ALLGEMEINE GESCHÄFTSBEDINGUNGEN
Es gelten unsere Allgemeinen Geschäftsbedingungen
(AGB). Sie finden sie in der jeweils gültigen Fassung
im Internet unter http://www.avira.de/agb
***************************************************
diff -rup dazukofs-3.0.0-rc4/ctrl_dev.c dazukofs-3.0.0-rc4_2.6.18/ctrl_dev.c
--- dazukofs-3.0.0-rc4/ctrl_dev.c       2009-02-10 10:54:38.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.18/ctrl_dev.c        2009-02-10 10:55:27.000000000 
+0100
@@ -22,6 +22,7 @@
 #include <linux/fs.h>
 #include <linux/cdev.h>
 #include <linux/uaccess.h>
+#include <linux/platform_device.h>
 
 #include "event.h"
 #include "dev.h"
@@ -181,9 +182,11 @@ int dazukofs_ctrl_dev_init(int dev_major
        if (err)
                goto error_out1;
 
+       dev = device_create(dazukofs_class, &platform_bus, 
+                           MKDEV(dev_major, dev_minor), "%s.ctrl", 
+                           DEVICE_NAME);
+
        /* create control device */
-       dev = device_create(dazukofs_class, NULL, MKDEV(dev_major, dev_minor),
-                           NULL, "%s.ctrl", DEVICE_NAME);
        if (IS_ERR(dev)) {
                err = PTR_ERR(dev);
                goto error_out2;
@@ -197,6 +200,7 @@ error_out1:
        return err;
 }
 
+
 void dazukofs_ctrl_dev_destroy(int dev_major, int dev_minor,
                               struct class *dazukofs_class)
 {
diff -rup dazukofs-3.0.0-rc4/dazukofs_fs.h 
dazukofs-3.0.0-rc4_2.6.18/dazukofs_fs.h
--- dazukofs-3.0.0-rc4/dazukofs_fs.h    2009-02-10 10:54:38.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.18/dazukofs_fs.h     2009-02-10 10:55:27.000000000 
+0100
@@ -57,6 +57,36 @@ struct dazukofs_file_info {
        struct file *lower_file;
 };
 
+void fsstack_copy_inode_size(struct inode *dst, const struct inode *src);
+
+static inline
+void fsstack_copy_attr_atime(struct inode *dst, const struct inode *src)
+{
+       dst->i_atime = src->i_atime;
+}
+
+static inline
+void fsstack_copy_attr_times(struct inode *dst, const struct inode *src)
+{
+       dst->i_atime = src->i_atime;
+       dst->i_mtime = src->i_mtime;
+       dst->i_ctime = src->i_ctime;
+}
+
+static inline 
+void fsstack_copy_attr_all(struct inode *dst, const struct inode *src)
+{
+       dst->i_mode = src->i_mode;
+       dst->i_uid = src->i_uid;
+       dst->i_gid = src->i_gid;
+       dst->i_rdev = src->i_rdev;
+       dst->i_atime = src->i_atime;
+       dst->i_mtime = src->i_mtime;
+       dst->i_ctime = src->i_ctime;
+       dst->i_blkbits = src->i_blkbits;
+       dst->i_flags = src->i_flags;
+}
+
 static inline
 struct dazukofs_sb_info *GET_SB_INFO(struct super_block *upper_sb)
 {
diff -rup dazukofs-3.0.0-rc4/dentry.c dazukofs-3.0.0-rc4_2.6.18/dentry.c
--- dazukofs-3.0.0-rc4/dentry.c 2009-02-10 10:54:38.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.18/dentry.c  2009-02-10 10:55:27.000000000 +0100
@@ -25,7 +25,7 @@
 #include <linux/fs.h>
 #include <linux/namei.h>
 #include <linux/mount.h>
-#include <linux/fs_stack.h>
+
 
 #include "dazukofs_fs.h"
 
@@ -65,19 +65,19 @@ static int dazukofs_d_revalidate(struct 
 
        lower_mnt = GET_LOWER_MNT(dentry);
 
-       vfsmount_save = nd->path.mnt;
-       dentry_save = nd->path.dentry;
+       vfsmount_save = nd->mnt;
+       dentry_save = nd->dentry;
 
-       nd->path.mnt = mntget(lower_mnt);
-       nd->path.dentry = dget(lower_dentry);
+       nd->mnt = mntget(lower_mnt);
+       nd->dentry = dget(lower_dentry);
 
        valid = lower_dentry->d_op->d_revalidate(lower_dentry, nd);
 
        mntput(lower_mnt);
        dput(lower_dentry);
 
-       nd->path.mnt = vfsmount_save;
-       nd->path.dentry = dentry_save;
+       nd->mnt = vfsmount_save;
+       nd->dentry = dentry_save;
 
        /* update the inode, even if d_revalidate() != 1 */
        if (dentry->d_inode) {
@@ -85,7 +85,7 @@ static int dazukofs_d_revalidate(struct 
 
                lower_inode = GET_LOWER_INODE(dentry->d_inode);
 
-               fsstack_copy_attr_all(dentry->d_inode, lower_inode, NULL);
+               fsstack_copy_attr_all(dentry->d_inode, lower_inode);
        }
 out:
        return valid;
diff -rup dazukofs-3.0.0-rc4/event.c dazukofs-3.0.0-rc4_2.6.18/event.c
--- dazukofs-3.0.0-rc4/event.c  2009-02-10 10:54:38.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.18/event.c   2009-02-10 10:55:27.000000000 +0100
@@ -23,7 +23,7 @@
 #include <linux/file.h>
 #include <linux/fs.h>
 #include <linux/mount.h>
-#include <linux/freezer.h>
+
 
 #include "dev.h"
 #include "dazukofs_fs.h"
@@ -113,21 +113,21 @@ int dazukofs_init_events(void)
        dazukofs_group_cachep =
                kmem_cache_create("dazukofs_group_cache",
                                  sizeof(struct dazukofs_group), 0,
-                                 SLAB_HWCACHE_ALIGN, NULL);
+                                 SLAB_HWCACHE_ALIGN, NULL, NULL);
        if (!dazukofs_group_cachep)
                goto error_out;
 
        dazukofs_event_container_cachep =
                kmem_cache_create("dazukofs_event_container_cache",
                                  sizeof(struct dazukofs_event_container), 0,
-                                 SLAB_HWCACHE_ALIGN, NULL);
+                                 SLAB_HWCACHE_ALIGN, NULL, NULL);
        if (!dazukofs_event_container_cachep)
                goto error_out;
 
        dazukofs_event_cachep =
                kmem_cache_create("dazukofs_event_cache",
                                  sizeof(struct dazukofs_event), 0,
-                                 SLAB_HWCACHE_ALIGN, NULL);
+                                 SLAB_HWCACHE_ALIGN, NULL, NULL);
        if (!dazukofs_event_cachep)
                goto error_out;
 
@@ -165,8 +165,8 @@ static int capture_group_count(int *cach
 static int get_group_count(void)
 {
        int cache = 0;
-       int ret = wait_event_freezable(__group_count_queue,
-                                      capture_group_count(&cache) == 0);
+       int ret = wait_event_interruptible(__group_count_queue,
+                                       capture_group_count(&cache) == 0);
        if (ret == 0)
                ret = __group_count;
        return ret;
@@ -729,7 +729,7 @@ int dazukofs_check_access(struct dentry 
        put_group_count();
 
        /* wait until event completely processed or signal */
-       err = wait_event_freezable(evt->queue, event_assigned(evt) == 0);
+       err = wait_event_interruptible(evt->queue, event_assigned(evt) == 0);
 
        if (evt->deny)
                err = -EPERM;
@@ -874,7 +874,8 @@ static struct dazukofs_event_container *
        /* move first todo-item to working list */
        mutex_lock(&work_mutex);
        if (!list_empty(&grp->todo_list.list)) {
-               ec = list_first_entry(&grp->todo_list.list,
+               struct list_head *head = &grp->todo_list.list;
+               ec = list_entry(head->next,
                                      struct dazukofs_event_container, list);
                list_del(&ec->list);
                list_add(&ec->list, &grp->working_list.list);
@@ -1004,9 +1005,9 @@ int dazukofs_get_event(unsigned long gro
        }
 
        while (1) {
-               ret = wait_event_freezable(grp->queue,
-                                          is_event_available(grp) ||
-                                          grp->deprecated);
+               ret = wait_event_interruptible(grp->queue,
+                                               is_event_available(grp) ||
+                                               grp->deprecated);
                if (ret != 0)
                        break;
 
diff -rup dazukofs-3.0.0-rc4/file.c dazukofs-3.0.0-rc4_2.6.18/file.c
--- dazukofs-3.0.0-rc4/file.c   2009-02-10 10:54:38.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.18/file.c    2009-02-10 10:55:27.000000000 +0100
@@ -25,7 +25,7 @@
 #include <linux/fs.h>
 #include <linux/mount.h>
 #include <linux/file.h>
-#include <linux/fs_stack.h>
+
 
 #include "dazukofs_fs.h"
 #include "event.h"
diff -rup dazukofs-3.0.0-rc4/group_dev.c dazukofs-3.0.0-rc4_2.6.18/group_dev.c
--- dazukofs-3.0.0-rc4/group_dev.c      2009-02-10 10:54:38.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.18/group_dev.c       2009-02-10 10:55:27.000000000 
+0100
@@ -22,6 +22,7 @@
 #include <linux/fs.h>
 #include <linux/cdev.h>
 #include <linux/uaccess.h>
+#include <linux/platform_device.h>
 
 #include "dazukofs_fs.h"
 #include "event.h"
@@ -209,9 +210,9 @@ int dazukofs_group_dev_init(int dev_majo
 
        /* create group devices */
        for (i = 0; i < GROUP_COUNT; i++) {
-               dev = device_create(dazukofs_class, NULL,
-                                   MKDEV(dev_major, dev_minor_end), NULL,
-                                   "%s.%d", DEVICE_NAME, i);
+               dev = device_create(dazukofs_class, &platform_bus,
+                                   MKDEV(dev_major, dev_minor_end), "%s.%d", 
+                                   DEVICE_NAME, i);
                if (IS_ERR(dev)) {
                        err = PTR_ERR(dev);
                        goto error_out2;
diff -rup dazukofs-3.0.0-rc4/ign_dev.c dazukofs-3.0.0-rc4_2.6.18/ign_dev.c
--- dazukofs-3.0.0-rc4/ign_dev.c        2009-02-10 10:54:38.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.18/ign_dev.c 2009-02-10 10:55:27.000000000 +0100
@@ -22,6 +22,7 @@
 #include <linux/fs.h>
 #include <linux/cdev.h>
 #include <linux/uaccess.h>
+#include <linux/platform_device.h>
 
 #include "dazukofs_fs.h"
 #include "dev.h"
@@ -144,7 +145,7 @@ int dazukofs_ign_dev_init(int dev_major,
        dazukofs_ign_cachep =
                kmem_cache_create("dazukofs_ign_cache",
                                  sizeof(struct dazukofs_proc), 0,
-                                 SLAB_HWCACHE_ALIGN, NULL);
+                                 SLAB_HWCACHE_ALIGN, NULL, NULL);
        if (!dazukofs_ign_cachep) {
                err = -ENOMEM;
                goto error_out1;
@@ -158,8 +159,9 @@ int dazukofs_ign_dev_init(int dev_major,
                goto error_out2;
 
        /* create ignore device */
-       dev = device_create(dazukofs_class, NULL, MKDEV(dev_major, dev_minor),
-                           NULL, "%s.ign", DEVICE_NAME);
+       dev = device_create(dazukofs_class, &platform_bus, 
+                           MKDEV(dev_major, dev_minor), "%s.ign", 
+                           DEVICE_NAME);
        if (IS_ERR(dev)) {
                err = PTR_ERR(dev);
                goto error_out3;
@@ -176,6 +178,7 @@ error_out1:
        return err;
 }
 
+
 void dazukofs_ign_dev_destroy(int dev_major, int dev_minor,
                              struct class *dazukofs_class)
 {
diff -rup dazukofs-3.0.0-rc4/inode.c dazukofs-3.0.0-rc4_2.6.18/inode.c
--- dazukofs-3.0.0-rc4/inode.c  2009-02-10 10:54:38.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.18/inode.c   2009-02-10 10:55:27.000000000 +0100
@@ -26,7 +26,7 @@
 #include <linux/namei.h>
 #include <linux/mount.h>
 #include <linux/uaccess.h>
-#include <linux/fs_stack.h>
+
 
 #include "dazukofs_fs.h"
 
@@ -34,6 +34,12 @@ static struct inode_operations dazukofs_
 static struct inode_operations dazukofs_dir_iops;
 static struct inode_operations dazukofs_main_iops;
 
+void fsstack_copy_inode_size(struct inode *dst, const struct inode *src)
+{
+       i_size_write(dst, i_size_read((struct inode *) src));
+       dst->i_blocks = src->i_blocks;
+}
+
 static int dazukofs_inode_test(struct inode *inode,
                               void *candidate_lower_inode)
 {
@@ -122,7 +128,7 @@ int dazukofs_interpose(struct dentry *lo
        else
                d_instantiate(dentry, inode);
 
-       fsstack_copy_attr_all(inode, lower_inode, NULL);
+       fsstack_copy_attr_all(inode, lower_inode);
        fsstack_copy_inode_size(inode, lower_inode);
 out:
        return err;
@@ -294,19 +300,19 @@ static int dazukofs_create(struct inode 
        mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
                          I_MUTEX_PARENT);
 
-       vfsmount_save = nd->path.mnt;
-       dentry_save = nd->path.dentry;
+       vfsmount_save = nd->mnt;
+       dentry_save = nd->dentry;
 
-       nd->path.mnt = mntget(lower_mnt);
-       nd->path.dentry = dget(lower_dentry);
+       nd->mnt = mntget(lower_mnt);
+       nd->dentry = dget(lower_dentry);
 
        err = vfs_create(lower_dentry_parent_inode, lower_dentry, mode, nd);
 
        mntput(lower_mnt);
        dput(lower_dentry);
 
-       nd->path.mnt = vfsmount_save;
-       nd->path.dentry = dentry_save;
+       nd->mnt = vfsmount_save;
+       nd->dentry = dentry_save;
 
        if (err)
                goto out;
@@ -340,7 +346,8 @@ static int dazukofs_symlink(struct inode
        mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
                          I_MUTEX_PARENT);
 
-       err = vfs_symlink(lower_dentry_parent_inode, lower_dentry, symname);
+       err = vfs_symlink(lower_dentry_parent_inode, lower_dentry, symname,
+                         S_IALLUGO);
        if (err)
                goto out;
 
@@ -452,9 +459,37 @@ static void dazukofs_put_link(struct den
  * Description: Called by the VFS to check for access rights on a
  * POSIX-like filesystem.
  */
-static int dazukofs_permission(struct inode *inode, int mask)
+static int dazukofs_permission(struct inode *inode, int mask,
+                              struct nameidata *nd)
 {
-       return inode_permission(GET_LOWER_INODE(inode), mask);
+       struct vfsmount *lower_mnt = NULL;
+       struct dentry *lower_dentry = NULL;
+       struct vfsmount *vfsmnt_save = NULL;
+       struct dentry *dentry_save = NULL;
+       int err;
+
+       if (nd) {
+               lower_mnt = GET_LOWER_MNT(nd->dentry);
+               lower_dentry = GET_LOWER_DENTRY(nd->dentry);
+
+               vfsmnt_save = nd->mnt;
+               dentry_save = nd->dentry;
+
+               nd->mnt = mntget(lower_mnt);
+               nd->dentry = dget(lower_dentry);
+       }
+
+       err = permission(GET_LOWER_INODE(inode), mask, nd);
+
+       if (nd) {
+               mntput(lower_mnt);
+               dput(lower_dentry);
+
+               nd->mnt = vfsmnt_save;
+               nd->dentry = dentry_save;
+       }
+
+        return err;
 }
 
 /**
@@ -470,7 +505,7 @@ static int dazukofs_setattr(struct dentr
 
        err = notify_change(lower_dentry, ia);
 
-       fsstack_copy_attr_all(inode, lower_inode, NULL);
+       fsstack_copy_attr_all(inode, lower_inode);
        fsstack_copy_inode_size(inode, lower_inode);
 
        return err;
@@ -503,7 +538,7 @@ static int dazukofs_setxattr(struct dent
        err = lower_dentry_inode->i_op->setxattr(lower_dentry, name, value,
                                                 size, flags);
 
-       fsstack_copy_attr_all(dentry->d_inode, lower_dentry_inode, NULL);
+       fsstack_copy_attr_all(dentry->d_inode, lower_dentry_inode);
        fsstack_copy_inode_size(dentry->d_inode, lower_dentry_inode);
 out:
        return err;
@@ -724,10 +759,10 @@ static int dazukofs_rename(struct inode 
        if (err)
                goto out;
 
-       fsstack_copy_attr_all(new_dir, lower_new_dentry_parent_inode, NULL);
+       fsstack_copy_attr_all(new_dir, lower_new_dentry_parent_inode);
        if (new_dir != old_dir)
-               fsstack_copy_attr_all(old_dir, lower_old_dentry_parent_inode,
-                                     NULL);
+               fsstack_copy_attr_all(old_dir, lower_old_dentry_parent_inode);
+                                    
 out:
        dput(lower_old_dentry_parent);
        dput(lower_new_dentry_parent);
diff -rup dazukofs-3.0.0-rc4/Makefile dazukofs-3.0.0-rc4_2.6.18/Makefile
--- dazukofs-3.0.0-rc4/Makefile 2009-02-10 10:54:38.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.18/Makefile  2009-02-10 10:55:27.000000000 +0100
@@ -10,7 +10,7 @@ obj-m += dazukofs.o
 dazukofs-objs := super.o inode.o file.o dentry.o mmap.o group_dev.o ign_dev.o 
ctrl_dev.o dev.o event.o
 
 dazukofs_modules:
-       make -C $(DAZUKOFS_KERNEL_SRC) SUBDIRS="`pwd`" modules
+       make -Wall -C $(DAZUKOFS_KERNEL_SRC) SUBDIRS="`pwd`" modules
 
 dazukofs_install: dazukofs_modules
        mkdir -p $(DAZUKOFS_KERNEL_INSTALL)
diff -rup dazukofs-3.0.0-rc4/super.c dazukofs-3.0.0-rc4_2.6.18/super.c
--- dazukofs-3.0.0-rc4/super.c  2009-02-10 10:54:38.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.18/super.c   2009-02-10 10:55:27.000000000 +0100
@@ -158,8 +158,8 @@ static int dazukofs_read_super(struct su
        if (err)
                return err;
 
-       lower_root = dget(nd.path.dentry);
-       lower_mnt = mntget(nd.path.mnt);
+       lower_root = dget(nd.dentry);
+       lower_mnt = mntget(nd.mnt);
 
        if (IS_ERR(lower_root)) {
                err = PTR_ERR(lower_root);
@@ -170,6 +170,10 @@ static int dazukofs_read_super(struct su
                err = -ENOENT;
                goto out_put;
        }
+       if (!S_ISDIR(lower_root->d_inode->i_mode)) {
+               err = -ENOENT;
+               goto out_put;
+       }
 
        SET_LOWER_SB(sb, lower_root->d_sb);
        sb->s_maxbytes = lower_root->d_sb->s_maxbytes;
@@ -184,7 +188,7 @@ out_put:
        dput(lower_root);
        mntput(lower_mnt);
 out:
-       path_put(&nd.path);
+       path_release(&nd);
        return err;
 }
 
@@ -213,15 +217,16 @@ static int dazukofs_get_sb(struct file_s
 
 out_abort:
        up_write(&sb->s_umount);
+       dput(sb->s_root);
        deactivate_super(sb);
 out:
        return err;
 }
 
-static void init_once(void *data)
+static void init_once(void *vptr, struct kmem_cache *cachep, unsigned long 
flags)
 {
        struct dazukofs_inode_info *inode_info =
-               (struct dazukofs_inode_info *)data;
+               (struct dazukofs_inode_info *)vptr;
 
        memset(inode_info, 0, sizeof(struct dazukofs_inode_info));
        inode_init_once(&(inode_info->vfs_inode));
@@ -256,7 +261,7 @@ static int init_caches(void)
                kmem_cache_create("dazukofs_inode_info_cache",
                                  sizeof(struct dazukofs_inode_info), 0,
                                  SLAB_HWCACHE_ALIGN,
-                                 init_once);
+                                 init_once, NULL);
        if (!dazukofs_inode_info_cachep)
                goto out_nomem;
 
@@ -264,7 +269,7 @@ static int init_caches(void)
                kmem_cache_create("dazukofs_sb_info_cache",
                                  sizeof(struct dazukofs_sb_info), 0,
                                  SLAB_HWCACHE_ALIGN,
-                                 NULL);
+                                 NULL, NULL);
        if (!dazukofs_sb_info_cachep)
                goto out_nomem;
 
@@ -272,7 +277,7 @@ static int init_caches(void)
                kmem_cache_create("dazukofs_dentry_info_cache",
                                  sizeof(struct dazukofs_dentry_info), 0,
                                  SLAB_HWCACHE_ALIGN,
-                                 NULL);
+                                 NULL, NULL);
        if (!dazukofs_dentry_info_cachep)
                goto out_nomem;
 
@@ -280,7 +285,7 @@ static int init_caches(void)
                kmem_cache_create("dazukofs_file_info_cache",
                                  sizeof(struct dazukofs_file_info), 0,
                                  SLAB_HWCACHE_ALIGN,
-                                 NULL);
+                                 NULL, NULL);
        if (!dazukofs_file_info_cachep)
                goto out_nomem;
 
diff -rup dazukofs-3.0.0-rc4/test/showfiles.c 
dazukofs-3.0.0-rc4_2.6.18/test/showfiles.c
--- dazukofs-3.0.0-rc4/test/showfiles.c 2009-02-10 10:54:38.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.18/test/showfiles.c  2009-02-10 10:55:27.000000000 
+0100
@@ -73,6 +73,8 @@ int main(void)
                }
 
                print_access(&acc);
+               
+               acc.deny = 1;
 
                if (dazukofs_return_access(hndl, &acc) != 0) {
                        if (running) {

reply via email to

[Prev in Thread] Current Thread [Next in Thread]