nfs-ganesha 1.4

handle_mapping.h

Go to the documentation of this file.
00001 /*
00002  * vim:expandtab:shiftwidth=8:tabstop=8:
00003  */
00004 
00005 /*
00006  * Copyright CEA/DAM/DIF  (2008)
00007  * contributeur : Philippe DENIEL   philippe.deniel@cea.fr
00008  *                Thomas LEIBOVICI  thomas.leibovici@cea.fr
00009  *
00010  *
00011  * This program is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU Lesser General Public
00013  * License as published by the Free Software Foundation; either
00014  * version 3 of the License, or (at your option) any later version.
00015  * 
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  * Lesser General Public License for more details.
00020  * 
00021  * You should have received a copy of the GNU Lesser General Public
00022  * License along with this library; if not, write to the Free Software
00023  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00024  * 
00025  * ---------------------------------------
00026  */
00027 
00035 #ifndef _HANDLE_MAPPING_H
00036 #define _HANDLE_MAPPING_H
00037 
00038 #include "fsal.h"
00039 
00040 /* parameters for Handle Map module */
00041 typedef struct handle_map_param__
00042 {
00043   /* path where database files are located */
00044   char databases_directory[MAXPATHLEN];
00045 
00046   /* temp dir for database work */
00047   char temp_directory[MAXPATHLEN];
00048 
00049   /* number of databases */
00050   unsigned int database_count;
00051 
00052   /* hash table size */
00053   unsigned int hashtable_size;
00054 
00055   /* number of preallocated FSAL handles */
00056   unsigned int nb_handles_prealloc;
00057 
00058   /* number of preallocated DB operations */
00059   unsigned int nb_db_op_prealloc;
00060 
00061   /* synchronous insert mode */
00062   int synchronous_insert;
00063 
00064 } handle_map_param_t;
00065 
00066 /* this describes a handle digest for nfsv2 and nfsv3 */
00067 
00068 typedef struct nfs23_map_handle__
00069 {
00070   /* object id */
00071   uint64_t object_id;
00072 
00073   /* to avoid reusing handles, when object_id is reused */
00074   unsigned int handle_hash;
00075 
00076 } nfs23_map_handle_t;
00077 
00078 /* Error codes */
00079 #define HANDLEMAP_SUCCESS        0
00080 #define HANDLEMAP_STALE          1
00081 #define HANDLEMAP_INCONSISTENCY  2
00082 #define HANDLEMAP_DB_ERROR       3
00083 #define HANDLEMAP_SYSTEM_ERROR   4
00084 #define HANDLEMAP_INTERNAL_ERROR 5
00085 #define HANDLEMAP_INVALID_PARAM  6
00086 #define HANDLEMAP_HASHTABLE_ERROR 7
00087 #define HANDLEMAP_EXISTS         8
00088 
00095 int HandleMap_Init(const handle_map_param_t * p_param);
00096 
00106 int HandleMap_GetFH(nfs23_map_handle_t * p_in_nfs23_digest,
00107                     fsal_handle_t * p_out_fsal_handle);
00108 
00112 int HandleMap_SetFH(nfs23_map_handle_t * p_in_nfs23_digest, fsal_handle_t * p_in_handle);
00113 
00119 int HandleMap_DelFH(nfs23_map_handle_t * p_in_nfs23_digest);
00120 
00124 int HandleMap_Flush();
00125 
00126 #endif