Changeset 77f0a1d in mainline for uspace/srv
- Timestamp:
- 2018-03-22T22:54:52Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- eed4139
- Parents:
- a46e56b
- Location:
- uspace/srv
- Files:
-
- 5 edited
-
clipboard/clipboard.c (modified) (10 diffs)
-
loader/main.c (modified) (17 diffs)
-
vfs/vfs_ipc.c (modified) (17 diffs)
-
vfs/vfs_pager.c (modified) (3 diffs)
-
vfs/vfs_register.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/clipboard/clipboard.c
ra46e56b r77f0a1d 47 47 static service_id_t svc_id; 48 48 49 static void clip_put_data(cap_call_handle_t r id, ipc_call_t *request)49 static void clip_put_data(cap_call_handle_t req_handle, ipc_call_t *request) 50 50 { 51 51 char *data; … … 65 65 66 66 fibril_mutex_unlock(&clip_mtx); 67 async_answer_0(r id, EOK);67 async_answer_0(req_handle, EOK); 68 68 break; 69 69 case CLIPBOARD_TAG_DATA: 70 70 rc = async_data_write_accept((void **) &data, false, 0, 0, 0, &size); 71 71 if (rc != EOK) { 72 async_answer_0(r id, rc);72 async_answer_0(req_handle, rc); 73 73 break; 74 74 } … … 84 84 85 85 fibril_mutex_unlock(&clip_mtx); 86 async_answer_0(r id, EOK);86 async_answer_0(req_handle, EOK); 87 87 break; 88 88 default: 89 async_answer_0(r id, EINVAL);90 } 91 } 92 93 static void clip_get_data(cap_call_handle_t r id, ipc_call_t *request)89 async_answer_0(req_handle, EINVAL); 90 } 91 } 92 93 static void clip_get_data(cap_call_handle_t req_handle, ipc_call_t *request) 94 94 { 95 95 fibril_mutex_lock(&clip_mtx); … … 103 103 if (!async_data_read_receive(&chandle, &size)) { 104 104 async_answer_0(chandle, EINVAL); 105 async_answer_0(r id, EINVAL);105 async_answer_0(req_handle, EINVAL); 106 106 break; 107 107 } … … 110 110 /* So far we only understand binary data */ 111 111 async_answer_0(chandle, EOVERFLOW); 112 async_answer_0(r id, EOVERFLOW);112 async_answer_0(req_handle, EOVERFLOW); 113 113 break; 114 114 } … … 117 117 /* The client expects different size of data */ 118 118 async_answer_0(chandle, EOVERFLOW); 119 async_answer_0(r id, EOVERFLOW);119 async_answer_0(req_handle, EOVERFLOW); 120 120 break; 121 121 } … … 123 123 errno_t retval = async_data_read_finalize(chandle, clip_data, size); 124 124 if (retval != EOK) { 125 async_answer_0(r id, retval);126 break; 127 } 128 129 async_answer_0(r id, EOK);125 async_answer_0(req_handle, retval); 126 break; 127 } 128 129 async_answer_0(req_handle, EOK); 130 130 break; 131 131 default: … … 134 134 * data from the clipbard 135 135 */ 136 async_answer_0(r id, EINVAL);136 async_answer_0(req_handle, EINVAL); 137 137 break; 138 138 } … … 141 141 } 142 142 143 static void clip_content(cap_call_handle_t r id, ipc_call_t *request)143 static void clip_content(cap_call_handle_t req_handle, ipc_call_t *request) 144 144 { 145 145 fibril_mutex_lock(&clip_mtx); … … 149 149 150 150 fibril_mutex_unlock(&clip_mtx); 151 async_answer_2(rid, EOK, (sysarg_t) size, (sysarg_t) tag); 152 } 153 154 static void clip_connection(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg) 151 async_answer_2(req_handle, EOK, (sysarg_t) size, (sysarg_t) tag); 152 } 153 154 static void clip_connection(cap_call_handle_t icall_handle, ipc_call_t *icall, 155 void *arg) 155 156 { 156 157 /* Accept connection */ -
uspace/srv/loader/main.c
ra46e56b r77f0a1d 90 90 static bool connected = false; 91 91 92 static void ldr_get_taskid(cap_call_handle_t r id, ipc_call_t *request)92 static void ldr_get_taskid(cap_call_handle_t req_handle, ipc_call_t *request) 93 93 { 94 94 cap_call_handle_t chandle; … … 100 100 if (!async_data_read_receive(&chandle, &len)) { 101 101 async_answer_0(chandle, EINVAL); 102 async_answer_0(r id, EINVAL);102 async_answer_0(req_handle, EINVAL); 103 103 return; 104 104 } … … 108 108 109 109 async_data_read_finalize(chandle, &task_id, len); 110 async_answer_0(r id, EOK);110 async_answer_0(req_handle, EOK); 111 111 } 112 112 113 113 /** Receive a call setting the current working directory. 114 114 * 115 * @param r id116 * @param request 117 */ 118 static void ldr_set_cwd(cap_call_handle_t r id, ipc_call_t *request)115 * @param req_handle 116 * @param request 117 */ 118 static void ldr_set_cwd(cap_call_handle_t req_handle, ipc_call_t *request) 119 119 { 120 120 char *buf; … … 128 128 } 129 129 130 async_answer_0(r id, rc);130 async_answer_0(req_handle, rc); 131 131 } 132 132 133 133 /** Receive a call setting the program to execute. 134 134 * 135 * @param r id136 * @param request 137 */ 138 static void ldr_set_program(cap_call_handle_t r id, ipc_call_t *request)135 * @param req_handle 136 * @param request 137 */ 138 static void ldr_set_program(cap_call_handle_t req_handle, ipc_call_t *request) 139 139 { 140 140 cap_call_handle_t write_chandle; 141 141 size_t namesize; 142 142 if (!async_data_write_receive(&write_chandle, &namesize)) { 143 async_answer_0(r id, EINVAL);143 async_answer_0(req_handle, EINVAL); 144 144 return; 145 145 } … … 148 148 errno_t rc = async_data_write_finalize(write_chandle, name, namesize); 149 149 if (rc != EOK) { 150 async_answer_0(r id, EINVAL);150 async_answer_0(req_handle, EINVAL); 151 151 return; 152 152 } … … 155 155 rc = vfs_receive_handle(true, &file); 156 156 if (rc != EOK) { 157 async_answer_0(r id, EINVAL);157 async_answer_0(req_handle, EINVAL); 158 158 return; 159 159 } … … 161 161 progname = name; 162 162 program_fd = file; 163 async_answer_0(r id, EOK);163 async_answer_0(req_handle, EOK); 164 164 } 165 165 166 166 /** Receive a call setting arguments of the program to execute. 167 167 * 168 * @param r id169 * @param request 170 */ 171 static void ldr_set_args(cap_call_handle_t r id, ipc_call_t *request)168 * @param req_handle 169 * @param request 170 */ 171 static void ldr_set_args(cap_call_handle_t req_handle, ipc_call_t *request) 172 172 { 173 173 char *buf; … … 194 194 if (_argv == NULL) { 195 195 free(buf); 196 async_answer_0(r id, ENOMEM);196 async_answer_0(req_handle, ENOMEM); 197 197 return; 198 198 } … … 226 226 } 227 227 228 async_answer_0(r id, rc);228 async_answer_0(req_handle, rc); 229 229 } 230 230 231 231 /** Receive a call setting inbox files of the program to execute. 232 232 * 233 * @param r id234 * @param request 235 */ 236 static void ldr_add_inbox(cap_call_handle_t r id, ipc_call_t *request)233 * @param req_handle 234 * @param request 235 */ 236 static void ldr_add_inbox(cap_call_handle_t req_handle, ipc_call_t *request) 237 237 { 238 238 if (inbox_entries == INBOX_MAX_ENTRIES) { 239 async_answer_0(r id, ERANGE);239 async_answer_0(req_handle, ERANGE); 240 240 return; 241 241 } … … 244 244 size_t namesize; 245 245 if (!async_data_write_receive(&write_chandle, &namesize)) { 246 async_answer_0(r id, EINVAL);246 async_answer_0(req_handle, EINVAL); 247 247 return; 248 248 } … … 251 251 errno_t rc = async_data_write_finalize(write_chandle, name, namesize); 252 252 if (rc != EOK) { 253 async_answer_0(r id, EINVAL);253 async_answer_0(req_handle, EINVAL); 254 254 return; 255 255 } … … 258 258 rc = vfs_receive_handle(true, &file); 259 259 if (rc != EOK) { 260 async_answer_0(r id, EINVAL);260 async_answer_0(req_handle, EINVAL); 261 261 return; 262 262 } … … 272 272 inbox[inbox_entries].file = file; 273 273 inbox_entries++; 274 async_answer_0(r id, EOK);274 async_answer_0(req_handle, EOK); 275 275 } 276 276 277 277 /** Load the previously selected program. 278 278 * 279 * @param r id279 * @param req_handle 280 280 * @param request 281 281 * @return 0 on success, !0 on error. 282 282 */ 283 static int ldr_load(cap_call_handle_t r id, ipc_call_t *request)283 static int ldr_load(cap_call_handle_t req_handle, ipc_call_t *request) 284 284 { 285 285 int rc = elf_load(program_fd, &prog_info); 286 286 if (rc != EE_OK) { 287 287 DPRINTF("Failed to load executable for '%s'.\n", progname); 288 async_answer_0(r id, EINVAL);288 async_answer_0(req_handle, EINVAL); 289 289 return 1; 290 290 } … … 300 300 pcb.inbox_entries = inbox_entries; 301 301 302 async_answer_0(r id, EOK);302 async_answer_0(req_handle, EOK); 303 303 return 0; 304 304 } … … 306 306 /** Run the previously loaded program. 307 307 * 308 * @param r id308 * @param req_handle 309 309 * @param request 310 310 * @return 0 on success, !0 on error. 311 311 */ 312 static __attribute__((noreturn)) void ldr_run(cap_call_handle_t r id,312 static __attribute__((noreturn)) void ldr_run(cap_call_handle_t req_handle, 313 313 ipc_call_t *request) 314 314 { … … 320 320 /* Run program */ 321 321 DPRINTF("Reply OK\n"); 322 async_answer_0(r id, EOK);322 async_answer_0(req_handle, EOK); 323 323 DPRINTF("Jump to entry point at %p\n", pcb.entry); 324 324 entry_point_jmp(prog_info.finfo.entry, &pcb); … … 332 332 * to execute the loaded program). 333 333 */ 334 static void ldr_connection(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg) 334 static void ldr_connection(cap_call_handle_t icall_handle, ipc_call_t *icall, 335 void *arg) 335 336 { 336 337 /* Already have a connection? */ -
uspace/srv/vfs/vfs_ipc.c
ra46e56b r77f0a1d 35 35 #include <vfs/canonify.h> 36 36 37 static void vfs_in_clone(cap_call_handle_t r id, ipc_call_t *request)37 static void vfs_in_clone(cap_call_handle_t req_handle, ipc_call_t *request) 38 38 { 39 39 int oldfd = IPC_GET_ARG1(*request); … … 43 43 int outfd = -1; 44 44 errno_t rc = vfs_op_clone(oldfd, newfd, desc, &outfd); 45 async_answer_1(r id, rc, outfd);46 } 47 48 static void vfs_in_fsprobe(cap_call_handle_t r id, ipc_call_t *request)45 async_answer_1(req_handle, rc, outfd); 46 } 47 48 static void vfs_in_fsprobe(cap_call_handle_t req_handle, ipc_call_t *request) 49 49 { 50 50 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request); … … 62 62 FS_NAME_MAXLEN, 0, NULL); 63 63 if (rc != EOK) { 64 async_answer_0(r id, rc);64 async_answer_0(req_handle, rc); 65 65 return; 66 66 } 67 67 68 68 rc = vfs_op_fsprobe(fs_name, service_id, &info); 69 async_answer_0(r id, rc);69 async_answer_0(req_handle, rc); 70 70 if (rc != EOK) 71 71 goto out; … … 83 83 } 84 84 85 static void vfs_in_fstypes(cap_call_handle_t r id, ipc_call_t *request)85 static void vfs_in_fstypes(cap_call_handle_t req_handle, ipc_call_t *request) 86 86 { 87 87 cap_call_handle_t chandle; … … 92 92 rc = vfs_get_fstypes(&fstypes); 93 93 if (rc != EOK) { 94 async_answer_0(r id, ENOMEM);94 async_answer_0(req_handle, ENOMEM); 95 95 return; 96 96 } 97 97 98 98 /* Send size of the data */ 99 async_answer_1(r id, EOK, fstypes.size);99 async_answer_1(req_handle, EOK, fstypes.size); 100 100 101 101 /* Now we should get a read request */ … … 111 111 } 112 112 113 static void vfs_in_mount(cap_call_handle_t r id, ipc_call_t *request)113 static void vfs_in_mount(cap_call_handle_t req_handle, ipc_call_t *request) 114 114 { 115 115 int mpfd = IPC_GET_ARG1(*request); … … 132 132 MAX_MNTOPTS_LEN, 0, NULL); 133 133 if (rc != EOK) { 134 async_answer_0(r id, rc);134 async_answer_0(req_handle, rc); 135 135 return; 136 136 } … … 143 143 if (rc != EOK) { 144 144 free(opts); 145 async_answer_0(r id, rc);145 async_answer_0(req_handle, rc); 146 146 return; 147 147 } … … 150 150 rc = vfs_op_mount(mpfd, service_id, flags, instance, opts, fs_name, 151 151 &outfd); 152 async_answer_1(r id, rc, outfd);152 async_answer_1(req_handle, rc, outfd); 153 153 154 154 free(opts); … … 156 156 } 157 157 158 static void vfs_in_open(cap_call_handle_t r id, ipc_call_t *request)158 static void vfs_in_open(cap_call_handle_t req_handle, ipc_call_t *request) 159 159 { 160 160 int fd = IPC_GET_ARG1(*request); … … 162 162 163 163 errno_t rc = vfs_op_open(fd, mode); 164 async_answer_0(r id, rc);165 } 166 167 static void vfs_in_put(cap_call_handle_t r id, ipc_call_t *request)164 async_answer_0(req_handle, rc); 165 } 166 167 static void vfs_in_put(cap_call_handle_t req_handle, ipc_call_t *request) 168 168 { 169 169 int fd = IPC_GET_ARG1(*request); 170 170 errno_t rc = vfs_op_put(fd); 171 async_answer_0(r id, rc);172 } 173 174 static void vfs_in_read(cap_call_handle_t r id, ipc_call_t *request)171 async_answer_0(req_handle, rc); 172 } 173 174 static void vfs_in_read(cap_call_handle_t req_handle, ipc_call_t *request) 175 175 { 176 176 int fd = IPC_GET_ARG1(*request); … … 180 180 size_t bytes = 0; 181 181 errno_t rc = vfs_op_read(fd, pos, &bytes); 182 async_answer_1(r id, rc, bytes);183 } 184 185 static void vfs_in_rename(cap_call_handle_t r id, ipc_call_t *request)182 async_answer_1(req_handle, rc, bytes); 183 } 184 185 static void vfs_in_rename(cap_call_handle_t req_handle, ipc_call_t *request) 186 186 { 187 187 /* The common base directory. */ … … 219 219 220 220 out: 221 async_answer_0(r id, rc);221 async_answer_0(req_handle, rc); 222 222 223 223 if (old) … … 227 227 } 228 228 229 static void vfs_in_resize(cap_call_handle_t r id, ipc_call_t *request)229 static void vfs_in_resize(cap_call_handle_t req_handle, ipc_call_t *request) 230 230 { 231 231 int fd = IPC_GET_ARG1(*request); 232 232 int64_t size = MERGE_LOUP32(IPC_GET_ARG2(*request), IPC_GET_ARG3(*request)); 233 233 errno_t rc = vfs_op_resize(fd, size); 234 async_answer_0(r id, rc);235 } 236 237 static void vfs_in_stat(cap_call_handle_t r id, ipc_call_t *request)234 async_answer_0(req_handle, rc); 235 } 236 237 static void vfs_in_stat(cap_call_handle_t req_handle, ipc_call_t *request) 238 238 { 239 239 int fd = IPC_GET_ARG1(*request); 240 240 errno_t rc = vfs_op_stat(fd); 241 async_answer_0(r id, rc);242 } 243 244 static void vfs_in_statfs(cap_call_handle_t r id, ipc_call_t *request)241 async_answer_0(req_handle, rc); 242 } 243 244 static void vfs_in_statfs(cap_call_handle_t req_handle, ipc_call_t *request) 245 245 { 246 246 int fd = (int) IPC_GET_ARG1(*request); 247 247 248 248 errno_t rc = vfs_op_statfs(fd); 249 async_answer_0(r id, rc);250 } 251 252 static void vfs_in_sync(cap_call_handle_t r id, ipc_call_t *request)249 async_answer_0(req_handle, rc); 250 } 251 252 static void vfs_in_sync(cap_call_handle_t req_handle, ipc_call_t *request) 253 253 { 254 254 int fd = IPC_GET_ARG1(*request); 255 255 errno_t rc = vfs_op_sync(fd); 256 async_answer_0(r id, rc);257 } 258 259 static void vfs_in_unlink(cap_call_handle_t r id, ipc_call_t *request)256 async_answer_0(req_handle, rc); 257 } 258 259 static void vfs_in_unlink(cap_call_handle_t req_handle, ipc_call_t *request) 260 260 { 261 261 int parentfd = IPC_GET_ARG1(*request); … … 267 267 rc = vfs_op_unlink(parentfd, expectfd, path); 268 268 269 async_answer_0(r id, rc);270 } 271 272 static void vfs_in_unmount(cap_call_handle_t r id, ipc_call_t *request)269 async_answer_0(req_handle, rc); 270 } 271 272 static void vfs_in_unmount(cap_call_handle_t req_handle, ipc_call_t *request) 273 273 { 274 274 int mpfd = IPC_GET_ARG1(*request); 275 275 errno_t rc = vfs_op_unmount(mpfd); 276 async_answer_0(r id, rc);277 } 278 279 static void vfs_in_wait_handle(cap_call_handle_t r id, ipc_call_t *request)276 async_answer_0(req_handle, rc); 277 } 278 279 static void vfs_in_wait_handle(cap_call_handle_t req_handle, ipc_call_t *request) 280 280 { 281 281 bool high_fd = IPC_GET_ARG1(*request); 282 282 int fd = -1; 283 283 errno_t rc = vfs_op_wait_handle(high_fd, &fd); 284 async_answer_1(r id, rc, fd);285 } 286 287 static void vfs_in_walk(cap_call_handle_t r id, ipc_call_t *request)284 async_answer_1(req_handle, rc, fd); 285 } 286 287 static void vfs_in_walk(cap_call_handle_t req_handle, ipc_call_t *request) 288 288 { 289 289 /* … … 301 301 free(path); 302 302 } 303 async_answer_1(r id, rc, fd);304 } 305 306 static void vfs_in_write(cap_call_handle_t r id, ipc_call_t *request)303 async_answer_1(req_handle, rc, fd); 304 } 305 306 static void vfs_in_write(cap_call_handle_t req_handle, ipc_call_t *request) 307 307 { 308 308 int fd = IPC_GET_ARG1(*request); … … 312 312 size_t bytes = 0; 313 313 errno_t rc = vfs_op_write(fd, pos, &bytes); 314 async_answer_1(r id, rc, bytes);314 async_answer_1(req_handle, rc, bytes); 315 315 } 316 316 -
uspace/srv/vfs/vfs_pager.c
ra46e56b r77f0a1d 42 42 #include <as.h> 43 43 44 void vfs_page_in(cap_call_handle_t r id, ipc_call_t *request)44 void vfs_page_in(cap_call_handle_t req_handle, ipc_call_t *request) 45 45 { 46 46 aoff64_t offset = IPC_GET_ARG1(*request); … … 55 55 56 56 if (page == AS_MAP_FAILED) { 57 async_answer_0(r id, ENOMEM);57 async_answer_0(req_handle, ENOMEM); 58 58 return; 59 59 } … … 78 78 } while (total < page_size); 79 79 80 async_answer_1(r id, rc, (sysarg_t) page);80 async_answer_1(req_handle, rc, (sysarg_t) page); 81 81 82 82 /* -
uspace/srv/vfs/vfs_register.c
ra46e56b r77f0a1d 108 108 /** VFS_REGISTER protocol function. 109 109 * 110 * @param r id Hash of the call withthe request.111 * @param request Call structure with the request.112 * 113 */ 114 void vfs_register(cap_call_handle_t r id, ipc_call_t *request)110 * @param req_handle Call handle of the request. 111 * @param request Call structure with the request. 112 * 113 */ 114 void vfs_register(cap_call_handle_t req_handle, ipc_call_t *request) 115 115 { 116 116 dprintf("Processing VFS_REGISTER request received from %zx.\n", … … 124 124 dprintf("Failed to deliver the VFS info into our AS, rc=%d.\n", 125 125 rc); 126 async_answer_0(r id, rc);126 async_answer_0(req_handle, rc); 127 127 return; 128 128 } … … 134 134 if (!fs_info) { 135 135 dprintf("Could not allocate memory for FS info.\n"); 136 async_answer_0(r id, ENOMEM);136 async_answer_0(req_handle, ENOMEM); 137 137 return; 138 138 } … … 146 146 if (!vfs_info_sane(&fs_info->vfs_info)) { 147 147 free(fs_info); 148 async_answer_0(r id, EINVAL);148 async_answer_0(req_handle, EINVAL); 149 149 return; 150 150 } … … 163 163 fibril_mutex_unlock(&fs_list_lock); 164 164 free(fs_info); 165 async_answer_0(r id, EEXIST);165 async_answer_0(req_handle, EEXIST); 166 166 return; 167 167 } … … 184 184 fibril_mutex_unlock(&fs_list_lock); 185 185 free(fs_info); 186 async_answer_0(r id, EINVAL);186 async_answer_0(req_handle, EINVAL); 187 187 return; 188 188 } … … 203 203 free(fs_info); 204 204 async_answer_0(chandle, EINVAL); 205 async_answer_0(r id, EINVAL);205 async_answer_0(req_handle, EINVAL); 206 206 return; 207 207 } … … 217 217 free(fs_info); 218 218 async_answer_0(chandle, EINVAL); 219 async_answer_0(r id, EINVAL);219 async_answer_0(req_handle, EINVAL); 220 220 return; 221 221 } … … 235 235 */ 236 236 fs_info->fs_handle = (fs_handle_t) atomic_postinc(&fs_handle_next); 237 async_answer_1(r id, EOK, (sysarg_t) fs_info->fs_handle);237 async_answer_1(req_handle, EOK, (sysarg_t) fs_info->fs_handle); 238 238 239 239 fibril_condvar_broadcast(&fs_list_cv);
Note:
See TracChangeset
for help on using the changeset viewer.
