--- /dev/null
+Index: linux-stage/fs/ext3/super.c
+===================================================================
+--- linux-stage.orig/fs/ext3/super.c 2004-04-02 16:40:18.000000000 -0500
++++ linux-stage/fs/ext3/super.c 2004-04-02 16:40:18.000000000 -0500
+@@ -115,6 +115,8 @@
+ handle->h_err = err;
+ }
+
++EXPORT_SYMBOL(ext3_journal_abort_handle);
++
+ static char error_buf[1024];
+
+ /* Deal with the reporting of failure conditions on a filesystem such as
+@@ -1774,6 +1776,8 @@
+ return ret;
+ }
+
++EXPORT_SYMBOL(ext3_force_commit);
++
+ /*
+ * Ext3 always journals updates to the superblock itself, so we don't
+ * have to propagate any other updates to the superblock on disk at this
+@@ -2088,6 +2092,10 @@
+ unsigned long *blocks, int *created, int create);
+ EXPORT_SYMBOL(ext3_map_inode_page);
+
++EXPORT_SYMBOL(ext3_xattr_get);
++EXPORT_SYMBOL(ext3_xattr_set_handle);
++EXPORT_SYMBOL(ext3_bread);
++
+ MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
+ MODULE_DESCRIPTION("Second Extended Filesystem with journaling extensions");
+ MODULE_LICENSE("GPL");
--- /dev/null
+Index: linux-2.6.0/include/linux/ext3_fs_sb.h
+===================================================================
+--- linux-2.6.0.orig/include/linux/ext3_fs_sb.h 2003-06-24 18:05:26.000000000 +0400
++++ linux-2.6.0/include/linux/ext3_fs_sb.h 2003-12-31 01:09:26.000000000 +0300
+@@ -19,9 +19,12 @@
+ #ifdef __KERNEL__
+ #include <linux/timer.h>
+ #include <linux/wait.h>
++#ifndef EXT_INCLUDE
++#define EXT_INCLUDE
+ #include <linux/blockgroup_lock.h>
+ #include <linux/percpu_counter.h>
+ #endif
++#endif
+
+ /*
+ * third extended-fs super-block data in memory
+ /* try to find attribute in inode body */
+ err = ext3_xattr_ibody_get(inode, name_index, name,
+ buffer, buffer_size);
-+ if (err < 0)
++ if (err < 0)
+ /* search was unsuccessful, try to find EA in dedicated block */
+ err = ext3_xattr_block_get(inode, name_index, name,
+ buffer, buffer_size);
+ return 0;
+
+ ret = ext3_get_inode_loc(inode, &iloc);
-+ if (ret)
++ if (ret)
+ return ret;
+ raw_inode = ext3_raw_inode(&iloc);
+
+ /* get list of attributes stored in inode body */
+ error = ext3_xattr_ibody_list(inode, buffer, buffer_size);
+ if (error < 0) {
-+ /* some error occured while collecting
++ /* some error occured while collecting
+ * attributes in inode body */
+ size = 0;
+ goto cleanup;
+ if (buffer_size <= 0) {
+ buffer = NULL;
+ buffer_size = 0;
-+ } else
++ } else
+ buffer += error;
+ }
+
+ error = ext3_xattr_block_list(inode, buffer, buffer_size);
-+ if (error < 0)
++ if (error < 0)
+ /* listing was successful, so we return len */
+ size = 0;
+
+ * NOTE: free space includes space our attribute hold
+ */
+int
-+ext3_xattr_ibody_find(struct inode *inode, int name_index,
++ext3_xattr_ibody_find(struct inode *inode, int name_index,
+ const char *name, struct ext3_xattr_entry *rentry, int *free)
+{
+ struct ext3_xattr_entry *last;
+ return ret;
+
+ err = ext3_get_inode_loc(inode, &iloc);
-+ if (err)
++ if (err)
+ return -EIO;
+ raw_inode = ext3_raw_inode(&iloc);
+
+
+/*
+ * ext3_xattr_inode_set()
-+ *
++ *
+ * this routine add/remove/replace attribute in inode body
+ */
+int
+ }
+ if (name_index == last->e_name_index &&
+ name_len == last->e_name_len &&
-+ !memcmp(name, last->e_name, name_len))
++ !memcmp(name, last->e_name, name_len))
+ here = last;
+ else {
+ /* we calculate all but our attribute
+ e = (struct ext3_xattr_entry *) start;
+ while (!IS_LAST_ENTRY(e)) {
+ struct ext3_xattr_entry *next = EXT3_XATTR_NEXT(e);
-+ int offs = le16_to_cpu(e->e_value_offs);
-+ if (offs < border)
-+ e->e_value_offs =
++ int offs = le16_to_cpu(e->e_value_offs);
++ if (offs < border)
++ e->e_value_offs =
+ cpu_to_le16(offs + size);
+ e = next;
+ }
+
+/*
+ * ext3_xattr_block_set()
-+ *
++ *
+ * this routine add/remove/replace attribute in EA block
+ */
+int
*/
loff_t i_disksize;
-+ /* on-disk additional lenght */
++ /* on-disk additional length */
+ __u16 i_extra_isize;
+
/*
--- /dev/null
+Index: linux-stage/include/linux/ext3_fs.h
+===================================================================
+--- linux-stage.orig/include/linux/ext3_fs.h 2004-04-02 16:43:37.000000000 -0500
++++ linux-stage/include/linux/ext3_fs.h 2004-04-02 16:43:37.000000000 -0500
+@@ -331,12 +331,13 @@
+ #define EXT3_MOUNT_IOPEN_NOPRIV 0x20000 /* Make iopen world-readable */
+
+ /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
+-#ifndef _LINUX_EXT2_FS_H
++#ifndef clear_opt
+ #define clear_opt(o, opt) o &= ~EXT3_MOUNT_##opt
+ #define set_opt(o, opt) o |= EXT3_MOUNT_##opt
+ #define test_opt(sb, opt) (EXT3_SB(sb)->s_mount_opt & \
+ EXT3_MOUNT_##opt)
+-#else
++#endif
++#ifndef EXT2_MOUNT_NOLOAD
+ #define EXT2_MOUNT_NOLOAD EXT3_MOUNT_NOLOAD
+ #define EXT2_MOUNT_ABORT EXT3_MOUNT_ABORT
+ #define EXT2_MOUNT_DATA_FLAGS EXT3_MOUNT_DATA_FLAGS
err = PTR_ERR(inode);
if (IS_ERR(inode))
goto out_stop;
-Index: uml-2.6.3/include/linux/dcache.h
-===================================================================
---- uml-2.6.3.orig/include/linux/dcache.h 2004-02-21 00:19:14.365988600 +0800
-+++ uml-2.6.3/include/linux/dcache.h 2004-02-21 00:21:04.612228624 +0800
-@@ -25,6 +25,11 @@
-
- #define IS_ROOT(x) ((x) == (x)->d_parent)
-
-+struct dentry_params {
-+ unsigned long p_inum;
-+ void *p_ptr;
-+};
-+
- /*
- * "quick string" -- eases parameter passing, but more importantly
- * saves "metadata" about the string (ie length and the hash).
Index: uml-2.6.3/include/linux/ext3_fs.h
===================================================================
--- uml-2.6.3.orig/include/linux/ext3_fs.h 2004-01-09 14:59:44.000000000 +0800
--- /dev/null
+ fs/ext3/inode.c | 3
+ fs/ext3/iopen.c | 239 +++++++++++++++++++++++++++++++++++++
+ fs/ext3/iopen.h | 15 ++
+ fs/ext3/namei.c | 13 ++
+ fs/ext3/super.c | 17 ++
+ include/linux/ext3_fs.h | 2
+ 7 files changed, 304 insertions(+), 1 deletion(-)
+
+Index: linux-stage/fs/ext3/Makefile
+===================================================================
+--- linux-stage.orig/fs/ext3/Makefile 2004-05-07 16:00:16.000000000 -0400
++++ linux-stage/fs/ext3/Makefile 2004-05-07 16:00:17.000000000 -0400
+@@ -4,7 +4,7 @@
+
+ obj-$(CONFIG_EXT3_FS) += ext3.o
+
+-ext3-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
++ext3-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o iopen.o \
+ ioctl.o namei.o super.o symlink.o hash.o
+
+ ext3-$(CONFIG_EXT3_FS_XATTR) += xattr.o xattr_user.o xattr_trusted.o
+Index: linux-stage/fs/ext3/inode.c
+===================================================================
+--- linux-stage.orig/fs/ext3/inode.c 2004-05-07 16:00:16.000000000 -0400
++++ linux-stage/fs/ext3/inode.c 2004-05-07 17:21:59.000000000 -0400
+@@ -37,6 +37,7 @@
+ #include <linux/mpage.h>
+ #include <linux/uio.h>
+ #include "xattr.h"
++#include "iopen.h"
+ #include "acl.h"
+
+ /*
+@@ -2472,6 +2473,9 @@
+ ei->i_acl = EXT3_ACL_NOT_CACHED;
+ ei->i_default_acl = EXT3_ACL_NOT_CACHED;
+ #endif
++ if (ext3_iopen_get_inode(inode))
++ return;
++
+ if (ext3_get_inode_loc(inode, &iloc, 0))
+ goto bad_inode;
+ bh = iloc.bh;
+Index: linux-stage/fs/ext3/iopen.c
+===================================================================
+--- linux-stage.orig/fs/ext3/iopen.c 2004-05-07 16:00:17.000000000 -0400
++++ linux-stage/fs/ext3/iopen.c 2004-05-07 17:22:37.000000000 -0400
+@@ -0,0 +1,272 @@
++/*
++ * linux/fs/ext3/iopen.c
++ *
++ * Special support for open by inode number
++ *
++ * Copyright (C) 2001 by Theodore Ts'o (tytso@alum.mit.edu).
++ *
++ * This file may be redistributed under the terms of the GNU General
++ * Public License.
++ *
++ *
++ * Invariants:
++ * - there is only ever a single DCACHE_NFSD_DISCONNECTED dentry alias
++ * for an inode at one time.
++ * - there are never both connected and DCACHE_NFSD_DISCONNECTED dentry
++ * aliases on an inode at the same time.
++ *
++ * If we have any connected dentry aliases for an inode, use one of those
++ * in iopen_lookup(). Otherwise, we instantiate a single NFSD_DISCONNECTED
++ * dentry for this inode, which thereafter will be found by the dcache
++ * when looking up this inode number in __iopen__, so we don't return here
++ * until it is gone.
++ *
++ * If we get an inode via a regular name lookup, then we "rename" the
++ * NFSD_DISCONNECTED dentry to the proper name and parent. This ensures
++ * existing users of the disconnected dentry will continue to use the same
++ * dentry as the connected users, and there will never be both kinds of
++ * dentry aliases at one time.
++ */
++
++#include <linux/sched.h>
++#include <linux/fs.h>
++#include <linux/ext3_jbd.h>
++#include <linux/jbd.h>
++#include <linux/ext3_fs.h>
++#include <linux/smp_lock.h>
++#include <linux/dcache.h>
++#include <linux/security.h>
++#include "iopen.h"
++
++#ifndef assert
++#define assert(test) J_ASSERT(test)
++#endif
++
++#define IOPEN_NAME_LEN 32
++
++/*
++ * This implements looking up an inode by number.
++ */
++static struct dentry *iopen_lookup(struct inode * dir, struct dentry *dentry,
++ struct nameidata *nd)
++{
++ struct inode *inode;
++ unsigned long ino;
++ struct list_head *lp;
++ struct dentry *alternate;
++ char buf[IOPEN_NAME_LEN];
++
++ if (dentry->d_name.len >= IOPEN_NAME_LEN)
++ return ERR_PTR(-ENAMETOOLONG);
++
++ memcpy(buf, dentry->d_name.name, dentry->d_name.len);
++ buf[dentry->d_name.len] = 0;
++
++ if (strcmp(buf, ".") == 0)
++ ino = dir->i_ino;
++ else if (strcmp(buf, "..") == 0)
++ ino = EXT3_ROOT_INO;
++ else
++ ino = simple_strtoul(buf, 0, 0);
++
++ if ((ino != EXT3_ROOT_INO &&
++ //ino != EXT3_ACL_IDX_INO &&
++ //ino != EXT3_ACL_DATA_INO &&
++ ino < EXT3_FIRST_INO(dir->i_sb)) ||
++ ino > le32_to_cpu(EXT3_SB(dir->i_sb)->s_es->s_inodes_count))
++ return ERR_PTR(-ENOENT);
++
++ inode = iget(dir->i_sb, ino);
++ if (!inode)
++ return ERR_PTR(-EACCES);
++ if (is_bad_inode(inode)) {
++ iput(inode);
++ return ERR_PTR(-ENOENT);
++ }
++
++ assert(list_empty(&dentry->d_alias)); /* d_instantiate */
++ assert(d_unhashed(dentry)); /* d_rehash */
++
++ /* preferrably return a connected dentry */
++ spin_lock(&dcache_lock);
++ list_for_each(lp, &inode->i_dentry) {
++ alternate = list_entry(lp, struct dentry, d_alias);
++ assert(!(alternate->d_flags & DCACHE_DISCONNECTED));
++ }
++
++ if (!list_empty(&inode->i_dentry)) {
++ alternate = list_entry(inode->i_dentry.next,
++ struct dentry, d_alias);
++ dget_locked(alternate);
++ alternate->d_vfs_flags |= DCACHE_REFERENCED;
++ iput(inode);
++ spin_unlock(&dcache_lock);
++ return alternate;
++ }
++ dentry->d_flags |= DCACHE_DISCONNECTED;
++
++ /* d_add(), but don't drop dcache_lock before adding dentry to inode */
++ list_add(&dentry->d_alias, &inode->i_dentry); /* d_instantiate */
++ dentry->d_inode = inode;
++
++ __d_rehash(dentry, 0); /* d_rehash */
++ spin_unlock(&dcache_lock);
++
++ return NULL;
++}
++
++#define do_switch(x,y) do { \
++ __typeof__ (x) __tmp = x; \
++ x = y; y = __tmp; } while (0)
++
++static inline void switch_names(struct dentry *dentry, struct dentry *target)
++{
++ const unsigned char *old_name, *new_name;
++
++ memcpy(dentry->d_iname, target->d_iname, DNAME_INLINE_LEN);
++ old_name = target->d_name.name;
++ new_name = dentry->d_name.name;
++ if (old_name == target->d_iname)
++ old_name = dentry->d_iname;
++ if (new_name == dentry->d_iname)
++ new_name = target->d_iname;
++ target->d_name.name = new_name;
++ dentry->d_name.name = old_name;
++}
++
++/* This function is spliced into ext3_lookup and does the move of a
++ * disconnected dentry (if it exists) to a connected dentry.
++ */
++struct dentry *iopen_connect_dentry(struct dentry *dentry, struct inode *inode,
++ int rehash)
++{
++ struct dentry *tmp, *goal = NULL;
++ struct list_head *lp;
++
++ /* verify this dentry is really new */
++ assert(dentry->d_inode == NULL);
++ assert(list_empty(&dentry->d_alias)); /* d_instantiate */
++ if (rehash)
++ assert(d_unhashed(dentry)); /* d_rehash */
++ assert(list_empty(&dentry->d_subdirs));
++
++ spin_lock(&dcache_lock);
++ if (!inode)
++ goto do_rehash;
++
++ /* preferrably return a connected dentry */
++ list_for_each(lp, &inode->i_dentry) {
++ tmp = list_entry(lp, struct dentry, d_alias);
++ if (tmp->d_flags & DCACHE_DISCONNECTED) {
++ assert(tmp->d_alias.next == &inode->i_dentry);
++ assert(tmp->d_alias.prev == &inode->i_dentry);
++ goal = tmp;
++ dget_locked(goal);
++ break;
++ }
++ }
++
++ if (!goal)
++ goto do_instantiate;
++
++ /* Move the goal to the de hash queue */
++ goal->d_flags &= ~ DCACHE_DISCONNECTED;
++ security_d_instantiate(goal, inode);
++ __d_rehash(dentry, 0);
++ __d_move(goal, dentry);
++ spin_unlock(&dcache_lock);
++ iput(inode);
++
++ return goal;
++
++ /* d_add(), but don't drop dcache_lock before adding dentry to inode */
++do_instantiate:
++ list_add(&dentry->d_alias, &inode->i_dentry); /* d_instantiate */
++ dentry->d_inode = inode;
++do_rehash:
++ if (rehash)
++ __d_rehash(dentry, 0); /* d_rehash */
++ spin_unlock(&dcache_lock);
++
++ return NULL;
++}
++
++/*
++ * These are the special structures for the iopen pseudo directory.
++ */
++
++static struct inode_operations iopen_inode_operations = {
++ lookup: iopen_lookup, /* BKL held */
++};
++
++static struct file_operations iopen_file_operations = {
++ read: generic_read_dir,
++};
++
++static int match_dentry(struct dentry *dentry, const char *name)
++{
++ int len;
++
++ len = strlen(name);
++ if (dentry->d_name.len != len)
++ return 0;
++ if (strncmp(dentry->d_name.name, name, len))
++ return 0;
++ return 1;
++}
++
++/*
++ * This function is spliced into ext3_lookup and returns 1 the file
++ * name is __iopen__ and dentry has been filled in appropriately.
++ */
++int ext3_check_for_iopen(struct inode *dir, struct dentry *dentry)
++{
++ struct inode *inode;
++
++ if (dir->i_ino != EXT3_ROOT_INO ||
++ !test_opt(dir->i_sb, IOPEN) ||
++ !match_dentry(dentry, "__iopen__"))
++ return 0;
++
++ inode = iget(dir->i_sb, EXT3_BAD_INO);
++
++ if (!inode)
++ return 0;
++ d_add(dentry, inode);
++ return 1;
++}
++
++/*
++ * This function is spliced into read_inode; it returns 1 if inode
++ * number is the one for /__iopen__, in which case the inode is filled
++ * in appropriately. Otherwise, this fuction returns 0.
++ */
++int ext3_iopen_get_inode(struct inode *inode)
++{
++ if (inode->i_ino != EXT3_BAD_INO)
++ return 0;
++
++ inode->i_mode = S_IFDIR | S_IRUSR | S_IXUSR;
++ if (test_opt(inode->i_sb, IOPEN_NOPRIV))
++ inode->i_mode |= 0777;
++ inode->i_uid = 0;
++ inode->i_gid = 0;
++ inode->i_nlink = 1;
++ inode->i_size = 4096;
++ inode->i_atime = CURRENT_TIME;
++ inode->i_ctime = CURRENT_TIME;
++ inode->i_mtime = CURRENT_TIME;
++ EXT3_I(inode)->i_dtime = 0;
++ inode->i_blksize = PAGE_SIZE; /* This is the optimal IO size
++ * (for stat), not the fs block
++ * size */
++ inode->i_blocks = 0;
++ inode->i_version = 1;
++ inode->i_generation = 0;
++
++ inode->i_op = &iopen_inode_operations;
++ inode->i_fop = &iopen_file_operations;
++ inode->i_mapping->a_ops = 0;
++
++ return 1;
++}
+Index: linux-stage/fs/ext3/iopen.h
+===================================================================
+--- linux-stage.orig/fs/ext3/iopen.h 2004-05-07 16:00:17.000000000 -0400
++++ linux-stage/fs/ext3/iopen.h 2004-05-07 16:00:17.000000000 -0400
+@@ -0,0 +1,15 @@
++/*
++ * iopen.h
++ *
++ * Special support for opening files by inode number.
++ *
++ * Copyright (C) 2001 by Theodore Ts'o (tytso@alum.mit.edu).
++ *
++ * This file may be redistributed under the terms of the GNU General
++ * Public License.
++ */
++
++extern int ext3_check_for_iopen(struct inode *dir, struct dentry *dentry);
++extern int ext3_iopen_get_inode(struct inode *inode);
++extern struct dentry *iopen_connect_dentry(struct dentry *dentry,
++ struct inode *inode, int rehash);
+Index: linux-stage/fs/ext3/namei.c
+===================================================================
+--- linux-stage.orig/fs/ext3/namei.c 2004-05-07 16:00:16.000000000 -0400
++++ linux-stage/fs/ext3/namei.c 2004-05-07 16:00:17.000000000 -0400
+@@ -37,6 +37,7 @@
+ #include <linux/buffer_head.h>
+ #include <linux/smp_lock.h>
+ #include "xattr.h"
++#include "iopen.h"
+ #include "acl.h"
+
+ /*
+@@ -979,6 +980,9 @@
+ if (dentry->d_name.len > EXT3_NAME_LEN)
+ return ERR_PTR(-ENAMETOOLONG);
+
++ if (ext3_check_for_iopen(dir, dentry))
++ return NULL;
++
+ bh = ext3_find_entry(dentry, &de);
+ inode = NULL;
+ if (bh) {
+@@ -989,10 +993,8 @@
+ if (!inode)
+ return ERR_PTR(-EACCES);
+ }
+- if (inode)
+- return d_splice_alias(inode, dentry);
+- d_add(dentry, inode);
+- return NULL;
++
++ return iopen_connect_dentry(dentry, inode, 1);
+ }
+
+
+@@ -2019,10 +2021,6 @@
+ inode->i_nlink);
+ inode->i_version++;
+ inode->i_nlink = 0;
+- /* There's no need to set i_disksize: the fact that i_nlink is
+- * zero will ensure that the right thing happens during any
+- * recovery. */
+- inode->i_size = 0;
+ ext3_orphan_add(handle, inode);
+ inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
+ ext3_mark_inode_dirty(handle, inode);
+@@ -2139,6 +2137,23 @@
+ return err;
+ }
+
++/* Like ext3_add_nondir() except for call to iopen_connect_dentry */
++static int ext3_add_link(handle_t *handle, struct dentry *dentry,
++ struct inode *inode)
++{
++ int err = ext3_add_entry(handle, dentry, inode);
++ if (!err) {
++ err = ext3_mark_inode_dirty(handle, inode);
++ if (err == 0) {
++ (void)iopen_connect_dentry(dentry, inode, 0);
++ return 0;
++ }
++ }
++ ext3_dec_count(handle, inode);
++ iput(inode);
++ return err;
++}
++
+ static int ext3_link (struct dentry * old_dentry,
+ struct inode * dir, struct dentry *dentry)
+ {
+@@ -2161,7 +2176,8 @@
+ ext3_inc_count(handle, inode);
+ atomic_inc(&inode->i_count);
+
+- err = ext3_add_nondir(handle, dentry, inode);
++ err = ext3_add_link(handle, dentry, inode);
++ ext3_orphan_del(handle,inode);
+ ext3_journal_stop(handle);
+ return err;
+ }
+Index: linux-stage/fs/ext3/super.c
+===================================================================
+--- linux-stage.orig/fs/ext3/super.c 2004-05-07 16:00:16.000000000 -0400
++++ linux-stage/fs/ext3/super.c 2004-05-07 17:21:59.000000000 -0400
+@@ -536,7 +536,7 @@
+ Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl, Opt_noload,
+ Opt_commit, Opt_journal_update, Opt_journal_inum,
+ Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback,
+- Opt_ignore, Opt_err,
++ Opt_ignore, Opt_err, Opt_iopen, Opt_noiopen, Opt_iopen_nopriv,
+ };
+
+ static match_table_t tokens = {
+@@ -575,6 +575,9 @@
+ {Opt_ignore, "noquota"},
+ {Opt_ignore, "quota"},
+ {Opt_ignore, "usrquota"},
++ {Opt_iopen, "iopen"},
++ {Opt_noiopen, "noiopen"},
++ {Opt_iopen_nopriv, "iopen_nopriv"},
+ {Opt_err, NULL}
+ };
+
+@@ -762,6 +765,18 @@
+ case Opt_abort:
+ set_opt(sbi->s_mount_opt, ABORT);
+ break;
++ case Opt_iopen:
++ set_opt (sbi->s_mount_opt, IOPEN);
++ clear_opt (sbi->s_mount_opt, IOPEN_NOPRIV);
++ break;
++ case Opt_noiopen:
++ clear_opt (sbi->s_mount_opt, IOPEN);
++ clear_opt (sbi->s_mount_opt, IOPEN_NOPRIV);
++ break;
++ case Opt_iopen_nopriv:
++ set_opt (sbi->s_mount_opt, IOPEN);
++ set_opt (sbi->s_mount_opt, IOPEN_NOPRIV);
++ break;
+ case Opt_ignore:
+ break;
+ default:
+Index: linux-stage/include/linux/ext3_fs.h
+===================================================================
+--- linux-stage.orig/include/linux/ext3_fs.h 2004-05-07 16:00:16.000000000 -0400
++++ linux-stage/include/linux/ext3_fs.h 2004-05-07 16:00:17.000000000 -0400
+@@ -325,6 +325,8 @@
+ #define EXT3_MOUNT_NO_UID32 0x2000 /* Disable 32-bit UIDs */
+ #define EXT3_MOUNT_XATTR_USER 0x4000 /* Extended user attributes */
+ #define EXT3_MOUNT_POSIX_ACL 0x8000 /* POSIX Access Control Lists */
++#define EXT3_MOUNT_IOPEN 0x10000 /* Allow access via iopen */
++#define EXT3_MOUNT_IOPEN_NOPRIV 0x20000 /* Make iopen world-readable */
+
+ /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
+ #ifndef _LINUX_EXT2_FS_H
--- /dev/null
+ext3-wantedi-2.6-suse.patch
+ext3-san-jdike-2.6-suse.patch
+iopen-2.6-suse.patch
+export_symbols-ext3-2.6-suse.patch
+ext3-map_inode_page-2.6-suse.patch
+ext3-init-generation-2.6-suse.patch
+ext3-ea-in-inode-2.6-suse.patch
+export-ext3-2.6-suse.patch
+ext3-include-fixes-2.6-suse.patch
--- /dev/null
+default: all
+
+MODULES := ldiskfs
+
+# copy makefile over to not break patches
+ext3_extra := $(wildcard @LINUX@/fs/ext3/Makefile)
+
+ext3_headers := $(wildcard @LINUX@/fs/ext3/*.h)
+linux_headers := $(wildcard @LINUX@/include/linux/ext3*.h)
+
+ext3_sources := $(filter-out %.mod.c,$(wildcard @LINUX@/fs/ext3/*.c))
+new_sources := iopen.c iopen.h
+ldiskfs_sources := $(notdir $(ext3_sources) $(ext3_headers)) $(new_sources)
+
+ldiskfs-objs := $(filter %.o,$(ldiskfs_sources:.c=.o))
+
+EXTRA_PRE_CFLAGS := -I@LINUX@/fs -I@LUSTRE@ -I@LUSTRE@/ldiskfs
+
+@INCLUDE_RULES@
--- /dev/null
+if LDISKFS
+modulefs_DATA = ldiskfs$(KMODEXT)
+endif
+
+ldiskfs_linux_headers := $(addprefix linux/,$(subst ext3,ldiskfs,$(notdir $(linux_headers))))
+
+$(filter %.c,$(ldiskfs_sources)): sources $(ldiskfs_linux_headers) $(filter %.h,$(ldiskfs_sources))
+
+ldiskfs_sed_flags = \
+ -e "s/dx_hash_info/ext3_dx_hash_info/g" \
+ -e "s/dir_private_info/ext3_dir_private_info/g" \
+ -e "s/DX_HASH/EXT3_DX_HASH/g" \
+ -e "s/EXT3/LDISKFS/g" -e "s/ext3/ldiskfs/g"
+
+%.c: linux-stage/fs/ext3/%.c
+ sed $(strip $(ldiskfs_sed_flags)) $< > $@
+
+%.h: linux-stage/fs/ext3/%.h
+ sed $(strip $(ldiskfs_sed_flags)) $< > $@
+
+linux/ldiskfs%.h: linux-stage/include/linux/ext3%.h
+ sed $(strip $(ldiskfs_sed_flags)) $< > $@
+
+#
+# FIXME: we need to grab the series in configure somehow
+# (see bug 1679)
+#
+series := @top_srcdir@/kernel_patches/series/ldiskfs-2.6-suse.series
+
+sources: $(ext3_sources) $(ext3_headers) $(linux_headers) $(series)
+ rm -rf linux-stage linux sources $(ldiskfs_SOURCES)
+ mkdir -p linux-stage/fs/ext3 linux-stage/include/linux
+ cd linux-stage && quilt setup -l ../$(series)
+ cp $(ext3_sources) $(ext3_headers) $(ext3_extra) linux-stage/fs/ext3
+ cp $(linux_headers) linux-stage/include/linux
+ cd linux-stage && quilt push -a -q
+ mkdir linux
+ @echo -n "Replacing 'ext3' with 'ldiskfs':"
+ @for i in $(notdir $(ext3_headers) $(ext3_sources)) $(new_sources) ; do \
+ echo -n " $$i" ; \
+ sed $(strip $(ldiskfs_sed_flags)) \
+ linux-stage/fs/ext3/$$i > $$i ; \
+ done
+ @for i in $(subst ext3,,$(notdir $(linux_headers))) ; do \
+ echo -n " ext3$$i" ; \
+ sed $(strip $(ldiskfs_sed_flags)) \
+ linux-stage/include/linux/ext3$$i \
+ > linux/ldiskfs$$i ; \
+ done
+ touch sources
+
+foo-check:
+ @echo "ldiskfs_sources: $(ldiskfs_sources)"
+ @echo "ldiskfs_SOURCES: $(ldiskfs_SOURCES)"
+ @echo "ldiskfs_headers: $(ldiskfs_headers)"
+ @echo "ldiskfs_objects: $(ldiskfs_objects)"
+ @echo "ldiskfs_OBJECTS: $(ldiskfs_OBJECTS)"
+ @echo "ldiskfs_LDADD: $(ldiskfs_LDADD)"
+
+MOSTLYCLEANFILES = *.o *.ko *.mod.c
+CLEANFILES = sources *.c *.h
+
+clean: clean-am
+ rm -rf linux linux-stage
Kernelenv
Makefile
-Makefile.in
+autoMakefile
+autoMakefile.in
aclocal.m4
autom4te.cache
config.log
config.status
configure
-.*.o.cmd
+.*.cmd
+.depend
+++ /dev/null
-# Copyright (C) 2001 Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-EXTRA_DIST = Rules.linux archdep.m4 include
-DIST_SUBDIRS = libcfs portals knals unals utils tests doc router
-
-if LIBLUSTRE
-SUBDIRS = portals unals utils
-else
-
-if CRAY_PORTALS
-SUBDIRS = libcfs tests doc
-else
-SUBDIRS = libcfs portals knals unals utils tests doc router
-endif
-
-endif
--- /dev/null
+subdir-m += libcfs
+
+cray-subdirs += portals
+cray-subdirs += knals
+cray-subdirs += router
+cray-subdirs += tests
+@CRAY_PORTALS_FALSE@subdir-m += $(cray-subdirs)
+
+@INCLUDE_RULES@
+++ /dev/null
-# included in Linux kernel directories
-# Rules for module building
-
-if LINUX25
-
-basename=$(shell echo $< | sed -e 's/\.c//g' | sed -e 's/-//g' | sed -e 's/\.o//g' | sed -e 's/^.*\///g')
-AM_CPPFLAGS= -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -DKBUILD_MODNAME=$(MODULE) -DKBUILD_BASENAME=$(basename)
-
-$(MODULE).o: $($(MODULE)_OBJECTS) $($(MODULE)_DEPENDENCIES)
- $(LD) -m $(MOD_LINK) -r -o $(MODULE)_tmp.o $($(MODULE)_OBJECTS)
- rm -f $(MODULE)_tmp.c
- $(LINUX)/scripts/modpost $(LINUX)/vmlinux $(MODULE)_tmp.o
- $(COMPILE) -UKBUILD_BASENAME -DKBUILD_BASENAME=$(MODULE) -c $(MODULE)_tmp.mod.c
- $(LD) -m $(MOD_LINK) -r -o $(MODULE).o $(MODULE)_tmp.o $(MODULE)_tmp.mod.o
-
-else
-
-$(MODULE).o: $($(MODULE)_OBJECTS)
- $(LD) -m $(MOD_LINK) -r -o $(MODULE).o $($(MODULE)_OBJECTS)
-
-endif
-
-tags:
- rm -f $(top_srcdir)/TAGS
- rm -f $(top_srcdir)/tags
- find $(top_srcdir)/../portals/ -name '*.[hc]' | xargs etags -a
- find $(top_srcdir) -name '*.[hc]' | grep -v ".orig" | xargs etags -a
- find $(top_srcdir)/../portals/ -name '*.[hc]' | xargs ctags -a
- find $(top_srcdir) -name '*.[hc]' | grep -v ".orig" | xargs ctags -a
+# -------- we can't build modules unless srcdir = builddir
+if test x$enable_modules != xno ; then
+AC_CHECK_FILE([autoMakefile.am],[],
+ [AC_MSG_ERROR([At this time, Lustre does not support building kernel modules with srcdir != buildir.])])
+fi
# -------- in kernel compilation? (2.5 only) -------------
-AC_ARG_ENABLE(inkernel, [ --enable-inkernel set up 2.5 kernel makefiles])
+AC_MSG_CHECKING([if inkernel build support is requested])
+AC_ARG_ENABLE([inkernel],
+ AC_HELP_STRING([--enable-inkernel],
+ [set up 2.5 kernel makefiles]),
+ [],[enable_inkernel=no])
+AC_MSG_RESULT([$enable_inkernel])
AM_CONDITIONAL(INKERNEL, test x$enable_inkernel = xyes)
-echo "Makefile for in kernel build: $INKERNEL"
# -------- are we building against an external portals? -------
-# haha, I wonder how one is really supposed to do this
-# automake seems to have a DEFS variable which looks good
-AC_ARG_WITH(cray-portals, [ --with-cray-portals=[path] path to cray portals],
- CRAY_PORTALS_INCLUDE="-I$with_cray_portals"
- CC="$CC -DCRAY_PORTALS=1"
- )
-AC_SUBST(CRAY_PORTALS_INCLUDE)
-AM_CONDITIONAL(CRAY_PORTALS, test ! "x$with_cray_portals" = x)
-
-# -------- liblustre compilation --------------
-AC_ARG_WITH(lib, [ --with-lib compile lustre library], host_cpu="lib")
+AC_MSG_CHECKING([if Cray portals should be used])
+AC_ARG_WITH([cray-portals],
+ AC_HELP_STRING([--with-cray-portals=path],
+ [path to cray portals]),
+ [
+ if test "$with_cray_portals" != no; then
+ if test -r $with_cray_portals/include/portals/api.h ; then
+ CRAY_PORTALS_INCLUDE="-I$with_cray_portals/include"
+ AC_DEFINE(CRAY_PORTALS, 1, [Building with Cray Portals])
+ else
+ AC_MSG_ERROR([--with-cray-portals specified badly])
+ fi
+ fi
+ ],[with_cray_portals=no])
+AC_MSG_RESULT([$with_cray_portals])
+
+AM_CONDITIONAL(CRAY_PORTALS, test x$with_cray_portals != xno)
+
+# -------- enable tests and utils? -------
+if test x$enable_tests = xno ; then
+ AC_MSG_NOTICE([disabling tests])
+ enable_tests=no
+fi
+if test x$enable_utils = xno ; then
+ AC_MSG_NOTICE([disabling utilities])
+ enable_utils=no
+fi
# -------- set linuxdir ------------
-
-AC_ARG_WITH(linux, [ --with-linux=[path] set path to Linux source (default=/usr/src/linux)],LINUX=$with_linux,LINUX=/usr/src/linux)
+AC_MSG_CHECKING([for Linux sources])
+AC_ARG_WITH([linux],
+ AC_HELP_STRING([--with-linux=path],
+ [set path to Linux source (default=/usr/src/linux)]),
+ [LINUX=$with_linux],
+ [LINUX=/usr/src/linux])
+AC_MSG_RESULT([$LINUX])
AC_SUBST(LINUX)
if test x$enable_inkernel = xyes ; then
echo ln -s `pwd` $LINUX/fs/lustre
ln -s `pwd` $LINUX/fs/lustre
fi
-# --------------------
-AC_MSG_CHECKING(if you are running user mode linux for $host_cpu ...)
-if test $host_cpu = "lib" ; then
- host_cpu="lib"
- AC_MSG_RESULT(no building Lustre library)
-else
- if test -e $LINUX/include/asm-um ; then
- if test X`ls -id $LINUX/include/asm/ | awk '{print $1}'` = X`ls -id $LINUX/include/asm-um | awk '{print $1}'` ; then
- host_cpu="um";
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no (asm doesn't point at asm-um))
- fi
+# -------- check for .confg --------
+AC_ARG_WITH([linux-config],
+ [AC_HELP_STRING([--with-linux-config=path],
+ [set path to Linux .conf (default=\$LINUX/.config)])],
+ [LINUX_CONFIG=$with_linux_config],
+ [LINUX_CONFIG=$LINUX/.config])
+AC_SUBST(LINUX_CONFIG)
- else
- AC_MSG_RESULT(no (asm-um missing))
- fi
-fi
+AC_CHECK_FILE([/boot/kernel.h],
+ [KERNEL_SOURCE_HEADER='/boot/kernel.h'],
+ [AC_CHECK_FILE([/var/adm/running-kernel.h]),
+ [KERNEL_SOURCE_HEADER='/var/adm/running-kernel.h']])
-# --------- Linux 25 ------------------
+AC_ARG_WITH([kernel-source-header],
+ AC_HELP_STRING([--with-kernel-source-header=path],
+ [Use a different kernel version header. Consult README.kernel-source for details.]),
+ [KERNEL_SOURCE_HEADER=$with_kernel_source_header])
-AC_MSG_CHECKING(if you are running linux 2.5)
-if test -e $LINUX/include/linux/namei.h ; then
- linux25="yes"
- AC_MSG_RESULT(yes)
-else
- linux25="no"
- AC_MSG_RESULT(no)
+# --------------------
+ARCH_UM=
+UML_CFLAGS=
+if test x$enable_modules != xno ; then
+ AC_MSG_CHECKING([if you are running user mode linux for $host_cpu])
+ if test -e $LINUX/include/asm-um ; then
+ if test X`ls -id $LINUX/include/asm/ | awk '{print $1}'` = X`ls -id $LINUX/include/asm-um | awk '{print $1}'` ; then
+ ARCH_UM='ARCH=um'
+ # see notes in Rules.in
+ UML_CFLAGS='-O0'
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT([no (asm doesn't point at asm-um)])
+ fi
+ else
+ AC_MSG_RESULT([no (asm-um missing)])
+ fi
fi
+AC_SUBST(ARCH_UM)
+AC_SUBST(UML_CFLAGS)
+# --------- Linux 25 ------------------
+
+AC_CHECK_FILE([$LINUX/include/linux/namei.h],
+ [
+ linux25="yes"
+ KMODEXT=".ko"
+ ],[
+ KMODEXT=".o"
+ linux25="no"
+ ])
+AC_MSG_CHECKING([if you are using Linux 2.6])
+AC_MSG_RESULT([$linux25])
AM_CONDITIONAL(LINUX25, test x$linux25 = xyes)
-echo "Makefiles for in linux 2.5 build: $LINUX25"
+AC_SUBST(KMODEXT)
# ------- Makeflags ------------------
-AC_MSG_CHECKING(setting make flags system architecture: )
-case ${host_cpu} in
- lib )
- AC_MSG_RESULT($host_cpu)
- KCFLAGS='-g -Wall '
- KCPPFLAGS='-D__arch_lib__ '
- libdir='${exec_prefix}/lib/lustre'
- MOD_LINK=elf_i386
-;;
- um )
- AC_MSG_RESULT($host_cpu)
- KCFLAGS='-g -Wall -pipe -Wno-trigraphs -Wstrict-prototypes -fno-strict-aliasing -fno-common '
- case ${linux25} in
- yes )
- KCPPFLAGS='-D__KERNEL__ -U__i386__ -Ui386 -DUM_FASTCALL -D__arch_um__ -DSUBARCH="i386" -DNESTING=0 -D_LARGEFILE64_SOURCE -Derrno=kernel_errno -DPATCHLEVEL=4 -DMODULE -I$(LINUX)/arch/um/include -I$(LINUX)/arch/um/kernel/tt/include -I$(LINUX)/arch/um/kernel/skas/include -O2 -nostdinc -iwithprefix include'
- ;;
- * )
- KCPPFLAGS='-D__KERNEL__ -U__i386__ -Ui386 -DUM_FASTCALL -D__arch_um__ -DSUBARCH="i386" -DNESTING=0 -D_LARGEFILE64_SOURCE -Derrno=kernel_errno -DPATCHLEVEL=4 -DMODULE -I$(LINUX)/arch/um/kernel/tt/include -I$(LINUX)/arch/um/include '
- ;;
- esac
-
- MOD_LINK=elf_i386
-;;
- i*86 )
- AC_MSG_RESULT($host_cpu)
- KCFLAGS='-g -O2 -Wall -Wstrict-prototypes -pipe'
- case ${linux25} in
- yes )
- KCPPFLAGS='-D__KERNEL__ -DMODULE -march=i686 -I$(LINUX)/include/asm-i386/mach-default -nostdinc -iwithprefix include '
- ;;
- * )
- KCPPFLAGS='-D__KERNEL__ -DMODULE '
- ;;
- esac
- MOD_LINK=elf_i386
-;;
-
- alphaev6 )
- AC_MSG_RESULT($host_cpu)
- KCFLAGS='-g -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mno-fp-regs -ffixed-8 -mcpu=ev5 -Wa,-mev6'
- KCPPFLAGS='-D__KERNEL__ -DMODULE '
- MOD_LINK=elf64alpha
-;;
-
- alphaev67 )
- AC_MSG_RESULT($host_cpu)
- KCFLAGS='-g -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mno-fp-regs -ffixed-8 -mcpu=ev5 -Wa,-mev6'
- KCPPFLAGS='-D__KERNEL__ -DMODULE '
- MOD_LINK=elf64alpha
-;;
-
- alpha* )
- AC_MSG_RESULT($host_cpu)
- KCFLAGS='-g -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mno-fp-regs -ffixed-8 -mcpu=ev5 -Wa,-mev5'
- KCPPFLAGS='-D__KERNEL__ -DMODULE '
- MOD_LINK=elf64alpha
-;;
-
- ia64 )
- AC_MSG_RESULT($host_cpu)
- KCFLAGS='-g -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -pipe -ffixed-r13 -mfixed-range=f10-f15,f32-f127 -falign-functions=32 -mb-step'
- KCPPFLAGS='-D__KERNEL__ -DMODULE'
- MOD_LINK=elf64_ia64
-;;
-
- x86_64 )
- AC_MSG_RESULT($host_cpu)
- KCFLAGS='-g -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fomit-frame-pointer -mno-red-zone -mcmodel=kernel -pipe -fno-reorder-blocks -finline-limit=2000 -fno-strength-reduce -fno-asynchronous-unwind-tables'
- KCPPFLAGS='-D__KERNEL__ -DMODULE'
- MOD_LINK=elf_x86_64
-;;
-
- sparc64 )
- AC_MSG_RESULT($host_cpu)
- KCFLAGS='-O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fomit-frame-pointer -fno-strict-aliasing -fno-common -Wno-unused -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow -ffixed-g4 -fcall-used-g5 -fcall-used-g7 -Wno-sign-compare -Wa,--undeclared-regs'
- KCPPFLAGS='-D__KERNEL__'
- MOD_LINK=elf64_sparc
-
-;;
-
- powerpc )
- AC_MSG_RESULT($host_cpu)
- KCFLAGS='-O2 -g -Wall -Wstrict-prototypes -Wno-trigraphs -fomit-frame-pointer -fno-strict-aliasing -fno-common -D__powerpc__ -fsigned-char -msoft-float -pipe -ffixed-r2 -Wno-uninitialized -mmultiple -mstring'
- KCPPFLAGS='-D__KERNEL__ -DMODULE'
- MOD_LINK=elf32ppclinux
-;;
-
- *)
- AC_ERROR("Unknown Linux Platform: $host_cpu")
-;;
-esac
-
-# ----------- make dep run? ------------------
-
-if test $host_cpu != "lib" ; then
- AC_MSG_CHECKING(if make dep has been run in kernel source (host $host_cpu) )
- if test -f $LINUX/include/linux/config.h ; then
- AC_MSG_RESULT(yes)
- else
- AC_MSG_ERROR(** cannot find $LINUX/include/linux/config.h. Run make dep in $LINUX.)
- fi
+CPPFLAGS="$CRAY_PORTALS_INCLUDE $CRAY_PORTALS_COMMANDLINE -I\$(top_srcdir)/include -I\$(top_srcdir)/portals/include"
+
+# liblustre are all the same
+LLCPPFLAGS="-D__arch_lib__ -D_LARGEFILE64_SOURCE=1"
+AC_SUBST(LLCPPFLAGS)
+
+LLCFLAGS="-g -Wall -fPIC"
+AC_SUBST(LLCFLAGS)
+
+# everyone builds against portals and lustre
+
+if test x$enable_ldiskfs = xyes ; then
+ AC_DEFINE(CONFIG_LDISKFS_FS_MODULE, 1, [build ldiskfs as a module])
+ AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [enable extended attributes for ldiskfs])
+ AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [enable posix acls])
+ AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [enable fs security])
fi
+EXTRA_KCFLAGS="-g $CRAY_PORTALS_INCLUDE $CRAY_PORTALS_COMMANDLINE -I$PWD/portals/include -I$PWD/include"
+
+# these are like AC_TRY_COMPILE, but try to build modules against the
+# kernel, inside the kernel-tests directory
+
+AC_DEFUN([LUSTRE_MODULE_CONFTEST],
+[cat >conftest.c <<_ACEOF
+$1
+_ACEOF
+])
+
+AC_DEFUN([LUSTRE_MODULE_COMPILE_IFELSE],
+[m4_ifvaln([$1], [LUSTRE_MODULE_CONFTEST([$1])])dnl
+rm -f kernel-tests/conftest.o kernel-tests/conftest.mod.c kernel-tests/conftest.ko
+AS_IF([AC_TRY_COMMAND(cp conftest.c kernel-tests && make [$2] -f $PWD/kernel-tests/Makefile LUSTRE_LINUX_CONFIG=$LINUX_CONFIG -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX EXTRA_CFLAGS="$EXTRA_KCFLAGS" $ARCH_UM SUBDIRS=$PWD/kernel-tests) >/dev/null && AC_TRY_COMMAND([$3])],
+ [$4],
+ [_AC_MSG_LOG_CONFTEST
+m4_ifvaln([$5],[$5])dnl])dnl
+rm -f kernel-tests/conftest.o kernel-tests/conftest.mod.c kernel-tests/conftest.mod.o kernel-tests/conftest.ko m4_ifval([$1], [kernel-tests/conftest.c conftest.c])[]dnl
+])
+
+AC_DEFUN([LUSTRE_MODULE_TRY_COMPILE],
+[LUSTRE_MODULE_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[$1]], [[$2]])],
+ [modules],
+ [test -s kernel-tests/conftest.o],
+ [$3], [$4])])
+
+AC_DEFUN([LUSTRE_MODULE_TRY_MAKE],
+[LUSTRE_MODULE_COMPILE_IFELSE([AC_LANG_PROGRAM([[$1]], [[$2]])], [$3], [$4], [$5], [$6])])
+
# ------------ include paths ------------------
-KINCFLAGS="$CRAY_PORTALS_INCLUDE $CRAY_PORTALS_COMMANDLINE \
- -I\$(top_srcdir)/include \
- -I\$(top_srcdir)/portals/include"
-if test $host_cpu != "lib" ; then
- KINCFLAGS="$KINCFLAGS -I$LINUX/include -I$LINUX/include"
-fi
-CPPFLAGS="$KINCFLAGS $ARCHCPPFLAGS"
-
-if test $host_cpu != "lib" ; then
-# ------------ autoconf.h ------------------
- AC_MSG_CHECKING(if autoconf.h is in kernel source)
- if test -f $LINUX/include/linux/autoconf.h ; then
- AC_MSG_RESULT(yes)
- else
- AC_MSG_ERROR(** cannot find $LINUX/include/linux/autoconf.h. Run make config in $LINUX.)
- fi
-
-# ------------ LINUXRELEASE and moduledir ------------------
- AC_MSG_CHECKING(for Linux release)
-
- dnl We need to rid ourselves of the nasty [ ] quotes.
- changequote(, )
- dnl Get release from version.h
- LINUXRELEASE="`sed -ne 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_-]*\).*/\1/p' $LINUX/include/linux/version.h`"
- changequote([, ])
-
- moduledir='$(libdir)/modules/'$LINUXRELEASE/kernel
- AC_SUBST(moduledir)
-
- modulefsdir='$(moduledir)/fs/$(PACKAGE)'
- AC_SUBST(modulefsdir)
-
- AC_MSG_RESULT($LINUXRELEASE)
- AC_SUBST(LINUXRELEASE)
-
-# ------------ RELEASE --------------------------------
- AC_MSG_CHECKING(lustre release)
-
- dnl We need to rid ourselves of the nasty [ ] quotes.
- changequote(, )
- dnl Get release from version.h
- RELEASE="`sed -ne 's/-/_/g' -e 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_]*\).*/\1/p' $LINUX/include/linux/version.h`_`date +%Y%m%d%H%M`"
- changequote([, ])
-
- AC_MSG_RESULT($RELEASE)
- AC_SUBST(RELEASE)
-
-# ---------- modversions? --------------------
- AC_MSG_CHECKING(for MODVERSIONS)
- if egrep -e 'MODVERSIONS.*1' $LINUX/include/linux/autoconf.h >/dev/null 2>&1;
- then
- if test $linux25 != "yes"; then
- MFLAGS="-DMODULE -DMODVERSIONS -include $LINUX/include/linux/modversions.h -DEXPORT_SYMTAB"
- AC_MSG_RESULT(yes)
- fi
- fi
+if test x$enable_modules != xno ; then
+ # ------------ .config exists ----------------
+ AC_CHECK_FILE([$LINUX_CONFIG],[],
+ [AC_MSG_ERROR([Kernel config could not be found. If you are building from a kernel-source rpm consult README.kernel-source])])
+
+ # ----------- make dep run? ------------------
+ AC_CHECK_FILES([$LINUX/include/linux/autoconf.h
+ $LINUX/include/linux/version.h
+ $LINUX/include/linux/config.h],[],
+ [AC_MSG_ERROR([Run make config in $LINUX.])])
+
+ # ------------ rhconfig.h includes runtime-generated bits --
+ # red hat kernel-source checks
+
+ # we know this exists after the check above. if the user
+ # tarred up the tree and ran make dep etc. in it, then
+ # version.h gets overwritten with a standard linux one.
+
+ if grep rhconfig $LINUX/include/linux/version.h >/dev/null ; then
+ # This is a clean kernel-source tree, we need to
+ # enable extensive workarounds to get this to build
+ # modules
+ AC_CHECK_FILE([$KERNEL_SOURCE_HEADER],
+ [if test $KERNEL_SOURCE_HEADER = '/boot/kernel.h' ; then
+ AC_MSG_WARN([Using /boot/kernel.h from RUNNING kernel.])
+ AC_MSG_WARN([If this is not what you want, use --with-kernel-source-header.])
+ AC_MSG_WARN([Consult README.kernel-source for details.])
+ fi],
+ [AC_MSG_ERROR([$KERNEL_SOURCE_HEADER not found. Consult README.kernel-source for details.])])
+ EXTRA_KCFLAGS="-include $KERNEL_SOURCE_HEADER $EXTRA_KCFLAGS"
+ fi
+
+ # --- check that we can build modules at all
+ AC_MSG_CHECKING([that modules can be built])
+ LUSTRE_MODULE_TRY_COMPILE([],[],
+ [
+ AC_MSG_RESULT([yes])
+ ],[
+ AC_MSG_RESULT([no])
+ AC_MSG_WARN([Consult config.log for details.])
+ AC_MSG_WARN([If you are trying to build with a kernel-source rpm, consult README.kernel-source])
+ AC_MSG_ERROR([Kernel modules could not be built.])
+ ])
+
+ # ------------ LINUXRELEASE and moduledir ------------------
+ AC_MSG_CHECKING([for Linux release])
+ rm -f kernel-tests/conftest.i
+ LINUXRELEASE=
+ if test $linux25 = 'yes' ; then
+ makerule="$PWD/kernel-tests"
+ else
+ makerule="_dir_$PWD/kernel-tests"
+ fi
+ LUSTRE_MODULE_TRY_MAKE(
+ [#include <linux/version.h>],
+ [LINUXRELEASE=UTS_RELEASE],
+ [$makerule LUSTRE_KERNEL_TEST=conftest.i],
+ [test -s kernel-tests/conftest.i],
+ [
+ # LINUXRELEASE="UTS_RELEASE"
+ eval $(grep LINUXRELEASE kernel-tests/conftest.i)
+ ],[
+ AC_MSG_RESULT([unknown])
+ AC_MSG_ERROR([Could not preprocess test program. Consult config.log for details.])
+ ])
+ rm -f kernel-tests/conftest.i
+ if test x$LINUXRELEASE = x ; then
+ AC_MSG_RESULT([unknown])
+ AC_MSG_ERROR([Could not determine Linux release version from linux/version.h.])
+ fi
+ AC_MSG_RESULT([$LINUXRELEASE])
+ AC_SUBST(LINUXRELEASE)
+
+ moduledir='$(libdir)/modules/'$LINUXRELEASE/kernel
+ AC_SUBST(moduledir)
+
+ modulefsdir='$(moduledir)/fs/$(PACKAGE)'
+ AC_SUBST(modulefsdir)
+
+ # ------------ RELEASE --------------------------------
+ AC_MSG_CHECKING([for Lustre release])
+ RELEASE="`echo ${LINUXRELEASE} | tr '-' '_'`_`date +%Y%m%d%H%M`"
+ AC_MSG_RESULT($RELEASE)
+ AC_SUBST(RELEASE)
fi
# ---------- Portals flags --------------------
#fi
#AC_SUBST(usrprefix)
-AC_MSG_CHECKING(if kernel has CPU affinity support)
-SET_CPUS_ALLOW="`grep -c set_cpus_allowed $LINUX/kernel/softirq.c`"
-if test "$SET_CPUS_ALLOW" != 0 ; then
- enable_affinity_temp="-DCPU_AFFINITY=1"
- AC_MSG_RESULT(yes)
+AC_MSG_CHECKING([for zero-copy TCP support])
+AC_ARG_ENABLE([zerocopy],
+ AC_HELP_STRING([--disable-zerocopy],
+ [disable socknal zerocopy]),
+ [],[enable_zerocopy='yes'])
+if test x$enable_zerocopy = xno ; then
+ AC_MSG_RESULT([no (by request)])
else
- enable_affinity_temp=""
- AC_MSG_RESULT(no)
+ ZCCD="`grep -c zccd $LINUX/include/linux/skbuff.h`"
+ if test "$ZCCD" != 0 ; then
+ AC_DEFINE(SOCKNAL_ZC, 1, [use zero-copy TCP])
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT([no (no kernel support)])
+ fi
fi
-AC_MSG_CHECKING(if kernel has zero-copy TCP support)
-ZCCD="`grep -c zccd $LINUX/include/linux/skbuff.h`"
-if test "$ZCCD" != 0 ; then
- enable_zerocopy_temp="-DSOCKNAL_ZC=1"
- AC_MSG_RESULT(yes)
+AC_MSG_CHECKING([for CPU affinity support])
+AC_ARG_ENABLE([affinity],
+ AC_HELP_STRING([--disable-affinity],
+ [disable process/irq affinity]),
+ [],[enable_affinity='yes'])
+if test x$enable_affinity = xno ; then
+ AC_MSG_RESULT([no (by request)])
else
- enable_zerocopy_temp=""
- AC_MSG_RESULT(no)
+ SET_CPUS_ALLOW="`grep -c set_cpus_allowed $LINUX/kernel/softirq.c`"
+ if test "$SET_CPUS_ALLOW" != 0 ; then
+ AC_DEFINE(CPU_AFFINITY, 1, [kernel has cpu affinity support])
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no (no kernel support)])
+ fi
fi
-AC_ARG_ENABLE(zerocopy, [ --disable-zerocopy disable socknal zerocopy],enable_zerocopy="", enable_zerocopy=$enable_zerocopy_temp)
-AC_ARG_ENABLE(affinity, [ --disable-affinity disable process/irq affinity],enable_affinity="", enable_affinity=$enable_affinity_temp)
#####################################
-AC_MSG_CHECKING(if quadrics kernel headers are present)
+AC_MSG_CHECKING([if quadrics kernel headers are present])
if test -d $LINUX/drivers/net/qsnet ; then
- AC_MSG_RESULT(yes)
- QSWNAL="qswnal"
- AC_MSG_CHECKING(for multirail EKC)
- if test -f $LINUX/include/elan/epcomms.h; then
- AC_MSG_RESULT(supported)
- with_quadrics="-DMULTIRAIL_EKC=1"
- else
- AC_MSG_RESULT(not supported)
- with_quadrics="-I$LINUX/drivers/net/qsnet/include"
- fi
- :
+ AC_MSG_RESULT([yes])
+ QSWNAL="qswnal"
+ AC_MSG_CHECKING([for multirail EKC])
+ if test -f $LINUX/include/elan/epcomms.h; then
+ AC_MSG_RESULT([supported])
+ QSWCPPFLAGS="-DMULTIRAIL_EKC=1"
+ else
+ AC_MSG_RESULT([not supported])
+ if test -d $LINUX/drivers/net/qsnet/include; then
+ QSWCPPFLAGS="-I$LINUX/drivers/net/qsnet/include"
+ else
+ QSWCPPFLAGS="-I$LINUX/include/linux"
+ fi
+ fi
else
- AC_MSG_RESULT(no)
- QSWNAL=""
- with_quadrics=""
- :
+ AC_MSG_RESULT([no])
+ QSWNAL=""
+ QSWCPPFLAGS=""
fi
-AC_SUBST(with_quadrics)
+AC_SUBST(QSWCPPFLAGS)
AC_SUBST(QSWNAL)
-
-# R. Read 5/02
-GMNAL=""
-echo "checking with-gm=" ${with_gm}
-if test "${with_gm+set}" = set; then
- if test "${with_gm}" = yes; then
- with_gm="-I/usr/local/gm/include"
- else
- with_gm="-I$with_gm/include -I$with_gm/drivers -I$with_gm/drivers/linux/gm"
- fi
- GMNAL="gmnal"
-else
-# default case - no GM
- with_gm=""
-fi
-AC_SUBST(with_gm)
+AM_CONDITIONAL(BUILD_QSWNAL, test x$QSWNAL = "xqswnal")
+
+AC_MSG_CHECKING([if gm support was requested])
+AC_ARG_WITH([gm],
+ AC_HELP_STRING([--with-gm=path],
+ [build gmnal against path]),
+ [
+ case $with_gm in
+ yes)
+ AC_MSG_RESULT([yes])
+ GMCPPFLAGS="-I/usr/local/gm/include"
+ GMNAL="gmnal"
+ ;;
+ no)
+ AC_MSG_RESULT([no])
+ GMCPPFLAGS=""
+ GMNAL=""
+ ;;
+ *)
+ AC_MSG_RESULT([yes])
+ GMCPPFLAGS="-I$with_gm/include -I$with_gm/drivers -I$with_gm/drivers/linux/gm"
+ GMNAL="gmnal"
+ ;;
+ esac
+ ],[
+ AC_MSG_RESULT([no])
+ GMCPPFLAGS=""
+ GMNAL=""
+ ])
+AC_SUBST(GMCPPFLAGS)
AC_SUBST(GMNAL)
-
+AM_CONDITIONAL(BUILD_GMNAL, test x$GMNAL = "xgmnal")
#fixme: where are the default IB includes?
default_ib_include_dir=/usr/local/ib/include
an_ib_include_file=vapi.h
-AC_ARG_WITH(ib, [ --with-ib=[yes/no/path] Path to IB includes], with_ib=$withval, with_ib=$default_ib)
-AC_MSG_CHECKING(if IB headers are present)
-if test "$with_ib" = yes; then
- with_ib=$default_ib_include_dir
-fi
-if test "$with_ib" != no -a -f ${with_ib}/${an_ib_include_file}; then
- AC_MSG_RESULT(yes)
- IBNAL="ibnal"
- with_ib="-I${with_ib}"
-else
- AC_MSG_RESULT(no)
- IBNAL=""
- with_ib=""
-fi
+AC_MSG_CHECKING([if ib nal support was requested])
+AC_ARG_WITH([ib],
+ AC_HELP_STRING([--with-ib=yes/no/path],
+ [Path to IB includes]),
+ [
+ case $with_ib in
+ yes)
+ AC_MSG_RESULT([yes])
+ IBCPPFLAGS="-I/usr/local/ib/include"
+ IBNAL="ibnal"
+ ;;
+ no)
+ AC_MSG_RESULT([no])
+ IBCPPFLAGS=""
+ IBNAL=""
+ ;;
+ *)
+ AC_MSG_RESULT([yes])
+ IBCPPFLAGS="-I$with_ib"
+ IBNAL=""
+ ;;
+ esac
+ ],[
+ AC_MSG_RESULT([no])
+ IBFLAGS=""
+ IBNAL=""
+ ])
AC_SUBST(IBNAL)
-AC_SUBST(with_ib)
-
+AC_SUBST(IBCPPFLAGS)
+AM_CONDITIONAL(BUILD_IBNAL, test x$IBNAL = "xibnal")
-def_scamac=/opt/scali/include
-AC_ARG_WITH(scamac, [ --with-scamac=[yes/no/path] Path to ScaMAC includes (default=/opt/scali/include)], with_scamac=$withval, with_scamac=$def_scamac)
-AC_MSG_CHECKING(if ScaMAC headers are present)
-if test "$with_scamac" = yes; then
- with_scamac=$def_scamac
-fi
-if test "$with_scamac" != no -a -f ${with_scamac}/scamac.h; then
- AC_MSG_RESULT(yes)
- SCIMACNAL="scimacnal"
- with_scamac="-I${with_scamac} -I${with_scamac}/icm"
-else
- AC_MSG_RESULT(no)
- SCIMACNAL=""
- with_scamac=""
-fi
-
-AC_SUBST(with_scamac)
-AC_SUBST(SCIMACNAL)
-
-CFLAGS="$KCFLAGS"
-CPPFLAGS="$KINCFLAGS $KCPPFLAGS $MFLAGS $enable_zerocopy $enable_affinity $with_quadrics $with_gm $with_scamac $with_ib"
-
-AM_CONDITIONAL(LIBLUSTRE, test x$host_cpu = xlib)
AC_SUBST(MOD_LINK)
AC_SUBST(LINUX25)
-AM_CONDITIONAL(LIBLUSTRE, test x$host_cpu = xlib)
# ---------- Red Hat 2.4.18 has iobuf->dovary --------------
# But other kernels don't
AC_MSG_CHECKING([if struct kiobuf has a dovary field])
-AC_TRY_COMPILE([#define __KERNEL__
- #include <linux/iobuf.h>],
- [struct kiobuf iobuf;
- iobuf.dovary = 1;],
- [AC_MSG_RESULT([yes])
- CPPFLAGS="$CPPFLAGS -DHAVE_KIOBUF_DOVARY"],
- [AC_MSG_RESULT([no])])
+LUSTRE_MODULE_TRY_COMPILE(
+ [
+ #include <linux/iobuf.h>
+ ],[
+ struct kiobuf iobuf;
+ iobuf.dovary = 1;
+ ],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_KIOBUF_DOVARY, 1, [struct kiobuf has a dovary field])
+ ],[
+ AC_MSG_RESULT([no])
+ ])
+
+# ----------- 2.6.4 no longer has page->list ---------------
+AC_MSG_CHECKING([if struct page has a list field])
+LUSTRE_MODULE_TRY_COMPILE(
+ [
+ #include <linux/mm.h>
+ ],[
+ struct page page;
+ &page.list;
+ ],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_PAGE_LIST, 1, [struct page has a list field])
+ ],[
+ AC_MSG_RESULT([no])
+ ])
# ---------- Red Hat 2.4.20 backports some 2.5 bits --------
# This needs to run after we've defined the KCPPFLAGS
-AC_MSG_CHECKING(for kernel version)
-AC_TRY_COMPILE([#define __KERNEL__
- #include <linux/sched.h>],
- [struct task_struct p;
- p.sighand = NULL;],
- [RH_2_4_20=1],
- [RH_2_4_20=0])
-
-if test $RH_2_4_20 = 1; then
- AC_MSG_RESULT(redhat-2.4.20)
- CPPFLAGS="$CPPFLAGS -DCONFIG_RH_2_4_20"
-else
- AC_MSG_RESULT($LINUXRELEASE)
-fi
+AC_MSG_CHECKING([for kernel version])
+LUSTRE_MODULE_TRY_COMPILE(
+ [
+ #include <linux/sched.h>
+ ],[
+ struct task_struct p;
+ p.sighand = NULL;
+ ],[
+ AC_DEFINE(CONFIG_RH_2_4_20, 1, [this kernel contains Red Hat 2.4.20 patches])
+ AC_MSG_RESULT([redhat-2.4.20])
+ ],[
+ AC_MSG_RESULT([$LINUXRELEASE])
+ ])
# ---------- Red Hat 2.4.21 backports some more 2.5 bits --------
-AC_MSG_CHECKING(if kernel defines PDE)
+AC_MSG_CHECKING([if kernel defines PDE])
HAVE_PDE="`grep -c 'proc_dir_entry..PDE' $LINUX/include/linux/proc_fs.h`"
if test "$HAVE_PDE" != 0 ; then
- CPPFLAGS="$CPPFLAGS -DHAVE_PDE"
- AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_PDE, 1, [the kernel defines PDE])
+ AC_MSG_RESULT([yes])
else
- AC_MSG_RESULT(no)
+ AC_MSG_RESULT([no])
fi
-AC_MSG_CHECKING(if kernel passes struct file to direct_IO)
+AC_MSG_CHECKING([if kernel passes struct file to direct_IO])
HAVE_DIO_FILE="`grep -c 'direct_IO.*struct file' $LINUX/include/linux/fs.h`"
if test "$HAVE_DIO_FILE" != 0 ; then
- CPPFLAGS="$CPPFLAGS -DHAVE_DIO_FILE"
- AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_DIO_FILE, 1, [the kernel passes struct file to direct_IO])
+ AC_MSG_RESULT(yes)
else
- AC_MSG_RESULT(no)
+ AC_MSG_RESULT(no)
+fi
+
+if test x$enable_modules != xno ; then
+ # ---------- modules? ------------------------
+ AC_MSG_CHECKING([for module support])
+ LUSTRE_MODULE_TRY_COMPILE(
+ [
+ #include <linux/config.h>
+ ],[
+ #ifndef CONFIG_MODULES
+ #error CONFIG_MODULES not #defined
+ #endif
+ ],[
+ AC_MSG_RESULT([yes])
+ ],[
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([module support is required to build Lustre kernel modules.])
+ ])
+
+ # ---------- modversions? --------------------
+ AC_MSG_CHECKING([for MODVERSIONS])
+ LUSTRE_MODULE_TRY_COMPILE(
+ [
+ #include <linux/config.h>
+ ],[
+ #ifndef CONFIG_MODVERSIONS
+ #error CONFIG_MODVERSIONS not #defined
+ #endif
+ ],[
+ AC_MSG_RESULT([yes])
+ ],[
+ AC_MSG_RESULT([no])
+ ])
+
+ # ------------ preempt -----------------------
+ AC_MSG_CHECKING([if preempt is enabled])
+ LUSTRE_MODULE_TRY_COMPILE(
+ [
+ #include <linux/config.h>
+ ],[
+ #ifndef CONFIG_PREEMPT
+ #error CONFIG_PREEMPT is not #defined
+ #endif
+ ],[
+ AC_MSG_RESULT([yes])
+ AC_MSG_ERROR([Lustre does not support kernels with preempt enabled.])
+ ],[
+ AC_MSG_RESULT([no])
+ ])
+
+ if test $BACKINGFS = 'ext3' ; then
+ # --- Check that ext3 and ext3 xattr are enabled in the kernel
+ AC_MSG_CHECKING([that ext3 is enabled in the kernel])
+ LUSTRE_MODULE_TRY_COMPILE(
+ [
+ #include <linux/config.h>
+ ],[
+ #ifndef CONFIG_EXT3_FS
+ #ifndef CONFIG_EXT3_FS_MODULE
+ #error CONFIG_EXT3_FS not #defined
+ #endif
+ #endif
+ ],[
+ AC_MSG_RESULT([yes])
+ ],[
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([Lustre requires that ext3 is enabled in the kernel (CONFIG_EXT3_FS)])
+ ])
+
+ AC_MSG_CHECKING([that extended attributes for ext3 are enabled in the kernel])
+ LUSTRE_MODULE_TRY_COMPILE(
+ [
+ #include <linux/config.h>
+ ],[
+ #ifndef CONFIG_EXT3_FS_XATTR
+ #error CONFIG_EXT3_FS_XATTR not #defined
+ #endif
+ ],[
+ AC_MSG_RESULT([yes])
+ ],[
+ AC_MSG_RESULT([no])
+ AC_MSG_WARN([Lustre requires that extended attributes for ext3 are enabled in the kernel (CONFIG_EXT3_FS_XATTR.)])
+ AC_MSG_WARN([This build may fail.])
+ ])
+ fi # BACKINGFS = ext3
fi
+
+CPPFLAGS="-include \$(top_builddir)/include/config.h $CPPFLAGS"
+EXTRA_KCFLAGS="-include $PWD/include/config.h $EXTRA_KCFLAGS"
+AC_SUBST(EXTRA_KCFLAGS)
+
+#echo "KCPPFLAGS: $KCPPFLAGS"
+#echo "KCFLAGS: $KCFLAGS"
+#echo "LLCPPFLAGS: $LLCPPFLAGS"
+#echo "LLCFLAGS: $LLCFLAGS"
+#echo "MOD_LINK: $MOD_LINK"
+#echo "CFLAGS: $CFLAGS"
+#echo "CPPFLAGS: $CPPFLAGS"
# This code is issued under the GNU General Public License.
# See the file COPYING in this distribution
-DIST_SUBDIRS= socknal qswnal gmnal scimacnal ibnal
-SUBDIRS= socknal @QSWNAL@ @GMNAL@ @SCIMACNAL@ @IBNAL@
+EXTRA_DIST = archdep.m4 build.m4 include
+
+SUBDIRS = portals libcfs knals unals router tests doc utils
# ---------- other tests and settings ---------
+AC_CHECK_TYPE([spinlock_t],
+ [AC_DEFINE(HAVE_SPINLOCK_T, 1, [spinlock_t is defined])],
+ [],
+ [#include <linux/spinlock.h>])
# --------- unsigned long long sane? -------
AC_SUBST(pkgexampledir)
pymoddir='${prefix}/usr/lib/${PACKAGE}/python/Lustre'
AC_SUBST(pymoddir)
+# for substitution in lconf
+PYMOD_DIR="/usr/lib/$PACKAGE/python"
+AC_SUBST(PYMOD_DIR)
modulenetdir='$(moduledir)/net/$(PACKAGE)'
AC_SUBST(modulenetdir)
# ---------- BAD gcc? ------------
AC_PROG_RANLIB
AC_PROG_CC
-AC_MSG_CHECKING(for buggy compiler)
+AC_MSG_CHECKING([for buggy compiler])
CC_VERSION=`$CC -v 2>&1 | grep "^gcc version"`
bad_cc() {
+ AC_MSG_RESULT([buggy compiler found!])
echo
echo " '$CC_VERSION'"
echo " has been known to generate bad code, "
echo " please get an updated compiler."
- AC_MSG_ERROR(sorry)
+ AC_MSG_ERROR([sorry])
}
TMP_VERSION=`echo $CC_VERSION | cut -c 1-16`
if test "$TMP_VERSION" = "gcc version 2.95"; then
bad_cc
;;
*)
- AC_MSG_RESULT(no known problems)
+ AC_MSG_RESULT([no known problems])
;;
esac
# end ------ BAD gcc? ------------
# this doesn't seem to work on older autoconf
# AC_CHECK_LIB(readline, readline,,)
-AC_ARG_ENABLE(readline, [ --enable-readline use readline library],,
- enable_readline="yes")
-
-if test "$enable_readline" = "yes" ; then
- LIBREADLINE="-lreadline -lncurses"
- HAVE_LIBREADLINE="-DHAVE_LIBREADLINE=1"
+AC_MSG_CHECKING([for readline support])
+AC_ARG_ENABLE(readline,
+ AC_HELP_STRING([--disable-readline],
+ [do not use readline library]),
+ [],[enable_readline='yes'])
+AC_MSG_RESULT([$enable_readline])
+if test x$enable_readline = xyes ; then
+ LIBREADLINE="-lreadline -lncurses"
+ AC_DEFINE(HAVE_LIBREADLINE, 1, [readline library is available])
else
- LIBREADLINE=""
- HAVE_LIBREADLINE=""
+ LIBREADLINE=""
fi
AC_SUBST(LIBREADLINE)
-AC_SUBST(HAVE_LIBREADLINE)
-AC_ARG_ENABLE(efence, [ --enable-efence use efence library],,
- enable_efence="no")
-
+AC_MSG_CHECKING([if efence debugging support is requested])
+AC_ARG_ENABLE(efence,
+ AC_HELP_STRING([--enable-efence],
+ [use efence library]),
+ [],[enable_efence='no'])
+AC_MSG_RESULT([$enable_efence])
if test "$enable_efence" = "yes" ; then
- LIBEFENCE="-lefence"
- HAVE_LIBEFENCE="-DHAVE_LIBEFENCE=1"
+ LIBEFENCE="-lefence"
+ AC_DEFINE(HAVE_LIBEFENCE, 1, [libefence support is requested])
else
- LIBEFENCE=""
- HAVE_LIBEFENCE=""
+ LIBEFENCE=""
fi
AC_SUBST(LIBEFENCE)
-AC_SUBST(HAVE_LIBEFENCE)
-
#define PORTAL_DEBUG
#ifndef offsetof
-# define offsetof(typ,memb) ((int)((char *)&(((typ *)0)->memb)))
+# define offsetof(typ,memb) ((unsigned long)((char *)&(((typ *)0)->memb)))
#endif
#define LOWEST_BIT_SET(x) ((x) & ~((x) - 1))
#endif
# include <unistd.h>
# include <time.h>
+# include <limits.h>
# include <asm/types.h>
# ifndef DEBUG_SUBSYSTEM
# define DEBUG_SUBSYSTEM S_UNDEFINED
# undef NDEBUG
# include <assert.h>
# define LASSERT(e) assert(e)
-# define LASSERTF(cond, args...) assert(cond)
+# define LASSERTF(cond, args...) \
+do { \
+ if (!(cond)) \
+ CERROR(args); \
+ assert(cond); \
+} while (0)
# else
# define LASSERT(e)
# define LASSERTF(cond, args...) do { } while (0)
# define printk(format, args...) printf (format, ## args)
# define PORTAL_ALLOC(ptr, size) do { (ptr) = malloc(size); } while (0);
# define PORTAL_FREE(a, b) do { free(a); } while (0);
+void portals_debug_dumplog(void);
# define portals_debug_msg(subsys, mask, file, fn, line, stack, format, a...) \
printf("%02x:%06x (@%lu %s:%s,l. %d %d %lu): " format, \
(subsys), (mask), (long)time(0), file, fn, line, \
* USER LEVEL STUFF BELOW
*/
-#define PORTALS_CFG_VERSION 0x00010001;
-
-struct portals_cfg {
- __u32 pcfg_version;
- __u32 pcfg_command;
-
- __u32 pcfg_nal;
- __u32 pcfg_flags;
-
- __u32 pcfg_gw_nal;
- __u64 pcfg_nid;
- __u64 pcfg_nid2;
- __u64 pcfg_nid3;
- __u32 pcfg_id;
- __u32 pcfg_misc;
- __u32 pcfg_fd;
- __u32 pcfg_count;
- __u32 pcfg_size;
- __u32 pcfg_wait;
-
- __u32 pcfg_plen1; /* buffers in userspace */
- char *pcfg_pbuf1;
- __u32 pcfg_plen2; /* buffers in userspace */
- char *pcfg_pbuf2;
-};
-
-#define PCFG_INIT(pcfg, cmd) \
-do { \
- memset(&pcfg, 0, sizeof(pcfg)); \
- pcfg.pcfg_version = PORTALS_CFG_VERSION; \
- pcfg.pcfg_command = (cmd); \
- \
-} while (0)
-
#define PORTAL_IOCTL_VERSION 0x00010007
#define PING_SYNC 0
#define PING_ASYNC 1
GMNAL = 3,
/* 4 unused */
TCPNAL = 5,
- SCIMACNAL = 6,
- ROUTER = 7,
- IBNAL = 8,
+ ROUTER = 6,
+ IBNAL = 7,
+ CRAY_KB_ERNAL = 8,
NAL_ENUM_END_MARKER
};
-#ifdef __KERNEL__
-extern ptl_handle_ni_t kqswnal_ni;
-extern ptl_handle_ni_t ksocknal_ni;
-extern ptl_handle_ni_t kgmnal_ni;
-extern ptl_handle_ni_t kibnal_ni;
-extern ptl_handle_ni_t kscimacnal_ni;
-#endif
-
-#define PTL_NALFMT_SIZE 16
+#define PTL_NALFMT_SIZE 26 /* %u:%u.%u.%u.%u (10+4+4+4+3+1) */
#define NAL_MAX_NR (NAL_ENUM_END_MARKER - 1)
DEBUG_DAEMON_CONTINUE = 4,
};
-/* module.c */
-typedef int (*nal_cmd_handler_t)(struct portals_cfg *, void * private);
-int kportal_nal_register(int nal, nal_cmd_handler_t handler, void * private);
-int kportal_nal_unregister(int nal);
enum cfg_record_type {
PORTALS_CFG_TYPE = 1,
};
typedef int (*cfg_record_cb_t)(enum cfg_record_type, int len, void *data);
-int kportal_nal_cmd(struct portals_cfg *);
-
-ptl_handle_ni_t *kportal_get_ni (int nal);
-void kportal_put_ni (int nal);
#ifdef __CYGWIN__
# ifndef BITS_PER_LONG
# endif
#endif
+#if BITS_PER_LONG > 32
+# define LI_POISON ((int)0x5a5a5a5a5a5a5a5a)
+# define LL_POISON ((long)0x5a5a5a5a5a5a5a5a)
+# define LP_POISON ((void *)(long)0x5a5a5a5a5a5a5a5a)
+#else
+# define LI_POISON ((int)0x5a5a5a5a)
+# define LL_POISON ((long)0x5a5a5a5a)
+# define LP_POISON ((void *)(long)0x5a5a5a5a)
+#endif
+
#if defined(__x86_64__)
# define LPU64 "%Lu"
# define LPD64 "%Ld"
void *kpr_arg;
} kpr_router_t;
-/* Router's control interface (Kernel Portals Routing Control Interface) */
-typedef const struct {
- int (*kprci_add_route)(int gateway_nal, ptl_nid_t gateway_nid,
- ptl_nid_t lo_nid, ptl_nid_t hi_nid);
- int (*kprci_del_route)(int gateway_nal, ptl_nid_t gateway_nid,
- ptl_nid_t lo_nid, ptl_nid_t hi_nid);
- int (*kprci_get_route)(int index, int *gateway_nal,
- ptl_nid_t *gateway,
- ptl_nid_t *lo_nid, ptl_nid_t *hi_nid,
- int *alive);
- int (*kprci_notify)(int gateway_nal, ptl_nid_t gateway_nid,
- int alive, time_t when);
-} kpr_control_interface_t;
-
-extern kpr_control_interface_t kpr_control_interface;
extern kpr_router_interface_t kpr_router_interface;
static inline int
#define PORTAL_DEBUG
+/* I think this beast is just trying to get cycles_t and get_cycles().
+ * this should be in its own header. */
+#ifdef __linux__
+# include <asm/types.h>
+# if defined(__powerpc__) && !defined(__KERNEL__)
+# define __KERNEL__
+# include <asm/timex.h>
+# undef __KERNEL__
+# else
+# if defined(__KERNEL__)
+# include <asm/timex.h>
+# else
+# include <sys/time.h>
+# define cycles_t unsigned long
+static inline cycles_t get_cycles(void)
+{
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ return (tv.tv_sec * 100000) + tv.tv_usec;
+}
+# endif
+# endif
+#else
+# include <sys/types.h>
+typedef u_int32_t __u32;
+typedef u_int64_t __u64;
+#endif
+
+#ifdef __KERNEL__
+# include <linux/time.h>
+#else
+# include <sys/time.h>
+# define do_gettimeofday(tv) gettimeofday(tv, NULL);
+#endif
+
#ifndef offsetof
-# define offsetof(typ,memb) ((int)((char *)&(((typ *)0)->memb)))
+# define offsetof(typ,memb) ((unsigned long)((char *)&(((typ *)0)->memb)))
#endif
#define LOWEST_BIT_SET(x) ((x) & ~((x) - 1))
#define S_COBD 0x00200000
#define S_IBNAL 0x00400000
#define S_LMV 0x00800000
-
+#define S_SM 0x01000000
+#define S_CMOBD 0x02000000
/* If you change these values, please keep portals/utils/debug.c
* up to date! */
#define EXIT do { } while (0)
#endif
+#define PORTALS_CFG_VERSION 0x00010001;
+
+struct portals_cfg {
+ __u32 pcfg_version;
+ __u32 pcfg_command;
+
+ __u32 pcfg_nal;
+ __u32 pcfg_flags;
+
+ __u32 pcfg_gw_nal;
+ __u64 pcfg_nid;
+ __u64 pcfg_nid2;
+ __u64 pcfg_nid3;
+ __u32 pcfg_id;
+ __u32 pcfg_misc;
+ __u32 pcfg_fd;
+ __u32 pcfg_count;
+ __u32 pcfg_size;
+ __u32 pcfg_wait;
+
+ __u32 pcfg_plen1; /* buffers in userspace */
+ char *pcfg_pbuf1;
+ __u32 pcfg_plen2; /* buffers in userspace */
+ char *pcfg_pbuf2;
+};
+
+#define PCFG_INIT(pcfg, cmd) \
+do { \
+ memset(&pcfg, 0, sizeof(pcfg)); \
+ pcfg.pcfg_version = PORTALS_CFG_VERSION; \
+ pcfg.pcfg_command = (cmd); \
+ \
+} while (0)
+
+typedef int (nal_cmd_handler_fn)(struct portals_cfg *, void *);
+int libcfs_nal_cmd_register(int nal, nal_cmd_handler_fn *handler, void *arg);
+int libcfs_nal_cmd(struct portals_cfg *pcfg);
+void libcfs_nal_cmd_unregister(int nal);
+
struct portal_ioctl_data {
__u32 ioc_len;
__u32 ioc_version;
char ioc_bulk[0];
};
+
#ifdef __KERNEL__
#include <linux/list.h>
# define RECALC_SIGPENDING recalc_sigpending()
# define CURRENT_SECONDS CURRENT_TIME
+# define kernel_text_address(addr) is_kernel_text_address(addr)
+extern int is_kernel_text_address(unsigned long addr);
+
#else /* 2.4.x */
# define SIGNAL_MASK_LOCK(task, flags) \
# define RECALC_SIGPENDING recalc_sigpending(current)
# define CURRENT_SECONDS CURRENT_TIME
+# define kernel_text_address(addr) is_kernel_text_address(addr)
+extern int is_kernel_text_address(unsigned long addr);
+
#endif
#if defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20))
-# define THREAD_NAME(comm, fmt, a...) \
- sprintf(comm, fmt "|%d", ## a, current->thread.extern_pid)
+# define THREAD_NAME(comm, len, fmt, a...) \
+ snprintf(comm, len, fmt "|%d", ## a, current->thread.extern_pid)
#elif defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-# define THREAD_NAME(comm, fmt, a...) \
- sprintf(comm, fmt "|%d", ## a, current->thread.mode.tt.extern_pid)
+# define THREAD_NAME(comm, len, fmt, a...) \
+ snprintf(comm, len,fmt"|%d", ## a,current->thread.mode.tt.extern_pid)
+#else
+# define THREAD_NAME(comm, len, fmt, a...) \
+ snprintf(comm, len, fmt, ## a)
+#endif
+
+#ifdef HAVE_PAGE_LIST
+/* 2.4 alloc_page users can use page->list */
+#define PAGE_LIST_ENTRY list
+#define PAGE_LIST(page) ((page)->list)
#else
-# define THREAD_NAME(comm, fmt, a...) \
- sprintf(comm, fmt, ## a)
+/* 2.6 alloc_page users can use page->lru */
+#define PAGE_LIST_ENTRY lru
+#define PAGE_LIST(page) ((page)->lru)
#endif
#endif /* _PORTALS_COMPAT_H */
+++ /dev/null
-# Copyright (C) 2001 Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-SUBDIRS = base
-include $(top_srcdir)/Rules
-
-pkginclude_HEADERS=api-support.h api.h arg-blocks.h defines.h errno.h internal.h lib-dispatch.h lib-nal.h lib-p30.h lib-types.h myrnal.h nal.h p30.h ppid.h ptlctl.h stringtab.h types.h nalids.h list.h bridge.h ipmap.h procbridge.h lltrace.h
-
-# define DEBUG_SUBSYSTEM S_PORTALS
-# define PORTAL_DEBUG
#include "build_check.h"
int PtlInit(int *);
void PtlFini(void);
-int PtlNIInit(ptl_interface_t interface, ptl_pt_index_t ptl_size_in,
- ptl_ac_index_t acl_size_in, ptl_pid_t requested_pid,
- ptl_handle_ni_t * interface_out);
+int PtlNIInit(ptl_interface_t interface, ptl_pid_t requested_pid,
+ ptl_ni_limits_t *desired_limits, ptl_ni_limits_t *actual_limits,
+ ptl_handle_ni_t *interface_out);
int PtlNIInitialized(ptl_interface_t);
#endif
-/*
- * PtlNIDebug:
- *
- * This is not an official Portals 3 API call. It is provided
- * by the reference implementation to allow the maintainers an
- * easy way to turn on and off debugging information in the
- * library. Do not use it in code that is not intended for use
- * with any version other than the portable reference library.
- */
-unsigned int PtlNIDebug(ptl_handle_ni_t ni, unsigned int mask_in);
-
/*
* PtlNIFailNid
*
/* These should be called by users */
int PtlEQAlloc(ptl_handle_ni_t ni_in, ptl_size_t count_in,
- int (*callback) (ptl_event_t * event),
- ptl_handle_eq_t * handle_out);
+ ptl_eq_handler_t handler,
+ ptl_handle_eq_t *handle_out);
int PtlEQFree(ptl_handle_eq_t eventq_in);
int PtlEQCount(ptl_handle_eq_t eventq_in, ptl_size_t * count_out);
#define PTL_GETID 1
#define PTL_NISTATUS 2
#define PTL_NIDIST 3
-#define PTL_NIDEBUG 4
+// #define PTL_NIDEBUG 4
#define PTL_MEATTACH 5
#define PTL_MEINSERT 6
// #define PTL_MEPREPEND 7
ptl_size_t count_in;
void *base_in;
int len_in;
- int (*callback_in) (ptl_event_t * event);
+ ptl_eq_handler_t callback_in;
} PtlEQAlloc_in;
typedef struct PtlEQAlloc_out {
PTL_MD_NO_UPDATE = 18,
PTL_FAIL = 19,
- PTL_IOV_TOO_MANY = 20,
- PTL_IOV_TOO_SMALL = 21,
+ PTL_IOV_INVALID = 20,
- PTL_EQ_IN_USE = 22,
+ PTL_EQ_IN_USE = 21,
- PTL_MAX_ERRNO = 23
+ PTL_MAX_ERRNO = 22
} ptl_err_t;
/* If you change these, you must update the string table in api-errno.c */
#include <portals/p30.h>
-extern int ptl_init; /* Has the library be initialized */
+extern int ptl_init; /* Has the library been initialized */
extern int ptl_ni_init(void);
-extern int ptl_me_init(void);
-extern int ptl_md_init(void);
-extern int ptl_eq_init(void);
-
-extern int ptl_me_ni_init(nal_t * nal);
-extern int ptl_md_ni_init(nal_t * nal);
-extern int ptl_eq_ni_init(nal_t * nal);
-
extern void ptl_ni_fini(void);
-extern void ptl_me_fini(void);
-extern void ptl_md_fini(void);
-extern void ptl_eq_fini(void);
-
-extern void ptl_me_ni_fini(nal_t * nal);
-extern void ptl_md_ni_fini(nal_t * nal);
-extern void ptl_eq_ni_fini(nal_t * nal);
static inline ptl_eq_t *
ptl_handle2usereq (ptl_handle_eq_t *handle)
extern int do_PtlGetId(nal_cb_t * nal, void *private, void *args, void *ret);
extern int do_PtlNIStatus(nal_cb_t * nal, void *private, void *args, void *ret);
extern int do_PtlNIDist(nal_cb_t * nal, void *private, void *args, void *ret);
-extern int do_PtlNIDebug(nal_cb_t * nal, void *private, void *args, void *ret);
extern int do_PtlMEAttach(nal_cb_t * nal, void *private, void *args, void *ret);
extern int do_PtlMEInsert(nal_cb_t * nal, void *private, void *args, void *ret);
extern int do_PtlMEPrepend(nal_cb_t * nal, void *private, void *args,
int niov;
if ((umd->options & PTL_MD_KIOV) != 0) {
- niov = umd->niov;
+ niov = umd->length;
size = offsetof(lib_md_t, md_iov.kiov[niov]);
} else {
niov = ((umd->options & PTL_MD_IOVEC) != 0) ?
- umd->niov : 1;
+ umd->length : 1;
size = offsetof(lib_md_t, md_iov.iov[niov]);
}
return (lh_entry (lh, lib_me_t, me_lh));
}
-extern int lib_init(nal_cb_t * cb, ptl_nid_t nid, ptl_pid_t pid, int gsize,
- ptl_pt_index_t tbl_size, ptl_ac_index_t ac_size);
+extern int lib_init(nal_cb_t *cb, ptl_process_id_t pid,
+ ptl_ni_limits_t *desired_limits,
+ ptl_ni_limits_t *actual_limits);
extern int lib_fini(nal_cb_t * cb);
extern void lib_dispatch(nal_cb_t * cb, void *private, int index,
void *arg_block, void *ret_block);
int niov;
if ((umd->options & PTL_MD_KIOV) != 0) {
- niov = umd->niov;
+ niov = umd->length;
size = offsetof(lib_md_t, md_iov.kiov[niov]);
} else {
niov = ((umd->options & PTL_MD_IOVEC) != 0) ?
- umd->niov : 1;
+ umd->length : 1;
size = offsetof(lib_md_t, md_iov.iov[niov]);
}
return (lh_entry (lh, lib_me_t, me_lh));
}
-extern int lib_init(nal_cb_t * cb, ptl_nid_t nid, ptl_pid_t pid, int gsize,
- ptl_pt_index_t tbl_size, ptl_ac_index_t ac_size);
+extern int lib_init(nal_cb_t *cb, ptl_process_id_t pid,
+ ptl_ni_limits_t *desired_limits,
+ ptl_ni_limits_t *actual_limits);
extern int lib_fini(nal_cb_t * cb);
extern void lib_dispatch(nal_cb_t * cb, void *private, int index,
void *arg_block, void *ret_block);
ptl_size_t size;
ptl_event_t *base;
int eq_refcount;
- int (*event_callback) (ptl_event_t * event);
+ ptl_eq_handler_t event_callback;
void *eq_addrkey;
};
* extracted by masking with (PTL_COOKIE_TYPES - 1) */
typedef struct {
- int up;
- int refcnt;
ptl_nid_t nid;
ptl_pid_t pid;
- int num_nodes;
- unsigned int debug;
lib_ptl_t tbl;
- lib_ac_t ac;
lib_counters_t counters;
+ ptl_ni_limits_t actual_limits;
int ni_lh_hash_size; /* size of lib handle hash table */
struct list_head *ni_lh_hash_table; /* all extant lib handles, this interface */
#endif
#include <portals/types.h>
-#include <portals/nal.h>
#include <portals/api.h>
-#include <portals/nalids.h>
-
-/*
- * Debugging flags reserved for the Portals reference library.
- * These are not part of the API as described in the SAND report
- * but are for the use of the maintainers of the reference implementation.
- *
- * It is not expected that the real implementations will export
- * this functionality.
- */
-#define PTL_DEBUG_NONE 0ul
-#define PTL_DEBUG_ALL (0x0FFFul) /* Only the Portals flags */
-
-#define __bit(x) ((unsigned long) 1<<(x))
-#define PTL_DEBUG_PUT __bit(0)
-#define PTL_DEBUG_GET __bit(1)
-#define PTL_DEBUG_REPLY __bit(2)
-#define PTL_DEBUG_ACK __bit(3)
-#define PTL_DEBUG_DROP __bit(4)
-#define PTL_DEBUG_REQUEST __bit(5)
-#define PTL_DEBUG_DELIVERY __bit(6)
-#define PTL_DEBUG_UNLINK __bit(7)
-#define PTL_DEBUG_THRESHOLD __bit(8)
-#define PTL_DEBUG_API __bit(9)
-
-/*
- * These eight are reserved for the NAL to define
- * It should probably give them better names...
- */
-#define PTL_DEBUG_NI_ALL (0xF000ul) /* Only the NAL flags */
-#define PTL_DEBUG_NI0 __bit(24)
-#define PTL_DEBUG_NI1 __bit(25)
-#define PTL_DEBUG_NI2 __bit(26)
-#define PTL_DEBUG_NI3 __bit(27)
-#define PTL_DEBUG_NI4 __bit(28)
-#define PTL_DEBUG_NI5 __bit(29)
-#define PTL_DEBUG_NI6 __bit(30)
-#define PTL_DEBUG_NI7 __bit(31)
#endif
#ifndef _PTLCTL_H_
#define _PTLCTL_H_
+#include <portals/types.h>
+#include <linux/kp30.h>
+#include <linux/libcfs.h>
+
#define PORTALS_DEV_ID 0
#define PORTALS_DEV_PATH "/dev/portals"
#define OBD_DEV_ID 1
int ptl_set_cfg_record_cb(cfg_record_cb_t cb);
/* l_ioctl.c */
-typedef int (ioc_handler_t)(int dev_id, int opc, void *buf);
+typedef int (ioc_handler_t)(int dev_id, unsigned int opc, void *buf);
void set_ioc_handler(ioc_handler_t *handler);
int register_ioc_dev(int dev_id, const char * dev_name);
void unregister_ioc_dev(int dev_id);
int set_ioctl_dump(char * file);
-int l_ioctl(int dev_id, int opc, void *buf);
-int parse_dump(char * dump_file, int (*ioc_func)(int dev_id, int opc, void *));
+int l_ioctl(int dev_id, unsigned int opc, void *buf);
+int parse_dump(char * dump_file, ioc_handler_t ioc_func);
int jt_ioc_dump(int argc, char **argv);
+extern char *dump_filename;
+int dump(int dev_id, unsigned int opc, void *buf);
#endif
typedef struct nal_t nal_t;
struct nal_t {
- ptl_ni_t ni;
- int refct;
- void *nal_data;
- int *timeout; /* for libp30api users */
- int (*forward) (nal_t * nal, int index, /* Function ID */
- void *args, size_t arg_len, void *ret, size_t ret_len);
+ int nal_refct;
+ void *nal_data;
- int (*shutdown) (nal_t * nal, int interface);
+ int (*startup) (nal_t *nal, ptl_pid_t requested_pid,
+ ptl_ni_limits_t *req, ptl_ni_limits_t *actual);
+
+ void (*shutdown) (nal_t *nal);
- int (*validate) (nal_t * nal, void *base, size_t extent);
+ int (*forward) (nal_t *nal, int index, /* Function ID */
+ void *args, size_t arg_len, void *ret, size_t ret_len);
- int (*yield) (nal_t * nal, unsigned long *flags, int milliseconds);
+ int (*yield) (nal_t *nal, unsigned long *flags, int milliseconds);
- void (*lock) (nal_t * nal, unsigned long *flags);
+ void (*lock) (nal_t *nal, unsigned long *flags);
- void (*unlock) (nal_t * nal, unsigned long *flags);
+ void (*unlock) (nal_t *nal, unsigned long *flags);
};
-typedef nal_t *(ptl_interface_t) (int, ptl_pt_index_t, ptl_ac_index_t, ptl_pid_t requested_pid);
-extern nal_t *PTL_IFACE_IP(int, ptl_pt_index_t, ptl_ac_index_t, ptl_pid_t requested_pid);
-extern nal_t *PTL_IFACE_MYR(int, ptl_pt_index_t, ptl_ac_index_t, ptl_pid_t requested_pid);
-
extern nal_t *ptl_hndl2nal(ptl_handle_any_t * any);
-#ifndef PTL_IFACE_DEFAULT
-#define PTL_IFACE_DEFAULT (PTL_IFACE_IP)
+#ifdef __KERNEL__
+extern int ptl_register_nal(ptl_interface_t interface, nal_t *nal);
+extern void ptl_unregister_nal(ptl_interface_t interface);
#endif
#endif
#include "build_check.h"
-#define PTL_IFACE_TCP 1
-#define PTL_IFACE_ER 2
-#define PTL_IFACE_SS 3
-#define PTL_IFACE_MAX 4
#endif
#include <portals/types.h>
-#include <portals/nal.h>
#include <portals/api.h>
-#include <portals/nalids.h>
-
-/*
- * Debugging flags reserved for the Portals reference library.
- * These are not part of the API as described in the SAND report
- * but are for the use of the maintainers of the reference implementation.
- *
- * It is not expected that the real implementations will export
- * this functionality.
- */
-#define PTL_DEBUG_NONE 0ul
-#define PTL_DEBUG_ALL (0x0FFFul) /* Only the Portals flags */
-
-#define __bit(x) ((unsigned long) 1<<(x))
-#define PTL_DEBUG_PUT __bit(0)
-#define PTL_DEBUG_GET __bit(1)
-#define PTL_DEBUG_REPLY __bit(2)
-#define PTL_DEBUG_ACK __bit(3)
-#define PTL_DEBUG_DROP __bit(4)
-#define PTL_DEBUG_REQUEST __bit(5)
-#define PTL_DEBUG_DELIVERY __bit(6)
-#define PTL_DEBUG_UNLINK __bit(7)
-#define PTL_DEBUG_THRESHOLD __bit(8)
-#define PTL_DEBUG_API __bit(9)
-
-/*
- * These eight are reserved for the NAL to define
- * It should probably give them better names...
- */
-#define PTL_DEBUG_NI_ALL (0xF000ul) /* Only the NAL flags */
-#define PTL_DEBUG_NI0 __bit(24)
-#define PTL_DEBUG_NI1 __bit(25)
-#define PTL_DEBUG_NI2 __bit(26)
-#define PTL_DEBUG_NI3 __bit(27)
-#define PTL_DEBUG_NI4 __bit(28)
-#define PTL_DEBUG_NI5 __bit(29)
-#define PTL_DEBUG_NI6 __bit(30)
-#define PTL_DEBUG_NI7 __bit(31)
#endif
#ifndef _PTLCTL_H_
#define _PTLCTL_H_
+#include <portals/types.h>
+#include <linux/kp30.h>
+#include <linux/libcfs.h>
+
#define PORTALS_DEV_ID 0
#define PORTALS_DEV_PATH "/dev/portals"
#define OBD_DEV_ID 1
int ptl_set_cfg_record_cb(cfg_record_cb_t cb);
/* l_ioctl.c */
-typedef int (ioc_handler_t)(int dev_id, int opc, void *buf);
+typedef int (ioc_handler_t)(int dev_id, unsigned int opc, void *buf);
void set_ioc_handler(ioc_handler_t *handler);
int register_ioc_dev(int dev_id, const char * dev_name);
void unregister_ioc_dev(int dev_id);
int set_ioctl_dump(char * file);
-int l_ioctl(int dev_id, int opc, void *buf);
-int parse_dump(char * dump_file, int (*ioc_func)(int dev_id, int opc, void *));
+int l_ioctl(int dev_id, unsigned int opc, void *buf);
+int parse_dump(char * dump_file, ioc_handler_t ioc_func);
int jt_ioc_dump(int argc, char **argv);
+extern char *dump_filename;
+int dump(int dev_id, unsigned int opc, void *buf);
#endif
#include "build_check.h"
-#ifdef __linux__
-# include <asm/types.h>
-# if defined(__powerpc__) && !defined(__KERNEL__)
-# define __KERNEL__
-# include <asm/timex.h>
-# undef __KERNEL__
-# else
-# include <asm/timex.h>
-# endif
-#else
-# include <sys/types.h>
-typedef u_int32_t __u32;
-typedef u_int64_t __u64;
-#endif
-
-#ifdef __KERNEL__
-# include <linux/time.h>
-#else
-# include <sys/time.h>
-# define do_gettimeofday(tv) gettimeofday(tv, NULL);
-#endif
-
+#include <linux/libcfs.h>
#include <portals/errno.h>
/* This implementation uses the same type for API function return codes and
typedef __u32 ptl_size_t;
#define PTL_TIME_FOREVER (-1)
-#define PTL_EQ_HANDLER_NONE NULL
typedef struct {
unsigned long nal_idx; /* which network interface */
} ptl_ins_pos_t;
typedef struct {
- struct page *kiov_page;
- unsigned int kiov_len;
- unsigned int kiov_offset;
-} ptl_kiov_t;
-
-typedef struct {
void *start;
ptl_size_t length;
int threshold;
unsigned int options;
void *user_ptr;
ptl_handle_eq_t eventq;
- unsigned int niov;
} ptl_md_t;
/* Options for the MD structure */
/* For compatibility with Cray Portals */
#define PTL_MD_LUSTRE_COMPLETION_SEMANTICS 0
+#define PTL_MD_PHYS 0
#define PTL_MD_THRESH_INF (-1)
+/* NB lustre portals uses struct iovec internally! */
+typedef struct iovec ptl_md_iovec_t;
+
+typedef struct {
+ struct page *kiov_page;
+ unsigned int kiov_len;
+ unsigned int kiov_offset;
+} ptl_kiov_t;
+
typedef enum {
PTL_EVENT_GET_START,
PTL_EVENT_GET_END,
PTL_NOACK_REQ
} ptl_ack_req_t;
+typedef void (*ptl_eq_handler_t)(ptl_event_t *event);
+#define PTL_EQ_HANDLER_NONE NULL
+
typedef struct {
volatile ptl_seq_t sequence;
ptl_size_t size;
} ptl_ni_t;
typedef struct {
- int max_match_entries; /* max number of match entries */
- int max_mem_descriptors; /* max number of memory descriptors */
- int max_event_queues; /* max number of event queues */
- int max_atable_index; /* maximum access control list table index */
- int max_ptable_index; /* maximum portals table index */
+ int max_mes;
+ int max_mds;
+ int max_eqs;
+ int max_ac_index;
+ int max_pt_index;
+ int max_md_iovecs;
+ int max_me_list;
+ int max_getput_md;
} ptl_ni_limits_t;
/*
typedef int ptl_sr_value_t;
+typedef int ptl_interface_t;
+#define PTL_IFACE_DEFAULT (-1)
+
#endif
Makefile
-Makefile.in
-.*.o.cmd
+autoMakefile
+autoMakefile.in
+.*.cmd
+.depend
--- /dev/null
+@BUILD_GMNAL_TRUE@subdir-m += gmnal
+@BUILD_IBNAL_TRUE@subdir-m += ibnal
+@BUILD_QSWNAL_TRUE@subdir-m += qswnal
+subdir-m += socknal
+
+@INCLUDE_RULES@
# This code is issued under the GNU General Public License.
# See the file COPYING in this distribution
-SUBDIRS = portals linux
-EXTRA_DIST = config.h.in
-include $(top_srcdir)/Rules
+SUBDIRS = gmnal ibnal qswnal socknal
.deps
Makefile
-Makefile.in
+autoMakefile.in
+autoMakefile
+*.ko
+*.mod.c
+.*.cmd
+.*.flags
+.tmp_versions
+.depend
+++ /dev/null
-# Copyright (C) 2001 Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-include ../../Rules.linux
-
-MODULE = kgmnal
-modulenet_DATA = kgmnal.o
-EXTRA_PROGRAMS = kgmnal
-
-DEFS = -DGM_KERNEL
-kgmnal_SOURCES = gmnal.h gmnal_api.c gmnal_cb.c gmnal_comm.c gmnal_utils.c gmnal_module.c
--- /dev/null
+MODULES := kgmnal
+kgmnal-objs := gmnal_api.o gmnal_cb.o gmnal_comm.o gmnal_utils.o gmnal_module.o
+
+EXTRA_PRE_CFLAGS := @GMCPPFLAGS@
+
+@INCLUDE_RULES@
--- /dev/null
+# Copyright (C) 2001 Cluster File Systems, Inc.
+#
+# This code is issued under the GNU General Public License.
+# See the file COPYING in this distribution
+
+if MODULES
+if BUILD_GMNAL
+if !CRAY_PORTALS
+modulenet_DATA = kgmnal$(KMODEXT)
+endif
+endif
+endif
+
+MOSTLYCLEANFILES = *.o *.ko *.mod.c
+DIST_SOURCES = $(kgmnal-objs:%.o=%.c) gmnal.h
#define NRXTHREADS 10 /* max number of receiver threads */
typedef struct _gmnal_data_t {
- int refcnt;
spinlock_t cb_lock;
spinlock_t stxd_lock;
struct semaphore stxd_token;
/*
* API NAL
*/
+int gmnal_api_startup(nal_t *, ptl_pid_t,
+ ptl_ni_limits_t *, ptl_ni_limits_t *);
+
int gmnal_api_forward(nal_t *, int, void *, size_t, void *, size_t);
-int gmnal_api_shutdown(nal_t *, int);
+void gmnal_api_shutdown(nal_t *);
int gmnal_api_validate(nal_t *, void *, size_t);
#define GMNAL_INIT_NAL(a) do { \
+ a->startup = gmnal_api_startup; \
a->forward = gmnal_api_forward; \
a->shutdown = gmnal_api_shutdown; \
- a->validate = NULL; \
a->yield = gmnal_api_yield; \
a->lock = gmnal_api_lock; \
a->unlock = gmnal_api_unlock; \
a->timeout = NULL; \
- a->refct = 1; \
a->nal_data = NULL; \
} while (0)
int gmnal_cb_dist(nal_cb_t *, ptl_nid_t, unsigned long *);
-nal_t *gmnal_init(int, ptl_pt_index_t, ptl_ac_index_t, ptl_pid_t rpid);
+int gmnal_init(void);
void gmnal_fini(void);
/*
* gmnal_api_shutdown
+ * nal_refct == 0 => called on last matching PtlNIFini()
* Close down this interface and free any resources associated with it
* nal_t nal our nal to shutdown
*/
-int
+void
gmnal_api_shutdown(nal_t *nal, int interface)
{
+ gmnal_data_t *nal_data;
+ nal_cb_t *nal_cb;
- gmnal_data_t *nal_data = nal->nal_data;
-
+ if (nal->nal_refct != 0)
+ return;
+
CDEBUG(D_TRACE, "gmnal_api_shutdown: nal_data [%p]\n", nal_data);
- return(PTL_OK);
+ LASSERT(nal == global_nal_data->nal);
+ nal_data = nal->nal_data;
+ LASSERT(nal_data == global_nal_data);
+ nal_cb = nal_data->nal_cb;
+
+ /* Stop portals calling our ioctl handler */
+ libcfs_nal_cmd_unregister(GMNAL);
+
+ /* XXX for shutdown "under fire" we probably need to set a shutdown
+ * flag so when lib calls us we fail immediately and dont queue any
+ * more work but our threads can still call into lib OK. THEN
+ * shutdown our threads, THEN lib_fini() */
+ lib_fini(nal_cb);
+
+ gmnal_stop_rxthread(nal_data);
+ gmnal_stop_ctthread(nal_data);
+ gmnal_free_txd(nal_data);
+ gmnal_free_srxd(nal_data);
+ GMNAL_GM_LOCK(nal_data);
+ gm_close(nal_data->gm_port);
+ gm_finalize();
+ GMNAL_GM_UNLOCK(nal_data);
+ if (nal_data->sysctl)
+ unregister_sysctl_table (nal_data->sysctl);
+ PORTAL_FREE(nal, sizeof(nal_t));
+ PORTAL_FREE(nal_data, sizeof(gmnal_data_t));
+ PORTAL_FREE(nal_cb, sizeof(nal_cb_t));
+
+ global_nal_data = NULL;
+ PORTAL_MODULE_UNUSE;
}
}
-nal_t *
-gmnal_init(int interface, ptl_pt_index_t ptl_size, ptl_ac_index_t ac_size,
- ptl_pid_t rpid)
+int
+gmnal_api_startup(nal_t *nal, ptl_pid_t requested_pid,
+ ptl_ni_limits_t *requested_limits,
+ ptl_ni_limits_t *actual_limits)
{
- nal_t *nal = NULL;
nal_cb_t *nal_cb = NULL;
gmnal_data_t *nal_data = NULL;
gmnal_srxd_t *srxd = NULL;
gm_status_t gm_status;
unsigned int local_nid = 0, global_nid = 0;
- ptl_nid_t portals_nid;
- ptl_pid_t portals_pid = 0;
+ ptl_process_id_t process_id;
+
+ if (nal->nal_refct != 0) {
+ if (actual_limits != NULL) {
+ nal_data = (gmnal_data_t *)nal->nal_data;
+ nal_cb = nal_data->nal_cb;
+ *actual_limits = nal->_cb->ni.actual_limits;
+ return (PTL_OK);
+ }
+ /* Called on first PtlNIInit() */
- CDEBUG(D_TRACE, "gmnal_init : interface [%d], ptl_size [%d], "
- "ac_size[%d]\n", interface, ptl_size, ac_size);
+ CDEBUG(D_TRACE, "startup\n");
+ LASSERT(global_nal_data == NULL);
PORTAL_ALLOC(nal_data, sizeof(gmnal_data_t));
if (!nal_data) {
CDEBUG(D_ERROR, "can't get memory\n");
- return(NULL);
+ return(PTL_NO_SPACE);
}
memset(nal_data, 0, sizeof(gmnal_data_t));
/*
* set the small message buffer size
*/
- nal_data->refcnt = 1;
CDEBUG(D_INFO, "Allocd and reset nal_data[%p]\n", nal_data);
CDEBUG(D_INFO, "small_msg_size is [%d]\n", nal_data->small_msg_size);
- PORTAL_ALLOC(nal, sizeof(nal_t));
- if (!nal) {
- PORTAL_FREE(nal_data, sizeof(gmnal_data_t));
- return(NULL);
- }
- memset(nal, 0, sizeof(nal_t));
- CDEBUG(D_INFO, "Allocd and reset nal[%p]\n", nal);
-
PORTAL_ALLOC(nal_cb, sizeof(nal_cb_t));
if (!nal_cb) {
- PORTAL_FREE(nal, sizeof(nal_t));
PORTAL_FREE(nal_data, sizeof(gmnal_data_t));
- return(NULL);
+ return(PTL_NO_SPACE);
}
memset(nal_cb, 0, sizeof(nal_cb_t));
CDEBUG(D_INFO, "Allocd and reset nal_cb[%p]\n", nal_cb);
- GMNAL_INIT_NAL(nal);
GMNAL_INIT_NAL_CB(nal_cb);
/*
* String them all together
CDEBUG(D_INFO, "Calling gm_init\n");
if (gm_init() != GM_SUCCESS) {
CDEBUG(D_ERROR, "call to gm_init failed\n");
- PORTAL_FREE(nal, sizeof(nal_t));
PORTAL_FREE(nal_data, sizeof(gmnal_data_t));
PORTAL_FREE(nal_cb, sizeof(nal_cb_t));
- return(NULL);
+ return(PTL_FAIL);
}
GMNAL_GM_LOCK(nal_data);
gm_finalize();
GMNAL_GM_UNLOCK(nal_data);
- PORTAL_FREE(nal, sizeof(nal_t));
PORTAL_FREE(nal_data, sizeof(gmnal_data_t));
PORTAL_FREE(nal_cb, sizeof(nal_cb_t));
- return(NULL);
+ return(PTL_FAIL);
}
gm_close(nal_data->gm_port);
gm_finalize();
GMNAL_GM_UNLOCK(nal_data);
- PORTAL_FREE(nal, sizeof(nal_t));
PORTAL_FREE(nal_data, sizeof(gmnal_data_t));
PORTAL_FREE(nal_cb, sizeof(nal_cb_t));
- return(NULL);
+ return(PTL_FAIL);
}
gm_close(nal_data->gm_port);
gm_finalize();
GMNAL_GM_UNLOCK(nal_data);
- PORTAL_FREE(nal, sizeof(nal_t));
PORTAL_FREE(nal_data, sizeof(gmnal_data_t));
PORTAL_FREE(nal_cb, sizeof(nal_cb_t));
- return(NULL);
+ return(PTL_FAIL);
}
gmnal_start_kernel_threads(nal_data);
gm_close(nal_data->gm_port);
gm_finalize();
GMNAL_GM_UNLOCK(nal_data);
- PORTAL_FREE(nal, sizeof(nal_t));
PORTAL_FREE(nal_data, sizeof(gmnal_data_t));
PORTAL_FREE(nal_cb, sizeof(nal_cb_t));
- return(NULL);
+ return(PTL_FAIL);
}
nal_data->gm_local_nid = local_nid;
CDEBUG(D_INFO, "Local node id is [%u]\n", local_nid);
gm_close(nal_data->gm_port);
gm_finalize();
GMNAL_GM_UNLOCK(nal_data);
- PORTAL_FREE(nal, sizeof(nal_t));
PORTAL_FREE(nal_data, sizeof(gmnal_data_t));
PORTAL_FREE(nal_cb, sizeof(nal_cb_t));
- return(NULL);
+ return(PTL_FAIL);
}
CDEBUG(D_INFO, "Global node id is [%u]\n", global_nid);
nal_data->gm_global_nid = global_nid;
/*
pid = gm_getpid();
*/
- CDEBUG(D_INFO, "portals_pid is [%u]\n", portals_pid);
- portals_nid = (unsigned long)global_nid;
- CDEBUG(D_INFO, "portals_nid is ["LPU64"]\n", portals_nid);
+ process_id.pid = 0;
+ process_id.nid = global_nid;
+
+ CDEBUG(D_INFO, "portals_pid is [%u]\n", process_id.pid);
+ CDEBUG(D_INFO, "portals_nid is ["LPU64"]\n", process_id.nid);
CDEBUG(D_PORTALS, "calling lib_init\n");
- if (lib_init(nal_cb, portals_nid, portals_pid, 1024, ptl_size,
- ac_size) != PTL_OK) {
+ if (lib_init(nal_cb, process_id,
+ requested_limits, actual_limits) != PTL_OK) {
CDEBUG(D_ERROR, "lib_init failed\n");
gmnal_stop_rxthread(nal_data);
gmnal_stop_ctthread(nal_data);
gm_close(nal_data->gm_port);
gm_finalize();
GMNAL_GM_UNLOCK(nal_data);
- PORTAL_FREE(nal, sizeof(nal_t));
PORTAL_FREE(nal_data, sizeof(gmnal_data_t));
PORTAL_FREE(nal_cb, sizeof(nal_cb_t));
- return(NULL);
+ return(PTL_FAIL);
}
+
+ if (libcfs_nal_cmd_register(GMNAL, &gmnal_cmd, nal->nal_data) != 0) {
+ CDEBUG(D_INFO, "libcfs_nal_cmd_register failed\n");
+
+ /* XXX these cleanup cases should be restructured to
+ * minimise duplication... */
+ lib_fini(nal_cb);
+
+ gmnal_stop_rxthread(nal_data);
+ gmnal_stop_ctthread(nal_data);
+ gmnal_free_txd(nal_data);
+ gmnal_free_srxd(nal_data);
+ GMNAL_GM_LOCK(nal_data);
+ gm_close(nal_data->gm_port);
+ gm_finalize();
+ GMNAL_GM_UNLOCK(nal_data);
+ PORTAL_FREE(nal_data, sizeof(gmnal_data_t));
+ PORTAL_FREE(nal_cb, sizeof(nal_cb_t));
+ return(PTL_FAIL);
+ }
+
+ /* might be better to initialise this at module load rather than in
+ * NAL startup */
nal_data->sysctl = NULL;
nal_data->sysctl = register_sysctl_table (gmnalnal_top_sysctl_table, 0);
CDEBUG(D_INFO, "gmnal_init finished\n");
global_nal_data = nal->nal_data;
- return(nal);
+
+ /* no unload now until shutdown */
+ PORTAL_MODULE_USE;
+
+ return(PTL_OK);
}
+nal_t the_gm_nal;
+
+/*
+ * Called when module loaded
+ */
+int gmnal_init(void)
+{
+ int rc;
+
+ memset(&the_gm_nal, 0, sizeof(nal_t));
+ CDEBUG(D_INFO, "reset nal[%p]\n", &the_gm_nal);
+ GMNAL_INIT_NAL(&the_gm_nal);
+ rc = ptl_register_nal(GMNAL, &the_gm_nal);
+ if (rc != PTL_OK)
+ CERROR("Can't register GMNAL: %d\n", rc);
+
+ return (rc);
+}
+
+
/*
* Called when module removed
CDEBUG(D_TRACE, "gmnal_fini\n");
- PtlNIFini(kgmnal_ni);
- lib_fini(nal_cb);
+ LASSERT(global_nal_data == NULL);
- gmnal_stop_rxthread(nal_data);
- gmnal_stop_ctthread(nal_data);
- gmnal_free_txd(nal_data);
- gmnal_free_srxd(nal_data);
- GMNAL_GM_LOCK(nal_data);
- gm_close(nal_data->gm_port);
- gm_finalize();
- GMNAL_GM_UNLOCK(nal_data);
- if (nal_data->sysctl)
- unregister_sysctl_table (nal_data->sysctl);
- PORTAL_FREE(nal, sizeof(nal_t));
- PORTAL_FREE(nal_data, sizeof(gmnal_data_t));
- PORTAL_FREE(nal_cb, sizeof(nal_cb_t));
+ ptl_unregister_nal(GMNAL);
}
int num_stxds = 5;
int gm_port = 4;
-ptl_handle_ni_t kgmnal_ni;
-
-
int
gmnal_cmd(struct portals_cfg *pcfg, void *private)
{
CDEBUG(D_INFO, "Calling gmnal_init\n");
- status = PtlNIInit(gmnal_init, 32, 4, 0, &kgmnal_ni);
+ statud = gmnal_init();
if (status == PTL_OK) {
- CDEBUG(D_INFO, "Portals GMNAL initialised ok kgmnal_ni\n");
+ CDEBUG(D_INFO, "Portals GMNAL initialised ok\n");
} else {
CDEBUG(D_INFO, "Portals GMNAL Failed to initialise\n");
- return(1);
+ return(-ENODEV);
}
- CDEBUG(D_INFO, "Calling kportal_nal_register\n");
- /*
- * global_nal_data is set by gmnal_init
- */
- if (kportal_nal_register(GMNAL, &gmnal_cmd, global_nal_data) != 0) {
- CDEBUG(D_INFO, "kportal_nal_register failed\n");
- return(1);
- }
-
- CDEBUG(D_INFO, "Calling PORTAL_SYMBOL_REGISTER\n");
- PORTAL_SYMBOL_REGISTER(kgmnal_ni);
CDEBUG(D_INFO, "This is the end of the gmnal init routine");
static void __exit
gmnal_unload(void)
{
-
- kportal_nal_unregister(GMNAL);
- PORTAL_SYMBOL_UNREGISTER(kgmnal_ni);
gmnal_fini();
- global_nal_data = NULL;
return;
}
module_exit(gmnal_unload);
-EXPORT_SYMBOL(kgmnal_ni);
-
MODULE_PARM(gmnal_small_msg_size, "i");
MODULE_PARM(num_rx_threads, "i");
MODULE_PARM(num_stxds, "i");
.deps
Makefile
-Makefile.in
+autoMakefile.in
+autoMakefile
+*.ko
+*.mod.c
+.*.flags
+.*.cmd
+.tmp_versions
+.depend
+++ /dev/null
-include ../../Rules.linux
-
-MODULE = kibnal
-modulenet_DATA = kibnal.o
-EXTRA_PROGRAMS = kibnal
-
-
-DEFS =
-CPPFLAGS=@CPPFLAGS@ @with_ib@
-kibnal_SOURCES = ibnal.h ibnal.c ibnal_cb.c
--- /dev/null
+MODULES := kibnal
+kibnal-objs := ibnal.o ibnal_cb.o
+
+EXTRA_PRE_CFLAGS := @IBCPPFLAGS@
+
+@INCLUDE_RULES@
--- /dev/null
+if MODULES
+if !CRAY_PORTALS
+if BUILD_IBNAL
+modulenet_DATA = kibnal$(KMODEXT)
+endif
+endif
+endif
+
+MOSTLYCLEANFILES = *.o *.ko *.mod.c
+DIST_SOURCES = $(kibnal-objs:%.o=%.c) ibnal.h
kibnal_data_t *nal_data = NULL;
int rc;
- unsigned int nnids = 1; // number of nids
- // do we know how many nodes are in this
- // system related to this kib_nid
- //
-
CDEBUG(D_NET, "kibnal_init:calling lib_init with nid 0x%u\n",
kibnal_data.kib_nid);
rc = lib_init(&kibnal_lib,
kibnal_data.kib_nid,
0, // process id is set as 0
- nnids,
ptl_size,
ac_size);
CDEBUG(D_PORTALS, "kibnal_initialize: Enter kibnal_initialize\n");
// set api functional pointers
+ kibnal_api.startup = kibnal_startup;
kibnal_api.forward = kibnal_forward;
kibnal_api.shutdown = kibnal_shutdown;
kibnal_api.yield = kibnal_yield;
- kibnal_api.validate = NULL; /* our api validate is a NOOP */
kibnal_api.lock = kibnal_lock;
kibnal_api.unlock = kibnal_unlock;
kibnal_api.nal_data = &kibnal_data; // this is so called private data
- kibnal_api.refct = 1;
- kibnal_api.timeout = NULL;
- kibnal_lib.nal_data = &kibnal_data;
memset(&kibnal_data, 0, sizeof(kibnal_data));
.deps
Makefile
-Makefile.in
+autoMakefile.in
+autoMakefile
+*.ko
+*.mod.c
+.*.flags
+.*.cmd
+.tmp_versions
+.depend
+++ /dev/null
-# Copyright (C) 2001 Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-include ../../Rules.linux
-
-MODULE = kqswnal
-modulenet_DATA = kqswnal.o
-EXTRA_PROGRAMS = kqswnal
-
-
-#CFLAGS:= @KCFLAGS@
-#CPPFLAGS:=@KCPPFLAGS@
-DEFS =
-CPPFLAGS=@CPPFLAGS@ @with_quadrics@
-kqswnal_SOURCES = qswnal.c qswnal_cb.c qswnal.h
--- /dev/null
+MODULES := kqswnal
+kqswnal-objs := qswnal.o qswnal_cb.o
+
+EXTRA_POST_CFLAGS := @QSWCPPFLAGS@ -I/usr/include
+
+@INCLUDE_RULES@
--- /dev/null
+# Copyright (C) 2001 Cluster File Systems, Inc.
+#
+# This code is issued under the GNU General Public License.
+# See the file COPYING in this distribution
+
+if MODULES
+if !CRAY_PORTALS
+if BUILD_QSWNAL
+modulenet_DATA = kqswnal$(KMODEXT)
+endif
+endif
+endif
+
+MOSTLYCLEANFILES = *.o *.ko *.mod.c
+DIST_SOURCES = $(kqswnal-objs:%.o=%.c) qswnal.h
#include "qswnal.h"
-ptl_handle_ni_t kqswnal_ni;
nal_t kqswnal_api;
kqswnal_data_t kqswnal_data;
+ptl_handle_ni_t kqswnal_ni;
+kqswnal_tunables_t kqswnal_tunables;
kpr_nal_interface_t kqswnal_router_interface = {
kprni_nalid: QSWNAL,
static ctl_table kqswnal_ctl_table[] = {
{QSWNAL_SYSCTL_OPTIMIZED_GETS, "optimized_gets",
- &kqswnal_data.kqn_optimized_gets, sizeof (int),
- 0644, NULL, &proc_dointvec},
- {QSWNAL_SYSCTL_COPY_SMALL_FWD, "copy_small_fwd",
- &kqswnal_data.kqn_copy_small_fwd, sizeof (int),
+ &kqswnal_tunables.kqn_optimized_gets, sizeof (int),
0644, NULL, &proc_dointvec},
{0}
};
}
static int
-kqswnal_shutdown(nal_t *nal, int ni)
-{
- CDEBUG (D_NET, "shutdown\n");
-
- LASSERT (nal == &kqswnal_api);
- return (0);
-}
-
-static int
kqswnal_yield(nal_t *nal, unsigned long *flags, int milliseconds)
{
/* NB called holding statelock */
CDEBUG (D_NET, "yield\n");
if (milliseconds == 0) {
- if (current->need_resched)
+ if (need_resched())
schedule();
return 0;
}
return (milliseconds);
}
-static nal_t *
-kqswnal_init(int interface, ptl_pt_index_t ptl_size, ptl_ac_index_t ac_size,
- ptl_pid_t requested_pid)
-{
- ptl_nid_t mynid = kqswnal_elanid2nid (kqswnal_data.kqn_elanid);
- int nnids = kqswnal_data.kqn_nnodes;
-
- CDEBUG(D_NET, "calling lib_init with nid "LPX64" of %d\n", mynid, nnids);
-
- lib_init(&kqswnal_lib, mynid, 0, nnids, ptl_size, ac_size);
-
- return (&kqswnal_api);
-}
-
int
kqswnal_get_tx_desc (struct portals_cfg *pcfg)
{
}
}
-void __exit
-kqswnal_finalise (void)
+static void
+kqswnal_shutdown(nal_t *nal)
{
+ unsigned long flags;
+ int do_lib_fini = 0;
+
+ /* NB The first ref was this module! */
+ if (nal->nal_refct != 0) {
+ PORTAL_MODULE_UNUSE;
+ return;
+ }
+
+ CDEBUG (D_NET, "shutdown\n");
+ LASSERT (nal == &kqswnal_api);
+
switch (kqswnal_data.kqn_init)
{
default:
LASSERT (0);
case KQN_INIT_ALL:
-#if CONFIG_SYSCTL
- if (kqswnal_data.kqn_sysctl != NULL)
- unregister_sysctl_table (kqswnal_data.kqn_sysctl);
-#endif
- PORTAL_SYMBOL_UNREGISTER (kqswnal_ni);
- kportal_nal_unregister(QSWNAL);
+ libcfs_nal_cmd_unregister(QSWNAL);
/* fall through */
- case KQN_INIT_PTL:
- PtlNIFini (kqswnal_ni);
- lib_fini (&kqswnal_lib);
+ case KQN_INIT_LIB:
+ do_lib_fini = 1;
/* fall through */
case KQN_INIT_DATA:
}
/**********************************************************************/
- /* Make router stop her calling me and fail any more call-ins */
+ /* Tell router we're shutting down. Any router calls my threads
+ * make will now fail immediately and the router will stop calling
+ * into me. */
kpr_shutdown (&kqswnal_data.kqn_router);
-
+
/**********************************************************************/
- /* flag threads we've started to terminate and wait for all to ack */
-
+ /* Signal the start of shutdown... */
+ spin_lock_irqsave(&kqswnal_data.kqn_idletxd_lock, flags);
kqswnal_data.kqn_shuttingdown = 1;
- wake_up_all (&kqswnal_data.kqn_sched_waitq);
+ spin_unlock_irqrestore(&kqswnal_data.kqn_idletxd_lock, flags);
+
+ wake_up_all(&kqswnal_data.kqn_idletxd_waitq);
- while (atomic_read (&kqswnal_data.kqn_nthreads_running) != 0) {
- CDEBUG(D_NET, "waiting for %d threads to start shutting down\n",
- atomic_read (&kqswnal_data.kqn_nthreads_running));
+ /**********************************************************************/
+ /* wait for sends that have allocated a tx desc to launch or give up */
+ while (atomic_read (&kqswnal_data.kqn_pending_txs) != 0) {
+ CDEBUG(D_NET, "waiting for %d pending sends\n",
+ atomic_read (&kqswnal_data.kqn_pending_txs));
set_current_state (TASK_UNINTERRUPTIBLE);
schedule_timeout (HZ);
}
/**********************************************************************/
/* close elan comms */
#if MULTIRAIL_EKC
+ /* Shut down receivers first; rx callbacks might try sending... */
if (kqswnal_data.kqn_eprx_small != NULL)
ep_free_rcvr (kqswnal_data.kqn_eprx_small);
if (kqswnal_data.kqn_eprx_large != NULL)
ep_free_rcvr (kqswnal_data.kqn_eprx_large);
+ /* NB ep_free_rcvr() returns only after we've freed off all receive
+ * buffers (see shutdown handling in kqswnal_requeue_rx()). This
+ * means we must have completed any messages we passed to
+ * lib_parse() or kpr_fwd_start(). */
+
if (kqswnal_data.kqn_eptx != NULL)
ep_free_xmtr (kqswnal_data.kqn_eptx);
- /* freeing the xmtr completes all txs pdq */
+ /* NB ep_free_xmtr() returns only after all outstanding transmits
+ * have called their callback... */
LASSERT(list_empty(&kqswnal_data.kqn_activetxds));
#else
+ /* "Old" EKC just pretends to shutdown cleanly but actually
+ * provides no guarantees */
if (kqswnal_data.kqn_eprx_small != NULL)
ep_remove_large_rcvr (kqswnal_data.kqn_eprx_small);
#endif
/**********************************************************************/