-
Notifications
You must be signed in to change notification settings - Fork 21
/
yaffs.py
56 lines (48 loc) · 1.66 KB
/
yaffs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# -*- encoding: utf-8 -*-
from ctypes import Structure, c_uint32, c_uint8, c_uint16, c_char, c_int32
class PackedTags2TagsPart(Structure):
_fields_ = [('sequenceNumber', c_uint32),
('objectId', c_uint32),
('chunkId', c_uint32),
('byteCount', c_uint32)]
class ECCOther(Structure):
_fields_ = [('colParity', c_uint8),
('lineParity', c_uint32),
('lineParityPrime', c_uint32)]
class PackedTags2(Structure):
_fields_ = [('t', PackedTags2TagsPart),
('ecc', ECCOther)]
MAX_NAME_LENGTH = 255
MAX_ALIAS_LENGTH = 159
class ObjectHeader(Structure):
_fields_ = [('type', c_int32),
('parentObjectId', c_int32),
('sum__NoLongerUsed', c_uint16),
('name', c_char*(MAX_NAME_LENGTH+1)),
('yst_mode', c_uint32),
('yst_uid', c_uint32),
('yst_gid', c_uint32),
('yst_atime', c_uint32),
('yst_mtime', c_uint32),
('yst_ctime', c_uint32),
('fileSize', c_int32),
('equivalentObjectId', c_int32),
('alias', c_char*(MAX_ALIAS_LENGTH + 1)),
('yst_rdev', c_uint32),
('roomToGrow', c_uint32*6),
('inbandShadowsObject', c_uint32),
('inbandIsShrink', c_uint32),
('reservedSpace', c_uint32*2),
('shadowsObject', c_int32),
('isShrink', c_uint32),
]
OBJECTID_ROOT = 1
CHUNK_SIZE = 2048
SPARE_SIZE = 64
# yaffs object types
UNKNOWN = 1
FILE = 1
SYMLINK = 2
DIRECTORY = 3
HARDLINK = 4
SPECIAL = 5