Changeset 696979ce in mainline for uspace/lib/libc/generic/vfs/vfs.c
- Timestamp:
- 2010-02-06T10:54:21Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5bda2f96
- Parents:
- 3f93cdbe (diff), 25e963a (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/libc/generic/vfs/vfs.c
r3f93cdbe r696979ce 120 120 const char *opts, unsigned int flags) 121 121 { 122 int res; 123 ipcarg_t rc; 124 ipcarg_t rc_orig; 125 aid_t req; 122 int null_id = -1; 123 char null[DEVMAP_NAME_MAXLEN]; 124 125 if (str_cmp(fqdn, "") == 0) { 126 /* No device specified, create a fresh 127 null/%d device instead */ 128 null_id = devmap_null_create(); 129 130 if (null_id == -1) 131 return ENOMEM; 132 133 snprintf(null, DEVMAP_NAME_MAXLEN, "null/%d", null_id); 134 fqdn = null; 135 } 136 126 137 dev_handle_t dev_handle; 127 128 res = devmap_device_get_handle(fqdn, &dev_handle, flags); 129 if (res != EOK) 138 int res = devmap_device_get_handle(fqdn, &dev_handle, flags); 139 if (res != EOK) { 140 if (null_id != -1) 141 devmap_null_destroy(null_id); 142 130 143 return res; 144 } 131 145 132 146 size_t mpa_size; 133 147 char *mpa = absolutize(mp, &mpa_size); 134 if (!mpa) 135 return ENOMEM; 136 137 futex_down(&vfs_phone_futex); 138 async_serialize_start(); 139 vfs_connect(); 140 141 req = async_send_2(vfs_phone, VFS_IN_MOUNT, dev_handle, flags, NULL); 142 rc = async_data_write_start(vfs_phone, (void *) mpa, mpa_size); 148 if (!mpa) { 149 if (null_id != -1) 150 devmap_null_destroy(null_id); 151 152 return ENOMEM; 153 } 154 155 futex_down(&vfs_phone_futex); 156 async_serialize_start(); 157 vfs_connect(); 158 159 ipcarg_t rc_orig; 160 aid_t req = async_send_2(vfs_phone, VFS_IN_MOUNT, dev_handle, flags, NULL); 161 ipcarg_t rc = async_data_write_start(vfs_phone, (void *) mpa, mpa_size); 143 162 if (rc != EOK) { 144 163 async_wait_for(req, &rc_orig); … … 146 165 futex_up(&vfs_phone_futex); 147 166 free(mpa); 167 168 if (null_id != -1) 169 devmap_null_destroy(null_id); 170 148 171 if (rc_orig == EOK) 149 172 return (int) rc; … … 158 181 futex_up(&vfs_phone_futex); 159 182 free(mpa); 160 if (rc_orig == EOK) 161 return (int) rc; 162 else 163 return (int) rc_orig; 164 } 165 183 184 if (null_id != -1) 185 devmap_null_destroy(null_id); 186 187 if (rc_orig == EOK) 188 return (int) rc; 189 else 190 return (int) rc_orig; 191 } 192 166 193 rc = async_data_write_start(vfs_phone, (void *) fs_name, str_size(fs_name)); 167 194 if (rc != EOK) { … … 170 197 futex_up(&vfs_phone_futex); 171 198 free(mpa); 172 if (rc_orig == EOK) 173 return (int) rc; 174 else 175 return (int) rc_orig; 176 } 177 199 200 if (null_id != -1) 201 devmap_null_destroy(null_id); 202 203 if (rc_orig == EOK) 204 return (int) rc; 205 else 206 return (int) rc_orig; 207 } 208 178 209 /* Ask VFS whether it likes fs_name. */ 179 210 rc = async_req_0_0(vfs_phone, IPC_M_PING); … … 183 214 futex_up(&vfs_phone_futex); 184 215 free(mpa); 216 217 if (null_id != -1) 218 devmap_null_destroy(null_id); 219 185 220 if (rc_orig == EOK) 186 221 return (int) rc; … … 193 228 futex_up(&vfs_phone_futex); 194 229 free(mpa); 230 231 if ((rc != EOK) && (null_id != -1)) 232 devmap_null_destroy(null_id); 195 233 196 234 return (int) rc;
Note:
See TracChangeset
for help on using the changeset viewer.