linux/drivers/w1/w1_netlink.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (c) 2003 Evgeniy Polyakov <[email protected]>
 */

#include <linux/slab.h>
#include <linux/skbuff.h>
#include <linux/netlink.h>
#include <linux/connector.h>

#include "w1_internal.h"
#include "w1_netlink.h"

#if defined(CONFIG_W1_CON) && (defined(CONFIG_CONNECTOR) || (defined(CONFIG_CONNECTOR_MODULE) && defined(CONFIG_W1_MODULE)))

/* Bundle together everything required to process a request in one memory
 * allocation.
 */
struct w1_cb_block {};
struct w1_cb_node {};

/**
 * w1_reply_len() - calculate current reply length, compare to maxlen
 * @block: block to calculate
 *
 * Calculates the current message length including possible multiple
 * cn_msg and data, excludes the first sizeof(struct cn_msg).  Direclty
 * compariable to maxlen and usable to send the message.
 */
static u16 w1_reply_len(struct w1_cb_block *block)
{}

static void w1_unref_block(struct w1_cb_block *block)
{}

/**
 * w1_reply_make_space() - send message if needed to make space
 * @block: block to make space on
 * @space: how many bytes requested
 *
 * Verify there is enough room left for the caller to add "space" bytes to the
 * message, if there isn't send the message and reset.
 */
static void w1_reply_make_space(struct w1_cb_block *block, u16 space)
{}

/* Early send when replies aren't bundled. */
static void w1_netlink_check_send(struct w1_cb_block *block)
{}

/**
 * w1_netlink_setup_msg() - prepare to write block->msg
 * @block: block to operate on
 * @ack: determines if cn can be reused
 *
 * block->cn will be setup with the correct ack, advancing if needed
 * block->cn->len does not include space for block->msg
 * block->msg advances but remains uninitialized
 */
static void w1_netlink_setup_msg(struct w1_cb_block *block, u32 ack)
{}

/* Append cmd to msg, include cmd->data as well.  This is because
 * any following data goes with the command and in the case of a read is
 * the results.
 */
static void w1_netlink_queue_cmd(struct w1_cb_block *block,
	struct w1_netlink_cmd *cmd)
{}

/* Append req_msg and req_cmd, no other commands and no data from req_cmd are
 * copied.
 */
static void w1_netlink_queue_status(struct w1_cb_block *block,
	struct w1_netlink_msg *req_msg, struct w1_netlink_cmd *req_cmd,
	int error)
{}

/**
 * w1_netlink_send_error() - sends the error message now
 * @cn: original cn_msg
 * @msg: original w1_netlink_msg
 * @portid: where to send it
 * @error: error status
 *
 * Use when a block isn't available to queue the message to and cn, msg
 * might not be contiguous.
 */
static void w1_netlink_send_error(struct cn_msg *cn, struct w1_netlink_msg *msg,
	int portid, int error)
{}

/**
 * w1_netlink_send() - sends w1 netlink notifications
 * @dev: w1_master the even is associated with or for
 * @msg: w1_netlink_msg message to be sent
 *
 * This are notifications generated from the kernel.
 */
void w1_netlink_send(struct w1_master *dev, struct w1_netlink_msg *msg)
{}

static void w1_send_slave(struct w1_master *dev, u64 rn)
{}

static void w1_found_send_slave(struct w1_master *dev, u64 rn)
{}

/* Get the current slave list, or search (with or without alarm) */
static int w1_get_slaves(struct w1_master *dev, struct w1_netlink_cmd *req_cmd)
{}

static int w1_process_command_io(struct w1_master *dev,
	struct w1_netlink_cmd *cmd)
{}

static int w1_process_command_addremove(struct w1_master *dev,
	struct w1_netlink_cmd *cmd)
{}

static int w1_process_command_master(struct w1_master *dev,
	struct w1_netlink_cmd *req_cmd)
{}

static int w1_process_command_slave(struct w1_slave *sl,
		struct w1_netlink_cmd *cmd)
{}

static int w1_process_command_root(struct cn_msg *req_cn, u32 portid)
{}

static void w1_process_cb(struct w1_master *dev, struct w1_async_cmd *async_cmd)
{}

static void w1_list_count_cmds(struct w1_netlink_msg *msg, int *cmd_count,
	u16 *slave_len)
{}

static void w1_cn_callback(struct cn_msg *cn, struct netlink_skb_parms *nsp)
{}

int w1_init_netlink(void)
{}

void w1_fini_netlink(void)
{}
#else
void w1_netlink_send(struct w1_master *dev, struct w1_netlink_msg *cn)
{
}

int w1_init_netlink(void)
{
	return 0;
}

void w1_fini_netlink(void)
{
}
#endif