[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dazuko-devel] patch for SLES 10 kernel 2.6.16
From: |
Lino Sanfilippo |
Subject: |
[Dazuko-devel] patch for SLES 10 kernel 2.6.16 |
Date: |
Tue, 10 Feb 2009 12:06:08 +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.16_SLES/ctrl_dev.c
--- dazukofs-3.0.0-rc4/ctrl_dev.c 2009-02-10 11:02:54.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.16_SLES/ctrl_dev.c 2009-02-06 18:27:43.000000000
+0100
@@ -21,7 +21,8 @@
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/cdev.h>
-#include <linux/uaccess.h>
+#include <linux/platform_device.h>
+#include <asm/uaccess.h>
#include "event.h"
#include "dev.h"
@@ -158,7 +159,11 @@ static ssize_t dazukofs_ctrl_write(struc
return ret;
}
-static struct cdev ctrl_cdev;
+static struct {
+ struct cdev cdev;
+ struct device dev;
+ struct class_device cls_dev;
+} ctrl_dev;
static struct file_operations ctrl_fops = {
.owner = THIS_MODULE,
@@ -168,38 +173,67 @@ static struct file_operations ctrl_fops
.write = dazukofs_ctrl_write,
};
+static void dazukofs_ctrl_class_dev_release(struct class_device *dev)
+{
+ // nothing
+}
+
+static void dazukofs_ctrl_dev_release(struct device *dev)
+{
+ // nothing
+}
+
int dazukofs_ctrl_dev_init(int dev_major, int dev_minor,
struct class *dazukofs_class)
{
int err = 0;
- struct device *dev;
+ dev_t devt;
+
+ devt = MKDEV(dev_major, dev_minor);
/* setup cdev for control */
- cdev_init(&ctrl_cdev, &ctrl_fops);
- ctrl_cdev.owner = THIS_MODULE;
- err = cdev_add(&ctrl_cdev, MKDEV(dev_major, dev_minor), 1);
+ cdev_init(&ctrl_dev.cdev, &ctrl_fops);
+ ctrl_dev.cdev.owner = THIS_MODULE;
+ err = cdev_add(&ctrl_dev.cdev, devt, 1);
if (err)
- goto error_out1;
+ return err;
- /* 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;
- }
+ ctrl_dev.dev.parent = &platform_bus;
+ ctrl_dev.dev.release = dazukofs_ctrl_dev_release;
+ snprintf(ctrl_dev.dev.bus_id, BUS_ID_SIZE, "%s.ctrl", DEVICE_NAME);
+
+ err = device_register(&ctrl_dev.dev);
+
+ if (err)
+ goto error_out;
+
+ ctrl_dev.cls_dev.release = dazukofs_ctrl_class_dev_release;
+ ctrl_dev.cls_dev.class = dazukofs_class;
+ ctrl_dev.cls_dev.dev = &ctrl_dev.dev;
+
+ snprintf(ctrl_dev.cls_dev.class_id, BUS_ID_SIZE, "%s.ctrl",
DEVICE_NAME);
+ ctrl_dev.cls_dev.devt = devt;
+
+ err = class_device_register(&ctrl_dev.cls_dev);
+
+ if (err)
+ goto error_out2;
+
return 0;
error_out2:
- cdev_del(&ctrl_cdev);
-error_out1:
+ device_unregister(&ctrl_dev.dev);
+error_out:
+ cdev_del(&ctrl_dev.cdev);
return err;
}
+
void dazukofs_ctrl_dev_destroy(int dev_major, int dev_minor,
struct class *dazukofs_class)
{
- device_destroy(dazukofs_class, MKDEV(dev_major, dev_minor));
- cdev_del(&ctrl_cdev);
+ class_device_unregister(&ctrl_dev.cls_dev);
+ device_unregister(&ctrl_dev.dev);
+ cdev_del(&ctrl_dev.cdev);
}
diff -rup dazukofs-3.0.0-rc4/dazukofs_fs.h
dazukofs-3.0.0-rc4_2.6.16_SLES/dazukofs_fs.h
--- dazukofs-3.0.0-rc4/dazukofs_fs.h 2009-02-10 11:02:54.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.16_SLES/dazukofs_fs.h 2009-02-06
17:48:21.000000000 +0100
@@ -27,7 +27,7 @@
extern struct kmem_cache *dazukofs_dentry_info_cachep;
extern struct kmem_cache *dazukofs_file_info_cachep;
extern struct file_operations dazukofs_main_fops;
-extern const struct file_operations dazukofs_dir_fops;
+extern struct file_operations dazukofs_dir_fops;
extern struct dentry_operations dazukofs_dops;
extern struct address_space_operations dazukofs_aops;
@@ -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.16_SLES/dentry.c
--- dazukofs-3.0.0-rc4/dentry.c 2009-02-10 11:02:54.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.16_SLES/dentry.c 2009-02-06 17:48:21.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/dev.c dazukofs-3.0.0-rc4_2.6.16_SLES/dev.c
--- dazukofs-3.0.0-rc4/dev.c 2009-02-10 11:02:54.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.16_SLES/dev.c 2009-02-06 17:48:21.000000000
+0100
@@ -21,18 +21,31 @@
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/cdev.h>
-#include <linux/uaccess.h>
+#include <asm/uaccess.h>
#include "dazukofs_fs.h"
#include "event.h"
#include "dev.h"
+
+//static CLASS_DEVICE_ATTR(dev, S_IRUGO, read_devnum, NULL);
+
static struct class *dazukofs_class;
static int dev_major;
static int dev_minor_start;
static int dev_minor_end;
+#if 0
+static ssize_t read_devnum(strut class_device *cls_dev, char *buf)
+{
+ dev_t devnum;
+
+ devnum = cls_dev->dev->
+
+}
+#endif
+
int dazukofs_dev_init(void)
{
int err = 0;
diff -rup dazukofs-3.0.0-rc4/event.c dazukofs-3.0.0-rc4_2.6.16_SLES/event.c
--- dazukofs-3.0.0-rc4/event.c 2009-02-10 11:02:54.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.16_SLES/event.c 2009-02-06 17:48:21.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;
@@ -373,9 +373,10 @@ static struct dazukofs_group *create_gro
{
struct dazukofs_group *grp;
- grp = kmem_cache_zalloc(dazukofs_group_cachep, GFP_KERNEL);
+ grp = kmem_cache_alloc(dazukofs_group_cachep, GFP_KERNEL);
if (!grp)
return NULL;
+ memset(grp, 0, sizeof(grp));
atomic_set(&grp->use_count, 0);
grp->group_id = id;
@@ -661,18 +662,24 @@ allocate_event_and_containers(struct daz
{
int i;
- *evt = kmem_cache_zalloc(dazukofs_event_cachep, GFP_KERNEL);
+ *evt = kmem_cache_alloc(dazukofs_event_cachep, GFP_KERNEL);
if (!*evt)
return -1;
+ memset(*evt, 0, sizeof(**evt));
init_waitqueue_head(&(*evt)->queue);
mutex_init(&(*evt)->assigned_mutex);
/* allocate containers now while we don't have a lock */
for (i = 0; i < grp_count; i++) {
- ec_array[i] = kmem_cache_zalloc(
- dazukofs_event_container_cachep, GFP_KERNEL);
- if (!ec_array[i])
+ struct dazukofs_event_container *ec;
+
+ ec = kmem_cache_alloc(dazukofs_event_container_cachep,
+ GFP_KERNEL);
+ if (!ec)
goto error_out;
+ memset(ec, 0, sizeof(*ec));
+
+ ec_array[i] = ec;
}
return 0;
@@ -729,7 +736,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 +881,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 +1012,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.16_SLES/file.c
--- dazukofs-3.0.0-rc4/file.c 2009-02-10 11:02:54.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.16_SLES/file.c 2009-02-10 10:43:31.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"
@@ -37,7 +37,7 @@ static loff_t dazukofs_llseek(struct fil
{
loff_t retval = -EINVAL;
struct file *lower_file = GET_LOWER_FILE(file);
-
+
lower_file->f_pos = file->f_pos;
memcpy(&(lower_file->f_ra), &(file->f_ra),
@@ -174,6 +174,7 @@ static int dazukofs_open(struct inode *i
struct dentry *dentry = file->f_dentry;
struct dentry *lower_dentry = dget(GET_LOWER_DENTRY(dentry));
struct vfsmount *lower_mnt = mntget(GET_LOWER_MNT(dentry));
+ struct dazukofs_file_info *fi;
struct file *lower_file;
int err;
@@ -181,12 +182,14 @@ static int dazukofs_open(struct inode *i
if (err)
goto error_out1;
- SET_FILE_INFO(file, kmem_cache_zalloc(dazukofs_file_info_cachep,
- GFP_KERNEL));
- if (!GET_FILE_INFO(file)) {
+ fi = kmem_cache_alloc(dazukofs_file_info_cachep, GFP_KERNEL);
+ if (!fi) {
err = -ENOMEM;
goto error_out1;
}
+ memset(fi, 0, sizeof(*fi));
+
+ SET_FILE_INFO(file, fi);
lower_file = dentry_open(lower_dentry, lower_mnt, file->f_flags);
if (IS_ERR(lower_file)) {
@@ -306,7 +309,6 @@ struct file_operations dazukofs_main_fop
.release = dazukofs_release,
.fsync = dazukofs_fsync,
.fasync = dazukofs_fasync,
- .splice_read = generic_file_splice_read,
};
/**
@@ -332,7 +334,7 @@ struct file_operations dazukofs_main_fop
* - splice_read (generic)
* - setlease
*/
-const struct file_operations dazukofs_dir_fops = {
+struct file_operations dazukofs_dir_fops = {
.readdir = dazukofs_readdir,
.ioctl = dazukofs_ioctl,
.mmap = generic_file_mmap,
@@ -341,5 +343,4 @@ const struct file_operations dazukofs_di
.release = dazukofs_release,
.fsync = dazukofs_fsync,
.fasync = dazukofs_fasync,
- .splice_read = generic_file_splice_read,
};
diff -rup dazukofs-3.0.0-rc4/group_dev.c
dazukofs-3.0.0-rc4_2.6.16_SLES/group_dev.c
--- dazukofs-3.0.0-rc4/group_dev.c 2009-02-10 11:02:54.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.16_SLES/group_dev.c 2009-02-06 19:04:28.000000000
+0100
@@ -21,31 +21,55 @@
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/cdev.h>
-#include <linux/uaccess.h>
+#include <linux/platform_device.h>
+#include <asm/uaccess.h>
#include "dazukofs_fs.h"
#include "event.h"
#include "dev.h"
-static int dazukofs_group_open(int group_id, struct inode *inode,
+
+
+
+struct group_device {
+ struct cdev cdev;
+ struct device dev;
+ struct class_device cls_dev;
+ int id;
+ int track;
+};
+
+static struct group_device *grp_devs;
+static int minor_start; /* initial minor number */
+
+static int dazukofs_group_open(struct inode *inode,
struct file *file)
{
- if (dazukofs_group_open_tracking(group_id))
- file->private_data = file;
- else
- file->private_data = NULL;
+ int id;
+ struct group_device *gdev;
+
+ id = MINOR(inode->i_rdev) - minor_start;
+ gdev = &grp_devs[id];
+
+ gdev->track = dazukofs_group_open_tracking(id);
+ gdev->id = id;
+ file->private_data = gdev;
return 0;
}
-static int dazukofs_group_release(int group_id, struct inode *inode,
+static int dazukofs_group_release(struct inode *inode,
struct file *file)
{
- if (file->private_data)
- dazukofs_group_release_tracking(group_id);
+ struct group_device *gdev;
+
+ gdev = (struct group_device *) file->private_data;
+
+ if (gdev->track)
+ dazukofs_group_release_tracking(gdev->id);
return 0;
}
-static ssize_t dazukofs_group_read(int group_id, struct file *file,
+static ssize_t dazukofs_group_read(struct file *file,
char __user *buffer, size_t length,
loff_t *pos)
{
@@ -56,6 +80,9 @@ static ssize_t dazukofs_group_read(int g
int fd;
int err;
unsigned long event_id;
+ struct group_device *gdev;
+
+ gdev = (struct group_device *) file->private_data;
if (*pos > 0)
return 0;
@@ -63,7 +90,7 @@ static ssize_t dazukofs_group_read(int g
if (length < DAZUKOFS_MIN_READ_BUFFER)
return -EINVAL;
- err = dazukofs_get_event(group_id, &event_id, &fd, &pid);
+ err = dazukofs_get_event(gdev->id, &event_id, &fd, &pid);
if (err) {
if (err == -ERESTARTSYS)
return -EINTR;
@@ -83,7 +110,7 @@ static ssize_t dazukofs_group_read(int g
return tmp_used;
}
-static ssize_t dazukofs_group_write(int group_id, struct file *file,
+static ssize_t dazukofs_group_write(struct file *file,
const char __user *buffer, size_t length,
loff_t *pos)
{
@@ -94,6 +121,9 @@ static ssize_t dazukofs_group_write(int
char *p;
char *p2;
int ret;
+ struct group_device *gdev;
+
+ gdev = (struct group_device *) file->private_data;
if (length >= DAZUKOFS_MAX_WRITE_BUFFER)
length = DAZUKOFS_MAX_WRITE_BUFFER - 1;
@@ -118,7 +148,7 @@ static ssize_t dazukofs_group_write(int
return -EINVAL;
response = (*(p + 2)) - '0';
- ret = dazukofs_return_event(group_id, event_id, response);
+ ret = dazukofs_return_event(gdev->id, event_id, response);
if (ret == 0) {
*pos += length;
ret = length;
@@ -129,104 +159,105 @@ static ssize_t dazukofs_group_write(int
return ret;
}
-#define DECLARE_GROUP_FOPS(group_id) \
-static int \
-dazukofs_group_open_##group_id(struct inode *inode, struct file *file) \
-{ \
- return dazukofs_group_open(group_id, inode, file); \
-} \
-static int \
-dazukofs_group_release_##group_id(struct inode *inode, struct file *file) \
-{ \
- return dazukofs_group_release(group_id, inode, file); \
-} \
-static ssize_t \
-dazukofs_group_read_##group_id(struct file *file, char __user *buffer, \
- size_t length, loff_t *pos) \
-{ \
- return dazukofs_group_read(group_id, file, buffer, length, pos); \
-} \
-static ssize_t \
-dazukofs_group_write_##group_id(struct file *file, \
- const char __user *buffer, size_t length, \
- loff_t *pos) \
-{ \
- return dazukofs_group_write(group_id, file, buffer, length, pos); \
-} \
-static struct file_operations group_fops_##group_id = { \
- .owner = THIS_MODULE, \
- .open = dazukofs_group_open_##group_id, \
- .release = dazukofs_group_release_##group_id, \
- .read = dazukofs_group_read_##group_id, \
- .write = dazukofs_group_write_##group_id, \
+struct file_operations grp_fops = {
+ .owner = THIS_MODULE,
+ .open = dazukofs_group_open,
+ .release = dazukofs_group_release,
+ .read = dazukofs_group_read,
+ .write = dazukofs_group_write,
};
-DECLARE_GROUP_FOPS(0)
-DECLARE_GROUP_FOPS(1)
-DECLARE_GROUP_FOPS(2)
-DECLARE_GROUP_FOPS(3)
-DECLARE_GROUP_FOPS(4)
-DECLARE_GROUP_FOPS(5)
-DECLARE_GROUP_FOPS(6)
-DECLARE_GROUP_FOPS(7)
-DECLARE_GROUP_FOPS(8)
-DECLARE_GROUP_FOPS(9)
-
-static struct cdev groups_cdev[GROUP_COUNT];
-
-static struct file_operations *group_fops[GROUP_COUNT] = {
- &group_fops_0,
- &group_fops_1,
- &group_fops_2,
- &group_fops_3,
- &group_fops_4,
- &group_fops_5,
- &group_fops_6,
- &group_fops_7,
- &group_fops_8,
- &group_fops_9,
-};
+
+static void dazukofs_group_class_dev_release(struct class_device *cls_dev)
+{
+ // nothing
+}
+
+static void dazukofs_group_dev_release(struct device *dev)
+{
+ // Nothing
+}
+
+static int __dazukofs_group_dev_init(dev_t devt, struct class *cls,
+ struct group_device *gdev, char *name)
+{
+ int err;
+
+ cdev_init(&gdev->cdev, &grp_fops);
+ gdev->cdev.owner = THIS_MODULE;
+
+ err = cdev_add(&gdev->cdev, devt, GROUP_COUNT);
+
+ if (err)
+ return -1;
+
+ gdev->dev.parent = &platform_bus;
+ gdev->dev.release = dazukofs_group_dev_release;
+ strncpy(gdev->dev.bus_id, name, BUS_ID_SIZE);
+
+ err = device_register(&gdev->dev);
+
+ if (err)
+ goto err_out;
+
+ gdev->cls_dev.release = dazukofs_group_class_dev_release;
+ gdev->cls_dev.class = cls;
+ gdev->cls_dev.dev = &gdev->dev;
+ strncpy(gdev->cls_dev.class_id, name, BUS_ID_SIZE);
+ gdev->cls_dev.devt = devt;
+
+ err = class_device_register(&gdev->cls_dev);
+
+ if (err)
+ goto err_out2;
+
+ return 0;
+
+err_out2:
+ device_unregister(&gdev->dev);
+err_out:
+ cdev_del(&gdev->cdev);
+
+ return err;
+}
int dazukofs_group_dev_init(int dev_major, int dev_minor_start,
struct class *dazukofs_class)
{
- int err = 0;
- struct device *dev;
+ int err;
int i;
- int cdev_count;
- int dev_minor_end = dev_minor_start;
+ dev_t devt;
+ struct group_device *gdev;
+ char name[BUS_ID_SIZE];
- /* setup cdevs for groups */
- for (cdev_count = 0; cdev_count < GROUP_COUNT; cdev_count++) {
- cdev_init(&groups_cdev[cdev_count], group_fops[cdev_count]);
- groups_cdev[cdev_count].owner = THIS_MODULE;
- err = cdev_add(&groups_cdev[cdev_count],
- MKDEV(dev_major, dev_minor_start + cdev_count),
- GROUP_COUNT);
- if (err)
- goto error_out1;
- }
+ grp_devs = kzalloc(sizeof(struct group_device) * GROUP_COUNT,
+ GFP_KERNEL);
+
+ if (!grp_devs)
+ return -ENOMEM;
/* 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);
- if (IS_ERR(dev)) {
- err = PTR_ERR(dev);
- goto error_out2;
- }
- dev_minor_end++;
+ gdev = &grp_devs[i];
+ devt = MKDEV(dev_major, dev_minor_start + i);
+ snprintf(name, sizeof(name), "%s.%i", DEVICE_NAME, i);
+ err = __dazukofs_group_dev_init(devt, dazukofs_class,
+ gdev, name);
+ if (err)
+ goto undo;
}
- return dev_minor_end;
+ minor_start = dev_minor_start;
+ return i;
-error_out2:
- for (i = dev_minor_start; i < dev_minor_end; i++)
- device_destroy(dazukofs_class, MKDEV(dev_major, i));
-error_out1:
- for (i = 0; i < cdev_count; i++)
- cdev_del(&groups_cdev[i]);
+undo:
+ while(i) {
+ i--;
+ gdev = &grp_devs[i];
+ class_device_unregister(&gdev->cls_dev);
+ device_unregister(&gdev->dev);
+ cdev_del(&gdev->cdev);
+ }
return err;
}
@@ -236,9 +267,14 @@ void dazukofs_group_dev_destroy(int dev_
{
int i;
- for (i = dev_minor_start; i < dev_minor_end; i++)
- device_destroy(dazukofs_class, MKDEV(dev_major, i));
+ for (i = 0; i < GROUP_COUNT; i++) {
+ struct group_device *gdev;
+
+ gdev = &grp_devs[i];
- for (i = 0; i < GROUP_COUNT; i++)
- cdev_del(&groups_cdev[i]);
+ class_device_unregister(&gdev->cls_dev);
+ device_unregister(&gdev->dev);
+ cdev_del(&gdev->cdev);
+ }
+ kfree(grp_devs);
}
diff -rup dazukofs-3.0.0-rc4/ign_dev.c dazukofs-3.0.0-rc4_2.6.16_SLES/ign_dev.c
--- dazukofs-3.0.0-rc4/ign_dev.c 2009-02-10 11:02:54.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.16_SLES/ign_dev.c 2009-02-06 18:29:19.000000000
+0100
@@ -21,7 +21,8 @@
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/cdev.h>
-#include <linux/uaccess.h>
+#include <linux/platform_device.h>
+#include <asm/uaccess.h>
#include "dazukofs_fs.h"
#include "dev.h"
@@ -56,12 +57,14 @@ int dazukofs_check_ignore_process(void)
static int dazukofs_add_ign(struct file *file)
{
- struct dazukofs_proc *proc =
- kmem_cache_zalloc(dazukofs_ign_cachep, GFP_KERNEL);
+ struct dazukofs_proc *proc;
+
+ proc = kmem_cache_alloc(dazukofs_ign_cachep, GFP_KERNEL);
if (!proc) {
file->private_data = NULL;
return -ENOMEM;
}
+ memset(proc, 0, sizeof(*proc));
file->private_data = proc;
proc->curr = current;
@@ -124,7 +127,11 @@ static void dazukofs_destroy_ignlist(voi
}
}
-static struct cdev ign_cdev;
+static struct {
+ struct cdev cdev;
+ struct device dev;
+ struct class_device cls_dev;
+} ign_dev;
static struct file_operations ign_fops = {
.owner = THIS_MODULE,
@@ -132,11 +139,23 @@ static struct file_operations ign_fops =
.release = dazukofs_ign_release,
};
+
+static void dazukofs_ign_class_dev_release(struct class_device *dev)
+{
+ // nothing
+}
+
+static void dazukofs_ign_dev_release(struct device *dev)
+{
+ // nothing
+}
+
+
int dazukofs_ign_dev_init(int dev_major, int dev_minor,
struct class *dazukofs_class)
{
- int err = 0;
- struct device *dev;
+ dev_t devt;
+ int err;
INIT_LIST_HEAD(&ign_list.list);
mutex_init(&ign_list_mutex);
@@ -144,43 +163,57 @@ 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);
- if (!dazukofs_ign_cachep) {
- err = -ENOMEM;
- goto error_out1;
- }
+ SLAB_HWCACHE_ALIGN, NULL, NULL);
+ if (!dazukofs_ign_cachep)
+ return -ENOMEM;
+
+ devt = MKDEV(dev_major, dev_minor);
/* setup cdev for ignore */
- cdev_init(&ign_cdev, &ign_fops);
- ign_cdev.owner = THIS_MODULE;
- err = cdev_add(&ign_cdev, MKDEV(dev_major, dev_minor), 1);
+ cdev_init(&ign_dev.cdev, &ign_fops);
+ ign_dev.cdev.owner = THIS_MODULE;
+ err = cdev_add(&ign_dev.cdev, devt, 1);
if (err)
+ goto error_out;
+
+ ign_dev.dev.parent = &platform_bus;
+ ign_dev.dev.release = dazukofs_ign_dev_release;
+ snprintf(ign_dev.dev.bus_id, BUS_ID_SIZE, "%s.ign", DEVICE_NAME);
+
+ err = device_register(&ign_dev.dev);
+
+ if (err)
goto error_out2;
- /* create ignore device */
- dev = device_create(dazukofs_class, NULL, MKDEV(dev_major, dev_minor),
- NULL, "%s.ign", DEVICE_NAME);
- if (IS_ERR(dev)) {
- err = PTR_ERR(dev);
+ ign_dev.cls_dev.release = dazukofs_ign_class_dev_release;
+ ign_dev.cls_dev.class = dazukofs_class;
+ ign_dev.cls_dev.dev = &ign_dev.dev;
+ snprintf(ign_dev.cls_dev.class_id, BUS_ID_SIZE, "%s.ign", DEVICE_NAME);
+ ign_dev.cls_dev.devt = devt;
+
+ err = class_device_register(&ign_dev.cls_dev);
+
+ if (err)
goto error_out3;
- }
- return 0;
+ return 0;
error_out3:
- cdev_del(&ign_cdev);
+ device_unregister(&ign_dev.dev);
error_out2:
- dazukofs_destroy_ignlist();
+ cdev_del(&ign_dev.cdev);
+error_out:
kmem_cache_destroy(dazukofs_ign_cachep);
-error_out1:
return err;
}
+
void dazukofs_ign_dev_destroy(int dev_major, int dev_minor,
struct class *dazukofs_class)
{
- device_destroy(dazukofs_class, MKDEV(dev_major, dev_minor));
- cdev_del(&ign_cdev);
+ class_device_unregister(&ign_dev.cls_dev);
+ device_unregister(&ign_dev.dev);
+ cdev_del(&ign_dev.cdev);
dazukofs_destroy_ignlist();
kmem_cache_destroy(dazukofs_ign_cachep);
}
diff -rup dazukofs-3.0.0-rc4/inode.c dazukofs-3.0.0-rc4_2.6.16_SLES/inode.c
--- dazukofs-3.0.0-rc4/inode.c 2009-02-10 11:02:54.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.16_SLES/inode.c 2009-02-10 10:41:36.000000000
+0100
@@ -25,15 +25,20 @@
#include <linux/fs.h>
#include <linux/namei.h>
#include <linux/mount.h>
-#include <linux/uaccess.h>
-#include <linux/fs_stack.h>
+#include <asm/uaccess.h>
#include "dazukofs_fs.h"
static struct inode_operations dazukofs_symlink_iops;
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 +127,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;
@@ -148,6 +153,7 @@ static struct dentry *dazukofs_lookup(st
struct dentry *lower_dentry;
struct dentry *lower_dentry_parent;
struct vfsmount *lower_mnt;
+ struct dazukofs_dentry_info *di;
int err = 0;
if ((dentry->d_name.len == 1 && !strcmp(dentry->d_name.name, "."))
@@ -171,13 +177,16 @@ static struct dentry *dazukofs_lookup(st
BUG_ON(!atomic_read(&lower_dentry->d_count));
- SET_DENTRY_INFO(dentry, kmem_cache_zalloc(dazukofs_dentry_info_cachep,
- GFP_KERNEL));
-
- if (!GET_DENTRY_INFO(dentry)) {
+ di = kmem_cache_alloc(dazukofs_dentry_info_cachep, GFP_KERNEL);
+
+ if (!di) {
err = -ENOMEM;
goto out_dput;
}
+ memset(di, 0, sizeof(*di));
+
+ SET_DENTRY_INFO(dentry, di);
+
lower_mnt = mntget(GET_LOWER_MNT(dentry->d_parent));
@@ -216,14 +225,15 @@ static int dazukofs_mknod(struct inode *
dev_t dev)
{
struct dentry *lower_dentry = GET_LOWER_DENTRY(dentry);
+ struct vfsmount *lower_mount = GET_LOWER_MNT(dentry);
struct dentry *lower_dentry_parent = dget(lower_dentry->d_parent);
struct inode *lower_dentry_parent_inode = lower_dentry_parent->d_inode;
int err = -ENOENT;
- mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
- I_MUTEX_PARENT);
+ mutex_lock(&(lower_dentry_parent_inode->i_mutex));
- err = vfs_mknod(lower_dentry_parent_inode, lower_dentry, mode, dev);
+ err = vfs_mknod(lower_dentry_parent_inode, lower_dentry, lower_mount,
+ mode, dev);
if (err)
goto out;
@@ -248,14 +258,15 @@ out:
static int dazukofs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
{
struct dentry *lower_dentry = GET_LOWER_DENTRY(dentry);
+ struct vfsmount *lower_mount = GET_LOWER_MNT(dentry);
struct dentry *lower_dentry_parent = dget(lower_dentry->d_parent);
struct inode *lower_dentry_parent_inode = lower_dentry_parent->d_inode;
int err = -ENOENT;
- mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
- I_MUTEX_PARENT);
+ mutex_lock(&(lower_dentry_parent_inode->i_mutex));
- err = vfs_mkdir(lower_dentry_parent_inode, lower_dentry, mode);
+ err = vfs_mkdir(lower_dentry_parent_inode, lower_dentry, lower_mount,
+ mode);
if (err)
goto out;
@@ -291,22 +302,21 @@ static int dazukofs_create(struct inode
struct dentry *dentry_save;
int err = -ENOENT;
- mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
- I_MUTEX_PARENT);
+ mutex_lock(&(lower_dentry_parent_inode->i_mutex));
- 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;
@@ -333,14 +343,15 @@ static int dazukofs_symlink(struct inode
const char *symname)
{
struct dentry *lower_dentry = GET_LOWER_DENTRY(dentry);
+ struct vfsmount *lower_mount = GET_LOWER_MNT(dentry);
struct dentry *lower_dentry_parent = dget(lower_dentry->d_parent);
struct inode *lower_dentry_parent_inode = lower_dentry_parent->d_inode;
int err = -ENOENT;
- mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
- I_MUTEX_PARENT);
+ mutex_lock(&(lower_dentry_parent_inode->i_mutex));
- err = vfs_symlink(lower_dentry_parent_inode, lower_dentry, symname);
+ err = vfs_symlink(lower_dentry_parent_inode, lower_dentry, lower_mount,
+ symname, S_IALLUGO);
if (err)
goto out;
@@ -452,9 +463,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;
}
/**
@@ -464,13 +503,14 @@ static int dazukofs_permission(struct in
static int dazukofs_setattr(struct dentry *dentry, struct iattr *ia)
{
struct dentry *lower_dentry = GET_LOWER_DENTRY(dentry);
+ struct vfsmount *lower_mount = GET_LOWER_MNT(dentry);
struct inode *inode = dentry->d_inode;
struct inode *lower_inode = GET_LOWER_INODE(inode);
int err;
- err = notify_change(lower_dentry, ia);
+ err = notify_change(lower_dentry, lower_mount,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 +543,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;
@@ -602,16 +642,19 @@ static int dazukofs_link(struct dentry *
struct dentry *new_dentry)
{
struct dentry *lower_old_dentry = GET_LOWER_DENTRY(old_dentry);
+ struct vfsmount *lower_old_mount = GET_LOWER_MNT(old_dentry);
struct dentry *lower_new_dentry = GET_LOWER_DENTRY(new_dentry);
+ struct vfsmount *lower_new_mount = GET_LOWER_MNT(new_dentry);
+
struct dentry *lower_dentry_parent = dget(lower_new_dentry->d_parent);
struct inode *lower_dentry_parent_inode = lower_dentry_parent->d_inode;
int err = -ENOENT;
- mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
- I_MUTEX_PARENT);
+ mutex_lock(&(lower_dentry_parent_inode->i_mutex));
- err = vfs_link(lower_old_dentry, lower_dentry_parent_inode,
- lower_new_dentry);
+ err = vfs_link(lower_old_dentry, lower_old_mount,
+ lower_dentry_parent_inode, lower_new_dentry,
+ lower_new_mount);
if (err)
goto out;
@@ -635,14 +678,14 @@ out:
static int dazukofs_unlink(struct inode *dir, struct dentry *dentry)
{
struct dentry *lower_dentry = GET_LOWER_DENTRY(dentry);
+ struct vfsmount *lower_mount = GET_LOWER_MNT(dentry);
struct dentry *lower_dentry_parent = dget(lower_dentry->d_parent);
struct inode *lower_dentry_parent_inode = lower_dentry_parent->d_inode;
int err;
- mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
- I_MUTEX_PARENT);
+ mutex_lock(&(lower_dentry_parent_inode->i_mutex));
- err = vfs_unlink(lower_dentry_parent_inode, lower_dentry);
+ err = vfs_unlink(lower_dentry_parent_inode, lower_dentry, lower_mount);
if (err)
goto out;
@@ -664,14 +707,14 @@ out:
static int dazukofs_rmdir(struct inode *dir, struct dentry *dentry)
{
struct dentry *lower_dentry = GET_LOWER_DENTRY(dentry);
+ struct vfsmount *lower_mount = GET_LOWER_MNT(dentry);
struct dentry *lower_dentry_parent = dget(lower_dentry->d_parent);
struct inode *lower_dentry_parent_inode = lower_dentry_parent->d_inode;
int err;
- mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
- I_MUTEX_PARENT);
+ mutex_lock(&(lower_dentry_parent_inode->i_mutex));
- err = vfs_rmdir(lower_dentry_parent_inode, lower_dentry);
+ err = vfs_rmdir(lower_dentry_parent_inode, lower_dentry, lower_mount);
if (err)
goto out;
@@ -695,7 +738,9 @@ static int dazukofs_rename(struct inode
struct inode *new_dir, struct dentry *new_dentry)
{
struct dentry *lower_old_dentry = GET_LOWER_DENTRY(old_dentry);
+ struct vfsmount *lower_old_mount = GET_LOWER_MNT(old_dentry);
struct dentry *lower_new_dentry = GET_LOWER_DENTRY(new_dentry);
+ struct vfsmount *lower_new_mount = GET_LOWER_MNT(new_dentry);
struct dentry *lower_old_dentry_parent =
dget(lower_old_dentry->d_parent);
struct dentry *lower_new_dentry_parent =
@@ -718,16 +763,17 @@ static int dazukofs_rename(struct inode
lock_rename(lower_old_dentry_parent, lower_new_dentry_parent);
err = vfs_rename(lower_old_dentry_parent_inode, lower_old_dentry,
- lower_new_dentry_parent_inode, lower_new_dentry);
+ lower_old_mount, lower_new_dentry_parent_inode,
+ lower_new_dentry, lower_new_mount);
unlock_rename(lower_old_dentry_parent, lower_new_dentry_parent);
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.16_SLES/Makefile
--- dazukofs-3.0.0-rc4/Makefile 2009-02-10 11:02:54.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.16_SLES/Makefile 2009-02-06 17:48:21.000000000
+0100
@@ -1,8 +1,9 @@
#
# Makefile for the dazukofs-filesystem routines.
#
-
-DAZUKOFS_KERNEL_SRC = /lib/modules/`uname -r`/build
+EXTRAC_CFLAGS += -Wall
+#DAZUKOFS_KERNEL_SRC = /lib/modules/2.6.16.60-0.21-smp/build
+DAZUKOFS_KERNEL_SRC = /usr/src/linux-2.6.16.60-0.21-obj/x86_64/default
DAZUKOFS_KERNEL_INSTALL = /lib/modules/`uname -r`/kernel/fs/dazukofs
obj-m += dazukofs.o
@@ -10,7 +11,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.16_SLES/super.c
--- dazukofs-3.0.0-rc4/super.c 2009-02-10 11:02:54.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.16_SLES/super.c 2009-02-06 17:48:21.000000000
+0100
@@ -114,9 +114,10 @@ static int dazukofs_fill_super(struct su
static const struct qstr name = { .name = "/", .len = 1 };
struct dazukofs_dentry_info *di;
- sbi = kmem_cache_zalloc(dazukofs_sb_info_cachep, GFP_KERNEL);
+ sbi = kmem_cache_alloc(dazukofs_sb_info_cachep, GFP_KERNEL);
if (!sbi)
return -ENOMEM;
+ memset(sbi, 0, sizeof(*sbi));
sb->s_op = &dazukofs_sops;
@@ -132,12 +133,13 @@ static int dazukofs_fill_super(struct su
sb->s_root->d_sb = sb;
sb->s_root->d_parent = sb->s_root;
- di = kmem_cache_zalloc(dazukofs_dentry_info_cachep, GFP_KERNEL);
+ di = kmem_cache_alloc(dazukofs_dentry_info_cachep, GFP_KERNEL);
if (!di) {
kmem_cache_free(dazukofs_sb_info_cachep, sbi);
dput(sb->s_root);
return -ENOMEM;
}
+ memset(di, 0, sizeof(*di));
SET_DENTRY_INFO(sb->s_root, di);
@@ -158,8 +160,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);
@@ -171,6 +173,11 @@ static int dazukofs_read_super(struct su
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;
SET_LOWER_DENTRY(sb->s_root, lower_root, lower_mnt);
@@ -184,44 +191,42 @@ out_put:
dput(lower_root);
mntput(lower_mnt);
out:
- path_put(&nd.path);
+ path_release(&nd);
return err;
}
-static int dazukofs_get_sb(struct file_system_type *fs_type, int flags,
- const char *dev_name, void *data,
- struct vfsmount *mnt)
+static struct super_block *
+dazukofs_get_sb(struct file_system_type *fs_type, int flags,
+ const char *dev_name, void *data)
{
struct super_block *sb;
int err;
- err = get_sb_nodev(fs_type, flags, data, dazukofs_fill_super, mnt);
- if (err)
- goto out;
-
- sb = mnt->mnt_sb;
+ sb = get_sb_nodev(fs_type, flags, data, dazukofs_fill_super);
+ if (IS_ERR(sb))
+ return sb;
err = dazukofs_parse_mount_options(data, sb);
if (err)
- goto out_abort;
+ goto out;
err = dazukofs_read_super(sb, dev_name);
if (err)
- goto out_abort;
+ goto out;
- goto out;
+ return sb;
-out_abort:
+out:
up_write(&sb->s_umount);
+ dput(sb->s_root);
deactivate_super(sb);
-out:
- return err;
+ return ERR_PTR(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.16_SLES/test/showfiles.c
--- dazukofs-3.0.0-rc4/test/showfiles.c 2009-02-10 11:02:54.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.16_SLES/test/showfiles.c 2009-02-06
17:48:21.000000000 +0100
@@ -73,6 +73,8 @@ int main(void)
}
print_access(&acc);
+
+ acc.deny = 1;
if (dazukofs_return_access(hndl, &acc) != 0) {
if (running) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dazuko-devel] patch for SLES 10 kernel 2.6.16,
Lino Sanfilippo <=