Skip to content

Commit

Permalink
Document semantics of add_entry parameter to readdir callback.
Browse files Browse the repository at this point in the history
  • Loading branch information
nrath-js committed Dec 3, 2024
1 parent 36cd288 commit e3da02a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/api/filesystem/async_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,9 @@ pub trait AsyncFileSystem: FileSystem {
/// the file system did not return a `Handle` from `opendir` then the contents of `handle` are
/// undefined.
///
/// `size` indicates the maximum number of bytes that should be returned by this method.
/// `size` indicates the maximum number of bytes that should be returned by this method,
/// but can be ignored in practice. Instead, entries are returned by calling the
/// `add_entry` function until it returns zero (indicating that the buffer is full).
///
/// If `offset` is non-zero then it corresponds to one of the `offset` values from a `DirEntry`
/// that was previously returned by a call to `readdir` for the same handle. In this case the
Expand Down Expand Up @@ -659,7 +661,9 @@ pub trait AsyncFileSystem: FileSystem {
/// the file system did not return a `Handle` from `opendir` then the contents of `handle` are
/// undefined.
///
/// `size` indicates the maximum number of bytes that should be returned by this method.
/// `size` indicates the maximum number of bytes that should be returned by this method,
/// but can be ignored in practice. Instead, entries are returned by calling the
/// `add_entry` function until it returns zero (indicating that the buffer is full).
///
/// Unlike `readdir`, the lookup count for `Inode`s associated with the returned directory
/// entries **IS** affected by this method (since it returns an `Entry` for each `DirEntry`).
Expand Down
9 changes: 7 additions & 2 deletions src/api/filesystem/sync_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,9 @@ pub trait FileSystem {
/// the file system did not return a `Handle` from `opendir` then the contents of `handle` are
/// undefined.
///
/// `size` indicates the maximum number of bytes that should be returned by this method.
/// `size` indicates the maximum number of bytes that should be returned by this method,
/// but can be ignored in practice. Instead, entries are returned by calling the
/// `add_entry` function until it returns zero (indicating that the buffer is full).
///
/// If `offset` is non-zero then it corresponds to one of the `offset` values from a `DirEntry`
/// that was previously returned by a call to `readdir` for the same handle. In this case the
Expand Down Expand Up @@ -675,7 +677,10 @@ pub trait FileSystem {
/// the file system did not return a `Handle` from `opendir` then the contents of `handle` are
/// undefined.
///
/// `size` indicates the maximum number of bytes that should be returned by this method.
/// `size` indicates the maximum number of bytes that should be returned by this method,
/// but can be ignored in practice. Instead, entries are returned by calling the
/// `add_entry` function until it returns zero (indicating that the buffer is full).
///
///
/// Unlike `readdir`, the lookup count for `Inode`s associated with the returned directory
/// entries **IS** affected by this method (since it returns an `Entry` for each `DirEntry`).
Expand Down

0 comments on commit e3da02a

Please sign in to comment.