[Ocfs2-commits] jlbec commits r2062 - in trunk/fs: ocfs2/cluster
usysfs
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Fri Mar 25 20:10:32 CST 2005
Author: jlbec
Signed-off-by: manish
Date: 2005-03-25 20:10:28 -0600 (Fri, 25 Mar 2005)
New Revision: 2062
Modified:
trunk/fs/ocfs2/cluster/nodemanager.c
trunk/fs/usysfs/bobtest.c
trunk/fs/usysfs/dir.c
trunk/fs/usysfs/usysfs.h
Log:
o Introduce the USYSFS_USET_DIR flag to usysfs_dirent->s_type. This
signals that a directory is a set, not an object.
o Use this flag to determine whether to behave as a set.
o Remove the requirement for sets to have set_ops, now that we can
determine sethood intrinsicly.
Signed-off-by: manish
Modified: trunk/fs/ocfs2/cluster/nodemanager.c
===================================================================
--- trunk/fs/ocfs2/cluster/nodemanager.c 2005-03-26 01:47:47 UTC (rev 2061)
+++ trunk/fs/ocfs2/cluster/nodemanager.c 2005-03-26 02:10:28 UTC (rev 2062)
@@ -446,12 +446,8 @@
.release = nm_node_release,
};
-static struct usysfs_set_operations nm_node_set_ops = {
-};
-
static struct uobj_type nm_node_type = {
.object_ops = &nm_node_object_ops,
- .set_ops = &nm_node_set_ops,
.sysfs_ops = &nm_node_sysfs_ops,
.default_attrs = nm_node_default_attrs,
.owner = THIS_MODULE,
@@ -584,12 +580,8 @@
.release = nm_cluster_release,
};
-static struct usysfs_set_operations nm_cluster_set_ops = {
-};
-
static struct uobj_type nm_cluster_type = {
.object_ops = &nm_cluster_object_ops,
- .set_ops = &nm_cluster_set_ops,
.sysfs_ops = NULL, /* no attributes */
.owner = THIS_MODULE,
};
Modified: trunk/fs/usysfs/bobtest.c
===================================================================
--- trunk/fs/usysfs/bobtest.c 2005-03-26 01:47:47 UTC (rev 2061)
+++ trunk/fs/usysfs/bobtest.c 2005-03-26 02:10:28 UTC (rev 2062)
@@ -579,16 +579,12 @@
kfree(tom);
}
-static struct usysfs_set_operations tom_set_ops = {
-};
-
static struct usysfs_object_operations tom_object_ops = {
.release = tom_release,
};
static struct uobj_type uktype_tom = {
.object_ops = &tom_object_ops,
- .set_ops = &tom_set_ops,
.sysfs_ops = &tom_sysfs_ops,
.default_attrs = tom_attrs,
.owner = THIS_MODULE,
Modified: trunk/fs/usysfs/dir.c
===================================================================
--- trunk/fs/usysfs/dir.c 2005-03-26 01:47:47 UTC (rev 2061)
+++ trunk/fs/usysfs/dir.c 2005-03-26 02:10:28 UTC (rev 2062)
@@ -566,9 +566,13 @@
struct dentry *dentry)
{
int ret;
+ struct usysfs_dirent *sd;
ret = usysfs_instantiate_object(parent_uobj, uobj, dentry);
if (!ret) {
+ sd = dentry->d_fsdata;
+ sd->s_type |= USYSFS_USET_DIR;
+
ret = populate_sets(to_uset(uobj));
if (ret) {
usysfs_drop_object(uobj);
@@ -599,7 +603,7 @@
uktype = parent_uobj->ktype;
BUG_ON(!uktype);
- if (uktype->set_ops->drop_object)
+ if (uktype->set_ops && uktype->set_ops->drop_object)
uktype->set_ops->drop_object(to_uset(parent_uobj),
uobj);
else
@@ -613,6 +617,7 @@
struct uset *uset;
struct uobject *uobj;
struct uobject *parent_uobj;
+ struct usysfs_dirent *sd;
struct uobj_type *uktype;
struct module *owner;
char *name;
@@ -620,10 +625,14 @@
if (dentry->d_parent == usysfs_sb->s_root)
return -EPERM;
+ sd = dentry->d_parent->d_fsdata;
+ if (!(sd->s_type & USYSFS_USET_DIR))
+ return -EPERM;
+
parent_uobj = usysfs_get_uobject(dentry->d_parent);
uktype = parent_uobj->ktype;
- if (!uktype ||
+ if (!uktype || !uktype->set_ops ||
(!uktype->set_ops->make_set &&
!uktype->set_ops->make_object)) {
uobject_put(parent_uobj);
@@ -672,19 +681,6 @@
return ret;
}
-/* Sets must have make_set() or make_object() */
-static int is_set(struct uobject *uobj)
-{
- int ret = 0;
- struct uobj_type *uktype;
-
- uktype = uobj->ktype;
- if (uktype && uktype->set_ops)
- ret = 1;
-
- return ret;
-}
-
static int usysfs_rmdir(struct inode *dir, struct dentry *dentry)
{
struct uobject *parent_uobj;
@@ -721,7 +717,7 @@
if (uobj->ktype)
owner = uobj->ktype->owner;
- if (is_set(uobj))
+ if (sd->s_type & USYSFS_USET_DIR)
usysfs_drop_set(uobj);
else
usysfs_drop_object(uobj);
Modified: trunk/fs/usysfs/usysfs.h
===================================================================
--- trunk/fs/usysfs/usysfs.h 2005-03-26 01:47:47 UTC (rev 2061)
+++ trunk/fs/usysfs/usysfs.h 2005-03-26 02:10:28 UTC (rev 2062)
@@ -43,18 +43,17 @@
/*
- * Usysfs objects must have a ->ktype of type uobj_type.
* If allow_link() exists, the object can symlink(2) out to other
- * objects. If the object is a uset, it may support mkdir(2). Kset
- * objects must supply one of make_set() and make_object(). If the
+ * objects. If the object is a uset, it may support mkdir(2). Uset
+ * objects supply one of make_set() and make_object(). If the
* object supports make_set(), one can create uset children. If it
* supports make_object(), one can create uobject children. If it has
* default_sets on uset->default_sets, it has automatically created
* uset children. default_sets may coexist alongsize make_set() or
* make_object(), but if the uset wishes to have only default_sets
- * children (disallowing mkdir(2)), it must provide
- * usysfs_make_no_object() as the value for make_object(). If the uset
- * has commit(), it supports pending and commited (active) objects.
+ * children (disallowing mkdir(2)), it need not provide either function.
+ * If the uset has commit(), it supports pending and commited (active)
+ * objects.
*/
struct usysfs_object_operations {
void (*release)(struct uobject *);
@@ -69,13 +68,6 @@
void (*drop_object)(struct uset *uset, struct uobject *uobj);
};
-static inline struct uobject *usysfs_make_no_object(struct uset *uset,
- const char *name)
-{
- return NULL;
-}
-
-
void uset_init_type_name(struct uset *uset, const char *name,
struct uobj_type *ktype);
More information about the Ocfs2-commits
mailing list