Changes in uspace/srv/fs/fat/fat_ops.c [472c09d:19f857a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_ops.c
r472c09d r19f857a 45 45 #include <ipc/services.h> 46 46 #include <ipc/devmap.h> 47 #include <macros.h> 47 48 #include <async.h> 48 49 #include <errno.h> 49 #include <str ing.h>50 #include <str.h> 50 51 #include <byteorder.h> 51 52 #include <adt/hash_table.h> … … 79 80 static int fat_has_children(bool *, fs_node_t *); 80 81 static fs_index_t fat_index_get(fs_node_t *); 81 static size_t fat_size_get(fs_node_t *);82 static aoff64_t fat_size_get(fs_node_t *); 82 83 static unsigned fat_lnkcnt_get(fs_node_t *); 83 84 static char fat_plb_get_char(unsigned); … … 722 723 fibril_mutex_lock(&childp->idx->lock); 723 724 724 /* 725 * If possible, create the Sub-directory Identifier Entry and the 726 * Sub-directory Parent Pointer Entry (i.e. "." and ".."). These entries 727 * are not mandatory according to Standard ECMA-107 and HelenOS VFS does 728 * not use them anyway, so this is rather a sign of our good will. 729 */ 730 rc = fat_block_get(&b, bs, childp, 0, BLOCK_FLAGS_NONE); 731 if (rc != EOK) { 725 if (childp->type == FAT_DIRECTORY) { 732 726 /* 733 * Rather than returning an error, simply skip the creation of 734 * these two entries. 727 * If possible, create the Sub-directory Identifier Entry and 728 * the Sub-directory Parent Pointer Entry (i.e. "." and ".."). 729 * These entries are not mandatory according to Standard 730 * ECMA-107 and HelenOS VFS does not use them anyway, so this is 731 * rather a sign of our good will. 735 732 */ 736 goto skip_dots; 737 } 738 d = (fat_dentry_t *)b->data; 739 if (fat_classify_dentry(d) == FAT_DENTRY_LAST || 740 str_cmp(d->name, FAT_NAME_DOT) == 0) { 741 memset(d, 0, sizeof(fat_dentry_t)); 742 str_cpy(d->name, 8, FAT_NAME_DOT); 743 str_cpy(d->ext, 3, FAT_EXT_PAD); 744 d->attr = FAT_ATTR_SUBDIR; 745 d->firstc = host2uint16_t_le(childp->firstc); 746 /* TODO: initialize also the date/time members. */ 747 } 748 d++; 749 if (fat_classify_dentry(d) == FAT_DENTRY_LAST || 750 str_cmp(d->name, FAT_NAME_DOT_DOT) == 0) { 751 memset(d, 0, sizeof(fat_dentry_t)); 752 str_cpy(d->name, 8, FAT_NAME_DOT_DOT); 753 str_cpy(d->ext, 3, FAT_EXT_PAD); 754 d->attr = FAT_ATTR_SUBDIR; 755 d->firstc = (parentp->firstc == FAT_CLST_ROOT) ? 756 host2uint16_t_le(FAT_CLST_RES0) : 757 host2uint16_t_le(parentp->firstc); 758 /* TODO: initialize also the date/time members. */ 759 } 760 b->dirty = true; /* need to sync block */ 761 /* 762 * Ignore the return value as we would have fallen through on error 763 * anyway. 764 */ 765 (void) block_put(b); 733 rc = fat_block_get(&b, bs, childp, 0, BLOCK_FLAGS_NONE); 734 if (rc != EOK) { 735 /* 736 * Rather than returning an error, simply skip the 737 * creation of these two entries. 738 */ 739 goto skip_dots; 740 } 741 d = (fat_dentry_t *) b->data; 742 if ((fat_classify_dentry(d) == FAT_DENTRY_LAST) || 743 (str_cmp((char *) d->name, FAT_NAME_DOT)) == 0) { 744 memset(d, 0, sizeof(fat_dentry_t)); 745 str_cpy((char *) d->name, 8, FAT_NAME_DOT); 746 str_cpy((char *) d->ext, 3, FAT_EXT_PAD); 747 d->attr = FAT_ATTR_SUBDIR; 748 d->firstc = host2uint16_t_le(childp->firstc); 749 /* TODO: initialize also the date/time members. */ 750 } 751 d++; 752 if ((fat_classify_dentry(d) == FAT_DENTRY_LAST) || 753 (str_cmp((char *) d->name, FAT_NAME_DOT_DOT) == 0)) { 754 memset(d, 0, sizeof(fat_dentry_t)); 755 str_cpy((char *) d->name, 8, FAT_NAME_DOT_DOT); 756 str_cpy((char *) d->ext, 3, FAT_EXT_PAD); 757 d->attr = FAT_ATTR_SUBDIR; 758 d->firstc = (parentp->firstc == FAT_CLST_ROOT) ? 759 host2uint16_t_le(FAT_CLST_RES0) : 760 host2uint16_t_le(parentp->firstc); 761 /* TODO: initialize also the date/time members. */ 762 } 763 b->dirty = true; /* need to sync block */ 764 /* 765 * Ignore the return value as we would have fallen through on error 766 * anyway. 767 */ 768 (void) block_put(b); 769 } 766 770 skip_dots: 767 771 … … 912 916 } 913 917 914 size_t fat_size_get(fs_node_t *fn)918 aoff64_t fat_size_get(fs_node_t *fn) 915 919 { 916 920 return FAT_NODE(fn)->size; … … 977 981 /* Accept the mount options */ 978 982 char *opts; 979 int rc = async_ string_receive(&opts, 0, NULL);983 int rc = async_data_write_accept((void **) &opts, true, 0, 0, 0, NULL); 980 984 981 985 if (rc != EOK) { … … 1154 1158 void fat_read(ipc_callid_t rid, ipc_call_t *request) 1155 1159 { 1156 dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request); 1157 fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request); 1158 off_t pos = (off_t)IPC_GET_ARG3(*request); 1160 dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request); 1161 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 1162 aoff64_t pos = 1163 (aoff64_t) MERGE_LOUP32(IPC_GET_ARG3(*request), IPC_GET_ARG4(*request)); 1159 1164 fs_node_t *fn; 1160 1165 fat_node_t *nodep; … … 1220 1225 } else { 1221 1226 unsigned bnum; 1222 off_t spos = pos;1227 aoff64_t spos = pos; 1223 1228 char name[FAT_NAME_LEN + 1 + FAT_EXT_LEN + 1]; 1224 1229 fat_dentry_t *d; … … 1236 1241 bnum = (pos * sizeof(fat_dentry_t)) / bps; 1237 1242 while (bnum < nodep->size / bps) { 1238 off_t o;1243 aoff64_t o; 1239 1244 1240 1245 rc = fat_block_get(&b, bs, nodep, bnum, … … 1292 1297 void fat_write(ipc_callid_t rid, ipc_call_t *request) 1293 1298 { 1294 dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request); 1295 fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request); 1296 off_t pos = (off_t)IPC_GET_ARG3(*request); 1299 dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request); 1300 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 1301 aoff64_t pos = 1302 (aoff64_t) MERGE_LOUP32(IPC_GET_ARG3(*request), IPC_GET_ARG4(*request)); 1297 1303 fs_node_t *fn; 1298 1304 fat_node_t *nodep; … … 1303 1309 unsigned spc; 1304 1310 unsigned bpc; /* bytes per cluster */ 1305 off_t boundary;1311 aoff64_t boundary; 1306 1312 int flags = BLOCK_FLAGS_NONE; 1307 1313 int rc; … … 1449 1455 void fat_truncate(ipc_callid_t rid, ipc_call_t *request) 1450 1456 { 1451 dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request); 1452 fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request); 1453 size_t size = (off_t)IPC_GET_ARG3(*request); 1457 dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request); 1458 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 1459 aoff64_t size = 1460 (aoff64_t) MERGE_LOUP32(IPC_GET_ARG3(*request), IPC_GET_ARG4(*request)); 1454 1461 fs_node_t *fn; 1455 1462 fat_node_t *nodep;
Note:
See TracChangeset
for help on using the changeset viewer.