#undef pr_fmt
#define pr_fmt(fmt) …
#include <linux/module.h>
#include <linux/blkdev.h>
#include "rnbd-srv.h"
#include "rnbd-srv-trace.h"
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
static u16 port_nr = …;
module_param_named(port_nr, port_nr, ushort, 0444);
MODULE_PARM_DESC(…) …;
#define DEFAULT_DEV_SEARCH_PATH …
static char dev_search_path[PATH_MAX] = …;
static int dev_search_path_set(const char *val, const struct kernel_param *kp)
{ … }
static struct kparam_string dev_search_path_kparam_str = …;
static const struct kernel_param_ops dev_search_path_ops = …;
module_param_cb(…);
MODULE_PARM_DESC(…) …;
static DEFINE_MUTEX(sess_lock);
static DEFINE_SPINLOCK(dev_lock);
static LIST_HEAD(sess_list);
static LIST_HEAD(dev_list);
struct rnbd_io_private { … };
static void rnbd_sess_dev_release(struct kref *kref)
{ … }
static inline void rnbd_put_sess_dev(struct rnbd_srv_sess_dev *sess_dev)
{ … }
static struct rnbd_srv_sess_dev *
rnbd_get_sess_dev(int dev_id, struct rnbd_srv_session *srv_sess)
{ … }
static void rnbd_dev_bi_end_io(struct bio *bio)
{ … }
static int process_rdma(struct rnbd_srv_session *srv_sess,
struct rtrs_srv_op *id, void *data, u32 datalen,
const void *usr, size_t usrlen)
{ … }
static void destroy_device(struct kref *kref)
{ … }
static void rnbd_put_srv_dev(struct rnbd_srv_dev *dev)
{ … }
void rnbd_destroy_sess_dev(struct rnbd_srv_sess_dev *sess_dev, bool keep_id)
{ … }
static void destroy_sess(struct rnbd_srv_session *srv_sess)
{ … }
static int create_sess(struct rtrs_srv_sess *rtrs)
{ … }
static int rnbd_srv_link_ev(struct rtrs_srv_sess *rtrs,
enum rtrs_srv_link_ev ev, void *priv)
{ … }
void rnbd_srv_sess_dev_force_close(struct rnbd_srv_sess_dev *sess_dev,
struct kobj_attribute *attr)
{ … }
static void process_msg_close(struct rnbd_srv_session *srv_sess,
void *data, size_t datalen, const void *usr,
size_t usrlen)
{ … }
static int process_msg_open(struct rnbd_srv_session *srv_sess,
const void *msg, size_t len,
void *data, size_t datalen);
static void process_msg_sess_info(struct rnbd_srv_session *srv_sess,
const void *msg, size_t len,
void *data, size_t datalen);
static int rnbd_srv_rdma_ev(void *priv, struct rtrs_srv_op *id,
void *data, size_t datalen,
const void *usr, size_t usrlen)
{ … }
static struct rnbd_srv_sess_dev
*rnbd_sess_dev_alloc(struct rnbd_srv_session *srv_sess)
{ … }
static struct rnbd_srv_dev *rnbd_srv_init_srv_dev(struct block_device *bdev)
{ … }
static struct rnbd_srv_dev *
rnbd_srv_find_or_add_srv_dev(struct rnbd_srv_dev *new_dev)
{ … }
static int rnbd_srv_check_update_open_perm(struct rnbd_srv_dev *srv_dev,
struct rnbd_srv_session *srv_sess,
enum rnbd_access_mode access_mode)
{ … }
static struct rnbd_srv_dev *
rnbd_srv_get_or_create_srv_dev(struct block_device *bdev,
struct rnbd_srv_session *srv_sess,
enum rnbd_access_mode access_mode)
{ … }
static void rnbd_srv_fill_msg_open_rsp(struct rnbd_msg_open_rsp *rsp,
struct rnbd_srv_sess_dev *sess_dev)
{ … }
static struct rnbd_srv_sess_dev *
rnbd_srv_create_set_sess_dev(struct rnbd_srv_session *srv_sess,
const struct rnbd_msg_open *open_msg,
struct file *bdev_file, bool readonly,
struct rnbd_srv_dev *srv_dev)
{ … }
static char *rnbd_srv_get_full_path(struct rnbd_srv_session *srv_sess,
const char *dev_name)
{ … }
static void process_msg_sess_info(struct rnbd_srv_session *srv_sess,
const void *msg, size_t len,
void *data, size_t datalen)
{ … }
static struct rnbd_srv_sess_dev *
find_srv_sess_dev(struct rnbd_srv_session *srv_sess, const char *dev_name)
{ … }
static int process_msg_open(struct rnbd_srv_session *srv_sess,
const void *msg, size_t len,
void *data, size_t datalen)
{ … }
static struct rtrs_srv_ctx *rtrs_ctx;
static struct rtrs_srv_ops rtrs_ops;
static int __init rnbd_srv_init_module(void)
{ … }
static void __exit rnbd_srv_cleanup_module(void)
{ … }
module_init(…) …;
module_exit(rnbd_srv_cleanup_module);