2008년 03월 18일
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)





☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]