Changes in / [224174f:3a67d63] in mainline
- Files:
-
- 3 deleted
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/Makefile.common
r224174f r3a67d63 202 202 $(USPACE_PATH)/app/websrv/websrv \ 203 203 $(USPACE_PATH)/app/date/date \ 204 $(USPACE_PATH)/app/vdemo/vdemo \ 205 $(USPACE_PATH)/app/df/df 204 $(USPACE_PATH)/app/vdemo/vdemo 206 205 207 206 ifeq ($(CONFIG_PCC),y) -
uspace/Makefile
r224174f r3a67d63 80 80 app/vlaunch \ 81 81 app/vterm \ 82 app/df \83 82 srv/clipboard \ 84 83 srv/locsrv \ -
uspace/app/trace/trace.c
r224174f r3a67d63 724 724 o = oper_new("stat", 0, arg_def, V_ERRNO, 0, resp_def); 725 725 proto_add_oper(p, VFS_IN_STAT, o); 726 o = oper_new("statfs", 0, arg_def, V_ERRNO, 0, resp_def);727 proto_add_oper(p, VFS_IN_STATFS, o);728 726 729 727 proto_register(SERVICE_VFS, p); -
uspace/lib/c/generic/vfs/vfs.c
r224174f r3a67d63 43 43 #include <stdio.h> 44 44 #include <sys/stat.h> 45 #include <sys/statfs.h>46 45 #include <sys/types.h> 47 46 #include <ipc/services.h> … … 893 892 } 894 893 895 int statfs(const char *path, struct statfs *statfs)896 {897 sysarg_t rc;898 sysarg_t rc_orig;899 aid_t req;900 size_t pa_size;901 902 char *pa = absolutize(path, &pa_size);903 if (!pa)904 return ENOMEM;905 async_exch_t *exch = vfs_exchange_begin();906 907 req = async_send_0(exch, VFS_IN_STATFS, NULL);908 rc = async_data_write_start(exch, pa, pa_size);909 if (rc != EOK) {910 vfs_exchange_end(exch);911 free(pa);912 async_wait_for(req, &rc_orig);913 if (rc_orig == EOK)914 return (int) rc;915 else916 return (int) rc_orig;917 }918 rc = async_data_read_start(exch, (void *) statfs, sizeof(struct statfs));919 if (rc != EOK) {920 vfs_exchange_end(exch);921 free(pa);922 async_wait_for(req, &rc_orig);923 if (rc_orig == EOK)924 return (int) rc;925 else926 return (int) rc_orig;927 }928 vfs_exchange_end(exch);929 free(pa);930 async_wait_for(req, &rc);931 return rc;932 }933 934 894 /** @} 935 895 */ -
uspace/lib/c/include/ipc/vfs.h
r224174f r3a67d63 82 82 VFS_IN_WAIT_HANDLE, 83 83 VFS_IN_MTAB_GET, 84 VFS_IN_STATFS85 84 } vfs_in_request_t; 86 85 … … 99 98 VFS_OUT_LOOKUP, 100 99 VFS_OUT_DESTROY, 101 VFS_OUT_STATFS,102 100 VFS_OUT_LAST 103 101 } vfs_out_request_t; -
uspace/lib/c/include/vfs/vfs.h
r224174f r3a67d63 44 44 #include "vfs_mtab.h" 45 45 46 47 46 enum vfs_change_state_type { 48 47 VFS_PASS_HANDLE 49 48 }; 50 51 49 52 50 extern char *absolutize(const char *, size_t *); … … 63 61 extern async_exch_t *vfs_exchange_begin(void); 64 62 extern void vfs_exchange_end(async_exch_t *); 63 65 64 #endif 66 65 -
uspace/lib/fs/libfs.c
r224174f r3a67d63 45 45 #include <mem.h> 46 46 #include <sys/stat.h> 47 #include <sys/statfs.h>48 47 #include <stdlib.h> 49 48 … … 75 74 static void libfs_open_node(libfs_ops_t *, fs_handle_t, ipc_callid_t, 76 75 ipc_call_t *); 77 static void libfs_statfs(libfs_ops_t *, fs_handle_t, ipc_callid_t, ipc_call_t *);78 76 79 77 static void vfs_out_mounted(ipc_callid_t rid, ipc_call_t *req) … … 221 219 } 222 220 223 static void vfs_out_statfs(ipc_callid_t rid, ipc_call_t *req)224 {225 libfs_statfs(libfs_ops, reg.fs_handle, rid, req);226 }227 221 static void vfs_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg) 228 222 { … … 282 276 case VFS_OUT_SYNC: 283 277 vfs_out_sync(callid, &call); 284 break;285 case VFS_OUT_STATFS:286 vfs_out_statfs(callid, &call);287 278 break; 288 279 default: … … 839 830 } 840 831 841 void libfs_statfs(libfs_ops_t *ops, fs_handle_t fs_handle, ipc_callid_t rid,842 ipc_call_t *request)843 {844 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request);845 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);846 847 fs_node_t *fn;848 int rc = ops->node_get(&fn, service_id, index);849 on_error(rc, answer_and_return(rid, rc));850 851 ipc_callid_t callid;852 size_t size;853 if ((!async_data_read_receive(&callid, &size)) ||854 (size != sizeof(struct statfs))) {855 ops->node_put(fn);856 async_answer_0(callid, EINVAL);857 async_answer_0(rid, EINVAL);858 return;859 }860 861 struct statfs statfs;862 memset(&statfs, 0, sizeof(struct statfs));863 864 if (NULL != ops->size_block)865 statfs.f_bsize = ops->size_block(service_id);866 867 ops->node_put(fn);868 869 async_data_read_finalize(callid, &statfs, sizeof(struct statfs));870 async_answer_0(rid, EOK);871 }872 873 874 832 /** Open VFS triplet. 875 833 * -
uspace/lib/fs/libfs.h
r224174f r3a67d63 93 93 bool (* is_file)(fs_node_t *); 94 94 service_id_t (* service_get)(fs_node_t *); 95 long (* size_block)(service_id_t);96 95 } libfs_ops_t; 97 96 -
uspace/srv/fs/exfat/exfat_ops.c
r224174f r3a67d63 89 89 static bool exfat_is_file(fs_node_t *node); 90 90 static service_id_t exfat_service_get(fs_node_t *node); 91 static long exfat_size_block(service_id_t);92 91 93 92 /* … … 913 912 } 914 913 915 long exfat_size_block(service_id_t service_id)916 {917 exfat_bs_t *bs;918 bs = block_bb_get(service_id);919 920 return BPC(bs);921 }922 914 923 915 /** libfs operations */ … … 938 930 .is_directory = exfat_is_directory, 939 931 .is_file = exfat_is_file, 940 .service_get = exfat_service_get, 941 .size_block = exfat_size_block 932 .service_get = exfat_service_get 942 933 }; 943 934 -
uspace/srv/fs/ext4fs/ext4fs_ops.c
r224174f r3a67d63 101 101 static bool ext4fs_is_file(fs_node_t *node); 102 102 static service_id_t ext4fs_service_get(fs_node_t *node); 103 static long ext4fs_size_block(service_id_t);104 103 105 104 /* Static variables */ … … 837 836 ext4fs_node_t *enode = EXT4FS_NODE(fn); 838 837 return enode->instance->service_id; 839 }840 841 long ext4fs_size_block(service_id_t service_id)842 {843 ext4fs_instance_t *inst;844 int rc = ext4fs_instance_get(service_id, &inst);845 if (rc != EOK)846 return rc;847 if (NULL == inst)848 return ENOENT;849 ext4_superblock_t *sb = inst->filesystem->superblock;850 uint32_t block_size = ext4_superblock_get_block_size(sb);851 return block_size;852 838 } 853 839 … … 871 857 .is_directory = ext4fs_is_directory, 872 858 .is_file = ext4fs_is_file, 873 .service_get = ext4fs_service_get, 874 .size_block = ext4fs_size_block 859 .service_get = ext4fs_service_get 875 860 }; 876 861 -
uspace/srv/fs/fat/fat_ops.c
r224174f r3a67d63 91 91 static bool fat_is_file(fs_node_t *node); 92 92 static service_id_t fat_service_get(fs_node_t *node); 93 static long fat_size_block(service_id_t);94 93 95 94 /* … … 844 843 } 845 844 846 long fat_size_block(service_id_t service_id)847 {848 fat_bs_t *bs;849 bs = block_bb_get(service_id);850 851 return BPC(bs);852 }853 854 845 /** libfs operations */ 855 846 libfs_ops_t fat_libfs_ops = { … … 869 860 .is_directory = fat_is_directory, 870 861 .is_file = fat_is_file, 871 .service_get = fat_service_get, 872 .size_block = fat_size_block 862 .service_get = fat_service_get 873 863 }; 874 864 -
uspace/srv/fs/mfs/mfs_ops.c
r224174f r3a67d63 64 64 static int mfs_check_sanity(struct mfs_sb_info *sbi); 65 65 static bool is_power_of_two(uint32_t n); 66 static long mfs_size_block(service_id_t service_id);67 66 68 67 static hash_table_t open_nodes; … … 85 84 .destroy = mfs_destroy_node, 86 85 .has_children = mfs_has_children, 87 .lnkcnt_get = mfs_lnkcnt_get, 88 .size_block = mfs_size_block 86 .lnkcnt_get = mfs_lnkcnt_get 89 87 }; 90 88 … … 1131 1129 } 1132 1130 1133 static long1134 mfs_size_block(service_id_t service_id)1135 {1136 long block_size;1137 1138 struct mfs_instance *inst;1139 int rc = mfs_instance_get(service_id, &inst);1140 if (rc != EOK)1141 return rc;1142 if (NULL == inst)1143 return ENOENT;1144 block_size = inst->sbi->block_size;1145 return block_size;1146 }1147 1148 1131 vfs_out_ops_t mfs_ops = { 1149 1132 .mounted = mfs_mounted, -
uspace/srv/vfs/vfs.c
r224174f r3a67d63 130 130 vfs_get_mtab(callid, &call); 131 131 break; 132 case VFS_IN_STATFS:133 vfs_statfs(callid, &call);134 break;135 132 default: 136 133 async_answer_0(callid, ENOTSUP); -
uspace/srv/vfs/vfs.h
r224174f r3a67d63 222 222 extern void vfs_wait_handle(ipc_callid_t, ipc_call_t *); 223 223 extern void vfs_get_mtab(ipc_callid_t, ipc_call_t *); 224 extern void vfs_statfs(ipc_callid_t, ipc_call_t *);225 224 226 225 #endif -
uspace/srv/vfs/vfs_ops.c
r224174f r3a67d63 1418 1418 } 1419 1419 1420 void vfs_statfs(ipc_callid_t rid, ipc_call_t *request)1421 {1422 char *path;1423 int rc = async_data_write_accept((void **) &path, true, 0, 0, 0, NULL);1424 if (rc != EOK) {1425 async_answer_0(rid, rc);1426 return;1427 }1428 1429 ipc_callid_t callid;1430 if (!async_data_read_receive(&callid, NULL)) {1431 free(path);1432 async_answer_0(callid, EINVAL);1433 async_answer_0(rid, EINVAL);1434 return;1435 }1436 1437 vfs_lookup_res_t lr;1438 fibril_rwlock_read_lock(&namespace_rwlock);1439 rc = vfs_lookup_internal(path, L_NONE, &lr, NULL);1440 free(path);1441 if (rc != EOK) {1442 fibril_rwlock_read_unlock(&namespace_rwlock);1443 async_answer_0(callid, rc);1444 async_answer_0(rid, rc);1445 return;1446 }1447 vfs_node_t *node = vfs_node_get(&lr);1448 if (!node) {1449 fibril_rwlock_read_unlock(&namespace_rwlock);1450 async_answer_0(callid, ENOMEM);1451 async_answer_0(rid, ENOMEM);1452 return;1453 }1454 1455 fibril_rwlock_read_unlock(&namespace_rwlock);1456 1457 async_exch_t *exch = vfs_exchange_grab(node->fs_handle);1458 1459 aid_t msg;1460 msg = async_send_3(exch, VFS_OUT_STATFS, node->service_id,1461 node->index, false, NULL);1462 async_forward_fast(callid, exch, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);1463 1464 vfs_exchange_release(exch);1465 1466 sysarg_t rv;1467 async_wait_for(msg, &rv);1468 1469 async_answer_0(rid, rv);1470 1471 vfs_node_put(node);1472 }1473 1474 1420 /** 1475 1421 * @}
Note:
See TracChangeset
for help on using the changeset viewer.