[XFS] endianess annotations for xfs_da_blkinfo_t
[pandora-kernel.git] / fs / xfs / xfs_dir.c
index 53787f3..7a708e9 100644 (file)
@@ -1,59 +1,43 @@
 /*
- * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
+ * All Rights Reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
  * published by the Free Software Foundation.
  *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-
 #include "xfs.h"
-
-#include "xfs_macros.h"
+#include "xfs_fs.h"
 #include "xfs_types.h"
-#include "xfs_inum.h"
 #include "xfs_log.h"
+#include "xfs_inum.h"
 #include "xfs_trans.h"
 #include "xfs_sb.h"
 #include "xfs_dir.h"
 #include "xfs_dir2.h"
 #include "xfs_dmapi.h"
 #include "xfs_mount.h"
-#include "xfs_alloc_btree.h"
+#include "xfs_da_btree.h"
 #include "xfs_bmap_btree.h"
+#include "xfs_alloc_btree.h"
 #include "xfs_ialloc_btree.h"
 #include "xfs_alloc.h"
 #include "xfs_btree.h"
-#include "xfs_attr_sf.h"
 #include "xfs_dir_sf.h"
 #include "xfs_dir2_sf.h"
+#include "xfs_attr_sf.h"
 #include "xfs_dinode.h"
 #include "xfs_inode.h"
 #include "xfs_bmap.h"
-#include "xfs_da_btree.h"
 #include "xfs_dir_leaf.h"
 #include "xfs_error.h"
 
@@ -192,7 +176,7 @@ xfs_dir_mount(xfs_mount_t *mp)
        uint shortcount, leafcount, count;
 
        mp->m_dirversion = 1;
-       if (mp->m_flags & XFS_MOUNT_COMPAT_ATTR) {
+       if (!(mp->m_flags & XFS_MOUNT_ATTR2)) {
                shortcount = (mp->m_attroffset -
                                (uint)sizeof(xfs_dir_sf_hdr_t)) /
                                 (uint)sizeof(xfs_dir_sf_entry_t);
@@ -650,7 +634,7 @@ xfs_dir_leaf_removename(xfs_da_args_t *args, int *count, int *totallen)
                return(retval);
        ASSERT(bp != NULL);
        leaf = bp->data;
-       ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR_LEAF_MAGIC);
+       ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR_LEAF_MAGIC);
        retval = xfs_dir_leaf_lookup_int(bp, args, &index);
        if (retval == EEXIST) {
                (void)xfs_dir_leaf_remove(args->trans, bp, index);
@@ -928,7 +912,7 @@ xfs_dir_node_getdents(xfs_trans_t *trans, xfs_inode_t *dp, uio_t *uio,
                        return(error);
                if (bp)
                        leaf = bp->data;
-               if (bp && INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) != XFS_DIR_LEAF_MAGIC) {
+               if (bp && be16_to_cpu(leaf->hdr.info.magic) != XFS_DIR_LEAF_MAGIC) {
                        xfs_dir_trace_g_dub("node: block not a leaf",
                                                   dp, uio, bno);
                        xfs_da_brelse(trans, bp);
@@ -965,7 +949,7 @@ xfs_dir_node_getdents(xfs_trans_t *trans, xfs_inode_t *dp, uio_t *uio,
                        if (bp == NULL)
                                return(XFS_ERROR(EFSCORRUPTED));
                        node = bp->data;
-                       if (INT_GET(node->hdr.info.magic, ARCH_CONVERT) != XFS_DA_NODE_MAGIC)
+                       if (be16_to_cpu(node->hdr.info.magic) != XFS_DA_NODE_MAGIC)
                                break;
                        btree = &node->btree[0];
                        xfs_dir_trace_g_dun("node: node detail", dp, uio, node);
@@ -998,7 +982,7 @@ xfs_dir_node_getdents(xfs_trans_t *trans, xfs_inode_t *dp, uio_t *uio,
         */
        for (;;) {
                leaf = bp->data;
-               if (unlikely(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) != XFS_DIR_LEAF_MAGIC)) {
+               if (unlikely(be16_to_cpu(leaf->hdr.info.magic) != XFS_DIR_LEAF_MAGIC)) {
                        xfs_dir_trace_g_dul("node: not a leaf", dp, uio, leaf);
                        xfs_da_brelse(trans, bp);
                        XFS_CORRUPTION_ERROR("xfs_dir_node_getdents(1)",
@@ -1006,7 +990,7 @@ xfs_dir_node_getdents(xfs_trans_t *trans, xfs_inode_t *dp, uio_t *uio,
                        return XFS_ERROR(EFSCORRUPTED);
                }
                xfs_dir_trace_g_dul("node: leaf detail", dp, uio, leaf);
-               if ((nextbno = INT_GET(leaf->hdr.info.forw, ARCH_CONVERT))) {
+               if ((nextbno = be32_to_cpu(leaf->hdr.info.forw))) {
                        nextda = xfs_da_reada_buf(trans, dp, nextbno,
                                                  XFS_DATA_FORK);
                } else
@@ -1141,8 +1125,7 @@ xfs_dir_trace_g_dun(char *where, xfs_inode_t *dp, uio_t *uio,
                     (void *)((unsigned long)(uio->uio_offset >> 32)),
                     (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)),
                     (void *)(unsigned long)uio->uio_resid,
-                    (void *)(unsigned long)
-                       INT_GET(node->hdr.info.forw, ARCH_CONVERT),
+                    (void *)(unsigned long)be32_to_cpu(node->hdr.info.forw),
                     (void *)(unsigned long)
                        INT_GET(node->hdr.count, ARCH_CONVERT),
                     (void *)(unsigned long)
@@ -1166,8 +1149,7 @@ xfs_dir_trace_g_dul(char *where, xfs_inode_t *dp, uio_t *uio,
                     (void *)((unsigned long)(uio->uio_offset >> 32)),
                     (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)),
                     (void *)(unsigned long)uio->uio_resid,
-                    (void *)(unsigned long)
-                       INT_GET(leaf->hdr.info.forw, ARCH_CONVERT),
+                    (void *)(unsigned long)be32_to_cpu(leaf->hdr.info.forw),
                     (void *)(unsigned long)
                        INT_GET(leaf->hdr.count, ARCH_CONVERT),
                     (void *)(unsigned long)