Why can struct sock convert to struct tcp_sock?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In funciton:

static int tcp_v4_init_sock(struct sock *sk)
{
	struct inet_connection_sock *icsk = inet_csk(sk);
	struct tcp_sock *tp = tcp_sk(sk);

        ...
}

Why can struct sock convert to struct tcp_sock?
Yes, 

static struct sock *sk_prot_alloc(struct proto *prot, gfp_t priority,
		int family)
{
	struct sock *sk;

		sk = kmalloc(prot->obj_size, priority);
        ...
}
Although inn the function above, prot->obj_size equals to sizeof(struct
tcp_sock), I still can not understand this type conversion.


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux