Esempio n. 1
0
File: init.c Progetto: berkus/flick
int Init ()
{
/* Start up the file systems (traverse everything) */

  return (InitCache () != -1 &&
	  StartFileSystem () != -1);
}
Esempio n. 2
0
rc_t CommonMain (Args * args)
{
    rc_t rc;
    uint32_t ocount; /* we take the address of ocount but not pcount. */
    uint32_t pcount; /* does that help the compiler optimize? */

    rc = ArgsParamCount (args, &ocount);
    if (rc)
        LOGERR (klogInt, rc, "failed to count parameters");

    else if ((pcount = ocount) == 0)
        MiniUsage (args);

    else if (pcount > 2)
    {
        LOGERR (klogErr, rc, "too many parameters");
        MiniUsage(args);
    }

    else
    {
        const char * dst; /* we only take the address of one of these */
        const char * src;

        rc = ArgsOptionCount (args, OPTION_FORCE, &ocount);
        if (rc)
            LOGERR (klogInt, rc, "failed to examine force option");

        else
        {
            ForceFlag = (ocount > 0);

            /* -----
             * letting comp put src in register
             * only if it wants
             */
            rc = ArgsParamValue (args, 0, &dst);
            if (rc)
                LOGERR (klogInt, rc, "Failure to fetch "
                        "source parameter");

            else
            {
                src = dst;

                if (pcount == 1)
                    dst = NULL;

                else
                {
                    rc = ArgsParamValue (args, 1, &dst);
                    if (rc)
                        LOGERR (klogInt, rc, "Failure to fetch "
                                "destination parameter");
                }

                if (rc == 0)
                    rc = StartFileSystem (src, dst);
            }
        }
    }
    return rc;
}