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

Changeset 4546fc3 in mainline


Ignore:
Timestamp:
2012-03-01T13:48:41Z (10 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master
Children:
3d23553, d8269dc
Parents:
68c60b0 (diff), df4fbe1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge mkexfat from Maurizio Lombardi

Files:
4 added
9 edited

Legend:

Unmodified
Added
Removed
  • boot/Makefile.common

    r68c60b0 r4546fc3  
    165165        $(USPACE_PATH)/app/locinfo/locinfo \
    166166        $(USPACE_PATH)/app/mkfat/mkfat \
     167        $(USPACE_PATH)/app/mkexfat/mkexfat \
    167168        $(USPACE_PATH)/app/mkmfs/mkmfs \
    168169        $(USPACE_PATH)/app/lsusb/lsusb \
  • uspace/Makefile

    r68c60b0 r4546fc3  
    4848        app/lsusb \
    4949        app/mkfat \
     50        app/mkexfat \
    5051        app/mkmfs \
    5152        app/redir \
  • uspace/srv/fs/exfat/exfat_bitmap.c

    r68c60b0 r4546fc3  
    4848
    4949
    50 int bitmap_is_free(exfat_bs_t *bs, service_id_t service_id,
     50int exfat_bitmap_is_free(exfat_bs_t *bs, service_id_t service_id,
    5151    exfat_cluster_t clst)
    5252{
     
    8989}
    9090
    91 int bitmap_set_cluster(exfat_bs_t *bs, service_id_t service_id,
     91int exfat_bitmap_set_cluster(exfat_bs_t *bs, service_id_t service_id,
    9292    exfat_cluster_t clst)
    9393{
     
    124124}
    125125
    126 int bitmap_clear_cluster(exfat_bs_t *bs, service_id_t service_id,
     126int exfat_bitmap_clear_cluster(exfat_bs_t *bs, service_id_t service_id,
    127127    exfat_cluster_t clst)
    128128{
     
    160160}
    161161
    162 int bitmap_set_clusters(exfat_bs_t *bs, service_id_t service_id,
     162int exfat_bitmap_set_clusters(exfat_bs_t *bs, service_id_t service_id,
    163163    exfat_cluster_t firstc, exfat_cluster_t count)
    164164{
     
    168168
    169169        while (clst < firstc + count ) {
    170                 rc = bitmap_set_cluster(bs, service_id, clst);
     170                rc = exfat_bitmap_set_cluster(bs, service_id, clst);
    171171                if (rc != EOK) {
    172172                        if (clst - firstc > 0)
    173                                 (void) bitmap_clear_clusters(bs, service_id,
     173                                (void) exfat_bitmap_clear_clusters(bs, service_id,
    174174                                    firstc, clst - firstc);
    175175                        return rc;
     
    180180}
    181181
    182 int bitmap_clear_clusters(exfat_bs_t *bs, service_id_t service_id,
     182int exfat_bitmap_clear_clusters(exfat_bs_t *bs, service_id_t service_id,
    183183    exfat_cluster_t firstc, exfat_cluster_t count)
    184184{
     
    188188
    189189        while (clst < firstc + count) {
    190                 rc = bitmap_clear_cluster(bs, service_id, clst);
     190                rc = exfat_bitmap_clear_cluster(bs, service_id, clst);
    191191                if (rc != EOK)
    192192                        return rc;
     
    196196}
    197197
    198 int bitmap_alloc_clusters(exfat_bs_t *bs, service_id_t service_id,
     198int exfat_bitmap_alloc_clusters(exfat_bs_t *bs, service_id_t service_id,
    199199    exfat_cluster_t *firstc, exfat_cluster_t count)
    200200{
     
    204204        while (startc < DATA_CNT(bs) + 2) {
    205205                endc = startc;
    206                 while (bitmap_is_free(bs, service_id, endc) == EOK) {
     206                while (exfat_bitmap_is_free(bs, service_id, endc) == EOK) {
    207207                        if ((endc - startc) + 1 == count) {
    208208                                *firstc = startc;
    209                                 return bitmap_set_clusters(bs, service_id, startc, count);
     209                                return exfat_bitmap_set_clusters(bs, service_id, startc, count);
    210210                        } else
    211211                                endc++;
     
    217217
    218218
    219 int bitmap_append_clusters(exfat_bs_t *bs, exfat_node_t *nodep,
     219int exfat_bitmap_append_clusters(exfat_bs_t *bs, exfat_node_t *nodep,
    220220    exfat_cluster_t count)
    221221{
    222222        if (nodep->firstc == 0) {
    223                 return bitmap_alloc_clusters(bs, nodep->idx->service_id,
     223                return exfat_bitmap_alloc_clusters(bs, nodep->idx->service_id,
    224224                    &nodep->firstc, count);
    225225        } else {
     
    228228
    229229                clst = lastc + 1;
    230                 while (bitmap_is_free(bs, nodep->idx->service_id, clst) == EOK) {
     230                while (exfat_bitmap_is_free(bs, nodep->idx->service_id, clst) == EOK) {
    231231                        if (clst - lastc == count){
    232                                 return bitmap_set_clusters(bs, nodep->idx->service_id,
     232                                return exfat_bitmap_set_clusters(bs, nodep->idx->service_id,
    233233                                    lastc + 1, count);
    234234                        } else
     
    240240
    241241
    242 int bitmap_free_clusters(exfat_bs_t *bs, exfat_node_t *nodep,
     242int exfat_bitmap_free_clusters(exfat_bs_t *bs, exfat_node_t *nodep,
    243243    exfat_cluster_t count)
    244244{
     
    247247        lastc -= count;
    248248
    249         return bitmap_clear_clusters(bs, nodep->idx->service_id, lastc + 1, count);
    250 }
    251 
    252 
    253 int bitmap_replicate_clusters(exfat_bs_t *bs, exfat_node_t *nodep)
     249        return exfat_bitmap_clear_clusters(bs, nodep->idx->service_id, lastc + 1, count);
     250}
     251
     252
     253int exfat_bitmap_replicate_clusters(exfat_bs_t *bs, exfat_node_t *nodep)
    254254{
    255255        int rc;
  • uspace/srv/fs/exfat/exfat_bitmap.h

    r68c60b0 r4546fc3  
    4242struct exfat_bs;
    4343
    44 extern int bitmap_alloc_clusters(struct exfat_bs *, service_id_t,
     44extern int exfat_bitmap_alloc_clusters(struct exfat_bs *, service_id_t,
    4545    exfat_cluster_t *, exfat_cluster_t);
    46 extern int bitmap_append_clusters(struct exfat_bs *, struct exfat_node *,
     46extern int exfat_bitmap_append_clusters(struct exfat_bs *, struct exfat_node *,
    4747    exfat_cluster_t);
    48 extern int bitmap_free_clusters(struct exfat_bs *, struct exfat_node *,
     48extern int exfat_bitmap_free_clusters(struct exfat_bs *, struct exfat_node *,
    4949    exfat_cluster_t);
    50 extern int bitmap_replicate_clusters(struct exfat_bs *, struct exfat_node *);
     50extern int exfat_bitmap_replicate_clusters(struct exfat_bs *, struct exfat_node *);
    5151
    52 extern int bitmap_is_free(struct exfat_bs *, service_id_t, exfat_cluster_t);
    53 extern int bitmap_set_cluster(struct exfat_bs *, service_id_t, exfat_cluster_t);
    54 extern int bitmap_clear_cluster(struct exfat_bs *, service_id_t,
     52extern int exfat_bitmap_is_free(struct exfat_bs *, service_id_t, exfat_cluster_t);
     53extern int exfat_bitmap_set_cluster(struct exfat_bs *, service_id_t, exfat_cluster_t);
     54extern int exfat_bitmap_clear_cluster(struct exfat_bs *, service_id_t,
    5555    exfat_cluster_t);
    5656
    57 extern int bitmap_set_clusters(struct exfat_bs *, service_id_t,
     57extern int exfat_bitmap_set_clusters(struct exfat_bs *, service_id_t,
    5858    exfat_cluster_t, exfat_cluster_t);
    59 extern int bitmap_clear_clusters(struct exfat_bs *, service_id_t,
     59extern int exfat_bitmap_clear_clusters(struct exfat_bs *, service_id_t,
    6060    exfat_cluster_t, exfat_cluster_t);
    6161
  • uspace/srv/fs/exfat/exfat_dentry.c

    r68c60b0 r4546fc3  
    130130}
    131131
    132 size_t utf16_length(const uint16_t *wstr)
     132size_t exfat_utf16_length(const uint16_t *wstr)
    133133{
    134134        size_t len = 0;
  • uspace/srv/fs/exfat/exfat_dentry.h

    r68c60b0 r4546fc3  
    160160extern bool exfat_valid_name(const char *);
    161161
    162 extern size_t utf16_length(const uint16_t *);
     162extern size_t exfat_utf16_length(const uint16_t *);
    163163
    164164
  • uspace/srv/fs/exfat/exfat_directory.c

    r68c60b0 r4546fc3  
    371371        ds.stream.valid_data_size = 0;
    372372        ds.stream.data_size = 0;
    373         ds.stream.name_size = utf16_length(wname);
     373        ds.stream.name_size = exfat_utf16_length(wname);
    374374        ds.stream.hash = host2uint16_t_le(exfat_name_hash(wname, uctable,
    375375            uctable_chars));
  • uspace/srv/fs/exfat/exfat_fat.c

    r68c60b0 r4546fc3  
    314314            clst++) {
    315315                /* Need to rewrite because of multiple exfat_bitmap_get calls */
    316                 if (bitmap_is_free(bs, service_id, clst) == EOK) {
     316                if (exfat_bitmap_is_free(bs, service_id, clst) == EOK) {
    317317                        /*
    318318                         * The cluster is free. Put it into our stack
     
    325325                                goto exit_error;
    326326                        found++;
    327                         rc = bitmap_set_cluster(bs, service_id, clst);
     327                        rc = exfat_bitmap_set_cluster(bs, service_id, clst);
    328328                        if (rc != EOK)
    329329                                goto exit_error;
     
    346346        /* If something wrong - free the clusters */
    347347        while (found--) {
    348                 (void) bitmap_clear_cluster(bs, service_id, lifo[found]);
     348                (void) exfat_bitmap_clear_cluster(bs, service_id, lifo[found]);
    349349                (void) exfat_set_cluster(bs, service_id, lifo[found], 0);
    350350        }
     
    378378                if (rc != EOK)
    379379                        return rc;
    380                 rc = bitmap_clear_cluster(bs, service_id, firstc);
     380                rc = exfat_bitmap_clear_cluster(bs, service_id, firstc);
    381381                if (rc != EOK)
    382382                        return rc;
  • uspace/srv/fs/exfat/exfat_ops.c

    r68c60b0 r4546fc3  
    405405
    406406        if (!nodep->fragmented) {
    407                 rc = bitmap_append_clusters(bs, nodep, clusters);
     407                rc = exfat_bitmap_append_clusters(bs, nodep, clusters);
    408408                if (rc != ENOSPC)
    409409                        return rc;
     
    411411                        nodep->fragmented = true;
    412412                        nodep->dirty = true;            /* need to sync node */
    413                         rc = bitmap_replicate_clusters(bs, nodep);
     413                        rc = exfat_bitmap_replicate_clusters(bs, nodep);
    414414                        if (rc != EOK)
    415415                                return rc;
     
    457457
    458458                clsts = prev_clsts - new_clsts;
    459                 rc = bitmap_free_clusters(bs, nodep, clsts);
     459                rc = exfat_bitmap_free_clusters(bs, nodep, clsts);
    460460                if (rc != EOK)
    461461                        return rc;
     
    704704                                nodep->firstc);
    705705                else
    706                         rc = bitmap_free_clusters(bs, nodep,
     706                        rc = exfat_bitmap_free_clusters(bs, nodep,
    707707                            ROUND_UP(nodep->size, BPC(bs)) / BPC(bs));
    708708        }
     
    758758
    759759        fibril_mutex_unlock(&parentp->idx->lock);
    760         if (rc != EOK)
    761                 return rc;
    762 
    763760        fibril_mutex_lock(&childp->idx->lock);
    764 
    765761
    766762        childp->idx->pfc = parentp->firstc;
     
    14631459        }
    14641460
    1465         (void) exfat_node_put(fn);
     1461        int rc2 = exfat_node_put(fn);
     1462        if (rc == EOK && rc2 != EOK)
     1463                rc = rc2;
     1464
    14661465        return rc;
    14671466}
Note: See TracChangeset for help on using the changeset viewer.