summaryrefslogtreecommitdiff
path: root/source/smbd
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1997-10-20 08:46:00 +0000
committerAndrew Tridgell <tridge@samba.org>1997-10-20 08:46:00 +0000
commit65ab9adaa0d356b8041ed8a507ea52117f2a284e (patch)
treee6f01020d3f1f9afaad9de7a8f111f04f18f213d /source/smbd
parentab849a97821c9e1f199eea8ea2ec477687bed947 (diff)
downloadsamba-65ab9adaa0d356b8041ed8a507ea52117f2a284e.tar.gz
a major share modes reorganisation.
The shares modes code is now split into separate files. The shared memory implementation is in locking_shm.c. The slow implementation is in locking_slow.c It is all controlled by a struct share_ops structure that has function pointers to the implementation of all the functions needed by a share modes implementation. An initialisation function sets up this structure. This will make adding new implementations easy and clean. This also allowed me to get rid of the ugly code in smbstatus. Now status.c links to the locking code and calls methods in share_ops. I also renamed some things and generally organised things in a much cleaner fashion. Defines and structures specific to each implementation have been moved to the appropriate file and out of smb.h.
Diffstat (limited to 'source/smbd')
-rw-r--r--source/smbd/reply.c2
-rw-r--r--source/smbd/server.c30
2 files changed, 14 insertions, 18 deletions
diff --git a/source/smbd/reply.c b/source/smbd/reply.c
index c5b7c500719..7576ee323b0 100644
--- a/source/smbd/reply.c
+++ b/source/smbd/reply.c
@@ -3422,7 +3422,7 @@ int reply_lockingX(char *inbuf,char *outbuf,int length,int bufsize)
(num_ulocks == 0) && (num_locks == 0) &&
(CVAL(inbuf,smb_vwv0) == 0xFF))
{
- share_lock_token token;
+ int token;
files_struct *fsp = &Files[fnum];
uint32 dev = fsp->fd_ptr->dev;
uint32 inode = fsp->fd_ptr->inode;
diff --git a/source/smbd/server.c b/source/smbd/server.c
index be24ad7781a..7d9638f01e8 100644
--- a/source/smbd/server.c
+++ b/source/smbd/server.c
@@ -1373,7 +1373,7 @@ void close_file(int fnum, BOOL normal_close)
int cnum = fs_p->cnum;
uint32 dev = fs_p->fd_ptr->dev;
uint32 inode = fs_p->fd_ptr->inode;
- share_lock_token token;
+ int token;
invalidate_read_prediction(fs_p->fd_ptr->fd);
fs_p->open = False;
@@ -1477,10 +1477,10 @@ BOOL check_file_sharing(int cnum,char *fname)
{
int i;
int ret = False;
- min_share_mode_entry *old_shares = 0;
+ share_mode_entry *old_shares = 0;
int num_share_modes;
struct stat sbuf;
- share_lock_token token;
+ int token;
int pid = getpid();
uint32 dev, inode;
@@ -1509,7 +1509,7 @@ BOOL check_file_sharing(int cnum,char *fname)
broke_oplock = False;
for(i = 0; i < num_share_modes; i++)
{
- min_share_mode_entry *share_entry = &old_shares[i];
+ share_mode_entry *share_entry = &old_shares[i];
/*
* Break oplocks before checking share modes. See comment in
@@ -1571,8 +1571,8 @@ free_and_exit:
Helper for open_file_shared.
Truncate a file after checking locking; close file if locked.
**************************************************************************/
-static void truncate_unless_locked(int fnum, int cnum, share_lock_token token,
- BOOL *share_locked)
+static void truncate_unless_locked(int fnum, int cnum, int token,
+ BOOL *share_locked)
{
if (Files[fnum].can_write){
if (is_locked(fnum,cnum,0x3FFFFFFF,0)){
@@ -1596,7 +1596,7 @@ static void truncate_unless_locked(int fnum, int cnum, share_lock_token token,
/****************************************************************************
check if we can open a file with a share mode
****************************************************************************/
-int check_share_mode( min_share_mode_entry *share, int deny_mode, char *fname,
+int check_share_mode( share_mode_entry *share, int deny_mode, char *fname,
BOOL fcbopen, int *flags)
{
int old_open_mode = share->share_mode &0xF;
@@ -1648,7 +1648,7 @@ void open_file_shared(int fnum,int cnum,char *fname,int share_mode,int ofun,
BOOL file_existed = file_exist(fname,&sbuf);
BOOL share_locked = False;
BOOL fcbopen = False;
- share_lock_token token;
+ int token;
uint32 dev = 0;
uint32 inode = 0;
int num_share_modes = 0;
@@ -1724,7 +1724,7 @@ void open_file_shared(int fnum,int cnum,char *fname,int share_mode,int ofun,
if (lp_share_modes(SNUM(cnum)))
{
int i;
- min_share_mode_entry *old_shares = 0;
+ share_mode_entry *old_shares = 0;
if (file_existed)
{
@@ -1749,7 +1749,7 @@ void open_file_shared(int fnum,int cnum,char *fname,int share_mode,int ofun,
broke_oplock = False;
for(i = 0; i < num_share_modes; i++)
{
- min_share_mode_entry *share_entry = &old_shares[i];
+ share_mode_entry *share_entry = &old_shares[i];
/*
* By observation of NetBench, oplocks are broken *before* share
@@ -2794,7 +2794,7 @@ Send an oplock break message to another smbd process. If the oplock is held
by the local smbd then call the oplock break function directly.
****************************************************************************/
-BOOL request_oplock_break(min_share_mode_entry *share_entry,
+BOOL request_oplock_break(share_mode_entry *share_entry,
uint32 dev, uint32 inode)
{
char op_break_msg[OPLOCK_BREAK_MSG_LEN];
@@ -4177,9 +4177,7 @@ void exit_server(char *reason)
#endif
}
-#ifdef FAST_SHARE_MODES
- stop_share_mode_mgmt();
-#endif /* FAST_SHARE_MODES */
+ locking_end();
DEBUG(3,("%s Server exit (%s)\n",timestring(),reason?reason:""));
exit(0);
@@ -5012,10 +5010,8 @@ static void usage(char *pname)
if (!open_sockets(is_daemon,port))
exit(1);
-#ifdef FAST_SHARE_MODES
- if (!start_share_mode_mgmt())
+ if (!locking_init())
exit(1);
-#endif /* FAST_SHARE_MODES */
/* possibly reload the services file. */
reload_services(True);