/******************************************************************************* * c0xfilesys.h * Test implementation for the ISO C proposal at: * . * * This code is designed to run reasonably well on Unix and Win32 systems. * * Contains * _FILESYS_DIRNAMES * _FILESYS_IGNORE_CASE * _FILESYS_SUBDIRS * struct _filesys * _fgetfilesys() * _getfilesys() * * Notes * Compile with macro '_unix' defined for Unix systems. * * Acknowledgments * This code was written by David R. Tribble (david@tribble.com), Jan 2004. * It is hereby placed into the public domain, and may be used for all * purposes, both commercial and private. No warranty is provided for this * source code, and the author cannot be held liable for its use in any * way. * * See also * * * */ #ifndef drt_c0xfilesys_h #define drt_c0xfilesys_h 101 /* Identification */ #ifndef NO_H_IDENT static const char drt_c0xfilesys_h_REV[] = "@(#)drt/text/stdc/c0xfilesys.h $Revision: 1.1 $ $Date: 2004/01/24 23:26:27 $\n"; #endif /* System includes */ #include /*------------------------------------------------------------------------------ * Constants */ /* Control bitflags for _filesys.fs_flags */ #define _FILESYS_DIRNAMES 0x0001 /* File and dir names differ */ #define _FILESYS_IGNORE_CASE 0x0002 /* Case ignored in file names */ #define _FILESYS_SUBDIRS 0x0004 /* Has subdirectories */ /* Other constants */ #if defined(_unix) #define _FS_NAMELEN 20 /* File system name length */ #elif defined(_WIN32) #define _FS_NAMELEN 64 /* File system name length */ #else #error Unsupported O/S #endif /*------------------------------------------------------------------------------ * Types */ #if defined(_WIN32) typedef __int64 llong_t; typedef unsigned __int64 ullong_t; #elif defined(_unix) typedef long long int llong_t; typedef unsigned long long int ullong_t; #else #error Unsupported O/S #endif /*------------------------------------------------------------------------------ * struct _filesys * File system information. * * Members marked with '(*)' are extensions to the proposed standard. * * @see * * * @since 1.1, 2004-01-24 */ #define _FILESYS_VERS 1 /* Struct version */ struct _filesys { llong_t fs_nfiles; /* Files used */ llong_t fs_ndirs; /* Directories used */ llong_t fs_total; /* Total space (blocks) */ llong_t fs_free; /* Free space (blocks) */ long int fs_blocksize; /* Block size (bytes) */ unsigned int fs_flags; /* Attributes */ int fs_namelen; /* Max file name length */ unsigned char fs__r[20]; /* Reserved (*) */ char fs_name[_FS_NAMELEN+1]; /* File system name */ }; /*------------------------------------------------------------------------------ * Functions */ /*------------------------------------------------------------------------------ * _getfilesys() * Retrieve information about a file system. * * @param name * File system name. * The contents and format of this name are implementation-defined. * * @param info * Pointer to a file system information structure. * * @return * Zero if successful and the structure pointed to by 'info' is filled with * information about the named file system; otherwise -1. * * @see * * * @since 1.1, 2004-01-24 */ extern int _getfilesys(const char *name, struct _filesys *info); /*------------------------------------------------------------------------------ * _fgetfilesys() * Retrieve information the file system containing a file associated with an I/O * stream. * * @param fp * An I/O stream. * This should not be null, nor should it point to a closed stream. * * @param info * Pointer to a file system information structure. * * @return * Zero if successful and the structure pointed to by 'info' is filled with * information about the stream's file system; otherwise -1. * * @see * * * @since 1.1, 2004-01-24 */ extern int _fgetfilesys(const FILE *fp, struct _filesys *info); #endif /* drt_c0xfilesys_h */ /* End c0xfilesys.h */