void bluesky_dirent_destroy(gpointer dirent);
uint64_t bluesky_directory_lookup(BlueSkyInode *inode, gchar *name);
uint64_t bluesky_directory_ilookup(BlueSkyInode *inode, gchar *name);
+BlueSkyDirent *bluesky_directory_read(BlueSkyInode *dir, uint32_t cookie);
gboolean bluesky_directory_insert(BlueSkyInode *dir, const gchar *name,
uint64_t inum);
void bluesky_directory_dump(BlueSkyInode *dir);
return d->inum;
}
+/* 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);
+}
+
/* Insert a new entry into a directory. Should be called with the inode lock
* already held. */
gboolean bluesky_directory_insert(BlueSkyInode *dir,