[BACK]Return to nfs_srvsubs.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / nfs

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/nfs/nfs_srvsubs.c between version 1.7 and 1.8

version 1.7, 2010/11/19 06:44:46 version 1.8, 2010/11/30 10:30:03
Line 120  nfs_namei(struct nameidata *ndp, nfsrvfh
Line 120  nfs_namei(struct nameidata *ndp, nfsrvfh
 {  {
         int i, rem;          int i, rem;
         struct mbuf *md;          struct mbuf *md;
         char *fromcp, *tocp, *cp;          char *fromcp, *tocp, *cp, *path;
         struct vnode *dp;          struct vnode *dp;
         int error, rdonly;          int error, rdonly;
         int neverfollow;          int neverfollow;
         struct componentname *cnp = &ndp->ni_cnd;          struct componentname *cnp = &ndp->ni_cnd;
   
         *retdirp = NULL;          *retdirp = NULL;
           ndp->ni_pathbuf = NULL;
   
         if ((len + 1) > MAXPATHLEN)          if ((len + 1) > MAXPATHLEN)
                 return (ENAMETOOLONG);                  return (ENAMETOOLONG);
         if (len == 0)          if (len == 0)
                 return (EACCES);                  return (EACCES);
         cnp->cn_pnbuf = PNBUF_GET();  
   
         /*          /*
          * Copy the name from the mbuf list to ndp->ni_pnbuf           * Copy the name from the mbuf list to ndp->ni_pathbuf
          * and set the various ndp fields appropriately.           * and set the various ndp fields appropriately.
          */           */
           path = PNBUF_GET();
         fromcp = *dposp;          fromcp = *dposp;
         tocp = cnp->cn_pnbuf;          tocp = path;
         md = *mdp;          md = *mdp;
         rem = mtod(md, char *) + md->m_len - fromcp;          rem = mtod(md, char *) + md->m_len - fromcp;
         for (i = 0; i < len; i++) {          for (i = 0; i < len; i++) {
Line 194  nfs_namei(struct nameidata *ndp, nfsrvfh
Line 195  nfs_namei(struct nameidata *ndp, nfsrvfh
                  * and the 'native path' indicator.                   * and the 'native path' indicator.
                  */                   */
                 cp = PNBUF_GET();                  cp = PNBUF_GET();
                 fromcp = cnp->cn_pnbuf;                  fromcp = path;
                 tocp = cp;                  tocp = cp;
                 if ((unsigned char)*fromcp >= WEBNFS_SPECCHAR_START) {                  if ((unsigned char)*fromcp >= WEBNFS_SPECCHAR_START) {
                         switch ((unsigned char)*fromcp) {                          switch ((unsigned char)*fromcp) {
Line 236  nfs_namei(struct nameidata *ndp, nfsrvfh
Line 237  nfs_namei(struct nameidata *ndp, nfsrvfh
                                 *tocp++ = *fromcp++;                                  *tocp++ = *fromcp++;
                 }                  }
                 *tocp = '\0';                  *tocp = '\0';
                 PNBUF_PUT(cnp->cn_pnbuf);                  PNBUF_PUT(path);
                 cnp->cn_pnbuf = cp;                  path = cp;
         }          }
   
         ndp->ni_pathlen = (tocp - cnp->cn_pnbuf) + 1;          ndp->ni_pathbuf = pathbuf_assimilate(path);
           if (ndp->ni_pathbuf == NULL) {
                   error = ENOMEM;
                   goto out;
           }
           ndp->ni_pathlen = (tocp - path) + 1;
         /*ndp->ni_segflg = UIO_SYSSPACE; - obsolete */          /*ndp->ni_segflg = UIO_SYSSPACE; - obsolete */
         ndp->ni_rootdir = rootvnode;          ndp->ni_rootdir = rootvnode;
         ndp->ni_erootdir = NULL;          ndp->ni_erootdir = NULL;
   
         if (pubflag) {          if (pubflag) {
                 ndp->ni_loopcnt = 0;                  ndp->ni_loopcnt = 0;
                 if (cnp->cn_pnbuf[0] == '/')                  if (path[0] == '/')
                         dp = rootvnode;                          dp = rootvnode;
         } else {          } else {
                 cnp->cn_flags |= NOCROSSMOUNT;                  cnp->cn_flags |= NOCROSSMOUNT;
Line 257  nfs_namei(struct nameidata *ndp, nfsrvfh
Line 263  nfs_namei(struct nameidata *ndp, nfsrvfh
   
         /*          /*
          * And call lookup() to do the real work           * And call lookup() to do the real work
            *
            * Note: ndp->ni_pathbuf is left undestroyed; caller must
            * clean it up.
          */           */
         error = lookup_for_nfsd(ndp, dp, neverfollow);          error = lookup_for_nfsd(ndp, dp, neverfollow);
         if (error) {          if (error) {
Line 265  nfs_namei(struct nameidata *ndp, nfsrvfh
Line 274  nfs_namei(struct nameidata *ndp, nfsrvfh
         return 0;          return 0;
   
 out:  out:
         PNBUF_PUT(cnp->cn_pnbuf);          if (ndp->ni_pathbuf != NULL) {
                   pathbuf_destroy(ndp->ni_pathbuf);
           } else {
                   PNBUF_PUT(path);
           }
         return (error);          return (error);
 }  }
   

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

CVSweb <webmaster@jp.NetBSD.org>