blob: d64f2d40d7668527ab6531bdec3ec6d7ef539393 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
/*
* Copyright (C) 2009 Karel Zak <kzak@redhat.com>
*
* This file may be redistributed under the terms of the
* GNU Lesser General Public License.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "mountP.h"
/**
* mnt_new_iter:
* @direction: MNT_INTER_{FOR,BACK}WARD direction
*
* Returns newly allocated generic libmount iterator.
*/
mnt_iter *mnt_new_iter(int direction)
{
mnt_iter *itr = calloc(1, sizeof(struct _mnt_iter));
if (!itr)
return NULL;
itr->direction = direction;
return itr;
}
/**
* mnt_free_iter:
* @itr: iterator pointer
*
* Deallocates iterator.
*/
void mnt_free_iter(mnt_iter *itr)
{
free(itr);
}
/**
* mnt_reset_iter:
* @itr: iterator pointer
* @direction: MNT_INTER_{FOR,BACK}WARD iterator direction
*
* Resets iterator.
*/
void mnt_reset_iter(mnt_iter *itr, int direction)
{
assert(itr);
if (itr) {
memset(itr, 0, sizeof(struct _mnt_iter));
itr->direction = direction;
}
}
|