Rev 4263 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4263 | Rev 4327 | ||
---|---|---|---|
Line 74... | Line 74... | ||
74 | ncwd_path_nc = malloc(cwd_size + 1 + size + 1); |
74 | ncwd_path_nc = malloc(cwd_size + 1 + size + 1); |
75 | if (!ncwd_path_nc) { |
75 | if (!ncwd_path_nc) { |
76 | futex_up(&cwd_futex); |
76 | futex_up(&cwd_futex); |
77 | return NULL; |
77 | return NULL; |
78 | } |
78 | } |
79 | str_ncpy(ncwd_path_nc, cwd_path, cwd_size + 1 + size + 1); |
79 | str_cpy(ncwd_path_nc, cwd_size + 1 + size + 1, cwd_path); |
80 | ncwd_path_nc[cwd_size] = '/'; |
80 | ncwd_path_nc[cwd_size] = '/'; |
81 | ncwd_path_nc[cwd_size + 1] = '\0'; |
81 | ncwd_path_nc[cwd_size + 1] = '\0'; |
82 | } else { |
82 | } else { |
83 | ncwd_path_nc = malloc(size + 1); |
83 | ncwd_path_nc = malloc(size + 1); |
84 | if (!ncwd_path_nc) { |
84 | if (!ncwd_path_nc) { |
85 | futex_up(&cwd_futex); |
85 | futex_up(&cwd_futex); |
86 | return NULL; |
86 | return NULL; |
87 | } |
87 | } |
88 | ncwd_path_nc[0] = '\0'; |
88 | ncwd_path_nc[0] = '\0'; |
89 | } |
89 | } |
90 | strcat(ncwd_path_nc, path); |
90 | str_append(ncwd_path_nc, cwd_size + 1 + size + 1, path); |
91 | ncwd_path = canonify(ncwd_path_nc, retlen); |
91 | ncwd_path = canonify(ncwd_path_nc, retlen); |
92 | if (!ncwd_path) { |
92 | if (!ncwd_path) { |
93 | futex_up(&cwd_futex); |
93 | futex_up(&cwd_futex); |
94 | free(ncwd_path_nc); |
94 | free(ncwd_path_nc); |
95 | return NULL; |
95 | return NULL; |
Line 97... | Line 97... | ||
97 | /* |
97 | /* |
98 | * We need to clone ncwd_path because canonify() works in-place and thus |
98 | * We need to clone ncwd_path because canonify() works in-place and thus |
99 | * the address in ncwd_path need not be the same as ncwd_path_nc, even |
99 | * the address in ncwd_path need not be the same as ncwd_path_nc, even |
100 | * though they both point into the same dynamically allocated buffer. |
100 | * though they both point into the same dynamically allocated buffer. |
101 | */ |
101 | */ |
102 | ncwd_path = strdup(ncwd_path); |
102 | ncwd_path = str_dup(ncwd_path); |
103 | free(ncwd_path_nc); |
103 | free(ncwd_path_nc); |
104 | if (!ncwd_path) { |
104 | if (!ncwd_path) { |
105 | futex_up(&cwd_futex); |
105 | futex_up(&cwd_futex); |
106 | return NULL; |
106 | return NULL; |
107 | } |
107 | } |
Line 153... | Line 153... | ||
153 | ipc_hangup(phone); |
153 | ipc_hangup(phone); |
154 | return retval; |
154 | return retval; |
155 | } |
155 | } |
156 | 156 | ||
157 | int mount(const char *fs_name, const char *mp, const char *dev, |
157 | int mount(const char *fs_name, const char *mp, const char *dev, |
158 | const unsigned int flags) |
158 | const char *opts, const unsigned int flags) |
159 | { |
159 | { |
160 | int res; |
160 | int res; |
161 | ipcarg_t rc; |
161 | ipcarg_t rc; |
162 | aid_t req; |
162 | aid_t req; |
163 | dev_handle_t dev_handle; |
163 | dev_handle_t dev_handle; |
Line 183... | Line 183... | ||
183 | futex_up(&vfs_phone_futex); |
183 | futex_up(&vfs_phone_futex); |
184 | free(mpa); |
184 | free(mpa); |
185 | return (int) rc; |
185 | return (int) rc; |
186 | } |
186 | } |
187 | 187 | ||
- | 188 | rc = ipc_data_write_start(vfs_phone, (void *) opts, str_size(opts)); |
|
- | 189 | if (rc != EOK) { |
|
- | 190 | async_wait_for(req, NULL); |
|
- | 191 | async_serialize_end(); |
|
- | 192 | futex_up(&vfs_phone_futex); |
|
- | 193 | free(mpa); |
|
- | 194 | return (int) rc; |
|
- | 195 | } |
|
- | 196 | ||
188 | rc = ipc_data_write_start(vfs_phone, (void *) fs_name, str_size(fs_name)); |
197 | rc = ipc_data_write_start(vfs_phone, (void *) fs_name, str_size(fs_name)); |
189 | if (rc != EOK) { |
198 | if (rc != EOK) { |
190 | async_wait_for(req, NULL); |
199 | async_wait_for(req, NULL); |
191 | async_serialize_end(); |
200 | async_serialize_end(); |
192 | futex_up(&vfs_phone_futex); |
201 | futex_up(&vfs_phone_futex); |
193 | free(mpa); |
202 | free(mpa); |
194 | return (int) rc; |
203 | return (int) rc; |
195 | } |
204 | } |
- | 205 | ||
- | 206 | /* Ask VFS whether it likes fs_name. */ |
|
- | 207 | rc = async_req_0_0(vfs_phone, IPC_M_PING); |
|
- | 208 | if (rc != EOK) { |
|
- | 209 | async_wait_for(req, NULL); |
|
- | 210 | async_serialize_end(); |
|
- | 211 | futex_up(&vfs_phone_futex); |
|
- | 212 | free(mpa); |
|
- | 213 | return (int) rc; |
|
- | 214 | } |
|
196 | 215 | ||
197 | async_wait_for(req, &rc); |
216 | async_wait_for(req, &rc); |
198 | async_serialize_end(); |
217 | async_serialize_end(); |
199 | futex_up(&vfs_phone_futex); |
218 | futex_up(&vfs_phone_futex); |
200 | free(mpa); |
219 | free(mpa); |
Line 532... | Line 551... | ||
532 | futex_down(&cwd_futex); |
551 | futex_down(&cwd_futex); |
533 | if (size < cwd_size + 1) { |
552 | if (size < cwd_size + 1) { |
534 | futex_up(&cwd_futex); |
553 | futex_up(&cwd_futex); |
535 | return NULL; |
554 | return NULL; |
536 | } |
555 | } |
537 | str_ncpy(buf, cwd_path, size); |
556 | str_cpy(buf, size, cwd_path); |
538 | futex_up(&cwd_futex); |
557 | futex_up(&cwd_futex); |
539 | return buf; |
558 | return buf; |
540 | } |
559 | } |
541 | 560 | ||
542 | /** @} |
561 | /** @} |