nfs-ganesha 1.4

sal_functions.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Copyright CEA/DAM/DIF  (2008)
00005  * contributeur : Philippe DENIEL   philippe.deniel@cea.fr
00006  *                Thomas LEIBOVICI  thomas.leibovici@cea.fr
00007  *
00008  *
00009  * This program is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public License
00011  * as published by the Free Software Foundation; either version 3 of
00012  * the License, or (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * Lesser General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Lesser General Public
00020  * License along with this library; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00022  * 02110-1301 USA
00023  *
00024  * ---------------------------------------
00025  */
00026 
00036 #ifndef _SAL_FUNCTIONS_H
00037 #define _SAL_FUNCTIONS_H
00038 
00039 #include "sal_data.h"
00040 #include "nfs_exports.h"
00041 #include "nfs_core.h"
00042 
00043 extern pool_t *nfs41_session_pool;
00044 
00045 /******************************************************************************
00046  *
00047  * Misc functions
00048  *
00049  ******************************************************************************/
00050 
00051 const char *state_err_str(state_status_t err);
00052 
00053 state_status_t state_error_convert(fsal_status_t fsal_status);
00054 
00055 state_status_t cache_inode_status_to_state_status(cache_inode_status_t status);
00056 
00057 nfsstat4 nfs4_Errno_state(state_status_t error);
00058 nfsstat3 nfs3_Errno_state(state_status_t error);
00059 nfsstat2 nfs2_Errno_state(state_status_t error);
00060 
00061 const char * state_owner_type_to_str(state_owner_type_t type);
00062 int different_owners(state_owner_t *powner1, state_owner_t *powner2);
00063 int DisplayOwner(state_owner_t *powner, char *buf);
00064 void Hash_inc_state_owner_ref(hash_buffer_t *buffval);
00065 int Hash_dec_state_owner_ref(hash_buffer_t *buffval);
00066 void inc_state_owner_ref_locked(state_owner_t *powner);
00067 void inc_state_owner_ref(state_owner_t *powner);
00068 
00069 void dec_state_owner_ref_locked(state_owner_t        * powner);
00070 
00071 void dec_state_owner_ref(state_owner_t        * powner);
00072 
00073 int DisplayOpaqueValue(char * value, int len, char * str);
00074 
00075 void state_wipe_file(cache_entry_t        * pentry);
00076 
00077 /******************************************************************************
00078  *
00079  * 9P State functions
00080  *
00081  ******************************************************************************/
00082 
00083 #ifdef _USE_9P
00084 int compare_9p_owner(state_owner_t * powner1,
00085                      state_owner_t * powner2);
00086 int compare_9p_owner_key(hash_buffer_t * buff1, hash_buffer_t * buff2) ;
00087 
00088 int display_9p_owner(state_owner_t * pkey, char * str);
00089 int display_9p_owner_key(hash_buffer_t * pbuff, char *str) ;
00090 int display_9p_owner_val(hash_buffer_t * pbuff, char *str) ;
00091 
00092 void remove_9p_owner( state_owner_t        * powner,
00093                       const char           * str);
00094 
00095 uint32_t _9p_owner_value_hash_func(hash_parameter_t * p_hparam,
00096                                    hash_buffer_t * buffclef) ;
00097 uint64_t _9p_owner_rbt_hash_func(hash_parameter_t * p_hparam,
00098                                  hash_buffer_t * buffclef) ;
00099 void _9p_owner_PrintAll(void) ;
00100 
00101 state_owner_t * get_9p_owner( struct sockaddr_storage * pclient_addr,
00102                               uint32_t    proc_id) ;
00103 
00104 int Init_9p_hash(void) ;
00105 #endif
00106 
00107 /******************************************************************************
00108  *
00109  * NLM State functions
00110  *
00111  ******************************************************************************/
00112 
00113 #ifdef _USE_NLM
00114 void inc_nsm_client_ref_locked(state_nsm_client_t * pclient);
00115 void inc_nsm_client_ref(state_nsm_client_t * pclient);
00116 void dec_nsm_client_ref_locked(state_nsm_client_t * pclient);
00117 void dec_nsm_client_ref(state_nsm_client_t * pclient);
00118 int display_nsm_client(state_nsm_client_t * pkey, char * str);
00119 int display_nsm_client_val(hash_buffer_t * pbuff, char * str);
00120 int display_nsm_client_key(hash_buffer_t * pbuff, char * str);
00121 
00122 int compare_nsm_client(state_nsm_client_t * pclient1,
00123                        state_nsm_client_t * pclient2);
00124 
00125 int compare_nsm_client_key(hash_buffer_t * buff1, hash_buffer_t * buff2);
00126 
00127 uint32_t nsm_client_value_hash_func(hash_parameter_t * p_hparam,
00128                                     hash_buffer_t    * buffclef);
00129 
00130 uint64_t nsm_client_rbt_hash_func(hash_parameter_t * p_hparam,
00131                                   hash_buffer_t    * buffclef);
00132 
00133 state_nsm_client_t *get_nsm_client(care_t       care,
00134                                    SVCXPRT    * xprt,
00135                                    const char * caller_name);
00136 void nsm_client_PrintAll(void);
00137 
00138 void inc_nlm_client_ref_locked(state_nlm_client_t * pclient);
00139 void inc_nlm_client_ref(state_nlm_client_t * pclient);
00140 void dec_nlm_client_ref_locked(state_nlm_client_t * pclient);
00141 void dec_nlm_client_ref(state_nlm_client_t * pclient);
00142 int display_nlm_client(state_nlm_client_t * pkey, char * str);
00143 int display_nlm_client_val(hash_buffer_t * pbuff, char * str);
00144 int display_nlm_client_key(hash_buffer_t * pbuff, char * str);
00145 
00146 int compare_nlm_client(state_nlm_client_t * pclient1,
00147                        state_nlm_client_t * pclient2);
00148 
00149 int compare_nlm_client_key(hash_buffer_t * buff1, hash_buffer_t * buff2);
00150 
00151 uint32_t nlm_client_value_hash_func(hash_parameter_t * p_hparam,
00152                                     hash_buffer_t    * buffclef);
00153 
00154 uint64_t nlm_client_rbt_hash_func(hash_parameter_t * p_hparam,
00155                                   hash_buffer_t    * buffclef);
00156 
00157 state_nlm_client_t *get_nlm_client(care_t               care,
00158                                    SVCXPRT            * xprt,
00159                                    state_nsm_client_t * pnsm_client,
00160                                    const char         * caller_name);
00161 void nlm_client_PrintAll(void);
00162 
00163 void remove_nlm_owner(state_owner_t        * powner,
00164                       const char           * str);
00165 
00166 int display_nlm_owner(state_owner_t * pkey, char * str);
00167 int display_nlm_owner_val(hash_buffer_t * pbuff, char * str);
00168 int display_nlm_owner_key(hash_buffer_t * pbuff, char * str);
00169 
00170 int compare_nlm_owner(state_owner_t * powner1,
00171                       state_owner_t * powner2);
00172 
00173 int compare_nlm_owner_key(hash_buffer_t * buff1, hash_buffer_t * buff2);
00174 
00175 uint32_t nlm_owner_value_hash_func(hash_parameter_t * p_hparam,
00176                                    hash_buffer_t    * buffclef);
00177 
00178 uint64_t nlm_owner_rbt_hash_func(hash_parameter_t * p_hparam,
00179                                  hash_buffer_t    * buffclef);
00180 
00181 state_owner_t *get_nlm_owner(care_t               care,
00182                              state_nlm_client_t * pclient,
00183                              netobj             * oh,
00184                              uint32_t             svid);
00185 void nlm_owner_PrintAll(void);
00186 
00187 int Init_nlm_hash(void);
00188 #endif
00189 
00190 /******************************************************************************
00191  *
00192  * NFS4 Client ID functions
00193  *
00194  ******************************************************************************/
00195 
00196 state_status_t get_clientid_owner(clientid4        clientid,
00197                                   state_owner_t ** clientid_owner);
00198 
00199 int nfs_Init_client_id(nfs_client_id_parameter_t * param);
00200 
00201 int nfs_client_id_get_unconfirmed(clientid4          clientid,
00202                                   nfs_client_id_t ** p_pclientid);
00203 
00204 int nfs_client_id_get_confirmed(clientid4          clientid,
00205                                 nfs_client_id_t ** p_pclientid);
00206 
00207 nfs_client_id_t * create_client_id(clientid4              clientid,
00208                                    nfs_client_record_t  * pclient_record,
00209                                    sockaddr_t           * pclient_addr,
00210                                    nfs_client_cred_t    * pcredential);
00211 
00212 int nfs_client_id_insert(nfs_client_id_t * pclientid);
00213 
00214 int remove_unconfirmed_client_id(nfs_client_id_t * pclientid);
00215 
00216 int nfs_client_id_confirm(nfs_client_id_t * pclientid,
00217                           log_components_t  component);
00218 
00219 int nfs_client_id_expire(nfs_client_id_t * pclientid);
00220 
00221 clientid4 new_clientid(void);
00222 void new_clientifd_verifier(char * pverf);
00223 
00224 int display_client_id_key(hash_buffer_t * pbuff, char *str);
00225 int display_client_id_val(hash_buffer_t * pbuff, char *str);
00226 
00227 int compare_client_id(hash_buffer_t * buff1, hash_buffer_t * buff2);
00228 
00229 uint64_t client_id_rbt_hash_func(hash_parameter_t * p_hparam,
00230                                  hash_buffer_t    * buffclef);
00231 
00232 uint32_t client_id_value_hash_func(hash_parameter_t * p_hparam,
00233                                    hash_buffer_t    * buffclef);
00234 
00235 int display_client_id_rec(nfs_client_id_t * pclientid, char *str);
00236 int display_clientid_name(nfs_client_id_t * pclientid, char * str);
00237 
00238 void free_client_id(nfs_client_id_t *pclientid);
00239 
00240 void inc_client_id_ref(nfs_client_id_t * pclientid);
00241 void dec_client_id_ref(nfs_client_id_t * pclientid);
00242 
00243 int display_client_record(nfs_client_record_t * precord, char *str);
00244 
00245 void inc_client_record_ref(nfs_client_record_t *precord);
00246 void dec_client_record_ref(nfs_client_record_t *precord);
00247 
00248 int display_client_record_key(hash_buffer_t * pbuff, char *str);
00249 int display_client_record_val(hash_buffer_t * pbuff, char *str);
00250 
00251 int compare_client_record(hash_buffer_t * buff1, hash_buffer_t * buff2);
00252 
00253 uint64_t client_record_rbt_hash_func(hash_parameter_t * p_hparam,
00254                                      hash_buffer_t    * buffclef);
00255 
00256 uint32_t client_record_value_hash_func(hash_parameter_t * p_hparam,
00257                                        hash_buffer_t    * buffclef);
00258 
00259 nfs_client_record_t *get_client_record(char * value, int len);
00260 
00261 /******************************************************************************
00262  *
00263  * NFS4.1 Session ID functions
00264  *
00265  ******************************************************************************/
00266 
00267 #ifdef _USE_NFS4_1
00268 int display_session_id_key(hash_buffer_t * pbuff, char *str);
00269 int display_session_id_val(hash_buffer_t * pbuff, char *str);
00270 int compare_session_id(hash_buffer_t * buff1, hash_buffer_t * buff2);
00271 
00272 uint32_t session_id_value_hash_func(hash_parameter_t * p_hparam,
00273                                     hash_buffer_t    * buffclef);
00274 
00275 uint64_t session_id_rbt_hash_func(hash_parameter_t * p_hparam,
00276                                   hash_buffer_t    * buffclef);
00277 
00278 int nfs41_Init_session_id(nfs_session_id_parameter_t param);
00279 
00280 int nfs41_Session_Set(char              sessionid[NFS4_SESSIONID_SIZE],
00281                       nfs41_session_t * psession_data);
00282 
00283 int nfs41_Session_Get_Pointer(char               sessionid[NFS4_SESSIONID_SIZE],
00284                               nfs41_session_t ** psession_data);
00285 
00286 int nfs41_Session_Del(char sessionid[NFS4_SESSIONID_SIZE]);
00287 void nfs41_Build_sessionid(clientid4 * pclientid, char * sessionid);
00288 void nfs41_Session_PrintAll(void);
00289 int display_session(nfs41_session_t * psession, char * str);
00290 int display_session_id(char * session_id, char * str);
00291 #endif
00292 
00293 /******************************************************************************
00294  *
00295  * NFSv4 Stateid functions
00296  *
00297  ******************************************************************************/
00298 
00299 void nfs4_BuildStateId_Other(char * other);
00300 
00301 #define STATEID_NO_SPECIAL 0
00302 #define STATEID_SPECIAL_ALL_0      2
00303 #define STATEID_SPECIAL_ALL_1      4
00304 #define STATEID_SPECIAL_CURRENT    8
00305 #define STATEID_SPECIAL_ANY        0xFF
00306 #define STATEID_SPECIAL_FOR_LOCK   (STATEID_SPECIAL_CURRENT)
00307 
00308 int nfs4_Check_Stateid(stateid4        * pstate,
00309                        cache_entry_t   * pentry,
00310                        state_t        ** ppstate,
00311                        compound_data_t * data,
00312                        char              flags,
00313                        const char      * tag);
00314 
00315 void update_stateid(state_t         * pstate,
00316                     stateid4        * presp,
00317                     compound_data_t * data,
00318                     const char      * tag);
00319 
00320 int nfs4_check_special_stateid(cache_entry_t *pentry,
00321                                const char    *tag,
00322                                int            access);
00323 
00324 int nfs4_Init_state_id(nfs_state_id_parameter_t param);
00325 int nfs4_State_Set(char other[OTHERSIZE], state_t * pstate_data);
00326 int nfs4_State_Get_Pointer(char other[OTHERSIZE], state_t * *pstate_data);
00327 int nfs4_State_Del(char other[OTHERSIZE]);
00328 void nfs_State_PrintAll(void);
00329 
00330 int display_state_id_val(hash_buffer_t * pbuff, char *str);
00331 int display_state_id_key(hash_buffer_t * pbuff, char *str);
00332 
00333 uint32_t state_id_value_hash_func(hash_parameter_t * p_hparam,
00334                                   hash_buffer_t    * buffclef);
00335 
00336 uint64_t state_id_rbt_hash_func(hash_parameter_t * p_hparam,
00337                                 hash_buffer_t    * buffclef);
00338 
00339 /******************************************************************************
00340  *
00341  * NFSv4 Lease functions
00342  *
00343  ******************************************************************************/
00344 
00345 int  reserve_lease(nfs_client_id_t * pclientid);
00346 void update_lease(nfs_client_id_t * pclientid);
00347 int  valid_lease(nfs_client_id_t * pclientid);
00348 
00349 /******************************************************************************
00350  *
00351  * NFSv4 Owner functions
00352  *
00353  ******************************************************************************/
00354 
00355 void remove_nfs4_owner(state_owner_t        * powner,
00356                        const char           * str);
00357 
00358 int display_nfs4_owner(state_owner_t *powner, char *str);
00359 int display_nfs4_owner_val(hash_buffer_t * pbuff, char *str);
00360 int display_nfs4_owner_key(hash_buffer_t * pbuff, char *str);
00361 
00362 int compare_nfs4_owner(state_owner_t * powner1,
00363                        state_owner_t * powner2);
00364 
00365 int compare_nfs4_owner_key(hash_buffer_t * buff1, hash_buffer_t * buff2);
00366 
00367 uint32_t nfs4_owner_value_hash_func(hash_parameter_t * p_hparam,
00368                                     hash_buffer_t    * buffclef);
00369 
00370 uint64_t nfs4_owner_rbt_hash_func(hash_parameter_t * p_hparam,
00371                                   hash_buffer_t    * buffclef);
00372 
00373 void convert_nfs4_open_owner(open_owner4             * pnfsowner,
00374                              state_nfs4_owner_name_t * pname_owner,
00375                              clientid4                 clientid);
00376 
00377 void convert_nfs4_lock_owner(lock_owner4             * pnfsowoner,
00378                              state_nfs4_owner_name_t * pname_owner,
00379                              clientid4                 clientid);
00380 
00381 void nfs4_owner_PrintAll(void);
00382 
00383 int nfs4_owner_Get_Pointer(state_nfs4_owner_name_t  * pname,
00384                            state_owner_t           ** powner);
00385 
00386 state_owner_t *create_nfs4_owner(state_nfs4_owner_name_t * pname,
00387                                  nfs_client_id_t         * pclientid,
00388                                  state_owner_type_t        type,
00389                                  state_owner_t           * related_owner,
00390                                  unsigned int              init_seqid);
00391 
00392 int Init_nfs4_owner(nfs4_owner_parameter_t param);
00393 
00394 void Process_nfs4_conflict(LOCK4denied          * denied,    /* NFS v4 LOck4denied structure to fill in */
00395                            state_owner_t        * holder,    /* owner that holds conflicting lock */
00396                            fsal_lock_param_t    * conflict); /* description of conflicting lock */
00397 
00398 void Release_nfs4_denied(LOCK4denied * denied);
00399 void Copy_nfs4_denied(LOCK4denied * denied_dst, LOCK4denied * denied_src);
00400 
00401 void Copy_nfs4_state_req(state_owner_t   * powner,
00402                          seqid4            seqid,
00403                          nfs_argop4      * args,
00404                          compound_data_t * data,
00405                          nfs_resop4      * resp,
00406                          const char      * tag);
00407 
00408 bool_t Check_nfs4_seqid(state_owner_t   * powner,
00409                         seqid4            seqid,
00410                         nfs_argop4      * args,
00411                         compound_data_t * data,
00412                         nfs_resop4      * resp,
00413                         const char      * tag);
00414 
00415 /******************************************************************************
00416  *
00417  * Lock functions
00418  *
00419  ******************************************************************************/
00420 
00421 #ifdef _USE_BLOCKING_LOCKS
00422 int display_lock_cookie_key(hash_buffer_t * pbuff, char *str);
00423 int display_lock_cookie_val(hash_buffer_t * pbuff, char *str);
00424 int compare_lock_cookie_key(hash_buffer_t * buff1, hash_buffer_t * buff2);
00425 
00426 uint32_t lock_cookie_value_hash_func(hash_parameter_t * p_hparam,
00427                                      hash_buffer_t    * buffclef);
00428 
00429 uint64_t lock_cookie_rbt_hash_func(hash_parameter_t * p_hparam,
00430                                    hash_buffer_t    * buffclef);
00431 #endif
00432 
00433 #ifdef _USE_NLM
00434 state_status_t state_lock_init(state_status_t   * pstatus,
00435                                hash_parameter_t   cookie_param);
00436 #else
00437 state_status_t state_lock_init(state_status_t * pstatus);
00438 #endif
00439 
00440 void LogLock(log_components_t     component,
00441              log_levels_t         debug,
00442              const char         * reason,
00443              cache_entry_t      * pentry,
00444              fsal_op_context_t  * pcontext,
00445              state_owner_t      * powner,
00446              fsal_lock_param_t  * plock);
00447 
00448 void dump_all_locks(const char * label);
00449 
00450 #ifdef _USE_BLOCKING_LOCKS
00451 
00466 state_status_t state_add_grant_cookie(cache_entry_t         * pentry,
00467                                       fsal_op_context_t     * pcontext,
00468                                       void                  * pcookie,
00469                                       int                     cookie_size,
00470                                       state_lock_entry_t    * lock_entry,
00471                                       state_cookie_entry_t ** ppcookie_entry,
00472                                       state_status_t        * pstatus);
00473 
00474 state_status_t state_find_grant(void                  * pcookie,
00475                                 int                     cookie_size,
00476                                 state_cookie_entry_t ** ppcookie_entry,
00477                                 state_status_t        * pstatus);
00478 
00479 void state_complete_grant(fsal_op_context_t    * pcontext,
00480                           state_cookie_entry_t * cookie_entry);
00481 
00488 state_status_t state_cancel_grant(fsal_op_context_t    * pcontext,
00489                                   state_cookie_entry_t * cookie_entry,
00490                                   state_status_t       * pstatus);
00491 
00492 state_status_t state_release_grant(fsal_op_context_t    * pcontext,
00493                                    state_cookie_entry_t * cookie_entry,
00494                                    state_status_t       * pstatus);
00495 #endif
00496 
00497 state_status_t state_test(cache_entry_t        * pentry,
00498                           fsal_op_context_t    * pcontext,
00499                           exportlist_t         * pexport,
00500                           state_owner_t        * powner,
00501                           fsal_lock_param_t    * plock,
00502                           state_owner_t       ** holder,   /* owner that holds conflicting lock */
00503                           fsal_lock_param_t    * conflict, /* description of conflicting lock */
00504                           state_status_t       * pstatus);
00505 
00506 state_status_t state_lock(cache_entry_t         * pentry,
00507                           fsal_op_context_t     * pcontext,
00508                           exportlist_t          * pexport,
00509                           state_owner_t         * powner,
00510                           state_t               * pstate,
00511                           state_blocking_t        blocking,
00512                           state_block_data_t    * block_data,
00513                           fsal_lock_param_t     * plock,
00514                           state_owner_t        ** holder,   /* owner that holds conflicting lock */
00515                           fsal_lock_param_t     * conflict, /* description of conflicting lock */
00516                           state_status_t        * pstatus);
00517 
00518 state_status_t state_unlock(cache_entry_t        * pentry,
00519                             fsal_op_context_t    * pcontext,
00520                             exportlist_t         * pexport,
00521                             state_owner_t        * powner,
00522                             state_t              * pstate,
00523                             fsal_lock_param_t    * plock,
00524                             state_status_t       * pstatus);
00525 
00526 #ifdef _USE_BLOCKING_LOCKS
00527 state_status_t state_cancel(cache_entry_t        * pentry,
00528                             fsal_op_context_t    * pcontext,
00529                             exportlist_t         * pexport,
00530                             state_owner_t        * powner,
00531                             fsal_lock_param_t    * plock,
00532                             state_status_t       * pstatus);
00533 #endif
00534 
00535 #ifdef _USE_NLM
00536 state_status_t state_nlm_notify(state_nsm_client_t   * pnsmclient,
00537                                 state_t              * pstate,
00538                                 state_status_t       * pstatus);
00539 #endif
00540 
00541 state_status_t state_owner_unlock_all(fsal_op_context_t    * pcontext,
00542                                       state_owner_t        * powner,
00543                                       state_t              * pstate,
00544                                       state_status_t       * pstatus);
00545 
00546 void state_lock_wipe(cache_entry_t        * pentry);
00547 
00548 /******************************************************************************
00549  *
00550  * NFSv4 State Management functions
00551  *
00552  ******************************************************************************/
00553 
00554 int state_conflict(state_t      * pstate,
00555                    state_type_t   state_type,
00556                    state_data_t * pstate_data);
00557 
00558 state_status_t state_add_impl(cache_entry_t         * pentry,
00559                               state_type_t            state_type,
00560                               state_data_t          * pstate_data,
00561                               state_owner_t         * powner_input,
00562                               fsal_op_context_t     * pcontext,
00563                               state_t              ** ppstate,
00564                               state_status_t        * pstatus);
00565 
00566 state_status_t state_add(cache_entry_t         * pentry,
00567                          state_type_t            state_type,
00568                          state_data_t          * pstate_data,
00569                          state_owner_t         * powner_input,
00570                          fsal_op_context_t     * pcontext,
00571                          state_t              ** ppstate,
00572                          state_status_t        * pstatus);
00573 
00574 state_status_t state_set(state_t              * pstate,
00575                          state_status_t       * pstatus);
00576 
00577 state_status_t state_del_locked(state_t              * pstate,
00578                                 cache_entry_t        * pentry);
00579 
00580 state_status_t state_del(state_t              * pstate,
00581                          state_status_t       * pstatus);
00582 
00583 int display_lock_cookie_key(hash_buffer_t * pbuff, char *str);
00584 int display_lock_cookie_val(hash_buffer_t * pbuff, char *str);
00585 int compare_lock_cookie_key(hash_buffer_t * buff1, hash_buffer_t * buff2);
00586 uint32_t lock_cookie_value_hash_func(hash_parameter_t * p_hparam,
00587                                           hash_buffer_t * buffclef);
00588 uint64_t lock_cookie_rbt_hash_func(hash_parameter_t * p_hparam,
00589                                    hash_buffer_t * buffclef);
00590 
00591 #ifdef _PNFS_MDS
00592 state_status_t state_add_segment(state_t             * pstate,
00593                                  struct pnfs_segment * segment,
00594                                  void                * fsal_data,
00595                                  bool_t                return_on_close);
00596 
00597 state_status_t state_delete_segment(state_layout_segment_t *segment);
00598 state_status_t state_lookup_layout_state(cache_entry_t * pentry,
00599                                          state_owner_t * powner,
00600                                          layouttype4     type,
00601                                          state_t      ** pstate);
00602 #endif /*  _PNFS_MDS */
00603 
00604 void state_nfs4_state_wipe(cache_entry_t        * pentry);
00605 
00606 void release_lockstate(state_owner_t * plock_owner);
00607 void release_openstate(state_owner_t * popen_owner);
00608 
00609 /******************************************************************************
00610  *
00611  * Share functions
00612  *
00613  ******************************************************************************/
00614 
00615 #define OPEN4_SHARE_ACCESS_NONE 0
00616 
00617 state_status_t state_share_add(cache_entry_t         * pentry,
00618                                fsal_op_context_t     * pcontext,
00619                                state_owner_t         * powner,
00620                                state_t               * pstate,  /* state that holds share bits to be added */
00621                                state_status_t        * pstatus);
00622 
00623 state_status_t state_share_remove(cache_entry_t         * pentry,
00624                                   fsal_op_context_t     * pcontext,
00625                                   state_owner_t         * powner,
00626                                   state_t               * pstate,  /* state that holds share bits to be removed */
00627                                   state_status_t        * pstatus);
00628 
00629 state_status_t state_share_upgrade(cache_entry_t         * pentry,
00630                                    fsal_op_context_t     * pcontext,
00631                                    state_data_t          * pstate_data, /* new share bits */
00632                                    state_owner_t         * powner,
00633                                    state_t               * pstate,      /* state that holds current share bits */
00634                                    state_status_t        * pstatus);
00635 
00636 state_status_t state_share_downgrade(cache_entry_t         * pentry,
00637                                      fsal_op_context_t     * pcontext,
00638                                      state_data_t          * pstate_data, /* new share bits */
00639                                      state_owner_t         * powner,
00640                                      state_t               * pstate,      /* state that holds current share bits */
00641                                      state_status_t        * pstatus);
00642 
00643 state_status_t state_share_set_prev(state_t      * pstate,
00644                                     state_data_t * pstate_data);
00645 
00646 state_status_t state_share_check_prev(state_t      * pstate,
00647                                     state_data_t * pstate_data);
00648 
00649 state_status_t state_share_check_conflict(cache_entry_t  * pentry,
00650                                           int              share_acccess,
00651                                           int              share_deny,
00652                                           state_status_t * pstatus);
00653 
00654 state_status_t state_share_anonymous_io_start(cache_entry_t  * pentry,
00655                                               int              share_access,
00656                                               state_status_t * pstatus);
00657 
00658 void state_share_anonymous_io_done(cache_entry_t  * pentry,
00659                                    int              share_access);
00660 
00661 state_status_t state_nlm_share(cache_entry_t        * pentry,
00662                                fsal_op_context_t    * pcontext,
00663                                exportlist_t         * pexport,
00664                                int                    share_access,
00665                                int                    share_deny,
00666                                state_owner_t        * powner,
00667                                state_status_t       * pstatus);
00668 
00669 state_status_t state_nlm_unshare(cache_entry_t        * pentry,
00670                                  fsal_op_context_t    * pcontext,
00671                                  int                    share_access,
00672                                  int                    share_deny,
00673                                  state_owner_t        * powner,
00674                                  state_status_t       * pstatus);
00675 
00676 /******************************************************************************
00677  *
00678  * Async functions
00679  *
00680  ******************************************************************************/
00681 
00682 #ifdef _USE_BLOCKING_LOCKS
00683 
00684 /* Schedule Async Work */
00685 state_status_t state_async_schedule(state_async_queue_t *arg);
00686 
00687 /* Signal Async Work */
00688 void signal_async_work();
00689 
00690 state_status_t state_async_init();
00691 void state_async_thread_start();
00692 
00693 void grant_blocked_lock_upcall(cache_entry_t        * pentry,
00694                                void                 * powner,
00695                                fsal_lock_param_t    * plock);
00696 
00697 void available_blocked_lock_upcall(cache_entry_t        * pentry,
00698                                    void                 * powner,
00699                                    fsal_lock_param_t    * plock);
00700 
00701 void process_blocked_lock_upcall(state_block_data_t   * block_data);
00702 #endif
00703 
00704 /******************************************************************************
00705  *
00706  * NFSv4 Recovery functions
00707  *
00708  ******************************************************************************/
00709 
00710 void nfs4_init_grace();
00711 void nfs4_start_grace(nfs_grace_start_t *gsp);
00712 int nfs_in_grace();
00713 void nfs4_create_clid_name(nfs_client_record_t *, nfs_client_id_t *,
00714     struct svc_req *);
00715 void nfs4_add_clid(nfs_client_id_t *);
00716 void nfs4_rm_clid(char *);
00717 void nfs4_chk_clid(nfs_client_id_t *);
00718 void nfs4_load_recov_clids(ushort nodeid);
00719 void nfs4_clean_old_recov_dir();
00720 void nfs4_create_recov_dir();
00721 
00722 #endif                          /*  _SAL_FUNCTIONS_H */