Ignore:
Timestamp:
Sep 27, 2004, 4:15:07 AM (21 years ago)
Author:
bird
Message:

Big path handling change. Fixed wrong file headers. A new api or two. A bit of restructuring. And hopefully no new bug :-)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/InnoTekLIBC/backend.h

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r1518 r1519  
    3030#include <sys/cdefs.h>
    3131#include <sys/types.h>
     32#include <emx/io.h>
    3233
    3334__BEGIN_DECLS
     
    3839#endif
    3940struct statfs;
     41struct stat;
    4042
    4143
     
    8284
    8385
    84 /** @defgroup __libc_Back_fh   LIBC Backend - File Handles.
    85  * @{ */
     86/** @defgroup __libc_Back_fs   LIBC Backend - File System
     87 * @{ */
     88
     89/**
     90 * Get the statistics for the filesystem which pszPath is located on.
     91 *
     92 * @returns 0 on success.
     93 * @returns Negative error code (errno.h) on failure.
     94 * @param   pszPath     The path to somewhere in the filesystem.
     95 * @param   pStatFs     Where to store the obtained information.
     96 */
     97int __libc_Back_fsStat(const char *pszPath, struct statfs *pStatFs);
     98
     99/**
     100 * Get file system statistics
     101 *
     102 * @returns 0 on success.
     103 * @returns Negative error code (errno.h) on failure.
     104 * @param   fh          The filehandle of any file within the mounted file system.
     105 * @param   pStatFs     Where to store the statistics.
     106 */
     107int __libc_Back_fsStatFH(int fh, struct statfs *pStatFs);
     108
     109/**
     110 * Get the statistics for all the mounted filesystems.
     111 *
     112 * @returns Number of returned statfs structs on success.
     113 * @returns Number of mounted filesystems on success if paStatFS is NULL
     114 * @returns Negative error code (errno.h) on failure.
     115 * @param   paStatFs    Where to to store the statistics.
     116 * @param   cStatFS     Number of structures the array pointed to by paStatFs can hold.
     117 * @param   fFlags      Flags, currently ignored.
     118 */
     119int __libc_Back_fsStats(struct statfs *paStatFs, unsigned cStatFs, unsigned fFlags);
     120
     121/**
     122 * Schedules all file system buffers for writing.
     123 *
     124 * See sync() for OS/2 limitations.
     125 */
     126void __libc_Back_fsSync(void);
     127
     128/**
     129 * Resolves the path into an canonicalized absolute path.
     130 *
     131 * @returns 0 on success.
     132 * @returns Negative error code (errno.h) on failure.
     133 * @param   pszPath     The path to resolve.
     134 * @param   pszBuf      Where to store the resolved path.
     135 * @param   cchBuf      Size of the buffer.
     136 * @param   fFlags      At the moment 0. Which means the entire path must exist.
     137 */
     138int __libc_Back_fsPathResolve(const char *pszPath, char *pszBuf, size_t cchBuf, unsigned fFlags);
     139
     140/**
     141 * Changes the default drive of the process.
     142 *
     143 * @returns 0 on success.
     144 * @returns Negative error code (errno.h) on failure.
     145 * @param   chDrive     New default drive.
     146 */
     147int __libc_Back_fsDriveDefaultSet(char chDrive);
     148
     149/**
     150 * Gets the default drive of the process.
     151 *
     152 * @returns 0 on success.
     153 * @returns Negative error code (errno.h) on failure.
     154 * @param   pchDrive    Where to store the default drive.
     155 */
     156int __libc_Back_fsDriveDefaultGet(char *pchDrive);
     157
     158/**
     159 * Sets or change the unixroot of the current process.
     160 *
     161 * @returns 0 on success.
     162 * @returns Negative error code (errno.h) on failure.
     163 * @param   pszNewRoot  The new root.
     164 */
     165int __libc_Back_fsDirChangeRoot(const char *pszNewRoot);
     166
     167/**
     168 * Gets the current directory of the process on a
     169 * specific drive or on the current one.
     170 *
     171 * @returns 0 on success.
     172 * @returns Negative error code (errno.h) on failure.
     173 * @param   pszPath     Where to store the path to the current directory.
     174 *                      This will be prefixed with a drive letter if we're
     175 *                      not in the unix tree.
     176 * @param   cchPath     The size of the path buffer.
     177 * @param   chDrive     The drive letter of the drive to get it for.
     178 *                      If '\0' the current dir for the current drive is returned.
     179 * @param   fFlags      Flags for skipping drive letter and slash.
     180 */
     181int __libc_Back_fsDirCurrentGet(char *pszPath, size_t cchPath, char chDrive, int fFlags);
     182
     183/** Flags for __libc_Back_fsDirCurrentGet().
     184 * @{ */
     185#define __LIBC_BACK_FSCWD_NO_DRIVE          1
     186#define __LIBC_BACK_FSCWD_NO_ROOT_SLASH     2
     187/** @} */
     188
     189/**
     190 * Changes the current directory of the process.
     191 *
     192 * @returns 0 on success.
     193 * @returns Negative error code (errno.h) on failure.
     194 * @param   pszPath     Path to the new current directory of the process.
     195 */
     196int __libc_Back_fsDirCurrentSet(const char *pszPath);
     197
     198/**
     199 * Creates a new directory.
     200 *
     201 * @returns 0 on success.
     202 * @returns Negative error code (errno.h) on failure.
     203 * @param   pszPath     Path of the new directory.
     204 * @param   Mode        Permissions on the created directory.
     205 */
     206int __libc_Back_fsDirCreate(const char *pszPath, mode_t Mode);
     207
     208/**
     209 * Removes a new directory.
     210 *
     211 * @returns 0 on success.
     212 * @returns Negative error code (errno.h) on failure.
     213 * @param   pszPath     Path to the directory which is to be removed.
     214 */
     215int __libc_Back_fsDirRemove(const char *pszPath);
     216
     217/**
     218 * Creates a symbolic link.
     219 *
     220 * @returns 0 on success.
     221 * @returns Negative error code (errno.h) on failure.
     222 * @param   pszTarget   The target of the symlink link.
     223 * @param   pszSymlink  The path to the symbolic link to create.
     224 */
     225int __libc_Back_fsSymlinkCreate(const char *pszTarget, const char *pszSymlink);
     226
     227/**
     228 * Reads the content of a symbolic link.
     229 *
     230 * This is weird interface as it will return a truncated result if not
     231 * enough buffer space. It is also weird in that there is no string
     232 * terminator.
     233 *
     234 * @returns Number of bytes returned in pachBuf.
     235 * @returns Negative error code (errno.h) on failure.
     236 * @param   pszPath     The path to the symlink directory.
     237 * @param   pachBuf     Where to store the symlink value.
     238 * @param   cchBuf      Size of buffer.
     239 */
     240int __libc_Back_fsSymlinkRead(const char *pszPath, char *pachBuf, size_t cchBuf);
     241
     242/**
     243 * Stats a symbolic link.
     244 *
     245 * @returns 0 on success.
     246 * @returns Negative error code (errno.h) on failure.
     247 * @param   pszPath     Path to the file to stat. If this is a symbolic link
     248 *                      the link it self will be stat'ed.
     249 * @param   pStat       Where to store the file stats.
     250 */
     251int __libc_Back_fsSymlinkStat(const char *pszPath, struct stat *pStat);
     252
     253/**
     254 * Stats a file.
     255 *
     256 * @returns 0 on success.
     257 * @returns Negative error code (errno.h) on failure.
     258 * @param   pszPath     Path to the file to stat.
     259 * @param   pStat       Where to store the file stats.
     260 */
     261int __libc_Back_fsFileStat(const char *pszPath, struct stat *pStat);
     262
     263/**
     264 * Gets the file stats for a file by filehandle.
     265 *
     266 * @returns 0 on success.
     267 * @returns Negative error code (errno.h) on failure. The content
     268 *          of *pStat is undefined.
     269 * @param   fh      Handle to file.
     270 * @param   pStat   Where to store the stats.
     271 */
     272int __libc_Back_fsFileStatFH(int fh, struct stat *pStat);
     273
     274
     275/** @defgroup __libc_Back_io   LIBC Backend - I/O and File Management.
     276 * @{ */
     277
     278/**
     279 * Opens a file.
     280 *
     281 * @returns Filehandle to the opened file on success.
     282 * @returns Negative error code (errno.h) on failure.
     283 * @param   pszFile     Path to the file.
     284 * @param   fFlags      Open flags.
     285 * @param   cbInitial   Initial filesize.
     286 * @param   Mode        The specified permission mask.
     287 * @param   fLibc       LIBC filehandle flags.
     288 * @param   ppFH        Where to store the LIBC filehandle structure which was created
     289 *                      for the opened file.
     290 */
     291int __libc_Back_ioFileOpen(const char *pszFile, int fFlags, off_t cbInitial, mode_t Mode, unsigned fLibc, PLIBCFH *ppFH);
     292
     293/**
     294 * Change the current position of a file stream and get the new position.
     295 *
     296 * @returns new file offset on success.
     297 * @returns Negative error code (errno) on failure.
     298 * @param   hFile       File handle to preform seek operation on.
     299 * @param   off         Offset to seek to.
     300 * @param   iMethod     The seek method. SEEK_CUR, SEEK_SET or SEEK_END.
     301 */
     302off_t __libc_Back_ioSeek(int hFile, off_t off, int iMethod);
     303
     304/**
     305 * Sets the size of an open file.
     306 *
     307 * When expanding a file the contents of the allocated
     308 * space is undefined.
     309 *
     310 * @returns 0 on success.
     311 * @returns Negative error code (errno.h) on failure.
     312 * @param   fh      Handle to the file which size should be changed.
     313 * @param   cbFile  The new filesize.
     314 * @param   fZero   If set any new allocated file space will be
     315 *                  initialized to zero.
     316 */
     317int __libc_Back_ioFileSizeSet(int fh, __off_t cbFile, int fZero);
    86318
    87319/**
     
    89321 *
    90322 * @returns 0 on success.
    91  * @returns -1 and errno on failure.
     323 * @returns Negative error code (errno.h) on failure.
    92324 * @param   fh          The file handle.
    93325 * @param   pszPath     Where to store the path.
    94326 * @param   cchPath     The size of he buffer pointed to by pszPath.
    95327 */
    96 int __libc_Back_fhToPath(int fh, char *pszPath, size_t cchPath);
    97 
    98 /** @} */
    99 
    100 
    101 /** @defgroup __libc_Back_fs   LIBC Backend - File System
    102  * @{ */
    103 
    104 /**
    105  * Get the statistics for the filesystem which pszPath is located on.
    106  *
    107  * @returns 0 on success.
    108  * @returns -1 and errno on failure.
    109  * @param   pszPath     The path to somewhere in the filesystem.
    110  * @param   pStatFs     Where to store the obtained information.
    111  */
    112 int __libc_Back_fsStat(const char *pszPath, struct statfs *pStatFs);
    113 
    114 /**
    115  * Get file system statistics
    116  *
    117  * @returns 0 on success.
    118  * @returns -1 and errno on failure.
    119  * @param   fh          The filehandle of any file within the mounted file system.
    120  * @param   pStatFs     Where to store the statistics.
    121  */
    122 int __libc_Back_fsStatFH(int fh, struct statfs *pStatFs);
    123 
    124 /**
    125  * Get the statistics for all the mounted filesystems.
    126  *
    127  * @returns Number of returned statfs structs on success.
    128  * @returns Number of mounted filesystems on success if paStatFS is NULL
    129  * @returns -1 and errno on failure.
    130  * @param   paStatFs    Where to to store the statistics.
    131  * @param   cStatFS     Number of structures the array pointed to by paStatFs can hold.
    132  * @param   fFlags      Flags, currently ignored.
    133  */
    134 int __libc_Back_fsStats(struct statfs *paStatFs, unsigned cStatFs, unsigned fFlags);
    135 
    136 /**
    137  * Schedules all file system buffers for writing.
    138  *
    139  * See sync() for OS/2 limitations.
    140  */
    141 void __libc_Back_fsSync(void);
    142 
    143 /**
    144  * Sets or change the unixroot of the current process.
    145  *
    146  * @returns 0 on success.
    147  * @returns -1 and errno on failure.
    148  * @param   pszNewRoot  The new root.
    149  */
    150 int __libc_Back_fsChRoot(const char *pszNewRoot);
     328int __libc_Back_ioFHToPath(int fh, char *pszPath, size_t cchPath);
     329
     330/** @} */
    151331
    152332/** @} */
     
    163343 *
    164344 * @returns 0 on success.
    165  * @returns -1 and errno on failure.
     345 * @returns Negative error code (errno.h) on failure.
    166346 * @param   pardAvgs    Where to store the samples.
    167347 * @param   cAvgs       Number of samples to get. Max is 3.
Note: See TracChangeset for help on using the changeset viewer.