# mount -t ntfs-3g
머.. 이런식으로 실행하면 자동으로 mount.ntfs-3g 라는 파일을 찾아서 실행을 한다.
처음에는 오 졸라 신기해!!! 하면서 뻘짓으로 ..
make 과정중에 나온 intall-exec-hook 인줄 알고 파고 들었다가 웬걸 ㄱ-
아무튼 install-exec-hook은 설치후 trigger 식으로 실행해주는 루틴을 의미할 뿐,
execution hook 이랑은 연관이 없다. (젠장 된장 미네랄!)
[링크 :
http://wiki.kldp.org/wiki.php/DocbookSgml/Autotools-KLDP]
아무튼, linux kernel utils 를 검색해서 mount.c 를 열어보니 busybox와는 다른 확연한 차이가 있었다.
일단 exec() 패밀리와 fork()를 사용하는 루틴의 존재유무
util-linux-2.12r/mount/mount.c
static int
check_special_mountprog(const char *spec, const char *node, const char *type,
int flags, char *extra_opts, int *status) {
char mountprog[120];
struct stat statbuf;
int res;
if (!external_allowed)
return 0;
if (type && strlen(type) < 100) {
sprintf(mountprog, "/sbin/mount.%s", type);
if (stat(mountprog, &statbuf) == 0) {
res = fork();
if (res == 0) {
const char *oo, *mountargs[10];
int i = 0;
setuid(getuid());
setgid(getgid());
oo = fix_opts_string (flags, extra_opts, NULL);
mountargs[i++] = mountprog;
mountargs[i++] = spec;
mountargs[i++] = node;
if (nomtab)
mountargs[i++] = "-n";
if (verbose)
mountargs[i++] = "-v";
if (oo && *oo) {
mountargs[i++] = "-o";
mountargs[i++] = oo;
}
mountargs[i] = NULL;
execv(mountprog, (char **) mountargs);
exit(1); /* exec failed */
} else if (res != -1) {
int st;
wait(&st);
*status = (WIFEXITED(st) ? WEXITSTATUS(st) : EX_SYSERR);
return 1;
} else {
int errsv = errno;
error(_("mount: cannot fork: %s"), strerror(errsv));
}
}
}
return 0;
}
위에 소스에서 보면
sprintf(mountprog, "/sbin/mount.%s", type);
res = fork();
execv(mountprog, (char **) mountargs);
mount -t ntfs 는 mount.ntfs 로
mount -t cifs 는 mount.cifs 로
-t type 으로 받은 인자를 이용하여 실행을 넘겨준다.
결론 : busybox에서는 mount 소스가 많이 간략화 되어있으므로
표준 mount 파일에서 지원하는 mount.type 실행치환 기능을 지원하지 않는다.
[링크 :
ftp://ftp.kernel.org/pub/linux/utils/util-linux/] 리눅스용 mount.c
[링크 :
http://www.koders.com/c/fid840A8124E3B838F1EC7B690C35A7A6F9BF10277B.aspx] busybox용 mount.c