From owner-freebsd-current Tue May 30 13:13:52 2000 Delivered-To: freebsd-current@freebsd.org Received: from bingnet2.cc.binghamton.edu (bingnet2.cc.binghamton.edu [128.226.1.18]) by hub.freebsd.org (Postfix) with ESMTP id 876A537B5FF; Tue, 30 May 2000 13:13:37 -0700 (PDT) (envelope-from zzhang@cs.binghamton.edu) Received: from sol.cs.binghamton.edu (sol.cs.binghamton.edu [128.226.123.100]) by bingnet2.cc.binghamton.edu (8.9.3/8.9.3) with ESMTP id QAA01365; Tue, 30 May 2000 16:13:34 -0400 (EDT) Date: Tue, 30 May 2000 16:12:25 -0400 (EDT) From: Zhihui Zhang To: "Yevmenkin, Maksim N, CSCIO" Cc: "'freebsd-hackers@freebsd.org'" , "'freebsd-current@freebsd.org'" Subject: Re: stupid FS questions In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 -Zhihui On Tue, 30 May 2000, Yevmenkin, Maksim N, CSCIO wrote: > Hello All, > > 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? > > thanks, > emax > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-current" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message