diff options
Diffstat (limited to '')
| -rw-r--r-- | src/myriadfs.h | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/myriadfs.h b/src/myriadfs.h index 808444b..3eecca5 100644 --- a/src/myriadfs.h +++ b/src/myriadfs.h | |||
| @@ -8,6 +8,8 @@ | |||
| 8 | #ifndef MYRIAD_FS_H | 8 | #ifndef MYRIAD_FS_H |
| 9 | #define MYRIAD_FS_H | 9 | #define MYRIAD_FS_H |
| 10 | 10 | ||
| 11 | #include <sys/types.h> | ||
| 12 | |||
| 11 | #include "bu/myriad.h" | 13 | #include "bu/myriad.h" |
| 12 | 14 | ||
| 13 | namespace Bu | 15 | namespace Bu |
| @@ -38,9 +40,9 @@ namespace Bu | |||
| 38 | * Basic node header format: | 40 | * Basic node header format: |
| 39 | * int32_t iUser | 41 | * int32_t iUser |
| 40 | * int32_t iGroup | 42 | * int32_t iGroup |
| 41 | * int16_t iPerms | 43 | * uint16_t uPerms |
| 42 | * int16_t iLinks | 44 | * int16_t iLinks |
| 43 | * int32_t iStreamIndex | 45 | * uint32_t uStreamIndex |
| 44 | * int32_t iParentNode | 46 | * int32_t iParentNode |
| 45 | * int64_t iATime | 47 | * int64_t iATime |
| 46 | * int64_t iMTime | 48 | * int64_t iMTime |
| @@ -51,14 +53,14 @@ namespace Bu | |||
| 51 | * Some types get special formats for their assosiated data stream, or | 53 | * Some types get special formats for their assosiated data stream, or |
| 52 | * other special considerations, here's a list: | 54 | * other special considerations, here's a list: |
| 53 | * | 55 | * |
| 54 | * - typeFifo: No stream, iStreamIndex unused (probably) | 56 | * - typeFifo: No stream, uStreamIndex unused (probably) |
| 55 | * - typeChrDev: No stream, iStreamIndex is device hi/lo | 57 | * - typeChrDev: No stream, uStreamIndex is device hi/lo |
| 56 | * - typeDir: The stream contains a directory contents listing, described | 58 | * - typeDir: The stream contains a directory contents listing, described |
| 57 | * below | 59 | * below |
| 58 | * - typeBlkDev: No stream, iStreamIndex is device hi/lo | 60 | * - typeBlkDev: No stream, uStreamIndex is device hi/lo |
| 59 | * - typeRegFile: The stream is the file data | 61 | * - typeRegFile: The stream is the file data |
| 60 | * - typeSymLink: The stream is the destination of the symlink | 62 | * - typeSymLink: The stream is the destination of the symlink |
| 61 | * - typeSocket: No steram, iStreamIndex unused (probably) | 63 | * - typeSocket: No steram, uStreamIndex unused (probably) |
| 62 | * | 64 | * |
| 63 | * Directory streams have this simple listing format. They contain a list | 65 | * Directory streams have this simple listing format. They contain a list |
| 64 | * of all child elements, with no particular order at the moment. The . and | 66 | * of all child elements, with no particular order at the moment. The . and |
| @@ -89,6 +91,7 @@ namespace Bu | |||
| 89 | permSticky = 0001000, | 91 | permSticky = 0001000, |
| 90 | permSetGid = 0002000, | 92 | permSetGid = 0002000, |
| 91 | permSetUid = 0004000, | 93 | permSetUid = 0004000, |
| 94 | permMask = 0007777, | ||
| 92 | typeFifo = 0010000, | 95 | typeFifo = 0010000, |
| 93 | typeChrDev = 0020000, | 96 | typeChrDev = 0020000, |
| 94 | typeDir = 0040000, | 97 | typeDir = 0040000, |
| @@ -127,14 +130,23 @@ namespace Bu | |||
| 127 | int64_t iMTime; | 130 | int64_t iMTime; |
| 128 | int64_t iCTime; | 131 | int64_t iCTime; |
| 129 | int32_t iSize; | 132 | int32_t iSize; |
| 133 | uint32_t uDev; | ||
| 130 | Bu::String sName; | 134 | Bu::String sName; |
| 131 | }; | 135 | }; |
| 132 | typedef Bu::List<Stat> Dir; | 136 | typedef Bu::List<Stat> Dir; |
| 133 | 137 | ||
| 134 | void stat( const Bu::String &sPath, Stat &rBuf ); | 138 | void stat( const Bu::String &sPath, Stat &rBuf ); |
| 135 | MyriadStream open( const Bu::String &sPath, int iMode ); | 139 | MyriadStream open( const Bu::String &sPath, int iMode ); |
| 136 | // void create( const Bu::String &sPath, uint16_t iPerms ); | 140 | void create( const Bu::String &sPath, uint16_t iPerms ); |
| 141 | void create( const Bu::String &sPath, uint16_t iPerms, | ||
| 142 | uint16_t iDevHi, uint16_t iDevLo ); | ||
| 143 | void create( const Bu::String &sPath, uint16_t iPerms, | ||
| 144 | uint32_t uSpecial ); | ||
| 145 | void mkDir( const Bu::String &sPath, uint16_t iPerms ); | ||
| 146 | Dir readDir( const Bu::String &sPath ); | ||
| 137 | 147 | ||
| 148 | static dev_t devToSys( uint32_t uDev ); | ||
| 149 | static uint32_t sysToDev( dev_t uDev ); | ||
| 138 | 150 | ||
| 139 | private: | 151 | private: |
| 140 | class RawStat | 152 | class RawStat |
| @@ -144,7 +156,7 @@ namespace Bu | |||
| 144 | int32_t iGroup; | 156 | int32_t iGroup; |
| 145 | uint16_t uPerms; | 157 | uint16_t uPerms; |
| 146 | int16_t iLinks; | 158 | int16_t iLinks; |
| 147 | int32_t iStreamIndex; | 159 | uint32_t uStreamIndex; |
| 148 | int32_t iParentNode; | 160 | int32_t iParentNode; |
| 149 | int64_t iATime; | 161 | int64_t iATime; |
| 150 | int64_t iMTime; | 162 | int64_t iMTime; |
| @@ -160,9 +172,9 @@ namespace Bu | |||
| 160 | Dir readDir( int32_t iNode ); | 172 | Dir readDir( int32_t iNode ); |
| 161 | MyriadStream openByInode( int32_t iNode ); | 173 | MyriadStream openByInode( int32_t iNode ); |
| 162 | int32_t create( int32_t iParent, const Bu::String &sName, | 174 | int32_t create( int32_t iParent, const Bu::String &sName, |
| 163 | uint16_t uPerms ); | 175 | uint16_t uPerms, uint32_t uSpecial ); |
| 164 | int32_t allocInode( const Bu::String &sName, int32_t iParent, | 176 | int32_t allocInode( const Bu::String &sName, int32_t iParent, |
| 165 | uint16_t uPerms ); | 177 | uint16_t uPerms, uint32_t uSpecial ); |
| 166 | void stat( int32_t iNode, Stat &rBuf, MyriadStream &rIs ); | 178 | void stat( int32_t iNode, Stat &rBuf, MyriadStream &rIs ); |
| 167 | void writeHeader(); | 179 | void writeHeader(); |
| 168 | 180 | ||
