Changeset 2048 for trunk/src/emx/include


Ignore:
Timestamp:
Jun 19, 2005, 6:10:41 AM (20 years ago)
Author:
bird
Message:

o File resize optimization: The JFS, HPFS and probably NET

will never return space which isn't zeroed when expanding
a file. Associate a file system information object with the
filehandles to keep track of such features. This also fixes
the fsStatFH() implementation trouble.
This attribute doesn't apply to CDFS. While RAMFS fails
the test, it zeros at open but not at setfilesize.

o Fixed invalid inode and dev numbers for new files, was passing

the wrong path around.

Location:
trunk/src/emx/include
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/386/builtin.h

    • Property cvs2svn:cvs-rev changed from 1.11 to 1.12
    r2047 r2048  
    148148}
    149149
    150 
    151150/**
    152151 * Atomically increments a 32-bit unsigned value.
     
    164163 * Atomically increments a 32-bit unsigned value.
    165164 *
     165 * @returns The new value.
    166166 * @param   pu32    Pointer to the value to increment.
    167167 */
    168 static __inline__ void __atomic_increment_u32(uint32_t __volatile__ *pu32)
    169 {
    170     __asm__ __volatile__("lock; incl %0"
    171                          : "=m" (*pu32)
    172                          : "m"  (*pu32));
     168static __inline__ uint32_t __atomic_increment_u32(uint32_t __volatile__ *pu32)
     169{
     170    uint32_t u32;
     171    __asm__ __volatile__("lock; xadd %0, %1\n\t"
     172                         "incl %0\n\t"
     173                         : "=r" (u32),
     174                           "=m" (*pu32)
     175                         : "0" (1)
     176                         : "memory");
     177    return u32;
     178}
     179
     180/**
     181 * Atomically increments a 32-bit signed value.
     182 *
     183 * @returns The new value.
     184 * @param   pi32    Pointer to the value to increment.
     185 */
     186static __inline__ uint32_t __atomic_increment_s32(int32_t __volatile__ *pi32)
     187{
     188    int32_t i32;
     189    __asm__ __volatile__("lock; xadd %0, %1\n\t"
     190                         "incl %0\n\t"
     191                         : "=r" (i32),
     192                           "=m" (*pi32)
     193                         : "0" (1)
     194                         : "memory");
     195    return i32;
    173196}
    174197
     
    200223 * Atomically decrements a 32-bit unsigned value.
    201224 *
    202  * @param   pu      Pointer to the value to decrement.
    203  */
    204 static __inline__ void __atomic_decrement_u32(__volatile__ uint32_t *pu32)
    205 {
    206     __asm__ __volatile__("lock; decl %0"
    207                          : "=m" (*pu32)
    208                          : "m"  (*pu32));
     225 * @returns The new value.
     226 * @param   pu32      Pointer to the value to decrement.
     227 */
     228static __inline__ uint32_t __atomic_decrement_u32(__volatile__ uint32_t *pu32)
     229{
     230    uint32_t u32;
     231    __asm__ __volatile__("lock; xadd %0, %1\n\t"
     232                         "decl %0\n\t"
     233                         : "=r" (u32),
     234                           "=m" (*pu32)
     235                         : "0" (-1)
     236                         : "memory");
     237    return u32;
     238}
     239
     240/**
     241 * Atomically decrements a 32-bit signed value.
     242 *
     243 * @returns The new value.
     244 * @param   pi32    Pointer to the value to decrement.
     245 */
     246static __inline__ uint32_t __atomic_decrement_s32(__volatile__ int32_t *pi32)
     247{
     248    int32_t i32;
     249    __asm__ __volatile__("lock; xadd %0, %1\n\t"
     250                         "decl %0\n\t"
     251                         : "=r" (i32),
     252                           "=m" (*pi32)
     253                         : "0" (-1)
     254                         : "memory");
     255    return i32;
    209256}
    210257
     
    212259 * Atomically decrements a 16-bit unsigned value.
    213260 *
     261 * @returns The new value.
    214262 * @param   pu16    Pointer to the value to decrement.
    215263 */
  • trunk/src/emx/include/InnoTekLIBC/sharedpm.h

    • Property cvs2svn:cvs-rev changed from 1.23 to 1.24
    r2047 r2048  
    163163#define __LIBC_SPM_INH_FHB_TYPE_END         (0)
    164164/** Standard bundle. */
    165 #define __LIBC_SPM_INH_FHB_TYPE_STANDARD    (0x10 | sizeof(unsigned))
     165#define __LIBC_SPM_INH_FHB_TYPE_STANDARD    (0x10 | (sizeof(unsigned) + sizeof(ino_t) + sizeof(dev_t)))
     166/** The old standard bundle. */
     167#define __LIBC_SPM_INH_FHB_TYPE_STANDARD_OLD (0x10 | sizeof(unsigned))
    166168/** Socket bundle, using the BSD 4.4 backend. */
    167169#define __LIBC_SPM_INH_FHB_TYPE_SOCKET_44   (0x20 | (sizeof(unsigned) + sizeof(unsigned short)))
     
    199201    /** The common bundle header. */
    200202    __LIBC_SPMINHFHBHDR Hdr;
    201     /** Array of flags of Hdr.cHandles entries. */
    202     unsigned            afFlags[1];
     203    /** Array Hdr.cHandles entries. */
     204    struct
     205    {
     206        /** The flags */
     207        unsigned            fFlags;
     208        /** The inode number. */
     209        ino_t               Inode;
     210        /** The device number. */
     211        dev_t               Dev;
     212    } aHandles[1];
    203213} __LIBC_SPMINHFHBSTD;
    204214#pragma pack()
    205215/** Pointer to SPM standard filehandle inherit bundle. */
    206216typedef __LIBC_SPMINHFHBSTD *__LIBC_PSPMINHFHBSTD;
     217
     218/**
     219 * SPM standard filehandle inherit bundle
     220 * This is used for OS/2 filehandles which only needs flags
     221 * transfered.
     222 */
     223#pragma pack(1)
     224typedef struct __libc_SPMInhFHOld
     225{
     226    /** The common bundle header. */
     227    __LIBC_SPMINHFHBHDR Hdr;
     228    /** Array of flags of Hdr.cHandles entries. */
     229    unsigned            afFlags[1];
     230} __LIBC_SPMINHFHBSTDOLD;
     231#pragma pack()
     232/** Pointer to SPM standard filehandle inherit bundle. */
     233typedef __LIBC_SPMINHFHBSTDOLD *__LIBC_PSPMINHFHBSTDOLD;
    207234
    208235/**
  • trunk/src/emx/include/emx/io.h

    • Property cvs2svn:cvs-rev changed from 1.14 to 1.15
    r2047 r2048  
    225225
    226226/**
     227 * Information struct about a mounted file system.
     228 *
     229 * Used to track down the filesystem of an open file handle and
     230 * so we can optimize certain operations like expanding a file.
     231 */
     232typedef struct __libc_FileSystemInfo
     233{
     234    /** Number of references to this file system info object.
     235     * The structure can be shared by many handles. */
     236    volatile int32_t    cRefs;
     237    /** Does the file system automatically zero the new space when a file is extended? */
     238    unsigned            fZeroNewBytes : 1;
     239    /** Device number of the device the filesystem resides on.
     240     * On OS/2 the device number is derived from the driveletter. */
     241    dev_t               Dev;
     242    /** The filesystem driver name. */
     243    char                szName[16];
     244    /** The mount point - may extend beyond the 4 bytes on some OSes. */
     245    char                szMountpoint[4];
     246} __LIBC_FSINFO;
     247/** Pointer to information about an open filesystem. */
     248typedef __LIBC_FSINFO *__LIBC_PFSINFO;
     249
     250
     251/**
    227252 * Filehandle type.
    228253 */
     
    381406     * determin this at handle creation time. */
    382407    ino_t                   Inode;
     408    /** Pointer to the filesystem information object for the filesystem which
     409     * this file resides on. This might be NULL... */
     410    __LIBC_PFSINFO          pFsInfo;
    383411} __LIBC_FH;
    384412/** Pointer to filehandle. */
Note: See TracChangeset for help on using the changeset viewer.