Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Rewrite kernfs and procfs.



Hello!
I desire become a NetBSD developer and develop this project.
Sorry to disturb, maybe I need anything else.

Also little patch, that removes unusable hack(any more, see below) from kernfs 
and
returns its work.

kernfs can't works from this commit(Wed Feb 13 14:03:48 2013 UTC):

Make the spec_node table implementation private to spec_vnops.c.
To retrieve a spec_node, two new lookup functions (by device or by mount)
are implemented.  Both return a referenced vnode, for an opened block device
the opened vnode is returned so further diagnostic checks "vp == ... sd_bdevvp"
will not fire.  Otherwise any vnode matching the criteria gets returned.
No objections on tech-kern.

 kernfs_subr.c  |   31 +++++--------------------------
 kernfs_vnops.c |   21 ++++++++-------------
 2 files changed, 13 insertions(+), 39 deletions(-)

Ilia.



Index: miscfs/kernfs/kernfs_subr.c
===================================================================
RCS file: /cvsil/nbcur/src/sys/miscfs/kernfs/kernfs_subr.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 kernfs_subr.c
--- miscfs/kernfs/kernfs_subr.c 4 Mar 2014 18:16:05 -0000       1.1.1.1
+++ miscfs/kernfs/kernfs_subr.c 8 Apr 2014 16:23:43 -0000
@@ -88,6 +88,7 @@ __KERNEL_RCSID(0, "$NetBSD: kernfs_subr.
 #include <sys/mount.h>
 
 #include <miscfs/kernfs/kernfs.h>
+#include <miscfs/specfs/specdev.h>
 
 void kernfs_hashins(struct kernfs_node *);
 void kernfs_hashrem(struct kernfs_node *);
@@ -147,32 +148,6 @@ kernfs_allocvp(struct mount *mp, struct 
                return (0);
        }
 
-       if (kfs_type == KFSdevice) {
-                       /* /kern/rootdev = look for device and obey */
-                       /* /kern/rrootdev = look for device and obey */
-               dev_t *dp;
-               struct vnode *fvp;
-
-#ifdef DIAGNOSTIC
-               if (!kt)
-                       panic("kernfs: kt == NULL for KFSdevice");
-#endif
-               dp = kt->kt_data;
-       loop:
-               if (*dp == NODEV || !vfinddev(*dp, kt->kt_vtype, &fvp)) {
-                       mutex_exit(&kfs_hashlock);
-                       return (ENOENT);
-               }
-               vp = fvp;
-               if (vn_lock(fvp, LK_EXCLUSIVE)) {
-                       vrele(fvp);
-                       goto loop;
-               }
-               *vpp = vp;
-               mutex_exit(&kfs_hashlock);
-               return (0);
-       }
-
        error = getnewvnode(VT_KERNFS, mp, kernfs_vnodeop_p, NULL, &vp);
        if (error) {
                *vpp = NULL;
@@ -220,6 +195,10 @@ again:
        if (kfs_type == KFSkern)
                vp->v_vflag = VV_ROOT;
 
+       if (kfs_type == KFSdevice) {
+               spec_node_init(vp, *(dev_t *)kt->kt_data);
+       }
+
        kernfs_hashins(kfs);
        uvm_vnp_setsize(vp, 0);
        mutex_exit(&kfs_hashlock);
Index: miscfs/kernfs/kernfs_vnops.c
===================================================================
RCS file: /cvsil/nbcur/src/sys/miscfs/kernfs/kernfs_vnops.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 kernfs_vnops.c
--- miscfs/kernfs/kernfs_vnops.c        4 Mar 2014 18:16:05 -0000       1.1.1.1
+++ miscfs/kernfs/kernfs_vnops.c        8 Apr 2014 16:23:43 -0000
@@ -59,6 +59,7 @@ __KERNEL_RCSID(0, "$NetBSD: kernfs_vnops
 
 #include <miscfs/genfs/genfs.h>
 #include <miscfs/kernfs/kernfs.h>
+#include <miscfs/specfs/specdev.h>
 
 #include <uvm/uvm_extern.h>
 
@@ -653,6 +654,11 @@ kernfs_getattr(void *v)
                vap->va_bytes = vap->va_size = DEV_BSIZE;
                break;
 
+       case KFSdevice:
+               vap->va_nlink = 1;
+               vap->va_rdev = ap->a_vp->v_rdev;
+               break;
+
        case KFSroot:
                vap->va_nlink = 1;
                vap->va_bytes = vap->va_size = DEV_BSIZE;
@@ -670,7 +676,6 @@ kernfs_getattr(void *v)
        case KFSstring:
        case KFShostname:
        case KFSavenrun:
-       case KFSdevice:
        case KFSmsgbuf:
                vap->va_nlink = 1;
                total = 0;
@@ -832,18 +837,8 @@ kernfs_setdirentfileno_kt(struct dirent 
        if ((error = kernfs_allocvp(ap->a_vp->v_mount, &vp, kt->kt_tag, kt,
            value)) != 0)
                return error;
-       if (kt->kt_tag == KFSdevice) {
-               struct vattr va;
-
-               error = VOP_GETATTR(vp, &va, ap->a_cred);
-               if (error != 0) {
-                       return error;
-               }
-               d->d_fileno = va.va_fileid;
-       } else {
-               kfs = VTOKERN(vp);
-               d->d_fileno = kfs->kfs_fileno;
-       }
+       kfs = VTOKERN(vp);
+       d->d_fileno = kfs->kfs_fileno;
        vput(vp);
        return 0;
 }

$NetBSD: membership-app.txt,v 1.1 2012/12/16 17:31:59 tron Exp $

NetBSD Foundation Membership Application Form

This form should be filled out by the applicant, with help from his or
her sponsors.

After completing this form, please send it to the NetBSD Foundation
Executive Committee for Membership, at the e-mail address
<membership-exec%NetBSD.org@localhost> and CC: your sponsors.

When filling out this application, please provide information in all
of the fields (except those in section 5).  If in any free-form text
field you need more lines than are provided by the form, add
additional lines (with the correct prefix) as needed.

If English is not your native language, then please fill the form in
to the best of your ability and pass it to someone else for proofing
and correction of spelling and grammar, particularly sections 2 and 3.


Section 1 - Contact info
---------

This is the relevant contact information for the prospective developer.

1A: Ilia Zykov:
1B: netbsd%izyk.ru@localhost:
1C: izyk:


Section 2 - Proposed work area(s)
---------

This is a free form text field where your prospective work areas
are listed.  This field will be used as part of the posting to the
netbsd-announce%NetBSD.org@localhost mailing list.

2A: Rewrite kernfs and procfs
2A: http://wiki.netbsd.org/projects/project/kernfs-rewrite
2A:


Section 3 - Accomplishments and Qualifications
---------

This section contains free form text fields where you may list your
recent accomplishments or contributions to the NetBSD project.

Section 3A should include a summary of your qualifications.

3A: Enhance ptyfs to handle multiple instances
3A:
3A:

Section 3B should include a small but detailed set of examples of your
technical contributions and qualifications.  This will be used by the
Membership committee and by other members of the Foundation when
evaluating your membership application.  Include URLs or other
citations for examples, as appropriate.

3B: Enhance ptyfs to handle multiple instances
3B: http://wiki.netbsd.org/projects/project/ptyfs_multiple_mounts
3B:


Section 4 - Sponsors
---------

In this section, please list the e-mail addresses of the NetBSD
Foundation member or members who are sponsoring your application, one
per line.  (Add more lines if necessary.)

4A: christos%zoulas.com@localhost


Section 5 - Paper trail
---------

Please leave this section blank; it will be filled out when tracking
your membership application.

5A: Received by Membership committee:
5B: Sent for member comments:
5C: Decision (ACCEPT or REJECT):
5D: Decision published:
5E: Membership agreement sent:
5F: Membership agreement received:
5G: Accounts created:
5H: WWW processed:
5I: Announcement processed:



Home | Main Index | Thread Index | Old Index