Home | History | Annotate | Line # | Download | only in common
vfs_syscalls_50.c revision 1.19
      1  1.19  pgoyette /*	$NetBSD: vfs_syscalls_50.c,v 1.19 2019/01/27 02:08:39 pgoyette Exp $	*/
      2   1.2  christos 
      3   1.2  christos /*-
      4   1.2  christos  * Copyright (c) 2008 The NetBSD Foundation, Inc.
      5   1.2  christos  * All rights reserved.
      6   1.2  christos  *
      7   1.2  christos  * This code is derived from software contributed to The NetBSD Foundation
      8   1.2  christos  * by Christos Zoulas.
      9   1.2  christos  *
     10   1.2  christos  * Redistribution and use in source and binary forms, with or without
     11   1.2  christos  * modification, are permitted provided that the following conditions
     12   1.2  christos  * are met:
     13   1.2  christos  * 1. Redistributions of source code must retain the above copyright
     14   1.2  christos  *    notice, this list of conditions and the following disclaimer.
     15   1.2  christos  * 2. Redistributions in binary form must reproduce the above copyright
     16   1.2  christos  *    notice, this list of conditions and the following disclaimer in the
     17   1.2  christos  *    documentation and/or other materials provided with the distribution.
     18   1.2  christos  * 3. All advertising materials mentioning features or use of this software
     19   1.2  christos  *    must display the following acknowledgement:
     20   1.2  christos  *        This product includes software developed by the NetBSD
     21   1.2  christos  *        Foundation, Inc. and its contributors.
     22   1.2  christos  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23   1.2  christos  *    contributors may be used to endorse or promote products derived
     24   1.2  christos  *    from this software without specific prior written permission.
     25   1.2  christos  *
     26   1.2  christos  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27   1.2  christos  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28   1.2  christos  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29   1.2  christos  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30   1.2  christos  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31   1.2  christos  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32   1.2  christos  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33   1.2  christos  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34   1.2  christos  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35   1.2  christos  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36   1.2  christos  * POSSIBILITY OF SUCH DAMAGE.
     37   1.2  christos  */
     38   1.2  christos #include <sys/cdefs.h>
     39  1.19  pgoyette __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_50.c,v 1.19 2019/01/27 02:08:39 pgoyette Exp $");
     40  1.19  pgoyette 
     41  1.19  pgoyette #if defined(_KERNEL_OPT)
     42  1.19  pgoyette #include "opt_compat_netbsd.h"
     43  1.19  pgoyette #endif
     44   1.2  christos 
     45   1.2  christos #include <sys/param.h>
     46   1.2  christos #include <sys/systm.h>
     47   1.2  christos #include <sys/namei.h>
     48   1.2  christos #include <sys/filedesc.h>
     49   1.2  christos #include <sys/kernel.h>
     50   1.2  christos #include <sys/file.h>
     51   1.2  christos #include <sys/stat.h>
     52   1.2  christos #include <sys/socketvar.h>
     53   1.2  christos #include <sys/vnode.h>
     54   1.2  christos #include <sys/mount.h>
     55   1.2  christos #include <sys/proc.h>
     56   1.2  christos #include <sys/uio.h>
     57   1.2  christos #include <sys/dirent.h>
     58   1.2  christos #include <sys/kauth.h>
     59   1.2  christos #include <sys/time.h>
     60  1.19  pgoyette #include <sys/syscall.h>
     61  1.19  pgoyette #include <sys/syscallvar.h>
     62  1.19  pgoyette #include <sys/syscallargs.h>
     63   1.2  christos #include <sys/vfs_syscalls.h>
     64   1.2  christos #ifndef LFS
     65   1.2  christos #define LFS
     66   1.2  christos #endif
     67   1.2  christos #include <sys/syscallargs.h>
     68   1.2  christos 
     69   1.2  christos #include <ufs/lfs/lfs_extern.h>
     70   1.2  christos 
     71   1.9  dholland #include <sys/quota.h>
     72  1.14  dholland #include <sys/quotactl.h>
     73   1.9  dholland #include <ufs/ufs/quota1.h>
     74   1.9  dholland 
     75   1.2  christos #include <compat/common/compat_util.h>
     76  1.19  pgoyette #include <compat/common/compat_mod.h>
     77   1.2  christos #include <compat/sys/time.h>
     78   1.2  christos #include <compat/sys/stat.h>
     79   1.2  christos #include <compat/sys/dirent.h>
     80   1.2  christos #include <compat/sys/mount.h>
     81   1.2  christos 
     82   1.2  christos static void cvtstat(struct stat30 *, const struct stat *);
     83   1.2  christos 
     84  1.19  pgoyette static const struct syscall_package vfs_syscalls_50_syscalls[] = {
     85  1.19  pgoyette 	{ SYS_compat_50___stat30, 0, (sy_call_t *)compat_50_sys___stat30 },
     86  1.19  pgoyette         { SYS_compat_50___fstat30, 0, (sy_call_t *)compat_50_sys___fstat30 },
     87  1.19  pgoyette         { SYS_compat_50___lstat30, 0, (sy_call_t *)compat_50_sys___lstat30 },
     88  1.19  pgoyette         { SYS_compat_50___fhstat40, 0, (sy_call_t *)compat_50_sys___fhstat40 },
     89  1.19  pgoyette 	{ SYS_compat_50_utimes, 0, (sy_call_t *)compat_50_sys_utimes },
     90  1.19  pgoyette         { SYS_compat_50_lfs_segwait, 0,
     91  1.19  pgoyette 	    (sy_call_t *)compat_50_sys_lfs_segwait } ,
     92  1.19  pgoyette         { SYS_compat_50_futimes, 0, (sy_call_t *)compat_50_sys_futimes },
     93  1.19  pgoyette         { SYS_compat_50_lutimes, 0, (sy_call_t *)compat_50_sys_lutimes },
     94  1.19  pgoyette 	{ SYS_compat_50_mknod, 0, (sy_call_t *)compat_50_sys_mknod },
     95  1.19  pgoyette         { SYS_compat_50_quotactl, 0, (sy_call_t *)compat_50_sys_quotactl },
     96  1.19  pgoyette 	{ 0, 0, NULL }
     97  1.19  pgoyette };
     98  1.19  pgoyette 
     99   1.2  christos /*
    100   1.2  christos  * Convert from a new to an old stat structure.
    101   1.2  christos  */
    102   1.2  christos static void
    103   1.2  christos cvtstat(struct stat30 *ost, const struct stat *st)
    104   1.2  christos {
    105   1.2  christos 
    106   1.2  christos 	ost->st_dev = st->st_dev;
    107   1.2  christos 	ost->st_ino = st->st_ino;
    108   1.2  christos 	ost->st_mode = st->st_mode;
    109   1.2  christos 	ost->st_nlink = st->st_nlink;
    110   1.2  christos 	ost->st_uid = st->st_uid;
    111   1.2  christos 	ost->st_gid = st->st_gid;
    112   1.2  christos 	ost->st_rdev = st->st_rdev;
    113   1.2  christos 	timespec_to_timespec50(&st->st_atimespec, &ost->st_atimespec);
    114   1.2  christos 	timespec_to_timespec50(&st->st_mtimespec, &ost->st_mtimespec);
    115   1.2  christos 	timespec_to_timespec50(&st->st_ctimespec, &ost->st_ctimespec);
    116   1.2  christos 	timespec_to_timespec50(&st->st_birthtimespec, &ost->st_birthtimespec);
    117   1.2  christos 	ost->st_size = st->st_size;
    118   1.2  christos 	ost->st_blocks = st->st_blocks;
    119   1.2  christos 	ost->st_blksize = st->st_blksize;
    120   1.2  christos 	ost->st_flags = st->st_flags;
    121   1.2  christos 	ost->st_gen = st->st_gen;
    122   1.6     pooka 	memset(ost->st_spare, 0, sizeof(ost->st_spare));
    123   1.2  christos }
    124   1.2  christos 
    125   1.2  christos /*
    126   1.2  christos  * Get file status; this version follows links.
    127   1.2  christos  */
    128   1.2  christos /* ARGSUSED */
    129   1.2  christos int
    130   1.2  christos compat_50_sys___stat30(struct lwp *l, const struct compat_50_sys___stat30_args *uap, register_t *retval)
    131   1.2  christos {
    132   1.2  christos 	/* {
    133   1.2  christos 		syscallarg(const char *) path;
    134   1.2  christos 		syscallarg(struct stat30 *) ub;
    135   1.2  christos 	} */
    136   1.2  christos 	struct stat sb;
    137   1.2  christos 	struct stat30 osb;
    138   1.2  christos 	int error;
    139   1.2  christos 
    140   1.2  christos 	error = do_sys_stat(SCARG(uap, path), FOLLOW, &sb);
    141   1.2  christos 	if (error)
    142   1.2  christos 		return error;
    143   1.2  christos 	cvtstat(&osb, &sb);
    144   1.2  christos 	error = copyout(&osb, SCARG(uap, ub), sizeof (osb));
    145   1.2  christos 	return error;
    146   1.2  christos }
    147   1.2  christos 
    148   1.2  christos 
    149   1.2  christos /*
    150   1.2  christos  * Get file status; this version does not follow links.
    151   1.2  christos  */
    152   1.2  christos /* ARGSUSED */
    153   1.2  christos int
    154   1.2  christos compat_50_sys___lstat30(struct lwp *l, const struct compat_50_sys___lstat30_args *uap, register_t *retval)
    155   1.2  christos {
    156   1.2  christos 	/* {
    157   1.2  christos 		syscallarg(const char *) path;
    158   1.2  christos 		syscallarg(struct stat30 *) ub;
    159   1.2  christos 	} */
    160   1.2  christos 	struct stat sb;
    161   1.2  christos 	struct stat30 osb;
    162   1.2  christos 	int error;
    163   1.2  christos 
    164   1.2  christos 	error = do_sys_stat(SCARG(uap, path), NOFOLLOW, &sb);
    165   1.2  christos 	if (error)
    166   1.2  christos 		return error;
    167   1.2  christos 	cvtstat(&osb, &sb);
    168   1.2  christos 	error = copyout(&osb, SCARG(uap, ub), sizeof (osb));
    169   1.2  christos 	return error;
    170   1.2  christos }
    171   1.2  christos 
    172   1.2  christos /*
    173   1.2  christos  * Return status information about a file descriptor.
    174   1.2  christos  */
    175   1.2  christos /* ARGSUSED */
    176   1.2  christos int
    177   1.2  christos compat_50_sys___fstat30(struct lwp *l, const struct compat_50_sys___fstat30_args *uap, register_t *retval)
    178   1.2  christos {
    179   1.2  christos 	/* {
    180   1.2  christos 		syscallarg(int) fd;
    181   1.2  christos 		syscallarg(struct stat30 *) sb;
    182   1.2  christos 	} */
    183   1.2  christos 	struct stat sb;
    184   1.2  christos 	struct stat30 osb;
    185   1.2  christos 	int error;
    186   1.2  christos 
    187   1.4     njoly 	error = do_sys_fstat(SCARG(uap, fd), &sb);
    188   1.2  christos 	if (error)
    189   1.2  christos 		return error;
    190   1.2  christos 	cvtstat(&osb, &sb);
    191   1.2  christos 	error = copyout(&osb, SCARG(uap, sb), sizeof (osb));
    192   1.2  christos 	return error;
    193   1.2  christos }
    194   1.2  christos 
    195   1.2  christos /* ARGSUSED */
    196   1.2  christos int
    197   1.2  christos compat_50_sys___fhstat40(struct lwp *l, const struct compat_50_sys___fhstat40_args *uap, register_t *retval)
    198   1.2  christos {
    199   1.2  christos 	/* {
    200   1.2  christos 		syscallarg(const void *) fhp;
    201   1.2  christos 		syscallarg(size_t) fh_size;
    202   1.2  christos 		syscallarg(struct stat30 *) sb;
    203   1.2  christos 	} */
    204   1.2  christos 	struct stat sb;
    205   1.2  christos 	struct stat30 osb;
    206   1.2  christos 	int error;
    207   1.2  christos 
    208   1.2  christos 	error = do_fhstat(l, SCARG(uap, fhp), SCARG(uap, fh_size), &sb);
    209   1.2  christos 	if (error)
    210   1.2  christos 		return error;
    211   1.2  christos 	cvtstat(&osb, &sb);
    212   1.2  christos 	error = copyout(&osb, SCARG(uap, sb), sizeof (osb));
    213   1.2  christos 	return error;
    214   1.2  christos }
    215   1.2  christos 
    216   1.2  christos static int
    217   1.2  christos compat_50_do_sys_utimes(struct lwp *l, struct vnode *vp, const char *path,
    218   1.2  christos     int flag, const struct timeval50 *tptr)
    219   1.2  christos {
    220   1.3  christos 	struct timeval tv[2], *tvp;
    221   1.2  christos 	struct timeval50 tv50[2];
    222   1.3  christos 	if (tptr) {
    223   1.3  christos 		int error = copyin(tptr, tv50, sizeof(tv50));
    224   1.3  christos 		if (error)
    225   1.3  christos 			return error;
    226   1.3  christos 		timeval50_to_timeval(&tv50[0], &tv[0]);
    227   1.3  christos 		timeval50_to_timeval(&tv50[1], &tv[1]);
    228   1.3  christos 		tvp = tv;
    229   1.3  christos 	} else
    230   1.3  christos 		tvp = NULL;
    231   1.3  christos 	return do_sys_utimes(l, vp, path, flag, tvp, UIO_SYSSPACE);
    232   1.2  christos }
    233   1.2  christos 
    234   1.2  christos /*
    235   1.2  christos  * Set the access and modification times given a path name; this
    236   1.2  christos  * version follows links.
    237   1.2  christos  */
    238   1.2  christos /* ARGSUSED */
    239   1.2  christos int
    240   1.2  christos compat_50_sys_utimes(struct lwp *l, const struct compat_50_sys_utimes_args *uap,
    241   1.2  christos     register_t *retval)
    242   1.2  christos {
    243   1.2  christos 	/* {
    244   1.2  christos 		syscallarg(const char *) path;
    245   1.2  christos 		syscallarg(const struct timeval50 *) tptr;
    246   1.2  christos 	} */
    247   1.2  christos 
    248   1.2  christos 	return compat_50_do_sys_utimes(l, NULL, SCARG(uap, path), FOLLOW,
    249   1.2  christos 	    SCARG(uap, tptr));
    250   1.2  christos }
    251   1.2  christos 
    252   1.2  christos /*
    253   1.2  christos  * Set the access and modification times given a file descriptor.
    254   1.2  christos  */
    255   1.2  christos /* ARGSUSED */
    256   1.2  christos int
    257   1.2  christos compat_50_sys_futimes(struct lwp *l,
    258   1.2  christos     const struct compat_50_sys_futimes_args *uap, register_t *retval)
    259   1.2  christos {
    260   1.2  christos 	/* {
    261   1.2  christos 		syscallarg(int) fd;
    262   1.2  christos 		syscallarg(const struct timeval50 *) tptr;
    263   1.2  christos 	} */
    264   1.2  christos 	int error;
    265   1.2  christos 	struct file *fp;
    266   1.2  christos 
    267   1.2  christos 	/* fd_getvnode() will use the descriptor for us */
    268   1.2  christos 	if ((error = fd_getvnode(SCARG(uap, fd), &fp)) != 0)
    269   1.2  christos 		return error;
    270  1.18      matt 	error = compat_50_do_sys_utimes(l, fp->f_vnode, NULL, 0,
    271   1.2  christos 	    SCARG(uap, tptr));
    272   1.2  christos 	fd_putfile(SCARG(uap, fd));
    273   1.2  christos 	return error;
    274   1.2  christos }
    275   1.2  christos 
    276   1.2  christos /*
    277   1.2  christos  * Set the access and modification times given a path name; this
    278   1.2  christos  * version does not follow links.
    279   1.2  christos  */
    280   1.2  christos int
    281   1.2  christos compat_50_sys_lutimes(struct lwp *l,
    282   1.2  christos     const struct compat_50_sys_lutimes_args *uap, register_t *retval)
    283   1.2  christos {
    284   1.2  christos 	/* {
    285   1.2  christos 		syscallarg(const char *) path;
    286   1.2  christos 		syscallarg(const struct timeval50 *) tptr;
    287   1.2  christos 	} */
    288   1.2  christos 
    289   1.2  christos 	return compat_50_do_sys_utimes(l, NULL, SCARG(uap, path), NOFOLLOW,
    290   1.2  christos 	    SCARG(uap, tptr));
    291   1.2  christos }
    292   1.2  christos 
    293   1.2  christos int
    294   1.2  christos compat_50_sys_lfs_segwait(struct lwp *l,
    295   1.2  christos     const struct compat_50_sys_lfs_segwait_args *uap, register_t *retval)
    296   1.2  christos {
    297   1.2  christos 	/* {
    298   1.2  christos 		syscallarg(fsid_t *) fsidp;
    299   1.2  christos 		syscallarg(struct timeval50 *) tv;
    300   1.2  christos 	} */
    301   1.2  christos #ifdef notyet
    302  1.19  pgoyette /* XXX need to check presence of LFS at run-time XXX */
    303   1.2  christos 	struct timeval atv;
    304   1.2  christos 	struct timeval50 atv50;
    305   1.2  christos 	fsid_t fsid;
    306   1.2  christos 	int error;
    307   1.2  christos 
    308   1.2  christos 	/* XXX need we be su to segwait? */
    309  1.17      elad 	error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_LFS,
    310  1.17      elad 	    KAUTH_REQ_SYSTEM_LFS_SEGWAIT, NULL, NULL, NULL);
    311  1.17      elad 	if (error)
    312   1.2  christos 		return (error);
    313   1.2  christos 	if ((error = copyin(SCARG(uap, fsidp), &fsid, sizeof(fsid_t))) != 0)
    314   1.2  christos 		return (error);
    315   1.2  christos 
    316   1.2  christos 	if (SCARG(uap, tv)) {
    317   1.2  christos 		error = copyin(SCARG(uap, tv), &atv50, sizeof(atv50));
    318   1.2  christos 		if (error)
    319   1.2  christos 			return (error);
    320   1.2  christos 		timeval50_to_timeval(&atv50, &atv);
    321   1.2  christos 		if (itimerfix(&atv))
    322   1.2  christos 			return (EINVAL);
    323   1.2  christos 	} else /* NULL or invalid */
    324   1.2  christos 		atv.tv_sec = atv.tv_usec = 0;
    325   1.2  christos 	return lfs_segwait(&fsid, &atv);
    326   1.2  christos #else
    327   1.2  christos 	return ENOSYS;
    328   1.2  christos #endif
    329   1.2  christos }
    330   1.2  christos 
    331   1.2  christos int
    332   1.2  christos compat_50_sys_mknod(struct lwp *l,
    333   1.2  christos     const struct compat_50_sys_mknod_args *uap, register_t *retval)
    334   1.2  christos {
    335   1.2  christos 	/* {
    336   1.2  christos 		syscallarg(const char *) path;
    337   1.2  christos 		syscallarg(mode_t) mode;
    338   1.2  christos 		syscallarg(uint32_t) dev;
    339   1.2  christos 	} */
    340   1.2  christos 	return do_sys_mknod(l, SCARG(uap, path), SCARG(uap, mode),
    341   1.5      haad 	    SCARG(uap, dev), retval, UIO_USERSPACE);
    342   1.2  christos }
    343   1.7    bouyer 
    344   1.7    bouyer /* ARGSUSED */
    345   1.7    bouyer int
    346   1.7    bouyer compat_50_sys_quotactl(struct lwp *l, const struct compat_50_sys_quotactl_args *uap, register_t *retval)
    347   1.7    bouyer {
    348   1.7    bouyer 	/* {
    349   1.7    bouyer 		syscallarg(const char *) path;
    350   1.7    bouyer 		syscallarg(int) cmd;
    351   1.7    bouyer 		syscallarg(int) uid;
    352   1.7    bouyer 		syscallarg(void *) arg;
    353   1.7    bouyer 	} */
    354  1.15  dholland 	struct vnode *vp;
    355   1.7    bouyer 	struct mount *mp;
    356  1.15  dholland 	int q1cmd;
    357  1.15  dholland 	int idtype;
    358  1.15  dholland 	char *qfile;
    359   1.7    bouyer 	struct dqblk dqblk;
    360  1.14  dholland 	struct quotakey key;
    361  1.14  dholland 	struct quotaval blocks, files;
    362  1.14  dholland 	struct quotastat qstat;
    363  1.15  dholland 	int error;
    364   1.8    bouyer 
    365   1.7    bouyer 	error = namei_simple_user(SCARG(uap, path),
    366   1.7    bouyer 				NSM_FOLLOW_TRYEMULROOT, &vp);
    367   1.7    bouyer 	if (error != 0)
    368   1.7    bouyer 		return (error);
    369  1.14  dholland 
    370   1.7    bouyer 	mp = vp->v_mount;
    371  1.15  dholland 	q1cmd = SCARG(uap, cmd);
    372  1.14  dholland 	idtype = quota_idtype_from_ufs(q1cmd & SUBCMDMASK);
    373   1.7    bouyer 
    374  1.14  dholland 	switch ((q1cmd & ~SUBCMDMASK) >> SUBCMDSHIFT) {
    375   1.7    bouyer 	case Q_QUOTAON:
    376  1.15  dholland 		qfile = PNBUF_GET();
    377  1.15  dholland 		error = copyinstr(SCARG(uap, arg), qfile, PATH_MAX, NULL);
    378   1.7    bouyer 		if (error != 0) {
    379  1.15  dholland 			PNBUF_PUT(qfile);
    380  1.14  dholland 			break;
    381   1.7    bouyer 		}
    382  1.14  dholland 
    383  1.16  dholland 		error = vfs_quotactl_quotaon(mp, idtype, qfile);
    384  1.14  dholland 
    385  1.15  dholland 		PNBUF_PUT(qfile);
    386  1.14  dholland 		break;
    387   1.7    bouyer 
    388   1.7    bouyer 	case Q_QUOTAOFF:
    389  1.16  dholland 		error = vfs_quotactl_quotaoff(mp, idtype);
    390  1.14  dholland 		break;
    391   1.7    bouyer 
    392   1.7    bouyer 	case Q_GETQUOTA:
    393  1.14  dholland 		key.qk_idtype = idtype;
    394  1.14  dholland 		key.qk_id = SCARG(uap, uid);
    395  1.14  dholland 
    396  1.14  dholland 		key.qk_objtype = QUOTA_OBJTYPE_BLOCKS;
    397  1.16  dholland 		error = vfs_quotactl_get(mp, &key, &blocks);
    398  1.14  dholland 		if (error) {
    399  1.14  dholland 			break;
    400   1.7    bouyer 		}
    401  1.14  dholland 
    402  1.14  dholland 		key.qk_objtype = QUOTA_OBJTYPE_FILES;
    403  1.16  dholland 		error = vfs_quotactl_get(mp, &key, &files);
    404  1.14  dholland 		if (error) {
    405  1.14  dholland 			break;
    406   1.7    bouyer 		}
    407  1.14  dholland 
    408  1.14  dholland 		quotavals_to_dqblk(&blocks, &files, &dqblk);
    409   1.7    bouyer 		error = copyout(&dqblk, SCARG(uap, arg), sizeof(dqblk));
    410  1.14  dholland 		break;
    411   1.7    bouyer 
    412   1.7    bouyer 	case Q_SETQUOTA:
    413   1.7    bouyer 		error = copyin(SCARG(uap, arg), &dqblk, sizeof(dqblk));
    414  1.14  dholland 		if (error) {
    415  1.14  dholland 			break;
    416   1.7    bouyer 		}
    417  1.14  dholland 		dqblk_to_quotavals(&dqblk, &blocks, &files);
    418  1.14  dholland 
    419  1.14  dholland 		key.qk_idtype = idtype;
    420  1.14  dholland 		key.qk_id = SCARG(uap, uid);
    421  1.14  dholland 
    422  1.14  dholland 		key.qk_objtype = QUOTA_OBJTYPE_BLOCKS;
    423  1.16  dholland 		error = vfs_quotactl_put(mp, &key, &blocks);
    424  1.14  dholland 		if (error) {
    425  1.14  dholland 			break;
    426   1.7    bouyer 		}
    427  1.14  dholland 
    428  1.14  dholland 		key.qk_objtype = QUOTA_OBJTYPE_FILES;
    429  1.16  dholland 		error = vfs_quotactl_put(mp, &key, &files);
    430  1.14  dholland 		break;
    431   1.7    bouyer 
    432   1.7    bouyer 	case Q_SYNC:
    433   1.7    bouyer 		/*
    434   1.7    bouyer 		 * not supported but used only to see if quota is supported,
    435  1.14  dholland 		 * emulate with stat
    436  1.14  dholland 		 *
    437  1.14  dholland 		 * XXX should probably be supported
    438   1.7    bouyer 		 */
    439  1.14  dholland 		(void)idtype; /* not used */
    440  1.14  dholland 
    441  1.16  dholland 		error = vfs_quotactl_stat(mp, &qstat);
    442  1.14  dholland 		break;
    443   1.7    bouyer 
    444   1.7    bouyer 	case Q_SETUSE:
    445   1.7    bouyer 	default:
    446   1.7    bouyer 		error = EOPNOTSUPP;
    447  1.14  dholland 		break;
    448   1.7    bouyer 	}
    449  1.14  dholland 
    450   1.7    bouyer 	vrele(vp);
    451   1.7    bouyer 	return error;
    452   1.7    bouyer }
    453  1.19  pgoyette 
    454  1.19  pgoyette int
    455  1.19  pgoyette vfs_syscalls_50_init(void)
    456  1.19  pgoyette {
    457  1.19  pgoyette 
    458  1.19  pgoyette         return syscall_establish(NULL, vfs_syscalls_50_syscalls);
    459  1.19  pgoyette }
    460  1.19  pgoyette 
    461  1.19  pgoyette int
    462  1.19  pgoyette vfs_syscalls_50_fini(void)
    463  1.19  pgoyette {
    464  1.19  pgoyette 
    465  1.19  pgoyette         return syscall_disestablish(NULL, vfs_syscalls_50_syscalls);
    466  1.19  pgoyette }
    467