1UTILS(3) utils 1.0 UTILS(3)
2
3
4
6 nfstest.utils - Utilities module
7
9 Definition for common classes and constants
10
12 class SparseFile(baseobj.BaseObj)
13 SparseFile object
14
15 SparseFile() -> New sparse file object
16
17 Usage:
18 # Create definition for a sparse file of size 10000 having
19 # two holes of size 1000 at offsets 3000 and 6000
20 x = SparseFile("/mnt/t/file1", 10000, [3000, 6000], 1000)
21
22 # Object attributes defined after creation using the above
23 # sample data:
24
25 # endhole: set to True if the file ends with a hole
26 # Above example ends with data so,
27 # x.endhole = False
28
29 # data_offsets: list of data segment offsets
30 # x.data_offsets = [0, 4000, 7000]
31
32 # hole_offsets: list of hole segment offsets including the
33 # implicit hole at the end of the file
34 # x.hole_offsets = [3000, 6000, 10000]
35
36 # sparse_data: list of data/hole segments, each item in the list
37 # has the following format [offset, size, type]
38 # x.sparse_data = [[0, 3000, 1], [3000, 1000, 0], [4000, 2000, 1],
39 # [6000, 1000, 0], [7000, 3000, 1]]
40
41
42 Methods defined here:
43 ---------------------
44
45 __init__(self, absfile, file_size, hole_list, hole_size)
46 Create sparse file object definition, the file is not created
47 just the object. Object attributes are defined which makes it
48 easy to create the actual file.
49
50
51 absfile:
52 Absolute path name of file
53
54 file_size:
55 Total size of sparse file
56
57 hole_list:
58 List of hole offsets
59
60 hole_size:
61 Size for each hole
62
64 split_path(path)
65 Return list of components in path
66
68 baseobj(3)
69
70
72 No known bugs.
73
75 Jorge Mora (mora@netapp.com)
76
77
78
79NFStest 2.1.5 14 February 2017 UTILS(3)