nfs-ganesha 1.4
Classes | Defines | Typedefs | Enumerations | Functions

posixdb.h File Reference

Go to the source code of this file.

Classes

struct  fsal_posixdb_conn_params_t
struct  fsal_posixdb_child
struct  fsal_posixdb_status_t

Defines

#define FSAL_MAX_DBHOST_NAME_LEN   HOST_NAME_MAX
#define FSAL_MAX_DBPORT_STR_LEN   8
#define FSAL_MAX_DB_NAME_LEN   64
#define FSAL_MAX_DB_LOGIN_LEN   LOGIN_NAME_MAX
#define FSAL_POSIXDB_MAXREADDIRBLOCKSIZE   64
#define FSAL_POSIXDB_IS_ERROR(_status_)   ( ! ( ( _status_ ).major == ERR_FSAL_POSIXDB_NOERR ) )
#define FSAL_POSIXDB_IS_NOENT(_status_)   ( ( _status_ ).major == ERR_FSAL_POSIXDB_NOENT )

Typedefs

typedef enum fsal_posixdb_errorcode fsal_posixdb_errorcode
typedef struct
fsal_posixdb_status_t 
fsal_posixdb_status_t

Enumerations

enum  fsal_posixdb_errorcode {
  ERR_FSAL_POSIXDB_NOERR = 0, ERR_FSAL_POSIXDB_BADCONN, ERR_FSAL_POSIXDB_NOENT, ERR_FSAL_POSIXDB_CMDFAILED,
  ERR_FSAL_POSIXDB_FAULT, ERR_FSAL_POSIXDB_NOPATH, ERR_FSAL_POSIXDB_TOOMANYPATHS, ERR_FSAL_POSIXDB_PATHTOOLONG,
  ERR_FSAL_POSIXDB_CONSISTENCY, ERR_FSAL_POSIXDB_NO_MEM
}

Functions

int fsal_posixdb_cache_init ()
fsal_posixdb_status_t fsal_posixdb_connect (fsal_posixdb_conn_params_t *p_params, fsal_posixdb_conn **p_conn)
fsal_posixdb_status_t fsal_posixdb_disconnect (fsal_posixdb_conn *p_conn)
fsal_posixdb_status_t fsal_posixdb_getInfoFromName (fsal_posixdb_conn *p_conn, posixfsal_handle_t *p_parent_directory_handle, fsal_name_t *p_objectname, fsal_path_t *p_path, posixfsal_handle_t *p_handle)
fsal_posixdb_status_t fsal_posixdb_getInfoFromHandle (fsal_posixdb_conn *p_conn, posixfsal_handle_t *p_object_handle, fsal_path_t *p_paths, int paths_size, int *p_count)
fsal_posixdb_status_t fsal_posixdb_add (fsal_posixdb_conn *p_conn, fsal_posixdb_fileinfo_t *p_object_info, posixfsal_handle_t *p_parent_directory_handle, fsal_name_t *p_filename, posixfsal_handle_t *p_object_handle)
fsal_posixdb_status_t fsal_posixdb_replace (fsal_posixdb_conn *p_conn, fsal_posixdb_fileinfo_t *p_object_info, posixfsal_handle_t *p_parent_directory_handle_old, fsal_name_t *p_filename_old, posixfsal_handle_t *p_parent_directory_handle_new, fsal_name_t *p_filename_new)
fsal_posixdb_status_t fsal_posixdb_delete (fsal_posixdb_conn *p_conn, posixfsal_handle_t *p_parent_directory_handle, fsal_name_t *p_filename, fsal_posixdb_fileinfo_t *p_object_info)
fsal_posixdb_status_t fsal_posixdb_deleteHandle (fsal_posixdb_conn *p_conn, posixfsal_handle_t *p_handle)
fsal_posixdb_status_t fsal_posixdb_getChildren (fsal_posixdb_conn *p_conn, posixfsal_handle_t *p_parent_directory_handle, unsigned int max_count, fsal_posixdb_child **p_children, unsigned int *p_count)
fsal_posixdb_status_t fsal_posixdb_export (fsal_posixdb_conn *p_conn, FILE *out)
fsal_posixdb_status_t fsal_posixdb_import (fsal_posixdb_conn *p_conn, FILE *in)
fsal_posixdb_status_t fsal_posixdb_flush (fsal_posixdb_conn *p_conn)
fsal_posixdb_status_t fsal_posixdb_getParentDirHandle (fsal_posixdb_conn *p_conn, posixfsal_handle_t *p_object_handle, posixfsal_handle_t *p_parent_directory_handle)
fsal_posixdb_status_t fsal_posixdb_lockHandleForUpdate (fsal_posixdb_conn *p_conn, fsal_posixdb_fileinfo_t *p_info)
 Lock the line of the Handle table with inode & devid defined in p_info.
fsal_posixdb_status_t fsal_posixdb_cancelHandleLock (fsal_posixdb_conn *p_conn)
 Unlock the Handle line previously locked by fsal_posixdb_lockHandleForUpdate.

Define Documentation

#define FSAL_MAX_DB_LOGIN_LEN   LOGIN_NAME_MAX

Definition at line 107 of file posixdb.h.

#define FSAL_MAX_DB_NAME_LEN   64

Definition at line 102 of file posixdb.h.

#define FSAL_MAX_DBHOST_NAME_LEN   HOST_NAME_MAX

POSIXDB

Definition at line 98 of file posixdb.h.

#define FSAL_MAX_DBPORT_STR_LEN   8

Definition at line 101 of file posixdb.h.

#define FSAL_POSIXDB_IS_ERROR (   _status_)    ( ! ( ( _status_ ).major == ERR_FSAL_POSIXDB_NOERR ) )

Definition at line 163 of file posixdb.h.

#define FSAL_POSIXDB_IS_NOENT (   _status_)    ( ( _status_ ).major == ERR_FSAL_POSIXDB_NOENT )

Definition at line 166 of file posixdb.h.

#define FSAL_POSIXDB_MAXREADDIRBLOCKSIZE   64

Definition at line 110 of file posixdb.h.


Typedef Documentation


Enumeration Type Documentation

Enumerator:
ERR_FSAL_POSIXDB_NOERR 
ERR_FSAL_POSIXDB_BADCONN 
ERR_FSAL_POSIXDB_NOENT 
ERR_FSAL_POSIXDB_CMDFAILED 
ERR_FSAL_POSIXDB_FAULT 
ERR_FSAL_POSIXDB_NOPATH 
ERR_FSAL_POSIXDB_TOOMANYPATHS 
ERR_FSAL_POSIXDB_PATHTOOLONG 
ERR_FSAL_POSIXDB_CONSISTENCY 
ERR_FSAL_POSIXDB_NO_MEM 

Definition at line 143 of file posixdb.h.


Function Documentation

fsal_posixdb_status_t fsal_posixdb_add ( fsal_posixdb_conn *  p_conn,
fsal_posixdb_fileinfo_t p_object_info,
posixfsal_handle_t p_parent_directory_handle,
fsal_name_t p_filename,
posixfsal_handle_t p_object_handle 
)

fsal_posixdb_add: Add an object in the database (identified by its name and its parent directory). Create an entry in the Handle table if needed, and add (or replace existing) an entry in the Path table.

Parameters:
conn(input) Database connection
p_object_info(input): POSIX information of the object to add (device ID, inode, ...)
p_parent_directory_handle(input): Handle of the parent directory of the object to add.
p_filename(input): The name of the object to add.
p_object_handle(output): FSAL handle of the added entry.
Returns:
- FSAL_POSIXDB_NOERR, if no error.
  • Another error code else.

Definition at line 16 of file MYSQL/posixdb_add.c.

int fsal_posixdb_cache_init ( )

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

fsal_posixdb_status_t fsal_posixdb_cancelHandleLock ( fsal_posixdb_conn *  p_conn)

Unlock the Handle line previously locked by fsal_posixdb_lockHandleForUpdate.

Parameters:
p_connDatabase connection
Returns:
ERR_FSAL_POSIXDB_NOERR if no error, another error code else.

Definition at line 58 of file MYSQL/posixdb_lock.c.

fsal_posixdb_status_t fsal_posixdb_connect ( fsal_posixdb_conn_params_t dbparams,
fsal_posixdb_conn **  p_conn 
)

fsal_posixdb_connect: Connect to the Database and initialize *dbconn.

Parameters:
params(input) Connection parameters
conn(output) Connection to the database
Returns:
- FSAL_POSIXDB_NOERR, if no error. Another error code else.

connection to database

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

fsal_posixdb_status_t fsal_posixdb_delete ( fsal_posixdb_conn *  p_conn,
posixfsal_handle_t p_parent_directory_handle,
fsal_name_t p_filename,
fsal_posixdb_fileinfo_t p_object_info 
)

fsal_posixdb_delete: Delete a path entry for an object. If the file has only one path (hardlink = 1), its handle is deleted too.

Parameters:
p_conn(input) Database connection
p_parent_directory_handle(input): Handle of the directory where the object is.
p_filename(input): The name of the object to delete.
p_object_info(input): POSIX information of the object (device ID, inode, ...)
Returns:
- FSAL_POSIXDB_NOERR, if no error.
  • FSAL_POSIXDB_NOENT, if parent_directory_handle does not exist.

Definition at line 10 of file MYSQL/posixdb_delete.c.

fsal_posixdb_status_t fsal_posixdb_deleteHandle ( fsal_posixdb_conn *  p_conn,
posixfsal_handle_t p_handle 
)

fsal_posixdb_deleteHandle: Delete a Handle and all paths related to him.

Parameters:
p_conn(input) Database connection
p_handle(input): Handle of the directory where the object is.
Returns:
- FSAL_POSIXDB_NOERR, if no error.
  • FSAL_POSIXDB_NOENT, if p_handle does not exist.

Definition at line 71 of file MYSQL/posixdb_delete.c.

fsal_posixdb_status_t fsal_posixdb_disconnect ( fsal_posixdb_conn *  p_conn)

fsal_posixdb_disconnect: Disconnect from the Database.

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

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

fsal_posixdb_status_t fsal_posixdb_export ( fsal_posixdb_conn *  p_conn,
FILE *  out 
)

fsal_posixdb_export: Export the content of the database to a file.

Parameters:
p_conn(input) Database connection
out(input): POSIX file descriptor
fsal_posixdb_status_t fsal_posixdb_flush ( fsal_posixdb_conn *  p_conn)

fsal_posixdb_flush: Empty the database.

Parameters:
p_conn(input) Database connection

Definition at line 9 of file MYSQL/posixdb_flush.c.

fsal_posixdb_status_t fsal_posixdb_getChildren ( fsal_posixdb_conn *  p_conn,
posixfsal_handle_t p_parent_directory_handle,
unsigned int  max_count,
fsal_posixdb_child **  p_children,
unsigned int *  p_count 
)

fsal_posixdb_getChildren: retrieve all the children of a directory handle.

Parameters:
p_conn(input) Database connection
p_parent_directory_handle(input): Handle of the directory where the objects to be retrieved are.
max_countmax fsal_posixdb_child to be returned
p_children,:Children of p_parent_directory_handle. It is dynamically allocated inside the function. It have to be freed outside the function !!!
p_count,:Number of children returned in p_children
Returns:
- FSAL_POSIXDB_NOERR, if no error.
  • another error code else.

fsal_posixdb_getChildren: retrieve all the children of a directory handle.

Parameters:
p_conn(input) Database connection
p_parent_directory_handle(input): Handle of the directory where the objects to be retrieved are.
p_children,:Children of p_parent_directory_handle. It is dynamically allocated inside the function. It have to be freed outside the function !!!
p_count,:Number of children returned in p_children
Returns:
- FSAL_POSIXDB_NOERR, if no error.
  • another error code else.

Definition at line 28 of file MYSQL/posixdb_getChildren.c.

fsal_posixdb_status_t fsal_posixdb_getInfoFromHandle ( fsal_posixdb_conn *  p_conn,
posixfsal_handle_t p_object_handle,
fsal_path_t p_paths,
int  paths_size,
int *  p_count 
)

fsal_posixdb_getInfoFromHandle: Fills informations known about an object (inside its posixfsal_handle_t object), its 'paths', knowing its FSAL handle.

Parameters:
conn(input) Database connection
object_handle(input) Handle of the object.
p_paths(output) Array of path to the objects
paths_size(input) Number of elements of p_paths allocated
p_count(output) Number of paths set in p_paths
p_infos(output) POSIX information stored in the database.
Returns:
- FSAL_POSIXDB_NOERR, if no error.
  • FSAL_POSIXDB_UNKNOWHANDLE, if object_handle is unknown.

Definition at line 109 of file MYSQL/posixdb_info.c.

fsal_posixdb_status_t fsal_posixdb_getInfoFromName ( fsal_posixdb_conn *  p_conn,
posixfsal_handle_t p_parent_directory_handle,
fsal_name_t p_objectname,
fsal_path_t p_path,
posixfsal_handle_t p_handle 
)

fsal_posixdb_getInfoFromName: Return informations known about an object, knowing the FSAL handle of its parent and its name.

Parameters:
conn(input) Database connection
p_parent_directory_handle(input) Handle of the parent directory to search the object in.
p_objectname(input) The name of the object to find.
p_path(optional output) path to the objects
p_handle(output) Handle of the object found in the database
Returns:
- FSAL_POSIXDB_NOERR, if no error.
  • FSAL_POSIXDB_NOENT, if directory unknown, or no object named 'object_name' in that directory.

Definition at line 10 of file MYSQL/posixdb_info.c.

fsal_posixdb_status_t fsal_posixdb_getParentDirHandle ( fsal_posixdb_conn *  p_conn,
posixfsal_handle_t p_object_handle,
posixfsal_handle_t p_parent_directory_handle 
)

fsal_posixdb_getParentDirHandle: get the parent directory of a directory (p_object_handle must have only one Parent entry).

Parameters:
p_conn(input) Database connection
p_object_handle(input): Directory Handle we want the parent
p_parent_directory_handle(output): Parent directory handle ( corresponding to <path to="" p_object_handle>="">/.. )

Definition at line 270 of file MYSQL/posixdb_info.c.

fsal_posixdb_status_t fsal_posixdb_import ( fsal_posixdb_conn *  p_conn,
FILE *  in 
)

fsal_posixdb_import: Import the content of the database from a file.

Parameters:
p_conn(input) Database connection
in(input): POSIX file descriptor
fsal_posixdb_status_t fsal_posixdb_lockHandleForUpdate ( fsal_posixdb_conn *  p_conn,
fsal_posixdb_fileinfo_t p_info 
)

Lock the line of the Handle table with inode & devid defined in p_info.

Parameters:
p_connDatabase connection
p_infoInformation about the file
Returns:
ERR_FSAL_POSIXDB_NOERR if no error, another error code else.

Definition at line 21 of file MYSQL/posixdb_lock.c.

fsal_posixdb_status_t fsal_posixdb_replace ( fsal_posixdb_conn *  p_conn,
fsal_posixdb_fileinfo_t p_object_info,
posixfsal_handle_t p_parent_directory_handle_old,
fsal_name_t p_filename_old,
posixfsal_handle_t p_parent_directory_handle_new,
fsal_name_t p_filename_new 
)

fsal_posixdb_replace: Move an object in the Path table (identified by its name and its parent directory). Create an entry in the Handle table if needed, and update (or create) an entry in the Path table.

Parameters:
conn(input) Database connection
p_object_info(input): POSIX information of the object to add (device ID, inode, ...)
p_parent_directory_handle_old(input): Handle of the source directory of the object.
p_filename_old(input): The old name of the object.
p_parent_directory_handle_new(input): Handle of the new directory of the object.
p_filename_new(input): The new name of the object.
Returns:
- FSAL_POSIXDB_NOERR, if no error.
  • Another error code else.

Definition at line 11 of file MYSQL/posixdb_replace.c.