skb_reserve(skb, DN_MAX_NSP_DATA_HEADER); 
skb_reserve(skb, 64 + DN_MAX_NSP_DATA_HEADER); 
static int dn_sendmsg(struct kiocb *iocb, struct socket *sock,	   struct msghdr *msg, size_t size){	struct sock *sk = sock->sk;	struct dn_scp *scp = DN_SK(sk);	size_t mss;	struct sk_buff_head *queue = &scp->data_xmit_queue;	int flags = msg->msg_flags;	int err = 0;	size_t sent = 0;	int addr_len = msg->msg_namelen;	struct sockaddr_dn *addr = (struct sockaddr_dn *)msg->msg_name;	struct sk_buff *skb = NULL;	struct dn_skb_cb *cb;	size_t len;	unsigned char fctype;	long timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT);	if (flags & ~(MSG_TRYHARD|MSG_OOB|MSG_DONTWAIT|MSG_EOR|MSG_NOSIGNAL|MSG_MORE|MSG_CMSG_COMPAT))		return -EOPNOTSUPP;	if (addr_len && (addr_len != sizeof(struct sockaddr_dn)))		return -EINVAL;	/*	 * The only difference between stream sockets and sequenced packet	 * sockets is that the stream sockets always behave as if MSG_EOR	 * has been set.	 */	if (sock->type == SOCK_STREAM) {		if (flags & MSG_EOR)			return -EINVAL;		flags |= MSG_EOR;	}	lock_sock(sk);	err = dn_check_state(sk, addr, addr_len, &timeo, flags);	if (err)		goto out_err;	if (sk->sk_shutdown & SEND_SHUTDOWN) {		err = -EPIPE;		goto out_err;	}	if ((flags & MSG_TRYHARD) && sk->sk_dst_cache)		dst_negative_advice(&sk->sk_dst_cache);	mss = scp->segsize_rem;	fctype = scp->services_rem & NSP_FC_MASK;	mss = dn_current_mss(sk, flags);	if (flags & MSG_OOB) {		queue = &scp->other_xmit_queue;		if (size > mss) {			err = -EMSGSIZE;			goto out;		}	}	scp->persist_fxn = dn_nsp_xmit_timeout;	while(sent < size) {		err = sock_error(sk);		if (err)			goto out;		if (signal_pending(current)) {			err = sock_intr_errno(timeo);			goto out;		}		/*		 * Calculate size that we wish to send.		 */		len = size - sent;		if (len > mss)			len = mss;		/*		 * Wait for queue size to go down below the window		 * size.		 */		if (dn_queue_too_long(scp, queue, flags)) {			if (flags & MSG_DONTWAIT) {				err = -EWOULDBLOCK;				goto out;			}			SOCK_SLEEP_PRE(sk)			if (dn_queue_too_long(scp, queue, flags))				schedule();			SOCK_SLEEP_POST(sk)			continue;		}		/*		 * Get a suitably sized skb.		 */		skb = dn_alloc_send_skb(sk, &len, flags & MSG_DONTWAIT, timeo, &err);		if (err)			break;		if (!skb)			continue;		cb = DN_SKB_CB(skb);		skb_reserve(skb, DN_MAX_NSP_DATA_HEADER);		if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) {			err = -EFAULT;			goto out;		}		if (flags & MSG_OOB) {			cb->nsp_flags = 0x30;			if (fctype != NSP_FC_NONE)				scp->flowrem_oth--;		} else {			cb->nsp_flags = 0x00;			if (scp->seg_total == 0)				cb->nsp_flags |= 0x20;			scp->seg_total += len;					if (((sent + len) == size) && (flags & MSG_EOR)) {				cb->nsp_flags |= 0x40;				scp->seg_total = 0;				if (fctype == NSP_FC_SCMC)					scp->flowrem_dat--;			}			if (fctype == NSP_FC_SRC)				scp->flowrem_dat--;		}		sent += len;		dn_nsp_queue_xmit(sk, skb, sk->sk_allocation, flags & MSG_OOB);		skb = NULL;		scp->persist = dn_nsp_persist(sk);	}out:	if (skb)		kfree_skb(skb);	release_sock(sk);	return sent ? sent : err;out_err:	err = sk_stream_error(sk, flags, err);	release_sock(sk);	return err;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/12a49ffd842bf5b07c62eaabf178703ce4fe09d7/af_decnet.c/buggy/net/decnet/af_decnet.c