nfs-ganesha 1.4
|
00001 #ifdef HAVE_CONFIG_H 00002 #include "config.h" 00003 #endif 00004 00005 #include "posixdb_internal.h" 00006 #include <string.h> 00007 00019 fsal_posixdb_status_t fsal_posixdb_lockHandleForUpdate(fsal_posixdb_conn * p_conn, /* IN */ 00020 fsal_posixdb_fileinfo_t * 00021 p_info /* IN */ ) 00022 { 00023 PGresult *p_res; 00024 char devid_str[MAX_DEVICEIDSTR_SIZE]; 00025 char inode_str[MAX_INODESTR_SIZE]; 00026 const char *paramValues[2]; 00027 00028 CheckConn(p_conn); 00029 00030 BeginTransaction(p_conn, p_res); 00031 00032 snprintf(devid_str, MAX_DEVICEIDSTR_SIZE, "%lli", (long long int)p_info->devid); 00033 snprintf(inode_str, MAX_INODESTR_SIZE, "%lli", (long long int)p_info->inode); 00034 paramValues[0] = devid_str; 00035 paramValues[1] = inode_str; 00036 p_res = PQexecPrepared(p_conn, "lookupHandleByInodeFU", 2, paramValues, NULL, NULL, 0); 00037 CheckResult(p_res); 00038 PQclear(p_res); 00039 00040 /* Do not end the transaction, because it will be closed by the next call to a posixdb function */ 00041 00042 ReturnCodeDB(ERR_FSAL_POSIXDB_NOERR, 0); 00043 } 00044 00054 fsal_posixdb_status_t fsal_posixdb_cancelHandleLock(fsal_posixdb_conn * p_conn /* IN */ ) 00055 { 00056 PGresult *p_res; 00057 PGTransactionStatusType transStatus = PQtransactionStatus(p_conn); 00058 00059 if(transStatus == PQTRANS_ACTIVE || transStatus == PQTRANS_INTRANS) 00060 { 00061 RollbackTransaction(p_conn, p_res); 00062 } 00063 00064 ReturnCodeDB(ERR_FSAL_POSIXDB_NOERR, 0); 00065 }