[Ocfs2-commits] jlbec commits r2084 - trunk/fs/configfs

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Wed Mar 30 13:29:33 CST 2005


Author: jlbec
Signed-off-by: mfasheh
Date: 2005-03-30 13:29:32 -0600 (Wed, 30 Mar 2005)
New Revision: 2084

Added:
   trunk/fs/configfs/item.c
Removed:
   trunk/fs/configfs/uobject.c
Modified:
   trunk/fs/configfs/Makefile
Log:

o Move uobject.c to item.c, cause they're config_items now.

Signed-off-by: mfasheh



Modified: trunk/fs/configfs/Makefile
===================================================================
--- trunk/fs/configfs/Makefile	2005-03-30 18:59:34 UTC (rev 2083)
+++ trunk/fs/configfs/Makefile	2005-03-30 19:29:32 UTC (rev 2084)
@@ -14,7 +14,7 @@
 INSTALL_MOD_DIR := fs/configfs
 
 obj-m		:= configfs.o bobtest.o
-configfs-objs	:= inode.o file.o dir.o symlink.o mount.o uobject.o
+configfs-objs	:= inode.o file.o dir.o symlink.o mount.o item.o
 		   
 ifeq ($(KERNELRELEASE),)
 #
@@ -22,7 +22,6 @@
 #
 
 HEADERS =					\
-	uobject.h				\
 	configfs.h				\
 	configfs_internal.h			\
 	compatinclude/linux/compat.h		\
@@ -36,9 +35,9 @@
 	dir.c			\
 	file.c			\
 	inode.c			\
+	item.c			\
 	mount.c			\
 	symlink.c		\
-	uobject.c		\
 	compat_kref.c		\
 	compat_libfs.c
 CONFIGFS_OBJECTS = $(subst .c,.o,$(CONFIGFS_SOURCES))

Copied: trunk/fs/configfs/item.c (from rev 2082, trunk/fs/configfs/uobject.c)

Deleted: trunk/fs/configfs/uobject.c
===================================================================
--- trunk/fs/configfs/uobject.c	2005-03-30 18:59:34 UTC (rev 2083)
+++ trunk/fs/configfs/uobject.c	2005-03-30 19:29:32 UTC (rev 2084)
@@ -1,197 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * config_item.c - library routines for handling generic kernel items
- *
- * Copyright (c) 2002-2003 Patrick Mochel <mochel at osdl.org>
- *
- * This file is released under the GPLv2.
- *
- *
- * Please see the file Documentation/config_item.txt for critical information
- * about using the config_item interface.
- *
- * 2005.01.24
- *      Stripped down for 2.4 compat in configfs.
- *      Joel Becker <joel.becker at oracle.com>
- */
-
-#include <linux/string.h>
-#include <linux/module.h>
-#include <linux/stat.h>
-#include <linux/slab.h>
-
-#include "configfs.h"
-
-
-static inline struct config_item * to_item(struct list_head * entry)
-{
-	return container_of(entry,struct config_item,entry);
-}
-
-/* Evil kernel */
-static void config_item_release(struct kref *kref);
-
-/**
- *	config_item_init - initialize item.
- *	@item:	item in question.
- */
-void config_item_init(struct config_item * item)
-{
-	kref_init(&item->kref, config_item_release);
-	INIT_LIST_HEAD(&item->entry);
-}
-
-/**
- *	config_item_set_name - Set the name of an item
- *	@item:	item.
- *	@name:	name. 
- *
- *	If strlen(name) >= UOBJ_NAME_LEN, then use a dynamically allocated
- *	string that @item->k_name points to. Otherwise, use the static 
- *	@item->name array.
- */
-
-int config_item_set_name(struct config_item * item, const char * fmt, ...)
-{
-	int error = 0;
-	int limit = UOBJ_NAME_LEN;
-	int need;
-	va_list args;
-	char * name;
-
-	/* 
-	 * First, try the static array 
-	 */
-	va_start(args,fmt);
-	need = vsnprintf(item->name,limit,fmt,args);
-	va_end(args);
-	if (need < limit) 
-		name = item->name;
-	else {
-		/* 
-		 * Need more space? Allocate it and try again 
-		 */
-		limit = need + 1;
-		name = kmalloc(limit,GFP_KERNEL);
-		if (!name) {
-			error = -ENOMEM;
-			goto Done;
-		}
-		va_start(args,fmt);
-		need = vsnprintf(name,limit,fmt,args);
-		va_end(args);
-
-		/* Still? Give up. */
-		if (need >= limit) {
-			kfree(name);
-			error = -EFAULT;
-			goto Done;
-		}
-	}
-
-	/* Free the old name, if necessary. */
-	if (item->k_name && item->k_name != item->name)
-		kfree(item->k_name);
-
-	/* Now, set the new name */
-	item->k_name = name;
- Done:
-	return error;
-}
-
-EXPORT_SYMBOL(config_item_set_name);
-
-struct config_item * config_item_get(struct config_item * item)
-{
-	if (item)
-		kref_get(&item->kref);
-	return item;
-}
-
-/**
- *	config_item_cleanup - free config_item resources. 
- *	@item:	item.
- */
-
-void config_item_cleanup(struct config_item * item)
-{
-	struct config_item_type * t = item->ktype;
-	struct uset * s = item->uset;
-	struct config_item * parent = item->parent;
-
-	pr_debug("config_item %s: cleaning up\n",config_item_name(item));
-	if (item->k_name != item->name)
-		kfree(item->k_name);
-	item->k_name = NULL;
-	if (t && t->item_ops && t->item_ops->release)
-		t->item_ops->release(item);
-	if (s)
-		uset_put(s);
-	if (parent)
-		config_item_put(parent);
-}
-
-static void config_item_release(struct kref *kref)
-{
-	config_item_cleanup(container_of(kref, struct config_item, kref));
-}
-
-/**
- *	config_item_put - decrement refcount for item.
- *	@item:	item.
- *
- *	Decrement the refcount, and if 0, call config_item_cleanup().
- */
-void config_item_put(struct config_item * item)
-{
-	if (item)
-		kref_put(&item->kref, config_item_release);
-}
-
-
-/**
- *	uset_init - initialize a uset for use
- *	@k:	uset 
- */
-
-void uset_init(struct uset *set)
-{
-	config_item_init(&set->item);
-	INIT_LIST_HEAD(&set->list);
-}
-
-
-/**
- *	uset_find_obj - search for item in uset.
- *	@uset:	uset we're looking in.
- *	@name:	item's name.
- *
- *	Lock uset via @uset->subsys, and iterate over @uset->list,
- *	looking for a matching config_item. If matching item is found
- *	take a reference and return the item.
- */
-
-struct config_item * uset_find_obj(struct uset * uset, const char * name)
-{
-	struct list_head * entry;
-	struct config_item * ret = NULL;
-
-        /* XXX LOCKING! */
-	list_for_each(entry,&uset->list) {
-		struct config_item * item = to_item(entry);
-		if (config_item_name(item) &&
-                    !strcmp(config_item_name(item), name)) {
-			ret = config_item_get(item);
-			break;
-		}
-	}
-	return ret;
-}
-
-
-EXPORT_SYMBOL(config_item_init);
-EXPORT_SYMBOL(uset_init);
-EXPORT_SYMBOL(config_item_get);
-EXPORT_SYMBOL(config_item_put);
-



More information about the Ocfs2-commits mailing list