1 // SPDX-License-Identifier: CDDL-1.0 2 /* 3 * CDDL HEADER START 4 * 5 * The contents of this file are subject to the terms of the 6 * Common Development and Distribution License (the "License"). 7 * You may not use this file except in compliance with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or https://opensource.org/licenses/CDDL-1.0. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright (c) 2014 by Chunwei Chen. All rights reserved. 24 * Copyright (c) 2016, 2019 by Delphix. All rights reserved. 25 */ 26 27 #ifndef _ABD_OS_H 28 #define _ABD_OS_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 struct abd; 35 36 struct abd_scatter { 37 uint_t abd_offset; 38 uint_t abd_nents; 39 struct scatterlist *abd_sgl; 40 }; 41 42 struct abd_linear { 43 void *abd_buf; 44 struct scatterlist *abd_sgl; /* for LINEAR_PAGE */ 45 }; 46 47 typedef int abd_iter_page_func_t(struct page *, size_t, size_t, void *); 48 int abd_iterate_page_func(struct abd *, size_t, size_t, abd_iter_page_func_t *, 49 void *); 50 51 /* 52 * Linux ABD bio functions 53 * Note: these are only needed to support vdev_classic. See comment in 54 * vdev_disk.c. 55 */ 56 unsigned int abd_bio_map_off(struct bio *, struct abd *, unsigned int, size_t); 57 unsigned long abd_nr_pages_off(struct abd *, unsigned int, size_t); 58 59 __attribute__((malloc)) 60 struct abd *abd_alloc_from_pages(struct page **, unsigned long, uint64_t); 61 62 #ifdef __cplusplus 63 } 64 #endif 65 66 #endif /* _ABD_H */ 67