Changeset 1750


Ignore:
Timestamp:
Dec 21, 2004, 2:38:04 AM (21 years ago)
Author:
bird
Message:

Inode and Dev stuff of stat/lstat/fstat.

Location:
trunk/src/emx
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/emx/io.h

    • Property cvs2svn:cvs-rev changed from 1.13 to 1.14
    r1749 r1750  
    373373    __LIBC_PCFHOPS          pOps;
    374374
     375
     376
     377
     378
     379
     380
     381
     382
    375383} __LIBC_FH;
    376384/** Pointer to filehandle. */
  • trunk/src/emx/src/lib/sys/__dup.c

    • Property cvs2svn:cvs-rev changed from 1.6 to 1.7
    r1749 r1750  
    5757                pFHNew->fFlags      = pFH->fFlags;
    5858                pFHNew->iLookAhead  = pFH->iLookAhead;
     59
     60
    5961            }
    6062            else
  • trunk/src/emx/src/lib/sys/__dup2.c

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r1749 r1750  
    9090                pFHNew->fFlags      = pFH->fFlags;
    9191                pFHNew->iLookAhead  = pFH->iLookAhead;
     92
     93
    9294            }
    9395            else
  • trunk/src/emx/src/lib/sys/b_fs.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1749 r1750  
    3131#include <sys/syslimits.h>
    3232#include <sys/types.h>
     33
    3334#include <InnoTekLIBC/sharedpm.h>
    3435#include "backend.h"
     
    136137/**
    137138 * Creates the unix EAs for a new file or directory.
     139
    138140 * @returns 0 on success.
    139141 * @returns Negative errno on failure.
    140142 * @param   hFile           File handle to the newly created fs object. If no
    141143 *                          handle handy, set to -1.
    142  * @param   pszNativePath   Native path of the newly created fs object. If
    143  *                          handle is give this will be ignored.
     144 * @param   pszNativePath   Native path to the newly created fs object.
    144145 * @param   mode            The specified file permission mode mask.
    145  */
    146 int __libc_back_fsUnixAttribsSet(int hFile, const char *pszNativePath, mode_t mode);
     146 * @param   pDev            Where to store the dev number.
     147 * @param   pInode          Where to store the calculated inode number.
     148 */
     149int __libc_back_fsUnixAttribsSet(int hFile, const char *pszNativePath, mode_t mode, dev_t *pDev, ino_t *pInode);
    147150
    148151/**
     
    197200int __libc_back_fsNativeFileStat(const char *pszNativePath, struct stat *pStat);
    198201
     202
     203
     204
     205
     206
     207
     208
     209
     210
     211
     212
    199213
    200214__END_DECLS
  • trunk/src/emx/src/lib/sys/b_fsDirCreate.c

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r1749 r1750  
    7171    if (!rc)
    7272    {
    73         __libc_back_fsUnixAttribsSet(-1, &szNativePath[0], Mode);
     73        __libc_back_fsUnixAttribsSet(-1, &szNativePath[0], Mode);
    7474        LIBCLOG_RETURN_INT(0);
    7575    }
  • trunk/src/emx/src/lib/sys/b_fsFileStatFH.c

    • Property cvs2svn:cvs-rev changed from 1.6 to 1.7
    r1749 r1750  
    9393        pStat->st_uid = 0;
    9494        pStat->st_gid = 0;
    95         pStat->st_ino = _sys_ino++;
    96         if (_sys_ino == 0)
    97             _sys_ino = 1;
    98         pStat->st_dev = 0;
     95        pStat->st_ino = pFH->Inode;
     96        pStat->st_dev = pFH->Dev;
    9997        pStat->st_rdev = 0;
    10098        pStat->st_nlink = 1;
  • trunk/src/emx/src/lib/sys/b_fsNativeFileStat.c

    • Property cvs2svn:cvs-rev changed from 1.6 to 1.7
    r1749 r1750  
    188188    pStat->st_uid = 0;
    189189    pStat->st_gid = 0;
    190     pStat->st_ino = _sys_ino++;
    191     if (_sys_ino == 0)
    192         _sys_ino = 1;
    193     pStat->st_dev = 0;
     190    pStat->st_dev = __libc_back_fsPathCalcInodeAndDev(pszNativePath, &pStat->st_ino);
    194191    pStat->st_rdev = 0;
    195192    pStat->st_nlink = 1;
  • trunk/src/emx/src/lib/sys/b_ioFileOpen.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r1749 r1750  
    174174        ULONG   fulType;
    175175        ULONG   fulDevFlags;
     176
     177
    176178
    177179        /*
     
    180182        if (   (ulAction == FILE_CREATED)
    181183            && !__libc_gfNoUnix)
    182             __libc_back_fsUnixAttribsSet(hFile, NULL, Mode);
     184            __libc_back_fsUnixAttribsSet(hFile, pszFile, Mode, &Dev, &Inode);
     185        else
     186            Dev = __libc_back_fsPathCalcInodeAndDev(szNativePath, &(*ppFH)->Inode);
     187
    183188
    184189        /*
     
    203208
    204209            /*
    205              * Register the handle.
     210             * Register the handle and calc Dev and Inode.
     211             * We calc the Dev/Inode regardless of whether it's stored in an EA or not.
    206212             */
    207213            rc = __libc_FHAllocate(hFile, fLibc, sizeof(LIBCFH), NULL, ppFH, NULL);
    208             LIBCLOG_MSG("hFile=%#lx fLibc=%#x fulType=%#lx ulAction=%lu\n",
    209                         hFile, fLibc, fulType, ulAction);
     214            if (!rc)
     215            {
     216                if (ppFH)
     217                {
     218                    (*ppFH)->Dev = Dev;
     219                    (*ppFH)->Inode = Inode;
     220                }
     221                LIBCLOG_MSG("hFile=%#lx fLibc=%#x fulType=%#lx ulAction=%lu Dev=%#x Inode=%#llx\n",
     222                            hFile, fLibc, fulType, ulAction, Dev, Inode);
     223            }
    210224        }
    211225
  • trunk/src/emx/src/lib/sys/filehandles.c

    • Property cvs2svn:cvs-rev changed from 1.16 to 1.17
    r1749 r1750  
    735735        pFH->iLookAhead = -1;
    736736        pFH->pOps       = pOps;
     737
     738
     739
     740
    737741
    738742        /*
  • trunk/src/emx/src/lib/sys/fs.c

    • Property cvs2svn:cvs-rev changed from 1.12 to 1.13
    r1749 r1750  
    187187*******************************************************************************/
    188188static int fsResolveUnix(const char *pszUserPath, unsigned fFlags, char *pszNativePath, int *pfInUnixTree);
     189
     190
     191
    189192
    190193
     
    12341237/**
    12351238 * Creates the unix EAs for a new file or directory.
     1239
    12361240 * @returns 0 on success.
    12371241 * @returns Negative errno on failure.
    12381242 * @param   hFile           File handle to the newly created fs object. If no
    12391243 *                          handle handy, set to -1.
    1240  * @param   pszNativePath   Native path to the newly created fs object. If
    1241  *                          handle is give this will be ignored.
     1244 * @param   pszNativePath   Native path to the newly created fs object.
    12421245 * @param   mode            The specified file permission mode mask.
     1246
     1247
    12431248 */
    1244 int __libc_back_fsUnixAttribsSet(int hFile, const char *pszNativePath, mode_t mode)
    1245 {
    1246     /* later */
     1249int __libc_back_fsUnixAttribsSet(int hFile, const char *pszNativePath, mode_t mode, dev_t *pDev, ino_t *pInode)
     1250{
     1251    /*
     1252     * Calc device.
     1253     */
     1254    dev_t   Dev;
     1255    char    chDrv = *pszNativePath;
     1256    if (chDrv == '/' || chDrv == '\\')
     1257        Dev = makedev('U', 0);          /* U as in UNC */
     1258    else
     1259    {
     1260        /* ASSUMES that pszNativePath contains a driveletter! If not fix the resolver!!! */
     1261        if (chDrv >= 'a' && chDrv <= 'z')
     1262            chDrv -= 'a' - 'A';
     1263        Dev = makedev('V', chDrv);      /* V as in Volume */
     1264    }
     1265
     1266    /*
     1267     * Calc Inode number.
     1268     *
     1269     * Whether to use another hash algorithm here is a bit in the blue now
     1270     * because the stored value might be inaccessible at times.
     1271     */
     1272    const char *psz = pszNativePath;
     1273    if (psz[1] == ':')
     1274        psz += 2;
     1275    ino_t Inode = ((uint64_t)crc32str(psz) << 32) | (uint64_t)djb2(psz);
     1276
     1277    /** @todo Save unix EAs! */
     1278    if (pDev)
     1279        *pDev = Dev;
     1280    if (pInode)
     1281        *pInode = (Inode & 0xffffffff00000000ULL) | (uint64_t)sdbm(psz);
    12471282    return 0;
    12481283}
     1284
    12491285
    12501286/**
     
    13391375
    13401376
     1377
     1378
     1379
     1380
     1381
     1382
     1383
     1384
     1385
     1386
     1387
     1388
     1389
     1390
     1391
     1392
     1393
     1394
     1395
     1396
     1397
     1398
     1399
     1400
     1401
     1402
     1403
     1404
     1405
     1406
     1407
     1408
     1409
     1410
     1411
     1412
     1413
     1414
     1415
     1416
     1417
     1418
     1419
     1420
     1421
     1422
     1423
     1424
     1425
     1426
     1427
     1428
     1429
     1430
     1431
     1432
     1433
     1434
     1435
     1436
     1437
     1438
     1439
     1440
     1441
     1442
     1443
     1444
     1445
     1446
     1447
     1448
     1449
     1450
     1451
     1452
     1453
     1454
     1455
     1456
     1457
     1458
     1459
     1460
     1461
     1462
     1463
     1464
     1465
     1466
     1467
     1468
     1469
     1470
     1471
     1472
     1473
     1474
     1475
     1476
     1477
     1478
     1479
     1480
     1481
     1482
     1483
     1484
     1485
     1486
     1487
     1488
     1489
     1490
     1491
     1492
     1493
     1494
     1495
     1496
     1497
     1498
     1499
     1500
     1501
     1502
     1503
     1504
     1505
     1506
     1507
     1508
     1509
     1510
     1511
     1512
     1513
     1514
     1515
     1516
     1517
     1518
     1519
     1520
     1521
     1522
     1523
     1524
     1525
     1526
     1527
     1528
     1529
     1530
     1531
     1532
     1533
     1534
     1535
     1536
     1537
     1538
     1539
     1540
     1541
     1542
     1543
     1544
     1545
     1546
     1547
     1548
     1549
     1550
     1551
     1552
     1553
     1554
     1555
     1556
     1557
     1558
     1559
     1560
     1561
     1562
Note: See TracChangeset for help on using the changeset viewer.