- Timestamp:
- 2008-10-25T17:48:09Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b4b7187
- Parents:
- 8d32152
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_ops.c
r8d32152 r6f2dfd1 850 850 } 851 851 852 static void fat_fill_gap(fat_node_t *nodep, off_t start, off_t stop) 852 static void 853 fat_fill_gap(fat_node_t *nodep, fat_cluster_t mclst, off_t pos) 853 854 { 854 855 /* TODO */ 856 } 857 858 static int 859 fat_alloc_clusters(unsigned nclsts, fat_cluster_t *mcl, fat_cluster_t *lcl) 860 { 861 return ENOTSUP; /* TODO */ 862 } 863 864 static void 865 fat_append_clusters(fat_node_t *nodep, fat_cluster_t mcl) 866 { 855 867 } 856 868 … … 910 922 * next block size boundary. 911 923 */ 912 if (pos > nodep->size) 913 fat_fill_gap(nodep, nodep->size, pos); 924 fat_fill_gap(nodep, FAT_CLST_RES0, pos); 914 925 b = fat_block_get(nodep, pos / bps); 915 926 (void) ipc_data_write_finalize(callid, b->data + pos % bps, 916 927 bytes); 917 928 b->dirty = true; /* need to sync block */ 929 block_put(b); 918 930 if (pos + bytes > nodep->size) { 919 931 nodep->size = pos + bytes; 920 932 nodep->dirty = true; /* need to sync node */ 921 933 } 922 block_put(b);923 934 fat_node_put(nodep); 924 935 ipc_answer_1(rid, EOK, bytes); … … 929 940 * clusters for the node and zero them out. 930 941 */ 942 int status; 931 943 unsigned nclsts; 932 944 fat_cluster_t mcl, lcl; 945 933 946 nclsts = (ROUND_UP(pos + bytes, bps * spc) - clst_boundary) / 934 bps * spc; 935 936 } 937 947 bps * spc; 948 /* create an independent chain of nclsts clusters in all FATs */ 949 status = fat_alloc_clusters(nclsts, &mcl, &lcl); 950 if (status != EOK) { 951 /* could not allocate a chain of nclsts clusters */ 952 fat_node_put(nodep); 953 ipc_answer_0(callid, status); 954 ipc_answer_0(rid, status); 955 return; 956 } 957 /* zero fill any gaps */ 958 fat_fill_gap(nodep, mcl, pos); 959 b = _fat_block_get(dev_handle, lcl, (pos / bps) % spc); 960 (void) ipc_data_write_finalize(callid, b->data + pos % bps, 961 bytes); 962 b->dirty = true; 963 block_put(b); 964 /* 965 * Append the cluster chain starting in mcl to the end of the 966 * node's cluster chain. 967 */ 968 fat_append_clusters(nodep, mcl); 969 nodep->size = pos + bytes; 970 nodep->dirty = true; 971 fat_node_put(nodep); 972 ipc_answer_1(rid, EOK, bytes); 973 return; 974 } 938 975 } 939 976
Note:
See TracChangeset
for help on using the changeset viewer.