[Ocfs2-commits] jlbec commits r1745 - branches/kabi/cluster
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu Jan 6 12:41:40 CST 2005
Author: jlbec
Date: 2005-01-06 12:41:39 -0600 (Thu, 06 Jan 2005)
New Revision: 1745
Modified:
branches/kabi/cluster/compat_libfs.c
branches/kabi/cluster/compat_libfs.h
branches/kabi/cluster/heartbeat.c
branches/kabi/cluster/nodemanager.c
Log:
o Clean up compat_libfs.c
Modified: branches/kabi/cluster/compat_libfs.c
===================================================================
--- branches/kabi/cluster/compat_libfs.c 2005-01-06 18:10:09 UTC (rev 1744)
+++ branches/kabi/cluster/compat_libfs.c 2005-01-06 18:41:39 UTC (rev 1745)
@@ -19,66 +19,17 @@
#include "compat_libfs.h"
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-#define kstatfs statfs
-#endif
-
-#define __user
-
-
-int simple_statfs(struct super_block *sb, struct kstatfs *buf);
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd);
-#else
+int simple_statfs(struct super_block *sb, struct statfs *buf);
struct dentry *simple_lookup(struct inode *dir,struct dentry *dentry);
-#endif
-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)
+int simple_statfs(struct super_block *sb, struct statfs *buf)
{
- 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 kstatfs *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.
- */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
-{
- if (dentry->d_name.len > NAME_MAX)
- return ERR_PTR(-ENAMETOOLONG);
- d_add(dentry, NULL);
- return NULL;
-}
-#else
struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry)
{
if (dentry->d_name.len > NAME_MAX)
@@ -88,7 +39,6 @@
}
#endif
-
struct dentry * simple_find_child(struct dentry *dentry, struct qstr *name)
{
struct list_head *iter;
@@ -110,131 +60,7 @@
-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 __user *buf, size_t siz, loff_t *ppos)
-{
- return -EISDIR;
-}
-
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
struct file_operations simple_dir_operations = {
.open = dcache_dir_open,
.release = dcache_dir_close,
@@ -247,185 +73,6 @@
.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;
@@ -522,79 +169,6 @@
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
/* -----------------------------------------------------------------*/
Modified: branches/kabi/cluster/compat_libfs.h
===================================================================
--- branches/kabi/cluster/compat_libfs.h 2005-01-06 18:10:09 UTC (rev 1744)
+++ branches/kabi/cluster/compat_libfs.h 2005-01-06 18:41:39 UTC (rev 1745)
@@ -9,7 +9,11 @@
#define TA_GENERIC_SB_MEMBER(sb) ((sb)->u.generic_sbp)
#endif
+#ifndef __user
+#define __user
+#endif
+
/* an argresp is stored in an allocated page and holds the
* size of the argument or response, along with its content
*/
@@ -25,6 +29,8 @@
TA_write_op *write_op[0];
} TA_write_ops;
+extern struct file_operations transaction_ops;
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
struct tree_descr
{
@@ -32,9 +38,12 @@
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);
+extern struct file_operations simple_dir_operations;
+extern struct inode_operations simple_dir_inode_operations;
+#endif
+
#endif /* CLUSTER_COMPAT_LIBFS_H */
Modified: branches/kabi/cluster/heartbeat.c
===================================================================
--- branches/kabi/cluster/heartbeat.c 2005-01-06 18:10:09 UTC (rev 1744)
+++ branches/kabi/cluster/heartbeat.c 2005-01-06 18:41:39 UTC (rev 1745)
@@ -501,7 +501,6 @@
}
-extern struct file_operations transaction_ops;
/*----------------------------------------------------------------------------*/
/*
Modified: branches/kabi/cluster/nodemanager.c
===================================================================
--- branches/kabi/cluster/nodemanager.c 2005-01-06 18:10:09 UTC (rev 1744)
+++ branches/kabi/cluster/nodemanager.c 2005-01-06 18:41:39 UTC (rev 1745)
@@ -164,11 +164,6 @@
int nm_init(dlm_ctxt *dlm);
static void nm_do_callbacks(int type, void *ptr1, void *ptr2, u16 idx);
-/* support for adding files, dirs, hardlinks in /proc/cluster/nm/... */
-extern struct file_operations simple_dir_operations;
-extern struct inode_operations simple_dir_inode_operations;
-extern struct file_operations transaction_ops;
-
static inline int nm_find_next_slot(void *bitmap, int max, int request);
static struct dentry * nm_add_file(struct super_block *s, struct dentry *parent, struct tree_descr *file, int ino);
static struct dentry * nm_add_link(struct super_block *s, struct dentry *parent, struct tree_descr *file, int ino);
More information about the Ocfs2-commits
mailing list