1139969Simp/*- 274465Srwatson * Copyright (c) 2001 Chris D. Faulhaber 374465Srwatson * All rights reserved. 474465Srwatson * 574465Srwatson * Redistribution and use in source and binary forms, with or without 674465Srwatson * modification, are permitted provided that the following conditions 774465Srwatson * are met: 874465Srwatson * 1. Redistributions of source code must retain the above copyright 974465Srwatson * notice, this list of conditions and the following disclaimer. 1074465Srwatson * 2. Redistributions in binary form must reproduce the above copyright 1174465Srwatson * notice, this list of conditions and the following disclaimer in the 1274465Srwatson * documentation and/or other materials provided with the distribution. 1374465Srwatson * 1474465Srwatson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1574465Srwatson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1674465Srwatson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17204819Sjoel * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18204819Sjoel * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19204819Sjoel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20204819Sjoel * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21204819Sjoel * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22204819Sjoel * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23204819Sjoel * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24204819Sjoel * SUCH DAMAGE. 2574465Srwatson */ 2674465Srwatson 2799110Sobrien#include <sys/cdefs.h> 2899110Sobrien__FBSDID("$FreeBSD$"); 2999110Sobrien 3074465Srwatson#include <err.h> 3174465Srwatson#include <stdlib.h> 3274465Srwatson#include <string.h> 3374465Srwatson 3474465Srwatson#include "setfacl.h" 3574465Srwatson 3674465Srwatsonvoid * 3774465Srwatsonzmalloc(size_t size) 3874465Srwatson{ 3974465Srwatson void *ptr; 4074465Srwatson 4187181Sjedgar ptr = calloc(1, size); 4287224Sjedgar if (ptr == NULL) 4387254Sjedgar err(1, "calloc() failed"); 4487254Sjedgar return (ptr); 4574465Srwatson} 46201016Strasz 47201016Straszconst char * 48201016Straszbrand_name(int brand) 49201016Strasz{ 50201016Strasz switch (brand) { 51201016Strasz case ACL_BRAND_NFS4: 52201016Strasz return "NFSv4"; 53201016Strasz case ACL_BRAND_POSIX: 54201016Strasz return "POSIX.1e"; 55201016Strasz default: 56201016Strasz return "unknown"; 57201016Strasz } 58201016Strasz} 59201016Strasz 60201016Straszint 61201016Straszbranding_mismatch(int brand1, int brand2) 62201016Strasz{ 63201016Strasz if (brand1 == ACL_BRAND_UNKNOWN || brand2 == ACL_BRAND_UNKNOWN) 64201016Strasz return (0); 65201016Strasz if (brand1 != brand2) 66201016Strasz return (1); 67201018Strasz return (0); 68201016Strasz} 69