kobject - container_of 사용 예제

NAME
container_of - cast a member of a structure out to the containing structure 

SYNOPSIS
container_of  (ptr, type, member);
 
ARGUMENTS
ptr : the pointer to the member.
type : the type of the container struct this is embedded in.
member : the name of the member within the struct.

Example
struct my_object
{
         int my_name[128];
         int my_count;
         struct kobject kobj;
}

struct my_object* get_my_object_address( void *ptr )
{
         struct my_object *ptr_my;
         ptr_my = container_of( ptr, struct my_object, kobj );
         return ptr_my;
}

by 유꼬 | 2008/03/18 09:08 | Linux System | 트랙백 | 덧글(0)

트랙백 주소 : http://yucco.egloos.com/tb/1801833
☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]

:         :

:

비공개 덧글

<< 이전 페이지     다음 페이지 >>