Changes in uspace/lib/fs/libfs.c [5ed8b72:feeac0d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/fs/libfs.c
r5ed8b72 rfeeac0d 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: … … 806 797 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request); 807 798 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 808 799 809 800 fs_node_t *fn; 810 801 int rc = ops->node_get(&fn, service_id, index); 811 802 on_error(rc, answer_and_return(rid, rc)); 812 803 813 804 ipc_callid_t callid; 814 805 size_t size; … … 820 811 return; 821 812 } 822 813 823 814 struct stat stat; 824 815 memset(&stat, 0, sizeof(struct stat)); 825 816 826 817 stat.fs_handle = fs_handle; 827 818 stat.service_id = service_id; … … 832 823 stat.size = ops->size_get(fn); 833 824 stat.service = ops->service_get(fn); 834 825 835 826 ops->node_put(fn); 836 837 827 838 828 async_data_read_finalize(callid, &stat, sizeof(struct stat)); 839 829 async_answer_0(rid, EOK); 840 830 } 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 891 831 892 832 /** Open VFS triplet.
Note:
See TracChangeset
for help on using the changeset viewer.