Changeset 925a21e in mainline for uspace/app/init/init.c


Ignore:
Timestamp:
2011-09-24T14:20:29Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5bf76c1
Parents:
867e2555 (diff), 1ab4aca (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

    r867e2555 r925a21e  
    4646#include <macros.h>
    4747#include <str.h>
    48 #include <devmap.h>
     48#include <loc.h>
    4949#include <str_error.h>
    5050#include "init.h"
     
    5353#define ROOT_MOUNT_POINT  "/"
    5454
    55 #define DEVFS_FS_TYPE      "devfs"
    56 #define DEVFS_MOUNT_POINT  "/dev"
     55#define LOCFS_FS_TYPE      "locfs"
     56#define LOCFS_MOUNT_POINT  "/loc"
    5757
    5858#define TMPFS_FS_TYPE      "tmpfs"
     
    6666#define APP_GETTERM  "/app/getterm"
    6767
     68/** Print banner */
    6869static void info_print(void)
    6970{
     
    7172}
    7273
     74/** Report mount operation success */
    7375static bool mount_report(const char *desc, const char *mntpt,
    7476    const char *fstype, const char *dev, int rc)
     
    100102}
    101103
     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 */
    102115static bool mount_root(const char *fstype)
    103116{
     
    108121       
    109122        int rc = mount(fstype, ROOT_MOUNT_POINT, ROOT_DEVICE, opts,
    110             IPC_FLAG_BLOCKING);
     123            IPC_FLAG_BLOCKING, 0);
    111124        return mount_report("Root filesystem", ROOT_MOUNT_POINT, fstype,
    112125            ROOT_DEVICE, rc);
    113126}
    114127
    115 static 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);
     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 */
     137static 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);
    121143}
    122144
     
    157179        rc = task_wait(id, &texit, &retval);
    158180        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,
    160182                    str_error(rc));
    161183                return;
     
    174196}
    175197
    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);
    190         if (rc != EOK) {
    191                 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];
     198static 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
     226static void getterm(const char *svc, const char *app, bool wmsg)
     227{
     228        char term[LOC_NAME_MAXLEN];
    199229        int rc;
    200230       
    201         snprintf(term, DEVMAP_NAME_MAXLEN, "%s/%s", DEVFS_MOUNT_POINT, dev);
     231        snprintf(term, LOC_NAME_MAXLEN, "%s/%s", LOCFS_MOUNT_POINT, svc);
    202232       
    203233        printf("%s: Spawning %s %s %s\n", NAME, APP_GETTERM, term, app);
    204234       
    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);
     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);
    208238        if (rc != EOK) {
    209239                printf("%s: Error waiting on %s (%s)\n", NAME, term,
     
    231261static bool mount_tmpfs(void)
    232262{
    233         int rc = mount(TMPFS_FS_TYPE, TMPFS_MOUNT_POINT, "", "", 0);
     263        int rc = mount(TMPFS_FS_TYPE, TMPFS_MOUNT_POINT, "", "", 0, 0);
    234264        return mount_report("Temporary filesystem", TMPFS_MOUNT_POINT,
    235265            TMPFS_FS_TYPE, NULL, rc);
     
    238268static bool mount_data(void)
    239269{
    240         int rc = mount(DATA_FS_TYPE, DATA_MOUNT_POINT, DATA_DEVICE, "wtcache", 0);
     270        int rc = mount(DATA_FS_TYPE, DATA_MOUNT_POINT, DATA_DEVICE, "wtcache", 0, 0);
    241271        return mount_report("Data filesystem", DATA_MOUNT_POINT, DATA_FS_TYPE,
    242272            DATA_DEVICE, rc);
     
    257287        }
    258288       
    259         spawn("/srv/devfs");
     289        spawn("/srv/locfs");
    260290        spawn("/srv/taskmon");
    261291       
    262         if (!mount_devfs()) {
     292        if (!mount_locfs()) {
    263293                printf("%s: Exiting\n", NAME);
    264294                return -2;
     
    278308        spawn("/srv/fb");
    279309        spawn("/srv/input");
    280         console("hid/input");
     310        console("hid/input", "hid/fb0");
    281311       
    282312        spawn("/srv/clip");
Note: See TracChangeset for help on using the changeset viewer.