diff options
author | Karel Zak | 2010-03-05 10:52:59 +0100 |
---|---|---|
committer | Karel Zak | 2010-06-03 15:20:11 +0200 |
commit | e7462a881930a41ec84bf0661ff19f8fd1dfe7be (patch) | |
tree | eebf6e56ea24483871efaf65136673b259df73d9 /shlibs/mount/src/iter.c | |
parent | libmount: read devno, ID and parent ID from /proc/self/mountinfo (diff) | |
download | kernel-qcow2-util-linux-e7462a881930a41ec84bf0661ff19f8fd1dfe7be.tar.gz kernel-qcow2-util-linux-e7462a881930a41ec84bf0661ff19f8fd1dfe7be.tar.xz kernel-qcow2-util-linux-e7462a881930a41ec84bf0661ff19f8fd1dfe7be.zip |
libblkid: add mnt_iter_get_direction()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/mount/src/iter.c')
-rw-r--r-- | shlibs/mount/src/iter.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/shlibs/mount/src/iter.c b/shlibs/mount/src/iter.c index d64f2d40d..4baa7ffb4 100644 --- a/shlibs/mount/src/iter.c +++ b/shlibs/mount/src/iter.c @@ -39,7 +39,7 @@ void mnt_free_iter(mnt_iter *itr) /** * mnt_reset_iter: * @itr: iterator pointer - * @direction: MNT_INTER_{FOR,BACK}WARD iterator direction + * @direction: MNT_INTER_{FOR,BACK}WARD or -1 to keep the derection unchanged * * Resets iterator. */ @@ -47,8 +47,23 @@ void mnt_reset_iter(mnt_iter *itr, int direction) { assert(itr); + if (direction == -1) + direction = itr->direction; + if (itr) { memset(itr, 0, sizeof(struct _mnt_iter)); itr->direction = direction; } } + +/** + * mnt_iter_get_direction: + * @itr: iterator pointer + * + * Returns: MNT_INTER_{FOR,BACK}WARD or -1 in case of error. + */ +int mnt_iter_get_direction(mnt_iter *itr) +{ + assert(itr); + return itr ? itr->direction : -1; +} |