nfs-ganesha 1.4
|
Reads the content of a directory. More...
#include "abstract_atomic.h"
#include "log.h"
#include "HashData.h"
#include "HashTable.h"
#include "fsal.h"
#include "cache_inode.h"
#include "cache_inode_lru.h"
#include "cache_inode_avl.h"
#include "cache_inode_weakref.h"
#include <unistd.h>
#include <sys/types.h>
#include <sys/param.h>
#include <time.h>
#include <pthread.h>
#include <assert.h>
Go to the source code of this file.
Reads the content of a directory.
Reads the content of a directory, also includes support functions for cached directories.
Definition in file cache_inode_readdir.c.
cache_inode_status_t cache_inode_add_cached_dirent | ( | cache_entry_t * | parent, |
fsal_name_t * | name, | ||
cache_entry_t * | entry, | ||
cache_inode_dir_entry_t ** | dir_entry, | ||
cache_inode_status_t * | status | ||
) |
Adds a directory entry to a cached directory.
This function adds a new directory entry to a directory. Directory entries have only weak references, so they do not prevent recycling or freeing the entry they locate. This function may be called either once (for handling creation) or iteratively in directory population.
[in,out] | parent | Cache entry of the directory being updated |
[in] | name | The name to add to the entry |
[in] | entry | The cache entry associated with name |
[out] | dir_entry | The directory entry newly added (optional) |
[out] | status | Same as return value |
Definition at line 260 of file cache_inode_readdir.c.
cache_inode_status_t cache_inode_invalidate_all_cached_dirent | ( | cache_entry_t * | entry, |
cache_inode_status_t * | status | ||
) |
Invalidates all cached entries for a directory.
Invalidates all the entries for a cached directory. The content lock must be held when this function is called.
[in,out] | entry | The directory to be managed |
[out] | status | Returned status. |
Definition at line 76 of file cache_inode_readdir.c.
cache_inode_status_t cache_inode_operate_cached_dirent | ( | cache_entry_t * | directory, |
fsal_name_t * | name, | ||
fsal_name_t * | newname, | ||
cache_inode_dirent_op_t | dirent_op | ||
) |
Perform an operation on it on a cached entry.
This function looks up an entry in the drectory cache and performs the indicated operation. If the directory has not been populated, it will not return not found errors.
The caller must hold the content lock on the directory.
[in] | directory | The directory to be operated upon |
[in] | name | The name of the relevant entry |
[in] | newname | The new name for renames |
[in] | dirent_op | The operation (LOOKUP, REMOVE, or RENAME) to perform |
CACHE_INODE_SUCCESS | on success or failure in an unpopulated directory. |
CACHE_INODE_BAD_TYPE | if the supplied cache entry is not a directory. |
CACHE_INODE_NOT_FOUND | on lookup failure in a populated directory. |
CACHE_INODE_ENTRY_EXISTS | on rename collission in a populated directory. |
Definition at line 126 of file cache_inode_readdir.c.
cache_inode_status_t cache_inode_readdir | ( | cache_entry_t * | directory, |
uint64_t | cookie, | ||
unsigned int * | nbfound, | ||
bool_t * | eod_met, | ||
fsal_op_context_t * | context, | ||
cache_inode_readdir_cb_t | cb, | ||
void * | cb_opaque, | ||
cache_inode_status_t * | status | ||
) |
Reads a directory.
This function iterates over the cached directory entries (possibly after populating the cache) and invokes a supplied callback function for each one.
The caller must not hold the attribute or content locks on directory.
[in] | directory | The directory to be read |
[in] | cookie | Starting cookie for the readdir operation |
[out] | nbfound | Number of entries returned. |
[out] | eod_met | Whether the end of directory was met |
[in] | context | FSAL credentials |
[in] | cb | The callback function to receive entries |
[in] | cb_opaque | A pointer passed as the first argument to cb |
[out] | status | Returned status |
CACHE_INODE_SUCCESS | if operation is a success |
CACHE_INODE_BAD_TYPE | if entry is not related to a directory |
Definition at line 601 of file cache_inode_readdir.c.
cache_inode_status_t cache_inode_readdir_populate | ( | cache_entry_t * | directory, |
fsal_op_context_t * | context, | ||
cache_inode_status_t * | status | ||
) |
Cache complete directory contents.
This function reads a complete directory from the FSAL and caches both the names and filess. The content lock must be held on the directory being read.
[in] | directory | Entry for the parent directory to be read |
[in] | context | FSAL credentials |
[out] | status | Returned status |
Definition at line 374 of file cache_inode_readdir.c.
cache_inode_status_t cache_inode_remove_cached_dirent | ( | cache_entry_t * | directory, |
fsal_name_t * | name, | ||
cache_inode_status_t * | status | ||
) |
Removes an entry from a cached directory.
This function removes the named entry from a cached directory. The caller must hold the content lock.
[in,out] | directory | The cache entry representing the directory |
[in] | name | The name indicating the entry to remove |
[out] | status | Returned status |
CACHE_INODE_SUCCESS | on success. |
CACHE_INODE_BAD_TYPE | if directory is not a directory. |
The | result of cache_inode_operate_cached_dirent |
Definition at line 337 of file cache_inode_readdir.c.