nfs-ganesha 1.4
Functions

cache_inode_open_close.c File Reference

Manage opening and closing files and caching file descriptors. More...

#include "fsal.h"
#include "abstract_atomic.h"
#include "log.h"
#include "HashData.h"
#include "HashTable.h"
#include "cache_inode.h"
#include "cache_inode_lru.h"
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <time.h>
#include <pthread.h>
#include <strings.h>
#include <assert.h>

Go to the source code of this file.

Functions

fsal_file_tcache_inode_fd (cache_entry_t *entry)
 Returns a file descriptor, if open.
bool_t is_open_for_write (cache_entry_t *entry)
 Check if a file is available to write.
bool_t is_open_for_read (cache_entry_t *entry)
 Check if a file is available to read.
cache_inode_status_t cache_inode_open (cache_entry_t *entry, fsal_openflags_t openflags, fsal_op_context_t *context, uint32_t flags, cache_inode_status_t *status)
 Opens a file descriptor.
cache_inode_status_t cache_inode_close (cache_entry_t *entry, uint32_t flags, cache_inode_status_t *status)
 Close a file.

Detailed Description

Manage opening and closing files and caching file descriptors.

vim:expandtab:shiftwidth=8:tabstop=8:

Copyright CEA/DAM/DIF (2008) contributeur : Philippe DENIEL philippe.deniel@cea.fr Thomas LEIBOVICI thomas.leibovici@cea.fr

This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

---------------------------------------

This file manages the opening and closing files and the file descriptor cache, in conjunction with the lru_thread in cache_inode_lru.

Definition in file cache_inode_open_close.c.


Function Documentation

cache_inode_status_t cache_inode_close ( cache_entry_t entry,
uint32_t  flags,
cache_inode_status_t status 
)

Close a file.

This function calls down to the FSAL to close the file.

Parameters:
[in]entryCache entry to close
[in]flagsFlags for lock management
[out]statusOperation status
Returns:
CACHE_INODE_SUCCESS or errors on failure

Definition at line 261 of file cache_inode_open_close.c.

fsal_file_t* cache_inode_fd ( cache_entry_t entry)

Returns a file descriptor, if open.

This function returns the file descriptor stored in a cache entry, if the cached file is open.

Parameters:
[in]entryEntry for the file on which to operate
Returns:
A pointer to a file descriptor or NULL if the entry is closed.

Definition at line 73 of file cache_inode_open_close.c.

cache_inode_status_t cache_inode_open ( cache_entry_t entry,
fsal_openflags_t  openflags,
fsal_op_context_t context,
uint32_t  flags,
cache_inode_status_t status 
)

Opens a file descriptor.

This function opens a file descriptor on a given cache entry.

Parameters:
[in]entryCache entry representing the file to open
[in]openflagsThe type of access for which to open
[in]contextFSAL operation context
[in]flagsFlags indicating lock status
[out]statusOperation status
Returns:
CACHE_INODE_SUCCESS if successful, errors otherwise

Definition at line 148 of file cache_inode_open_close.c.

bool_t is_open_for_read ( cache_entry_t entry)

Check if a file is available to read.

This function checks whether the given file is currently open in a mode supporting read operations.

Parameters:
[in]entryEntry for the file to check
Returns:
TRUE if the file is opened for reads

Definition at line 123 of file cache_inode_open_close.c.

bool_t is_open_for_write ( cache_entry_t entry)

Check if a file is available to write.

This function checks whether the given file is currently open in a mode supporting write operations.

Parameters:
[in]entryEntry for the file to check
Returns:
TRUE if the file is open for writes

Definition at line 102 of file cache_inode_open_close.c.