'mount cifs'에 해당되는 글 2건

  1. 2009.10.22 mount() 이용하기 - mount cifs using mount() 2
  2. 2009.10.14 execl()로 mount 실행하기 - samba 2
Linux2009. 10. 22. 13:10
$ man 2 mount
       #include <sys/mount.h>

       int mount(const char *source, const char *target,
                 const char *filesystemtype, unsigned long mountflags,
                 const void *data);

       int umount(const char *target);

       int umount2(const char *target, int flags);

mount의 형태는 저따구인데.. 알흠답지 못하다...
아무튼 cifs를 마운트 하기 위해서는 "-o user=userid,password=userpw" 라는 옵션이 들어가는데
mount() 함수에서 사용하려니.... 오잉? 가변인자가 아니다 ㄱ-

몇번 실험해보니
"-o"를 제외하고 나머지 값을 data에 넘겨주면 된다.


$ mount -t cifs -o user=userid,password=userpw \\serverip\share /mnt/samba

mount("\\serverip\share", "/mnt/samba", "cifs", 0, "user=userid,password=userpw");
로 대치하여 사용하면 된다.

[링크 : http://linux.die.net/man/2/mount]

'Linux' 카테고리의 다른 글

tree  (0) 2009.11.16
설치하지 않은 rpm에 포함된 파일의 내용 보기  (0) 2009.11.04
execl()로 mount 실행하기 - samba  (2) 2009.10.14
gnash - GNU SWF player  (0) 2009.09.23
/ 는 root // 는?  (0) 2009.09.22
Posted by 구차니
Linux2009. 10. 14. 15:20
 CIFS: UNC Path does not begin with // or \\

execl("/bin/mount", "mount", "-t","cifs", resolv_urn, mount_point, "-o", option, NULL);

일단 resol_urn의 내용은
커맨드 라인상으로는

mount -t cifs //servernam/sharename 혹은
mount -t cifs "//servernam/share name" 혹은

으로 실행이 되는데, execl 에서

sprintf(resolv_urn, "\"//%s/%s\"", servername, sharename);
로 하니 위와 같은 에러가 난다.

곰곰히 생각해보니..

execl() 에서 인자로 넘기는 하나하나에는 공백이 들어가도 상관이 없다!!!
그게 무슨 말이냐면은, 공백까지 인식을 시키기 위해서 " "를 사용하는 것인데
execl() 자체에 들어가는 인자는 이러한 것을 인식한 것이기 때문에
굳이 \" \" 를 써가면서 문자열 내에 " "를 넣을 필요가 없는 것이다.

결론은
sprintf(resolv_urn, "//%s/%s", servername, sharename);
이런 식으로 urn을 입력해주면 상황끝!

'Linux' 카테고리의 다른 글

설치하지 않은 rpm에 포함된 파일의 내용 보기  (0) 2009.11.04
mount() 이용하기 - mount cifs using mount()  (2) 2009.10.22
gnash - GNU SWF player  (0) 2009.09.23
/ 는 root // 는?  (0) 2009.09.22
User Mode Linux - UML  (0) 2009.09.15
Posted by 구차니