/xlators/features/locks/tests/

eral Public License, version 3 or any later version (LGPLv3 or later), or the GNU General Public License, version 2 (GPLv2), in all cases as published by the Free Software Foundation. */ #ifndef __POSIX_LOCKS_H__ #define __POSIX_LOCKS_H__ #include "compat-errno.h" #include "stack.h" #include "call-stub.h" #include "locks-mem-types.h" #include "client_t.h" #include "lkowner.h" typedef enum { MLK_NONE, MLK_FILE_BASED, MLK_FORCED, MLK_OPTIMAL } mlk_mode_t; /* defines different mandatory locking modes*/ struct __pl_fd; struct __posix_lock { struct list_head list; short fl_type; off_t fl_start; off_t fl_end; uint32_t lk_flags; short blocked; /* waiting to acquire */ struct gf_flock user_flock; /* the flock supplied by the user */ xlator_t *this; /* required for blocked locks */ unsigned long fd_num; fd_t *fd; call_frame_t *frame; struct timeval blkd_time; /*time at which lock was queued into blkd list*/ struct timeval granted_time; /*time at which lock was queued into active list*/ /* These two together serve to uniquely identify each process across nodes */ void *client; /* to identify client node */ /* This field uniquely identifies the client the lock belongs to. As * lock migration is handled by rebalance, the client_t object will be * overwritten by rebalance and can't be deemed as the owner of the * lock on destination. Hence, the below field is migrated from * source to destination by lock_migration_info_t and updated on the * destination. So that on client-server disconnection, server can * cleanup the locks proper;y. */ char *client_uid; gf_lkowner_t owner; pid_t client_pid; /* pid of client process */ int blocking; }; typedef struct __posix_lock posix_lock_t; struct __pl_inode_lock { struct list_head list; struct list_head blocked_locks; /* list_head pointing to blocked_inodelks */ int ref; short fl_type; off_t fl_start; off_t fl_end; const char *volume; struct gf_flock user_flock; /* the flock supplied by the user */ xlator_t *this; /* required for blocked locks */ struct __pl_inode *pl_inode; call_frame_t *frame; struct timeval blkd_time; /*time at which lock was queued into blkd list*/ struct timeval granted_time; /*time at which lock was queued into active list*/ /* These two together serve to uniquely identify each process across nodes */ void *client; /* to identify client node */ gf_lkowner_t owner; pid_t client_pid; /* pid of client process */ char *connection_id; /* stores the client connection id */ struct list_head client_list; /* list of all locks from a client */ }; typedef struct __pl_inode_lock pl_inode_lock_t; struct __pl_rw_req_t { struct list_head list; call_stub_t *stub; posix_lock_t region; }; typedef struct __pl_rw_req_t pl_rw_