Changeset e738d56 in mainline
- Timestamp:
- 2011-12-15T20:01:23Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9ce2202
- Parents:
- 80ec9b8
- Location:
- uspace/srv/fs/exfat
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/exfat/exfat_bitmap.c
r80ec9b8 re738d56 48 48 49 49 50 int bitmap_is_free(exfat_bs_t *bs, service_id_t service_id,50 int exfat_bitmap_is_free(exfat_bs_t *bs, service_id_t service_id, 51 51 exfat_cluster_t clst) 52 52 { … … 89 89 } 90 90 91 int bitmap_set_cluster(exfat_bs_t *bs, service_id_t service_id,91 int exfat_bitmap_set_cluster(exfat_bs_t *bs, service_id_t service_id, 92 92 exfat_cluster_t clst) 93 93 { … … 124 124 } 125 125 126 int bitmap_clear_cluster(exfat_bs_t *bs, service_id_t service_id,126 int exfat_bitmap_clear_cluster(exfat_bs_t *bs, service_id_t service_id, 127 127 exfat_cluster_t clst) 128 128 { … … 160 160 } 161 161 162 int bitmap_set_clusters(exfat_bs_t *bs, service_id_t service_id,162 int exfat_bitmap_set_clusters(exfat_bs_t *bs, service_id_t service_id, 163 163 exfat_cluster_t firstc, exfat_cluster_t count) 164 164 { … … 168 168 169 169 while (clst < firstc + count ) { 170 rc = bitmap_set_cluster(bs, service_id, clst);170 rc = exfat_bitmap_set_cluster(bs, service_id, clst); 171 171 if (rc != EOK) { 172 172 if (clst - firstc > 0) 173 (void) bitmap_clear_clusters(bs, service_id,173 (void) exfat_bitmap_clear_clusters(bs, service_id, 174 174 firstc, clst - firstc); 175 175 return rc; … … 180 180 } 181 181 182 int bitmap_clear_clusters(exfat_bs_t *bs, service_id_t service_id,182 int exfat_bitmap_clear_clusters(exfat_bs_t *bs, service_id_t service_id, 183 183 exfat_cluster_t firstc, exfat_cluster_t count) 184 184 { … … 188 188 189 189 while (clst < firstc + count) { 190 rc = bitmap_clear_cluster(bs, service_id, clst);190 rc = exfat_bitmap_clear_cluster(bs, service_id, clst); 191 191 if (rc != EOK) 192 192 return rc; … … 196 196 } 197 197 198 int bitmap_alloc_clusters(exfat_bs_t *bs, service_id_t service_id,198 int exfat_bitmap_alloc_clusters(exfat_bs_t *bs, service_id_t service_id, 199 199 exfat_cluster_t *firstc, exfat_cluster_t count) 200 200 { … … 204 204 while (startc < DATA_CNT(bs) + 2) { 205 205 endc = startc; 206 while ( bitmap_is_free(bs, service_id, endc) == EOK) {206 while (exfat_bitmap_is_free(bs, service_id, endc) == EOK) { 207 207 if ((endc - startc) + 1 == count) { 208 208 *firstc = startc; 209 return bitmap_set_clusters(bs, service_id, startc, count);209 return exfat_bitmap_set_clusters(bs, service_id, startc, count); 210 210 } else 211 211 endc++; … … 217 217 218 218 219 int bitmap_append_clusters(exfat_bs_t *bs, exfat_node_t *nodep,219 int exfat_bitmap_append_clusters(exfat_bs_t *bs, exfat_node_t *nodep, 220 220 exfat_cluster_t count) 221 221 { 222 222 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, 224 224 &nodep->firstc, count); 225 225 } else { … … 228 228 229 229 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) { 231 231 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, 233 233 lastc + 1, count); 234 234 } else … … 240 240 241 241 242 int bitmap_free_clusters(exfat_bs_t *bs, exfat_node_t *nodep,242 int exfat_bitmap_free_clusters(exfat_bs_t *bs, exfat_node_t *nodep, 243 243 exfat_cluster_t count) 244 244 { … … 247 247 lastc -= count; 248 248 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 253 int exfat_bitmap_replicate_clusters(exfat_bs_t *bs, exfat_node_t *nodep) 254 254 { 255 255 int rc; -
uspace/srv/fs/exfat/exfat_bitmap.h
r80ec9b8 re738d56 42 42 struct exfat_bs; 43 43 44 extern int bitmap_alloc_clusters(struct exfat_bs *, service_id_t,44 extern int exfat_bitmap_alloc_clusters(struct exfat_bs *, service_id_t, 45 45 exfat_cluster_t *, exfat_cluster_t); 46 extern int bitmap_append_clusters(struct exfat_bs *, struct exfat_node *,46 extern int exfat_bitmap_append_clusters(struct exfat_bs *, struct exfat_node *, 47 47 exfat_cluster_t); 48 extern int bitmap_free_clusters(struct exfat_bs *, struct exfat_node *,48 extern int exfat_bitmap_free_clusters(struct exfat_bs *, struct exfat_node *, 49 49 exfat_cluster_t); 50 extern int bitmap_replicate_clusters(struct exfat_bs *, struct exfat_node *);50 extern int exfat_bitmap_replicate_clusters(struct exfat_bs *, struct exfat_node *); 51 51 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,52 extern int exfat_bitmap_is_free(struct exfat_bs *, service_id_t, exfat_cluster_t); 53 extern int exfat_bitmap_set_cluster(struct exfat_bs *, service_id_t, exfat_cluster_t); 54 extern int exfat_bitmap_clear_cluster(struct exfat_bs *, service_id_t, 55 55 exfat_cluster_t); 56 56 57 extern int bitmap_set_clusters(struct exfat_bs *, service_id_t,57 extern int exfat_bitmap_set_clusters(struct exfat_bs *, service_id_t, 58 58 exfat_cluster_t, exfat_cluster_t); 59 extern int bitmap_clear_clusters(struct exfat_bs *, service_id_t,59 extern int exfat_bitmap_clear_clusters(struct exfat_bs *, service_id_t, 60 60 exfat_cluster_t, exfat_cluster_t); 61 61 -
uspace/srv/fs/exfat/exfat_dentry.c
r80ec9b8 re738d56 130 130 } 131 131 132 size_t utf16_length(const uint16_t *wstr)132 size_t exfat_utf16_length(const uint16_t *wstr) 133 133 { 134 134 size_t len = 0; -
uspace/srv/fs/exfat/exfat_dentry.h
r80ec9b8 re738d56 160 160 extern bool exfat_valid_name(const char *); 161 161 162 extern size_t utf16_length(const uint16_t *);162 extern size_t exfat_utf16_length(const uint16_t *); 163 163 164 164 -
uspace/srv/fs/exfat/exfat_directory.c
r80ec9b8 re738d56 371 371 ds.stream.valid_data_size = 0; 372 372 ds.stream.data_size = 0; 373 ds.stream.name_size = utf16_length(wname);373 ds.stream.name_size = exfat_utf16_length(wname); 374 374 ds.stream.hash = host2uint16_t_le(exfat_name_hash(wname, uctable, 375 375 uctable_chars)); -
uspace/srv/fs/exfat/exfat_fat.c
r80ec9b8 re738d56 314 314 clst++) { 315 315 /* 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) { 317 317 /* 318 318 * The cluster is free. Put it into our stack … … 325 325 goto exit_error; 326 326 found++; 327 rc = bitmap_set_cluster(bs, service_id, clst);327 rc = exfat_bitmap_set_cluster(bs, service_id, clst); 328 328 if (rc != EOK) 329 329 goto exit_error; … … 346 346 /* If something wrong - free the clusters */ 347 347 while (found--) { 348 (void) bitmap_clear_cluster(bs, service_id, lifo[found]);348 (void) exfat_bitmap_clear_cluster(bs, service_id, lifo[found]); 349 349 (void) exfat_set_cluster(bs, service_id, lifo[found], 0); 350 350 } … … 378 378 if (rc != EOK) 379 379 return rc; 380 rc = bitmap_clear_cluster(bs, service_id, firstc);380 rc = exfat_bitmap_clear_cluster(bs, service_id, firstc); 381 381 if (rc != EOK) 382 382 return rc; -
uspace/srv/fs/exfat/exfat_ops.c
r80ec9b8 re738d56 405 405 406 406 if (!nodep->fragmented) { 407 rc = bitmap_append_clusters(bs, nodep, clusters);407 rc = exfat_bitmap_append_clusters(bs, nodep, clusters); 408 408 if (rc != ENOSPC) 409 409 return rc; … … 411 411 nodep->fragmented = true; 412 412 nodep->dirty = true; /* need to sync node */ 413 rc = bitmap_replicate_clusters(bs, nodep);413 rc = exfat_bitmap_replicate_clusters(bs, nodep); 414 414 if (rc != EOK) 415 415 return rc; … … 457 457 458 458 clsts = prev_clsts - new_clsts; 459 rc = bitmap_free_clusters(bs, nodep, clsts);459 rc = exfat_bitmap_free_clusters(bs, nodep, clsts); 460 460 if (rc != EOK) 461 461 return rc; … … 704 704 nodep->firstc); 705 705 else 706 rc = bitmap_free_clusters(bs, nodep,706 rc = exfat_bitmap_free_clusters(bs, nodep, 707 707 ROUND_UP(nodep->size, BPC(bs)) / BPC(bs)); 708 708 }
Note:
See TracChangeset
for help on using the changeset viewer.