#include <linux/fs.h>
#include <linux/filelock.h>
#include <linux/miscdevice.h>
#include <linux/poll.h>
#include <linux/dlm.h>
#include <linux/dlm_plock.h>
#include <linux/slab.h>
#include <trace/events/dlm.h>
#include "dlm_internal.h"
#include "lockspace.h"
static DEFINE_SPINLOCK(ops_lock);
static LIST_HEAD(send_list);
static LIST_HEAD(recv_list);
static DECLARE_WAIT_QUEUE_HEAD(send_wq);
static DECLARE_WAIT_QUEUE_HEAD(recv_wq);
struct plock_async_data { … };
struct plock_op { … };
static inline void set_version(struct dlm_plock_info *info)
{ … }
static struct plock_op *plock_lookup_waiter(const struct dlm_plock_info *info)
{ … }
static int check_version(struct dlm_plock_info *info)
{ … }
static void dlm_release_plock_op(struct plock_op *op)
{ … }
static void send_op(struct plock_op *op)
{ … }
static int do_lock_cancel(const struct dlm_plock_info *orig_info)
{ … }
int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
int cmd, struct file_lock *fl)
{ … }
EXPORT_SYMBOL_GPL(…);
static int dlm_plock_callback(struct plock_op *op)
{ … }
int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
struct file_lock *fl)
{ … }
EXPORT_SYMBOL_GPL(…);
int dlm_posix_cancel(dlm_lockspace_t *lockspace, u64 number, struct file *file,
struct file_lock *fl)
{ … }
EXPORT_SYMBOL_GPL(…);
int dlm_posix_get(dlm_lockspace_t *lockspace, u64 number, struct file *file,
struct file_lock *fl)
{ … }
EXPORT_SYMBOL_GPL(…);
static ssize_t dev_read(struct file *file, char __user *u, size_t count,
loff_t *ppos)
{ … }
static ssize_t dev_write(struct file *file, const char __user *u, size_t count,
loff_t *ppos)
{ … }
static __poll_t dev_poll(struct file *file, poll_table *wait)
{ … }
static const struct file_operations dev_fops = …;
static struct miscdevice plock_dev_misc = …;
int dlm_plock_init(void)
{ … }
void dlm_plock_exit(void)
{ … }