Lines Matching full:cn
26 struct cn_msg *cn; /* advances as cn_msg is appeneded */ member
40 /* pointers within w1_cb_block and cn data */
57 if (!block->cn) in w1_reply_len()
59 return (u8 *)block->cn - (u8 *)block->first_cn + block->cn->len; in w1_reply_len()
88 block->cn = NULL; in w1_reply_make_space()
97 if (!(block->request_cn.flags & W1_CN_BUNDLE) && block->cn) in w1_netlink_check_send()
104 * @ack: determines if cn can be reused
106 * block->cn will be setup with the correct ack, advancing if needed
107 * block->cn->len does not include space for block->msg
112 if (block->cn && block->cn->ack == ack) { in w1_netlink_setup_msg()
113 block->msg = (struct w1_netlink_msg *)(block->cn->data + block->cn->len); in w1_netlink_setup_msg()
116 if (block->cn) in w1_netlink_setup_msg()
117 block->cn = (struct cn_msg *)(block->cn->data + in w1_netlink_setup_msg()
118 block->cn->len); in w1_netlink_setup_msg()
120 block->cn = block->first_cn; in w1_netlink_setup_msg()
122 memcpy(block->cn, &block->request_cn, sizeof(*block->cn)); in w1_netlink_setup_msg()
123 block->cn->len = 0; in w1_netlink_setup_msg()
124 block->cn->ack = ack; in w1_netlink_setup_msg()
125 block->msg = (struct w1_netlink_msg *)block->cn->data; in w1_netlink_setup_msg()
146 block->cn->len += sizeof(*block->msg); in w1_netlink_queue_cmd()
153 block->cn->len += space; in w1_netlink_queue_cmd()
169 block->cn->len += sizeof(*req_msg); in w1_netlink_queue_status()
175 block->cn->len += sizeof(*cmd); in w1_netlink_queue_status()
184 * @cn: original cn_msg
189 * Use when a block isn't available to queue the message to and cn, msg
192 static void w1_netlink_send_error(struct cn_msg *cn, struct w1_netlink_msg *msg, in w1_netlink_send_error() argument
196 struct cn_msg cn; in w1_netlink_send_error() member
199 memcpy(&packet.cn, cn, sizeof(packet.cn)); in w1_netlink_send_error()
201 packet.cn.len = sizeof(packet.msg); in w1_netlink_send_error()
204 cn_netlink_send(&packet.cn, portid, 0, GFP_KERNEL); in w1_netlink_send_error()
217 struct cn_msg cn; in w1_netlink_send() member
222 packet.cn.id.idx = CN_W1_IDX; in w1_netlink_send()
223 packet.cn.id.val = CN_W1_VAL; in w1_netlink_send()
225 packet.cn.seq = dev->seq++; in w1_netlink_send()
226 packet.cn.len = sizeof(*msg); in w1_netlink_send()
231 cn_netlink_send(&packet.cn, 0, 0, GFP_KERNEL); in w1_netlink_send()
251 block->cn->len += sizeof(*data); in w1_send_slave()
400 struct cn_msg *cn; in w1_process_command_root() local
404 cn = kmalloc(PAGE_SIZE, GFP_KERNEL); in w1_process_command_root()
405 if (!cn) in w1_process_command_root()
408 cn->id.idx = CN_W1_IDX; in w1_process_command_root()
409 cn->id.val = CN_W1_VAL; in w1_process_command_root()
411 cn->seq = req_cn->seq; in w1_process_command_root()
412 cn->ack = req_cn->seq + 1; in w1_process_command_root()
413 cn->len = sizeof(struct w1_netlink_msg); in w1_process_command_root()
414 msg = (struct w1_netlink_msg *)cn->data; in w1_process_command_root()
423 if (cn->len + sizeof(*id) > PAGE_SIZE - sizeof(struct cn_msg)) { in w1_process_command_root()
424 cn_netlink_send(cn, portid, 0, GFP_KERNEL); in w1_process_command_root()
425 cn->len = sizeof(struct w1_netlink_msg); in w1_process_command_root()
432 cn->len += sizeof(*id); in w1_process_command_root()
435 cn_netlink_send(cn, portid, 0, GFP_KERNEL); in w1_process_command_root()
438 kfree(cn); in w1_process_command_root()
535 static void w1_cn_callback(struct cn_msg *cn, struct netlink_skb_parms *nsp) in w1_cn_callback() argument
537 struct w1_netlink_msg *msg = (struct w1_netlink_msg *)(cn + 1); in w1_cn_callback()
552 if (cn->flags & ~(W1_CN_BUNDLE)) { in w1_cn_callback()
553 w1_netlink_send_error(cn, msg, nsp->portid, -EINVAL); in w1_cn_callback()
560 msg_len = cn->len; in w1_cn_callback()
579 msg = (struct w1_netlink_msg *)(cn + 1); in w1_cn_callback()
582 int reply_size = sizeof(*cn) + cn->len + slave_len; in w1_cn_callback()
583 if (cn->flags & W1_CN_BUNDLE) { in w1_cn_callback()
595 * cn->len doesn't include itself which is part of the block in w1_cn_callback()
598 sizeof(struct w1_cb_block) + sizeof(*cn) + cn->len + in w1_cn_callback()
609 w1_netlink_send_error(cn, msg, nsp->portid, -ENOMEM); in w1_cn_callback()
614 block->request_cn = *cn; in w1_cn_callback()
615 memcpy(block->request_cn.data, cn->data, cn->len); in w1_cn_callback()
616 node = (struct w1_cb_node *)(block->request_cn.data + cn->len); in w1_cn_callback()
632 msg_len = cn->len; in w1_cn_callback()
645 err = w1_process_command_root(cn, nsp->portid); in w1_cn_callback()
665 pr_notice("%s: cn: %x.%x, wrong type: %u, len: %u.\n", in w1_cn_callback()
666 __func__, cn->id.idx, cn->id.val, in w1_cn_callback()
683 (size_t)((u8 *)msg - (u8 *)cn)); in w1_cn_callback()
699 w1_netlink_send_error(cn, msg, nsp->portid, err); in w1_cn_callback()
728 void w1_netlink_send(struct w1_master *dev, struct w1_netlink_msg *cn) in w1_netlink_send() argument