]> git.hungrycats.org Git - linux/commitdiff
[PATCH] hfs endianness annotations
authorAlexander Viro <viro@www.linux.org.uk>
Wed, 6 Oct 2004 00:55:39 +0000 (17:55 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 6 Oct 2004 00:55:39 +0000 (17:55 -0700)
Signed-off-by: Al Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
14 files changed:
fs/hfs/bfind.c
fs/hfs/bitmap.c
fs/hfs/bnode.c
fs/hfs/brec.c
fs/hfs/btree.c
fs/hfs/btree.h
fs/hfs/catalog.c
fs/hfs/extent.c
fs/hfs/hfs.h
fs/hfs/hfs_fs.h
fs/hfs/inode.c
fs/hfs/mdb.c
fs/hfs/part_tbl.c
fs/hfs/super.c

index af78ad64fa3a43af864bdc248e1ab001bb905eac..89450ae322280b499906611f208fdd299aa08a7e 100644 (file)
@@ -85,7 +85,8 @@ int hfs_brec_find(struct hfs_find_data *fd)
 {
        struct hfs_btree *tree;
        struct hfs_bnode *bnode;
-       u32 data, nidx, parent;
+       u32 nidx, parent;
+       __be32 data;
        int height, res;
 
        tree = fd->tree;
index 117fe1e1983a4736efb670756f57ffe6c2a12e0a..24e75798ddf014c747d9537dfe475b0e5326c884 100644 (file)
  *  Accesses memory in 32-bit aligned chunks of 32-bits and thus
  *  may read beyond the 'size'th bit.
  */
-static u32 hfs_find_set_zero_bits(u32 *bitmap, u32 size, u32 offset, u32 *max)
+static u32 hfs_find_set_zero_bits(__be32 *bitmap, u32 size, u32 offset, u32 *max)
 {
-       u32 *curr, *end;
-       u32 val, mask, start, len;
+       __be32 *curr, *end;
+       u32 mask, start, len, n;
+       __be32 val;
        int i;
 
        len = *max;
@@ -42,11 +43,11 @@ static u32 hfs_find_set_zero_bits(u32 *bitmap, u32 size, u32 offset, u32 *max)
        /* scan the first partial u32 for zero bits */
        val = *curr;
        if (~val) {
-               val = be32_to_cpu(val);
+               n = be32_to_cpu(val);
                i = offset % 32;
                mask = (1U << 31) >> i;
                for (; i < 32; mask >>= 1, i++) {
-                       if (!(val & mask))
+                       if (!(n & mask))
                                goto found;
                }
        }
@@ -55,10 +56,10 @@ static u32 hfs_find_set_zero_bits(u32 *bitmap, u32 size, u32 offset, u32 *max)
        while (++curr < end) {
                val = *curr;
                if (~val) {
-                       val = be32_to_cpu(val);
+                       n = be32_to_cpu(val);
                        mask = 1 << 31;
                        for (i = 0; i < 32; mask >>= 1, i++) {
-                               if (!(val & mask))
+                               if (!(n & mask))
                                        goto found;
                        }
                }
@@ -72,38 +73,38 @@ found:
        /* do any partial u32 at the start */
        len = min(size - start, len);
        while (1) {
-               val |= mask;
+               n |= mask;
                if (++i >= 32)
                        break;
                mask >>= 1;
-               if (!--len || val & mask)
+               if (!--len || n & mask)
                        goto done;
        }
        if (!--len)
                goto done;
-       *curr++ = cpu_to_be32(val);
+       *curr++ = cpu_to_be32(n);
        /* do full u32s */
        while (1) {
-               val = be32_to_cpu(*curr);
+               n = be32_to_cpu(*curr);
                if (len < 32)
                        break;
-               if (val) {
+               if (n) {
                        len = 32;
                        break;
                }
-               *curr++ = 0xffffffffU;
+               *curr++ = cpu_to_be32(0xffffffff);
                len -= 32;
        }
        /* do any partial u32 at end */
        mask = 1U << 31;
        for (i = 0; i < len; i++) {
-               if (val & mask)
+               if (n & mask)
                        break;
-               val |= mask;
+               n |= mask;
                mask >>= 1;
        }
 done:
-       *curr = cpu_to_be32(val);
+       *curr = cpu_to_be32(n);
        *max = (curr - bitmap) * 32 + i - start;
        return start;
 }
@@ -191,7 +192,7 @@ out:
  */
 int hfs_clear_vbm_bits(struct super_block *sb, u16 start, u16 count)
 {
-       u32 *curr;
+       __be32 *curr;
        u32 mask;
        int i, len;
 
index d0cf0a6f431c1314b1949d229832a70aff1b92e3..b47ab4283cca670a29e35d9d8e03077e91605979 100644 (file)
@@ -29,7 +29,7 @@ void hfs_bnode_read(struct hfs_bnode *node, void *buf,
 
 u16 hfs_bnode_read_u16(struct hfs_bnode *node, int off)
 {
-       u16 data;
+       __be16 data;
        // optimize later...
        hfs_bnode_read(node, &data, off, 2);
        return be16_to_cpu(data);
@@ -72,9 +72,9 @@ void hfs_bnode_write(struct hfs_bnode *node, void *buf, int off, int len)
 
 void hfs_bnode_write_u16(struct hfs_bnode *node, int off, u16 data)
 {
-       data = cpu_to_be16(data);
+       __be16 v = cpu_to_be16(data);
        // optimize later...
-       hfs_bnode_write(node, &data, off, 2);
+       hfs_bnode_write(node, &v, off, 2);
 }
 
 void hfs_bnode_write_u8(struct hfs_bnode *node, int off, u8 data)
@@ -136,7 +136,7 @@ void hfs_bnode_move(struct hfs_bnode *node, int dst, int src, int len)
 void hfs_bnode_dump(struct hfs_bnode *node)
 {
        struct hfs_bnode_desc desc;
-       u32 cnid;
+       __be32 cnid;
        int i, off, key_off;
 
        dprint(DBG_BNODE_MOD, "bnode: %d\n", node->this);
@@ -173,7 +173,7 @@ void hfs_bnode_unlink(struct hfs_bnode *node)
 {
        struct hfs_btree *tree;
        struct hfs_bnode *tmp;
-       u32 cnid;
+       __be32 cnid;
 
        tree = node->tree;
        if (node->prev) {
index 5e54671dcff9c6a195163a4f6f36052531c89967..10e986c2fcddfa8bf1e46033f592d8ee67e8b9b5 100644 (file)
@@ -13,7 +13,7 @@
 /* Get the length and offset of the given record in the given node */
 u16 hfs_brec_lenoff(struct hfs_bnode *node, u16 rec, u16 *off)
 {
-       u16 retval[2];
+       __be16 retval[2];
        u16 dataoff;
 
        dataoff = node->tree->node_size - (rec + 2) * 2;
@@ -55,7 +55,7 @@ int hfs_brec_insert(struct hfs_find_data *fd, void *entry, int entry_len)
        int size, key_len, rec;
        int data_off, end_off;
        int idx_rec_off, data_rec_off, end_rec_off;
-       u32 cnid;
+       __be32 cnid;
 
        tree = fd->tree;
        if (!fd->bnode) {
@@ -391,7 +391,7 @@ skip:
        node = parent;
 
        if (new_node) {
-               u32 cnid;
+               __be32 cnid;
 
                fd->bnode = hfs_bnode_find(tree, new_node->parent);
                /* create index key and entry */
@@ -423,7 +423,7 @@ int hfs_btree_inc_height(struct hfs_btree *tree)
        struct hfs_bnode *node, *new_node;
        struct hfs_bnode_desc node_desc;
        int key_size, rec;
-       u32 cnid;
+       __be32 cnid;
 
        node = NULL;
        if (tree->root) {
index 19f10cf9f6fb7378d60bb0bafde90e9f03ce4133..64354debfab806ce47369e392245bdfe7bb9c7c6 100644 (file)
@@ -154,7 +154,7 @@ static struct hfs_bnode *hfs_bmap_new_bmap(struct hfs_bnode *prev, u32 idx)
        struct hfs_btree *tree = prev->tree;
        struct hfs_bnode *node;
        struct hfs_bnode_desc desc;
-       u32 cnid;
+       __be32 cnid;
 
        node = hfs_bnode_create(tree, idx);
        if (IS_ERR(node))
index 266af5e546096bf6f4dd1ee4f7b3048d3a93eb5c..87eaa9ff8355d1889c92c3aafc59155b5c54851c 100644 (file)
@@ -125,11 +125,11 @@ extern int hfs_brec_goto(struct hfs_find_data *, int);
 
 
 struct hfs_bnode_desc {
-       u32 next;               /* (V) Number of the next node at this level */
-       u32 prev;               /* (V) Number of the prev node at this level */
+       __be32 next;            /* (V) Number of the next node at this level */
+       __be32 prev;            /* (V) Number of the prev node at this level */
        u8 type;                /* (F) The type of node */
        u8 height;              /* (F) The level of this node (leaves=1) */
-       u16 num_recs;           /* (V) The number of records in this node */
+       __be16 num_recs;        /* (V) The number of records in this node */
        u16 reserved;
 } __packed;
 
@@ -139,20 +139,20 @@ struct hfs_bnode_desc {
 #define HFS_NODE_LEAF  0xFF    /* A leaf (ndNHeight==1) node */
 
 struct hfs_btree_header_rec {
-       u16 depth;              /* (V) The number of levels in this B-tree */
-       u32 root;               /* (V) The node number of the root node */
-       u32 leaf_count;         /* (V) The number of leaf records */
-       u32 leaf_head;          /* (V) The number of the first leaf node */
-       u32 leaf_tail;          /* (V) The number of the last leaf node */
-       u16 node_size;          /* (F) The number of bytes in a node (=512) */
-       u16 max_key_len;        /* (F) The length of a key in an index node */
-       u32 node_count;         /* (V) The total number of nodes */
-       u32 free_nodes;         /* (V) The number of unused nodes */
+       __be16 depth;           /* (V) The number of levels in this B-tree */
+       __be32 root;            /* (V) The node number of the root node */
+       __be32 leaf_count;      /* (V) The number of leaf records */
+       __be32 leaf_head;       /* (V) The number of the first leaf node */
+       __be32 leaf_tail;       /* (V) The number of the last leaf node */
+       __be16 node_size;       /* (F) The number of bytes in a node (=512) */
+       __be16 max_key_len;     /* (F) The length of a key in an index node */
+       __be32 node_count;      /* (V) The total number of nodes */
+       __be32 free_nodes;      /* (V) The number of unused nodes */
        u16 reserved1;
-       u32 clump_size;         /* (F) clump size. not usually used. */
+       __be32 clump_size;      /* (F) clump size. not usually used. */
        u8 btree_type;          /* (F) BTree type */
        u8 reserved2;
-       u32 attributes;         /* (F) attributes */
+       __be32 attributes;      /* (F) attributes */
        u32 reserved3[16];
 } __packed;
 
index d38e18c2fa57ffc3235304ea3adc0ba21a1cd384..b21c09b78ca5fdab7f03eedde5851190d160619a 100644 (file)
@@ -35,7 +35,7 @@ void hfs_cat_build_key(btree_key *key, u32 parent, struct qstr *name)
 
 int hfs_cat_build_record(hfs_cat_rec *rec, u32 cnid, struct inode *inode)
 {
-       u32 mtime = hfs_mtime();
+       __be32 mtime = hfs_mtime();
 
        memset(rec, 0, sizeof(*rec));
        if (S_ISDIR(inode->i_mode)) {
index a9f4e23f715a2bd79af190e87f8c8eb8ae848c25..b7ce3f04805fdfb4f5e52cd820900c90701c4d85 100644 (file)
@@ -279,13 +279,13 @@ int hfs_free_fork(struct super_block *sb, struct hfs_cat_file *file, int type)
        int res, i;
 
        if (type == HFS_FK_DATA) {
-               total_blocks = file->PyLen;
+               total_blocks = be32_to_cpu(file->PyLen);
                extent = file->ExtRec;
        } else {
-               total_blocks = file->RPyLen;
+               total_blocks = be32_to_cpu(file->RPyLen);
                extent = file->RExtRec;
        }
-       total_blocks = be32_to_cpu(total_blocks) / HFS_SB(sb)->alloc_blksz;
+       total_blocks /= HFS_SB(sb)->alloc_blksz;
        if (!total_blocks)
                return 0;
 
index 73ac40810d159e9ff4df56cf9b772ae2571d7360..df6b33adee3bbd143d0a2873d9e378d44a7419d1 100644 (file)
@@ -91,45 +91,45 @@ struct hfs_name {
 } __packed;
 
 struct hfs_point {
-       u16 v;
-       u16 h;
+       __be16 v;
+       __be16 h;
 } __packed;
 
 struct hfs_rect {
-       u16 top;
-       u16 left;
-       u16 bottom;
-       u16 right;
+       __be16 top;
+       __be16 left;
+       __be16 bottom;
+       __be16 right;
 } __packed;
 
 struct hfs_finfo {
-       u32 fdType;
-       u32 fdCreator;
-       u16 fdFlags;
+       __be32 fdType;
+       __be32 fdCreator;
+       __be16 fdFlags;
        struct hfs_point fdLocation;
-       u16 fdFldr;
+       __be16 fdFldr;
 } __packed;
 
 struct hfs_fxinfo {
-       u16 fdIconID;
+       __be16 fdIconID;
        u8 fdUnused[8];
-       u16 fdComment;
-       u32 fdPutAway;
+       __be16 fdComment;
+       __be32 fdPutAway;
 } __packed;
 
 struct hfs_dinfo {
        struct hfs_rect frRect;
-       u16 frFlags;
+       __be16 frFlags;
        struct hfs_point frLocation;
-       u16 frView;
+       __be16 frView;
 } __packed;
 
 struct hfs_dxinfo {
        struct hfs_point frScroll;
-       u32 frOpenChain;
-       u16 frUnused;
-       u16 frComment;
-       u32 frPutAway;
+       __be32 frOpenChain;
+       __be16 frUnused;
+       __be16 frComment;
+       __be32 frPutAway;
 } __packed;
 
 union hfs_finder_info {
@@ -150,7 +150,7 @@ union hfs_finder_info {
 struct hfs_cat_key {
        u8 key_len;             /* number of bytes in the key */
        u8 reserved;            /* padding */
-       u32 ParID;              /* CNID of the parent dir */
+       __be32 ParID;           /* CNID of the parent dir */
        struct hfs_name CName;  /* The filename of the entry */
 } __packed;
 
@@ -158,8 +158,8 @@ struct hfs_cat_key {
 struct hfs_ext_key {
        u8 key_len;             /* number of bytes in the key */
        u8 FkType;              /* HFS_FK_{DATA,RSRC} */
-       u32 FNum;               /* The File ID of the file */
-       u16 FABN;               /* allocation blocks number*/
+       __be32 FNum;            /* The File ID of the file */
+       __be16 FABN;            /* allocation blocks number*/
 } __packed;
 
 typedef union hfs_btree_key {
@@ -171,8 +171,8 @@ typedef union hfs_btree_key {
 typedef union hfs_btree_key btree_key;
 
 struct hfs_extent {
-       u16 block;
-       u16 count;
+       __be16 block;
+       __be16 count;
 };
 typedef struct hfs_extent hfs_extent_rec[3];
 
@@ -183,18 +183,18 @@ struct hfs_cat_file {
        u8 Flags;                       /* Flags such as read-only */
        s8 Typ;                         /* file version number = 0 */
        struct hfs_finfo UsrWds;        /* data used by the Finder */
-       u32 FlNum;                      /* The CNID */
-       u16 StBlk;                      /* obsolete */
-       u32 LgLen;                      /* The logical EOF of the data fork*/
-       u32 PyLen;                      /* The physical EOF of the data fork */
-       u16 RStBlk;                     /* obsolete */
-       u32 RLgLen;                     /* The logical EOF of the rsrc fork */
-       u32 RPyLen;                     /* The physical EOF of the rsrc fork */
-       u32 CrDat;                      /* The creation date */
-       u32 MdDat;                      /* The modified date */
-       u32 BkDat;                      /* The last backup date */
+       __be32 FlNum;                   /* The CNID */
+       __be16 StBlk;                   /* obsolete */
+       __be32 LgLen;                   /* The logical EOF of the data fork*/
+       __be32 PyLen;                   /* The physical EOF of the data fork */
+       __be16 RStBlk;                  /* obsolete */
+       __be32 RLgLen;                  /* The logical EOF of the rsrc fork */
+       __be32 RPyLen;                  /* The physical EOF of the rsrc fork */
+       __be32 CrDat;                   /* The creation date */
+       __be32 MdDat;                   /* The modified date */
+       __be32 BkDat;                   /* The last backup date */
        struct hfs_fxinfo FndrInfo;     /* more data for the Finder */
-       u16 ClpSize;                    /* number of bytes to allocate
+       __be16 ClpSize;                 /* number of bytes to allocate
                                           when extending files */
        hfs_extent_rec ExtRec;          /* first extent record
                                           for the data fork */
@@ -207,13 +207,13 @@ struct hfs_cat_file {
 struct hfs_cat_dir {
        s8 type;                        /* The type of entry */
        u8 reserved;
-       u16 Flags;                      /* flags */
-       u16 Val;                        /* Valence: number of files and
+       __be16 Flags;                   /* flags */
+       __be16 Val;                     /* Valence: number of files and
                                           dirs in the directory */
-       u32 DirID;                      /* The CNID */
-       u32 CrDat;                      /* The creation date */
-       u32 MdDat;                      /* The modification date */
-       u32 BkDat;                      /* The last backup date */
+       __be32 DirID;                   /* The CNID */
+       __be32 CrDat;                   /* The creation date */
+       __be32 MdDat;                   /* The modification date */
+       __be32 BkDat;                   /* The last backup date */
        struct hfs_dinfo UsrInfo;       /* data used by the Finder */
        struct hfs_dxinfo FndrInfo;     /* more data used by Finder */
        u8 Resrv[16];                   /* reserved by Apple */
@@ -223,7 +223,7 @@ struct hfs_cat_dir {
 struct hfs_cat_thread {
        s8 type;                        /* The type of entry */
        u8 reserved[9];                 /* reserved by Apple */
-       u32 ParID;                      /* CNID of parent directory */
+       __be32 ParID;                   /* CNID of parent directory */
        struct hfs_name CName;          /* The name of this entry */
 }  __packed;
 
@@ -236,43 +236,43 @@ typedef union hfs_cat_rec {
 } hfs_cat_rec;
 
 struct hfs_mdb {
-       u16 drSigWord;                  /* Signature word indicating fs type */
-       u32 drCrDate;                   /* fs creation date/time */
-       u32 drLsMod;                    /* fs modification date/time */
-       u16 drAtrb;                     /* fs attributes */
-       u16 drNmFls;                    /* number of files in root directory */
-       u16 drVBMSt;                    /* location (in 512-byte blocks)
+       __be16 drSigWord;               /* Signature word indicating fs type */
+       __be32 drCrDate;                /* fs creation date/time */
+       __be32 drLsMod;                 /* fs modification date/time */
+       __be16 drAtrb;                  /* fs attributes */
+       __be16 drNmFls;                 /* number of files in root directory */
+       __be16 drVBMSt;                 /* location (in 512-byte blocks)
                                           of the volume bitmap */
-       u16 drAllocPtr;                 /* location (in allocation blocks)
+       __be16 drAllocPtr;              /* location (in allocation blocks)
                                           to begin next allocation search */
-       u16 drNmAlBlks;                 /* number of allocation blocks */
-       u32 drAlBlkSiz;                 /* bytes in an allocation block */
-       u32 drClpSiz;                   /* clumpsize, the number of bytes to
+       __be16 drNmAlBlks;              /* number of allocation blocks */
+       __be32 drAlBlkSiz;              /* bytes in an allocation block */
+       __be32 drClpSiz;                /* clumpsize, the number of bytes to
                                           allocate when extending a file */
-       u16 drAlBlSt;                   /* location (in 512-byte blocks)
+       __be16 drAlBlSt;                /* location (in 512-byte blocks)
                                           of the first allocation block */
-       u32 drNxtCNID;                  /* CNID to assign to the next
+       __be32 drNxtCNID;               /* CNID to assign to the next
                                           file or directory created */
-       u16 drFreeBks;                  /* number of free allocation blocks */
+       __be16 drFreeBks;               /* number of free allocation blocks */
        u8 drVN[28];                    /* the volume label */
-       u32 drVolBkUp;                  /* fs backup date/time */
-       u16 drVSeqNum;                  /* backup sequence number */
-       u32 drWrCnt;                    /* fs write count */
-       u32 drXTClpSiz;                 /* clumpsize for the extents B-tree */
-       u32 drCTClpSiz;                 /* clumpsize for the catalog B-tree */
-       u16 drNmRtDirs;                 /* number of directories in
+       __be32 drVolBkUp;               /* fs backup date/time */
+       __be16 drVSeqNum;               /* backup sequence number */
+       __be32 drWrCnt;                 /* fs write count */
+       __be32 drXTClpSiz;              /* clumpsize for the extents B-tree */
+       __be32 drCTClpSiz;              /* clumpsize for the catalog B-tree */
+       __be16 drNmRtDirs;              /* number of directories in
                                           the root directory */
-       u32 drFilCnt;                   /* number of files in the fs */
-       u32 drDirCnt;                   /* number of directories in the fs */
+       __be32 drFilCnt;                /* number of files in the fs */
+       __be32 drDirCnt;                /* number of directories in the fs */
        u8 drFndrInfo[32];              /* data used by the Finder */
-       u16 drEmbedSigWord;             /* embedded volume signature */
-       u32 drEmbedExtent;              /* starting block number (xdrStABN)
+       __be16 drEmbedSigWord;          /* embedded volume signature */
+       __be32 drEmbedExtent;           /* starting block number (xdrStABN)
                                           and number of allocation blocks
                                           (xdrNumABlks) occupied by embedded
                                           volume */
-       u32 drXTFlSize;                 /* bytes in the extents B-tree */
+       __be32 drXTFlSize;              /* bytes in the extents B-tree */
        hfs_extent_rec drXTExtRec;      /* extents B-tree's first 3 extents */
-       u32 drCTFlSize;                 /* bytes in the catalog B-tree */
+       __be32 drCTFlSize;              /* bytes in the catalog B-tree */
        hfs_extent_rec drCTExtRec;      /* catalog B-tree's first 3 extents */
 } __packed;
 
index 2ea973d20a7c2eb82de561870b3a9c15db8e91a8..ecf33d875c31169e9730e107f6537de50d656f1e 100644 (file)
@@ -90,7 +90,7 @@ struct hfs_sb_info {
        struct buffer_head *alt_mdb_bh;         /* The hfs_buffer holding
                                                   the alternate superblock */
        struct hfs_mdb *alt_mdb;
-       u32 *bitmap;                            /* The page holding the
+       __be32 *bitmap;                         /* The page holding the
                                                   allocation bitmap */
        struct hfs_btree *ext_tree;                     /* Information about
                                                   the extents b-tree */
@@ -129,8 +129,8 @@ struct hfs_sb_info {
                                                   "allocation block" */
        int s_quiet;                            /* Silent failure when
                                                   changing owner or mode? */
-       u32 s_type;                             /* Type for new files */
-       u32 s_creator;                          /* Creator for new files */
+       __be32 s_type;                          /* Type for new files */
+       __be32 s_creator;                       /* Creator for new files */
        umode_t s_file_umask;                   /* The umask applied to the
                                                   permissions on all files */
        umode_t s_dir_umask;                    /* The umask applied to the
@@ -197,11 +197,11 @@ extern struct address_space_operations hfs_aops;
 extern struct address_space_operations hfs_btree_aops;
 
 extern struct inode *hfs_new_inode(struct inode *, struct qstr *, int);
-extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, u32 *, u32 *);
+extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *);
 extern int hfs_write_inode(struct inode *, int);
 extern int hfs_inode_setattr(struct dentry *, struct iattr *);
 extern void hfs_inode_read_fork(struct inode *inode, struct hfs_extent *ext,
-                               u32 log_size, u32 phys_size, u32 clump_size);
+                       __be32 log_size, __be32 phys_size, u32 clump_size);
 extern struct inode *hfs_iget(struct super_block *, struct hfs_cat_key *, hfs_cat_rec *);
 extern void hfs_clear_inode(struct inode *);
 extern void hfs_delete_inode(struct inode *);
index 1bda3a6ae2b403167579ee718360fc663dbbb0ad..6c869f3779648adb008b10403e678001e2ef38c2 100644 (file)
@@ -210,14 +210,14 @@ void hfs_delete_inode(struct inode *inode)
        dprint(DBG_INODE, "delete_inode: %lu\n", inode->i_ino);
        if (S_ISDIR(inode->i_mode)) {
                HFS_SB(sb)->folder_count--;
-               if (HFS_I(inode)->cat_key.ParID == be32_to_cpu(HFS_ROOT_CNID))
+               if (HFS_I(inode)->cat_key.ParID == cpu_to_be32(HFS_ROOT_CNID))
                        HFS_SB(sb)->root_dirs--;
                set_bit(HFS_FLG_MDB_DIRTY, &HFS_SB(sb)->flags);
                sb->s_dirt = 1;
                return;
        }
        HFS_SB(sb)->file_count--;
-       if (HFS_I(inode)->cat_key.ParID == be32_to_cpu(HFS_ROOT_CNID))
+       if (HFS_I(inode)->cat_key.ParID == cpu_to_be32(HFS_ROOT_CNID))
                HFS_SB(sb)->root_files--;
        if (S_ISREG(inode->i_mode)) {
                if (!inode->i_nlink) {
@@ -230,9 +230,10 @@ void hfs_delete_inode(struct inode *inode)
 }
 
 void hfs_inode_read_fork(struct inode *inode, struct hfs_extent *ext,
-                        u32 log_size, u32 phys_size, u32 clump_size)
+                        __be32 __log_size, __be32 phys_size, u32 clump_size)
 {
        struct super_block *sb = inode->i_sb;
+       u32 log_size = be32_to_cpu(__log_size);
        u16 count;
        int i;
 
@@ -241,7 +242,6 @@ void hfs_inode_read_fork(struct inode *inode, struct hfs_extent *ext,
                count += be16_to_cpu(ext[i].count);
        HFS_I(inode)->first_blocks = count;
 
-       log_size = be32_to_cpu(log_size);
        inode->i_size = HFS_I(inode)->phys_size = log_size;
        inode->i_blocks = (log_size + sb->s_blocksize - 1) >> sb->s_blocksize_bits;
        HFS_I(inode)->alloc_blocks = be32_to_cpu(phys_size) /
@@ -370,7 +370,7 @@ struct inode *hfs_iget(struct super_block *sb, struct hfs_cat_key *key, hfs_cat_
 }
 
 void hfs_inode_write_fork(struct inode *inode, struct hfs_extent *ext,
-                         u32 *log_size, u32 *phys_size)
+                         __be32 *log_size, __be32 *phys_size)
 {
        memcpy(ext, HFS_I(inode)->first_extents, sizeof(hfs_extent_rec));
 
index cedb9ab184c38090decb8c28f812fd295a30e969..f90764f658728a0a21af0bd416a2990d723959bb 100644 (file)
@@ -71,7 +71,7 @@ int hfs_mdb_get(struct super_block *sb)
        int off2, len, size, sect;
        sector_t part_start, part_size;
        loff_t off;
-       u16 attrib;
+       __be16 attrib;
 
        /* set the device driver to 512-byte blocks */
        size = sb_min_blocksize(sb, HFS_SECTOR_SIZE);
@@ -164,7 +164,7 @@ int hfs_mdb_get(struct super_block *sb)
                hfs_warn("hfs_fs: continuing without an alternate MDB\n");
        }
 
-       HFS_SB(sb)->bitmap = (u32 *)__get_free_pages(GFP_KERNEL, PAGE_SIZE < 8192 ? 1 : 0);
+       HFS_SB(sb)->bitmap = (__be32 *)__get_free_pages(GFP_KERNEL, PAGE_SIZE < 8192 ? 1 : 0);
        if (!HFS_SB(sb)->bitmap)
                goto out;
 
index 19c189dc74bfd97d70b5f64450f5e057ebb7289c..36add537d153e55ccb362b5b6f82694421b61867 100644 (file)
  * contiguous starting at block 1.
  */
 struct new_pmap {
-       u16     pmSig;          /* signature */
-       u16     reSigPad;       /* padding */
-       u32     pmMapBlkCnt;    /* partition blocks count */
-       u32     pmPyPartStart;  /* physical block start of partition */
-       u32     pmPartBlkCnt;   /* physical block count of partition */
+       __be16  pmSig;          /* signature */
+       __be16  reSigPad;       /* padding */
+       __be32  pmMapBlkCnt;    /* partition blocks count */
+       __be32  pmPyPartStart;  /* physical block start of partition */
+       __be32  pmPartBlkCnt;   /* physical block count of partition */
        u8      pmPartName[32]; /* (null terminated?) string
                                   giving the name of this
                                   partition */
@@ -41,11 +41,11 @@ struct new_pmap {
  * one of these.
  */
 struct old_pmap {
-       u16             pdSig;  /* Signature bytes */
+       __be16          pdSig;  /* Signature bytes */
        struct  old_pmap_entry {
-               u32     pdStart;
-               u32     pdSize;
-               u32     pdFSID;
+               __be32  pdStart;
+               __be32  pdSize;
+               __be32  pdFSID;
        }       pdEntry[42];
 } __packed;
 
@@ -59,7 +59,7 @@ int hfs_part_find(struct super_block *sb,
                  sector_t *part_start, sector_t *part_size)
 {
        struct buffer_head *bh;
-       u16 *data;
+       __be16 *data;
        int i, size, res;
 
        res = -ENOENT;
index 345651903fe0068144101ebabea6adcad2f79603..c773aa763bda84bd5cf3f7163465a659c74b31ab 100644 (file)
@@ -152,8 +152,7 @@ static int parse_options(char *options, struct hfs_sb_info *hsb)
        hsb->s_gid = current->gid;
        hsb->s_file_umask = 0644;
        hsb->s_dir_umask = 0755;
-       hsb->s_type = 0x3f3f3f3f;       /* == '????' */
-       hsb->s_creator = 0x3f3f3f3f;    /* == '????' */
+       hsb->s_type = hsb->s_creator = cpu_to_be32(0x3f3f3f3f); /* == '????' */
        hsb->s_quiet = 0;
        hsb->part = -1;
        hsb->session = -1;
@@ -216,11 +215,11 @@ static int parse_options(char *options, struct hfs_sb_info *hsb)
                } else if (!strcmp(this_char, "type") && value) {
                        if (strlen(value) != 4)
                                return 0;
-                       hsb->s_type = *(u32 *)value;
+                       memcpy(&hsb->s_type, value, 4);
                } else if (!strcmp(this_char, "creator") && value) {
                        if (strlen(value) != 4)
                                return 0;
-                       hsb->s_creator = *(u32 *)value;
+                       memcpy(&hsb->s_creator, value, 4);
        /* Boolean-valued options */
                } else if (!strcmp(this_char, "quiet")) {
                        if (value)