]> err.no Git - util-linux/commitdiff
libblkid: add mnt_iter_get_direction()
authorKarel Zak <kzak@redhat.com>
Fri, 5 Mar 2010 09:52:59 +0000 (10:52 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 3 Jun 2010 13:20:11 +0000 (15:20 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
shlibs/mount/src/iter.c
shlibs/mount/src/mount.h.in
shlibs/mount/src/mount.sym

index d64f2d40d7668527ab6531bdec3ec6d7ef539393..4baa7ffb4a24518de22b015118092178bf5f88ca 100644 (file)
@@ -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;
+}
index 8e71213aa598e07f2d4897b4ed785ea8f31fe915..585b9fca3c6d73d7aee3651c2377a4452e91104a 100644 (file)
@@ -147,6 +147,7 @@ enum {
 extern mnt_iter *mnt_new_iter(int direction);
 extern void mnt_free_iter(mnt_iter *mi);
 extern void mnt_reset_iter(mnt_iter *mi, int direction);
+extern int mnt_iter_get_direction(mnt_iter *itr);
 
 /* optmap.c */
 enum {
index 3bc32ecddcded5a73f2495d1dcc80db65c1a8497..6740bbcd366da57a08718792080c8d1a7b3a9e91 100644 (file)
@@ -46,6 +46,7 @@ global:
        mnt_fstype_is_pseudofs;
        mnt_get_builtin_optmap;
        mnt_get_library_version;
+       mnt_iter_get_direction;
        mnt_lock_file;
        mnt_lock_get_linkfile;
        mnt_lock_get_lockfile;