1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_CEPH_CLS_LOCK_CLIENT_H
3 #define _LINUX_CEPH_CLS_LOCK_CLIENT_H
4 
5 #include <linux/ceph/osd_client.h>
6 
7 enum ceph_cls_lock_type {
8 	CEPH_CLS_LOCK_NONE = 0,
9 	CEPH_CLS_LOCK_EXCLUSIVE = 1,
10 	CEPH_CLS_LOCK_SHARED = 2,
11 };
12 
13 struct ceph_locker_id {
14 	struct ceph_entity_name name;	/* locker's client name */
15 	char *cookie;			/* locker's cookie */
16 };
17 
18 struct ceph_locker_info {
19 	struct ceph_entity_addr addr;	/* locker's address */
20 };
21 
22 struct ceph_locker {
23 	struct ceph_locker_id id;
24 	struct ceph_locker_info info;
25 };
26 
27 int ceph_cls_lock(struct ceph_osd_client *osdc,
28 		  struct ceph_object_id *oid,
29 		  struct ceph_object_locator *oloc,
30 		  char *lock_name, u8 type, char *cookie,
31 		  char *tag, char *desc, u8 flags);
32 int ceph_cls_unlock(struct ceph_osd_client *osdc,
33 		    struct ceph_object_id *oid,
34 		    struct ceph_object_locator *oloc,
35 		    char *lock_name, char *cookie);
36 int ceph_cls_break_lock(struct ceph_osd_client *osdc,
37 			struct ceph_object_id *oid,
38 			struct ceph_object_locator *oloc,
39 			char *lock_name, char *cookie,
40 			struct ceph_entity_name *locker);
41 int ceph_cls_set_cookie(struct ceph_osd_client *osdc,
42 			struct ceph_object_id *oid,
43 			struct ceph_object_locator *oloc,
44 			char *lock_name, u8 type, char *old_cookie,
45 			char *tag, char *new_cookie);
46 
47 void ceph_free_lockers(struct ceph_locker *lockers, u32 num_lockers);
48 
49 int ceph_cls_lock_info(struct ceph_osd_client *osdc,
50 		       struct ceph_object_id *oid,
51 		       struct ceph_object_locator *oloc,
52 		       char *lock_name, u8 *type, char **tag,
53 		       struct ceph_locker **lockers, u32 *num_lockers);
54 
55 #endif
56