Changeset 984a9ba in mainline for uspace/srv/clipboard/clipboard.c
- Timestamp:
- 2018-07-05T09:34:09Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 63d46341
- Parents:
- 76f566d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/clipboard/clipboard.c
r76f566d r984a9ba 47 47 static service_id_t svc_id; 48 48 49 static void clip_put_data( cap_call_handle_t req_handle, ipc_call_t *request)49 static void clip_put_data(ipc_call_t *req) 50 50 { 51 51 char *data; … … 53 53 size_t size; 54 54 55 switch (IPC_GET_ARG1(*req uest)) {55 switch (IPC_GET_ARG1(*req)) { 56 56 case CLIPBOARD_TAG_NONE: 57 57 fibril_mutex_lock(&clip_mtx); … … 65 65 66 66 fibril_mutex_unlock(&clip_mtx); 67 async_answer_0(req _handle, EOK);67 async_answer_0(req, 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(req _handle, rc);72 async_answer_0(req, rc); 73 73 break; 74 74 } … … 84 84 85 85 fibril_mutex_unlock(&clip_mtx); 86 async_answer_0(req _handle, EOK);86 async_answer_0(req, EOK); 87 87 break; 88 88 default: 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)89 async_answer_0(req, EINVAL); 90 } 91 } 92 93 static void clip_get_data(ipc_call_t *req) 94 94 { 95 95 fibril_mutex_lock(&clip_mtx); 96 96 97 cap_call_handle_t chandle;97 ipc_call_t call; 98 98 size_t size; 99 99 100 100 /* Check for clipboard data tag compatibility */ 101 switch (IPC_GET_ARG1(*req uest)) {101 switch (IPC_GET_ARG1(*req)) { 102 102 case CLIPBOARD_TAG_DATA: 103 if (!async_data_read_receive(&c handle, &size)) {104 async_answer_0( chandle, EINVAL);105 async_answer_0(req _handle, EINVAL);103 if (!async_data_read_receive(&call, &size)) { 104 async_answer_0(&call, EINVAL); 105 async_answer_0(req, EINVAL); 106 106 break; 107 107 } … … 109 109 if (clip_tag != CLIPBOARD_TAG_DATA) { 110 110 /* So far we only understand binary data */ 111 async_answer_0( chandle, EOVERFLOW);112 async_answer_0(req _handle, EOVERFLOW);111 async_answer_0(&call, EOVERFLOW); 112 async_answer_0(req, EOVERFLOW); 113 113 break; 114 114 } … … 116 116 if (clip_size != size) { 117 117 /* The client expects different size of data */ 118 async_answer_0( chandle, EOVERFLOW);119 async_answer_0(req _handle, EOVERFLOW);120 break; 121 } 122 123 errno_t retval = async_data_read_finalize( chandle, clip_data, size);118 async_answer_0(&call, EOVERFLOW); 119 async_answer_0(req, EOVERFLOW); 120 break; 121 } 122 123 errno_t retval = async_data_read_finalize(&call, clip_data, size); 124 124 if (retval != EOK) { 125 async_answer_0(req _handle, retval);126 break; 127 } 128 129 async_answer_0(req _handle, EOK);125 async_answer_0(req, retval); 126 break; 127 } 128 129 async_answer_0(req, EOK); 130 130 break; 131 131 default: … … 134 134 * data from the clipbard 135 135 */ 136 async_answer_0(req _handle, EINVAL);136 async_answer_0(req, EINVAL); 137 137 break; 138 138 } … … 141 141 } 142 142 143 static void clip_content( cap_call_handle_t req_handle, ipc_call_t *request)143 static void clip_content(ipc_call_t *req) 144 144 { 145 145 fibril_mutex_lock(&clip_mtx); … … 149 149 150 150 fibril_mutex_unlock(&clip_mtx); 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) 151 async_answer_2(req, EOK, (sysarg_t) size, (sysarg_t) tag); 152 } 153 154 static void clip_connection(ipc_call_t *icall, void *arg) 156 155 { 157 156 /* Accept connection */ 158 async_answer_0(icall _handle, EOK);157 async_answer_0(icall, EOK); 159 158 160 159 while (true) { 161 160 ipc_call_t call; 162 cap_call_handle_t chandle =async_get_call(&call);161 async_get_call(&call); 163 162 164 163 if (!IPC_GET_IMETHOD(call)) … … 167 166 switch (IPC_GET_IMETHOD(call)) { 168 167 case CLIPBOARD_PUT_DATA: 169 clip_put_data( chandle,&call);168 clip_put_data(&call); 170 169 break; 171 170 case CLIPBOARD_GET_DATA: 172 clip_get_data( chandle,&call);171 clip_get_data(&call); 173 172 break; 174 173 case CLIPBOARD_CONTENT: 175 clip_content( chandle,&call);174 clip_content(&call); 176 175 break; 177 176 default: 178 async_answer_0( chandle, ENOENT);177 async_answer_0(&call, ENOENT); 179 178 } 180 179 }
Note:
See TracChangeset
for help on using the changeset viewer.