aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hpfs/hpfs_fn.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hpfs/hpfs_fn.h')
-rw-r--r--fs/hpfs/hpfs_fn.h27
1 files changed, 13 insertions, 14 deletions
diff --git a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h
index d10108690ed0..f99377306b13 100644
--- a/fs/hpfs/hpfs_fn.h
+++ b/fs/hpfs/hpfs_fn.h
@@ -84,7 +84,6 @@ struct hpfs_sb_info {
84 unsigned *sb_bmp_dir; /* main bitmap directory */ 84 unsigned *sb_bmp_dir; /* main bitmap directory */
85 unsigned sb_c_bitmap; /* current bitmap */ 85 unsigned sb_c_bitmap; /* current bitmap */
86 unsigned sb_max_fwd_alloc; /* max forwad allocation */ 86 unsigned sb_max_fwd_alloc; /* max forwad allocation */
87 /*unsigned sb_mounting : 1;*/
88 int sb_timeshift; 87 int sb_timeshift;
89}; 88};
90 89
@@ -100,7 +99,7 @@ struct quad_buffer_head {
100static inline dnode_secno de_down_pointer (struct hpfs_dirent *de) 99static inline dnode_secno de_down_pointer (struct hpfs_dirent *de)
101{ 100{
102 CHKCOND(de->down,("HPFS: de_down_pointer: !de->down\n")); 101 CHKCOND(de->down,("HPFS: de_down_pointer: !de->down\n"));
103 return *(dnode_secno *) ((void *) de + de->length - 4); 102 return le32_to_cpu(*(dnode_secno *) ((void *) de + le16_to_cpu(de->length) - 4));
104} 103}
105 104
106/* The first dir entry in a dnode */ 105/* The first dir entry in a dnode */
@@ -114,41 +113,41 @@ static inline struct hpfs_dirent *dnode_first_de (struct dnode *dnode)
114 113
115static inline struct hpfs_dirent *dnode_end_de (struct dnode *dnode) 114static inline struct hpfs_dirent *dnode_end_de (struct dnode *dnode)
116{ 115{
117 CHKCOND(dnode->first_free>=0x14 && dnode->first_free<=0xa00,("HPFS: dnode_end_de: dnode->first_free = %d\n",(int)dnode->first_free)); 116 CHKCOND(le32_to_cpu(dnode->first_free)>=0x14 && le32_to_cpu(dnode->first_free)<=0xa00,("HPFS: dnode_end_de: dnode->first_free = %x\n",(unsigned)le32_to_cpu(dnode->first_free)));
118 return (void *) dnode + dnode->first_free; 117 return (void *) dnode + le32_to_cpu(dnode->first_free);
119} 118}
120 119
121/* The dir entry after dir entry de */ 120/* The dir entry after dir entry de */
122 121
123static inline struct hpfs_dirent *de_next_de (struct hpfs_dirent *de) 122static inline struct hpfs_dirent *de_next_de (struct hpfs_dirent *de)
124{ 123{
125 CHKCOND(de->length>=0x20 && de->length<0x800,("HPFS: de_next_de: de->length = %d\n",(int)de->length)); 124 CHKCOND(le16_to_cpu(de->length)>=0x20 && le16_to_cpu(de->length)<0x800,("HPFS: de_next_de: de->length = %x\n",(unsigned)le16_to_cpu(de->length)));
126 return (void *) de + de->length; 125 return (void *) de + le16_to_cpu(de->length);
127} 126}
128 127
129static inline struct extended_attribute *fnode_ea(struct fnode *fnode) 128static inline struct extended_attribute *fnode_ea(struct fnode *fnode)
130{ 129{
131 return (struct extended_attribute *)((char *)fnode + fnode->ea_offs + fnode->acl_size_s); 130 return (struct extended_attribute *)((char *)fnode + le16_to_cpu(fnode->ea_offs) + le16_to_cpu(fnode->acl_size_s));
132} 131}
133 132
134static inline struct extended_attribute *fnode_end_ea(struct fnode *fnode) 133static inline struct extended_attribute *fnode_end_ea(struct fnode *fnode)
135{ 134{
136 return (struct extended_attribute *)((char *)fnode + fnode->ea_offs + fnode->acl_size_s + fnode->ea_size_s); 135 return (struct extended_attribute *)((char *)fnode + le16_to_cpu(fnode->ea_offs) + le16_to_cpu(fnode->acl_size_s) + le16_to_cpu(fnode->ea_size_s));
137} 136}
138 137
139static inline struct extended_attribute *next_ea(struct extended_attribute *ea) 138static inline struct extended_attribute *next_ea(struct extended_attribute *ea)
140{ 139{
141 return (struct extended_attribute *)((char *)ea + 5 + ea->namelen + ea->valuelen); 140 return (struct extended_attribute *)((char *)ea + 5 + ea->namelen + le16_to_cpu(ea->valuelen));
142} 141}
143 142
144static inline secno ea_sec(struct extended_attribute *ea) 143static inline secno ea_sec(struct extended_attribute *ea)
145{ 144{
146 return *(secno *)((char *)ea + 9 + ea->namelen); 145 return le32_to_cpu(*((secno *)((char *)ea + 9 + ea->namelen)));
147} 146}
148 147
149static inline secno ea_len(struct extended_attribute *ea) 148static inline secno ea_len(struct extended_attribute *ea)
150{ 149{
151 return *(secno *)((char *)ea + 5 + ea->namelen); 150 return le32_to_cpu(*((secno *)((char *)ea + 5 + ea->namelen)));
152} 151}
153 152
154static inline char *ea_data(struct extended_attribute *ea) 153static inline char *ea_data(struct extended_attribute *ea)
@@ -173,13 +172,13 @@ static inline void copy_de(struct hpfs_dirent *dst, struct hpfs_dirent *src)
173 dst->not_8x3 = n; 172 dst->not_8x3 = n;
174} 173}
175 174
176static inline unsigned tstbits(unsigned *bmp, unsigned b, unsigned n) 175static inline unsigned tstbits(u32 *bmp, unsigned b, unsigned n)
177{ 176{
178 int i; 177 int i;
179 if ((b >= 0x4000) || (b + n - 1 >= 0x4000)) return n; 178 if ((b >= 0x4000) || (b + n - 1 >= 0x4000)) return n;
180 if (!((bmp[(b & 0x3fff) >> 5] >> (b & 0x1f)) & 1)) return 1; 179 if (!((le32_to_cpu(bmp[(b & 0x3fff) >> 5]) >> (b & 0x1f)) & 1)) return 1;
181 for (i = 1; i < n; i++) 180 for (i = 1; i < n; i++)
182 if (/*b+i < 0x4000 &&*/ !((bmp[((b+i) & 0x3fff) >> 5] >> ((b+i) & 0x1f)) & 1)) 181 if (!((le32_to_cpu(bmp[((b+i) & 0x3fff) >> 5]) >> ((b+i) & 0x1f)) & 1))
183 return i + 1; 182 return i + 1;
184 return 0; 183 return 0;
185} 184}