Changeset 5f70118 in mainline for uspace/app/init/init.c


Ignore:
Timestamp:
2010-01-10T12:16:59Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c77a64f
Parents:
309ede1 (diff), 1ac3a52 (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.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/init/init.c

    r309ede1 r5f70118  
    4848#include <string.h>
    4949#include <devmap.h>
    50 #include <config.h>
    5150#include "init.h"
    5251
     52#define DEVFS_MOUNT_POINT  "/dev"
     53
     54#define SRV_CONSOLE  "/srv/console"
     55#define APP_GETTERM  "/app/getterm"
     56
    5357static void info_print(void)
    5458{
     
    5963{
    6064        char *opts = "";
    61         const char *root_dev = "initrd";
     65        const char *root_dev = "bd/initrd";
    6266       
    6367        if (str_cmp(fstype, "tmpfs") == 0)
     
    98102        }
    99103       
    100         snprintf(null, MAX_DEVICE_NAME, "null%d", null_id);
    101         int rc = mount("devfs", "/dev", null, "", IPC_FLAG_BLOCKING);
     104        snprintf(null, MAX_DEVICE_NAME, "null/%d", null_id);
     105        int rc = mount("devfs", DEVFS_MOUNT_POINT, null, "", IPC_FLAG_BLOCKING);
    102106       
    103107        switch (rc) {
     
    171175        }
    172176
    173         if (texit != TASK_EXIT_NORMAL || retval != 0) {
     177        if ((texit != TASK_EXIT_NORMAL) || (retval != 0)) {
    174178                printf(NAME ": Server %s failed to start (returned %d)\n",
    175179                        fname, retval);
     
    177181}
    178182
    179 static void getvc(char *dev, char *app)
    180 {
    181         char *argv[4];
    182         char vc[MAX_DEVICE_NAME];
     183static void console(char *dev)
     184{
     185        char *argv[3];
     186        char hid_in[MAX_DEVICE_NAME];
    183187        int rc;
    184188       
    185         snprintf(vc, MAX_DEVICE_NAME, "/dev/%s", dev);
    186        
    187         printf(NAME ": Spawning getvc on %s\n", vc);
    188        
     189        snprintf(hid_in, MAX_DEVICE_NAME, "%s/%s", DEVFS_MOUNT_POINT, dev);
     190       
     191        printf(NAME ": Spawning %s with %s\n", SRV_CONSOLE, hid_in);
     192       
     193        /* Wait for the input device to be ready */
    189194        dev_handle_t handle;
    190195        rc = devmap_device_get_handle(dev, &handle, IPC_FLAG_BLOCKING);
    191196       
    192197        if (rc == EOK) {
    193                 argv[0] = "/app/getvc";
    194                 argv[1] = vc;
     198                argv[0] = SRV_CONSOLE;
     199                argv[1] = hid_in;
     200                argv[2] = NULL;
     201               
     202                if (!task_spawn(SRV_CONSOLE, argv))
     203                        printf(NAME ": Error spawning %s with %s\n", SRV_CONSOLE, hid_in);
     204        } else
     205                printf(NAME ": Error waiting on %s\n", hid_in);
     206}
     207
     208static void getterm(char *dev, char *app)
     209{
     210        char *argv[4];
     211        char term[MAX_DEVICE_NAME];
     212        int rc;
     213       
     214        snprintf(term, MAX_DEVICE_NAME, "%s/%s", DEVFS_MOUNT_POINT, dev);
     215       
     216        printf(NAME ": Spawning %s with %s %s\n", APP_GETTERM, term, app);
     217       
     218        /* Wait for the terminal device to be ready */
     219        dev_handle_t handle;
     220        rc = devmap_device_get_handle(dev, &handle, IPC_FLAG_BLOCKING);
     221       
     222        if (rc == EOK) {
     223                argv[0] = APP_GETTERM;
     224                argv[1] = term;
    195225                argv[2] = app;
    196226                argv[3] = NULL;
    197227               
    198                 if (!task_spawn("/app/getvc", argv))
    199                         printf(NAME ": Error spawning getvc on %s\n", vc);
    200         } else {
    201                 printf(NAME ": Error waiting on %s\n", vc);
    202         }
     228                if (!task_spawn(APP_GETTERM, argv))
     229                        printf(NAME ": Error spawning %s with %s %s\n", APP_GETTERM,
     230                            term, app);
     231        } else
     232                printf(NAME ": Error waiting on %s\n", term);
    203233}
    204234
     
    207237        int rc;
    208238
    209         printf("Trying to mount disk0 on /data... ");
     239        printf("Trying to mount bd/disk0 on /data... ");
    210240        fflush(stdout);
    211241
    212         rc = mount("fat", "/data", "disk0", "wtcache", 0);
     242        rc = mount("fat", "/data", "bd/disk0", "wtcache", 0);
    213243        if (rc == EOK)
    214244                printf("OK\n");
     
    233263        }
    234264       
     265        spawn("/srv/fhc");
     266        spawn("/srv/obio");
     267        srv_start("/srv/i8042");
     268        srv_start("/srv/c_mouse");
     269
    235270        spawn("/srv/fb");
    236271        spawn("/srv/kbd");
    237         spawn("/srv/console");
    238         spawn("/srv/fhc");
    239         spawn("/srv/obio");
     272        console("hid_in/kbd");
     273       
     274        spawn("/srv/clip");
    240275
    241276        /*
     
    256291#endif
    257292
    258         getvc("vc0", "/app/bdsh");
    259         getvc("vc1", "/app/bdsh");
    260         getvc("vc2", "/app/bdsh");
    261         getvc("vc3", "/app/bdsh");
    262         getvc("vc4", "/app/bdsh");
    263         getvc("vc5", "/app/bdsh");
    264         getvc("vc6", "/app/klog");
     293        getterm("term/vc0", "/app/bdsh");
     294        getterm("term/vc1", "/app/bdsh");
     295        getterm("term/vc2", "/app/bdsh");
     296        getterm("term/vc3", "/app/bdsh");
     297        getterm("term/vc4", "/app/bdsh");
     298        getterm("term/vc5", "/app/bdsh");
     299        getterm("term/vc6", "/app/klog");
    265300       
    266301        return 0;
Note: See TracChangeset for help on using the changeset viewer.