Changeset e65e406 in mainline


Ignore:
Timestamp:
2011-06-12T14:45:38Z (13 years ago)
Author:
Oleg Romanenko <romanenko.oleg@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c6aca755
Parents:
17fa0280
Message:

Fixes for mips32 big endian.

Location:
uspace/srv/fs/fat
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/fat/fat_dentry.c

    r17fa0280 re65e406  
    4040#include <str.h>
    4141#include <errno.h>
     42#include <byteorder.h>
    4243
    4344static bool is_d_char(const char ch)
     
    307308}
    308309
    309 void fat_lfn_copy_part(const uint8_t *src, size_t src_size, uint8_t *dst, size_t *offset)
     310size_t fat_lfn_copy_part(const uint8_t *src, size_t src_size, uint8_t *dst, size_t offset)
    310311{
    311312        int i;
    312         for (i=src_size-1; i>0 && (*offset)>1; i-=2) {
     313        for (i=src_size-1; i>0 && offset>1; i-=2) {
    313314                if ((src[i] == 0x00 && src[i-1] == 0x00) ||
    314315                        (src[i] == 0xff && src[i-1] == 0xff))
    315316                        continue;
    316                 dst[(*offset)-1] = src[i];
    317                 dst[(*offset)-2] = src[i-1];
    318                 (*offset)-=2;
    319         }
    320 }
    321 
    322 void fat_lfn_copy_entry(const fat_dentry_t *d, uint8_t *dst, size_t *offset)
    323 {
    324         fat_lfn_copy_part(FAT_LFN_PART3(d), FAT_LFN_PART3_SIZE, dst, offset);
    325         fat_lfn_copy_part(FAT_LFN_PART2(d), FAT_LFN_PART2_SIZE, dst, offset);
    326         fat_lfn_copy_part(FAT_LFN_PART1(d), FAT_LFN_PART1_SIZE, dst, offset);
     317                dst[offset-1] = src[i];
     318                dst[offset-2] = src[i-1];
     319                offset-=2;
     320        }
     321        return offset;
     322}
     323
     324size_t fat_lfn_copy_entry(const fat_dentry_t *d, uint8_t *dst, size_t offset)
     325{
     326        offset = fat_lfn_copy_part(FAT_LFN_PART3(d),
     327            FAT_LFN_PART3_SIZE, dst, offset);
     328        offset = fat_lfn_copy_part(FAT_LFN_PART2(d),
     329            FAT_LFN_PART2_SIZE, dst, offset);
     330        offset = fat_lfn_copy_part(FAT_LFN_PART1(d),
     331            FAT_LFN_PART1_SIZE, dst, offset);
     332
     333        return offset;
    327334}
    328335
     
    339346                                return EOVERFLOW;
    340347                } else {
    341                         c = (src[i] << 8) | src[i+1];
     348                        c = uint16_t_le2host((src[i] << 8) | src[i+1]);
    342349                        rc = chr_encode(c, (char*)dst, &offset, dst_size);
    343350                        if (rc!=EOK) {
  • uspace/srv/fs/fat/fat_dentry.h

    r17fa0280 re65e406  
    138138extern size_t fat_lfn_str_nlength(const uint8_t *, size_t);
    139139extern size_t fat_lfn_size(const fat_dentry_t *);
    140 extern void fat_lfn_copy_part(const uint8_t *, size_t, uint8_t *, size_t *);
    141 extern void fat_lfn_copy_entry(const fat_dentry_t *, uint8_t *, size_t *);
     140extern size_t fat_lfn_copy_part(const uint8_t *, size_t, uint8_t *, size_t);
     141extern size_t fat_lfn_copy_entry(const fat_dentry_t *, uint8_t *, size_t);
    142142extern int fat_lfn_convert_name(const uint8_t *, size_t, uint8_t *, size_t);
    143143
  • uspace/srv/fs/fat/fat_directory.c

    r17fa0280 re65e406  
    118118                                        (di->checksum == FAT_LFN_CHKSUM(d))) {
    119119                                        /* Right order! */
    120                                         fat_lfn_copy_entry(d, di->lfn_utf16, &di->lfn_offset);
     120                                        di->lfn_offset = fat_lfn_copy_entry(d, di->lfn_utf16,
     121                                            di->lfn_offset);
    121122                                } else {
    122123                                        /* Something wrong with order. Skip this long entries set */
     
    133134                                                        (FAT_LFN_COUNT(d) - 1)) + fat_lfn_size(d);
    134135                                                di->lfn_offset = di->lfn_size;
    135                                                 fat_lfn_copy_entry(d, di->lfn_utf16, &di->lfn_offset);
     136                                                di->lfn_offset = fat_lfn_copy_entry(d, di->lfn_utf16,
     137                                                    di->lfn_offset);
    136138                                                di->checksum = FAT_LFN_CHKSUM(d);
    137139                                        }
Note: See TracChangeset for help on using the changeset viewer.