Changes in uspace/srv/vfs/vfs_lookup.c [5a6cc679:a35b458] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_lookup.c
r5a6cc679 ra35b458 108 108 */ 109 109 list_append(&entry->plb_link, &plb_entries); 110 110 111 111 fibril_mutex_unlock(&plb_mutex); 112 112 … … 116 116 size_t cnt1 = min(len, (PLB_SIZE - first) + 1); 117 117 size_t cnt2 = len - cnt1; 118 118 119 119 memcpy(&plb[first], path, cnt1); 120 120 memcpy(plb, &path[cnt1], cnt2); … … 145 145 assert(child->fs_handle); 146 146 assert(path != NULL); 147 147 148 148 vfs_lookup_res_t res; 149 149 char component[NAME_MAX + 1]; 150 150 errno_t rc; 151 151 152 152 size_t len; 153 153 char *npath = canonify(path, &len); … … 157 157 } 158 158 path = npath; 159 159 160 160 vfs_triplet_t *triplet; 161 161 162 162 char *slash = str_rchr(path, L'/'); 163 163 if (slash && slash != path) { … … 166 166 goto out; 167 167 } 168 168 169 169 memcpy(component, slash + 1, str_size(slash)); 170 170 *slash = 0; 171 171 172 172 rc = vfs_lookup_internal(base, path, L_DIRECTORY, &res); 173 173 if (rc != EOK) 174 174 goto out; 175 175 triplet = &res.triplet; 176 176 177 177 *slash = '/'; 178 178 } else { … … 181 181 goto out; 182 182 } 183 183 184 184 memcpy(component, path + 1, str_size(path)); 185 185 triplet = (vfs_triplet_t *) base; 186 186 } 187 187 188 188 if (triplet->fs_handle != child->fs_handle || 189 189 triplet->service_id != child->service_id) { … … 191 191 goto out; 192 192 } 193 193 194 194 async_exch_t *exch = vfs_exchange_grab(triplet->fs_handle); 195 195 aid_t req = async_send_3(exch, VFS_OUT_LINK, triplet->service_id, 196 196 triplet->index, child->index, NULL); 197 197 198 198 rc = async_data_write_start(exch, component, str_size(component) + 1); 199 199 errno_t orig_rc; … … 202 202 if (orig_rc != EOK) 203 203 rc = orig_rc; 204 204 205 205 out: 206 206 return rc; … … 212 212 assert(base); 213 213 assert(result); 214 214 215 215 errno_t rc; 216 216 ipc_call_t answer; … … 221 221 async_wait_for(req, &rc); 222 222 vfs_exchange_release(exch); 223 223 224 224 if (rc != EOK) 225 225 return rc; 226 226 227 227 unsigned last = *pfirst + *plen; 228 228 *pfirst = IPC_GET_ARG3(answer) & 0xffff; 229 229 *plen = last - *pfirst; 230 230 231 231 result->triplet.fs_handle = (fs_handle_t) IPC_GET_ARG1(answer); 232 232 result->triplet.service_id = base->service_id; … … 248 248 if (rc != EOK) 249 249 return rc; 250 250 251 251 size_t next = first; 252 252 size_t nlen = len; 253 253 254 254 vfs_lookup_res_t res; 255 255 256 256 /* Resolve path as long as there are mount points to cross. */ 257 257 while (nlen > 0) { … … 261 261 goto out; 262 262 } 263 263 264 264 base = base->mount; 265 265 } 266 266 267 267 rc = out_lookup((vfs_triplet_t *) base, &next, &nlen, lflag, 268 268 &res); 269 269 if (rc != EOK) 270 270 goto out; 271 271 272 272 if (nlen > 0) { 273 273 base = vfs_node_peek(&res); … … 288 288 } 289 289 } 290 290 291 291 assert(nlen == 0); 292 292 rc = EOK; 293 293 294 294 if (result != NULL) { 295 295 /* The found file may be a mount point. Try to cross it. */ … … 303 303 base = nbase; 304 304 } 305 305 306 306 result->triplet = *((vfs_triplet_t *) base); 307 307 result->type = base->type; … … 316 316 *result = res; 317 317 } 318 318 319 319 out: 320 320 plb_clear_entry(&entry, first, len); … … 339 339 assert(base != NULL); 340 340 assert(path != NULL); 341 341 342 342 size_t len; 343 343 errno_t rc; … … 348 348 } 349 349 path = npath; 350 350 351 351 assert(path[0] == '/'); 352 352 … … 367 367 char *slash = str_rchr(path, L'/'); 368 368 vfs_node_t *parent = base; 369 369 370 370 if (slash != path) { 371 371 int tflag = lflag; … … 392 392 rc = _vfs_lookup_internal(base, path, lflag, result, len); 393 393 } 394 394 395 395 return rc; 396 396 }
Note:
See TracChangeset
for help on using the changeset viewer.