[Ocfs2-commits] jlbec commits r2060 - trunk/fs/usysfs
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Fri Mar 25 19:37:41 CST 2005
Author: jlbec
Signed-off-by: manish
Date: 2005-03-25 19:37:39 -0600 (Fri, 25 Mar 2005)
New Revision: 2060
Removed:
trunk/fs/usysfs/bin.c
Modified:
trunk/fs/usysfs/Makefile
trunk/fs/usysfs/dir.c
trunk/fs/usysfs/inode.c
trunk/fs/usysfs/usysfs_internal.h
Log:
o Remove binary attributes, they're a holdover from sysfs
Signed-off-by: manish
Modified: trunk/fs/usysfs/Makefile
===================================================================
--- trunk/fs/usysfs/Makefile 2005-03-26 01:28:52 UTC (rev 2059)
+++ trunk/fs/usysfs/Makefile 2005-03-26 01:37:39 UTC (rev 2060)
@@ -14,7 +14,7 @@
INSTALL_MOD_DIR := fs/usysfs
obj-m := usysfs.o bobtest.o
-usysfs-objs := inode.o file.o dir.o symlink.o mount.o bin.o uobject.o
+usysfs-objs := inode.o file.o dir.o symlink.o mount.o uobject.o
ifeq ($(KERNELRELEASE),)
#
@@ -33,7 +33,6 @@
EXTRA_CFLAGS += -I$(TOPDIR)/fs/usysfs/compatinclude
USYSFS_SOURCES = \
- bin.c \
dir.c \
file.c \
inode.c \
Deleted: trunk/fs/usysfs/bin.c
===================================================================
--- trunk/fs/usysfs/bin.c 2005-03-26 01:28:52 UTC (rev 2059)
+++ trunk/fs/usysfs/bin.c 2005-03-26 01:37:39 UTC (rev 2060)
@@ -1,199 +0,0 @@
-/*
- * bin.c - binary file operations for usysfs.
- *
- * 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 sysfs:
- * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
- *
- * usysfs Copyright (C) 2005 Oracle. All rights reserved.
- */
-
-#undef DEBUG
-
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/module.h>
-#include <linux/slab.h>
-
-#include <asm/uaccess.h>
-
-#include "uobject.h"
-#include "usysfs.h"
-#include "usysfs_internal.h"
-
-static int
-fill_read(struct dentry *dentry, char *buffer, loff_t off, size_t count)
-{
- struct usysfs_bin_attribute * attr = to_bin_attr(dentry);
- struct uobject * uobj = to_uobj(dentry->d_parent);
-
- return attr->read(uobj, buffer, off, count);
-}
-
-static ssize_t
-read(struct file * file, char __user * userbuf, size_t count, loff_t * off)
-{
- char *buffer = file->private_data;
- struct dentry *dentry = file->f_dentry;
- int size = dentry->d_inode->i_size;
- loff_t offs = *off;
- int ret;
-
- if (count > PAGE_SIZE)
- count = PAGE_SIZE;
-
- if (size) {
- if (offs > size)
- return 0;
- if (offs + count > size)
- count = size - offs;
- }
-
- ret = fill_read(dentry, buffer, offs, count);
- if (ret < 0)
- return ret;
- count = ret;
-
- if (copy_to_user(userbuf, buffer, count))
- return -EFAULT;
-
- pr_debug("offs = %lld, *off = %lld, count = %zd\n", offs, *off, count);
-
- *off = offs + count;
-
- return count;
-}
-
-static int
-flush_write(struct dentry *dentry, char *buffer, loff_t offset, size_t count)
-{
- struct usysfs_bin_attribute *attr = to_bin_attr(dentry);
- struct uobject *uobj = to_uobj(dentry->d_parent);
-
- return attr->write(uobj, buffer, offset, count);
-}
-
-static ssize_t write(struct file * file, const char __user * userbuf,
- size_t count, loff_t * off)
-{
- char *buffer = file->private_data;
- struct dentry *dentry = file->f_dentry;
- int size = dentry->d_inode->i_size;
- loff_t offs = *off;
-
- if (count > PAGE_SIZE)
- count = PAGE_SIZE;
- if (size) {
- if (offs > size)
- return 0;
- if (offs + count > size)
- count = size - offs;
- }
-
- if (copy_from_user(buffer, userbuf, count))
- return -EFAULT;
-
- count = flush_write(dentry, buffer, offs, count);
- if (count > 0)
- *off = offs + count;
- return count;
-}
-
-static int open(struct inode * inode, struct file * file)
-{
- struct uobject *uobj = usysfs_get_uobject(file->f_dentry->d_parent);
- struct usysfs_bin_attribute * attr = to_bin_attr(file->f_dentry);
- int error = -EINVAL;
-
- if (!uobj || !attr)
- goto Done;
-
- /* Grab the module reference for this attribute if we have one */
- error = -ENODEV;
- if (!try_module_get(attr->attr.owner))
- goto Done;
-
- error = -EACCES;
- if ((file->f_mode & FMODE_WRITE) && !attr->write)
- goto Error;
- if ((file->f_mode & FMODE_READ) && !attr->read)
- goto Error;
-
- error = -ENOMEM;
- file->private_data = kmalloc(PAGE_SIZE, GFP_KERNEL);
- if (!file->private_data)
- goto Error;
-
- error = 0;
- goto Done;
-
- Error:
- module_put(attr->attr.owner);
- Done:
- if (error && uobj)
- uobject_put(uobj);
- return error;
-}
-
-static int release(struct inode * inode, struct file * file)
-{
- struct uobject * uobj = to_uobj(file->f_dentry->d_parent);
- struct usysfs_bin_attribute * attr = to_bin_attr(file->f_dentry);
- u8 * buffer = file->private_data;
-
- if (uobj)
- uobject_put(uobj);
- module_put(attr->attr.owner);
- kfree(buffer);
- return 0;
-}
-
-struct file_operations bin_fops = {
- .read = read,
- .write = write,
- .llseek = generic_file_llseek,
- .open = open,
- .release = release,
-};
-
-/**
- * usysfs_create_bin_file - create binary file for object.
- * @uobj: object.
- * @attr: attribute descriptor.
- *
- */
-
-int usysfs_create_bin_file(struct uobject * uobj, struct usysfs_bin_attribute * attr)
-{
- BUG_ON(!uobj || !uobj->dentry || !attr);
-
- return usysfs_add_file(uobj->dentry, &attr->attr, USYSFS_UOBJ_BIN_ATTR);
-}
-
-
-/**
- * usysfs_remove_bin_file - remove binary file for object.
- * @uobj: object.
- * @attr: attribute descriptor.
- *
- */
-
-int usysfs_remove_bin_file(struct uobject * uobj, struct usysfs_bin_attribute * attr)
-{
- usysfs_hash_and_remove(uobj->dentry,attr->attr.name);
- return 0;
-}
Modified: trunk/fs/usysfs/dir.c
===================================================================
--- trunk/fs/usysfs/dir.c 2005-03-26 01:28:52 UTC (rev 2059)
+++ trunk/fs/usysfs/dir.c 2005-03-26 01:37:39 UTC (rev 2060)
@@ -239,27 +239,13 @@
*/
static int usysfs_attach_attr(struct usysfs_dirent * sd, struct dentry * dentry)
{
- struct usysfs_attribute * attr = NULL;
- struct usysfs_bin_attribute * bin_attr = NULL;
- int (* init) (struct inode *) = NULL;
- int error = 0;
+ struct usysfs_attribute * attr = sd->s_element;
+ int error;
- if (sd->s_type & USYSFS_UOBJ_BIN_ATTR) {
- bin_attr = sd->s_element;
- attr = &bin_attr->attr;
- } else {
- attr = sd->s_element;
- init = init_file;
- }
-
- error = usysfs_create(dentry, (attr->mode & S_IALLUGO) | S_IFREG, init);
+ error = usysfs_create(dentry, (attr->mode & S_IALLUGO) | S_IFREG, init_file);
if (error)
return error;
- if (bin_attr) {
- dentry->d_inode->i_size = bin_attr->size;
- dentry->d_inode->i_fop = &bin_fops;
- }
dentry->d_op = &usysfs_dentry_ops;
dentry->d_fsdata = usysfs_get(sd);
sd->s_dentry = dentry;
Modified: trunk/fs/usysfs/inode.c
===================================================================
--- trunk/fs/usysfs/inode.c 2005-03-26 01:28:52 UTC (rev 2059)
+++ trunk/fs/usysfs/inode.c 2005-03-26 01:37:39 UTC (rev 2060)
@@ -117,7 +117,6 @@
const unsigned char * usysfs_get_name(struct usysfs_dirent *sd)
{
struct attribute * attr;
- struct bin_attribute * bin_attr;
if (!sd || !sd->s_element)
BUG();
@@ -132,10 +131,6 @@
case USYSFS_UOBJ_ATTR:
attr = sd->s_element;
return attr->name;
-
- case USYSFS_UOBJ_BIN_ATTR:
- bin_attr = sd->s_element;
- return bin_attr->attr.name;
}
return NULL;
}
Modified: trunk/fs/usysfs/usysfs_internal.h
===================================================================
--- trunk/fs/usysfs/usysfs_internal.h 2005-03-26 01:28:52 UTC (rev 2059)
+++ trunk/fs/usysfs/usysfs_internal.h 2005-03-26 01:37:39 UTC (rev 2060)
@@ -45,10 +45,9 @@
#define USYSFS_ROOT 0x0001
#define USYSFS_DIR 0x0002
#define USYSFS_UOBJ_ATTR 0x0004
-#define USYSFS_UOBJ_BIN_ATTR 0x0008
#define USYSFS_UOBJ_LINK 0x0020
#define USYSFS_DEFAULT_DIR 0x0040
-#define USYSFS_NOT_PINNED (USYSFS_UOBJ_ATTR | USYSFS_UOBJ_BIN_ATTR)
+#define USYSFS_NOT_PINNED (USYSFS_UOBJ_ATTR)
extern struct vfsmount * usysfs_mount;
@@ -104,12 +103,6 @@
return ((struct usysfs_attribute *) sd->s_element);
}
-static inline struct usysfs_bin_attribute * to_bin_attr(struct dentry * dentry)
-{
- struct usysfs_dirent * sd = dentry->d_fsdata;
- return ((struct usysfs_bin_attribute *) sd->s_element);
-}
-
static inline struct uobject *usysfs_get_uobject(struct dentry *dentry)
{
struct uobject * uobj = NULL;
More information about the Ocfs2-commits
mailing list