Changes in uspace/srv/fs/exfat/exfat_bitmap.c [ff0c270:e738d56] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/exfat/exfat_bitmap.c
rff0c270 re738d56 45 45 #include <assert.h> 46 46 #include <fibril_synch.h> 47 #include <malloc.h>48 47 #include <mem.h> 49 48 50 49 51 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, 52 51 exfat_cluster_t clst) 53 52 { … … 90 89 } 91 90 92 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, 93 92 exfat_cluster_t clst) 94 93 { … … 125 124 } 126 125 127 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, 128 127 exfat_cluster_t clst) 129 128 { … … 161 160 } 162 161 163 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, 164 163 exfat_cluster_t firstc, exfat_cluster_t count) 165 164 { … … 169 168 170 169 while (clst < firstc + count ) { 171 rc = bitmap_set_cluster(bs, service_id, clst);170 rc = exfat_bitmap_set_cluster(bs, service_id, clst); 172 171 if (rc != EOK) { 173 172 if (clst - firstc > 0) 174 (void) bitmap_clear_clusters(bs, service_id,173 (void) exfat_bitmap_clear_clusters(bs, service_id, 175 174 firstc, clst - firstc); 176 175 return rc; … … 181 180 } 182 181 183 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, 184 183 exfat_cluster_t firstc, exfat_cluster_t count) 185 184 { … … 189 188 190 189 while (clst < firstc + count) { 191 rc = bitmap_clear_cluster(bs, service_id, clst);190 rc = exfat_bitmap_clear_cluster(bs, service_id, clst); 192 191 if (rc != EOK) 193 192 return rc; … … 197 196 } 198 197 199 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, 200 199 exfat_cluster_t *firstc, exfat_cluster_t count) 201 200 { … … 205 204 while (startc < DATA_CNT(bs) + 2) { 206 205 endc = startc; 207 while ( bitmap_is_free(bs, service_id, endc) == EOK) {206 while (exfat_bitmap_is_free(bs, service_id, endc) == EOK) { 208 207 if ((endc - startc) + 1 == count) { 209 208 *firstc = startc; 210 return bitmap_set_clusters(bs, service_id, startc, count);209 return exfat_bitmap_set_clusters(bs, service_id, startc, count); 211 210 } else 212 211 endc++; … … 218 217 219 218 220 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, 221 220 exfat_cluster_t count) 222 221 { 223 222 if (nodep->firstc == 0) { 224 return bitmap_alloc_clusters(bs, nodep->idx->service_id,223 return exfat_bitmap_alloc_clusters(bs, nodep->idx->service_id, 225 224 &nodep->firstc, count); 226 225 } else { … … 229 228 230 229 clst = lastc + 1; 231 while ( bitmap_is_free(bs, nodep->idx->service_id, clst) == EOK) {230 while (exfat_bitmap_is_free(bs, nodep->idx->service_id, clst) == EOK) { 232 231 if (clst - lastc == count){ 233 return bitmap_set_clusters(bs, nodep->idx->service_id,232 return exfat_bitmap_set_clusters(bs, nodep->idx->service_id, 234 233 lastc + 1, count); 235 234 } else … … 241 240 242 241 243 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, 244 243 exfat_cluster_t count) 245 244 { … … 248 247 lastc -= count; 249 248 250 return bitmap_clear_clusters(bs, nodep->idx->service_id, lastc + 1, count);251 } 252 253 254 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) 255 254 { 256 255 int rc;
Note:
See TracChangeset
for help on using the changeset viewer.