Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 151a4e2 in mainline


Ignore:
Timestamp:
2011-08-14T18:10:02Z (10 years ago)
Author:
Oleg Romanenko <romanenko.oleg@…>
Branches:
lfn, master
Children:
d8df2fb
Parents:
cd860fc
Message:

exFAT: using exfat directory api for exfat_node_sync

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

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/exfat/exfat_directory.c

    rcd860fc r151a4e2  
    249249}
    250250
     251int exfat_directory_sync_file(exfat_directory_t *di,
     252    exfat_file_dentry_t *df, exfat_stream_dentry_t *ds)
     253{
     254        return EOK;
     255}
     256
    251257int exfat_directory_write_file(exfat_directory_t *di, const char *name)
    252258{
  • uspace/srv/fs/exfat/exfat_directory.h

    rcd860fc r151a4e2  
    7171extern int exfat_directory_read_file(exfat_directory_t *di, char *name,
    7272    size_t size, exfat_file_dentry_t *df, exfat_stream_dentry_t *ds);
     73extern int exfat_directory_sync_file(exfat_directory_t *di,
     74    exfat_file_dentry_t *df, exfat_stream_dentry_t *ds);
    7375extern int exfat_directory_write_file(exfat_directory_t *di, const char *name);
    7476extern int exfat_directory_erase_file(exfat_directory_t *di, aoff64_t pos);
  • uspace/srv/fs/exfat/exfat_ops.c

    rcd860fc r151a4e2  
    112112static int exfat_node_sync(exfat_node_t *node)
    113113{
    114 //      block_t *b;
    115 //      exfat_bs_t *bs;
    116 //      fat_dentry_t *d;
    117 //      int rc;
    118 
    119 //      assert(node->dirty);
    120 
    121 //      bs = block_bb_get(node->idx->devmap_handle);
    122 
    123         /* Read the block that contains the dentry of interest. */
    124 /*
    125         rc = _fat_block_get(&b, bs, node->idx->devmap_handle, node->idx->pfc,
    126             NULL, (node->idx->pdi * sizeof(fat_dentry_t)) / BPS(bs),
    127             BLOCK_FLAGS_NONE);
    128         if (rc != EOK)
    129                 return rc;
    130 
    131         d = ((fat_dentry_t *)b->data) + (node->idx->pdi % DPS(bs));
    132 
    133         d->firstc = host2uint16_t_le(node->firstc);
    134         if (node->type == FAT_FILE) {
    135                 d->size = host2uint32_t_le(node->size);
    136         } else if (node->type == FAT_DIRECTORY) {
    137                 d->attr = FAT_ATTR_SUBDIR;
    138         }
    139 */
    140         /* TODO: update other fields? (e.g time fields) */
    141 
    142 //      b->dirty = true;                /* need to sync block */
    143 //      rc = block_put(b);
    144 //      return rc;
    145         return EOK;
     114        int rc;
     115        exfat_directory_t di;
     116        exfat_file_dentry_t df;
     117        exfat_stream_dentry_t ds;
     118
     119        if (!(node->type == EXFAT_DIRECTORY || node->type == EXFAT_FILE))
     120                return EOK;
     121
     122        if (node->type == EXFAT_DIRECTORY)
     123                df.attr = EXFAT_ATTR_SUBDIR;
     124        else
     125                df.attr = 0;
     126
     127        ds.firstc = host2uint32_t_le(node->firstc);
     128        if (node->size == 0 && node->firstc == 0) {
     129                ds.flags = 0;
     130        } else {
     131                ds.flags = 1;
     132                ds.flags |= (!node->fragmented << 1);
     133        }
     134        ds.valid_data_size = host2uint64_t_le(node->size);
     135        ds.data_size = host2uint64_t_le(node->size);
     136
     137        exfat_directory_open_parent(&di, node->idx->devmap_handle, node->idx->pfc,
     138            node->idx->parent_fragmented);
     139        rc = exfat_directory_sync_file(&di, &df, &ds);
     140        if (rc != EOK) {
     141                (void) exfat_directory_close(&di);
     142                return rc;
     143        }
     144        return exfat_directory_close(&di);
    146145}
    147146
Note: See TracChangeset for help on using the changeset viewer.