From 4e1291a83f61a72989045879763d9ef05fd38f71 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 21 Dec 1999 09:25:59 +0000 Subject: converted all our existing shared memory code to use a tdb database instead of either sysv or mmap shared memory or lock files. this means we can now completely remove locking_shm.c locking_slow.c shmem.c shmem_sysv.c and lots of other things also got simpler locking.c got a bit larger, but is much better compartmentalised now (This used to be commit e48c2d9937eea0667b8cd3332e49c06314ef31e7) --- source3/include/proto.h | 21 ++++++++++++--------- source3/include/smb.h | 16 ++++++++++++++++ 2 files changed, 28 insertions(+), 9 deletions(-) (limited to 'source3/include') diff --git a/source3/include/proto.h b/source3/include/proto.h index 125ef3a27c..401a619110 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -299,6 +299,7 @@ BOOL reg_split_key(char *full_keyname, uint32 *reg_type, char *key_name); char *smbd_mktemp(char *template); void *memdup(void *p, size_t size); char *myhostname(void); +char *lock_path(char *name); /*The following definitions come from lib/util_file.c */ @@ -618,17 +619,18 @@ BOOL do_unlock(files_struct *fsp,connection_struct *conn, BOOL locking_init(int read_only); BOOL locking_end(void); BOOL lock_share_entry(connection_struct *conn, - SMB_DEV_T dev, SMB_INO_T inode, int *ptok); + SMB_DEV_T dev, SMB_INO_T inode); BOOL unlock_share_entry(connection_struct *conn, - SMB_DEV_T dev, SMB_INO_T inode, int token); + SMB_DEV_T dev, SMB_INO_T inode); int get_share_modes(connection_struct *conn, - int token, SMB_DEV_T dev, SMB_INO_T inode, + SMB_DEV_T dev, SMB_INO_T inode, share_mode_entry **shares); -void del_share_mode(int token, files_struct *fsp); -BOOL set_share_mode(int token, files_struct *fsp, uint16 port, uint16 op_type); -BOOL remove_share_oplock(int token, files_struct *fsp); -BOOL downgrade_share_oplock(int token, files_struct *fsp); -BOOL modify_share_mode(int token, files_struct *fsp, int new_mode, uint16 new_oplock); +void del_share_mode(files_struct *fsp); +BOOL set_share_mode(files_struct *fsp, uint16 port, uint16 op_type); +BOOL remove_share_oplock(files_struct *fsp); +BOOL downgrade_share_oplock(files_struct *fsp); +BOOL modify_share_mode(files_struct *fsp, int new_mode, uint16 new_oplock); +int traverse_fn(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf); int share_mode_forall(void (*fn)(share_mode_entry *, char *)); void share_status(FILE *f); @@ -2375,7 +2377,6 @@ void conn_free(connection_struct *conn); /*The following definitions come from smbd/connection.c */ -TDB_CONTEXT *open_db(char *name); BOOL yield_connection(connection_struct *conn,char *name,int max_connections); int delete_dead(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf); BOOL claim_connection(connection_struct *conn,char *name,int max_connections,BOOL Clear); @@ -2809,6 +2810,8 @@ TDB_CONTEXT *tdb_open(char *name, int hash_size, int flags, mode_t mode); int tdb_close(TDB_CONTEXT *tdb); int tdb_writelock(TDB_CONTEXT *tdb); int tdb_writeunlock(TDB_CONTEXT *tdb); +int tdb_lockchain(TDB_CONTEXT *tdb, TDB_DATA key); +int tdb_unlockchain(TDB_CONTEXT *tdb, TDB_DATA key); /*The following definitions come from utils/nbio.c */ diff --git a/source3/include/smb.h b/source3/include/smb.h index 6c3d7488c3..de269f1d7d 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -858,6 +858,22 @@ struct connections_data { time_t start; }; + +/* key and data records in the tdb locking database */ +struct locking_key { + SMB_DEV_T dev; + SMB_INO_T inode; +}; + +struct locking_data { + int num_share_mode_entries; + /* the following two entries are implicit + share_mode_entry modes[num_share_mode_entries]; + char file_name[]; + */ +}; + + /* the following are used by loadparm for option lists */ typedef enum { -- cgit