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