Changeset 0182e5cc in mainline for uspace/srv/fs/fat/fat_ops.c


Ignore:
Timestamp:
2011-05-24T19:56:11Z (13 years ago)
Author:
Oleg Romanenko <romanenko.oleg@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1467102
Parents:
88a27f1
Message:
  1. Rewrite and clean fat_get_cluster_fat12
  2. Support MIPS and other arch with only alligned memory access.
  3. Fix incompatibilities with BigEndian.
  4. Tested on IA32 and on MIPS32 EndianBig (GXEmul):

FAT12,16 reading and writing. FAT32 only reading. FAT32 writing - not tested!

  1. Some fixes for FAT32: reading hi and lo part of node cluster number from fat_dentry_t,

but its need more fixes to change size of cluster number from uint16_t to uint32_t etc.

File:
1 edited

Legend:

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

    r88a27f1 r0182e5cc  
    310310
    311311        d = ((fat_dentry_t *)b->data) + (idxp->pdi % DPS(bs));
     312        if (FAT_IS_FAT32(bs)) {
     313                nodep->firstc = uint16_t_le2host(d->firstc_lo) |
     314                    (uint16_t_le2host(d->firstc_hi) << 16);
     315        }
     316        else
     317                nodep->firstc = uint16_t_le2host(d->firstc);
     318
    312319        if (d->attr & FAT_ATTR_SUBDIR) {
    313320                /*
     
    318325                nodep->type = FAT_DIRECTORY;
    319326
    320                 /*
     327                /*
    321328                 * Unfortunately, the 'size' field of the FAT dentry is not
    322329                 * defined for the directory entry type. We must determine the
    323330                 * size of the directory by walking the FAT.
    324331                 */
     332                /* TODO uint16_t clusters to uint32_t */
    325333                uint16_t clusters;
    326                 rc = fat_clusters_get(&clusters, bs, idxp->devmap_handle,
    327                     uint16_t_le2host(d->firstc));
     334                rc = fat_clusters_get(&clusters, bs, idxp->devmap_handle, nodep->firstc);
    328335                if (rc != EOK) {
    329336                        (void) block_put(b);
     
    337344        }
    338345
    339         nodep->firstc = uint16_t_le2host(d->firstc);
    340346        nodep->lnkcnt = 1;
    341347        nodep->refcnt = 1;
     
    10291035                return;
    10301036        }
     1037
    10311038        fs_node_initialize(rfn);
    10321039        fat_node_t *rootp = (fat_node_t *)malloc(sizeof(fat_node_t));
Note: See TracChangeset for help on using the changeset viewer.