1 /* ----> DO NOT REMOVE THE FOLLOWING NOTICE <---- 2 * 3 * Copyright (c) 2014-2015 Datalight, Inc. 4 * All Rights Reserved Worldwide. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; use version 2 of the License. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty 12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License along 16 * with this program; if not, write to the Free Software Foundation, Inc., 17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 */ 19 20 /* Businesses and individuals that for commercial or other reasons cannot 21 * comply with the terms of the GPLv2 license may obtain a commercial license 22 * before incorporating Reliance Edge into proprietary software for 23 * distribution in any form. Visit http://www.datalight.com/reliance-edge for 24 * more information. 25 */ 26 27 /** @file 28 */ 29 #ifndef REDSTAT_H 30 #define REDSTAT_H 31 32 33 /** Mode bit for a directory. */ 34 #define RED_S_IFDIR 0x4000U 35 36 /** Mode bit for a regular file. */ 37 #define RED_S_IFREG 0x8000U 38 39 /** @brief Test for a directory. 40 */ 41 #define RED_S_ISDIR( m ) ( ( ( m ) & RED_S_IFDIR ) != 0U ) 42 43 /** @brief Test for a regular file. 44 */ 45 #define RED_S_ISREG( m ) ( ( ( m ) & RED_S_IFREG ) != 0U ) 46 47 48 /** File system is read-only. */ 49 #define RED_ST_RDONLY 0x00000001U 50 51 /** File system ignores suid and sgid bits. */ 52 #define RED_ST_NOSUID 0x00000002U 53 54 55 /** @brief Status information on an inode. 56 */ 57 typedef struct 58 { 59 uint8_t st_dev; /**< Volume number of volume containing file. */ 60 uint32_t st_ino; /**< File serial number (inode number). */ 61 uint16_t st_mode; /**< Mode of file. */ 62 uint16_t st_nlink; /**< Number of hard links to the file. */ 63 uint64_t st_size; /**< File size in bytes. */ 64 #if REDCONF_INODE_TIMESTAMPS == 1 65 uint32_t st_atime; /**< Time of last access (seconds since 01-01-1970). */ 66 uint32_t st_mtime; /**< Time of last data modification (seconds since 01-01-1970). */ 67 uint32_t st_ctime; /**< Time of last status change (seconds since 01-01-1970). */ 68 #endif 69 #if REDCONF_INODE_BLOCKS == 1 70 uint32_t st_blocks; /**< Number of blocks allocated for this object. */ 71 #endif 72 } REDSTAT; 73 74 75 /** @brief Status information on a file system volume. 76 */ 77 typedef struct 78 { 79 uint32_t f_bsize; /**< File system block size. */ 80 uint32_t f_frsize; /**< Fundamental file system block size. */ 81 uint32_t f_blocks; /**< Total number of blocks on file system in units of f_frsize. */ 82 uint32_t f_bfree; /**< Total number of free blocks. */ 83 uint32_t f_bavail; /**< Number of free blocks available to non-privileged process. */ 84 uint32_t f_files; /**< Total number of file serial numbers. */ 85 uint32_t f_ffree; /**< Total number of free file serial numbers. */ 86 uint32_t f_favail; /**< Number of file serial numbers available to non-privileged process. */ 87 uint32_t f_fsid; /**< File system ID (useless, populated with zero). */ 88 uint32_t f_flag; /**< Bit mask of f_flag values. Includes read-only file system flag. */ 89 uint32_t f_namemax; /**< Maximum filename length. */ 90 uint64_t f_maxfsize; /**< Maximum file size (POSIX extension). */ 91 uint32_t f_dev; /**< Volume number (POSIX extension). */ 92 } REDSTATFS; 93 94 95 #endif /* ifndef REDSTAT_H */ 96