[BACK]Return to vfs_syscalls_30.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / compat / common

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

Diff for /src/sys/compat/common/vfs_syscalls_30.c between version 1.9.6.2 and 1.9.6.3

version 1.9.6.2, 2006/06/21 14:58:32 version 1.9.6.3, 2006/12/30 20:47:31
Line 60  __KERNEL_RCSID(0, "$NetBSD$");
Line 60  __KERNEL_RCSID(0, "$NetBSD$");
 #include <compat/common/compat_util.h>  #include <compat/common/compat_util.h>
 #include <compat/sys/stat.h>  #include <compat/sys/stat.h>
 #include <compat/sys/dirent.h>  #include <compat/sys/dirent.h>
   #include <compat/sys/mount.h>
   
 static void cvtstat(struct stat13 *, const struct stat *);  static void cvtstat(struct stat13 *, const struct stat *);
   
Line 152  int
Line 153  int
 compat_30_sys_fhstat(struct lwp *l, void *v, register_t *retval)  compat_30_sys_fhstat(struct lwp *l, void *v, register_t *retval)
 {  {
         struct compat_30_sys_fhstat_args /* {          struct compat_30_sys_fhstat_args /* {
                 syscallarg(const fhandle_t *) fhp;                  syscallarg(const struct compat_30_fhandle *) fhp;
                 syscallarg(struct stat13 *) sb;                  syscallarg(struct stat13 *) sb;
         } */ *uap = v;          } */ *uap = v;
         struct proc *p = l->l_proc;  
         struct stat sb;          struct stat sb;
         struct stat13 osb;          struct stat13 osb;
         int error;          int error;
         fhandle_t fh;          struct compat_30_fhandle fh;
         struct mount *mp;          struct mount *mp;
         struct vnode *vp;          struct vnode *vp;
   
         /*          /*
          * Must be super user           * Must be super user
          */           */
         if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER,          if ((error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_FILEHANDLE,
             &p->p_acflag)))              0, NULL, NULL, NULL)))
                 return (error);                  return (error);
   
         if ((error = copyin(SCARG(uap, fhp), &fh, sizeof(fhandle_t))) != 0)          if ((error = copyin(SCARG(uap, fhp), &fh, sizeof(fh))) != 0)
                 return (error);                  return (error);
   
         if ((mp = vfs_getvfs(&fh.fh_fsid)) == NULL)          if ((mp = vfs_getvfs(&fh.fh_fsid)) == NULL)
                 return (ESTALE);                  return (ESTALE);
         if (mp->mnt_op->vfs_fhtovp == NULL)          if (mp->mnt_op->vfs_fhtovp == NULL)
                 return EOPNOTSUPP;                  return EOPNOTSUPP;
         if ((error = VFS_FHTOVP(mp, &fh.fh_fid, &vp)))          if ((error = VFS_FHTOVP(mp, (struct fid*)&fh.fh_fid, &vp)))
                 return (error);                  return (error);
         error = vn_stat(vp, &sb, l);          error = vn_stat(vp, &sb, l);
         vput(vp);          vput(vp);
Line 350  out1:
Line 350  out1:
         FILE_UNUSE(fp, l);          FILE_UNUSE(fp, l);
         return error;          return error;
 }  }
   
   /*
    * Get file handle system call
    */
   int
   compat_30_sys_getfh(struct lwp *l, void *v, register_t *retval)
   {
           struct compat_30_sys_getfh_args /* {
                   syscallarg(char *) fname;
                   syscallarg(struct compat_30_fhandle *) fhp;
           } */ *uap = v;
           struct vnode *vp;
           struct compat_30_fhandle fh;
           int error;
           struct nameidata nd;
           size_t sz;
   
           /*
            * Must be super user
            */
           error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_FILEHANDLE,
               0, NULL, NULL, NULL);
           if (error)
                   return (error);
           NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
               SCARG(uap, fname), l);
           error = namei(&nd);
           if (error)
                   return (error);
           vp = nd.ni_vp;
           sz = sizeof(struct compat_30_fhandle);
           error = vfs_composefh(vp, (void *)&fh, &sz);
           vput(vp);
           if (sz != FHANDLE_SIZE_COMPAT) {
                   error = EINVAL;
           }
           if (error)
                   return (error);
           error = copyout(&fh, SCARG(uap, fhp), sizeof(struct compat_30_fhandle));
           return (error);
   }
   
   /*
    * Open a file given a file handle.
    *
    * Check permissions, allocate an open file structure,
    * and call the device open routine if any.
    */
   int
   compat_30_sys_fhopen(struct lwp *l, void *v, register_t *retval)
   {
           struct compat_30_sys_fhopen_args /* {
                   syscallarg(const fhandle_t *) fhp;
                   syscallarg(int) flags;
           } */ *uap = v;
   
           return dofhopen(l, SCARG(uap, fhp), FHANDLE_SIZE_COMPAT,
               SCARG(uap, flags), retval);
   }
   
   /* ARGSUSED */
   int
   compat_30_sys___fhstat30(struct lwp *l, void *v, register_t *retval)
   {
           struct compat_30_sys___fhstat30_args /* {
                   syscallarg(const fhandle_t *) fhp;
                   syscallarg(struct stat *) sb;
           } */ *uap = v;
   
           return dofhstat(l, SCARG(uap, fhp), FHANDLE_SIZE_COMPAT,
               SCARG(uap, sb), retval);
   }
   
   /* ARGSUSED */
   int
   compat_30_sys_fhstatvfs1(struct lwp *l, void *v, register_t *retval)
   {
           struct compat_30_sys_fhstatvfs1_args /* {
                   syscallarg(const fhandle_t *) fhp;
                   syscallarg(struct statvfs *) buf;
                   syscallarg(int) flags;
           } */ *uap = v;
   
           return dofhstatvfs(l, SCARG(uap, fhp), FHANDLE_SIZE_COMPAT,
               SCARG(uap, buf), SCARG(uap, flags), retval);
   }

Legend:
Removed from v.1.9.6.2  
changed lines
  Added in v.1.9.6.3

CVSweb <webmaster@jp.NetBSD.org>