Changeset e738d56 in mainline for uspace/srv/fs/exfat/exfat_bitmap.c
- 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
- File:
-
- 1 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;
Note:
See TracChangeset
for help on using the changeset viewer.