[Ocfs2-commits] jlbec commits r2081 - in trunk/fs: configfs
ocfs2/cluster
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Wed Mar 30 12:19:40 CST 2005
Author: jlbec
Signed-off-by: manish
Date: 2005-03-30 12:19:38 -0600 (Wed, 30 Mar 2005)
New Revision: 2081
Removed:
trunk/fs/configfs/uobject.h
Modified:
trunk/fs/configfs/bobtest.c
trunk/fs/configfs/configfs.h
trunk/fs/configfs/configfs.txt
trunk/fs/configfs/dir.c
trunk/fs/configfs/file.c
trunk/fs/configfs/inode.c
trunk/fs/configfs/mount.c
trunk/fs/configfs/symlink.c
trunk/fs/configfs/uobject.c
trunk/fs/ocfs2/cluster/nodemanager.c
trunk/fs/ocfs2/cluster/nodemanager.h
Log:
o Remove uobject.h, putting its contents in configfs.h
Signed-off-by: manish
Modified: trunk/fs/configfs/bobtest.c
===================================================================
--- trunk/fs/configfs/bobtest.c 2005-03-30 17:51:17 UTC (rev 2080)
+++ trunk/fs/configfs/bobtest.c 2005-03-30 18:19:38 UTC (rev 2081)
@@ -27,7 +27,6 @@
#include <linux/module.h>
#include <linux/slab.h>
-#include "uobject.h"
#include "configfs.h"
Modified: trunk/fs/configfs/configfs.h
===================================================================
--- trunk/fs/configfs/configfs.h 2005-03-30 17:51:17 UTC (rev 2080)
+++ trunk/fs/configfs/configfs.h 2005-03-30 18:19:38 UTC (rev 2081)
@@ -21,21 +21,106 @@
* Based on sysfs:
* sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
*
+ * Based on kobject.h:
+ * Copyright (c) 2002-2003 Patrick Mochel
+ * Copyright (c) 2002-2003 Open Source Development Labs
+ *
* configfs Copyright (C) 2005 Oracle. All rights reserved.
*
- * Please see Documentation/filesystems/configfs.txt for more information.
+ * Please read Documentation/filesystems/configfs.txt before using the
+ * configfs interface, ESPECIALLY the parts about reference counts and
+ * object destructors.
*/
#ifndef _CONFIGFS_H_
#define _CONFIGFS_H_
+#ifdef __KERNEL__
+
+#include <linux/types.h>
+#include <linux/list.h>
+#include <linux/kref.h>
+
#include <asm/atomic.h>
#include <asm/semaphore.h>
-#include "uobject.h"
+#define UOBJ_NAME_LEN 20
struct module;
+struct configfs_object_operations;
+struct configfs_set_operations;
+struct configfs_attribute;
+struct configfs_subsystem;
+
+struct uobject {
+ char *k_name;
+ char name[UOBJ_NAME_LEN];
+ struct kref kref;
+ struct list_head entry;
+ struct uobject *parent;
+ struct uset *uset;
+ struct uobj_type *ktype;
+ struct dentry *dentry;
+};
+
+extern int uobject_set_name(struct uobject *, const char *, ...);
+
+static inline char *uobject_name(struct uobject * uobj)
+{
+ return uobj->k_name;
+}
+
+extern void uobject_init(struct uobject *);
+extern void uobject_cleanup(struct uobject *);
+
+extern struct uobject * uobject_get(struct uobject *);
+extern void uobject_put(struct uobject *);
+
+struct uobj_type {
+ struct module *owner;
+ struct configfs_object_operations *object_ops;
+ struct configfs_set_operations *set_ops;
+ struct configfs_attribute **attrs;
+};
+
+
+/**
+ * uset - a set of uobjects of a specific type, belonging
+ * to a specific subsystem.
+ */
+
+struct uset {
+ struct uobject uobj;
+ struct list_head list;
+ struct configfs_subsystem *subsys;
+ struct uset **default_sets;
+};
+
+
+extern void uset_init(struct uset *set);
+extern void uset_init_type_name(struct uset *uset, const char *name,
+ struct uobj_type *ktype);
+
+
+static inline struct uset *to_uset(struct uobject *uobj)
+{
+ return uobj ? container_of(uobj,struct uset,uobj) : NULL;
+}
+
+static inline struct uset *uset_get(struct uset *set)
+{
+ return set ? to_uset(uobject_get(&set->uobj)) : NULL;
+}
+
+static inline void uset_put(struct uset *set)
+{
+ uobject_put(&set->uobj);
+}
+
+extern struct uobject *uset_find_obj(struct uset *, const char *);
+
+
struct configfs_attribute {
char * name;
struct module * owner;
@@ -109,4 +194,6 @@
int configfs_register_subsystem(struct configfs_subsystem *subsys);
void configfs_unregister_subsystem(struct configfs_subsystem *subsys);
+#endif /* __KERNEL__ */
+
#endif /* _CONFIGFS_H_ */
Modified: trunk/fs/configfs/configfs.txt
===================================================================
--- trunk/fs/configfs/configfs.txt 2005-03-30 17:51:17 UTC (rev 2080)
+++ trunk/fs/configfs/configfs.txt 2005-03-30 18:19:38 UTC (rev 2081)
@@ -1,20 +1,20 @@
-usysfs - User-driven sysfs
+configfs - User-driven sysfs
Joel Becker <joel.becker at oracle.com>
-Updated: 15 March 2005
+Updated: 29 March 2005
Copyright (c) 2005 Oracle Corporation,
Joel Becker <joel.becker at oracle.com>
-[What is usysfs?]
+[What is configfs?]
-usysfs is a ram-based filesystem initially based on sysfs. It provides
-the converse of sysfs's functionality. Where sysfs is a
-filesystem-based view of kernel objects, usysfs is a filesystem-based
-manager of kernel objects.
+configfs is a ram-based filesystem that provides the converse of
+sysfs's functionality. Where sysfs is a filesystem-based view of
+kernel objects, configfs is a filesystem-based manager of kernel
+objects.
With sysfs, an object is created in kernel (for example, when a device
is discovered) and it is registered with sysfs. Its attributes then
@@ -24,7 +24,7 @@
destroyed in kernel, the kernel controls the lifecycle of the sysfs
representation, and sysfs is merely a window on all this.
-A usysfs object is created via an explicit userspace operation:
+A configfs object is created via an explicit userspace operation:
mkdir(2). It is destroyed via rmdir(2). The attributes appear at
mkdir(2) time, and can be read or modified via read(2) and write(2).
As with sysfs, readdir(3) queries the list of objects and/or attributes.
@@ -32,21 +32,21 @@
lifetime of the representation is completely driven by userspace. The
kernel modules backing the objects must respond to this.
-Both sysfs and usysfs can and should exist together on the same system.
-One is not a replacement for the other.
+Both sysfs and configfs can and should exist together on the same
+system. One is not a replacement for the other.
-[Using usysfs]
+[Using configfs]
-usysfs can be compiled as a module or into the kernel. You can access
+configfs can be compiled as a module or into the kernel. You can access
it by doing
- mount -t usysfs none /usys
+ mount -t configfs none /config
-The usysfs tree will be empty unless client modules are also loaded.
-These are modules that register their object types with usysfs. Once a
-client module is loaded, it will appear as a subdirectory (or more than
-one) under /usys. Like sysfs, the usysfs tree is always there, whether
-mounted on /usys or not.
+The configfs tree will be empty unless client modules are also loaded.
+These are modules that register their object types with configfs. Once
+a client module is loaded, it will appear as a subdirectory (or more
+than one) under /config. Like sysfs, the configfs tree is always there,
+whether mounted on /config or not.
An object is created via mkdir(2). The object's attributes will also
appear at this time. readdir(3) can determine what the attributes are,
@@ -55,11 +55,11 @@
with only one value per file. The same efficiency caveats from sysfs
apply. Don't mix more than one attribute in one attribute file.
-Like sysfs, usysfs expects write(2) to store the entire buffer at once.
-When writing to usysfs attributes, userspace processes should first
-read the entire file, modify the portions they wish to change, and then
-write the entire buffer back. Attribute files have a maximum size of
-one page (PAGE_SIZE, 4096 on i386).
+Like sysfs, configfs expects write(2) to store the entire buffer at
+once. When writing to configfs attributes, userspace processes should
+first read the entire file, modify the portions they wish to change, and
+then write the entire buffer back. Attribute files have a maximum size
+of one page (PAGE_SIZE, 4096 on i386).
When an object needs to be destroyed, remove it with rmdir(2). An
object cannot be destroyed if any other object has a link to it (via
@@ -68,23 +68,23 @@
[Configuring FakeNBD: an Example]
Imagine there's a Network Block Device (NBD) driver that allows you to
-access remote block devices. Call it FakeNBD. FakeNBD uses usysfs for
-its configuration. Obviously, there will be a nice program that
+access remote block devices. Call it FakeNBD. FakeNBD uses configfs
+for its configuration. Obviously, there will be a nice program that
sysadmins use to configure FakeNBD, but somehow that program has to tell
-the driver about it. Here's where usysfs comes in.
+the driver about it. Here's where configfs comes in.
-When the FakeNBD driver is loaded, it registers itself with usysfs.
+When the FakeNBD driver is loaded, it registers itself with configfs.
readdir(3) sees this just fine:
- # ls /usys
+ # ls /config
fakenbd
A fakenbd connection can be created with mkdir(2). The name is
arbitrary, but likely the tool will make some use of the name. Perhaps
it is a uuid or a disk name:
- # mkdir /usys/fakenbd/disk1
- # ls /usys/fakenbd/disk1
+ # mkdir /config/fakenbd/disk1
+ # ls /config/fakenbd/disk1
target device rw
The target attribute contains the IP address of the server FakeNBD will
@@ -92,12 +92,12 @@
Predictably, the rw attribute determines whether the connection is
read-only or read-write.
- # echo 10.0.0.1 > /usys/fakenbd/disk1/target
- # echo /dev/sda1 > /usys/fakenbd/disk1/device
- # echo 1 > /usys/fakenbd/disk1/rw
+ # echo 10.0.0.1 > /config/fakenbd/disk1/target
+ # echo /dev/sda1 > /config/fakenbd/disk1/device
+ # echo 1 > /config/fakenbd/disk1/rw
That's it. That's all there is. Now the device is configured, via the
shell no less.
-[Coding With usysfs]
+[Coding With configfs]
Modified: trunk/fs/configfs/dir.c
===================================================================
--- trunk/fs/configfs/dir.c 2005-03-30 17:51:17 UTC (rev 2080)
+++ trunk/fs/configfs/dir.c 2005-03-30 18:19:38 UTC (rev 2081)
@@ -33,7 +33,6 @@
#include <linux/module.h>
#include <linux/slab.h>
-#include "uobject.h"
#include "configfs.h"
#include "configfs_internal.h"
Modified: trunk/fs/configfs/file.c
===================================================================
--- trunk/fs/configfs/file.c 2005-03-30 17:51:17 UTC (rev 2080)
+++ trunk/fs/configfs/file.c 2005-03-30 18:19:38 UTC (rev 2081)
@@ -31,7 +31,6 @@
#include <asm/uaccess.h>
#include <asm/semaphore.h>
-#include "uobject.h"
#include "configfs.h"
#include "configfs_internal.h"
Modified: trunk/fs/configfs/inode.c
===================================================================
--- trunk/fs/configfs/inode.c 2005-03-30 17:51:17 UTC (rev 2080)
+++ trunk/fs/configfs/inode.c 2005-03-30 18:19:38 UTC (rev 2081)
@@ -32,7 +32,6 @@
#include <linux/namei.h>
#include <linux/backing-dev.h>
-#include "uobject.h"
#include "configfs.h"
#include "configfs_internal.h"
Modified: trunk/fs/configfs/mount.c
===================================================================
--- trunk/fs/configfs/mount.c 2005-03-30 17:51:17 UTC (rev 2080)
+++ trunk/fs/configfs/mount.c 2005-03-30 18:19:38 UTC (rev 2081)
@@ -32,7 +32,6 @@
#include <linux/pagemap.h>
#include <linux/init.h>
-#include "uobject.h"
#include "configfs.h"
#include "configfs_internal.h"
Modified: trunk/fs/configfs/symlink.c
===================================================================
--- trunk/fs/configfs/symlink.c 2005-03-30 17:51:17 UTC (rev 2080)
+++ trunk/fs/configfs/symlink.c 2005-03-30 18:19:38 UTC (rev 2081)
@@ -29,7 +29,6 @@
#include <linux/module.h>
#include <linux/namei.h>
-#include "uobject.h"
#include "configfs.h"
#include "configfs_internal.h"
Modified: trunk/fs/configfs/uobject.c
===================================================================
--- trunk/fs/configfs/uobject.c 2005-03-30 17:51:17 UTC (rev 2080)
+++ trunk/fs/configfs/uobject.c 2005-03-30 18:19:38 UTC (rev 2081)
@@ -21,7 +21,6 @@
#include <linux/stat.h>
#include <linux/slab.h>
-#include "uobject.h"
#include "configfs.h"
Deleted: trunk/fs/configfs/uobject.h
===================================================================
--- trunk/fs/configfs/uobject.h 2005-03-30 17:51:17 UTC (rev 2080)
+++ trunk/fs/configfs/uobject.h 2005-03-30 18:19:38 UTC (rev 2081)
@@ -1,117 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * uobject.h - generic user object infrastructure.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 021110-1307, USA.
- *
- * Based on uobject.h:
- * Copyright (c) 2002-2003 Patrick Mochel
- * Copyright (c) 2002-2003 Open Source Development Labs
- *
- * Copyright (C) 2005 Oracle. All rights reserved.
- *
- * Please read Documentation/configfs.txt before using the uobject and
- * configfs interface, ESPECIALLY the parts about reference counts and
- * object destructors.
- */
-
-#ifndef _UOBJECT_H_
-#define _UOBJECT_H_
-
-#ifdef __KERNEL__
-
-#include <linux/types.h>
-#include <linux/list.h>
-#include <linux/kref.h>
-
-#define UOBJ_NAME_LEN 20
-
-struct configfs_object_operations;
-struct configfs_set_operations;
-struct configfs_attribute;
-struct configfs_subsystem;
-
-struct uobject {
- char *k_name;
- char name[UOBJ_NAME_LEN];
- struct kref kref;
- struct list_head entry;
- struct uobject *parent;
- struct uset *uset;
- struct uobj_type *ktype;
- struct dentry *dentry;
-};
-
-extern int uobject_set_name(struct uobject *, const char *, ...);
-
-static inline char *uobject_name(struct uobject * uobj)
-{
- return uobj->k_name;
-}
-
-extern void uobject_init(struct uobject *);
-extern void uobject_cleanup(struct uobject *);
-
-extern struct uobject * uobject_get(struct uobject *);
-extern void uobject_put(struct uobject *);
-
-struct uobj_type {
- struct module *owner;
- struct configfs_object_operations *object_ops;
- struct configfs_set_operations *set_ops;
- struct configfs_attribute **attrs;
-};
-
-
-/**
- * uset - a set of uobjects of a specific type, belonging
- * to a specific subsystem.
- */
-
-struct uset {
- struct uobject uobj;
- struct list_head list;
- struct configfs_subsystem *subsys;
- struct uset **default_sets;
-};
-
-
-extern void uset_init(struct uset *set);
-extern void uset_init_type_name(struct uset *uset, const char *name,
- struct uobj_type *ktype);
-
-
-static inline struct uset *to_uset(struct uobject *uobj)
-{
- return uobj ? container_of(uobj,struct uset,uobj) : NULL;
-}
-
-static inline struct uset *uset_get(struct uset *set)
-{
- return set ? to_uset(uobject_get(&set->uobj)) : NULL;
-}
-
-static inline void uset_put(struct uset *set)
-{
- uobject_put(&set->uobj);
-}
-
-extern struct uobject *uset_find_obj(struct uset *, const char *);
-
-
-#endif /* __KERNEL__ */
-#endif /* _UOBJECT_H_ */
Modified: trunk/fs/ocfs2/cluster/nodemanager.c
===================================================================
--- trunk/fs/ocfs2/cluster/nodemanager.c 2005-03-30 17:51:17 UTC (rev 2080)
+++ trunk/fs/ocfs2/cluster/nodemanager.c 2005-03-30 18:19:38 UTC (rev 2081)
@@ -59,8 +59,6 @@
#include <asm/uaccess.h>
#include <asm/semaphore.h>
-#include "uobject.h"
-
#include "tcp.h"
#include "nodemanager.h"
#include "heartbeat.h"
Modified: trunk/fs/ocfs2/cluster/nodemanager.h
===================================================================
--- trunk/fs/ocfs2/cluster/nodemanager.h 2005-03-30 17:51:17 UTC (rev 2080)
+++ trunk/fs/ocfs2/cluster/nodemanager.h 2005-03-30 18:19:38 UTC (rev 2081)
@@ -32,7 +32,7 @@
#include "ocfs2_nodemanager.h"
/* This totally doesn't belong here. */
-#include "uobject.h"
+#include "configfs.h"
/* TODO: move this */
More information about the Ocfs2-commits
mailing list