include/locking.h

説明を見る。
00001 /* 
00002    Unix SMB/CIFS implementation.
00003    SMB parameters and setup, plus a whole lot more.
00004    
00005    Copyright (C) Jeremy Allison   2006
00006    
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2 of the License, or
00010    (at your option) any later version.
00011    
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016    
00017    You should have received a copy of the GNU General Public License
00018    along with this program; if not, write to the Free Software
00019    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020 */
00021 
00022 #ifndef _LOCKING_H
00023 #define _LOCKING_H
00024 
00025 /* passed to br lock code - the UNLOCK_LOCK should never be stored into the tdb
00026    and is used in calculating POSIX unlock ranges only. We differentiate between
00027    PENDING read and write locks to allow posix lock downgrades to trigger a lock
00028    re-evaluation. */
00029 
00030 enum brl_type {READ_LOCK, WRITE_LOCK, PENDING_READ_LOCK, PENDING_WRITE_LOCK, UNLOCK_LOCK};
00031 enum brl_flavour {WINDOWS_LOCK = 0, POSIX_LOCK = 1};
00032 
00033 #define IS_PENDING_LOCK(type) ((type) == PENDING_READ_LOCK || (type) == PENDING_WRITE_LOCK)
00034 
00035 /* This contains elements that differentiate locks. The smbpid is a
00036    client supplied pid, and is essentially the locking context for
00037    this client */
00038 
00039 struct lock_context {
00040         uint32 smbpid;
00041         uint16 tid;
00042         struct process_id pid;
00043 };
00044 
00045 /* The key used in the brlock database. */
00046 
00047 struct lock_key {
00048         SMB_DEV_T device;
00049         SMB_INO_T inode;
00050 };
00051 
00052 struct files_struct;
00053 
00054 struct byte_range_lock {
00055         struct files_struct *fsp;
00056         unsigned int num_locks;
00057         BOOL modified;
00058         BOOL read_only;
00059         struct lock_key key;
00060         void *lock_data;
00061 };
00062 
00063 #define BRLOCK_FN_CAST() \
00064         void (*)(SMB_DEV_T dev, SMB_INO_T ino, struct process_id pid, \
00065                                  enum brl_type lock_type, \
00066                                  enum brl_flavour lock_flav, \
00067                                  br_off start, br_off size)
00068 
00069 #define BRLOCK_FN(fn) \
00070         void (*fn)(SMB_DEV_T dev, SMB_INO_T ino, struct process_id pid, \
00071                                  enum brl_type lock_type, \
00072                                  enum brl_flavour lock_flav, \
00073                                  br_off start, br_off size)
00074 
00075 /* Internal structure in brlock.tdb. 
00076    The data in brlock records is an unsorted linear array of these
00077    records.  It is unnecessary to store the count as tdb provides the
00078    size of the record */
00079 
00080 struct lock_struct {
00081         struct lock_context context;
00082         br_off start;
00083         br_off size;
00084         uint16 fnum;
00085         enum brl_type lock_type;
00086         enum brl_flavour lock_flav;
00087 };
00088 
00089 #endif /* _LOCKING_H_ */

Sambaに対してSat Aug 29 21:22:54 2009に生成されました。  doxygen 1.4.7