Changeset c9957b6 in mainline for uspace/srv/vfs/vfs_mount.c
- Timestamp:
- 2007-12-22T20:13:59Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a4eb8a60
- Parents:
- 6344851
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_mount.c
r6344851 rc9957b6 80 80 */ 81 81 82 /*83 * Now, we expect the client to send us data with the name of the file84 * system and the path of the mountpoint.85 */86 82 ipc_callid_t callid; 87 83 size_t size; 84 85 /* 86 * Now, we expect the client to send us data with the name of the file 87 * system. 88 */ 88 89 if (!ipc_data_receive(&callid, NULL, &size)) { 89 90 ipc_answer_0(callid, EINVAL); … … 93 94 94 95 /* 95 * There is no sense in receiving data that can't hold a single 96 * character of path. We won't accept data that exceed certain limits 97 * either. 98 */ 99 if ((size < FS_NAME_MAXLEN + 1) || 100 (size > FS_NAME_MAXLEN + MAX_PATH_LEN)) { 101 ipc_answer_0(callid, EINVAL); 102 ipc_answer_0(rid, EINVAL); 103 return; 104 } 105 106 /* 107 * Allocate buffer for the data being received. 96 * Don't receive more than is necessary for storing a full file system 97 * name. 98 */ 99 if (size < 1 || size > FS_NAME_MAXLEN) { 100 ipc_answer_0(callid, EINVAL); 101 ipc_answer_0(rid, EINVAL); 102 return; 103 } 104 105 /* 106 * Deliver the file system name. 107 */ 108 char fs_name[FS_NAME_MAXLEN + 1]; 109 (void) ipc_data_deliver(callid, fs_name, size); 110 fs_name[size] = '\0'; 111 112 /* 113 * Check if we know a file system with the same name as is in fs_name. 114 * This will also give us its file system handle. 115 */ 116 int fs_handle = fs_name_to_handle(fs_name, true); 117 if (!fs_handle) { 118 ipc_answer_0(rid, ENOENT); 119 return; 120 } 121 122 /* 123 * Now, we want the client to send us the mount point. 124 */ 125 if (!ipc_data_receive(&callid, NULL, &size)) { 126 ipc_answer_0(callid, EINVAL); 127 ipc_answer_0(rid, EINVAL); 128 return; 129 } 130 131 /* 132 * Check whether size is reasonable wrt. the mount point. 133 */ 134 if (size < 1 || size > MAX_PATH_LEN) { 135 ipc_answer_0(callid, EINVAL); 136 ipc_answer_0(rid, EINVAL); 137 return; 138 } 139 /* 140 * Allocate buffer for the mount point data being received. 108 141 */ 109 142 uint8_t *buf; … … 116 149 117 150 /* 118 * Deliver the data.151 * Deliver the mount point. 119 152 */ 120 153 (void) ipc_data_deliver(callid, buf, size); 121 122 char fs_name[FS_NAME_MAXLEN + 1];123 memcpy(fs_name, buf, FS_NAME_MAXLEN);124 fs_name[FS_NAME_MAXLEN] = '\0';125 126 /*127 * Check if we know a file system with the same name as is in fs_name.128 * This will also give us its file system handle.129 */130 int fs_handle = fs_name_to_handle(fs_name, true);131 if (!fs_handle) {132 free(buf);133 ipc_answer_0(rid, ENOENT);134 return;135 }136 154 137 155 /* … … 166 184 */ 167 185 futex_down(&unlink_futex); 168 rc = vfs_lookup_internal((char *) (buf + FS_NAME_MAXLEN), 169 size - FS_NAME_MAXLEN, &mp, NULL); 186 rc = vfs_lookup_internal(buf, size, &mp, NULL); 170 187 if (rc != EOK) { 171 188 /* … … 198 215 * We still don't have the root file system mounted. 199 216 */ 200 if ((size - FS_NAME_MAXLEN == strlen("/")) && 201 (buf[FS_NAME_MAXLEN] == '/')) { 217 if ((size == 1) && (buf[0] == '/')) { 202 218 /* 203 219 * For this simple, but important case, we are done.
Note:
See TracChangeset
for help on using the changeset viewer.