Date: Tue, 30 May 2000 16:20:53 -0400 From: "Yevmenkin, Maksim N, CSCIO" <myevmenkin@att.com> To: "'Zhihui Zhang'" <zzhang@cs.binghamton.edu> Cc: "'freebsd-hackers@freebsd.org'" <freebsd-hackers@FreeBSD.ORG>, "'freebsd-current@freebsd.org'" <freebsd-current@FreeBSD.ORG> Subject: RE: stupid FS questions Message-ID: <E598F159668DD311B9C700902799EAF447340F@njb140po01.ems.att.com>
next in thread | raw e-mail | index | archive | help
i know that :) i guess my questions were 1) why the same piece of code duplicated in all ``mount_xxx'' utilities? 2) if we are loading fs kernel module from ``mount_xxx'' why we have to do it again in kernel? if i'm not missing anything, by the time we reach ``mount'' function, fs module will be in the memory and this code will never be executed. thanks, emax > I believe that it is used to dynamic load filesystem modules. > Please read > the following pages to understand what is a kernel module: > > http://thc.inferno.tusculum.edu/files/thc/bsdkern.html > > > i've been looking at ``mount_xxx'' code and have noticed > "strange" thing. > > all ``mount_xxx'' utilities have common part of code, like > > > > error = getvfsbyname("xxx", &vfc); > > if (error && vfsisloadable("xxx")) { > > if (vfsload("xxx")) > > err(EX_OSERR, "vfsload(xxx)"); > > endvfsent(); /* flush cache */ > > error = getvfsbyname("xxx", &vfc); > > } > > if (error) > > errx(1, "xxx filesystem is not available"); > > > > if (mount(vfc.vfc_name, dir, mntflags, &args) < 0) > > err(1, NULL); > > > > 1) what is the reason for this? why can't move this code to > ``mount''? > > 2) what is the purpose of the following code in > > ``/sys/kern/vfs_syscalls.c''? > > > > ... > > for (vfsp = vfsconf; vfsp; vfsp = vfsp->vfc_next) > > if (!strcmp(vfsp->vfc_name, fstypename)) > > break; > > if (vfsp == NULL) { > > linker_file_t lf; > > > > /* Refuse to load modules if securelevel raised */ > > if (securelevel > 0) { > > vput(vp); > > return EPERM; > > } > > /* Only load modules for root (very important!) */ > > if ((error = suser(p)) != 0) { > > vput(vp); > > return error; > > } > > error = linker_load_file(fstypename, &lf); > > if (error || lf == NULL) { > > vput(vp); > > if (lf == NULL) > > error = ENODEV; > > return error; > > } > > ... > > > > from my understanding this is done to load FS module. > > or did i miss someting? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E598F159668DD311B9C700902799EAF447340F>