Module Name: src Committed By: riastradh Date: Sun Dec 19 10:36:41 UTC 2021
Modified Files: src/sys/external/bsd/drm2/include/linux: pagevec.h xarray.h Log Message: Start xarray stubs. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/include/linux/pagevec.h cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/xarray.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/external/bsd/drm2/include/linux/pagevec.h diff -u src/sys/external/bsd/drm2/include/linux/pagevec.h:1.1 src/sys/external/bsd/drm2/include/linux/pagevec.h:1.2 --- src/sys/external/bsd/drm2/include/linux/pagevec.h:1.1 Sun Dec 19 00:30:01 2021 +++ src/sys/external/bsd/drm2/include/linux/pagevec.h Sun Dec 19 10:36:40 2021 @@ -0,0 +1,34 @@ +/* $NetBSD: pagevec.h,v 1.2 2021/12/19 10:36:40 riastradh Exp $ */ + +/*- + * Copyright (c) 2020 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _LINUX_PAGEVEC_H_ +#define _LINUX_PAGEVEC_H_ + +#include <linux/xarray.h> + +#endif /* _LINUX_PAGEVEC_H_ */ Index: src/sys/external/bsd/drm2/include/linux/xarray.h diff -u src/sys/external/bsd/drm2/include/linux/xarray.h:1.2 src/sys/external/bsd/drm2/include/linux/xarray.h:1.3 --- src/sys/external/bsd/drm2/include/linux/xarray.h:1.2 Sun Dec 19 01:54:50 2021 +++ src/sys/external/bsd/drm2/include/linux/xarray.h Sun Dec 19 10:36:40 2021 @@ -1,11 +1,61 @@ -// SPDX-License-Identifier: MIT -/* - * Copyright © 2020 The NetBSD Foundation, Inc. +/* $NetBSD: xarray.h,v 1.3 2021/12/19 10:36:40 riastradh Exp $ */ + +/*- + * Copyright (c) 2020 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #ifndef _LINUX_XARRAY_H_ #define _LINUX_XARRAY_H_ +#include <linux/slab.h> + struct xarray; +struct xa_limit; + +struct xa_limit { + uint32_t max; + uint32_t min; +}; + +#define xa_for_each(XA, INDEX, ENTRY) \ + for ((INDEX) = 0, (ENTRY) = xa_find((XA), &(INDEX), ULONG_MAX, 0); \ + (ENTRY) != NULL; \ + (ENTRY) = xa_find_after((XA), &(INDEX), ULONG_MAX, 0)) + +#define xa_alloc linux_xa_alloc +#define xa_find linux_xa_find +#define xa_find_after linux_xa_find_after +#define xa_store linux_xa_store +#define xa_limit_32b linux_xa_limit_32b + +int xa_alloc(struct xarray *, uint32_t *, void *, struct xa_limit, gfp_t); +void * xa_find(struct xarray *, unsigned long *, unsigned long, unsigned); +void * xa_find_after(struct xarray *, unsigned long *, unsigned long, + unsigned); +void xa_store(struct xarray *, unsigned long, void *, gfp_t); + +extern const struct xa_limit xa_limit_32b; #endif /* _LINUX_XARRAY_H_ */