fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / fs / adfs / dir_f.c
index 1c60626..b9b2b27 100644 (file)
@@ -53,7 +53,7 @@ static inline int adfs_readname(char *buf, char *ptr, int maxlen)
 {
        char *old_buf = buf;
 
-       while (*ptr >= ' ' && maxlen--) {
+       while ((unsigned char)*ptr >= ' ' && maxlen--) {
                if (*ptr == '/')
                        *buf++ = '.';
                else
@@ -65,23 +65,6 @@ static inline int adfs_readname(char *buf, char *ptr, int maxlen)
        return buf - old_buf;
 }
 
-static inline void adfs_writename(char *to, char *from, int maxlen)
-{
-       int i;
-
-       for (i = 0; i < maxlen; i++) {
-               if (from[i] == '\0')
-                       break;
-               if (from[i] == '.')
-                       to[i] = '/';
-               else
-                       to[i] = from[i];
-       }
-
-       for (; i < maxlen; i++)
-               to[i] = '\0';
-}
-
 #define ror13(v) ((v >> 13) | (v << 19))
 
 #define dir_u8(idx)                            \
@@ -93,7 +76,7 @@ static inline void adfs_writename(char *to, char *from, int maxlen)
 #define dir_u32(idx)                           \
        ({ int _buf = idx >> blocksize_bits;    \
           int _off = idx - (_buf << blocksize_bits);\
-         *(u32 *)(bh[_buf]->b_data + _off);    \
+         *(__le32 *)(bh[_buf]->b_data + _off); \
        })
 
 #define bufoff(_bh,_idx)                       \
@@ -112,7 +95,7 @@ adfs_dir_checkbyte(const struct adfs_dir *dir)
 {
        struct buffer_head * const *bh = dir->bh;
        const int blocksize_bits = dir->sb->s_blocksize_bits;
-       union { u32 *ptr32; u8 *ptr8; } ptr, end;
+       union { __le32 *ptr32; u8 *ptr8; } ptr, end;
        u32 dircheck = 0;
        int last = 5 - 26;
        int i = 0;
@@ -125,7 +108,7 @@ adfs_dir_checkbyte(const struct adfs_dir *dir)
        do {
                last += 26;
                do {
-                       dircheck = cpu_to_le32(dir_u32(i)) ^ ror13(dircheck);
+                       dircheck = le32_to_cpu(dir_u32(i)) ^ ror13(dircheck);
 
                        i += sizeof(u32);
                } while (i < (last & ~3));
@@ -155,8 +138,8 @@ adfs_dir_checkbyte(const struct adfs_dir *dir)
        end.ptr8 = ptr.ptr8 + 36;
 
        do {
-               unsigned int v = *ptr.ptr32++;
-               dircheck = cpu_to_le32(v) ^ ror13(dircheck);
+               __le32 v = *ptr.ptr32++;
+               dircheck = le32_to_cpu(v) ^ ror13(dircheck);
        } while (ptr.ptr32 < end.ptr32);
 
        return (dircheck ^ (dircheck >> 8) ^ (dircheck >> 16) ^ (dircheck >> 24)) & 0xff;
@@ -165,7 +148,7 @@ adfs_dir_checkbyte(const struct adfs_dir *dir)
 /*
  * Read and check that a directory is valid
  */
-int
+static int
 adfs_dir_read(struct super_block *sb, unsigned long object_id,
              unsigned int size, struct adfs_dir *dir)
 {
@@ -260,7 +243,7 @@ adfs_obj2dir(struct adfs_direntry *de, struct object_info *obj)
  * get a directory entry.  Note that the caller is responsible
  * for holding the relevant locks.
  */
-int
+static int
 __adfs_dir_get(struct adfs_dir *dir, int pos, struct object_info *obj)
 {
        struct super_block *sb = dir->sb;
@@ -290,7 +273,7 @@ __adfs_dir_get(struct adfs_dir *dir, int pos, struct object_info *obj)
        return 0;
 }
 
-int
+static int
 __adfs_dir_put(struct adfs_dir *dir, int pos, struct object_info *obj)
 {
        struct super_block *sb = dir->sb;