nfs-ganesha 1.4
|
#include "fsal_types.h"
Go to the source code of this file.
Defines | |
#define | MAX_HANDLEIDSTR_SIZE 21 |
#define | MAX_DEVICEIDSTR_SIZE 21 |
#define | MAX_INODESTR_SIZE 21 |
#define | MAX_HANDLETSSTR_SIZE 11 |
#define | MAX_CTIMESTR_SIZE 11 |
#define | MAX_NLINKSTR_SIZE 11 |
#define | MAX_FTYPESTR_SIZE 11 |
#define | ReturnCodeDB(_code_, _minor_) |
#define | CheckCommand(_res_) |
#define | CheckResult(_res_) |
#define | CheckConn(_p_conn_) |
#define | BeginTransaction(_conn_, _res_) |
#define | EndTransaction(_conn_, _res_) |
#define | RollbackTransaction(_conn_, _res_) |
Functions | |
fsal_posixdb_status_t | fsal_posixdb_buildOnePath (fsal_posixdb_conn *p_conn, posixfsal_handle_t *p_handle, fsal_path_t *p_path) |
fsal_posixdb_status_t | fsal_posixdb_recursiveDelete (fsal_posixdb_conn *p_conn, char *handleid_str, char *handlets_str, fsal_nodetype_t ftype) |
fsal_posixdb_status_t | fsal_posixdb_deleteParent (fsal_posixdb_conn *p_conn, char *handleid_str, char *handlets_str, char *handleidparent_str, char *handletsparent_str, char *filename, int nlink) |
fsal_posixdb_status_t | fsal_posixdb_internal_delete (fsal_posixdb_conn *p_conn, char *handleidparent_str, char *handletsparent_str, char *filename, fsal_posixdb_fileinfo_t *p_object_info) |
fsal_posixdb_status_t | fsal_posixdb_initPreparedQueries (fsal_posixdb_conn *p_conn) |
fsal_posixdb_status_t | posixdb_internal_fillFileinfoFromStrValues (fsal_posixdb_fileinfo_t *p_info, char *devid_str, char *inode_str, char *nlink_str, char *ctime_str, char *ftype_str) |
Fill a fsal_posixdb_fileinfo_t struct from char* values. | |
void | fsal_posixdb_CachePath (posixfsal_handle_t *p_handle, fsal_path_t *p_path) |
void | fsal_posixdb_InvalidateCache () |
int | fsal_posixdb_GetPathCache (posixfsal_handle_t *p_handle, fsal_path_t *p_path) |
int | fsal_posixdb_UpdateInodeCache (posixfsal_handle_t *p_handle) |
int | fsal_posixdb_GetInodeCache (posixfsal_handle_t *p_handle) |
#define BeginTransaction | ( | _conn_, | |
_res_ | |||
) |
do { \ PGTransactionStatusType transStatus = PQtransactionStatus(_conn_);\ if (transStatus != PQTRANS_ACTIVE && transStatus != PQTRANS_INTRANS) { \ _res_ = PQexec(_conn_, "BEGIN"); \ CheckCommand(_res_); \ PQclear(_res_); \ } \ } while (0)
Definition at line 58 of file PGSQL/posixdb_internal.h.
#define CheckCommand | ( | _res_ | ) |
do { \ if (PQresultStatus( _res_ ) != PGRES_COMMAND_OK) \ { \ LogCrit(COMPONENT_FSAL, "PGSQL Command Failed in %s ( %s:%i ) with %s", __FUNCTION__, __FILE__, __LINE__, (PQresultErrorMessage(_res_))); \ PQclear(_res_); \ RollbackTransaction( p_conn, _res_ ); \ ReturnCodeDB(ERR_FSAL_POSIXDB_CMDFAILED, (PQresultStatus( _res_ ))); \ } \ } while (0)
Definition at line 29 of file PGSQL/posixdb_internal.h.
#define CheckConn | ( | _p_conn_ | ) |
do { \ if (PQstatus( _p_conn_ ) != CONNECTION_OK) { \ LogCrit(COMPONENT_FSAL, "Reconnecting to database..."); \ PQreset( _p_conn_ );\ if (PQstatus( _p_conn_ ) != CONNECTION_OK) ReturnCodeDB(ERR_FSAL_POSIXDB_BADCONN, PQstatus( _p_conn_ ));/* Connexion still bad */ \ fsal_posixdb_initPreparedQueries( _p_conn_ ); \ } \ } while (0)
Definition at line 49 of file PGSQL/posixdb_internal.h.
#define CheckResult | ( | _res_ | ) |
do { \ if (PQresultStatus( _res_ ) != PGRES_TUPLES_OK) \ { \ LogCrit(COMPONENT_FSAL, "PGSQL Select Failed in %s ( %s:%i ) with %s", __FUNCTION__, __FILE__, __LINE__, (PQresultErrorMessage(_res_))); \ PQclear(_res_); \ RollbackTransaction( p_conn, _res_ ); \ ReturnCodeDB(ERR_FSAL_POSIXDB_CMDFAILED, (PQresultStatus( _res_ ))); \ } \ } while (0)
Definition at line 39 of file PGSQL/posixdb_internal.h.
#define EndTransaction | ( | _conn_, | |
_res_ | |||
) |
do { \ _res_ = PQexec(_conn_, "END"); \ CheckCommand(_res_); \ PQclear(_res_); \ } while (0)
Definition at line 67 of file PGSQL/posixdb_internal.h.
#define MAX_CTIMESTR_SIZE 11 |
Definition at line 14 of file PGSQL/posixdb_internal.h.
#define MAX_DEVICEIDSTR_SIZE 21 |
Definition at line 11 of file PGSQL/posixdb_internal.h.
#define MAX_FTYPESTR_SIZE 11 |
Definition at line 16 of file PGSQL/posixdb_internal.h.
#define MAX_HANDLEIDSTR_SIZE 21 |
Definition at line 10 of file PGSQL/posixdb_internal.h.
#define MAX_HANDLETSSTR_SIZE 11 |
Definition at line 13 of file PGSQL/posixdb_internal.h.
#define MAX_INODESTR_SIZE 21 |
Definition at line 12 of file PGSQL/posixdb_internal.h.
#define MAX_NLINKSTR_SIZE 11 |
Definition at line 15 of file PGSQL/posixdb_internal.h.
#define ReturnCodeDB | ( | _code_, | |
_minor_ | |||
) |
do { \ fsal_posixdb_status_t _struct_status_; \ if(isFullDebug(COMPONENT_FSAL)) \ { \ LogCrit(COMPONENT_FSAL, "Exiting %s ( %s:%i ) with status code = %i/%i\n", __FUNCTION__, __FILE__, __LINE__ - 2, _code_, _minor_ ); \ } \ (_struct_status_).major = (_code_) ; \ (_struct_status_).minor = (_minor_) ; \ return (_struct_status_); \ } while(0)
Definition at line 18 of file PGSQL/posixdb_internal.h.
#define RollbackTransaction | ( | _conn_, | |
_res_ | |||
) |
do { \ _res_ = PQexec(_conn_, "ROLLBACK"); \ PQclear(_res_); \ } while (0)
Definition at line 73 of file PGSQL/posixdb_internal.h.
fsal_posixdb_status_t fsal_posixdb_buildOnePath | ( | fsal_posixdb_conn * | p_conn, |
posixfsal_handle_t * | p_handle, | ||
fsal_path_t * | p_path | ||
) |
fsal_posixdb_buildOnePath: Build the path of an object with only one Path in the parent table (usually a directory).
p_conn | (input) Connection to the database |
p_handle | (input) Handle of the object we want the path |
path | (output) Path of the object |
Definition at line 301 of file MYSQL/posixdb_internal.c.
void fsal_posixdb_CachePath | ( | posixfsal_handle_t * | p_handle, |
fsal_path_t * | p_path | ||
) |
Definition at line 53 of file MYSQL/posixdb_internal.c.
fsal_posixdb_status_t fsal_posixdb_deleteParent | ( | fsal_posixdb_conn * | p_conn, |
char * | handleid_str, | ||
char * | handlets_str, | ||
char * | handleidparent_str, | ||
char * | handletsparent_str, | ||
char * | filename, | ||
int | nlink | ||
) |
fsal_posixdb_deleteParent: Delete a parent entry. If the handle has no more links, then it is also deleted. Notice : do not use with a directory
p_conn | (input) Connection to the database |
handleid_str | (input) ID part of the handle of the object |
handlets_str | (input) Timestamp part of the handle of the parent directory |
handleidparent_str | (input) ID part of the handle of the object |
handletsparent_str | (input) Timestamp part of the handle of the parent directory |
filename | (input) Filename of the entry to delete |
nlink | (input) Number of hardlink on the object |
Definition at line 397 of file PGSQL/posixdb_internal.c.
int fsal_posixdb_GetInodeCache | ( | posixfsal_handle_t * | p_handle | ) |
Definition at line 140 of file MYSQL/posixdb_internal.c.
int fsal_posixdb_GetPathCache | ( | posixfsal_handle_t * | p_handle, |
fsal_path_t * | p_path | ||
) |
Definition at line 191 of file MYSQL/posixdb_internal.c.
fsal_posixdb_status_t fsal_posixdb_initPreparedQueries | ( | fsal_posixdb_conn * | p_conn | ) |
fsal_posixdb_initPreparedQueries: setup the prepared queries for a new connection
p_conn | (input) Connection to the database |
Definition at line 133 of file MYSQL/posixdb_connect.c.
fsal_posixdb_status_t fsal_posixdb_internal_delete | ( | fsal_posixdb_conn * | p_conn, |
char * | handleidparent_str, | ||
char * | handletsparent_str, | ||
char * | filename, | ||
fsal_posixdb_fileinfo_t * | p_object_info | ||
) |
fsal_posixdb_internal_delete: Delete a Parent entry knowing its parent handle and its name
Definition at line 458 of file PGSQL/posixdb_internal.c.
void fsal_posixdb_InvalidateCache | ( | ) |
Definition at line 170 of file MYSQL/posixdb_internal.c.
fsal_posixdb_status_t fsal_posixdb_recursiveDelete | ( | fsal_posixdb_conn * | p_conn, |
char * | handleid_str, | ||
char * | handlets_str, | ||
fsal_nodetype_t | ftype | ||
) |
fsal_posixdb_recursiveDelete: Delete a handle and all its entries in the Parent table. If the object is a directory, then all its entries will be recursively deleted.
p_conn | (input) Connection to the database |
handleid_str | (input) ID part of the handle |
handlets_str | (input) Timestamp part of the handle |
ftype | (input) Type of the object (regular file, directory, ...) |
Definition at line 333 of file PGSQL/posixdb_internal.c.
int fsal_posixdb_UpdateInodeCache | ( | posixfsal_handle_t * | p_handle | ) |
Definition at line 95 of file MYSQL/posixdb_internal.c.
fsal_posixdb_status_t posixdb_internal_fillFileinfoFromStrValues | ( | fsal_posixdb_fileinfo_t * | p_info, |
char * | devid_str, | ||
char * | inode_str, | ||
char * | nlink_str, | ||
char * | ctime_str, | ||
char * | ftype_str | ||
) |
Fill a fsal_posixdb_fileinfo_t struct from char* values.
p_info | |
devid_str | |
inode_str | |
nlink_str | |
ctime_str | |
ftype_str |
Definition at line 686 of file MYSQL/posixdb_internal.c.