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()
90 block->cn = NULL; in w1_reply_make_space()
99 if (!(block->request_cn.flags & W1_CN_BUNDLE) && block->cn) in w1_netlink_check_send()
106 * @ack: determines if cn can be reused
108 * block->cn will be setup with the correct ack, advancing if needed
109 * block->cn->len does not include space for block->msg
114 if (block->cn && block->cn->ack == ack) { in w1_netlink_setup_msg()
115 block->msg = (struct w1_netlink_msg *)(block->cn->data + block->cn->len); in w1_netlink_setup_msg()
118 if (block->cn) in w1_netlink_setup_msg()
119 block->cn = (struct cn_msg *)(block->cn->data + in w1_netlink_setup_msg()
120 block->cn->len); in w1_netlink_setup_msg()
122 block->cn = block->first_cn; in w1_netlink_setup_msg()
124 memcpy(block->cn, &block->request_cn, sizeof(*block->cn)); in w1_netlink_setup_msg()
125 block->cn->len = 0; in w1_netlink_setup_msg()
126 block->cn->ack = ack; in w1_netlink_setup_msg()
127 block->msg = (struct w1_netlink_msg *)block->cn->data; in w1_netlink_setup_msg()
148 block->cn->len += sizeof(*block->msg); in w1_netlink_queue_cmd()
155 block->cn->len += space; in w1_netlink_queue_cmd()
171 block->cn->len += sizeof(*req_msg); in w1_netlink_queue_status()
177 block->cn->len += sizeof(*cmd); in w1_netlink_queue_status()
186 * @cn: original cn_msg
191 * Use when a block isn't available to queue the message to and cn, msg
194 static void w1_netlink_send_error(struct cn_msg *cn, struct w1_netlink_msg *msg, in w1_netlink_send_error() argument
198 struct cn_msg cn; in w1_netlink_send_error() member
201 memcpy(&packet.cn, cn, sizeof(packet.cn)); in w1_netlink_send_error()
203 packet.cn.len = sizeof(packet.msg); in w1_netlink_send_error()
206 cn_netlink_send(&packet.cn, portid, 0, GFP_KERNEL); in w1_netlink_send_error()
219 struct cn_msg cn; in w1_netlink_send() member
224 packet.cn.id.idx = CN_W1_IDX; in w1_netlink_send()
225 packet.cn.id.val = CN_W1_VAL; in w1_netlink_send()
227 packet.cn.seq = dev->seq++; in w1_netlink_send()
228 packet.cn.len = sizeof(*msg); in w1_netlink_send()
233 cn_netlink_send(&packet.cn, 0, 0, GFP_KERNEL); in w1_netlink_send()
253 block->cn->len += sizeof(*data); in w1_send_slave()
402 struct cn_msg *cn; in w1_process_command_root() local
406 cn = kmalloc(PAGE_SIZE, GFP_KERNEL); in w1_process_command_root()
407 if (!cn) in w1_process_command_root()
410 cn->id.idx = CN_W1_IDX; in w1_process_command_root()
411 cn->id.val = CN_W1_VAL; in w1_process_command_root()
413 cn->seq = req_cn->seq; in w1_process_command_root()
414 cn->ack = req_cn->seq + 1; in w1_process_command_root()
415 cn->len = sizeof(struct w1_netlink_msg); in w1_process_command_root()
416 msg = (struct w1_netlink_msg *)cn->data; in w1_process_command_root()
425 if (cn->len + sizeof(*id) > PAGE_SIZE - sizeof(struct cn_msg)) { in w1_process_command_root()
426 cn_netlink_send(cn, portid, 0, GFP_KERNEL); in w1_process_command_root()
427 cn->len = sizeof(struct w1_netlink_msg); in w1_process_command_root()
434 cn->len += sizeof(*id); in w1_process_command_root()
437 cn_netlink_send(cn, portid, 0, GFP_KERNEL); in w1_process_command_root()
440 kfree(cn); in w1_process_command_root()
537 static void w1_cn_callback(struct cn_msg *cn, struct netlink_skb_parms *nsp) in w1_cn_callback() argument
539 struct w1_netlink_msg *msg = (struct w1_netlink_msg *)(cn + 1); in w1_cn_callback()
554 if (cn->flags & ~(W1_CN_BUNDLE)) { in w1_cn_callback()
555 w1_netlink_send_error(cn, msg, nsp->portid, -EINVAL); in w1_cn_callback()
562 msg_len = cn->len; in w1_cn_callback()
581 msg = (struct w1_netlink_msg *)(cn + 1); in w1_cn_callback()
584 int reply_size = sizeof(*cn) + cn->len + slave_len; in w1_cn_callback()
585 if (cn->flags & W1_CN_BUNDLE) { in w1_cn_callback()
597 * cn->len doesn't include itself which is part of the block in w1_cn_callback()
600 sizeof(struct w1_cb_block) + sizeof(*cn) + cn->len + in w1_cn_callback()
611 w1_netlink_send_error(cn, msg, nsp->portid, -ENOMEM); in w1_cn_callback()
616 block->request_cn = *cn; in w1_cn_callback()
617 memcpy(block->request_cn.data, cn->data, cn->len); in w1_cn_callback()
618 node = (struct w1_cb_node *)(block->request_cn.data + cn->len); in w1_cn_callback()
634 msg_len = cn->len; in w1_cn_callback()
647 err = w1_process_command_root(cn, nsp->portid); in w1_cn_callback()
667 pr_notice("%s: cn: %x.%x, wrong type: %u, len: %u.\n", in w1_cn_callback()
668 __func__, cn->id.idx, cn->id.val, in w1_cn_callback()
685 (size_t)((u8 *)msg - (u8 *)cn)); in w1_cn_callback()
701 w1_netlink_send_error(cn, msg, nsp->portid, err); in w1_cn_callback()
730 void w1_netlink_send(struct w1_master *dev, struct w1_netlink_msg *cn) in w1_netlink_send() argument