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