+/* Iterate through a directory listing. This returns one directory entry at a
+ * time, finding the first entry with a directory cookie value larger than the
+ * supplied one. Use a cookie of 0 to start reading from the start of a
+ * directory. */
+BlueSkyDirent *bluesky_directory_read(BlueSkyInode *dir, uint32_t cookie)
+{
+ BlueSkyDirent start = {NULL, NULL, cookie, 0};
+ GSequenceIter *i = g_sequence_search(dir->dirents, &start,
+ bluesky_dirent_compare, NULL);
+
+ if (g_sequence_iter_is_end(i))
+ return NULL;
+ else
+ return g_sequence_get(i);
+}
+