Home | History | Annotate | Line # | Download | only in libquota
quota_put.c revision 1.4.4.2
      1  1.4.4.2  yamt /*	$NetBSD: quota_put.c,v 1.4.4.2 2012/04/17 00:05:32 yamt Exp $	*/
      2  1.4.4.2  yamt /*-
      3  1.4.4.2  yamt  * Copyright (c) 2011 The NetBSD Foundation, Inc.
      4  1.4.4.2  yamt  * All rights reserved.
      5  1.4.4.2  yamt  *
      6  1.4.4.2  yamt  * This code is derived from software contributed to The NetBSD Foundation
      7  1.4.4.2  yamt  * by David A. Holland.
      8  1.4.4.2  yamt  *
      9  1.4.4.2  yamt  * Redistribution and use in source and binary forms, with or without
     10  1.4.4.2  yamt  * modification, are permitted provided that the following conditions
     11  1.4.4.2  yamt  * are met:
     12  1.4.4.2  yamt  * 1. Redistributions of source code must retain the above copyright
     13  1.4.4.2  yamt  *    notice, this list of conditions and the following disclaimer.
     14  1.4.4.2  yamt  * 2. Redistributions in binary form must reproduce the above copyright
     15  1.4.4.2  yamt  *    notice, this list of conditions and the following disclaimer in the
     16  1.4.4.2  yamt  *    documentation and/or other materials provided with the distribution.
     17  1.4.4.2  yamt  *
     18  1.4.4.2  yamt  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     19  1.4.4.2  yamt  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     20  1.4.4.2  yamt  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     21  1.4.4.2  yamt  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     22  1.4.4.2  yamt  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     23  1.4.4.2  yamt  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     24  1.4.4.2  yamt  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     25  1.4.4.2  yamt  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     26  1.4.4.2  yamt  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     27  1.4.4.2  yamt  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     28  1.4.4.2  yamt  * POSSIBILITY OF SUCH DAMAGE.
     29  1.4.4.2  yamt  */
     30  1.4.4.2  yamt 
     31  1.4.4.2  yamt #include <sys/cdefs.h>
     32  1.4.4.2  yamt __RCSID("$NetBSD: quota_put.c,v 1.4.4.2 2012/04/17 00:05:32 yamt Exp $");
     33  1.4.4.2  yamt 
     34  1.4.4.2  yamt #include <errno.h>
     35  1.4.4.2  yamt 
     36  1.4.4.2  yamt #include <quota.h>
     37  1.4.4.2  yamt #include "quotapvt.h"
     38  1.4.4.2  yamt 
     39  1.4.4.2  yamt int
     40  1.4.4.2  yamt quota_put(struct quotahandle *qh, const struct quotakey *qk,
     41  1.4.4.2  yamt 	  const struct quotaval *qv)
     42  1.4.4.2  yamt {
     43  1.4.4.2  yamt 	switch (qh->qh_mode) {
     44  1.4.4.2  yamt 	    case QUOTA_MODE_NFS:
     45  1.4.4.2  yamt 		errno = EOPNOTSUPP;
     46  1.4.4.2  yamt 		return -1;
     47  1.4.4.2  yamt 
     48  1.4.4.2  yamt 	    case QUOTA_MODE_OLDFILES:
     49  1.4.4.2  yamt 		return __quota_oldfiles_put(qh, qk, qv);
     50  1.4.4.2  yamt 
     51  1.4.4.2  yamt 	    case QUOTA_MODE_KERNEL:
     52  1.4.4.2  yamt 		return __quota_kernel_put(qh, qk, qv);
     53  1.4.4.2  yamt 
     54  1.4.4.2  yamt 	    default:
     55  1.4.4.2  yamt 		break;
     56  1.4.4.2  yamt 	}
     57  1.4.4.2  yamt 	errno = EINVAL;
     58  1.4.4.2  yamt 	return -1;
     59  1.4.4.2  yamt }
     60