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
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _LOCKING_H
#define IS_PENDING_LOCK(type) ((type) == PENDING_READ_LOCK || (type) == PENDING_WRITE_LOCK)
+#include "librpc/gen_ndr/server_id.h"
+
/* 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 {
- uint32 smbpid;
- uint16 tid;
- struct process_id pid;
-};
-
-/* The key used in the brlock database. */
-
-struct lock_key {
- SMB_DEV_T device;
- SMB_INO_T inode;
+ uint64_t smblctx;
+ uint32_t tid;
+ struct server_id pid;
};
struct files_struct;
+#include "lib/file_id.h"
+
struct byte_range_lock {
struct files_struct *fsp;
unsigned int num_locks;
- BOOL modified;
- BOOL read_only;
- struct lock_key key;
- void *lock_data;
+ bool modified;
+ bool read_only;
+ struct file_id key;
+ struct lock_struct *lock_data;
+ struct db_record *record;
};
-#define BRLOCK_FN_CAST() \
- void (*)(SMB_DEV_T dev, SMB_INO_T ino, struct process_id pid, \
- enum brl_type lock_type, \
- enum brl_flavour lock_flav, \
- br_off start, br_off size)
-
-#define BRLOCK_FN(fn) \
- void (*fn)(SMB_DEV_T dev, SMB_INO_T ino, struct process_id pid, \
- enum brl_type lock_type, \
- enum brl_flavour lock_flav, \
- br_off start, br_off size)
-
/* Internal structure in brlock.tdb.
The data in brlock records is an unsorted linear array of these
records. It is unnecessary to store the count as tdb provides the
struct lock_context context;
br_off start;
br_off size;
- uint16 fnum;
+ uint64_t fnum;
enum brl_type lock_type;
enum brl_flavour lock_flav;
};
+/****************************************************************************
+ This is the structure to queue to implement blocking locks.
+*****************************************************************************/
+
+struct blocking_lock_record {
+ struct blocking_lock_record *next;
+ struct blocking_lock_record *prev;
+ struct files_struct *fsp;
+ struct timeval expire_time;
+ int lock_num;
+ uint64_t offset;
+ uint64_t count;
+ uint64_t smblctx;
+ uint64_t blocking_smblctx; /* Context that blocks us. */
+ enum brl_flavour lock_flav;
+ enum brl_type lock_type;
+ struct smb_request *req;
+ void *blr_private; /* Implementation specific. */
+};
+
+struct smbd_lock_element {
+ uint64_t smblctx;
+ enum brl_type brltype;
+ uint64_t offset;
+ uint64_t count;
+};
+
+struct share_mode_lock {
+ struct share_mode_data *data;
+};
+
#endif /* _LOCKING_H_ */