Directory reading

How to read a million inodes as fast as possible. More...

Defines

#define HAVE_GETDENTS64   1
 If the system fulfills all necessary checks to use getdents(), this macro is set.

Typedefs

typedef int dir__handle
 The type of handle.
typedef struct dirent64 fsvs_dirent
 A compatibility structure.

Functions

int dir__start_enum (dir__handle *dh, char *path)
 Starts enumeration of the given path.
int dir__enum (dir__handle dh, fsvs_dirent *dirp, unsigned int count)
 The enumeration function.
int dir__close (dir__handle dh)
 Simply closes the handle dh.
int dir__get_dir_size (dir__handle dh, struct sstat_t *st)
 How to get the length of a directory (in bytes), from a handle dh, into st->size.

Detailed Description

How to read a million inodes as fast as possible.

Why?

Why do we care for getdents64 instead of simply using the (portable) readdir()?

How?

We have two kinds of directory reading codes.

Which one to use is defined by configure.


Define Documentation

#define HAVE_GETDENTS64   1

If the system fulfills all necessary checks to use getdents(), this macro is set.

Definition at line 62 of file direnum.c.


Typedef Documentation

typedef int dir__handle

The type of handle.

Definition at line 73 of file direnum.c.

typedef struct dirent64 fsvs_dirent

A compatibility structure.

It has an inode; a name; and a record length in it, to get from one record to the next.

Definition at line 77 of file direnum.c.


Function Documentation

int dir__close ( dir__handle  dh  )  [inline]

Simply closes the handle dh.

Definition at line 111 of file direnum.c.

References STOPIF_CODE_ERR.

Referenced by dir__enumerator().

Here is the caller graph for this function:

int dir__enum ( dir__handle  dh,
fsvs_dirent dirp,
unsigned int  count 
) [inline]

The enumeration function.

Parameters:
dh The handle given by dir__start_enum.
dirp The space where data should be returned
count The maximum number of bytes in dirp.
Returns:
The number of bytes used in dirp.

Definition at line 103 of file direnum.c.

Referenced by dir__enumerator().

Here is the caller graph for this function:

int dir__get_dir_size ( dir__handle  dh,
struct sstat_t st 
) [inline]

How to get the length of a directory (in bytes), from a handle dh, into st->size.

Definition at line 126 of file direnum.c.

References hlp__fstat(), and STOPIF.

Referenced by dir__enumerator().

Here is the call graph for this function:

Here is the caller graph for this function:

int dir__start_enum ( dir__handle dh,
char *  path 
) [inline]

Starts enumeration of the given path.

The directory handle is returned in *dirp.

Returns:
0 for success, or an error code.

Definition at line 83 of file direnum.c.

References STOPIF_CODE_ERR.

Referenced by dir__enumerator().

Here is the caller graph for this function:


Generated for fsvs by  doxygen 1.6.1