---
name: "nfstest.utils"
section: "3"
platform: "linux"
package: "nfstest"
version: "3.2-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/nfstest.utils"
---

# nfstest.utils(3)

Utilities module

## NAME

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 definition 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
    #   implicit 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

## FUNCTIONS

```
split_path(path)
Return list of components in path
```

## SEE ALSO

**[baseobj(3)](/baseobj/3.md)**

## BUGS

No known bugs.

## AUTHOR

Jorge Mora (mora@netapp.com)
