커널 모듈에 매개변수 집어넣는 함수에 대하여 질문있습니다.

minsu9101의 이미지


//m.c
char ip[20];
 
module_param_array(ip, ? , ? , ?);

명령어 insmod m.ko ip=119.70.155.11
를 입력하여 매개변수를 전달하고 싶은데

module_param_array 라는 함수를 어떻게 사용하는지 모르겠습니다
구글링을 해봐도 잘 안나오고ㅜㅜ

모듈에서 char형 배열을 파라미터로 전달하는 방법이 뭔지 아시는분 있으신가요:??

pastime의 이미지

/**
 * module_param_string - a char array parameter
 * @name: the name of the parameter
 * @string: the string variable
 * @len: the maximum length of the string, incl. terminator
 * @perm: visibility in sysfs.
 *
 * This actually copies the string when it's set (unlike type charp).
 * @len is usually just sizeof(string).
 */
#define module_param_string(name, string, len, perm)			\
        ...

실제 사용 예는 다음과 같습니다.

/* from sample/kretprobe_example.c */
 
static char func_name[NAME_MAX] = "do_fork";
module_param_string(func, func_name, NAME_MAX, S_IRUGO);
MODULE_PARM_DESC(func, "Function to kretprobe; this module will report the"
			" function's execution time");
minsu9101의 이미지

감사합니다 ㅎㅎ