Iterator

Iterator — unified iterator

Functions

Types and Values

struct fdisk_iter

Description

The iterator keeps the direction and the last position for access to the internal library tables/lists.

It's very unusual to use the same iterator on multiple places in your application or share the same iterator, for this purpose libfdisk does not provide reference counting for this object. It's recommended to initialize the iterator by fdisk_new_iter() at begin of your function and then fdisk_free_iter() before you return from the function.

Don't forget to call fdisk_reset_iter() if you want to use the iterator more than once.

Functions

fdisk_free_iter ()

void
fdisk_free_iter (struct fdisk_iter *itr);

Deallocates the iterator.

Parameters

itr

iterator pointer

 

fdisk_iter_get_direction ()

int
fdisk_iter_get_direction (struct fdisk_iter *itr);

Parameters

itr

iterator pointer

 

Returns

FDISK_INTER_{FOR,BACK}WARD


fdisk_new_iter ()

struct fdisk_iter *
fdisk_new_iter (int direction);

Parameters

direction

FDISK_INTER_{FOR,BACK}WARD direction

 

Returns

newly allocated generic libmount iterator.


fdisk_reset_iter ()

void
fdisk_reset_iter (struct fdisk_iter *itr,
                  int direction);

Resets the iterator.

Parameters

itr

iterator pointer

 

direction

FDISK_ITER_{FOR,BACK}WARD or -1 to keep the direction unchanged

 

Types and Values

struct fdisk_iter

struct fdisk_iter;

Unified iterator.