2005-09-06 00:36:07 +04:00
/*
Samba share mode database library .
Copyright ( C ) Jeremy Allison 2005.
This library is free software ; you can redistribute it and / or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation ; either
2007-07-10 05:44:42 +04:00
version 3 of the License , or ( at your option ) any later version .
2005-09-06 00:36:07 +04:00
This library is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
Lesser General Public License for more details .
You should have received a copy of the GNU Lesser General Public
2007-07-10 07:42:26 +04:00
License along with this library ; if not , see < http : //www.gnu.org/licenses/>.
2005-09-06 00:36:07 +04:00
*/
# ifndef _SMB_SHARE_MODES_H_
# define _SMB_STATE_MODES_H_
# ifdef __cplusplus
extern " C " {
# endif
2005-09-11 09:18:14 +04:00
# if HAVE_INTTYPES_H
# include <inttypes.h>
# else
# if HAVE_STDINT_H
# include <stdint.h>
# endif
# endif
2007-04-10 22:12:25 +04:00
/* Opaque database context handle. */
struct smbdb_ctx ;
2005-09-06 00:36:07 +04:00
/* Share mode entry. */
/*
We use 64 bit types for device and inode as
we don ' t know what size mode Samba has been
compiled in - dev / ino may be 32 , may be 64
bits . This interface copes with either .
*/
struct smb_share_mode_entry {
uint64_t dev ;
uint64_t ino ;
2009-02-16 10:45:28 +03:00
uint64_t extid ;
2005-09-06 00:36:07 +04:00
uint32_t share_access ;
uint32_t access_mask ;
struct timeval open_time ;
uint32_t file_id ;
2007-05-07 13:35:35 +04:00
struct server_id pid ;
2005-09-06 00:36:07 +04:00
} ;
/*
* open / close sharemode database .
*/
struct smbdb_ctx * smb_share_mode_db_open ( const char * db_path ) ;
int smb_share_mode_db_close ( struct smbdb_ctx * db_ctx ) ;
/*
* lock / unlock entry in sharemode database .
*/
int smb_lock_share_mode_entry ( struct smbdb_ctx * db_ctx ,
uint64_t dev ,
2009-02-16 10:45:28 +03:00
uint64_t ino ,
uint64_t extid ) ;
2005-09-06 00:36:07 +04:00
int smb_unlock_share_mode_entry ( struct smbdb_ctx * db_ctx ,
uint64_t dev ,
2009-02-16 10:45:28 +03:00
uint64_t ino ,
uint64_t extid ) ;
2005-09-06 00:36:07 +04:00
/*
* Share mode database accessor functions .
*/
int smb_get_share_mode_entries ( struct smbdb_ctx * db_ctx ,
uint64_t dev ,
uint64_t ino ,
2009-02-16 10:45:28 +03:00
uint64_t extid ,
2005-09-06 00:36:07 +04:00
struct smb_share_mode_entry * * pp_list ,
unsigned char * p_delete_on_close ) ;
int smb_create_share_mode_entry ( struct smbdb_ctx * db_ctx ,
uint64_t dev ,
uint64_t ino ,
2009-02-16 10:45:28 +03:00
uint64_t extid ,
2005-09-06 00:36:07 +04:00
const struct smb_share_mode_entry * set_entry ,
const char * path ) ;
int smb_delete_share_mode_entry ( struct smbdb_ctx * db_ctx ,
uint64_t dev ,
uint64_t ino ,
2009-02-16 10:45:28 +03:00
uint64_t extid ,
2005-09-06 00:36:07 +04:00
const struct smb_share_mode_entry * set_entry ) ;
int smb_change_share_mode_entry ( struct smbdb_ctx * db_ctx ,
uint64_t dev ,
uint64_t ino ,
2009-02-16 10:45:28 +03:00
uint64_t extid ,
2005-09-06 00:36:07 +04:00
const struct smb_share_mode_entry * set_entry ,
const struct smb_share_mode_entry * new_entry ) ;
# ifdef __cplusplus
}
# endif
# endif