SysTutorials

Linux Manual Pages › Section 3

nfstest-utils(3)

nfstest.utils – Utilities module

Description

Definition for common classes and constants

Classes

class SparseFile(baseobj.BaseObj)

SparseFile object
SparseFile() -> New sparse file object
Usage:
 # Create defintion for a sparse file of size 10000 having
 # two holes of size 1000 at offsets 3000 and 6000
 x = SparseFile("/mnt/t/file1", 10000, [3000, 6000], 1000)
 # Object attributes defined after creation using the above
 # sample data:
 # endhole: set to True if the file ends with a hole
 # Above example ends with data so,
 # x.endhole = False
 # data_offsets: list of data segment offsets
 # x.data_offsets = [0, 4000, 7000]
 # hole_offsets: list of hole segment offsets including the
 # imlicit hole at the end of the file
 # x.hole_offsets = [3000, 6000, 10000]
 # sparse_data: list of data/hole segments, each item in the list
 # has the following format [offset, size, type]
 # x.sparse_data = [[0, 3000, 1], [3000, 1000, 0], [4000, 2000, 1],
 # [6000, 1000, 0], [7000, 3000, 1]]
Methods defined here:
---------------------
__init__(self, absfile, file_size, hole_list, hole_size)
Create sparse file object definition, the file is not created
just the object. Object attributes are defined which makes it
easy to create the actual file.
absfile:
Absolute path name of file
file_size:
Total size of sparse file
hole_list:
List of hole offsets
hole_size:
Size for each hole

See Also

baseobj(3)

Bugs

No known bugs.

Author

Jorge Mora (mora [at] netapp.com)