#!/usr/bin/python3
#-*- encoding: Utf-8 -*-

EFS2_ERROR_CODES = {
    0x40000001: 'FS_DIAG_INCONSISTENT_STATE',
    0x40000002: 'FS_DIAG_INVALID_SEQ_NO',
    0x40000003: 'FS_DIAG_DIR_NOT_OPEN',
    0x40000004: 'FS_DIAG_DIRENT_NOT_FOUND',
    0x40000005: 'FS_DIAG_INVALID_PATH',
    0x40000006: 'FS_DIAG_PATH_TOO_LONG',
    0x40000007: 'FS_DIAG_TOO_MANY_OPEN_DIRS',
    0x40000008: 'FS_DIAG_INVALID_DIR_ENTRY',
    0x40000009: 'FS_DIAG_TOO_MANY_OPEN_FILES',
    0x4000000a: 'FS_DIAG_UNKNOWN_FILETYPE',
    0x4000000b: 'FS_DIAG_NOT_NAND_FLASH',
    0x4000000c: 'FS_DIAG_UNAVAILABLE_INFO'
}

EFS2_FILE_TYPES = {
    0o010000: 'FIFO (S_IFIFO)',
    0o020000: 'Character device (S_IFCHR)',
    0o040000: 'Directory (S_IFDIR)',
    0o060000: 'Block device (S_IFBLK)',
    0o100000: 'Regular file (S_IFREG)',
    0o120000: 'Symlink (S_IFLNK)',
    0o140000: 'Socket (S_IFSOCK)',
    0o160000: 'Item File (S_IFITM)',
    0o170000: 'Mask of all values (S_IFMT)',  
}

EFS2_DIAG_HELLO = 0
EFS2_DIAG_QUERY = 1
EFS2_DIAG_OPEN = 2
EFS2_DIAG_CLOSE = 3
EFS2_DIAG_READ = 4
EFS2_DIAG_WRITE = 5
EFS2_DIAG_SYMLINK = 6
EFS2_DIAG_READLINK = 7
EFS2_DIAG_UNLINK = 8
EFS2_DIAG_MKDIR = 9
EFS2_DIAG_RMDIR = 10
EFS2_DIAG_OPENDIR = 11
EFS2_DIAG_READDIR = 12
EFS2_DIAG_CLOSEDIR = 13
EFS2_DIAG_RENAME = 14
EFS2_DIAG_STAT = 15
EFS2_DIAG_LSTAT = 16
EFS2_DIAG_FSTAT = 17
EFS2_DIAG_CHMOD = 18
EFS2_DIAG_STATFS = 19
EFS2_DIAG_ACCESS = 20
EFS2_DIAG_DEV_INFO = 21
EFS2_DIAG_FACT_IMAGE_START = 22
EFS2_DIAG_FACT_IMAGE_READ = 23
EFS2_DIAG_FACT_IMAGE_END = 24
EFS2_DIAG_PREP_FACT_IMAGE = 25
EFS2_DIAG_PUT_DEPRECATED = 26
EFS2_DIAG_GET_DEPRECATED = 27
EFS2_DIAG_ERROR = 28
EFS2_DIAG_EXTENDED_INFO = 29
EFS2_DIAG_CHOWN = 30
EFS2_DIAG_BENCHMARK_START_TEST = 31
EFS2_DIAG_BENCHMARK_GET_RESULTS = 32
EFS2_DIAG_BENCHMARK_INIT = 33
EFS2_DIAG_SET_RESERVATION = 34
EFS2_DIAG_SET_QUOTA = 35
EFS2_DIAG_GET_GROUP_INFO = 36
EFS2_DIAG_DELTREE = 37
EFS2_DIAG_PUT = 38
EFS2_DIAG_GET = 39
EFS2_DIAG_TRUNCATE = 40
EFS2_DIAG_FTRUNCATE = 41
EFS2_DIAG_STATVFS_V2 = 42
EFS2_DIAG_MD5SUM = 43
EFS2_DIAG_HOTPLUG_FORMAT = 44
EFS2_DIAG_SHRED = 45
EFS2_DIAG_SET_IDLE_DEV_EVT_DUR = 46
EFS2_DIAG_HOTPLUG_DEVICE_INFO = 47
EFS2_DIAG_SYNC_NO_WAIT = 48
EFS2_DIAG_SYNC_GET_STATUS = 49
EFS2_DIAG_TRUNCATE64 = 50
EFS2_DIAG_FTRUNCATE64 = 51
EFS2_DIAG_LSEEK64 = 52
EFS2_DIAG_MAKE_GOLDEN_COPY = 53
EFS2_DIAG_FILESYSTEM_IMAGE_OPEN = 54
EFS2_DIAG_FILESYSTEM_IMAGE_READ = 55
EFS2_DIAG_FILESYSTEM_IMAGE_CLOSE = 56
