2013-09-10 11:35:01 +00:00
/*
2006-07-11 18:01:26 +00:00
Unix SMB / CIFS implementation .
SMB parameters and setup , plus a whole lot more .
2013-09-10 11:35:01 +00:00
2006-07-11 18:01:26 +00:00
Copyright ( C ) Jeremy Allison 2006
2013-09-10 11:35:01 +00:00
2006-07-11 18:01:26 +00:00
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
2007-07-09 19:25:36 +00:00
the Free Software Foundation ; either version 3 of the License , or
2006-07-11 18:01:26 +00:00
( at your option ) any later version .
2013-09-10 11:35:01 +00:00
2006-07-11 18:01:26 +00:00
This program 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 General Public License for more details .
2013-09-10 11:35:01 +00:00
2006-07-11 18:01:26 +00:00
You should have received a copy of the GNU General Public License
2007-07-10 00:52:41 +00:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2006-07-11 18:01:26 +00:00
*/
# ifndef _LOCKING_H
# define _LOCKING_H
/* passed to br lock code - the UNLOCK_LOCK should never be stored into the tdb
2006-07-29 19:14:24 +00:00
and is used in calculating POSIX unlock ranges only . We differentiate between
PENDING read and write locks to allow posix lock downgrades to trigger a lock
re - evaluation . */
2006-07-11 18:01:26 +00:00
2019-06-20 11:07:17 +02:00
enum brl_type { READ_LOCK , WRITE_LOCK , UNLOCK_LOCK } ;
2006-07-11 18:01:26 +00:00
enum brl_flavour { WINDOWS_LOCK = 0 , POSIX_LOCK = 1 } ;
2011-03-24 15:31:06 +01:00
# include "librpc/gen_ndr/server_id.h"
2019-08-08 19:26:28 +02:00
# include "librpc/gen_ndr/misc.h"
2011-03-24 15:31:06 +01:00
2006-07-11 18:01:26 +00:00
/* This contains elements that differentiate locks. The smbpid is a
client supplied pid , and is essentially the locking context for
this client */
struct lock_context {
2010-05-07 06:20:50 -07:00
uint64_t smblctx ;
2012-06-06 15:33:58 +02:00
uint32_t tid ;
2007-05-07 09:35:35 +00:00
struct server_id pid ;
2006-07-11 18:01:26 +00:00
} ;
2007-05-29 09:30:34 +00:00
struct files_struct ;
2006-07-11 18:01:26 +00:00
2012-04-16 15:34:40 +10:00
# include "lib/file_id.h"
2006-07-11 18:01:26 +00:00
2013-09-10 19:42:06 +02:00
struct byte_range_lock ;
2006-07-11 18:01:26 +00:00
2013-09-10 11:35:01 +00:00
/* Internal structure in brlock.tdb.
2006-07-11 18:01:26 +00:00
The data in brlock records is an unsorted linear array of these
records . It is unnecessary to store the count as tdb provides the
size of the record */
struct lock_struct {
struct lock_context context ;
br_off start ;
br_off size ;
2012-06-06 15:42:48 +02:00
uint64_t fnum ;
2006-07-11 18:01:26 +00:00
enum brl_type lock_type ;
enum brl_flavour lock_flav ;
} ;
2010-04-30 21:03:20 -07:00
struct smbd_lock_element {
2019-08-08 19:26:28 +02:00
struct GUID req_guid ;
2010-05-07 06:20:50 -07:00
uint64_t smblctx ;
2010-04-30 21:03:20 -07:00
enum brl_type brltype ;
uint64_t offset ;
uint64_t count ;
} ;
2012-06-04 17:43:13 +02:00
struct share_mode_lock {
struct share_mode_data * data ;
} ;
2006-07-11 18:01:26 +00:00
# endif /* _LOCKING_H_ */