RE: stupid FS questions

2000-05-31 Thread Bruce Evans

On Tue, 30 May 2000, Garrett Wollman wrote:

 On Tue, 30 May 2000 16:20:53 -0400, "Yevmenkin, Maksim N, CSCIO" 
[EMAIL PROTECTED] said:
 
  i know that :) i guess my questions were
  1) why the same piece of code duplicated in all ``mount_xxx'' utilities?
 
 Because the original loadable module system held strongly to the
 religion that the kernel should never load anything of its own
 accord.  The designers of the current loadable module system made
 different design choices, but the some traces of its predecessor still
 remain.

Including defunct traces like all the duplicated code in the mount utilities
:-).

Relevant history:

RCS file: /home/ncvs/src/lib/libc/gen/getvfsent.c,v
Working file: getvfsent.c
head: 1.14

revision 1.13
date: 1998/11/03 15:02:29;  author: peter;  state: Exp;  lines: +10 -1
A feeble attempt at kld compatability.  The mount_* programs assume that
they cannot mount a filesystem that they cannot see in getvfsbyname().
Part 1 of this is a hack, make vfsisloadable() always return true - the
ultimate decider of whether it's loadable or not is kldload() or mount().
Part 2 of this is to have vfsload() call kldload(2) and return success if
it works.  This means that we will use a viable kld module in preference
to an LKM!
Ultimately, the thing to do is remove the hacks to do a vfsload in all the
^^ should have been more than a year ago
mount_* commands and let the kernel do it by itself in mount(2).


RCS file: /home/ncvs/src/sys/kern/vfs_syscalls.c,v
Working file: vfs_syscalls.c
head: 1.153
...

revision 1.110
date: 1998/11/03 14:29:09;  author: peter;  state: Exp;  lines: +32 -3
make mount(2) automatically kldload modules if the requested filesystem
isn't present.


This commit made the duplicated code redundant except for backwards
compatibility.

Bruce



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: stupid FS questions

2000-05-30 Thread Zhihui Zhang


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 [EMAIL PROTECTED]
 with "unsubscribe freebsd-current" in the body of the message
 



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



RE: stupid FS questions

2000-05-30 Thread Yevmenkin, Maksim N, CSCIO

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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



RE: stupid FS questions

2000-05-30 Thread Garrett Wollman

On Tue, 30 May 2000 16:20:53 -0400, "Yevmenkin, Maksim N, CSCIO" 
[EMAIL PROTECTED] said:

 i know that :) i guess my questions were
 1) why the same piece of code duplicated in all ``mount_xxx'' utilities?

Because the original loadable module system held strongly to the
religion that the kernel should never load anything of its own
accord.  The designers of the current loadable module system made
different design choices, but the some traces of its predecessor still
remain.

-GAWollman

--
Garrett A. Wollman   | O Siem / We are all family / O Siem / We're all the same
[EMAIL PROTECTED]  | O Siem / The fires of freedom 
Opinions not those of| Dance in the burning flame
MIT, LCS, CRS, or NSA| - Susan Aglukark and Chad Irschick


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: stupid FS questions

2000-05-30 Thread Brandon D. Valentine

On Tue, 30 May 2000, Zhihui Zhang wrote:

http://thc.inferno.tusculum.edu/files/thc/bsdkern.html

That stuff is excellent.  It belongs in doc/.  Any chances of it making
it there?

Brandon D. Valentine
-- 
"You should believe in death, taxes, Larry Ellison's loathing of Bill
Gates and Intel's inability to ship a working chipset."
 - Dr Spinola, The Register, 05/13/2000



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message