Changeset 3696 for trunk


Ignore:
Timestamp:
Mar 16, 2011, 2:07:03 AM (14 years ago)
Author:
bird
Message:

libc: Added new env.var. LIBC_UNIX_EAS for controlling where EAs are used.

Location:
trunk/libc/src/kNIX
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libc/src/kNIX/b_initterm.c

    r3642 r3696  
    7474             */
    7575
    76 
    77             if (!rc)
    78                 rc = __libc_back_fsInit();
    7976            if (!rc)
    8077            {
    8178                /*
    82                  * Init file handles.
     79                 * Setup environment (org_environ and _STD(environ)) before
     80                 * fsInit and other uses them.
    8381                 */
    84                 rc = __libc_fhInit();
     82                rc = __libc_back_envInit();
    8583                if (!rc)
    8684                {
    87                     /*
    88                      * Init signals
     85                    /* 
     86                     * Initialize the file system bits.
    8987                     */
    90                     rc = __libc_back_signalInit();
     88                    rc = __libc_back_fsInit();
    9189                    if (!rc)
    9290                    {
    9391                        /*
    94                          * Setup environment (org_environ and _STD(environ))
     92                         * Init file handles.
    9593                         */
    96                         rc = __libc_back_envInit();
     94                        rc = __libc_fhInit();
    9795                        if (!rc)
    9896                        {
    99                             /* more? */
    100                             LIBCLOG_RETURN_INT(0);
     97                            /*
     98                             * Init signals
     99                             */
     100                            rc = __libc_back_signalInit();
     101                            if (!rc)
     102                            {
     103                                /* more? */
     104                                LIBCLOG_RETURN_INT(0);
     105                                //__libc_back_signalTerm();
     106                            }
     107
     108                            //__libc_fhTerm();
    101109                        }
    102                         //__libc_back_signalTerm();
     110
     111                        //__libc_back_fsTerm();
    103112                    }
    104113
    105                     //__libc_fhTerm();
     114                    //__libc_back_envTerm();
    106115                }
    107 
    108                 //__libc_back_fsTerm();
    109116            }
    110117            __libc_back_termOS(hmod, pvOS, fFlags);
  • trunk/libc/src/kNIX/os2/fs-os2.c

    r3687 r3696  
    194194static _fmutex        g_mtxFSInfoVolumes = _FMUTEX_INITIALIZER_EX(_FMC_MUST_COMPLETE, "mtxFSInfoVolumes");
    195195
     196/** Array of Unix EA settings overrides for all possible OS/2 volumes.
     197 * Tristate: -1 force off, 0 default, 1 force on.
     198 */
     199static char           g_achUnixEAsOverrides['Z' - 'A' + 1];
     200
    196201
    197202/*******************************************************************************
     
    211216{
    212217    LIBCLOG_ENTER("\n");
     218/** @todo getenv doesn't work at this point. :( */
    213219
    214220    /*
     
    298304    else
    299305    {
    300         LIBC_ASSERTM_FAILED("DosQueryModuleName(exe) failed: hmte=%lx rc=%d\n", pPib->pib_hmte, rc);
     306        LIBC_ASSERTM_FAILED("DosQueryModuleName(exe) failed: hmte=%lx rc=%i\n", pPib->pib_hmte, (int)rc);
    301307        gaMiscRewriteRules[0].cchTo = 1;
    302308        gaMiscRewriteRules[0].pszTo = "/";
     
    380386    }
    381387    DosFreeModule(hmod);
     388
     389    /*
     390     * Look for the UNIX EAs control environment variable.
     391     * The value form: !a, c, !d-e
     392     */
     393    const char *pszUnixEAs = getenv("LIBC_UNIX_EAS");
     394    if (pszUnixEAs)
     395    {
     396        while (*pszUnixEAs)
     397        {
     398            char chDrv;
     399            while ((chDrv = *pszUnixEAs) == ',' || chDrv == ';' || chDrv == ' ' || chDrv == '\t')
     400                pszUnixEAs++;
     401            if (!chDrv)
     402                break;
     403
     404            /* check for the operator. */
     405            int fOverride = 1;
     406            if (chDrv == '!')
     407            {
     408                fOverride = -1;
     409                chDrv = *++pszUnixEAs;
     410            }
     411
     412            /* check for the first drive letter, upper case it. */
     413            if (chDrv >= 'a' && chDrv <= 'z')
     414                chDrv -= 'a' - 'A';
     415            if (chDrv < 'A' || chDrv > 'Z')
     416                LIBCLOG_ERROR_RETURN_MSG(-1, "Bad LIBC_UNIX_EAS value; ch=%c\n", chDrv);
     417            pszUnixEAs++;
     418            if (*pszUnixEAs == ':')
     419                pszUnixEAs++;
     420
     421            /* check if it is a range spec. */
     422            char chDrv2;
     423            while ((chDrv2 = *pszUnixEAs) == ' ' || chDrv2 == '\t')
     424                pszUnixEAs++;
     425            if (chDrv2 == '-')
     426            {
     427                pszUnixEAs++;
     428                while ((chDrv2 = *pszUnixEAs) == ' ' || chDrv2 == '\t')
     429                    pszUnixEAs++;
     430
     431                if (chDrv >= 'a' && chDrv <= 'z')
     432                    chDrv -= 'a' - 'A';
     433                if (chDrv < 'A' || chDrv > 'Z')
     434                    LIBCLOG_ERROR_RETURN_MSG(-1, "Bad LIBC_UNIX_EAS value; ch=%c\n", chDrv2);
     435                pszUnixEAs++;
     436                if (*pszUnixEAs == ':')
     437                    pszUnixEAs++;
     438            }
     439            else
     440                chDrv2 = chDrv;
     441
     442            /* Be nice and swap the values if they are not in ascending order. */
     443            if (chDrv2 < chDrv)
     444            {
     445                char chDrvTmp = chDrv2;
     446                chDrv2 = chDrv;
     447                chDrv = chDrvTmp;
     448            }
     449
     450            /* apply them. */
     451            do
     452                g_achUnixEAsOverrides[chDrv - 'A'] = fOverride;
     453            while (chDrv++ < chDrv2);
     454        }
     455    }
     456
    382457    LIBCLOG_RETURN_INT(0);
    383458}
     
    525600    /*else if (!strcmp(pFsInfo->szName, "FAT32"))
    526601    { } */
     602
     603    /* check the Unix EAs overrides. */
     604    if (g_achUnixEAsOverrides[minor(Dev) - 'A'] != 0)
     605        pFsInfo->fUnixEAs = g_achUnixEAsOverrides[minor(Dev) - 'A'] > 0;
    527606
    528607    LIBCLOG_MSG2("fsInfoObjUpdate: dev:%#x mp:%s fsd:%s fZeroNewBytes=%d fUnixEAs=%d\n",
Note: See TracChangeset for help on using the changeset viewer.