cMD_PRE_CMD_SMASH are the relevant tags.
The pre-smashing contents of HEAD will be committed by yury into b_cmd as a
merge of the two branches. These will be stabilized on b_cmd and eventually
landed onto HEAD.
+++ /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
+++ /dev/null
-%patch
-Index: linux-2.6.0/fs/ext3/ialloc.c
-===================================================================
---- linux-2.6.0.orig/fs/ext3/ialloc.c 2004-01-14 18:54:11.000000000 +0300
-+++ linux-2.6.0/fs/ext3/ialloc.c 2004-01-14 18:54:12.000000000 +0300
-@@ -627,6 +627,11 @@
- inode->i_generation = EXT3_SB(sb)->s_next_generation++;
-
- ei->i_state = EXT3_STATE_NEW;
-+ if (EXT3_INODE_SIZE(inode->i_sb) > EXT3_GOOD_OLD_INODE_SIZE) {
-+ ei->i_extra_isize = sizeof(__u16) /* i_extra_isize */
-+ + sizeof(__u16); /* i_pad1 */
-+ } else
-+ ei->i_extra_isize = 0;
-
- ret = inode;
- if(DQUOT_ALLOC_INODE(inode)) {
-Index: linux-2.6.0/fs/ext3/inode.c
-===================================================================
---- linux-2.6.0.orig/fs/ext3/inode.c 2004-01-14 18:54:12.000000000 +0300
-+++ linux-2.6.0/fs/ext3/inode.c 2004-01-14 19:09:46.000000000 +0300
-@@ -2339,7 +2339,7 @@
- * trying to determine the inode's location on-disk and no read need be
- * performed.
- */
--static int ext3_get_inode_loc(struct inode *inode,
-+int ext3_get_inode_loc(struct inode *inode,
- struct ext3_iloc *iloc, int in_mem)
- {
- unsigned long block;
-@@ -2547,6 +2547,11 @@
- ei->i_data[block] = raw_inode->i_block[block];
- INIT_LIST_HEAD(&ei->i_orphan);
-
-+ if (EXT3_INODE_SIZE(inode->i_sb) > EXT3_GOOD_OLD_INODE_SIZE)
-+ ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize);
-+ else
-+ ei->i_extra_isize = 0;
-+
- if (S_ISREG(inode->i_mode)) {
- inode->i_op = &ext3_file_inode_operations;
- inode->i_fop = &ext3_file_operations;
-@@ -2682,6 +2687,9 @@
- } else for (block = 0; block < EXT3_N_BLOCKS; block++)
- raw_inode->i_block[block] = ei->i_data[block];
-
-+ if (EXT3_INODE_SIZE(inode->i_sb) > EXT3_GOOD_OLD_INODE_SIZE)
-+ raw_inode->i_extra_isize = cpu_to_le16(ei->i_extra_isize);
-+
- BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
- rc = ext3_journal_dirty_metadata(handle, bh);
- if (!err)
-Index: linux-2.6.0/fs/ext3/xattr.c
-===================================================================
---- linux-2.6.0.orig/fs/ext3/xattr.c 2003-12-30 08:33:13.000000000 +0300
-+++ linux-2.6.0/fs/ext3/xattr.c 2004-01-14 18:54:12.000000000 +0300
-@@ -246,17 +246,12 @@
- }
-
- /*
-- * ext3_xattr_get()
-- *
-- * Copy an extended attribute into the buffer
-- * provided, or compute the buffer size required.
-- * Buffer is NULL to compute the size of the buffer required.
-+ * ext3_xattr_block_get()
- *
-- * Returns a negative error number on failure, or the number of bytes
-- * used / required on success.
-+ * routine looks for attribute in EA block and returns it's value and size
- */
- int
--ext3_xattr_get(struct inode *inode, int name_index, const char *name,
-+ext3_xattr_block_get(struct inode *inode, int name_index, const char *name,
- void *buffer, size_t buffer_size)
- {
- struct buffer_head *bh = NULL;
-@@ -270,7 +265,6 @@
-
- if (name == NULL)
- return -EINVAL;
-- down_read(&EXT3_I(inode)->xattr_sem);
- error = -ENODATA;
- if (!EXT3_I(inode)->i_file_acl)
- goto cleanup;
-@@ -343,15 +337,87 @@
-
- cleanup:
- brelse(bh);
-- up_read(&EXT3_I(inode)->xattr_sem);
-
- return error;
- }
-
- /*
-- * ext3_xattr_list()
-+ * ext3_xattr_ibode_get()
- *
-- * Copy a list of attribute names into the buffer
-+ * routine looks for attribute in inode body and returns it's value and size
-+ */
-+int
-+ext3_xattr_ibody_get(struct inode *inode, int name_index, const char *name,
-+ void *buffer, size_t buffer_size)
-+{
-+ int size, name_len = strlen(name), storage_size;
-+ struct ext3_xattr_entry *last;
-+ struct ext3_inode *raw_inode;
-+ struct ext3_iloc iloc;
-+ char *start, *end;
-+ int ret = -ENOENT;
-+
-+ if (EXT3_SB(inode->i_sb)->s_inode_size <= EXT3_GOOD_OLD_INODE_SIZE)
-+ return -ENOENT;
-+
-+ ret = ext3_get_inode_loc(inode, &iloc);
-+ if (ret)
-+ return ret;
-+ raw_inode = ext3_raw_inode(&iloc);
-+
-+ storage_size = EXT3_SB(inode->i_sb)->s_inode_size -
-+ EXT3_GOOD_OLD_INODE_SIZE -
-+ EXT3_I(inode)->i_extra_isize -
-+ sizeof(__u32);
-+ start = (char *) raw_inode + EXT3_GOOD_OLD_INODE_SIZE +
-+ EXT3_I(inode)->i_extra_isize;
-+ if (le32_to_cpu((*(__u32*) start)) != EXT3_XATTR_MAGIC) {
-+ brelse(iloc.bh);
-+ return -ENOENT;
-+ }
-+ start += sizeof(__u32);
-+ end = (char *) raw_inode + EXT3_SB(inode->i_sb)->s_inode_size;
-+
-+ last = (struct ext3_xattr_entry *) start;
-+ while (!IS_LAST_ENTRY(last)) {
-+ struct ext3_xattr_entry *next = EXT3_XATTR_NEXT(last);
-+ if (le32_to_cpu(last->e_value_size) > storage_size ||
-+ (char *) next >= end) {
-+ ext3_error(inode->i_sb, "ext3_xattr_ibody_get",
-+ "inode %ld", inode->i_ino);
-+ brelse(iloc.bh);
-+ return -EIO;
-+ }
-+ if (name_index == last->e_name_index &&
-+ name_len == last->e_name_len &&
-+ !memcmp(name, last->e_name, name_len))
-+ goto found;
-+ last = next;
-+ }
-+
-+ /* can't find EA */
-+ brelse(iloc.bh);
-+ return -ENOENT;
-+
-+found:
-+ size = le32_to_cpu(last->e_value_size);
-+ if (buffer) {
-+ ret = -ERANGE;
-+ if (buffer_size >= size) {
-+ memcpy(buffer, start + le16_to_cpu(last->e_value_offs),
-+ size);
-+ ret = size;
-+ }
-+ } else
-+ ret = size;
-+ brelse(iloc.bh);
-+ return ret;
-+}
-+
-+/*
-+ * ext3_xattr_get()
-+ *
-+ * Copy an extended attribute into the buffer
- * provided, or compute the buffer size required.
- * Buffer is NULL to compute the size of the buffer required.
- *
-@@ -359,7 +425,31 @@
- * used / required on success.
- */
- int
--ext3_xattr_list(struct inode *inode, char *buffer, size_t buffer_size)
-+ext3_xattr_get(struct inode *inode, int name_index, const char *name,
-+ void *buffer, size_t buffer_size)
-+{
-+ int err;
-+
-+ down_read(&EXT3_I(inode)->xattr_sem);
-+
-+ /* try to find attribute in inode body */
-+ err = ext3_xattr_ibody_get(inode, name_index, name,
-+ buffer, buffer_size);
-+ 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);
-+ up_read(&EXT3_I(inode)->xattr_sem);
-+
-+ return err;
-+}
-+
-+/* ext3_xattr_ibody_list()
-+ *
-+ * generate list of attributes stored in EA block
-+ */
-+int
-+ext3_xattr_block_list(struct inode *inode, char *buffer, size_t buffer_size)
- {
- struct buffer_head *bh = NULL;
- struct ext3_xattr_entry *entry;
-@@ -370,7 +460,6 @@
- ea_idebug(inode, "buffer=%p, buffer_size=%ld",
- buffer, (long)buffer_size);
-
-- down_read(&EXT3_I(inode)->xattr_sem);
- error = 0;
- if (!EXT3_I(inode)->i_file_acl)
- goto cleanup;
-@@ -380,7 +469,7 @@
- if (!bh)
- goto cleanup;
- ea_bdebug(bh, "b_count=%d, refcount=%d",
-- atomic_read(&(bh->b_count)), le32_to_cpu(HDR(bh)->h_refcount));
-+ (int) atomic_read(&(bh->b_count)), (int) le32_to_cpu(HDR(bh)->h_refcount));
- end = bh->b_data + bh->b_size;
- if (HDR(bh)->h_magic != cpu_to_le32(EXT3_XATTR_MAGIC) ||
- HDR(bh)->h_blocks != cpu_to_le32(1)) {
-@@ -431,11 +520,138 @@
-
- cleanup:
- brelse(bh);
-- up_read(&EXT3_I(inode)->xattr_sem);
-
- return error;
- }
-
-+/* ext3_xattr_ibody_list()
-+ *
-+ * generate list of attributes stored in inode body
-+ */
-+int
-+ext3_xattr_ibody_list(struct inode *inode, char *buffer, size_t buffer_size)
-+{
-+ struct ext3_xattr_entry *last;
-+ struct ext3_inode *raw_inode;
-+ char *start, *end, *buf;
-+ struct ext3_iloc iloc;
-+ int storage_size;
-+ int ret;
-+ int size = 0;
-+
-+ if (EXT3_SB(inode->i_sb)->s_inode_size <= EXT3_GOOD_OLD_INODE_SIZE)
-+ return 0;
-+
-+ ret = ext3_get_inode_loc(inode, &iloc);
-+ if (ret)
-+ return ret;
-+ raw_inode = ext3_raw_inode(&iloc);
-+
-+ storage_size = EXT3_SB(inode->i_sb)->s_inode_size -
-+ EXT3_GOOD_OLD_INODE_SIZE -
-+ EXT3_I(inode)->i_extra_isize -
-+ sizeof(__u32);
-+ start = (char *) raw_inode + EXT3_GOOD_OLD_INODE_SIZE +
-+ EXT3_I(inode)->i_extra_isize;
-+ if (le32_to_cpu((*(__u32*) start)) != EXT3_XATTR_MAGIC) {
-+ brelse(iloc.bh);
-+ return 0;
-+ }
-+ start += sizeof(__u32);
-+ end = (char *) raw_inode + EXT3_SB(inode->i_sb)->s_inode_size;
-+
-+ last = (struct ext3_xattr_entry *) start;
-+ while (!IS_LAST_ENTRY(last)) {
-+ struct ext3_xattr_entry *next = EXT3_XATTR_NEXT(last);
-+ struct ext3_xattr_handler *handler;
-+ if (le32_to_cpu(last->e_value_size) > storage_size ||
-+ (char *) next >= end) {
-+ ext3_error(inode->i_sb, "ext3_xattr_ibody_list",
-+ "inode %ld", inode->i_ino);
-+ brelse(iloc.bh);
-+ return -EIO;
-+ }
-+ handler = ext3_xattr_handler(last->e_name_index);
-+ if (handler)
-+ size += handler->list(NULL, inode, last->e_name,
-+ last->e_name_len);
-+ last = next;
-+ }
-+
-+ if (!buffer) {
-+ ret = size;
-+ goto cleanup;
-+ } else {
-+ ret = -ERANGE;
-+ if (size > buffer_size)
-+ goto cleanup;
-+ }
-+
-+ last = (struct ext3_xattr_entry *) start;
-+ buf = buffer;
-+ while (!IS_LAST_ENTRY(last)) {
-+ struct ext3_xattr_entry *next = EXT3_XATTR_NEXT(last);
-+ struct ext3_xattr_handler *handler;
-+ handler = ext3_xattr_handler(last->e_name_index);
-+ if (handler)
-+ buf += handler->list(buf, inode, last->e_name,
-+ last->e_name_len);
-+ last = next;
-+ }
-+ ret = size;
-+cleanup:
-+ brelse(iloc.bh);
-+ return ret;
-+}
-+
-+/*
-+ * ext3_xattr_list()
-+ *
-+ * Copy a list of attribute names into the buffer
-+ * provided, or compute the buffer size required.
-+ * Buffer is NULL to compute the size of the buffer required.
-+ *
-+ * Returns a negative error number on failure, or the number of bytes
-+ * used / required on success.
-+ */
-+int
-+ext3_xattr_list(struct inode *inode, char *buffer, size_t buffer_size)
-+{
-+ int error;
-+ int size = buffer_size;
-+
-+ down_read(&EXT3_I(inode)->xattr_sem);
-+
-+ /* 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
-+ * attributes in inode body */
-+ size = 0;
-+ goto cleanup;
-+ }
-+ size = error;
-+
-+ /* get list of attributes stored in dedicated block */
-+ if (buffer) {
-+ buffer_size -= error;
-+ if (buffer_size <= 0) {
-+ buffer = NULL;
-+ buffer_size = 0;
-+ } else
-+ buffer += error;
-+ }
-+
-+ error = ext3_xattr_block_list(inode, buffer, buffer_size);
-+ if (error < 0)
-+ /* listing was successful, so we return len */
-+ size = 0;
-+
-+cleanup:
-+ up_read(&EXT3_I(inode)->xattr_sem);
-+ return error + size;
-+}
-+
- /*
- * If the EXT3_FEATURE_COMPAT_EXT_ATTR feature of this file system is
- * not set, set it.
-@@ -457,6 +673,279 @@
- }
-
- /*
-+ * ext3_xattr_ibody_find()
-+ *
-+ * search attribute and calculate free space in inode body
-+ * NOTE: free space includes space our attribute hold
-+ */
-+int
-+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;
-+ struct ext3_inode *raw_inode;
-+ int name_len = strlen(name);
-+ int err, storage_size;
-+ struct ext3_iloc iloc;
-+ char *start, *end;
-+ int ret = -ENOENT;
-+
-+ if (EXT3_SB(inode->i_sb)->s_inode_size <= EXT3_GOOD_OLD_INODE_SIZE)
-+ return ret;
-+
-+ err = ext3_get_inode_loc(inode, &iloc);
-+ if (err)
-+ return -EIO;
-+ raw_inode = ext3_raw_inode(&iloc);
-+
-+ storage_size = EXT3_SB(inode->i_sb)->s_inode_size -
-+ EXT3_GOOD_OLD_INODE_SIZE -
-+ EXT3_I(inode)->i_extra_isize -
-+ sizeof(__u32);
-+ *free = storage_size - sizeof(__u32);
-+ start = (char *) raw_inode + EXT3_GOOD_OLD_INODE_SIZE +
-+ EXT3_I(inode)->i_extra_isize;
-+ if (le32_to_cpu((*(__u32*) start)) != EXT3_XATTR_MAGIC) {
-+ brelse(iloc.bh);
-+ return -ENOENT;
-+ }
-+ start += sizeof(__u32);
-+ end = (char *) raw_inode + EXT3_SB(inode->i_sb)->s_inode_size;
-+
-+ last = (struct ext3_xattr_entry *) start;
-+ while (!IS_LAST_ENTRY(last)) {
-+ struct ext3_xattr_entry *next = EXT3_XATTR_NEXT(last);
-+ if (le32_to_cpu(last->e_value_size) > storage_size ||
-+ (char *) next >= end) {
-+ ext3_error(inode->i_sb, "ext3_xattr_ibody_find",
-+ "inode %ld", inode->i_ino);
-+ brelse(iloc.bh);
-+ return -EIO;
-+ }
-+
-+ if (name_index == last->e_name_index &&
-+ name_len == last->e_name_len &&
-+ !memcmp(name, last->e_name, name_len)) {
-+ memcpy(rentry, last, sizeof(struct ext3_xattr_entry));
-+ ret = 0;
-+ } else {
-+ *free -= EXT3_XATTR_LEN(last->e_name_len);
-+ *free -= le32_to_cpu(last->e_value_size);
-+ }
-+ last = next;
-+ }
-+
-+ brelse(iloc.bh);
-+ return ret;
-+}
-+
-+/*
-+ * ext3_xattr_block_find()
-+ *
-+ * search attribute and calculate free space in EA block (if it allocated)
-+ * NOTE: free space includes space our attribute hold
-+ */
-+int
-+ext3_xattr_block_find(struct inode *inode, int name_index, const char *name,
-+ struct ext3_xattr_entry *rentry, int *free)
-+{
-+ struct buffer_head *bh = NULL;
-+ struct ext3_xattr_entry *entry;
-+ char *end;
-+ int name_len, error = -ENOENT;
-+
-+ if (!EXT3_I(inode)->i_file_acl) {
-+ *free = inode->i_sb->s_blocksize -
-+ sizeof(struct ext3_xattr_header) -
-+ sizeof(__u32);
-+ return -ENOENT;
-+ }
-+ ea_idebug(inode, "reading block %d", EXT3_I(inode)->i_file_acl);
-+ bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl);
-+ if (!bh)
-+ return -EIO;
-+ ea_bdebug(bh, "b_count=%d, refcount=%d",
-+ atomic_read(&(bh->b_count)), le32_to_cpu(HDR(bh)->h_refcount));
-+ end = bh->b_data + bh->b_size;
-+ if (HDR(bh)->h_magic != cpu_to_le32(EXT3_XATTR_MAGIC) ||
-+ HDR(bh)->h_blocks != cpu_to_le32(1)) {
-+bad_block: ext3_error(inode->i_sb, "ext3_xattr_get",
-+ "inode %ld: bad block %d", inode->i_ino,
-+ EXT3_I(inode)->i_file_acl);
-+ brelse(bh);
-+ return -EIO;
-+ }
-+ /* find named attribute */
-+ name_len = strlen(name);
-+ *free = bh->b_size - sizeof(__u32);
-+
-+ entry = FIRST_ENTRY(bh);
-+ while (!IS_LAST_ENTRY(entry)) {
-+ struct ext3_xattr_entry *next =
-+ EXT3_XATTR_NEXT(entry);
-+ if ((char *)next >= end)
-+ goto bad_block;
-+ if (name_index == entry->e_name_index &&
-+ name_len == entry->e_name_len &&
-+ memcmp(name, entry->e_name, name_len) == 0) {
-+ memcpy(rentry, entry, sizeof(struct ext3_xattr_entry));
-+ error = 0;
-+ } else {
-+ *free -= EXT3_XATTR_LEN(entry->e_name_len);
-+ *free -= le32_to_cpu(entry->e_value_size);
-+ }
-+ entry = next;
-+ }
-+ brelse(bh);
-+
-+ return error;
-+}
-+
-+/*
-+ * ext3_xattr_inode_set()
-+ *
-+ * this routine add/remove/replace attribute in inode body
-+ */
-+int
-+ext3_xattr_ibody_set(handle_t *handle, struct inode *inode, int name_index,
-+ const char *name, const void *value, size_t value_len,
-+ int flags)
-+{
-+ struct ext3_xattr_entry *last, *next, *here = NULL;
-+ struct ext3_inode *raw_inode;
-+ int name_len = strlen(name);
-+ int esize = EXT3_XATTR_LEN(name_len);
-+ struct buffer_head *bh;
-+ int err, storage_size;
-+ struct ext3_iloc iloc;
-+ int free, min_offs;
-+ char *start, *end;
-+
-+ if (EXT3_SB(inode->i_sb)->s_inode_size <= EXT3_GOOD_OLD_INODE_SIZE)
-+ return -ENOSPC;
-+
-+ err = ext3_get_inode_loc(inode, &iloc);
-+ if (err)
-+ return err;
-+ raw_inode = ext3_raw_inode(&iloc);
-+ bh = iloc.bh;
-+
-+ storage_size = EXT3_SB(inode->i_sb)->s_inode_size -
-+ EXT3_GOOD_OLD_INODE_SIZE -
-+ EXT3_I(inode)->i_extra_isize -
-+ sizeof(__u32);
-+ start = (char *) raw_inode + EXT3_GOOD_OLD_INODE_SIZE +
-+ EXT3_I(inode)->i_extra_isize;
-+ if ((*(__u32*) start) != EXT3_XATTR_MAGIC) {
-+ /* inode had no attributes before */
-+ *((__u32*) start) = cpu_to_le32(EXT3_XATTR_MAGIC);
-+ }
-+ start += sizeof(__u32);
-+ end = (char *) raw_inode + EXT3_SB(inode->i_sb)->s_inode_size;
-+ min_offs = storage_size;
-+ free = storage_size - sizeof(__u32);
-+
-+ last = (struct ext3_xattr_entry *) start;
-+ while (!IS_LAST_ENTRY(last)) {
-+ next = EXT3_XATTR_NEXT(last);
-+ if (le32_to_cpu(last->e_value_size) > storage_size ||
-+ (char *) next >= end) {
-+ ext3_error(inode->i_sb, "ext3_xattr_ibody_set",
-+ "inode %ld", inode->i_ino);
-+ brelse(bh);
-+ return -EIO;
-+ }
-+
-+ if (last->e_value_size) {
-+ int offs = le16_to_cpu(last->e_value_offs);
-+ if (offs < min_offs)
-+ min_offs = offs;
-+ }
-+ if (name_index == last->e_name_index &&
-+ name_len == last->e_name_len &&
-+ !memcmp(name, last->e_name, name_len))
-+ here = last;
-+ else {
-+ /* we calculate all but our attribute
-+ * because it will be removed before changing */
-+ free -= EXT3_XATTR_LEN(last->e_name_len);
-+ free -= le32_to_cpu(last->e_value_size);
-+ }
-+ last = next;
-+ }
-+
-+ if (value && (esize + value_len > free)) {
-+ brelse(bh);
-+ return -ENOSPC;
-+ }
-+
-+ err = ext3_reserve_inode_write(handle, inode, &iloc);
-+ if (err) {
-+ brelse(bh);
-+ return err;
-+ }
-+
-+ if (here) {
-+ /* time to remove old value */
-+ struct ext3_xattr_entry *e;
-+ int size = le32_to_cpu(here->e_value_size);
-+ int border = le16_to_cpu(here->e_value_offs);
-+ char *src;
-+
-+ /* move tail */
-+ memmove(start + min_offs + size, start + min_offs,
-+ border - min_offs);
-+
-+ /* recalculate offsets */
-+ 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 =
-+ cpu_to_le16(offs + size);
-+ e = next;
-+ }
-+ min_offs += size;
-+
-+ /* remove entry */
-+ border = EXT3_XATTR_LEN(here->e_name_len);
-+ src = (char *) here + EXT3_XATTR_LEN(here->e_name_len);
-+ size = (char *) last - src;
-+ if ((char *) here + size > end)
-+ printk("ALERT at %s:%d: 0x%p + %d > 0x%p\n",
-+ __FILE__, __LINE__, here, size, end);
-+ memmove(here, src, size);
-+ last = (struct ext3_xattr_entry *) ((char *) last - border);
-+ *((__u32 *) last) = 0;
-+ }
-+
-+ if (value) {
-+ int offs = min_offs - value_len;
-+ /* use last to create new entry */
-+ last->e_name_len = strlen(name);
-+ last->e_name_index = name_index;
-+ last->e_value_offs = cpu_to_le16(offs);
-+ last->e_value_size = cpu_to_le32(value_len);
-+ last->e_hash = last->e_value_block = 0;
-+ memset(last->e_name, 0, esize);
-+ memcpy(last->e_name, name, last->e_name_len);
-+ if (start + offs + value_len > end)
-+ printk("ALERT at %s:%d: 0x%p + %d + %d > 0x%p\n",
-+ __FILE__, __LINE__, start, offs,
-+ value_len, end);
-+ memcpy(start + offs, value, value_len);
-+ last = EXT3_XATTR_NEXT(last);
-+ *((__u32 *) last) = 0;
-+ }
-+
-+ ext3_mark_iloc_dirty(handle, inode, &iloc);
-+ brelse(bh);
-+
-+ return 0;
-+}
-+
-+/*
- * ext3_xattr_set_handle()
- *
- * Create, replace or remove an extended attribute for this inode. Buffer
-@@ -470,6 +959,104 @@
- */
- int
- ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
-+ const char *name, const void *value, size_t value_len,
-+ int flags)
-+{
-+ struct ext3_xattr_entry entry;
-+ int err, where = 0, found = 0, total;
-+ int free1 = -1, free2 = -1;
-+ int name_len;
-+
-+ ea_idebug(inode, "name=%d.%s, value=%p, value_len=%ld",
-+ name_index, name, value, (long)value_len);
-+
-+ if (IS_RDONLY(inode))
-+ return -EROFS;
-+ if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
-+ return -EPERM;
-+ if (value == NULL)
-+ value_len = 0;
-+ if (name == NULL)
-+ return -EINVAL;
-+ name_len = strlen(name);
-+ if (name_len > 255 || value_len > inode->i_sb->s_blocksize)
-+ return -ERANGE;
-+ down_write(&EXT3_I(inode)->xattr_sem);
-+
-+ /* try to find attribute in inode body */
-+ err = ext3_xattr_ibody_find(inode, name_index, name, &entry, &free1);
-+ if (err == 0) {
-+ /* found EA in inode */
-+ found = 1;
-+ where = 0;
-+ } else if (err == -ENOENT) {
-+ /* there is no such attribute in inode body */
-+ /* try to find attribute in dedicated block */
-+ err = ext3_xattr_block_find(inode, name_index, name,
-+ &entry, &free2);
-+ if (err != 0 && err != -ENOENT) {
-+ /* not found EA in block */
-+ goto finish;
-+ } else if (err == 0) {
-+ /* found EA in block */
-+ where = 1;
-+ found = 1;
-+ }
-+ } else
-+ goto finish;
-+
-+ /* check flags: may replace? may create ? */
-+ if (found && (flags & XATTR_CREATE)) {
-+ err = -EEXIST;
-+ goto finish;
-+ } else if (!found && (flags & XATTR_REPLACE)) {
-+ err = -ENODATA;
-+ goto finish;
-+ }
-+
-+ /* check if we have enough space to store attribute */
-+ total = EXT3_XATTR_LEN(strlen(name)) + value_len;
-+ if (free1 >= 0 && total > free1 && free2 >= 0 && total > free2) {
-+ /* have no enough space */
-+ err = -ENOSPC;
-+ goto finish;
-+ }
-+
-+ /* time to remove attribute */
-+ if (found) {
-+ if (where == 0) {
-+ /* EA is stored in inode body */
-+ ext3_xattr_ibody_set(handle, inode, name_index, name,
-+ NULL, 0, flags);
-+ } else {
-+ /* EA is stored in separated block */
-+ ext3_xattr_block_set(handle, inode, name_index, name,
-+ NULL, 0, flags);
-+ }
-+ }
-+
-+ /* try to store EA in inode body */
-+ err = ext3_xattr_ibody_set(handle, inode, name_index, name,
-+ value, value_len, flags);
-+ if (err) {
-+ /* can't store EA in inode body */
-+ /* try to store in block */
-+ err = ext3_xattr_block_set(handle, inode, name_index,
-+ name, value, value_len, flags);
-+ }
-+
-+finish:
-+ up_write(&EXT3_I(inode)->xattr_sem);
-+ return err;
-+}
-+
-+/*
-+ * ext3_xattr_block_set()
-+ *
-+ * this routine add/remove/replace attribute in EA block
-+ */
-+int
-+ext3_xattr_block_set(handle_t *handle, struct inode *inode, int name_index,
- const char *name, const void *value, size_t value_len,
- int flags)
- {
-@@ -492,22 +1078,7 @@
- * towards the end of the block).
- * end -- Points right after the block pointed to by header.
- */
--
-- ea_idebug(inode, "name=%d.%s, value=%p, value_len=%ld",
-- name_index, name, value, (long)value_len);
--
-- if (IS_RDONLY(inode))
-- return -EROFS;
-- if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
-- return -EPERM;
-- if (value == NULL)
-- value_len = 0;
-- if (name == NULL)
-- return -EINVAL;
- name_len = strlen(name);
-- if (name_len > 255 || value_len > sb->s_blocksize)
-- return -ERANGE;
-- down_write(&EXT3_I(inode)->xattr_sem);
- if (EXT3_I(inode)->i_file_acl) {
- /* The inode already has an extended attribute block. */
- bh = sb_bread(sb, EXT3_I(inode)->i_file_acl);
-@@ -733,7 +1304,6 @@
- brelse(bh);
- if (!(bh && header == HDR(bh)))
- kfree(header);
-- up_write(&EXT3_I(inode)->xattr_sem);
-
- return error;
- }
-Index: linux-2.6.0/fs/ext3/xattr.h
-===================================================================
---- linux-2.6.0.orig/fs/ext3/xattr.h 2003-06-24 18:04:43.000000000 +0400
-+++ linux-2.6.0/fs/ext3/xattr.h 2004-01-14 18:54:12.000000000 +0300
-@@ -77,7 +77,8 @@
- extern int ext3_xattr_get(struct inode *, int, const char *, void *, size_t);
- extern int ext3_xattr_list(struct inode *, char *, size_t);
- extern int ext3_xattr_set(struct inode *, int, const char *, const void *, size_t, int);
--extern int ext3_xattr_set_handle(handle_t *, struct inode *, int, const char *, const void *, size_t, int);
-+extern int ext3_xattr_set_handle(handle_t *, struct inode *, int, const char *,const void *,size_t,int);
-+extern int ext3_xattr_block_set(handle_t *, struct inode *, int, const char *,const void *,size_t,int);
-
- extern void ext3_xattr_delete_inode(handle_t *, struct inode *);
- extern void ext3_xattr_put_super(struct super_block *);
-Index: linux-2.6.0/include/linux/ext3_fs.h
-===================================================================
---- linux-2.6.0.orig/include/linux/ext3_fs.h 2004-01-14 18:54:11.000000000 +0300
-+++ linux-2.6.0/include/linux/ext3_fs.h 2004-01-14 18:54:12.000000000 +0300
-@@ -265,6 +265,8 @@
- __u32 m_i_reserved2[2];
- } masix2;
- } osd2; /* OS dependent 2 */
-+ __u16 i_extra_isize;
-+ __u16 i_pad1;
- };
-
- #define i_size_high i_dir_acl
-Index: linux-2.6.0/include/linux/ext3_fs_i.h
-===================================================================
---- linux-2.6.0.orig/include/linux/ext3_fs_i.h 2003-12-30 08:32:44.000000000 +0300
-+++ linux-2.6.0/include/linux/ext3_fs_i.h 2004-01-14 18:54:12.000000000 +0300
-@@ -96,6 +96,9 @@
- */
- loff_t i_disksize;
-
-+ /* on-disk additional length */
-+ __u16 i_extra_isize;
-+
- /*
- * truncate_sem is for serialising ext3_truncate() against
- * ext3_getblock(). In the 2.4 ext2 design, great chunks of inode's
-
-%diffstat
- fs/ext3/ialloc.c | 5
- fs/ext3/inode.c | 10
- fs/ext3/xattr.c | 634 +++++++++++++++++++++++++++++++++++++++++++---
- fs/ext3/xattr.h | 3
- include/linux/ext3_fs.h | 2
- include/linux/ext3_fs_i.h | 3
- 6 files changed, 623 insertions(+), 34 deletions(-)
-
+++ /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
+++ /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
-autoMakefile
-autoMakefile.in
+Makefile.in
aclocal.m4
autom4te.cache
config.log
config.status
configure
-.*.cmd
-.depend
+.*.o.cmd
--- /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_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])
+AC_ARG_ENABLE(inkernel, [ --enable-inkernel set up 2.5 kernel makefiles])
AM_CONDITIONAL(INKERNEL, test x$enable_inkernel = xyes)
+echo "Makefile for in kernel build: $INKERNEL"
# -------- are we building against an external portals? -------
-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
+# 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")
# -------- set linuxdir ------------
-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_ARG_WITH(linux, [ --with-linux=[path] set path to Linux source (default=/usr/src/linux)],LINUX=$with_linux,LINUX=/usr/src/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
-# -------- 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)
-
-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']])
-
-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])
-
# --------------------
-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
+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
+
+ 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])
+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)
+fi
AM_CONDITIONAL(LINUX25, test x$linux25 = xyes)
-AC_SUBST(KMODEXT)
+echo "Makefiles for in linux 2.5 build: $LINUX25"
# ------- Makeflags ------------------
-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])
+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
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 ------------------
-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)
+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
fi
# ---------- Portals flags --------------------
#fi
#AC_SUBST(usrprefix)
-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)])
+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)
else
- 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
+ enable_affinity_temp=""
+ AC_MSG_RESULT(no)
fi
-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)])
+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)
else
- 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
+ enable_zerocopy_temp=""
+ AC_MSG_RESULT(no)
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])
- 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
+ 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
+ :
else
- AC_MSG_RESULT([no])
- QSWNAL=""
- QSWCPPFLAGS=""
+ AC_MSG_RESULT(no)
+ QSWNAL=""
+ with_quadrics=""
+ :
fi
-AC_SUBST(QSWCPPFLAGS)
+AC_SUBST(with_quadrics)
AC_SUBST(QSWNAL)
-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)
+
+# 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)
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_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_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_SUBST(IBNAL)
-AC_SUBST(IBCPPFLAGS)
-AM_CONDITIONAL(BUILD_IBNAL, test x$IBNAL = "xibnal")
+AC_SUBST(with_ib)
+
+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])
-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])
- ])
+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])])
# ---------- 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])
-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])
- ])
+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
# ---------- 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
- AC_DEFINE(HAVE_PDE, 1, [the kernel defines PDE])
- AC_MSG_RESULT([yes])
+ CPPFLAGS="$CPPFLAGS -DHAVE_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
- AC_DEFINE(HAVE_DIO_FILE, 1, [the kernel passes struct file to direct_IO])
- AC_MSG_RESULT(yes)
+ CPPFLAGS="$CPPFLAGS -DHAVE_DIO_FILE"
+ AC_MSG_RESULT(yes)
else
- 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
+ AC_MSG_RESULT(no)
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"
# ---------- 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_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])
+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"
else
- LIBREADLINE=""
+ LIBREADLINE=""
+ HAVE_LIBREADLINE=""
fi
AC_SUBST(LIBREADLINE)
+AC_SUBST(HAVE_LIBREADLINE)
-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])
+AC_ARG_ENABLE(efence, [ --enable-efence use efence library],,
+ enable_efence="no")
+
if test "$enable_efence" = "yes" ; then
- LIBEFENCE="-lefence"
- AC_DEFINE(HAVE_LIBEFENCE, 1, [libefence support is requested])
+ LIBEFENCE="-lefence"
+ HAVE_LIBEFENCE="-DHAVE_LIBEFENCE=1"
else
- LIBEFENCE=""
+ LIBEFENCE=""
+ HAVE_LIBEFENCE=""
fi
AC_SUBST(LIBEFENCE)
+AC_SUBST(HAVE_LIBEFENCE)
+
# This code is issued under the GNU General Public License.
# See the file COPYING in this distribution
-SUBDIRS = gmnal ibnal qswnal socknal
+SUBDIRS = portals linux
+EXTRA_DIST = config.h.in
+include $(top_srcdir)/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
+
+include $(top_srcdir)/Rules
+
+linuxincludedir = $(includedir)/linux
+
+linuxinclude_HEADERS=kp30.h portals_lib.h
#define PORTAL_DEBUG
#ifndef offsetof
-# define offsetof(typ,memb) ((unsigned long)((char *)&(((typ *)0)->memb)))
+# define offsetof(typ,memb) ((int)((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...) \
-do { \
- if (!(cond)) \
- CERROR(args); \
- assert(cond); \
-} while (0)
+# define LASSERTF(cond, args...) assert(cond)
# 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,
- ROUTER = 6,
- IBNAL = 7,
- CRAY_KB_ERNAL = 8,
+ SCIMACNAL = 6,
+ ROUTER = 7,
+ IBNAL = 8,
NAL_ENUM_END_MARKER
};
-#define PTL_NALFMT_SIZE 26 /* %u:%u.%u.%u.%u (10+4+4+4+3+1) */
+#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 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) ((unsigned long)((char *)&(((typ *)0)->memb)))
+# define offsetof(typ,memb) ((int)((char *)&(((typ *)0)->memb)))
#endif
#define LOWEST_BIT_SET(x) ((x) & ~((x) - 1))
#define S_PTLROUTER 0x00100000
#define S_COBD 0x00200000
#define S_IBNAL 0x00400000
-#define S_SM 0x00800000
+#define S_LMV 0x00800000
/* 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, len, fmt, a...) \
- snprintf(comm, len, fmt "|%d", ## a, current->thread.extern_pid)
+# define THREAD_NAME(comm, fmt, a...) \
+ sprintf(comm, fmt "|%d", ## a, current->thread.extern_pid)
#elif defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-# 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)
+# define THREAD_NAME(comm, fmt, a...) \
+ sprintf(comm, fmt "|%d", ## a, current->thread.mode.tt.extern_pid)
#else
-/* 2.6 alloc_page users can use page->lru */
-#define PAGE_LIST_ENTRY lru
-#define PAGE_LIST(page) ((page)->lru)
+# define THREAD_NAME(comm, fmt, a...) \
+ sprintf(comm, fmt, ## a)
#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_pid_t requested_pid,
- ptl_ni_limits_t *desired_limits, ptl_ni_limits_t *actual_limits,
- ptl_handle_ni_t *interface_out);
+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 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,
- ptl_eq_handler_t handler,
- ptl_handle_eq_t *handle_out);
+ int (*callback) (ptl_event_t * event),
+ 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;
- ptl_eq_handler_t callback_in;
+ int (*callback_in) (ptl_event_t * event);
} PtlEQAlloc_in;
typedef struct PtlEQAlloc_out {
PTL_MD_NO_UPDATE = 18,
PTL_FAIL = 19,
- PTL_IOV_INVALID = 20,
+ PTL_IOV_TOO_MANY = 20,
+ PTL_IOV_TOO_SMALL = 21,
- PTL_EQ_IN_USE = 21,
+ PTL_EQ_IN_USE = 22,
- PTL_MAX_ERRNO = 22
+ PTL_MAX_ERRNO = 23
} 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 been initialized */
+extern int ptl_init; /* Has the library be 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->length;
+ niov = umd->niov;
size = offsetof(lib_md_t, md_iov.kiov[niov]);
} else {
niov = ((umd->options & PTL_MD_IOVEC) != 0) ?
- umd->length : 1;
+ umd->niov : 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_process_id_t pid,
- ptl_ni_limits_t *desired_limits,
- ptl_ni_limits_t *actual_limits);
+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_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->length;
+ niov = umd->niov;
size = offsetof(lib_md_t, md_iov.kiov[niov]);
} else {
niov = ((umd->options & PTL_MD_IOVEC) != 0) ?
- umd->length : 1;
+ umd->niov : 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_process_id_t pid,
- ptl_ni_limits_t *desired_limits,
- ptl_ni_limits_t *actual_limits);
+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_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;
- ptl_eq_handler_t event_callback;
+ int (*event_callback) (ptl_event_t * event);
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, unsigned int opc, void *buf);
+typedef int (ioc_handler_t)(int dev_id, 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, unsigned int opc, void *buf);
-int parse_dump(char * dump_file, ioc_handler_t ioc_func);
+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 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 {
- int nal_refct;
- void *nal_data;
+ 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 (*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 (*shutdown) (nal_t * nal, int interface);
- int (*forward) (nal_t *nal, int index, /* Function ID */
- void *args, size_t arg_len, void *ret, size_t ret_len);
+ int (*validate) (nal_t * nal, void *base, size_t extent);
- 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);
-#ifdef __KERNEL__
-extern int ptl_register_nal(ptl_interface_t interface, nal_t *nal);
-extern void ptl_unregister_nal(ptl_interface_t interface);
+#ifndef PTL_IFACE_DEFAULT
+#define PTL_IFACE_DEFAULT (PTL_IFACE_IP)
#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, unsigned int opc, void *buf);
+typedef int (ioc_handler_t)(int dev_id, 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, unsigned int opc, void *buf);
-int parse_dump(char * dump_file, ioc_handler_t ioc_func);
+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 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"
-#include <linux/libcfs.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 <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_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;
+ 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 */
} ptl_ni_limits_t;
/*
typedef int ptl_sr_value_t;
-typedef int ptl_interface_t;
-#define PTL_IFACE_DEFAULT (-1)
-
#endif
Makefile
-autoMakefile
-autoMakefile.in
-.*.cmd
-.depend
+Makefile.in
+.*.o.cmd
# This code is issued under the GNU General Public License.
# See the file COPYING in this distribution
-
-pkginclude_HEADERS = lustre_user.h liblustreapi.h
-
-EXTRA_DIST = $(pkginclude_HEADERS)
+DIST_SUBDIRS= socknal qswnal gmnal scimacnal ibnal
+SUBDIRS= socknal @QSWNAL@ @GMNAL@ @SCIMACNAL@ @IBNAL@
+++ /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@
.deps
Makefile
-autoMakefile.in
-autoMakefile
-*.ko
-*.mod.c
-.*.cmd
-.*.flags
-.tmp_versions
-.depend
+Makefile.in
--- /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);
-void gmnal_api_shutdown(nal_t *);
+int gmnal_api_shutdown(nal_t *, int);
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 *);
-int gmnal_init(void);
+nal_t *gmnal_init(int, ptl_pt_index_t, ptl_ac_index_t, ptl_pid_t rpid);
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
*/
-void
+int
gmnal_api_shutdown(nal_t *nal, int interface)
{
- gmnal_data_t *nal_data;
- nal_cb_t *nal_cb;
-
- if (nal->nal_refct != 0)
- return;
-
- CDEBUG(D_TRACE, "gmnal_api_shutdown: nal_data [%p]\n", nal_data);
-
- 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_data_t *nal_data = nal->nal_data;
- 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));
+ CDEBUG(D_TRACE, "gmnal_api_shutdown: nal_data [%p]\n", nal_data);
- global_nal_data = NULL;
- PORTAL_MODULE_UNUSE;
+ return(PTL_OK);
}
}
-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 *
+gmnal_init(int interface, ptl_pt_index_t ptl_size, ptl_ac_index_t ac_size,
+ ptl_pid_t rpid)
{
+ 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_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);
- }
+ ptl_nid_t portals_nid;
+ ptl_pid_t portals_pid = 0;
- /* Called on first PtlNIInit() */
- CDEBUG(D_TRACE, "startup\n");
+ CDEBUG(D_TRACE, "gmnal_init : interface [%d], ptl_size [%d], "
+ "ac_size[%d]\n", interface, ptl_size, ac_size);
- 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(PTL_NO_SPACE);
+ return(NULL);
}
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(PTL_NO_SPACE);
+ return(NULL);
}
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(PTL_FAIL);
+ return(NULL);
}
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(PTL_FAIL);
+ return(NULL);
}
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(PTL_FAIL);
+ return(NULL);
}
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(PTL_FAIL);
+ return(NULL);
}
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(PTL_FAIL);
+ return(NULL);
}
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(PTL_FAIL);
+ return(NULL);
}
CDEBUG(D_INFO, "Global node id is [%u]\n", global_nid);
nal_data->gm_global_nid = global_nid;
/*
pid = gm_getpid();
*/
- 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_INFO, "portals_pid is [%u]\n", portals_pid);
+ portals_nid = (unsigned long)global_nid;
+ CDEBUG(D_INFO, "portals_nid is ["LPU64"]\n", portals_nid);
CDEBUG(D_PORTALS, "calling lib_init\n");
- if (lib_init(nal_cb, process_id,
- requested_limits, actual_limits) != PTL_OK) {
+ if (lib_init(nal_cb, portals_nid, portals_pid, 1024, ptl_size,
+ ac_size) != 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(PTL_FAIL);
+ return(NULL);
}
-
- 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);
-
- &nbs