Changeset 903bac0a in mainline for uspace/app/init/init.c
- Timestamp:
- 2011-08-19T09:00:38Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e2ab36f1
- Parents:
- d894fbd (diff), 42a619b (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/app/init/init.c
rd894fbd r903bac0a 46 46 #include <macros.h> 47 47 #include <str.h> 48 #include < devmap.h>48 #include <loc.h> 49 49 #include <str_error.h> 50 50 #include "init.h" … … 53 53 #define ROOT_MOUNT_POINT "/" 54 54 55 #define DEVFS_FS_TYPE "devfs"56 #define DEVFS_MOUNT_POINT "/dev"55 #define LOCFS_FS_TYPE "locfs" 56 #define LOCFS_MOUNT_POINT "/loc" 57 57 58 58 #define TMPFS_FS_TYPE "tmpfs" … … 66 66 #define APP_GETTERM "/app/getterm" 67 67 68 /** Print banner */ 68 69 static void info_print(void) 69 70 { … … 71 72 } 72 73 74 /** Report mount operation success */ 73 75 static bool mount_report(const char *desc, const char *mntpt, 74 76 const char *fstype, const char *dev, int rc) … … 100 102 } 101 103 104 /** Mount root filesystem 105 * 106 * The operation blocks until the root filesystem 107 * server is ready for mounting. 108 * 109 * @param[in] fstype Root filesystem type. 110 * 111 * @return True on success. 112 * @return False on failure. 113 * 114 */ 102 115 static bool mount_root(const char *fstype) 103 116 { … … 113 126 } 114 127 115 static bool mount_devfs(void) 116 { 117 int rc = mount(DEVFS_FS_TYPE, DEVFS_MOUNT_POINT, "", "", 128 /** Mount locfs filesystem 129 * 130 * The operation blocks until the locfs filesystem 131 * server is ready for mounting. 132 * 133 * @return True on success. 134 * @return False on failure. 135 * 136 */ 137 static bool mount_locfs(void) 138 { 139 int rc = mount(LOCFS_FS_TYPE, LOCFS_MOUNT_POINT, "", "", 118 140 IPC_FLAG_BLOCKING); 119 return mount_report(" Device filesystem", DEVFS_MOUNT_POINT, DEVFS_FS_TYPE,120 NULL, rc);141 return mount_report("Location service filesystem", LOCFS_MOUNT_POINT, 142 LOCFS_FS_TYPE, NULL, rc); 121 143 } 122 144 … … 157 179 rc = task_wait(id, &texit, &retval); 158 180 if (rc != EOK) { 159 printf("%s: Error waiting for %s (%s (\n", NAME, fname,181 printf("%s: Error waiting for %s (%s)\n", NAME, fname, 160 182 str_error(rc)); 161 183 return; … … 174 196 } 175 197 176 static void console(const char * dev)177 { 178 printf("%s: Spawning %s %s\n", NAME, SRV_CONSOLE, dev);179 180 /* Wait for the input device to be ready */181 devmap_handle_t handle;182 int rc = devmap_device_get_handle(dev, &handle, IPC_FLAG_BLOCKING);183 if (rc != EOK) { 184 printf("%s: Error waiting on %s (%s)\n", NAME, dev,185 str_error(rc)); 186 return; 187 } 188 189 rc = task_spawnl(NULL, SRV_CONSOLE, SRV_CONSOLE, dev, NULL);198 static void console(const char *svc) 199 { 200 printf("%s: Spawning %s %s\n", NAME, SRV_CONSOLE, svc); 201 202 /* Wait for the input service to be ready */ 203 service_id_t service_id; 204 int rc = loc_service_get_id(svc, &service_id, IPC_FLAG_BLOCKING); 205 if (rc != EOK) { 206 printf("%s: Error waiting on %s (%s)\n", NAME, svc, 207 str_error(rc)); 208 return; 209 } 210 211 rc = task_spawnl(NULL, SRV_CONSOLE, SRV_CONSOLE, svc, NULL); 190 212 if (rc != EOK) { 191 213 printf("%s: Error spawning %s %s (%s)\n", NAME, SRV_CONSOLE, 192 dev, str_error(rc));193 } 194 } 195 196 static void getterm(const char * dev, const char *app, bool wmsg)197 { 198 char term[ DEVMAP_NAME_MAXLEN];214 svc, str_error(rc)); 215 } 216 } 217 218 static void getterm(const char *svc, const char *app, bool wmsg) 219 { 220 char term[LOC_NAME_MAXLEN]; 199 221 int rc; 200 222 201 snprintf(term, DEVMAP_NAME_MAXLEN, "%s/%s", DEVFS_MOUNT_POINT, dev);223 snprintf(term, LOC_NAME_MAXLEN, "%s/%s", LOCFS_MOUNT_POINT, svc); 202 224 203 225 printf("%s: Spawning %s %s %s\n", NAME, APP_GETTERM, term, app); 204 226 205 /* Wait for the terminal device to be ready */206 devmap_handle_t handle;207 rc = devmap_device_get_handle(dev, &handle, IPC_FLAG_BLOCKING);227 /* Wait for the terminal service to be ready */ 228 service_id_t service_id; 229 rc = loc_service_get_id(svc, &service_id, IPC_FLAG_BLOCKING); 208 230 if (rc != EOK) { 209 231 printf("%s: Error waiting on %s (%s)\n", NAME, term, … … 257 279 } 258 280 259 spawn("/srv/ devfs");281 spawn("/srv/locfs"); 260 282 spawn("/srv/taskmon"); 261 283 262 if (!mount_ devfs()) {284 if (!mount_locfs()) { 263 285 printf("%s: Exiting\n", NAME); 264 286 return -2;
Note:
See TracChangeset
for help on using the changeset viewer.