39c39
< * $Id: vfs_init.c,v 1.3 1994/08/02 07:43:22 davidg Exp $
---
> * $Id: vfs_init.c,v 1.4 1994/08/18 22:35:08 wollman Exp $
44a45
> #include <sys/kernel.h>
53a55,57
> #include <sys/proc.h>
> #include <vm/vm.h>
> #include <sys/sysctl.h>
64,65c68,76
< extern struct vnodeopv_desc *vfs_opv_descs[];
< /* a list of lists of vnodeops defns */
---
> struct vfsconf void_vfsconf;
>
> extern struct linker_set vfs_opv_descs_;
> #define vfs_opv_descs ((struct vnodeopv_desc **)vfs_opv_descs_.ls_items)
>
> extern struct linker_set vfs_set;
> struct vfsops *vfssw[MOUNT_MAXTYPE + 1];
> struct vfsconf *vfsconf[MOUNT_MAXTYPE + 1];
>
76c87
< typedef (*PFI)(); /* the standard Pointer to a Function returning an Int */
---
> typedef int (*PFI)(); /* the standard Pointer to a Function returning an Int */
106c117
< vfs_opv_init()
---
> vfs_opv_init(struct vnodeopv_desc **them)
116,117c127,128
< for (i=0; vfs_opv_descs[i]; i++) {
< opv_desc_vector_p = vfs_opv_descs[i]->opv_desc_vector_p;
---
> for (i=0; them[i]; i++) {
> opv_desc_vector_p = them[i]->opv_desc_vector_p;
131,132c142,143
< for (j=0; vfs_opv_descs[i]->opv_desc_ops[j].opve_op; j++) {
< opve_descp = &(vfs_opv_descs[i]->opv_desc_ops[j]);
---
> for (j=0; them[i]->opv_desc_ops[j].opve_op; j++) {
> opve_descp = &(them[i]->opv_desc_ops[j]);
171,172c182,183
< for (i = 0; vfs_opv_descs[i]; i++) {
< opv_desc_vector = *(vfs_opv_descs[i]->opv_desc_vector_p);
---
> for (i = 0; them[i]; i++) {
> opv_desc_vector = *(them[i]->opv_desc_vector_p);
225a237,238
> struct vfsconf **vfc;
> int i;
227a241,254
> * Initialize the VFS switch table
> */
> for(i = 0; i < MOUNT_MAXTYPE + 1; i++) {
> vfsconf[i] = &void_vfsconf;
> }
>
> vfc = (struct vfsconf **)vfs_set.ls_items;
> while(*vfc) {
> vfssw[(**vfc).vfc_index] = (**vfc).vfc_vfsops;
> vfsconf[(**vfc).vfc_index] = *vfc;
> vfc++;
> }
>
> /*
239c266
< vfs_opv_init(); /* finish the job */
---
> vfs_opv_init(vfs_opv_descs); /* finish the job */
249a277,328
>
> /*
> * kernel related system variables.
> */
> int
> fs_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
> int *name;
> u_int namelen;
> void *oldp;
> size_t *oldlenp;
> void *newp;
> size_t newlen;
> struct proc *p;
> {
> int i;
> int error;
> int buflen = *oldlenp;
> caddr_t where = newp, start = newp;
>
> switch (name[0]) {
> case FS_VFSCONF:
> if (namelen != 1) return ENOTDIR;
>
> if (oldp == NULL) {
> *oldlenp = (MOUNT_MAXTYPE+1) * sizeof(struct vfsconf);
> return 0;
> }
> if (newp) {
> return EINVAL;
> }
>
> for(i = 0; i < MOUNT_MAXTYPE + 1; i++) {
> if(buflen < sizeof *vfsconf[i]) {
> *oldlenp = where - start;
> return ENOMEM;
> }
>
> if(error = copyout(vfsconf[i], where,
> sizeof *vfsconf[i]))
> return error;
> where += sizeof *vfsconf[i];
> buflen -= sizeof *vfsconf[i];
> }
> *oldlenp = where - start;
> return 0;
>
> default:
> return (EOPNOTSUPP);
> }
> /* NOTREACHED */
> }
>
< * $Id: vfs_init.c,v 1.3 1994/08/02 07:43:22 davidg Exp $
---
> * $Id: vfs_init.c,v 1.4 1994/08/18 22:35:08 wollman Exp $
44a45
> #include <sys/kernel.h>
53a55,57
> #include <sys/proc.h>
> #include <vm/vm.h>
> #include <sys/sysctl.h>
64,65c68,76
< extern struct vnodeopv_desc *vfs_opv_descs[];
< /* a list of lists of vnodeops defns */
---
> struct vfsconf void_vfsconf;
>
> extern struct linker_set vfs_opv_descs_;
> #define vfs_opv_descs ((struct vnodeopv_desc **)vfs_opv_descs_.ls_items)
>
> extern struct linker_set vfs_set;
> struct vfsops *vfssw[MOUNT_MAXTYPE + 1];
> struct vfsconf *vfsconf[MOUNT_MAXTYPE + 1];
>
76c87
< typedef (*PFI)(); /* the standard Pointer to a Function returning an Int */
---
> typedef int (*PFI)(); /* the standard Pointer to a Function returning an Int */
106c117
< vfs_opv_init()
---
> vfs_opv_init(struct vnodeopv_desc **them)
116,117c127,128
< for (i=0; vfs_opv_descs[i]; i++) {
< opv_desc_vector_p = vfs_opv_descs[i]->opv_desc_vector_p;
---
> for (i=0; them[i]; i++) {
> opv_desc_vector_p = them[i]->opv_desc_vector_p;
131,132c142,143
< for (j=0; vfs_opv_descs[i]->opv_desc_ops[j].opve_op; j++) {
< opve_descp = &(vfs_opv_descs[i]->opv_desc_ops[j]);
---
> for (j=0; them[i]->opv_desc_ops[j].opve_op; j++) {
> opve_descp = &(them[i]->opv_desc_ops[j]);
171,172c182,183
< for (i = 0; vfs_opv_descs[i]; i++) {
< opv_desc_vector = *(vfs_opv_descs[i]->opv_desc_vector_p);
---
> for (i = 0; them[i]; i++) {
> opv_desc_vector = *(them[i]->opv_desc_vector_p);
225a237,238
> struct vfsconf **vfc;
> int i;
227a241,254
> * Initialize the VFS switch table
> */
> for(i = 0; i < MOUNT_MAXTYPE + 1; i++) {
> vfsconf[i] = &void_vfsconf;
> }
>
> vfc = (struct vfsconf **)vfs_set.ls_items;
> while(*vfc) {
> vfssw[(**vfc).vfc_index] = (**vfc).vfc_vfsops;
> vfsconf[(**vfc).vfc_index] = *vfc;
> vfc++;
> }
>
> /*
239c266
< vfs_opv_init(); /* finish the job */
---
> vfs_opv_init(vfs_opv_descs); /* finish the job */
249a277,328
>
> /*
> * kernel related system variables.
> */
> int
> fs_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
> int *name;
> u_int namelen;
> void *oldp;
> size_t *oldlenp;
> void *newp;
> size_t newlen;
> struct proc *p;
> {
> int i;
> int error;
> int buflen = *oldlenp;
> caddr_t where = newp, start = newp;
>
> switch (name[0]) {
> case FS_VFSCONF:
> if (namelen != 1) return ENOTDIR;
>
> if (oldp == NULL) {
> *oldlenp = (MOUNT_MAXTYPE+1) * sizeof(struct vfsconf);
> return 0;
> }
> if (newp) {
> return EINVAL;
> }
>
> for(i = 0; i < MOUNT_MAXTYPE + 1; i++) {
> if(buflen < sizeof *vfsconf[i]) {
> *oldlenp = where - start;
> return ENOMEM;
> }
>
> if(error = copyout(vfsconf[i], where,
> sizeof *vfsconf[i]))
> return error;
> where += sizeof *vfsconf[i];
> buflen -= sizeof *vfsconf[i];
> }
> *oldlenp = where - start;
> return 0;
>
> default:
> return (EOPNOTSUPP);
> }
> /* NOTREACHED */
> }
>