Changes in uspace/app/init/init.c [28be7fa:5ebdf94] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/init/init.c
r28be7fa r5ebdf94 50 50 #include "init.h" 51 51 52 #define DEVFS_MOUNT_POINT "/dev"53 54 #define SRV_CONSOLE "/srv/console"55 #define APP_GETTERM "/app/getterm"56 57 52 static void info_print(void) 58 53 { … … 63 58 { 64 59 char *opts = ""; 65 const char *root_dev = " bd/initrd";60 const char *root_dev = "initrd"; 66 61 67 62 if (str_cmp(fstype, "tmpfs") == 0) … … 94 89 static bool mount_devfs(void) 95 90 { 96 int rc = mount("devfs", DEVFS_MOUNT_POINT, "", "", IPC_FLAG_BLOCKING); 91 char null[MAX_DEVICE_NAME]; 92 int null_id = devmap_null_create(); 93 94 if (null_id == -1) { 95 printf(NAME ": Unable to create null device\n"); 96 return false; 97 } 98 99 snprintf(null, MAX_DEVICE_NAME, "null%d", null_id); 100 int rc = mount("devfs", "/dev", null, "", IPC_FLAG_BLOCKING); 97 101 98 102 switch (rc) { … … 102 106 case EBUSY: 103 107 printf(NAME ": Device filesystem already mounted\n"); 108 devmap_null_destroy(null_id); 104 109 return false; 105 110 case ELIMIT: 106 111 printf(NAME ": Unable to mount device filesystem\n"); 112 devmap_null_destroy(null_id); 107 113 return false; 108 114 case ENOENT: 109 115 printf(NAME ": Unknown filesystem type (devfs)\n"); 116 devmap_null_destroy(null_id); 110 117 return false; 111 118 default: 112 119 printf(NAME ": Error mounting device filesystem (%d)\n", rc); 120 devmap_null_destroy(null_id); 113 121 return false; 114 122 } … … 162 170 } 163 171 164 if ( (texit != TASK_EXIT_NORMAL) || (retval != 0)) {172 if (texit != TASK_EXIT_NORMAL || retval != 0) { 165 173 printf(NAME ": Server %s failed to start (returned %d)\n", 166 174 fname, retval); … … 168 176 } 169 177 170 static void console(char *dev)171 { 172 char *argv[ 3];173 char hid_in[DEVMAP_NAME_MAXLEN];178 static void getvc(char *dev, char *app) 179 { 180 char *argv[4]; 181 char vc[MAX_DEVICE_NAME]; 174 182 int rc; 175 183 176 snprintf(hid_in, DEVMAP_NAME_MAXLEN, "%s/%s", DEVFS_MOUNT_POINT, dev); 177 178 printf(NAME ": Spawning %s with %s\n", SRV_CONSOLE, hid_in); 179 180 /* Wait for the input device to be ready */ 184 snprintf(vc, MAX_DEVICE_NAME, "/dev/%s", dev); 185 186 printf(NAME ": Spawning getvc on %s\n", vc); 187 181 188 dev_handle_t handle; 182 189 rc = devmap_device_get_handle(dev, &handle, IPC_FLAG_BLOCKING); 183 190 184 191 if (rc == EOK) { 185 argv[0] = SRV_CONSOLE; 186 argv[1] = hid_in; 187 argv[2] = NULL; 188 189 if (!task_spawn(SRV_CONSOLE, argv)) 190 printf(NAME ": Error spawning %s with %s\n", SRV_CONSOLE, hid_in); 191 } else 192 printf(NAME ": Error waiting on %s\n", hid_in); 193 } 194 195 static void getterm(char *dev, char *app) 196 { 197 char *argv[4]; 198 char term[DEVMAP_NAME_MAXLEN]; 199 int rc; 200 201 snprintf(term, DEVMAP_NAME_MAXLEN, "%s/%s", DEVFS_MOUNT_POINT, dev); 202 203 printf(NAME ": Spawning %s with %s %s\n", APP_GETTERM, term, app); 204 205 /* Wait for the terminal device to be ready */ 206 dev_handle_t handle; 207 rc = devmap_device_get_handle(dev, &handle, IPC_FLAG_BLOCKING); 208 209 if (rc == EOK) { 210 argv[0] = APP_GETTERM; 211 argv[1] = term; 192 argv[0] = "/app/getvc"; 193 argv[1] = vc; 212 194 argv[2] = app; 213 195 argv[3] = NULL; 214 196 215 if (!task_spawn( APP_GETTERM, argv))216 printf(NAME ": Error spawning %s with %s %s\n", APP_GETTERM,217 term, app);218 } else219 printf(NAME ": Error waiting on %s\n", term);220 } 221 222 static void mount_ scratch(void)197 if (!task_spawn("/app/getvc", argv)) 198 printf(NAME ": Error spawning getvc on %s\n", vc); 199 } else { 200 printf(NAME ": Error waiting on %s\n", vc); 201 } 202 } 203 204 static void mount_data(void) 223 205 { 224 206 int rc; 225 207 226 printf("Trying to mount null/0 on /scratch... ");208 printf("Trying to mount disk0 on /data... "); 227 209 fflush(stdout); 228 210 229 rc = mount(" tmpfs", "/scratch", "null/0", "", 0);211 rc = mount("fat", "/data", "disk0", "wtcache", 0); 230 212 if (rc == EOK) 231 213 printf("OK\n"); … … 234 216 } 235 217 236 static void mount_data(void)237 {238 int rc;239 240 printf("Trying to mount bd/disk0 on /data... ");241 fflush(stdout);242 243 rc = mount("fat", "/data", "bd/disk0", "wtcache", 0);244 if (rc == EOK)245 printf("OK\n");246 else247 printf("Failed\n");248 }249 250 218 int main(int argc, char *argv[]) 251 219 { … … 256 224 return -1; 257 225 } 258 259 /* Make sure tmpfs is running. */260 if (str_cmp(STRING(RDFMT), "tmpfs") != 0) {261 spawn("/srv/tmpfs");262 }263 226 264 227 spawn("/srv/devfs"); 265 spawn("/srv/taskmon");266 228 267 229 if (!mount_devfs()) { … … 269 231 return -2; 270 232 } 271 272 mount_scratch(); 273 233 234 spawn("/srv/fb"); 235 spawn("/srv/kbd"); 236 spawn("/srv/console"); 274 237 spawn("/srv/fhc"); 275 238 spawn("/srv/obio"); 276 srv_start("/srv/cuda_adb");277 srv_start("/srv/i8042");278 srv_start("/srv/adb_ms");279 srv_start("/srv/char_ms");280 281 spawn("/srv/fb");282 spawn("/srv/kbd");283 console("hid_in/kbd");284 285 spawn("/srv/clip");286 239 287 240 /* … … 302 255 #endif 303 256 304 getterm("term/vc0", "/app/bdsh"); 305 getterm("term/vc1", "/app/bdsh"); 306 getterm("term/vc2", "/app/bdsh"); 307 getterm("term/vc3", "/app/bdsh"); 308 getterm("term/vc4", "/app/bdsh"); 309 getterm("term/vc5", "/app/bdsh"); 310 getterm("term/vc6", "/app/klog"); 311 257 getvc("vc0", "/app/bdsh"); 258 getvc("vc1", "/app/bdsh"); 259 getvc("vc2", "/app/bdsh"); 260 getvc("vc3", "/app/bdsh"); 261 getvc("vc4", "/app/bdsh"); 262 getvc("vc5", "/app/bdsh"); 263 getvc("vc6", "/app/klog"); 264 265 usleep(1000000); 266 spawn("/srv/dd"); 267 312 268 return 0; 313 269 }
Note:
See TracChangeset
for help on using the changeset viewer.