dmg-builder 26.0.16 → 26.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,158 +1,174 @@
1
- # -*- coding: utf-8 -*-
2
- from __future__ import unicode_literals
3
-
4
- from ctypes import *
5
- import struct
6
- import os
7
1
  import datetime
2
+ import os
8
3
  import uuid
9
-
10
- from .utils import *
11
-
12
- libc = cdll.LoadLibrary('/usr/lib/libc.dylib')
4
+ from ctypes import (
5
+ POINTER,
6
+ Structure,
7
+ Union,
8
+ byref,
9
+ c_byte,
10
+ c_char,
11
+ c_char_p,
12
+ c_int,
13
+ c_long,
14
+ c_longlong,
15
+ c_short,
16
+ c_uint,
17
+ c_ulong,
18
+ c_ulonglong,
19
+ c_ushort,
20
+ c_void_p,
21
+ cdll,
22
+ create_string_buffer,
23
+ sizeof,
24
+ )
25
+
26
+ from .utils import unix_epoch
27
+
28
+ libc = cdll.LoadLibrary("/usr/lib/libc.dylib")
13
29
 
14
30
  # Constants
15
- FSOPT_NOFOLLOW = 0x00000001
16
- FSOPT_NOINMEMUPDATE = 0x00000002
17
- FSOPT_REPORT_FULLSIZE = 0x00000004
18
- FSOPT_PACK_INVAL_ATTRS = 0x00000008
31
+ FSOPT_NOFOLLOW = 0x00000001
32
+ FSOPT_NOINMEMUPDATE = 0x00000002
33
+ FSOPT_REPORT_FULLSIZE = 0x00000004
34
+ FSOPT_PACK_INVAL_ATTRS = 0x00000008
19
35
  FSOPT_ATTR_CMN_EXTENDED = 0x00000020
20
- FSOPT_RETURN_REALDEV = 0x00000200
36
+ FSOPT_RETURN_REALDEV = 0x00000200
21
37
 
22
- VOL_CAPABILITIES_FORMAT = 0
38
+ VOL_CAPABILITIES_FORMAT = 0
23
39
  VOL_CAPABILITIES_INTERFACES = 1
24
40
 
25
41
  VOL_CAP_FMT_PERSISTENTOBJECTIDS = 0x00000001
26
- VOL_CAP_FMT_SYMBOLICLINKS = 0x00000002
27
- VOL_CAP_FMT_HARDLINKS = 0x00000004
28
- VOL_CAP_FMT_JOURNAL = 0x00000008
29
- VOL_CAP_FMT_JOURNAL_ACTIVE = 0x00000010
30
- VOL_CAP_FMT_NO_ROOT_TIMES = 0x00000020
31
- VOL_CAP_FMT_SPARSE_FILES = 0x00000040
32
- VOL_CAP_FMT_ZERO_RUNS = 0x00000080
33
- VOL_CAP_FMT_CASE_SENSITIVE = 0x00000100
34
- VOL_CAP_FMT_CASE_PRESERVING = 0x00000200
35
- VOL_CAP_FMT_FAST_STATFS = 0x00000400
36
- VOL_CAP_FMT_2TB_FILESIZE = 0x00000800
37
- VOL_CAP_FMT_OPENDENYMODES = 0x00001000
38
- VOL_CAP_FMT_HIDDEN_FILES = 0x00002000
39
- VOL_CAP_FMT_PATH_FROM_ID = 0x00004000
40
- VOL_CAP_FMT_NO_VOLUME_SIZES = 0x00008000
42
+ VOL_CAP_FMT_SYMBOLICLINKS = 0x00000002
43
+ VOL_CAP_FMT_HARDLINKS = 0x00000004
44
+ VOL_CAP_FMT_JOURNAL = 0x00000008
45
+ VOL_CAP_FMT_JOURNAL_ACTIVE = 0x00000010
46
+ VOL_CAP_FMT_NO_ROOT_TIMES = 0x00000020
47
+ VOL_CAP_FMT_SPARSE_FILES = 0x00000040
48
+ VOL_CAP_FMT_ZERO_RUNS = 0x00000080
49
+ VOL_CAP_FMT_CASE_SENSITIVE = 0x00000100
50
+ VOL_CAP_FMT_CASE_PRESERVING = 0x00000200
51
+ VOL_CAP_FMT_FAST_STATFS = 0x00000400
52
+ VOL_CAP_FMT_2TB_FILESIZE = 0x00000800
53
+ VOL_CAP_FMT_OPENDENYMODES = 0x00001000
54
+ VOL_CAP_FMT_HIDDEN_FILES = 0x00002000
55
+ VOL_CAP_FMT_PATH_FROM_ID = 0x00004000
56
+ VOL_CAP_FMT_NO_VOLUME_SIZES = 0x00008000
41
57
  VOL_CAP_FMT_DECMPFS_COMPRESSION = 0x00010000
42
- VOL_CAP_FMT_64BIT_OBJECT_IDS = 0x00020000
43
-
44
- VOL_CAP_INT_SEARCHFS = 0x00000001
45
- VOL_CAP_INT_ATTRLIST = 0x00000002
46
- VOL_CAP_INT_NFSEXPORT = 0x00000004
47
- VOL_CAP_INT_READDIRATTR = 0x00000008
48
- VOL_CAP_INT_EXCHANGEDATA = 0x00000010
49
- VOL_CAP_INT_COPYFILE = 0x00000020
50
- VOL_CAP_INT_ALLOCATE = 0x00000040
51
- VOL_CAP_INT_VOL_RENAME = 0x00000080
52
- VOL_CAP_INT_ADVLOCK = 0x00000100
53
- VOL_CAP_INT_FLOCK = 0x00000200
58
+ VOL_CAP_FMT_64BIT_OBJECT_IDS = 0x00020000
59
+
60
+ VOL_CAP_INT_SEARCHFS = 0x00000001
61
+ VOL_CAP_INT_ATTRLIST = 0x00000002
62
+ VOL_CAP_INT_NFSEXPORT = 0x00000004
63
+ VOL_CAP_INT_READDIRATTR = 0x00000008
64
+ VOL_CAP_INT_EXCHANGEDATA = 0x00000010
65
+ VOL_CAP_INT_COPYFILE = 0x00000020
66
+ VOL_CAP_INT_ALLOCATE = 0x00000040
67
+ VOL_CAP_INT_VOL_RENAME = 0x00000080
68
+ VOL_CAP_INT_ADVLOCK = 0x00000100
69
+ VOL_CAP_INT_FLOCK = 0x00000200
54
70
  VOL_CAP_INT_EXTENDED_SECURITY = 0x00000400
55
- VOL_CAP_INT_USERACCESS = 0x00000800
56
- VOL_CAP_INT_MANLOCK = 0x00001000
57
- VOL_CAP_INT_NAMEDSTREAMS = 0x00002000
58
- VOL_CAP_INT_EXTENDED_ATTR = 0x00004000
59
- VOL_CAP_INT_CLONE = 0x00010000
60
- VOL_CAP_INT_SNAPSHOT = 0x00020000
61
- VOL_CAP_INT_RENAME_SWAP = 0x00040000
62
- VOL_CAP_INT_RENAME_EXCL = 0x00080000
63
- VOL_CAP_INT_RENAME_OPENFAIL = 0x00100000
64
-
65
- ATTR_CMN_NAME = 0x00000001
66
- ATTR_CMN_DEVID = 0x00000002
67
- ATTR_CMN_FSID = 0x00000004
68
- ATTR_CMN_OBJTYPE = 0x00000008
69
- ATTR_CMN_OBJTAG = 0x00000010
70
- ATTR_CMN_OBJID = 0x00000020
71
- ATTR_CMN_OBJPERMANENTID = 0x00000040
72
- ATTR_CMN_PAROBJID = 0x00000080
73
- ATTR_CMN_SCRIPT = 0x00000100
74
- ATTR_CMN_CRTIME = 0x00000200
75
- ATTR_CMN_MODTIME = 0x00000400
76
- ATTR_CMN_CHGTIME = 0x00000800
77
- ATTR_CMN_ACCTIME = 0x00001000
78
- ATTR_CMN_BKUPTIME = 0x00002000
79
- ATTR_CMN_FNDRINFO = 0x00004000
80
- ATTR_CMN_OWNERID = 0x00008000
81
- ATTR_CMN_GRPID = 0x00010000
82
- ATTR_CMN_ACCESSMASK = 0x00020000
83
- ATTR_CMN_FLAGS = 0x00040000
84
- ATTR_CMN_GEN_COUNT = 0x00080000
85
- ATTR_CMN_DOCUMENT_ID = 0x00100000
86
- ATTR_CMN_USERACCESS = 0x00200000
87
- ATTR_CMN_EXTENDED_SECURITY = 0x00400000
88
- ATTR_CMN_UUID = 0x00800000
89
- ATTR_CMN_GRPUUID = 0x01000000
90
- ATTR_CMN_FILEID = 0x02000000
91
- ATTR_CMN_PARENTID = 0x04000000
92
- ATTR_CMN_FULLPATH = 0x08000000
93
- ATTR_CMN_ADDEDTIME = 0x10000000
94
- ATTR_CMN_ERROR = 0x20000000
71
+ VOL_CAP_INT_USERACCESS = 0x00000800
72
+ VOL_CAP_INT_MANLOCK = 0x00001000
73
+ VOL_CAP_INT_NAMEDSTREAMS = 0x00002000
74
+ VOL_CAP_INT_EXTENDED_ATTR = 0x00004000
75
+ VOL_CAP_INT_CLONE = 0x00010000
76
+ VOL_CAP_INT_SNAPSHOT = 0x00020000
77
+ VOL_CAP_INT_RENAME_SWAP = 0x00040000
78
+ VOL_CAP_INT_RENAME_EXCL = 0x00080000
79
+ VOL_CAP_INT_RENAME_OPENFAIL = 0x00100000
80
+
81
+ ATTR_CMN_NAME = 0x00000001
82
+ ATTR_CMN_DEVID = 0x00000002
83
+ ATTR_CMN_FSID = 0x00000004
84
+ ATTR_CMN_OBJTYPE = 0x00000008
85
+ ATTR_CMN_OBJTAG = 0x00000010
86
+ ATTR_CMN_OBJID = 0x00000020
87
+ ATTR_CMN_OBJPERMANENTID = 0x00000040
88
+ ATTR_CMN_PAROBJID = 0x00000080
89
+ ATTR_CMN_SCRIPT = 0x00000100
90
+ ATTR_CMN_CRTIME = 0x00000200
91
+ ATTR_CMN_MODTIME = 0x00000400
92
+ ATTR_CMN_CHGTIME = 0x00000800
93
+ ATTR_CMN_ACCTIME = 0x00001000
94
+ ATTR_CMN_BKUPTIME = 0x00002000
95
+ ATTR_CMN_FNDRINFO = 0x00004000
96
+ ATTR_CMN_OWNERID = 0x00008000
97
+ ATTR_CMN_GRPID = 0x00010000
98
+ ATTR_CMN_ACCESSMASK = 0x00020000
99
+ ATTR_CMN_FLAGS = 0x00040000
100
+ ATTR_CMN_GEN_COUNT = 0x00080000
101
+ ATTR_CMN_DOCUMENT_ID = 0x00100000
102
+ ATTR_CMN_USERACCESS = 0x00200000
103
+ ATTR_CMN_EXTENDED_SECURITY = 0x00400000
104
+ ATTR_CMN_UUID = 0x00800000
105
+ ATTR_CMN_GRPUUID = 0x01000000
106
+ ATTR_CMN_FILEID = 0x02000000
107
+ ATTR_CMN_PARENTID = 0x04000000
108
+ ATTR_CMN_FULLPATH = 0x08000000
109
+ ATTR_CMN_ADDEDTIME = 0x10000000
110
+ ATTR_CMN_ERROR = 0x20000000
95
111
  ATTR_CMN_DATA_PROTECT_FLAGS = 0x40000000
96
- ATTR_CMN_RETURNED_ATTRS = 0x80000000
97
- ATTR_CMN_ALL_ATTRS = 0xffffffff
98
-
99
- ATTR_CMN_VALIDMASK = 0xffffffff
100
- ATTR_CMN_SETMASK = 0x51c7ff00
101
- ATTR_CMN_VOLSETMASK = 0x00006700
102
-
103
- ATTR_VOL_FSTYPE = 0x00000001
104
- ATTR_VOL_SIGNATURE = 0x00000002
105
- ATTR_VOL_SIZE = 0x00000004
106
- ATTR_VOL_SPACEFREE = 0x00000008
107
- ATTR_VOL_SPACEAVAIL = 0x00000010
108
- ATTR_VOL_MINALLOCATION = 0x00000020
112
+ ATTR_CMN_RETURNED_ATTRS = 0x80000000
113
+ ATTR_CMN_ALL_ATTRS = 0xFFFFFFFF
114
+
115
+ ATTR_CMN_VALIDMASK = 0xFFFFFFFF
116
+ ATTR_CMN_SETMASK = 0x51C7FF00
117
+ ATTR_CMN_VOLSETMASK = 0x00006700
118
+
119
+ ATTR_VOL_FSTYPE = 0x00000001
120
+ ATTR_VOL_SIGNATURE = 0x00000002
121
+ ATTR_VOL_SIZE = 0x00000004
122
+ ATTR_VOL_SPACEFREE = 0x00000008
123
+ ATTR_VOL_SPACEAVAIL = 0x00000010
124
+ ATTR_VOL_MINALLOCATION = 0x00000020
109
125
  ATTR_VOL_ALLOCATIONCLUMP = 0x00000040
110
- ATTR_VOL_IOBLOCKSIZE = 0x00000080
111
- ATTR_VOL_OBJCOUNT = 0x00000100
112
- ATTR_VOL_FILECOUNT = 0x00000200
113
- ATTR_VOL_DIRCOUNT = 0x00000400
114
- ATTR_VOL_MAXOBJCOUNT = 0x00000800
115
- ATTR_VOL_MOUNTPOINT = 0x00001000
116
- ATTR_VOL_NAME = 0x00002000
117
- ATTR_VOL_MOUNTFLAGS = 0x00004000
118
- ATTR_VOL_MOUNTEDDEVICE = 0x00008000
119
- ATTR_VOL_ENCODINGSUSED = 0x00010000
120
- ATTR_VOL_CAPABILITIES = 0x00020000
121
- ATTR_VOL_UUID = 0x00040000
122
- ATTR_VOL_QUOTA_SIZE = 0x10000000
123
- ATTR_VOL_RESERVED_SIZE = 0x20000000
124
- ATTR_VOL_ATTRIBUTES = 0x40000000
125
- ATTR_VOL_INFO = 0x80000000
126
- ATTR_VOL_ALL_ATTRS = 0xf007ffff
127
-
128
- ATTR_DIR_LINKCOUNT = 0x00000001
129
- ATTR_DIR_ENTRYCOUNT = 0x00000002
130
- ATTR_DIR_MOUNTSTATUS = 0x00000004
131
- DIR_MNTSTATUS_MNTPOINT = 0x00000001
132
- DIR_MNTSTATUS_TRIGGER = 0x00000002
133
- ATTR_DIR_ALLOCSIZE = 0x00000008
134
- ATTR_DIR_IOBLOCKSIZE = 0x00000010
135
- ATTR_DIR_DATALENGTH = 0x00000020
136
- ATTR_DIR_ALL_ATTRS = 0x0000003f
137
-
138
- ATTR_DIR_VALIDMASK = 0x0000003f
139
- ATTR_DIR_SETMASK = 0x00000000
140
-
141
- ATTR_FILE_LINKCOUNT = 0x00000001
142
- ATTR_FILE_TOTALSIZE = 0x00000002
143
- ATTR_FILE_ALLOCSIZE = 0x00000004
144
- ATTR_FILE_IOBLOCKSIZE = 0x00000008
145
- ATTR_FILE_DEVTYPE = 0x00000020
146
- ATTR_FILE_FORKCOUNT = 0x00000080
147
- ATTR_FILE_FORKLIST = 0x00000100
148
- ATTR_FILE_DATALENGTH = 0x00000200
149
- ATTR_FILE_DATAALLOCSIZE = 0x00000400
150
- ATTR_FILE_RSRCLENGTH = 0x00001000
151
- ATTR_FILE_RSRCALLOCSIZE = 0x00002000
152
- ATTR_FILE_ALL_ATTRS = 0x000037ff
153
-
154
- ATTR_FILE_VALIDMASK = 0x000037ff
155
- ATTR_FILE_SETMASK = 0x00000020
126
+ ATTR_VOL_IOBLOCKSIZE = 0x00000080
127
+ ATTR_VOL_OBJCOUNT = 0x00000100
128
+ ATTR_VOL_FILECOUNT = 0x00000200
129
+ ATTR_VOL_DIRCOUNT = 0x00000400
130
+ ATTR_VOL_MAXOBJCOUNT = 0x00000800
131
+ ATTR_VOL_MOUNTPOINT = 0x00001000
132
+ ATTR_VOL_NAME = 0x00002000
133
+ ATTR_VOL_MOUNTFLAGS = 0x00004000
134
+ ATTR_VOL_MOUNTEDDEVICE = 0x00008000
135
+ ATTR_VOL_ENCODINGSUSED = 0x00010000
136
+ ATTR_VOL_CAPABILITIES = 0x00020000
137
+ ATTR_VOL_UUID = 0x00040000
138
+ ATTR_VOL_QUOTA_SIZE = 0x10000000
139
+ ATTR_VOL_RESERVED_SIZE = 0x20000000
140
+ ATTR_VOL_ATTRIBUTES = 0x40000000
141
+ ATTR_VOL_INFO = 0x80000000
142
+ ATTR_VOL_ALL_ATTRS = 0xF007FFFF
143
+
144
+ ATTR_DIR_LINKCOUNT = 0x00000001
145
+ ATTR_DIR_ENTRYCOUNT = 0x00000002
146
+ ATTR_DIR_MOUNTSTATUS = 0x00000004
147
+ DIR_MNTSTATUS_MNTPOINT = 0x00000001
148
+ DIR_MNTSTATUS_TRIGGER = 0x00000002
149
+ ATTR_DIR_ALLOCSIZE = 0x00000008
150
+ ATTR_DIR_IOBLOCKSIZE = 0x00000010
151
+ ATTR_DIR_DATALENGTH = 0x00000020
152
+ ATTR_DIR_ALL_ATTRS = 0x0000003F
153
+
154
+ ATTR_DIR_VALIDMASK = 0x0000003F
155
+ ATTR_DIR_SETMASK = 0x00000000
156
+
157
+ ATTR_FILE_LINKCOUNT = 0x00000001
158
+ ATTR_FILE_TOTALSIZE = 0x00000002
159
+ ATTR_FILE_ALLOCSIZE = 0x00000004
160
+ ATTR_FILE_IOBLOCKSIZE = 0x00000008
161
+ ATTR_FILE_DEVTYPE = 0x00000020
162
+ ATTR_FILE_FORKCOUNT = 0x00000080
163
+ ATTR_FILE_FORKLIST = 0x00000100
164
+ ATTR_FILE_DATALENGTH = 0x00000200
165
+ ATTR_FILE_DATAALLOCSIZE = 0x00000400
166
+ ATTR_FILE_RSRCLENGTH = 0x00001000
167
+ ATTR_FILE_RSRCALLOCSIZE = 0x00002000
168
+ ATTR_FILE_ALL_ATTRS = 0x000037FF
169
+
170
+ ATTR_FILE_VALIDMASK = 0x000037FF
171
+ ATTR_FILE_SETMASK = 0x00000020
156
172
 
157
173
  # These are deprecated
158
174
  ATTR_FORK_TOTALSIZE = 0x00000001
@@ -160,132 +176,192 @@ ATTR_FORK_ALLOCSIZE = 0x00000002
160
176
  ATTR_FORK_ALL_ATTRS = 0x00000003
161
177
 
162
178
  # These go in the fork attribute field
163
- ATTR_CMNEXT_RELPATH = 0x00000004
164
- ATTR_CMNEXT_PRIVATESIZE = 0x00000008
165
- ATTR_CMNEXT_LINKID = 0x0000010
166
- ATTR_CMNEXT_NOFIRMLINKPATH = 0x00000020
167
- ATTR_CMNEXT_REALDEVID = 0x00000040
168
- ATTR_CMNEXT_REALFSID = 0x00000080
169
- ATTR_CMNEXT_CLONEID = 0x00000100
170
- ATTR_CMNEXT_EXT_FLAGS = 0x00000200
179
+ ATTR_CMNEXT_RELPATH = 0x00000004
180
+ ATTR_CMNEXT_PRIVATESIZE = 0x00000008
181
+ ATTR_CMNEXT_LINKID = 0x0000010
182
+ ATTR_CMNEXT_NOFIRMLINKPATH = 0x00000020
183
+ ATTR_CMNEXT_REALDEVID = 0x00000040
184
+ ATTR_CMNEXT_REALFSID = 0x00000080
185
+ ATTR_CMNEXT_CLONEID = 0x00000100
186
+ ATTR_CMNEXT_EXT_FLAGS = 0x00000200
171
187
  ATTR_CMNEXT_RECURSIVE_GENCOUNT = 0x00000400
172
- ATTR_CMNEXT_ALL_ATTRS = 0x000007fc
188
+ ATTR_CMNEXT_ALL_ATTRS = 0x000007FC
173
189
 
174
- ATTR_CMNEXT_VALIDMASK = 0x000007fc
175
- ATTR_CMNEXT_SETMASK = 0x00000000
190
+ ATTR_CMNEXT_VALIDMASK = 0x000007FC
191
+ ATTR_CMNEXT_SETMASK = 0x00000000
176
192
 
177
- ATTR_FORK_VALIDMASK = 0x00000003
178
- ATTR_FORK_SETMASK = 0x00000000
193
+ ATTR_FORK_VALIDMASK = 0x00000003
194
+ ATTR_FORK_SETMASK = 0x00000000
179
195
 
180
196
  # These can't be used
181
- ATTR_CMN_NAMEDATTRCOUNT = 0x00080000
182
- ATTR_CMN_NAMEDATTRLIST = 0x00100000
183
- ATTR_FILE_CLUMPSIZE = 0x00000010
184
- ATTR_FILE_FILETYPE = 0x00000040
185
- ATTR_FILE_DATAEXTENTS = 0x00000800
186
- ATTR_FILE_RSRCEXTENTS = 0x00004000
197
+ ATTR_CMN_NAMEDATTRCOUNT = 0x00080000
198
+ ATTR_CMN_NAMEDATTRLIST = 0x00100000
199
+ ATTR_FILE_CLUMPSIZE = 0x00000010
200
+ ATTR_FILE_FILETYPE = 0x00000040
201
+ ATTR_FILE_DATAEXTENTS = 0x00000800
202
+ ATTR_FILE_RSRCEXTENTS = 0x00004000
203
+
187
204
 
188
205
  class attrlist(Structure):
189
- _fields_ = [('bitmapcount', c_ushort),
190
- ('reserved', c_ushort),
191
- ('commonattr', c_uint),
192
- ('volattr', c_uint),
193
- ('dirattr', c_uint),
194
- ('fileattr', c_uint),
195
- ('forkattr', c_uint)]
206
+ _fields_ = [
207
+ ("bitmapcount", c_ushort),
208
+ ("reserved", c_ushort),
209
+ ("commonattr", c_uint),
210
+ ("volattr", c_uint),
211
+ ("dirattr", c_uint),
212
+ ("fileattr", c_uint),
213
+ ("forkattr", c_uint),
214
+ ]
215
+
196
216
 
197
217
  class attribute_set_t(Structure):
198
- _fields_ = [('commonattr', c_uint),
199
- ('volattr', c_uint),
200
- ('dirattr', c_uint),
201
- ('fileattr', c_uint),
202
- ('forkattr', c_uint)]
218
+ _fields_ = [
219
+ ("commonattr", c_uint),
220
+ ("volattr", c_uint),
221
+ ("dirattr", c_uint),
222
+ ("fileattr", c_uint),
223
+ ("forkattr", c_uint),
224
+ ]
225
+
203
226
 
204
227
  class fsobj_id_t(Structure):
205
- _fields_ = [('fid_objno', c_uint),
206
- ('fid_generation', c_uint)]
228
+ _fields_ = [
229
+ ("fid_objno", c_uint),
230
+ ("fid_generation", c_uint),
231
+ ]
232
+
207
233
 
208
234
  class timespec(Structure):
209
- _fields_ = [('tv_sec', c_long),
210
- ('tv_nsec', c_long)]
235
+ _fields_ = [
236
+ ("tv_sec", c_long),
237
+ ("tv_nsec", c_long),
238
+ ]
239
+
211
240
 
212
241
  class attrreference_t(Structure):
213
- _fields_ = [('attr_dataoffset', c_int),
214
- ('attr_length', c_uint)]
242
+ _fields_ = [
243
+ ("attr_dataoffset", c_int),
244
+ ("attr_length", c_uint),
245
+ ]
246
+
215
247
 
216
248
  class fsid_t(Structure):
217
- _fields_ = [('val', c_uint * 2)]
249
+ _fields_ = [
250
+ ("val", c_uint * 2),
251
+ ]
252
+
218
253
 
219
254
  class guid_t(Structure):
220
- _fields_ = [('g_guid', c_byte*16)]
255
+ _fields_ = [
256
+ ("g_guid", c_byte * 16),
257
+ ]
258
+
221
259
 
222
260
  class kauth_ace(Structure):
223
- _fields_ = [('ace_applicable', guid_t),
224
- ('ace_flags', c_uint)]
261
+ _fields_ = [
262
+ ("ace_applicable", guid_t),
263
+ ("ace_flags", c_uint),
264
+ ]
265
+
225
266
 
226
267
  class kauth_acl(Structure):
227
- _fields_ = [('acl_entrycount', c_uint),
228
- ('acl_flags', c_uint),
229
- ('acl_ace', kauth_ace * 128)]
268
+ _fields_ = [
269
+ ("acl_entrycount", c_uint),
270
+ ("acl_flags", c_uint),
271
+ ("acl_ace", kauth_ace * 128),
272
+ ]
273
+
230
274
 
231
275
  class kauth_filesec(Structure):
232
- _fields_ = [('fsec_magic', c_uint),
233
- ('fsec_owner', guid_t),
234
- ('fsec_group', guid_t),
235
- ('fsec_acl', kauth_acl)]
276
+ _fields_ = [
277
+ ("fsec_magic", c_uint),
278
+ ("fsec_owner", guid_t),
279
+ ("fsec_group", guid_t),
280
+ ("fsec_acl", kauth_acl),
281
+ ]
282
+
236
283
 
237
284
  class diskextent(Structure):
238
- _fields_ = [('startblock', c_uint),
239
- ('blockcount', c_uint)]
285
+ _fields_ = [
286
+ ("startblock", c_uint),
287
+ ("blockcount", c_uint),
288
+ ]
289
+
240
290
 
241
291
  OSType = c_uint
242
292
  UInt16 = c_ushort
243
293
  SInt16 = c_short
244
294
  SInt32 = c_int
245
295
 
296
+
246
297
  class Point(Structure):
247
- _fields_ = [('x', SInt16),
248
- ('y', SInt16)]
298
+ _fields_ = [
299
+ ("x", SInt16),
300
+ ("y", SInt16),
301
+ ]
302
+
303
+
249
304
  class Rect(Structure):
250
- _fields_ = [('x', SInt16),
251
- ('y', SInt16),
252
- ('w', SInt16),
253
- ('h', SInt16)]
305
+ _fields_ = [
306
+ ("x", SInt16),
307
+ ("y", SInt16),
308
+ ("w", SInt16),
309
+ ("h", SInt16),
310
+ ]
311
+
312
+
254
313
  class FileInfo(Structure):
255
- _fields_ = [('fileType', OSType),
256
- ('fileCreator', OSType),
257
- ('finderFlags', UInt16),
258
- ('location', Point),
259
- ('reservedField', UInt16),
260
- ('reserved1', SInt16 * 4),
261
- ('extendedFinderFlags', UInt16),
262
- ('reserved2', SInt16),
263
- ('putAwayFolderID', SInt32)]
314
+ _fields_ = [
315
+ ("fileType", OSType),
316
+ ("fileCreator", OSType),
317
+ ("finderFlags", UInt16),
318
+ ("location", Point),
319
+ ("reservedField", UInt16),
320
+ ("reserved1", SInt16 * 4),
321
+ ("extendedFinderFlags", UInt16),
322
+ ("reserved2", SInt16),
323
+ ("putAwayFolderID", SInt32),
324
+ ]
325
+
326
+
264
327
  class FolderInfo(Structure):
265
- _fields_ = [('windowBounds', Rect),
266
- ('finderFlags', UInt16),
267
- ('location', Point),
268
- ('reservedField', UInt16),
269
- ('scrollPosition', Point),
270
- ('reserved1', SInt32),
271
- ('extendedFinderFlags', UInt16),
272
- ('reserved2', SInt16),
273
- ('putAwayFolderID', SInt32)]
328
+ _fields_ = [
329
+ ("windowBounds", Rect),
330
+ ("finderFlags", UInt16),
331
+ ("location", Point),
332
+ ("reservedField", UInt16),
333
+ ("scrollPosition", Point),
334
+ ("reserved1", SInt32),
335
+ ("extendedFinderFlags", UInt16),
336
+ ("reserved2", SInt16),
337
+ ("putAwayFolderID", SInt32),
338
+ ]
339
+
340
+
274
341
  class FinderInfo(Union):
275
- _fields_ = [('fileInfo', FileInfo),
276
- ('folderInfo', FolderInfo)]
342
+ _fields_ = [
343
+ ("fileInfo", FileInfo),
344
+ ("folderInfo", FolderInfo),
345
+ ]
277
346
 
278
- extentrecord = diskextent * 8
279
347
 
348
+ extentrecord = diskextent * 8
280
349
  vol_capabilities_set_t = c_uint * 4
281
350
 
351
+
282
352
  class vol_capabilities_attr_t(Structure):
283
- _fields_ = [('capabilities', vol_capabilities_set_t),
284
- ('valid', vol_capabilities_set_t)]
353
+ _fields_ = [
354
+ ("capabilities", vol_capabilities_set_t),
355
+ ("valid", vol_capabilities_set_t),
356
+ ]
357
+
285
358
 
286
359
  class vol_attributes_attr_t(Structure):
287
- _fields_ = [('validattr', attribute_set_t),
288
- ('nativeattr', attribute_set_t)]
360
+ _fields_ = [
361
+ ("validattr", attribute_set_t),
362
+ ("nativeattr", attribute_set_t),
363
+ ]
364
+
289
365
 
290
366
  dev_t = c_uint
291
367
 
@@ -342,30 +418,34 @@ int64_t = c_longlong
342
418
  uint64_t = c_ulonglong
343
419
  off_t = c_long
344
420
  size_t = c_ulong
345
- uuid_t = c_byte*16
421
+ uuid_t = c_byte * 16
346
422
 
347
423
  NAME_MAX = 255
348
424
  PATH_MAX = 1024
349
425
  FSTYPE_MAX = 16
350
426
 
427
+
351
428
  class struct_statfs(Structure):
352
- _fields_ = [('f_bsize', uint32_t),
353
- ('f_iosize', int32_t),
354
- ('f_blocks', uint64_t),
355
- ('f_bfree', uint64_t),
356
- ('f_bavail', uint64_t),
357
- ('f_files', uint64_t),
358
- ('f_ffree', uint64_t),
359
- ('f_fsid', fsid_t),
360
- ('f_owner', uid_t),
361
- ('f_type', uint32_t),
362
- ('f_flags', uint32_t),
363
- ('f_fssubtype', uint32_t),
364
- ('f_fstypename', c_char * FSTYPE_MAX),
365
- ('f_mntonname', c_char * PATH_MAX),
366
- ('f_mntfromname', c_char * PATH_MAX),
367
- ('f_flags_ext', uint32_t),
368
- ('f_reserved', uint32_t * 7)]
429
+ _fields_ = [
430
+ ("f_bsize", uint32_t),
431
+ ("f_iosize", int32_t),
432
+ ("f_blocks", uint64_t),
433
+ ("f_bfree", uint64_t),
434
+ ("f_bavail", uint64_t),
435
+ ("f_files", uint64_t),
436
+ ("f_ffree", uint64_t),
437
+ ("f_fsid", fsid_t),
438
+ ("f_owner", uid_t),
439
+ ("f_type", uint32_t),
440
+ ("f_flags", uint32_t),
441
+ ("f_fssubtype", uint32_t),
442
+ ("f_fstypename", c_char * FSTYPE_MAX),
443
+ ("f_mntonname", c_char * PATH_MAX),
444
+ ("f_mntfromname", c_char * PATH_MAX),
445
+ ("f_flags_ext", uint32_t),
446
+ ("f_reserved", uint32_t * 7),
447
+ ]
448
+
369
449
 
370
450
  # Calculate the maximum number of bytes required for the attribute buffer
371
451
  _attr_info = (
@@ -403,7 +483,6 @@ _attr_info = (
403
483
  (0, ATTR_CMN_FULLPATH, sizeof(attrreference_t) + PATH_MAX),
404
484
  (0, ATTR_CMN_ADDEDTIME, sizeof(timespec)),
405
485
  (0, ATTR_CMN_DATA_PROTECT_FLAGS, sizeof(uint32_t)),
406
-
407
486
  # Volume attributes
408
487
  (1, ATTR_VOL_FSTYPE, sizeof(uint32_t)),
409
488
  (1, ATTR_VOL_SIGNATURE, sizeof(uint32_t)),
@@ -427,7 +506,6 @@ _attr_info = (
427
506
  (1, ATTR_VOL_QUOTA_SIZE, sizeof(off_t)),
428
507
  (1, ATTR_VOL_RESERVED_SIZE, sizeof(off_t)),
429
508
  (1, ATTR_VOL_ATTRIBUTES, sizeof(vol_attributes_attr_t)),
430
-
431
509
  # Directory attributes
432
510
  (2, ATTR_DIR_LINKCOUNT, sizeof(uint32_t)),
433
511
  (2, ATTR_DIR_ENTRYCOUNT, sizeof(uint32_t)),
@@ -435,7 +513,6 @@ _attr_info = (
435
513
  (2, ATTR_DIR_ALLOCSIZE, sizeof(off_t)),
436
514
  (2, ATTR_DIR_IOBLOCKSIZE, sizeof(uint32_t)),
437
515
  (2, ATTR_DIR_DATALENGTH, sizeof(off_t)),
438
-
439
516
  # File attributes
440
517
  (3, ATTR_FILE_LINKCOUNT, sizeof(uint32_t)),
441
518
  (3, ATTR_FILE_TOTALSIZE, sizeof(off_t)),
@@ -452,11 +529,9 @@ _attr_info = (
452
529
  (3, ATTR_FILE_RSRCLENGTH, sizeof(off_t)),
453
530
  (3, ATTR_FILE_RSRCALLOCSIZE, sizeof(off_t)),
454
531
  (3, ATTR_FILE_RSRCEXTENTS, sizeof(extentrecord)),
455
-
456
532
  # Fork attributes
457
533
  (4, ATTR_FORK_TOTALSIZE, sizeof(off_t)),
458
534
  (4, ATTR_FORK_ALLOCSIZE, sizeof(off_t)),
459
-
460
535
  # Extended common attributes
461
536
  (4, ATTR_CMNEXT_RELPATH, sizeof(attrreference_t) + PATH_MAX),
462
537
  (4, ATTR_CMNEXT_PRIVATESIZE, sizeof(off_t)),
@@ -466,18 +541,21 @@ _attr_info = (
466
541
  (4, ATTR_CMNEXT_REALFSID, sizeof(fsid_t)),
467
542
  (4, ATTR_CMNEXT_CLONEID, sizeof(uint64_t)),
468
543
  (4, ATTR_CMNEXT_EXT_FLAGS, sizeof(uint64_t)),
469
- )
544
+ )
545
+
470
546
 
471
547
  def _attrbuf_size(attrs):
472
548
  size = 4
473
549
  for entry in _attr_info:
474
550
  if attrs[entry[0]] & entry[1]:
475
551
  if entry[2] is None:
476
- raise ValueError('Unsupported attribute (%u, %x)'
477
- % (entry[0], entry[1]))
552
+ raise ValueError(
553
+ "Unsupported attribute (%u, %x)" % (entry[0], entry[1])
554
+ )
478
555
  size += entry[2]
479
556
  return size
480
557
 
558
+
481
559
  _getattrlist = libc.getattrlist
482
560
  _getattrlist.argtypes = [c_char_p, POINTER(attrlist), c_void_p, c_ulong, c_ulong]
483
561
  _getattrlist.restype = c_int
@@ -487,30 +565,39 @@ _fgetattrlist.argtypes = [c_int, POINTER(attrlist), c_void_p, c_ulong, c_ulong]
487
565
  _fgetattrlist.restype = c_int
488
566
 
489
567
  try:
490
- _statfs = libc['statfs$INODE64']
568
+ _statfs = libc["statfs$INODE64"]
491
569
  except (KeyError, AttributeError):
492
- _statfs = libc['statfs']
570
+ _statfs = libc["statfs"]
493
571
 
494
- _statfs.argtypes = [c_char_p, POINTER(struct_statfs)]
572
+ _statfs.argtypes = [
573
+ c_char_p,
574
+ POINTER(struct_statfs),
575
+ ]
495
576
  _statfs.restype = c_int
496
577
 
497
578
  try:
498
- _fstatfs = libc['fstatfs$INODE64']
579
+ _fstatfs = libc["fstatfs$INODE64"]
499
580
  except (KeyError, AttributeError):
500
- _fstatfs = libc['fstatfs']
581
+ _fstatfs = libc["fstatfs"]
501
582
 
502
- _fstatfs.argtypes = [c_int, POINTER(struct_statfs)]
583
+ _fstatfs.argtypes = [
584
+ c_int,
585
+ POINTER(struct_statfs),
586
+ ]
503
587
  _fstatfs.restype = c_int
504
588
 
589
+
505
590
  def _datetime_from_timespec(ts):
506
591
  td = datetime.timedelta(seconds=ts.tv_sec + 1.0e-9 * ts.tv_nsec)
507
592
  return unix_epoch + td
508
593
 
594
+
509
595
  def _decode_utf8_nul(sz):
510
- nul = sz.find(b'\0')
596
+ nul = sz.find(b"\0")
511
597
  if nul > -1:
512
598
  sz = sz[:nul]
513
- return sz.decode('utf-8')
599
+ return sz.decode("utf-8")
600
+
514
601
 
515
602
  def _decode_attrlist_result(buf, attrs, options):
516
603
  result = []
@@ -525,14 +612,14 @@ def _decode_attrlist_result(buf, attrs, options):
525
612
  if attrs[0] & ATTR_CMN_RETURNED_ATTRS:
526
613
  a = attribute_set_t.from_buffer(buf, offset)
527
614
  result.append(a)
528
- offset += sizeof (attribute_set_t)
615
+ offset += sizeof(attribute_set_t)
529
616
  if not (options & FSOPT_PACK_INVAL_ATTRS):
530
617
  attrs = [a.commonattr, a.volattr, a.dirattr, a.fileattr, a.forkattr]
531
618
  if attrs[0] & ATTR_CMN_NAME:
532
619
  a = attrreference_t.from_buffer(buf, offset)
533
620
  ofs = offset + a.attr_dataoffset
534
- name = _decode_utf8_nul(buf[ofs:ofs+a.attr_length])
535
- offset += sizeof (attrreference_t)
621
+ name = _decode_utf8_nul(buf[ofs : ofs + a.attr_length])
622
+ offset += sizeof(attrreference_t)
536
623
  result.append(name)
537
624
  if attrs[0] & ATTR_CMN_DEVID:
538
625
  a = dev_t.from_buffer(buf, offset)
@@ -623,22 +710,29 @@ def _decode_attrlist_result(buf, attrs, options):
623
710
  ofs = offset + a.attr_dataoffset
624
711
  offset += sizeof(attrreference_t)
625
712
  ec = uint32_t.from_buffer(buf, ofs + 36).value
713
+
626
714
  class kauth_acl(Structure):
627
- _fields_ = [('acl_entrycount', c_uint),
628
- ('acl_flags', c_uint),
629
- ('acl_ace', kauth_ace * ec)]
715
+ _fields_ = [
716
+ ("acl_entrycount", c_uint),
717
+ ("acl_flags", c_uint),
718
+ ("acl_ace", kauth_ace * ec),
719
+ ]
720
+
630
721
  class kauth_filesec(Structure):
631
- _fields_ = [('fsec_magic', c_uint),
632
- ('fsec_owner', guid_t),
633
- ('fsec_group', guid_t),
634
- ('fsec_acl', kauth_acl)]
722
+ _fields_ = [
723
+ ("fsec_magic", c_uint),
724
+ ("fsec_owner", guid_t),
725
+ ("fsec_group", guid_t),
726
+ ("fsec_acl", kauth_acl),
727
+ ]
728
+
635
729
  a = kauth_filesec.from_buffer(buf, ofs)
636
730
  result.append(a)
637
731
  if attrs[0] & ATTR_CMN_UUID:
638
- result.append(uuid.UUID(bytes=buf[offset:offset+16]))
732
+ result.append(uuid.UUID(bytes=buf[offset : offset + 16]))
639
733
  offset += sizeof(guid_t)
640
734
  if attrs[0] & ATTR_CMN_GRPUUID:
641
- result.append(uuid.UUID(bytes=buf[offset:offset+16]))
735
+ result.append(uuid.UUID(bytes=buf[offset : offset + 16]))
642
736
  offset += sizeof(guid_t)
643
737
  if attrs[0] & ATTR_CMN_FILEID:
644
738
  a = uint64_t.from_buffer(buf, offset)
@@ -651,8 +745,8 @@ def _decode_attrlist_result(buf, attrs, options):
651
745
  if attrs[0] & ATTR_CMN_FULLPATH:
652
746
  a = attrreference_t.from_buffer(buf, offset)
653
747
  ofs = offset + a.attr_dataoffset
654
- path = _decode_utf8_nul(buf[ofs:ofs+a.attr_length])
655
- offset += sizeof (attrreference_t)
748
+ path = _decode_utf8_nul(buf[ofs : ofs + a.attr_length])
749
+ offset += sizeof(attrreference_t)
656
750
  result.append(path)
657
751
  if attrs[0] & ATTR_CMN_ADDEDTIME:
658
752
  a = timespec.from_buffer(buf, offset)
@@ -715,14 +809,14 @@ def _decode_attrlist_result(buf, attrs, options):
715
809
  if attrs[1] & ATTR_VOL_MOUNTPOINT:
716
810
  a = attrreference_t.from_buffer(buf, offset)
717
811
  ofs = offset + a.attr_dataoffset
718
- path = _decode_utf8_nul(buf[ofs:ofs+a.attr_length])
719
- offset += sizeof (attrreference_t)
812
+ path = _decode_utf8_nul(buf[ofs : ofs + a.attr_length])
813
+ offset += sizeof(attrreference_t)
720
814
  result.append(path)
721
815
  if attrs[1] & ATTR_VOL_NAME:
722
816
  a = attrreference_t.from_buffer(buf, offset)
723
817
  ofs = offset + a.attr_dataoffset
724
- name = _decode_utf8_nul(buf[ofs:ofs+a.attr_length])
725
- offset += sizeof (attrreference_t)
818
+ name = _decode_utf8_nul(buf[ofs : ofs + a.attr_length])
819
+ offset += sizeof(attrreference_t)
726
820
  result.append(name)
727
821
  if attrs[1] & ATTR_VOL_MOUNTFLAGS:
728
822
  a = uint32_t.from_buffer(buf, offset)
@@ -731,8 +825,8 @@ def _decode_attrlist_result(buf, attrs, options):
731
825
  if attrs[1] & ATTR_VOL_MOUNTEDDEVICE:
732
826
  a = attrreference_t.from_buffer(buf, offset)
733
827
  ofs = offset + a.attr_dataoffset
734
- path = _decode_utf8_nul(buf[ofs:ofs+a.attr_length])
735
- offset += sizeof (attrreference_t)
828
+ path = _decode_utf8_nul(buf[ofs : ofs + a.attr_length])
829
+ offset += sizeof(attrreference_t)
736
830
  result.append(path)
737
831
  if attrs[1] & ATTR_VOL_ENCODINGSUSED:
738
832
  a = c_ulonglong.from_buffer(buf, offset)
@@ -743,7 +837,7 @@ def _decode_attrlist_result(buf, attrs, options):
743
837
  offset += sizeof(vol_capabilities_attr_t)
744
838
  result.append(a)
745
839
  if attrs[1] & ATTR_VOL_UUID:
746
- result.append(uuid.UUID(bytes=buf[offset:offset+16]))
840
+ result.append(uuid.UUID(bytes=buf[offset : offset + 16]))
747
841
  offset += sizeof(uuid_t)
748
842
  if attrs[1] & ATTR_VOL_QUOTA_SIZE:
749
843
  a = off_t.from_buffer(buf, offset)
@@ -856,8 +950,8 @@ def _decode_attrlist_result(buf, attrs, options):
856
950
  if attrs[4] & ATTR_CMNEXT_RELPATH:
857
951
  a = attrreference_t.from_buffer(buf, offset)
858
952
  ofs = offset + a.attr_dataoffset
859
- path = _decode_utf8_nul(buf[ofs:ofs+a.attr_length])
860
- offset += sizeof (attrreference_t)
953
+ path = _decode_utf8_nul(buf[ofs : ofs + a.attr_length])
954
+ offset += sizeof(attrreference_t)
861
955
  result.append(path)
862
956
  if attrs[4] & ATTR_CMNEXT_PRIVATESIZE:
863
957
  a = off_t.from_buffer(buf, offset)
@@ -870,8 +964,8 @@ def _decode_attrlist_result(buf, attrs, options):
870
964
  if attrs[4] & ATTR_CMNEXT_NOFIRMLINKPATH:
871
965
  a = attrreference_t.from_buffer(buf, offset)
872
966
  ofs = offset + a.attr_dataoffset
873
- path = _decode_utf8_nul(buf[ofs:ofs+a.attr_length])
874
- offset += sizeof (attrreference_t)
967
+ path = _decode_utf8_nul(buf[ofs : ofs + a.attr_length])
968
+ offset += sizeof(attrreference_t)
875
969
  result.append(path)
876
970
  if attrs[4] & ATTR_CMNEXT_REALDEVID:
877
971
  a = dev_t.from_buffer(buf, offset)
@@ -892,31 +986,37 @@ def _decode_attrlist_result(buf, attrs, options):
892
986
 
893
987
  return result
894
988
 
989
+
895
990
  # Sadly, ctypes.get_errno() seems not to work
896
991
  __error = libc.__error
897
992
  __error.restype = POINTER(c_int)
898
993
 
994
+
899
995
  def _get_errno():
900
996
  return __error().contents.value
901
997
 
998
+
902
999
  def getattrlist(path, attrs, options):
903
1000
  if not isinstance(path, bytes):
904
- path = path.encode('utf-8')
1001
+ path = path.encode("utf-8")
905
1002
  attrs = list(attrs)
906
1003
  if attrs[1]:
907
1004
  attrs[1] |= ATTR_VOL_INFO
908
- alist = attrlist(bitmapcount=5,
909
- commonattr=attrs[0],
910
- volattr=attrs[1],
911
- dirattr=attrs[2],
912
- fileattr=attrs[3],
913
- forkattr=attrs[4])
1005
+ alist = attrlist(
1006
+ bitmapcount=5,
1007
+ commonattr=attrs[0],
1008
+ volattr=attrs[1],
1009
+ dirattr=attrs[2],
1010
+ fileattr=attrs[3],
1011
+ forkattr=attrs[4],
1012
+ )
914
1013
 
915
1014
  bufsize = _attrbuf_size(attrs)
916
1015
  buf = create_string_buffer(bufsize)
917
1016
 
918
- ret = _getattrlist(path, byref(alist), buf, bufsize,
919
- options | FSOPT_REPORT_FULLSIZE)
1017
+ ret = _getattrlist(
1018
+ path, byref(alist), buf, bufsize, options | FSOPT_REPORT_FULLSIZE
1019
+ )
920
1020
 
921
1021
  if ret < 0:
922
1022
  err = _get_errno()
@@ -924,24 +1024,26 @@ def getattrlist(path, attrs, options):
924
1024
 
925
1025
  return _decode_attrlist_result(buf, attrs, options)
926
1026
 
1027
+
927
1028
  def fgetattrlist(fd, attrs, options):
928
- if hasattr(fd, 'fileno'):
1029
+ if hasattr(fd, "fileno"):
929
1030
  fd = fd.fileno()
930
1031
  attrs = list(attrs)
931
1032
  if attrs[1]:
932
1033
  attrs[1] |= ATTR_VOL_INFO
933
- alist = attrlist(bitmapcount=5,
934
- commonattr=attrs[0],
935
- volattr=attrs[1],
936
- dirattr=attrs[2],
937
- fileattr=attrs[3],
938
- forkattr=attrs[4])
1034
+ alist = attrlist(
1035
+ bitmapcount=5,
1036
+ commonattr=attrs[0],
1037
+ volattr=attrs[1],
1038
+ dirattr=attrs[2],
1039
+ fileattr=attrs[3],
1040
+ forkattr=attrs[4],
1041
+ )
939
1042
 
940
1043
  bufsize = _attrbuf_size(attrs)
941
1044
  buf = create_string_buffer(bufsize)
942
1045
 
943
- ret = _fgetattrlist(fd, byref(alist), buf, bufsize,
944
- options | FSOPT_REPORT_FULLSIZE)
1046
+ ret = _fgetattrlist(fd, byref(alist), buf, bufsize, options | FSOPT_REPORT_FULLSIZE)
945
1047
 
946
1048
  if ret < 0:
947
1049
  err = _get_errno()
@@ -949,9 +1051,10 @@ def fgetattrlist(fd, attrs, options):
949
1051
 
950
1052
  return _decode_attrlist_result(buf, attrs, options)
951
1053
 
1054
+
952
1055
  def statfs(path):
953
1056
  if not isinstance(path, bytes):
954
- path = path.encode('utf-8')
1057
+ path = path.encode("utf-8")
955
1058
  result = struct_statfs()
956
1059
  ret = _statfs(path, byref(result))
957
1060
  if ret < 0:
@@ -959,8 +1062,9 @@ def statfs(path):
959
1062
  raise OSError(err, os.strerror(err), path)
960
1063
  return result
961
1064
 
1065
+
962
1066
  def fstatfs(fd):
963
- if hasattr(fd, 'fileno'):
1067
+ if hasattr(fd, "fileno"):
964
1068
  fd = fd.fileno()
965
1069
  result = struct_statfs()
966
1070
  ret = _fstatfs(fd, byref(result))