#define pr_fmt(fmt) …
#include <linux/module.h>
#include <linux/drbd.h>
#include <linux/in.h>
#include <linux/fs.h>
#include <linux/file.h>
#include <linux/slab.h>
#include <linux/blkpg.h>
#include <linux/cpumask.h>
#include "drbd_int.h"
#include "drbd_protocol.h"
#include "drbd_req.h"
#include "drbd_state_change.h"
#include <asm/unaligned.h>
#include <linux/drbd_limits.h>
#include <linux/kthread.h>
#include <net/genetlink.h>
int drbd_adm_new_minor(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_del_minor(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_new_resource(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_del_resource(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_down(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_set_role(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_disk_opts(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_detach(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_connect(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_net_opts(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_resize(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_start_ov(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_new_c_uuid(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_disconnect(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_invalidate(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_invalidate_peer(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_pause_sync(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_resume_sync(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_suspend_io(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_resume_io(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_outdate(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_resource_opts(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_get_status(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_get_timeout_type(struct sk_buff *skb, struct genl_info *info);
int drbd_adm_get_status_all(struct sk_buff *skb, struct netlink_callback *cb);
int drbd_adm_dump_resources(struct sk_buff *skb, struct netlink_callback *cb);
int drbd_adm_dump_devices(struct sk_buff *skb, struct netlink_callback *cb);
int drbd_adm_dump_devices_done(struct netlink_callback *cb);
int drbd_adm_dump_connections(struct sk_buff *skb, struct netlink_callback *cb);
int drbd_adm_dump_connections_done(struct netlink_callback *cb);
int drbd_adm_dump_peer_devices(struct sk_buff *skb, struct netlink_callback *cb);
int drbd_adm_dump_peer_devices_done(struct netlink_callback *cb);
int drbd_adm_get_initial_state(struct sk_buff *skb, struct netlink_callback *cb);
#include <linux/drbd_genl_api.h>
#include "drbd_nla.h"
#include <linux/genl_magic_func.h>
static atomic_t drbd_genl_seq = …;
static atomic_t notify_genl_seq = …;
DEFINE_MUTEX(…) …;
static char *drbd_m_holder = …;
static void drbd_adm_send_reply(struct sk_buff *skb, struct genl_info *info)
{ … }
static int drbd_msg_put_info(struct sk_buff *skb, const char *info)
{ … }
__printf(2, 3)
static int drbd_msg_sprintf_info(struct sk_buff *skb, const char *fmt, ...)
{ … }
#define DRBD_ADM_NEED_MINOR …
#define DRBD_ADM_NEED_RESOURCE …
#define DRBD_ADM_NEED_CONNECTION …
static int drbd_adm_prepare(struct drbd_config_context *adm_ctx,
struct sk_buff *skb, struct genl_info *info, unsigned flags)
{ … }
static int drbd_adm_finish(struct drbd_config_context *adm_ctx,
struct genl_info *info, int retcode)
{ … }
static void setup_khelper_env(struct drbd_connection *connection, char **envp)
{ … }
int drbd_khelper(struct drbd_device *device, char *cmd)
{ … }
enum drbd_peer_state conn_khelper(struct drbd_connection *connection, char *cmd)
{ … }
static enum drbd_fencing_p highest_fencing_policy(struct drbd_connection *connection)
{ … }
static bool resource_is_supended(struct drbd_resource *resource)
{ … }
bool conn_try_outdate_peer(struct drbd_connection *connection)
{ … }
static int _try_outdate_peer_async(void *data)
{ … }
void conn_try_outdate_peer_async(struct drbd_connection *connection)
{ … }
enum drbd_state_rv
drbd_set_role(struct drbd_device *const device, enum drbd_role new_role, int force)
{ … }
static const char *from_attrs_err_to_txt(int err)
{ … }
int drbd_adm_set_role(struct sk_buff *skb, struct genl_info *info)
{ … }
static void drbd_md_set_sector_offsets(struct drbd_device *device,
struct drbd_backing_dev *bdev)
{ … }
char *ppsize(char *buf, unsigned long long size)
{ … }
void drbd_suspend_io(struct drbd_device *device)
{ … }
void drbd_resume_io(struct drbd_device *device)
{ … }
enum determine_dev_size
drbd_determine_dev_size(struct drbd_device *device, enum dds_flags flags, struct resize_parms *rs) __must_hold(local)
{ … }
sector_t
drbd_new_dev_size(struct drbd_device *device, struct drbd_backing_dev *bdev,
sector_t u_size, int assume_peer_has_space)
{ … }
static int drbd_check_al_size(struct drbd_device *device, struct disk_conf *dc)
{ … }
static unsigned int drbd_max_peer_bio_size(struct drbd_device *device)
{ … }
static unsigned int drbd_max_discard_sectors(struct drbd_connection *connection)
{ … }
static bool drbd_discard_supported(struct drbd_connection *connection,
struct drbd_backing_dev *bdev)
{ … }
static unsigned int drbd_backing_dev_max_segments(struct drbd_device *device)
{ … }
void drbd_reconsider_queue_parameters(struct drbd_device *device,
struct drbd_backing_dev *bdev, struct o_qlim *o)
{ … }
static void conn_reconfig_start(struct drbd_connection *connection)
{ … }
static void conn_reconfig_done(struct drbd_connection *connection)
{ … }
static void drbd_suspend_al(struct drbd_device *device)
{ … }
static bool should_set_defaults(struct genl_info *info)
{ … }
static unsigned int drbd_al_extents_max(struct drbd_backing_dev *bdev)
{ … }
static bool write_ordering_changed(struct disk_conf *a, struct disk_conf *b)
{ … }
static void sanitize_disk_conf(struct drbd_device *device, struct disk_conf *disk_conf,
struct drbd_backing_dev *nbc)
{ … }
static int disk_opts_check_al_size(struct drbd_device *device, struct disk_conf *dc)
{ … }
int drbd_adm_disk_opts(struct sk_buff *skb, struct genl_info *info)
{ … }
static struct file *open_backing_dev(struct drbd_device *device,
const char *bdev_path, void *claim_ptr, bool do_bd_link)
{ … }
static int open_backing_devices(struct drbd_device *device,
struct disk_conf *new_disk_conf,
struct drbd_backing_dev *nbc)
{ … }
static void close_backing_dev(struct drbd_device *device,
struct file *bdev_file, bool do_bd_unlink)
{ … }
void drbd_backing_dev_free(struct drbd_device *device, struct drbd_backing_dev *ldev)
{ … }
int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
{ … }
static int adm_detach(struct drbd_device *device, int force)
{ … }
int drbd_adm_detach(struct sk_buff *skb, struct genl_info *info)
{ … }
static bool conn_resync_running(struct drbd_connection *connection)
{ … }
static bool conn_ov_running(struct drbd_connection *connection)
{ … }
static enum drbd_ret_code
_check_net_options(struct drbd_connection *connection, struct net_conf *old_net_conf, struct net_conf *new_net_conf)
{ … }
static enum drbd_ret_code
check_net_options(struct drbd_connection *connection, struct net_conf *new_net_conf)
{ … }
struct crypto { … };
static int
alloc_shash(struct crypto_shash **tfm, char *tfm_name, int err_alg)
{ … }
static enum drbd_ret_code
alloc_crypto(struct crypto *crypto, struct net_conf *new_net_conf)
{ … }
static void free_crypto(struct crypto *crypto)
{ … }
int drbd_adm_net_opts(struct sk_buff *skb, struct genl_info *info)
{ … }
static void connection_to_info(struct connection_info *info,
struct drbd_connection *connection)
{ … }
static void peer_device_to_info(struct peer_device_info *info,
struct drbd_peer_device *peer_device)
{ … }
int drbd_adm_connect(struct sk_buff *skb, struct genl_info *info)
{ … }
static enum drbd_state_rv conn_try_disconnect(struct drbd_connection *connection, bool force)
{ … }
int drbd_adm_disconnect(struct sk_buff *skb, struct genl_info *info)
{ … }
void resync_after_online_grow(struct drbd_device *device)
{ … }
int drbd_adm_resize(struct sk_buff *skb, struct genl_info *info)
{ … }
int drbd_adm_resource_opts(struct sk_buff *skb, struct genl_info *info)
{ … }
int drbd_adm_invalidate(struct sk_buff *skb, struct genl_info *info)
{ … }
static int drbd_adm_simple_request_state(struct sk_buff *skb, struct genl_info *info,
union drbd_state mask, union drbd_state val)
{ … }
static int drbd_bmio_set_susp_al(struct drbd_device *device,
struct drbd_peer_device *peer_device) __must_hold(local)
{ … }
int drbd_adm_invalidate_peer(struct sk_buff *skb, struct genl_info *info)
{ … }
int drbd_adm_pause_sync(struct sk_buff *skb, struct genl_info *info)
{ … }
int drbd_adm_resume_sync(struct sk_buff *skb, struct genl_info *info)
{ … }
int drbd_adm_suspend_io(struct sk_buff *skb, struct genl_info *info)
{ … }
int drbd_adm_resume_io(struct sk_buff *skb, struct genl_info *info)
{ … }
int drbd_adm_outdate(struct sk_buff *skb, struct genl_info *info)
{ … }
static int nla_put_drbd_cfg_context(struct sk_buff *skb,
struct drbd_resource *resource,
struct drbd_connection *connection,
struct drbd_device *device)
{ … }
static struct nlattr *find_cfg_context_attr(const struct nlmsghdr *nlh, int attr)
{ … }
static void resource_to_info(struct resource_info *, struct drbd_resource *);
int drbd_adm_dump_resources(struct sk_buff *skb, struct netlink_callback *cb)
{ … }
static void device_to_statistics(struct device_statistics *s,
struct drbd_device *device)
{ … }
static int put_resource_in_arg0(struct netlink_callback *cb, int holder_nr)
{ … }
int drbd_adm_dump_devices_done(struct netlink_callback *cb) { … }
static void device_to_info(struct device_info *, struct drbd_device *);
int drbd_adm_dump_devices(struct sk_buff *skb, struct netlink_callback *cb)
{ … }
int drbd_adm_dump_connections_done(struct netlink_callback *cb)
{ … }
enum { … };
int drbd_adm_dump_connections(struct sk_buff *skb, struct netlink_callback *cb)
{ … }
enum mdf_peer_flag { … };
static void peer_device_to_statistics(struct peer_device_statistics *s,
struct drbd_peer_device *peer_device)
{ … }
int drbd_adm_dump_peer_devices_done(struct netlink_callback *cb)
{ … }
int drbd_adm_dump_peer_devices(struct sk_buff *skb, struct netlink_callback *cb)
{ … }
static struct drbd_connection *the_only_connection(struct drbd_resource *resource)
{ … }
static int nla_put_status_info(struct sk_buff *skb, struct drbd_device *device,
const struct sib_info *sib)
{ … }
int drbd_adm_get_status(struct sk_buff *skb, struct genl_info *info)
{ … }
static int get_one_status(struct sk_buff *skb, struct netlink_callback *cb)
{ … }
int drbd_adm_get_status_all(struct sk_buff *skb, struct netlink_callback *cb)
{ … }
int drbd_adm_get_timeout_type(struct sk_buff *skb, struct genl_info *info)
{ … }
int drbd_adm_start_ov(struct sk_buff *skb, struct genl_info *info)
{ … }
int drbd_adm_new_c_uuid(struct sk_buff *skb, struct genl_info *info)
{ … }
static enum drbd_ret_code
drbd_check_resource_name(struct drbd_config_context *adm_ctx)
{ … }
static void resource_to_info(struct resource_info *info,
struct drbd_resource *resource)
{ … }
int drbd_adm_new_resource(struct sk_buff *skb, struct genl_info *info)
{ … }
static void device_to_info(struct device_info *info,
struct drbd_device *device)
{ … }
int drbd_adm_new_minor(struct sk_buff *skb, struct genl_info *info)
{ … }
static enum drbd_ret_code adm_del_minor(struct drbd_device *device)
{ … }
int drbd_adm_del_minor(struct sk_buff *skb, struct genl_info *info)
{ … }
static int adm_del_resource(struct drbd_resource *resource)
{ … }
int drbd_adm_down(struct sk_buff *skb, struct genl_info *info)
{ … }
int drbd_adm_del_resource(struct sk_buff *skb, struct genl_info *info)
{ … }
void drbd_bcast_event(struct drbd_device *device, const struct sib_info *sib)
{ … }
static int nla_put_notification_header(struct sk_buff *msg,
enum drbd_notification_type type)
{ … }
int notify_resource_state(struct sk_buff *skb,
unsigned int seq,
struct drbd_resource *resource,
struct resource_info *resource_info,
enum drbd_notification_type type)
{ … }
int notify_device_state(struct sk_buff *skb,
unsigned int seq,
struct drbd_device *device,
struct device_info *device_info,
enum drbd_notification_type type)
{ … }
int notify_connection_state(struct sk_buff *skb,
unsigned int seq,
struct drbd_connection *connection,
struct connection_info *connection_info,
enum drbd_notification_type type)
{ … }
int notify_peer_device_state(struct sk_buff *skb,
unsigned int seq,
struct drbd_peer_device *peer_device,
struct peer_device_info *peer_device_info,
enum drbd_notification_type type)
{ … }
void notify_helper(enum drbd_notification_type type,
struct drbd_device *device, struct drbd_connection *connection,
const char *name, int status)
{ … }
static int notify_initial_state_done(struct sk_buff *skb, unsigned int seq)
{ … }
static void free_state_changes(struct list_head *list)
{ … }
static unsigned int notifications_for_state_change(struct drbd_state_change *state_change)
{ … }
static int get_initial_state(struct sk_buff *skb, struct netlink_callback *cb)
{ … }
int drbd_adm_get_initial_state(struct sk_buff *skb, struct netlink_callback *cb)
{ … }