Changes in uspace/app/init/init.c [00d7e1b:3acb285] in mainline


Ignore:
File:
1 edited

Legend:

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

    r00d7e1b r3acb285  
    4646#include <macros.h>
    4747#include <str.h>
    48 #include <loc.h>
     48#include <devmap.h>
    4949#include <str_error.h>
    5050#include "init.h"
     
    5353#define ROOT_MOUNT_POINT  "/"
    5454
    55 #define LOCFS_FS_TYPE      "locfs"
    56 #define LOCFS_MOUNT_POINT  "/loc"
     55#define DEVFS_FS_TYPE      "devfs"
     56#define DEVFS_MOUNT_POINT  "/dev"
    5757
    5858#define TMPFS_FS_TYPE      "tmpfs"
     
    6666#define APP_GETTERM  "/app/getterm"
    6767
    68 /** Print banner */
    6968static void info_print(void)
    7069{
     
    7271}
    7372
    74 /** Report mount operation success */
    7573static bool mount_report(const char *desc, const char *mntpt,
    7674    const char *fstype, const char *dev, int rc)
     
    102100}
    103101
    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  */
    115102static bool mount_root(const char *fstype)
    116103{
     
    121108       
    122109        int rc = mount(fstype, ROOT_MOUNT_POINT, ROOT_DEVICE, opts,
    123             IPC_FLAG_BLOCKING, 0);
     110            IPC_FLAG_BLOCKING);
    124111        return mount_report("Root filesystem", ROOT_MOUNT_POINT, fstype,
    125112            ROOT_DEVICE, rc);
    126113}
    127114
    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, "", "",
    140             IPC_FLAG_BLOCKING, 0);
    141         return mount_report("Location service filesystem", LOCFS_MOUNT_POINT,
    142             LOCFS_FS_TYPE, NULL, rc);
     115static bool mount_devfs(void)
     116{
     117        int rc = mount(DEVFS_FS_TYPE, DEVFS_MOUNT_POINT, "", "",
     118            IPC_FLAG_BLOCKING);
     119        return mount_report("Device filesystem", DEVFS_MOUNT_POINT, DEVFS_FS_TYPE,
     120            NULL, rc);
    143121}
    144122
     
    179157        rc = task_wait(id, &texit, &retval);
    180158        if (rc != EOK) {
    181                 printf("%s: Error waiting for %s (%s)\n", NAME, fname,
     159                printf("%s: Error waiting for %s (%s(\n", NAME, fname,
    182160                    str_error(rc));
    183161                return;
     
    196174}
    197175
    198 static void console(const char *isvc, const char *fbsvc)
    199 {
    200         printf("%s: Spawning %s %s %s\n", NAME, SRV_CONSOLE, isvc, fbsvc);
    201        
    202         /* Wait for the input service to be ready */
    203         service_id_t service_id;
    204         int rc = loc_service_get_id(isvc, &service_id, IPC_FLAG_BLOCKING);
    205         if (rc != EOK) {
    206                 printf("%s: Error waiting on %s (%s)\n", NAME, isvc,
    207                     str_error(rc));
    208                 return;
    209         }
    210        
    211         /* Wait for the framebuffer service to be ready */
    212         rc = loc_service_get_id(fbsvc, &service_id, IPC_FLAG_BLOCKING);
    213         if (rc != EOK) {
    214                 printf("%s: Error waiting on %s (%s)\n", NAME, fbsvc,
    215                     str_error(rc));
    216                 return;
    217         }
    218        
    219         rc = task_spawnl(NULL, SRV_CONSOLE, SRV_CONSOLE, isvc, fbsvc, NULL);
    220         if (rc != EOK) {
    221                 printf("%s: Error spawning %s %s %s (%s)\n", NAME, SRV_CONSOLE,
    222                     isvc, fbsvc, str_error(rc));
    223         }
    224 }
    225 
    226 static void getterm(const char *svc, const char *app, bool wmsg)
    227 {
    228         char term[LOC_NAME_MAXLEN];
     176static void console(const char *dev)
     177{
     178        char hid_in[DEVMAP_NAME_MAXLEN];
    229179        int rc;
    230180       
    231         snprintf(term, LOC_NAME_MAXLEN, "%s/%s", LOCFS_MOUNT_POINT, svc);
     181        snprintf(hid_in, DEVMAP_NAME_MAXLEN, "%s/%s", DEVFS_MOUNT_POINT, dev);
     182       
     183        printf("%s: Spawning %s %s\n", NAME, SRV_CONSOLE, hid_in);
     184       
     185        /* Wait for the input device to be ready */
     186        devmap_handle_t handle;
     187        rc = devmap_device_get_handle(dev, &handle, IPC_FLAG_BLOCKING);
     188        if (rc != EOK) {
     189                printf("%s: Error waiting on %s (%s)\n", NAME, hid_in,
     190                    str_error(rc));
     191                return;
     192        }
     193       
     194        rc = task_spawnl(NULL, SRV_CONSOLE, SRV_CONSOLE, hid_in, NULL);
     195        if (rc != EOK) {
     196                printf("%s: Error spawning %s %s (%s)\n", NAME, SRV_CONSOLE,
     197                    hid_in, str_error(rc));
     198        }
     199}
     200
     201static void getterm(const char *dev, const char *app, bool wmsg)
     202{
     203        char term[DEVMAP_NAME_MAXLEN];
     204        int rc;
     205       
     206        snprintf(term, DEVMAP_NAME_MAXLEN, "%s/%s", DEVFS_MOUNT_POINT, dev);
    232207       
    233208        printf("%s: Spawning %s %s %s\n", NAME, APP_GETTERM, term, app);
    234209       
    235         /* Wait for the terminal service to be ready */
    236         service_id_t service_id;
    237         rc = loc_service_get_id(svc, &service_id, IPC_FLAG_BLOCKING);
     210        /* Wait for the terminal device to be ready */
     211        devmap_handle_t handle;
     212        rc = devmap_device_get_handle(dev, &handle, IPC_FLAG_BLOCKING);
    238213        if (rc != EOK) {
    239214                printf("%s: Error waiting on %s (%s)\n", NAME, term,
     
    261236static bool mount_tmpfs(void)
    262237{
    263         int rc = mount(TMPFS_FS_TYPE, TMPFS_MOUNT_POINT, "", "", 0, 0);
     238        int rc = mount(TMPFS_FS_TYPE, TMPFS_MOUNT_POINT, "", "", 0);
    264239        return mount_report("Temporary filesystem", TMPFS_MOUNT_POINT,
    265240            TMPFS_FS_TYPE, NULL, rc);
     
    268243static bool mount_data(void)
    269244{
    270         int rc = mount(DATA_FS_TYPE, DATA_MOUNT_POINT, DATA_DEVICE, "wtcache", 0, 0);
     245        int rc = mount(DATA_FS_TYPE, DATA_MOUNT_POINT, DATA_DEVICE, "wtcache", 0);
    271246        return mount_report("Data filesystem", DATA_MOUNT_POINT, DATA_FS_TYPE,
    272247            DATA_DEVICE, rc);
     
    287262        }
    288263       
    289         spawn("/srv/locfs");
     264        spawn("/srv/devfs");
    290265        spawn("/srv/taskmon");
    291266       
    292         if (!mount_locfs()) {
     267        if (!mount_devfs()) {
    293268                printf("%s: Exiting\n", NAME);
    294269                return -2;
     
    297272        mount_tmpfs();
    298273       
     274#ifdef CONFIG_START_DEVMAN
    299275        spawn("/srv/devman");
     276#endif
    300277        spawn("/srv/apic");
    301278        spawn("/srv/i8259");
     279        spawn("/srv/fhc");
    302280        spawn("/srv/obio");
    303281        srv_start("/srv/cuda_adb");
    304282        srv_start("/srv/i8042");
    305283        srv_start("/srv/s3c24ser");
     284        srv_start("/srv/adb_ms");
     285        srv_start("/srv/char_ms");
    306286        srv_start("/srv/s3c24ts");
    307287       
    308         spawn("/srv/net");
    309        
    310288        spawn("/srv/fb");
    311         spawn("/srv/input");
    312         console("hid/input", "hid/fb0");
     289        spawn("/srv/kbd");
     290        console("hid_in/kbd");
    313291       
    314292        spawn("/srv/clip");
     
    326304       
    327305#ifdef CONFIG_MOUNT_DATA
    328         /* Make sure fat is running. */
    329         if (str_cmp(STRING(RDFMT), "fat") != 0) {
    330                 srv_start("/srv/fat");
    331         }
    332306        mount_data();
    333307#else
Note: See TracChangeset for help on using the changeset viewer.