Changeset 925a21e in mainline for uspace/lib/c/generic/vfs/vfs.c
- Timestamp:
- 2011-09-24T14:20:29Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5bf76c1
- Parents:
- 867e2555 (diff), 1ab4aca (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/vfs/vfs.c
r867e2555 r925a21e 51 51 #include <assert.h> 52 52 #include <str.h> 53 #include < devmap.h>53 #include <loc.h> 54 54 #include <ipc/vfs.h> 55 #include <ipc/ devmap.h>55 #include <ipc/loc.h> 56 56 57 57 static FIBRIL_MUTEX_INITIALIZE(vfs_mutex); … … 69 69 * 70 70 */ 71 staticasync_exch_t *vfs_exchange_begin(void)71 async_exch_t *vfs_exchange_begin(void) 72 72 { 73 73 fibril_mutex_lock(&vfs_mutex); … … 87 87 * 88 88 */ 89 staticvoid vfs_exchange_end(async_exch_t *exch)89 void vfs_exchange_end(async_exch_t *exch) 90 90 { 91 91 async_exchange_end(exch); … … 142 142 } 143 143 144 int mount(const char *fs_name, const char *mp, const char *fq dn,145 const char *opts, unsigned int flags )144 int mount(const char *fs_name, const char *mp, const char *fqsn, 145 const char *opts, unsigned int flags, unsigned int instance) 146 146 { 147 147 int null_id = -1; 148 char null[ DEVMAP_NAME_MAXLEN];149 150 if (str_cmp(fq dn, "") == 0) {148 char null[LOC_NAME_MAXLEN]; 149 150 if (str_cmp(fqsn, "") == 0) { 151 151 /* No device specified, create a fresh 152 152 null/%d device instead */ 153 null_id = devmap_null_create();153 null_id = loc_null_create(); 154 154 155 155 if (null_id == -1) 156 156 return ENOMEM; 157 157 158 snprintf(null, DEVMAP_NAME_MAXLEN, "null/%d", null_id);159 fq dn = null;160 } 161 162 devmap_handle_t devmap_handle;163 int res = devmap_device_get_handle(fqdn, &devmap_handle, flags);158 snprintf(null, LOC_NAME_MAXLEN, "null/%d", null_id); 159 fqsn = null; 160 } 161 162 service_id_t service_id; 163 int res = loc_service_get_id(fqsn, &service_id, flags); 164 164 if (res != EOK) { 165 165 if (null_id != -1) 166 devmap_null_destroy(null_id);166 loc_null_destroy(null_id); 167 167 168 168 return res; … … 173 173 if (!mpa) { 174 174 if (null_id != -1) 175 devmap_null_destroy(null_id);175 loc_null_destroy(null_id); 176 176 177 177 return ENOMEM; … … 181 181 182 182 sysarg_t rc_orig; 183 aid_t req = async_send_2(exch, VFS_IN_MOUNT, devmap_handle, flags, NULL); 183 aid_t req = async_send_3(exch, VFS_IN_MOUNT, service_id, flags, 184 instance, NULL); 184 185 sysarg_t rc = async_data_write_start(exch, (void *) mpa, mpa_size); 185 186 if (rc != EOK) { … … 189 190 190 191 if (null_id != -1) 191 devmap_null_destroy(null_id);192 loc_null_destroy(null_id); 192 193 193 194 if (rc_orig == EOK) … … 204 205 205 206 if (null_id != -1) 206 devmap_null_destroy(null_id);207 loc_null_destroy(null_id); 207 208 208 209 if (rc_orig == EOK) … … 219 220 220 221 if (null_id != -1) 221 devmap_null_destroy(null_id);222 loc_null_destroy(null_id); 222 223 223 224 if (rc_orig == EOK) … … 235 236 236 237 if (null_id != -1) 237 devmap_null_destroy(null_id);238 loc_null_destroy(null_id); 238 239 239 240 if (rc_orig == EOK) … … 248 249 249 250 if ((rc != EOK) && (null_id != -1)) 250 devmap_null_destroy(null_id);251 loc_null_destroy(null_id); 251 252 252 253 return (int) rc; … … 327 328 328 329 return ret; 329 }330 331 int open_node(fdi_node_t *node, int oflag)332 {333 async_exch_t *exch = vfs_exchange_begin();334 335 ipc_call_t answer;336 aid_t req = async_send_4(exch, VFS_IN_OPEN_NODE, node->fs_handle,337 node->devmap_handle, node->index, oflag, &answer);338 339 vfs_exchange_end(exch);340 341 sysarg_t rc;342 async_wait_for(req, &rc);343 344 if (rc != EOK)345 return (int) rc;346 347 return (int) IPC_GET_ARG1(answer);348 330 } 349 331 … … 673 655 async_exch_t *exch = vfs_exchange_begin(); 674 656 675 req = async_send_ 0(exch, VFS_IN_UNLINK, NULL);657 req = async_send_1(exch, VFS_IN_UNLINK, lflag, NULL); 676 658 rc = async_data_write_start(exch, pa, pa_size); 677 659 if (rc != EOK) { … … 811 793 } 812 794 813 if (!stat. device) {795 if (!stat.service) { 814 796 errno = ENOENT; 815 797 return NULL; 816 798 } 817 799 818 return devmap_device_connect(mgmt, stat.device, 0); 819 } 820 821 int fd_node(int fildes, fdi_node_t *node) 822 { 823 struct stat stat; 824 int rc = fstat(fildes, &stat); 825 826 if (rc == EOK) { 827 node->fs_handle = stat.fs_handle; 828 node->devmap_handle = stat.devmap_handle; 829 node->index = stat.index; 830 } 831 832 return rc; 800 return loc_service_connect(mgmt, stat.service, 0); 833 801 } 834 802 … … 848 816 } 849 817 818 int fd_wait(void) 819 { 820 async_exch_t *exch = vfs_exchange_begin(); 821 822 sysarg_t ret; 823 sysarg_t rc = async_req_0_1(exch, VFS_IN_WAIT_HANDLE, &ret); 824 825 vfs_exchange_end(exch); 826 827 if (rc == EOK) 828 return (int) ret; 829 830 return (int) rc; 831 } 832 850 833 /** @} 851 834 */
Note:
See TracChangeset
for help on using the changeset viewer.