----
struct ldlm_lock_desc {
struct ldlm_resource_desc l_resource;
- ldlm_mode_t l_req_mode;
- ldlm_mode_t l_granted_mode;
- ldlm_wire_policy_data_t l_policy_data;
+ enum ldlm_mode l_req_mode;
+ enum ldlm_mode l_granted_mode;
+ union ldlm_wire_policy_data l_policy_data;
};
----
values are:
----
-typedef enum {
+enum ldlm_mode {
LCK_EX = 1, /* exclusive */
LCK_PW = 2, /* privileged write */
LCK_PR = 4, /* privileged read */
LCK_NL = 32, /* */
LCK_GROUP = 64, /* */
LCK_COS = 128, /* */
-} ldlm_mode_t;
+};
----
+[[struct-ldlm-mode]]
Despite the fact that the lock modes are not overlapping, these lock
modes are exclusive. In addition the mode value 0 is the MINMODE,
The 'l_policy_data' field gives the kind of resource being
requested/granted. It is a union of these struct definitions:
-[[ldlm-wire-policy-data-t]]
+[[struct-ldlm-wire-policy-data]]
----
-typedef union {
+union ldlm_wire_policy_data {
struct ldlm_extent l_extent;
struct ldlm_flock_wire l_flock;
struct ldlm_inodebits l_inodebits;
-} ldlm_wire_policy_data_t;
+};
----
----
__u64 end;
__u64 gid;
};
+----
+[[struct-ldlm-extent]]
+----
struct ldlm_flock_wire {
__u64 lfw_start;
__u64 lfw_end;
__u32 lfw_padding;
__u32 lfw_pid;
};
+----
+[[struct-ldlm-flock-wire]]
+----
struct ldlm_inodebits {
__u64 bits;
};
----
+[[struct-ldlm-inodebits]]
Thus the lock may be on an 'extent', a contiguous sequence of bytes
in a regular file; an 'flock wire', whatever to heck that is; or a
portion of an inode. For a "plain" lock (or one with no type at all)
the 'l_policy_data' field has zero length.
-
-