Changes in uspace/lib/fs/libfs.c [2d884ab:5ed8b72] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/fs/libfs.c
r2d884ab r5ed8b72 45 45 #include <mem.h> 46 46 #include <sys/stat.h> 47 #include <sys/statfs.h> 47 48 #include <stdlib.h> 48 49 … … 74 75 static void libfs_open_node(libfs_ops_t *, fs_handle_t, ipc_callid_t, 75 76 ipc_call_t *); 77 static void libfs_statfs(libfs_ops_t *, fs_handle_t, ipc_callid_t, ipc_call_t *); 76 78 77 79 static void vfs_out_mounted(ipc_callid_t rid, ipc_call_t *req) … … 219 221 } 220 222 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 } 221 227 static void vfs_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg) 222 228 { … … 276 282 case VFS_OUT_SYNC: 277 283 vfs_out_sync(callid, &call); 284 break; 285 case VFS_OUT_STATFS: 286 vfs_out_statfs(callid, &call); 278 287 break; 279 288 default: … … 797 806 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request); 798 807 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 799 808 800 809 fs_node_t *fn; 801 810 int rc = ops->node_get(&fn, service_id, index); 802 811 on_error(rc, answer_and_return(rid, rc)); 803 812 804 813 ipc_callid_t callid; 805 814 size_t size; … … 811 820 return; 812 821 } 813 822 814 823 struct stat stat; 815 824 memset(&stat, 0, sizeof(struct stat)); 816 825 817 826 stat.fs_handle = fs_handle; 818 827 stat.service_id = service_id; … … 823 832 stat.size = ops->size_get(fn); 824 833 stat.service = ops->service_get(fn); 825 834 826 835 ops->node_put(fn); 827 836 837 828 838 async_data_read_finalize(callid, &stat, sizeof(struct stat)); 829 839 async_answer_0(rid, EOK); 830 840 } 841 842 void libfs_statfs(libfs_ops_t *ops, fs_handle_t fs_handle, ipc_callid_t rid, 843 ipc_call_t *request) 844 { 845 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request); 846 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 847 848 fs_node_t *fn; 849 int rc = ops->node_get(&fn, service_id, index); 850 on_error(rc, answer_and_return(rid, rc)); 851 852 ipc_callid_t callid; 853 size_t size; 854 if ((!async_data_read_receive(&callid, &size)) || 855 (size != sizeof(struct statfs))) { 856 goto error; 857 } 858 859 struct statfs st; 860 memset(&st, 0, sizeof(struct statfs)); 861 862 if (ops->size_block != NULL) { 863 rc = ops->size_block(service_id, &st.f_bsize); 864 if (rc != EOK) 865 goto error; 866 } 867 868 if (ops->total_block_count != NULL) { 869 rc = ops->total_block_count(service_id, &st.f_blocks); 870 if (rc != EOK) 871 goto error; 872 } 873 874 if (ops->free_block_count != NULL) { 875 rc = ops->free_block_count(service_id, &st.f_bfree); 876 if (rc != EOK) 877 goto error; 878 } 879 880 ops->node_put(fn); 881 async_data_read_finalize(callid, &st, sizeof(struct statfs)); 882 async_answer_0(rid, EOK); 883 return; 884 885 error: 886 ops->node_put(fn); 887 async_answer_0(callid, EINVAL); 888 async_answer_0(rid, EINVAL); 889 } 890 831 891 832 892 /** Open VFS triplet. … … 882 942 883 943 fibril_mutex_lock(&instances_mutex); 884 list_foreach(instances_list, link) { 885 fs_instance_t *cur = list_get_instance(link, fs_instance_t, 886 link); 887 944 list_foreach(instances_list, link, fs_instance_t, cur) { 888 945 if (cur->service_id == service_id) { 889 946 fibril_mutex_unlock(&instances_mutex); … … 908 965 { 909 966 fibril_mutex_lock(&instances_mutex); 910 list_foreach(instances_list, link) { 911 fs_instance_t *inst = list_get_instance(link, fs_instance_t, 912 link); 913 967 list_foreach(instances_list, link, fs_instance_t, inst) { 914 968 if (inst->service_id == service_id) { 915 969 *idp = inst->data; … … 925 979 { 926 980 fibril_mutex_lock(&instances_mutex); 927 list_foreach(instances_list, link) { 928 fs_instance_t *inst = list_get_instance(link, fs_instance_t, 929 link); 930 981 list_foreach(instances_list, link, fs_instance_t, inst) { 931 982 if (inst->service_id == service_id) { 932 983 list_remove(&inst->link);
Note:
See TracChangeset
for help on using the changeset viewer.