nfs-ganesha 1.4
Defines | Typedefs | Functions

posixdb_internal.h File Reference

#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 BeginTransaction(_conn_)   db_exec_sql( _conn_, "BEGIN", NULL )
#define EndTransaction(_conn_)   db_exec_sql( _conn_, "COMMIT", NULL )
#define RollbackTransaction(_conn_)   db_exec_sql( _conn_, "ROLLBACK", NULL )

Typedefs

typedef MYSQL_RES * result_handle_t

Functions

int db_is_retryable (int sql_err)
fsal_posixdb_status_t db_exec_sql (fsal_posixdb_conn *conn, const char *query, result_handle_t *p_result)
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, unsigned long long id, unsigned int ts, fsal_nodetype_t ftype)
fsal_posixdb_status_t fsal_posixdb_deleteParent (fsal_posixdb_conn *p_conn, unsigned long long id, unsigned int ts, unsigned long long idparent, unsigned int tsparent, char *filename, int nlink)
fsal_posixdb_status_t fsal_posixdb_internal_delete (fsal_posixdb_conn *p_conn, unsigned long long idparent, unsigned int tsparent, 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 Documentation

#define BeginTransaction (   _conn_)    db_exec_sql( _conn_, "BEGIN", NULL )

Definition at line 29 of file MYSQL/posixdb_internal.h.

#define EndTransaction (   _conn_)    db_exec_sql( _conn_, "COMMIT", NULL )

Definition at line 30 of file MYSQL/posixdb_internal.h.

#define MAX_CTIMESTR_SIZE   11

Definition at line 14 of file MYSQL/posixdb_internal.h.

#define MAX_DEVICEIDSTR_SIZE   21

Definition at line 11 of file MYSQL/posixdb_internal.h.

#define MAX_FTYPESTR_SIZE   11

Definition at line 16 of file MYSQL/posixdb_internal.h.

#define MAX_HANDLEIDSTR_SIZE   21

Definition at line 10 of file MYSQL/posixdb_internal.h.

#define MAX_HANDLETSSTR_SIZE   11

Definition at line 13 of file MYSQL/posixdb_internal.h.

#define MAX_INODESTR_SIZE   21

Definition at line 12 of file MYSQL/posixdb_internal.h.

#define MAX_NLINKSTR_SIZE   11

Definition at line 15 of file MYSQL/posixdb_internal.h.

#define ReturnCodeDB (   _code_,
  _minor_ 
)
Value:
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 MYSQL/posixdb_internal.h.

#define RollbackTransaction (   _conn_)    db_exec_sql( _conn_, "ROLLBACK", NULL )

Definition at line 31 of file MYSQL/posixdb_internal.h.


Typedef Documentation

typedef MYSQL_RES* result_handle_t

Definition at line 34 of file MYSQL/posixdb_internal.h.


Function Documentation

fsal_posixdb_status_t db_exec_sql ( fsal_posixdb_conn *  conn,
const char *  query,
result_handle_t p_result 
)

Definition at line 259 of file MYSQL/posixdb_internal.c.

int db_is_retryable ( int  sql_err)

Definition at line 245 of file MYSQL/posixdb_internal.c.

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).

Parameters:
p_conn(input) Connection to the database
p_handle(input) Handle of the object we want the path
path(output) Path of the object
Returns:
- FSAL_POSIXDB_NOERR, if no error. Another error code else.

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,
unsigned long long  id,
unsigned int  ts,
unsigned long long  idparent,
unsigned int  tsparent,
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

Parameters:
p_conn(input) Connection to the database
id(input) ID part of the handle of the object
ts(input) Timestamp part of the handle of the parent directory
idparent(input) ID part of the handle of the object
tsparent(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
Returns:
- FSAL_POSIXDB_NOERR, if no error. Another error code else.

Definition at line 551 of file MYSQL/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

Parameters:
p_conn(input) Connection to the database
Returns:
- ERR_FSAL_POSIXDB_NOERR, if no error. Another error code else.

Definition at line 133 of file MYSQL/posixdb_connect.c.

fsal_posixdb_status_t fsal_posixdb_internal_delete ( fsal_posixdb_conn *  p_conn,
unsigned long long  idparent,
unsigned int  tsparent,
char *  filename,
fsal_posixdb_fileinfo_t p_object_info 
)

fsal_posixdb_internal_delete: Delete a Parent entry knowing its parent handle and its name

See also:
fsal_posixdb_delete

Definition at line 618 of file MYSQL/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,
unsigned long long  id,
unsigned int  ts,
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.

Parameters:
p_conn(input) Connection to the database
id(input) ID part of the handle
ts(input) Timestamp part of the handle
ftype(input) Type of the object (regular file, directory, ...)
Returns:
- FSAL_POSIXDB_NOERR, if no error. Another error code else.

Definition at line 472 of file MYSQL/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.

Parameters:
p_info
devid_str
inode_str
nlink_str
ctime_str
ftype_str
Returns:
ERR_FSAL_POSIXDB_NOERR, if no error ERR_FSAL_POSIXDB_FAULT if p_info is NULL

Definition at line 686 of file MYSQL/posixdb_internal.c.