tech-kern archive

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

Re: Enhance ptyfs to handle multiple instances.



Hello!

Minor corrections readdir and lookup for multi-mountpoint use.

 ptyfs_vnops.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Ilya.

Index: fs/ptyfs/ptyfs_vnops.c
===================================================================
RCS file: /cvsil/nbcur/src/sys/fs/ptyfs/ptyfs_vnops.c,v
retrieving revision 1.3
diff -u -p -r1.3 ptyfs_vnops.c
--- fs/ptyfs/ptyfs_vnops.c      24 Mar 2014 20:48:09 -0000      1.3
+++ fs/ptyfs/ptyfs_vnops.c      26 Mar 2014 08:49:47 -0000
@@ -616,7 +616,8 @@ ptyfs_lookup(void *v)
 
                pty = atoi(pname, cnp->cn_namelen);
 
-               if (pty < 0 || pty >= npty || pty_isfree(pty, 1))
+               if (pty < 0 || pty >= npty || pty_isfree(pty, 1) ||
+                   ptyfs_used_get(PTYFSptc, pty, dvp->v_mount, 0) == NULL)
                        break;
 
                error = ptyfs_allocvp(dvp->v_mount, vpp, PTYFSpts, pty,
@@ -711,7 +712,8 @@ ptyfs_readdir(void *v)
        }
        for (; uio->uio_resid >= UIO_MX && i < npty; i++) {
                /* check for used ptys */
-               if (ptyfs_used_get(PTYFSptc, i - 2, vp->v_mount, 0) == NULL)
+               if (pty_isfree(i - 2, 1) ||
+                   ptyfs_used_get(PTYFSptc, i - 2, vp->v_mount, 0) == NULL)
                        continue;
 
                dp->d_fileno = PTYFS_FILENO(i - 2, PTYFSpts);


Home | Main Index | Thread Index | Old Index