1// MyLinux.h 2 3#ifndef ZIP7_INC_COMMON_MY_LINUX_H 4#define ZIP7_INC_COMMON_MY_LINUX_H 5 6// #include "../../C/7zTypes.h" 7 8#define MY_LIN_DT_UNKNOWN 0 9#define MY_LIN_DT_FIFO 1 10#define MY_LIN_DT_CHR 2 11#define MY_LIN_DT_DIR 4 12#define MY_LIN_DT_BLK 6 13#define MY_LIN_DT_REG 8 14#define MY_LIN_DT_LNK 10 15#define MY_LIN_DT_SOCK 12 16#define MY_LIN_DT_WHT 14 17 18#define MY_LIN_S_IFMT 00170000 19#define MY_LIN_S_IFSOCK 0140000 20#define MY_LIN_S_IFLNK 0120000 21#define MY_LIN_S_IFREG 0100000 22#define MY_LIN_S_IFBLK 0060000 23#define MY_LIN_S_IFDIR 0040000 24#define MY_LIN_S_IFCHR 0020000 25#define MY_LIN_S_IFIFO 0010000 26 27#define MY_LIN_S_ISLNK(m) (((m) & MY_LIN_S_IFMT) == MY_LIN_S_IFLNK) 28#define MY_LIN_S_ISREG(m) (((m) & MY_LIN_S_IFMT) == MY_LIN_S_IFREG) 29#define MY_LIN_S_ISDIR(m) (((m) & MY_LIN_S_IFMT) == MY_LIN_S_IFDIR) 30#define MY_LIN_S_ISCHR(m) (((m) & MY_LIN_S_IFMT) == MY_LIN_S_IFCHR) 31#define MY_LIN_S_ISBLK(m) (((m) & MY_LIN_S_IFMT) == MY_LIN_S_IFBLK) 32#define MY_LIN_S_ISFIFO(m) (((m) & MY_LIN_S_IFMT) == MY_LIN_S_IFIFO) 33#define MY_LIN_S_ISSOCK(m) (((m) & MY_LIN_S_IFMT) == MY_LIN_S_IFSOCK) 34 35#define MY_LIN_S_ISUID 0004000 36#define MY_LIN_S_ISGID 0002000 37#define MY_LIN_S_ISVTX 0001000 38 39#define MY_LIN_S_IRWXU 00700 40#define MY_LIN_S_IRUSR 00400 41#define MY_LIN_S_IWUSR 00200 42#define MY_LIN_S_IXUSR 00100 43 44#define MY_LIN_S_IRWXG 00070 45#define MY_LIN_S_IRGRP 00040 46#define MY_LIN_S_IWGRP 00020 47#define MY_LIN_S_IXGRP 00010 48 49#define MY_LIN_S_IRWXO 00007 50#define MY_LIN_S_IROTH 00004 51#define MY_LIN_S_IWOTH 00002 52#define MY_LIN_S_IXOTH 00001 53 54/* 55// major/minor encoding for makedev(): MMMMMmmmmmmMMMmm: 56 57inline UInt32 MY_dev_major(UInt64 dev) 58{ 59 return ((UInt32)(dev >> 8) & (UInt32)0xfff) | ((UInt32)(dev >> 32) & ~(UInt32)0xfff); 60} 61 62inline UInt32 MY_dev_minor(UInt64 dev) 63{ 64 return ((UInt32)(dev) & 0xff) | ((UInt32)(dev >> 12) & ~0xff); 65} 66 67inline UInt64 MY_dev_makedev(UInt32 __major, UInt32 __minor) 68{ 69 return (__minor & 0xff) | ((__major & 0xfff) << 8) 70 | ((UInt64) (__minor & ~0xff) << 12) 71 | ((UInt64) (__major & ~0xfff) << 32); 72} 73*/ 74 75#endif 76