[Ocfs2-commits] manish commits r2014 - in trunk: . fs/ocfs2/cluster
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Fri Mar 18 18:05:00 CST 2005
Author: manish
Signed-off-by: jlbec
Date: 2005-03-18 18:04:59 -0600 (Fri, 18 Mar 2005)
New Revision: 2014
Removed:
trunk/fs/ocfs2/cluster/compat_libfs.c
trunk/fs/ocfs2/cluster/compat_libfs.h
trunk/fs/ocfs2/cluster/transaction_file.c
trunk/fs/ocfs2/cluster/transaction_file.h
Modified:
trunk/Makefile
trunk/fs/ocfs2/cluster/Makefile
trunk/fs/ocfs2/cluster/heartbeat.c
trunk/fs/ocfs2/cluster/nodemanager.c
Log:
Kill some dead files, add references to some new ones
Signed-off-by: jlbec
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2005-03-18 23:55:55 UTC (rev 2013)
+++ trunk/Makefile 2005-03-19 00:04:59 UTC (rev 2014)
@@ -7,10 +7,14 @@
SUBDIRS = fs docs patches vendor
KAPI_COMPAT_FILES = \
+ kapi-compat/include/assert_spin_locked.h \
+ kapi-compat/include/journal_access.h \
+ kapi-compat/include/kcalloc.h \
kapi-compat/include/kref_init.h \
kapi-compat/include/kref_put.h \
kapi-compat/include/msecs_to_jiffies.h \
- kapi-compat/include/wait_event_interruptible_timeout.h
+ kapi-compat/include/wait_event_interruptible_timeout.h \
+ kapi-compat/include/wait_event_timeout.h
DIST_FILES = \
COPYING \
Modified: trunk/fs/ocfs2/cluster/Makefile
===================================================================
--- trunk/fs/ocfs2/cluster/Makefile 2005-03-18 23:55:55 UTC (rev 2013)
+++ trunk/fs/ocfs2/cluster/Makefile 2005-03-19 00:04:59 UTC (rev 2014)
@@ -21,17 +21,11 @@
# XXX should be folded into the kapi stuff
EXTRA_CFLAGS += -I$(OUR_TOPDIR)/fs/usysfs/compatinclude
-ifeq ($(KERNELRELEASE),)
-ifeq ($(KERNEL_26),)
-COMPAT_LIBFS := compat_libfs.o
-endif
-endif
-
INSTALL_MOD_DIR := fs/ocfs2
obj-m := ocfs2_nodemanager.o
-ocfs2_nodemanager-objs := nodemanager.o heartbeat.o tcp.o $(COMPAT_LIBFS)
+ocfs2_nodemanager-objs := nodemanager.o heartbeat.o tcp.o
ifeq ($(KERNELRELEASE),)
#
@@ -39,7 +33,6 @@
#
SOURCES = \
- compat_libfs.c \
heartbeat.c \
nodemanager.c \
tcp.c \
@@ -47,12 +40,10 @@
HEADERS = \
cl_compat.h \
- compat_libfs.h \
heartbeat.h \
nodemanager.h \
ocfs2_heartbeat.h \
ocfs2_nodemanager.h \
- ocfs2_tcp.h \
tcp.h \
util.h
Deleted: trunk/fs/ocfs2/cluster/compat_libfs.c
===================================================================
--- trunk/fs/ocfs2/cluster/compat_libfs.c 2005-03-18 23:55:55 UTC (rev 2013)
+++ trunk/fs/ocfs2/cluster/compat_libfs.c 2005-03-19 00:04:59 UTC (rev 2014)
@@ -1,579 +0,0 @@
-/* -----------------------------------------------------------------*/
-
-
-/*
- * compat_libfs.c
- * 2.4 compat Library for filesystems writers.
- */
-
-
-#include <linux/module.h>
-#include <linux/pagemap.h>
-#include <linux/mount.h>
-#include <linux/vfs.h>
-#include <asm/uaccess.h>
-#include <linux/slab.h>
-
-#include "compat_libfs.h"
-
-
-int simple_statfs(struct super_block *sb, struct statfs *buf);
-
-struct dentry *simple_lookup(struct inode *dir,struct dentry *dentry);
-
-int simple_sync_file(struct file *file, struct dentry *dentry, int datasync);
-int dcache_dir_open(struct inode *inode, struct file *file);
-int dcache_dir_close(struct inode *inode, struct file *file);
-loff_t dcache_dir_lseek(struct file *file, loff_t offset, int origin);
-ssize_t generic_read_dir(struct file *filp, char *buf, size_t siz, loff_t *ppos);
-int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry);
-int simple_empty(struct dentry *dentry);
-int simple_unlink(struct inode *dir, struct dentry *dentry);
-int simple_rmdir(struct inode *dir, struct dentry *dentry);
-int simple_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry);
-int simple_fill_super(struct super_block *s, int magic, struct tree_descr *files);
-
-
-
-#if 0
-int simple_getattr(struct vfsmount *mnt, struct dentry *dentry,
- struct kstat *stat)
-{
- struct inode *inode = dentry->d_inode;
- generic_fillattr(inode, stat);
- stat->blocks = inode->i_mapping->nrpages << (PAGE_CACHE_SHIFT - 9);
- return 0;
-}
-#endif
-
-int simple_statfs(struct super_block *sb, struct statfs *buf)
-{
- buf->f_type = sb->s_magic;
- buf->f_bsize = PAGE_CACHE_SIZE;
- buf->f_namelen = NAME_MAX;
- return 0;
-}
-
-/*
- * Lookup the data. This is trivial - if the dentry didn't already
- * exist, we know it is negative.
- */
-struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry)
-{
- if (dentry->d_name.len > NAME_MAX)
- return ERR_PTR(-ENAMETOOLONG);
- d_add(dentry, NULL);
- return NULL;
-}
-
-
-struct dentry * simple_find_child(struct dentry *dentry, struct qstr *name)
-{
- struct list_head *iter;
- struct dentry *child = NULL;
-
- spin_lock(&dcache_lock);
- list_for_each(iter, &dentry->d_subdirs) {
- child = list_entry(iter, struct dentry, d_child);
- if (child->d_name.len == name->len &&
- memcmp(child->d_name.name, name->name, name->len)==0)
- break;
- child = NULL;
- }
- if (child)
- dget_locked(child);
- spin_unlock(&dcache_lock);
- return child;
-}
-
-
-
-int simple_sync_file(struct file * file, struct dentry *dentry, int datasync)
-{
- return 0;
-}
-
-int dcache_dir_open(struct inode *inode, struct file *file)
-{
- static struct qstr cursor_name = {.len = 1, .name = "."};
-
- file->private_data = d_alloc(file->f_dentry, &cursor_name);
-
- return file->private_data ? 0 : -ENOMEM;
-}
-
-int dcache_dir_close(struct inode *inode, struct file *file)
-{
- dput(file->private_data);
- return 0;
-}
-
-loff_t dcache_dir_lseek(struct file *file, loff_t offset, int origin)
-{
- down(&file->f_dentry->d_inode->i_sem);
- switch (origin) {
- case 1:
- offset += file->f_pos;
- case 0:
- if (offset >= 0)
- break;
- default:
- up(&file->f_dentry->d_inode->i_sem);
- return -EINVAL;
- }
- if (offset != file->f_pos) {
- file->f_pos = offset;
- if (file->f_pos >= 2) {
- struct list_head *p;
- struct dentry *cursor = file->private_data;
- loff_t n = file->f_pos - 2;
-
- spin_lock(&dcache_lock);
- list_del(&cursor->d_child);
- p = file->f_dentry->d_subdirs.next;
- while (n && p != &file->f_dentry->d_subdirs) {
- struct dentry *next;
- next = list_entry(p, struct dentry, d_child);
- if (!d_unhashed(next) && next->d_inode)
- n--;
- p = p->next;
- }
- list_add_tail(&cursor->d_child, p);
- spin_unlock(&dcache_lock);
- }
- }
- up(&file->f_dentry->d_inode->i_sem);
- return offset;
-}
-
-/* Relationship between i_mode and the DT_xxx types */
-static inline unsigned char dt_type(struct inode *inode)
-{
- return (inode->i_mode >> 12) & 15;
-}
-
-/*
- * Directory is locked and all positive dentries in it are safe, since
- * for ramfs-type trees they can't go away without unlink() or rmdir(),
- * both impossible due to the lock on directory.
- */
-
-int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir)
-{
- struct dentry *dentry = filp->f_dentry;
- struct dentry *cursor = filp->private_data;
- struct list_head *p, *q = &cursor->d_child;
- ino_t ino;
- int i = filp->f_pos;
-
- switch (i) {
- case 0:
- ino = dentry->d_inode->i_ino;
- if (filldir(dirent, ".", 1, i, ino, DT_DIR) < 0)
- break;
- filp->f_pos++;
- i++;
- /* fallthrough */
- case 1:
- ino = dentry->d_parent->d_inode->i_ino;
- if (filldir(dirent, "..", 2, i, ino, DT_DIR) < 0)
- break;
- filp->f_pos++;
- i++;
- /* fallthrough */
- default:
- spin_lock(&dcache_lock);
- if (filp->f_pos == 2) {
- list_del(q);
- list_add(q, &dentry->d_subdirs);
- }
- for (p=q->next; p != &dentry->d_subdirs; p=p->next) {
- struct dentry *next;
- next = list_entry(p, struct dentry, d_child);
- if (d_unhashed(next) || !next->d_inode)
- continue;
-
- spin_unlock(&dcache_lock);
- if (filldir(dirent, next->d_name.name, next->d_name.len, filp->f_pos, next->d_inode->i_ino, dt_type(next->d_inode)) < 0)
- return 0;
- spin_lock(&dcache_lock);
- /* next is still alive */
- list_del(q);
- list_add(q, p);
- p = q;
- filp->f_pos++;
- }
- spin_unlock(&dcache_lock);
- }
- return 0;
-}
-
-ssize_t generic_read_dir(struct file *filp, char *buf, size_t siz, loff_t *ppos)
-{
- return -EISDIR;
-}
-
-struct file_operations simple_dir_operations = {
- .open = dcache_dir_open,
- .release = dcache_dir_close,
- .llseek = dcache_dir_lseek,
- .read = generic_read_dir,
- .readdir = dcache_readdir,
-};
-
-struct inode_operations simple_dir_inode_operations = {
- .lookup = simple_lookup,
-};
-
-#if 0
-/*
- * Common helper for pseudo-filesystems (sockfs, pipefs, bdev - stuff that
- * will never be mountable)
- */
-struct super_block *
-get_sb_pseudo(struct file_system_type *fs_type, char *name,
- struct super_operations *ops, unsigned long magic)
-{
- struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL);
- static struct super_operations default_ops = {.statfs = simple_statfs};
- struct dentry *dentry;
- struct inode *root;
- struct qstr d_name = {.name = name, .len = strlen(name)};
-
- if (IS_ERR(s))
- return s;
-
- s->s_flags = MS_NOUSER;
- s->s_maxbytes = ~0ULL;
- s->s_blocksize = 1024;
- s->s_blocksize_bits = 10;
- s->s_magic = magic;
- s->s_op = ops ? ops : &default_ops;
- root = new_inode(s);
- if (!root)
- goto Enomem;
- root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR;
- root->i_uid = root->i_gid = 0;
- root->i_atime = root->i_mtime = root->i_ctime = CURRENT_TIME;
- dentry = d_alloc(NULL, &d_name);
- if (!dentry) {
- iput(root);
- goto Enomem;
- }
- dentry->d_sb = s;
- dentry->d_parent = dentry;
- d_instantiate(dentry, root);
- s->s_root = dentry;
- s->s_flags |= MS_ACTIVE;
- return s;
-
-Enomem:
- up_write(&s->s_umount);
- deactivate_super(s);
- return ERR_PTR(-ENOMEM);
-}
-#endif
-
-int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
-{
- struct inode *inode = old_dentry->d_inode;
-
- inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
- inode->i_nlink++;
- atomic_inc(&inode->i_count);
- dget(dentry);
- d_instantiate(dentry, inode);
- return 0;
-}
-
-static inline int simple_positive(struct dentry *dentry)
-{
- return dentry->d_inode && !d_unhashed(dentry);
-}
-
-int simple_empty(struct dentry *dentry)
-{
- struct dentry *child;
- int ret = 0;
-
- spin_lock(&dcache_lock);
- list_for_each_entry(child, &dentry->d_subdirs, d_child)
- if (simple_positive(child))
- goto out;
- ret = 1;
-out:
- spin_unlock(&dcache_lock);
- return ret;
-}
-
-int simple_unlink(struct inode *dir, struct dentry *dentry)
-{
- struct inode *inode = dentry->d_inode;
-
- inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
- inode->i_nlink--;
- dput(dentry);
- return 0;
-}
-
-int simple_rmdir(struct inode *dir, struct dentry *dentry)
-{
- if (!simple_empty(dentry))
- return -ENOTEMPTY;
-
- dentry->d_inode->i_nlink--;
- simple_unlink(dir, dentry);
- dir->i_nlink--;
- return 0;
-}
-
-int simple_rename(struct inode *old_dir, struct dentry *old_dentry,
- struct inode *new_dir, struct dentry *new_dentry)
-{
- struct inode *inode = old_dentry->d_inode;
- int they_are_dirs = S_ISDIR(old_dentry->d_inode->i_mode);
-
- if (!simple_empty(new_dentry))
- return -ENOTEMPTY;
-
- if (new_dentry->d_inode) {
- simple_unlink(new_dir, new_dentry);
- if (they_are_dirs)
- old_dir->i_nlink--;
- } else if (they_are_dirs) {
- old_dir->i_nlink--;
- new_dir->i_nlink++;
- }
-
- old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime =
- new_dir->i_mtime = inode->i_ctime = CURRENT_TIME;
-
- return 0;
-}
-
-#if 0
-int simple_readpage(struct file *file, struct page *page)
-{
- void *kaddr;
-
- if (PageUptodate(page))
- goto out;
-
- kaddr = kmap_atomic(page, KM_USER0);
- memset(kaddr, 0, PAGE_CACHE_SIZE);
- kunmap_atomic(kaddr, KM_USER0);
- flush_dcache_page(page);
- SetPageUptodate(page);
-out:
- unlock_page(page);
- return 0;
-}
-
-int simple_prepare_write(struct file *file, struct page *page,
- unsigned from, unsigned to)
-{
- if (!PageUptodate(page)) {
- if (to - from != PAGE_CACHE_SIZE) {
- void *kaddr = kmap_atomic(page, KM_USER0);
- memset(kaddr, 0, from);
- memset(kaddr + to, 0, PAGE_CACHE_SIZE - to);
- flush_dcache_page(page);
- kunmap_atomic(kaddr, KM_USER0);
- }
- SetPageUptodate(page);
- }
- return 0;
-}
-
-int simple_commit_write(struct file *file, struct page *page,
- unsigned offset, unsigned to)
-{
- struct inode *inode = page->mapping->host;
- loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
-
- /*
- * No need to use i_size_read() here, the i_size
- * cannot change under us because we hold the i_sem.
- */
- if (pos > inode->i_size)
- i_size_write(inode, pos);
- set_page_dirty(page);
- return 0;
-}
-#endif
-
-void d_genocide(struct dentry *root);
-
-void d_genocide(struct dentry *root)
-{
- struct dentry *this_parent = root;
- struct list_head *next;
- spin_lock(&dcache_lock);
-repeat:
- next = this_parent->d_subdirs.next;
-resume:
- while (next != &this_parent->d_subdirs) {
- struct list_head *tmp = next;
- struct dentry *dentry = list_entry(tmp, struct dentry, d_child);
- next = tmp->next;
- if (d_unhashed(dentry)||!dentry->d_inode)
- continue;
- if (!list_empty(&dentry->d_subdirs)) {
- this_parent = dentry;
- goto repeat;
- }
- atomic_dec(&dentry->d_count);
- }
- if (this_parent != root) {
- next = this_parent->d_child.next;
- atomic_dec(&this_parent->d_count);
- this_parent = this_parent->d_parent;
- goto resume;
- }
- spin_unlock(&dcache_lock);
-}
-
-static void simple_read_inode(struct inode * inode)
-{
- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
-}
-
-
-int simple_fill_super(struct super_block *s, int magic, struct tree_descr *files)
-{
- static struct super_operations s_ops = {
- .statfs = simple_statfs,
- .read_inode = simple_read_inode
- };
- struct inode *inode;
- struct dentry *root;
- struct dentry *dentry;
- int i;
-
- s->s_blocksize = PAGE_CACHE_SIZE;
- s->s_blocksize_bits = PAGE_CACHE_SHIFT;
- s->s_magic = magic;
- s->s_op = &s_ops;
-
- inode = new_inode(s);
- if (!inode)
- return -ENOMEM;
- inode->i_mode = S_IFDIR | 0755;
- inode->i_uid = inode->i_gid = 0;
- inode->i_blksize = PAGE_CACHE_SIZE;
- inode->i_blocks = 0;
- inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
- inode->i_op = &simple_dir_inode_operations;
- inode->i_fop = &simple_dir_operations;
- root = d_alloc_root(inode);
- if (!root) {
- iput(inode);
- return -ENOMEM;
- }
- for (i = 0; !files->name || files->name[0]; i++, files++) {
- struct qstr name;
- if (!files->name)
- continue;
- name.name = files->name;
- name.len = strlen(name.name);
- printk("adding file %.*s\n", name.len, name.name);
- name.hash = full_name_hash(name.name, name.len);
- dentry = d_alloc(root, &name);
- if (!dentry)
- goto out;
- inode = new_inode(s);
- if (!inode)
- goto out;
- inode->i_mode = S_IFREG | files->mode;
- inode->i_uid = inode->i_gid = 0;
- inode->i_blksize = PAGE_CACHE_SIZE;
- inode->i_blocks = 0;
- inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
- inode->i_fop = files->ops;
- inode->i_ino = i;
- d_add(dentry, inode);
- }
- s->s_root = root;
- return 0;
-out:
- d_genocide(root);
- dput(root);
- return -ENOMEM;
-}
-
-#if 0
-static spinlock_t pin_fs_lock = SPIN_LOCK_UNLOCKED;
-
-int simple_pin_fs(char *name, struct vfsmount **mount, int *count)
-{
- struct vfsmount *mnt = NULL;
- spin_lock(&pin_fs_lock);
- if (unlikely(!*mount)) {
- spin_unlock(&pin_fs_lock);
- mnt = do_kern_mount(name, 0, name, NULL);
- if (IS_ERR(mnt))
- return PTR_ERR(mnt);
- spin_lock(&pin_fs_lock);
- if (!*mount)
- *mount = mnt;
- }
- mntget(*mount);
- ++*count;
- spin_unlock(&pin_fs_lock);
- mntput(mnt);
- return 0;
-}
-
-void simple_release_fs(struct vfsmount **mount, int *count)
-{
- struct vfsmount *mnt;
- spin_lock(&pin_fs_lock);
- mnt = *mount;
- if (!--*count)
- *mount = NULL;
- spin_unlock(&pin_fs_lock);
- mntput(mnt);
-}
-
-ssize_t simple_read_from_buffer(void __user *to, size_t count, loff_t *ppos,
- const void *from, size_t available)
-{
- loff_t pos = *ppos;
- if (pos < 0)
- return -EINVAL;
- if (pos >= available)
- return 0;
- if (count > available - pos)
- count = available - pos;
- if (copy_to_user(to, from + pos, count))
- return -EFAULT;
- *ppos = pos + count;
- return count;
-}
-
-EXPORT_SYMBOL(dcache_dir_close);
-EXPORT_SYMBOL(dcache_dir_lseek);
-EXPORT_SYMBOL(dcache_dir_open);
-EXPORT_SYMBOL(dcache_readdir);
-EXPORT_SYMBOL(generic_read_dir);
-EXPORT_SYMBOL(simple_commit_write);
-EXPORT_SYMBOL(simple_empty);
-EXPORT_SYMBOL(simple_fill_super);
-EXPORT_SYMBOL(simple_getattr);
-EXPORT_SYMBOL(simple_link);
-EXPORT_SYMBOL(simple_lookup);
-EXPORT_SYMBOL(simple_pin_fs);
-EXPORT_SYMBOL(simple_prepare_write);
-EXPORT_SYMBOL(simple_readpage);
-EXPORT_SYMBOL(simple_release_fs);
-EXPORT_SYMBOL(simple_rename);
-EXPORT_SYMBOL(simple_rmdir);
-EXPORT_SYMBOL(simple_statfs);
-EXPORT_SYMBOL(simple_sync_file);
-EXPORT_SYMBOL(simple_unlink);
-EXPORT_SYMBOL(simple_read_from_buffer);
-EXPORT_SYMBOL(get_sb_pseudo);
-#endif
-
-/* -----------------------------------------------------------------*/
-
Deleted: trunk/fs/ocfs2/cluster/compat_libfs.h
===================================================================
--- trunk/fs/ocfs2/cluster/compat_libfs.h 2005-03-18 23:55:55 UTC (rev 2013)
+++ trunk/fs/ocfs2/cluster/compat_libfs.h 2005-03-19 00:04:59 UTC (rev 2014)
@@ -1,18 +0,0 @@
-#ifndef CLUSTER_COMPAT_LIBFS_H
-#define CLUSTER_COMPAT_LIBFS_H
-
-#include <linux/version.h>
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-struct tree_descr
-{
- char *name;
- struct file_operations *ops;
- int mode;
-};
-#endif
-
-int simple_fill_super(struct super_block *s, int magic, struct tree_descr *files);
-struct dentry * simple_find_child(struct dentry *dentry, struct qstr *name);
-
-#endif /* CLUSTER_COMPAT_LIBFS_H */
Modified: trunk/fs/ocfs2/cluster/heartbeat.c
===================================================================
--- trunk/fs/ocfs2/cluster/heartbeat.c 2005-03-18 23:55:55 UTC (rev 2013)
+++ trunk/fs/ocfs2/cluster/heartbeat.c 2005-03-19 00:04:59 UTC (rev 2014)
@@ -68,9 +68,6 @@
#include "tcp.h"
#include "nodemanager.h"
-#include "compat_libfs.h"
-#include "transaction_file.h"
-
#ifndef __user
#define __user
#endif
Modified: trunk/fs/ocfs2/cluster/nodemanager.c
===================================================================
--- trunk/fs/ocfs2/cluster/nodemanager.c 2005-03-18 23:55:55 UTC (rev 2013)
+++ trunk/fs/ocfs2/cluster/nodemanager.c 2005-03-19 00:04:59 UTC (rev 2014)
@@ -64,8 +64,6 @@
#include "nodemanager.h"
#include "heartbeat.h"
-#include "compat_libfs.h"
-#include "transaction_file.h"
#include "usysfs.h"
#ifndef __user
Deleted: trunk/fs/ocfs2/cluster/transaction_file.c
===================================================================
--- trunk/fs/ocfs2/cluster/transaction_file.c 2005-03-18 23:55:55 UTC (rev 2013)
+++ trunk/fs/ocfs2/cluster/transaction_file.c 2005-03-19 00:04:59 UTC (rev 2014)
@@ -1,120 +0,0 @@
-
-/*
- * transaction_file.c
- * Little library for transaction files.
- */
-
-#include <linux/fs.h>
-#include <linux/slab.h>
-
-#include <asm/uaccess.h>
-
-#include "transaction_file.h"
-
-#ifndef __user
-#define __user
-#endif
-
-/*
- * transaction based IO methods.
- * The file expects a single write which triggers the transaction, and then
- * possibly a read which collects the result - which is stored in a
- * file-local buffer.
- */
-static ssize_t TA_write(struct file *file, const char __user *buf, size_t size, loff_t *pos)
-{
- ino_t ino = file->f_dentry->d_inode->i_ino;
- struct argresp *ar;
- ssize_t rv = 0;
- struct super_block *sb = file->f_dentry->d_inode->i_sb;
- struct TA_write_ops *ops = TA_GENERIC_SB_MEMBER(sb);
- ssize_t (*write_op)(struct file *, char *, size_t);
-
- printk("welcome to TA_write: num_ops=%d, op[%d]=%p, private=%p, size=%lld\n",
- ops->num_ops, (int)ino, ops->write_op[ino], file->private_data, (long long)size);
- if (ino >= ops->num_ops || ops->write_op[ino] == NULL)
- return -EINVAL;
- write_op = ops->write_op[ino];
- if (file->private_data)
- return -EINVAL; /* only one write allowed per open */
- if (size > PAGE_SIZE - sizeof(struct argresp))
- return -EFBIG;
-
- ar = kmalloc(PAGE_SIZE, GFP_KERNEL);
- if (!ar)
- return -ENOMEM;
- ar->size = 0;
- down(&file->f_dentry->d_inode->i_sem);
- if (file->private_data)
- rv = -EINVAL;
- else
- file->private_data = ar;
- up(&file->f_dentry->d_inode->i_sem);
- if (rv) {
- kfree(ar);
- return rv;
- }
- if (copy_from_user(ar->data, buf, size))
- return -EFAULT;
-
- printk("now calling write_op...\n");
- rv = write_op(file, ar->data, size);
- printk("write_op returned %lld\n", (long long)rv);
- if (rv>0) {
- ar->size = rv;
- rv = size;
- }
- return rv;
-}
-
-
-static ssize_t TA_read(struct file *file, char __user *buf, size_t size, loff_t *pos)
-{
- struct argresp *ar;
- ssize_t rv = 0;
-
- if (file->private_data == NULL)
- rv = TA_write(file, buf, 0, pos);
- if (rv < 0)
- return rv;
-
- ar = file->private_data;
- if (!ar)
- return 0;
- if (*pos >= ar->size)
- return 0;
- if (*pos + size > ar->size)
- size = ar->size - *pos;
- if (copy_to_user(buf, ar->data + *pos, size))
- return -EFAULT;
- *pos += size;
- return size;
-}
-
-static int TA_open(struct inode *inode, struct file *file)
-{
- file->private_data = NULL;
- return 0;
-}
-
-static int TA_release(struct inode *inode, struct file *file)
-{
- void *p = file->private_data;
- file->private_data = NULL;
- kfree(p);
- return 0;
-}
-
-
-
-
-
-
-
-
-struct file_operations transaction_ops = {
- .write = TA_write,
- .read = TA_read,
- .open = TA_open,
- .release = TA_release,
-};
Deleted: trunk/fs/ocfs2/cluster/transaction_file.h
===================================================================
--- trunk/fs/ocfs2/cluster/transaction_file.h 2005-03-18 23:55:55 UTC (rev 2013)
+++ trunk/fs/ocfs2/cluster/transaction_file.h 2005-03-19 00:04:59 UTC (rev 2014)
@@ -1,28 +0,0 @@
-#ifndef _TRANSACTION_FILE_H
-#define _TRANSACTION_FILE_H
-
-#include <linux/version.h>
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-#define TA_GENERIC_SB_MEMBER(sb) ((sb)->s_fs_info)
-#else
-#define TA_GENERIC_SB_MEMBER(sb) ((sb)->u.generic_sbp)
-#endif
-
-/* an argresp is stored in an allocated page and holds the
- * size of the argument or response, along with its content
- */
-struct argresp {
- ssize_t size;
- char data[0];
-};
-
-struct TA_write_ops
-{
- int num_ops;
- ssize_t (*write_op[0])(struct file *, char *, size_t);
-};
-
-extern struct file_operations transaction_ops;
-
-#endif /* _TRANSACTION_FILE_H */
More information about the Ocfs2-commits
mailing list