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