diff --git a/sys/cddl/contrib/opensolaris/common/unicode/u8_textprep.c b/sys/cddl/contrib/opensolaris/common/unicode/u8_textprep.c deleted file mode 100644 index 06c8a05506e7..000000000000 --- a/sys/cddl/contrib/opensolaris/common/unicode/u8_textprep.c +++ /dev/null @@ -1,2130 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - - -/* - * UTF-8 text preparation functions (PSARC/2007/149, PSARC/2007/458). - * - * Man pages: u8_textprep_open(9F), u8_textprep_buf(9F), u8_textprep_close(9F), - * u8_textprep_str(9F), u8_strcmp(9F), and u8_validate(9F). See also - * the section 3C man pages. - * Interface stability: Committed. - */ - -#include -#ifdef _KERNEL -#include -#include -#include -#include -#include -#include -#else -#include -#endif /* _KERNEL */ -#include -#include -#include -#include - - -/* The maximum possible number of bytes in a UTF-8 character. */ -#define U8_MB_CUR_MAX (4) - -/* - * The maximum number of bytes needed for a UTF-8 character to cover - * U+0000 - U+FFFF, i.e., the coding space of now deprecated UCS-2. - */ -#define U8_MAX_BYTES_UCS2 (3) - -/* The maximum possible number of bytes in a Stream-Safe Text. */ -#define U8_STREAM_SAFE_TEXT_MAX (128) - -/* - * The maximum number of characters in a combining/conjoining sequence and - * the actual upperbound limit of a combining/conjoining sequence. - */ -#define U8_MAX_CHARS_A_SEQ (32) -#define U8_UPPER_LIMIT_IN_A_SEQ (31) - -/* The combining class value for Starter. */ -#define U8_COMBINING_CLASS_STARTER (0) - -/* - * Some Hangul related macros at below. - * - * The first and the last of Hangul syllables, Hangul Jamo Leading consonants, - * Vowels, and optional Trailing consonants in Unicode scalar values. - * - * Please be noted that the U8_HANGUL_JAMO_T_FIRST is 0x11A7 at below not - * the actual U+11A8. This is due to that the trailing consonant is optional - * and thus we are doing a pre-calculation of subtracting one. - * - * Each of 19 modern leading consonants has total 588 possible syllables since - * Hangul has 21 modern vowels and 27 modern trailing consonants plus 1 for - * no trailing consonant case, i.e., 21 x 28 = 588. - * - * We also have bunch of Hangul related macros at below. Please bear in mind - * that the U8_HANGUL_JAMO_1ST_BYTE can be used to check whether it is - * a Hangul Jamo or not but the value does not guarantee that it is a Hangul - * Jamo; it just guarantee that it will be most likely. - */ -#define U8_HANGUL_SYL_FIRST (0xAC00U) -#define U8_HANGUL_SYL_LAST (0xD7A3U) - -#define U8_HANGUL_JAMO_L_FIRST (0x1100U) -#define U8_HANGUL_JAMO_L_LAST (0x1112U) -#define U8_HANGUL_JAMO_V_FIRST (0x1161U) -#define U8_HANGUL_JAMO_V_LAST (0x1175U) -#define U8_HANGUL_JAMO_T_FIRST (0x11A7U) -#define U8_HANGUL_JAMO_T_LAST (0x11C2U) - -#define U8_HANGUL_V_COUNT (21) -#define U8_HANGUL_VT_COUNT (588) -#define U8_HANGUL_T_COUNT (28) - -#define U8_HANGUL_JAMO_1ST_BYTE (0xE1U) - -#define U8_SAVE_HANGUL_AS_UTF8(s, i, j, k, b) \ - (s)[(i)] = (uchar_t)(0xE0U | ((uint32_t)(b) & 0xF000U) >> 12); \ - (s)[(j)] = (uchar_t)(0x80U | ((uint32_t)(b) & 0x0FC0U) >> 6); \ - (s)[(k)] = (uchar_t)(0x80U | ((uint32_t)(b) & 0x003FU)); - -#define U8_HANGUL_JAMO_L(u) \ - ((u) >= U8_HANGUL_JAMO_L_FIRST && (u) <= U8_HANGUL_JAMO_L_LAST) - -#define U8_HANGUL_JAMO_V(u) \ - ((u) >= U8_HANGUL_JAMO_V_FIRST && (u) <= U8_HANGUL_JAMO_V_LAST) - -#define U8_HANGUL_JAMO_T(u) \ - ((u) > U8_HANGUL_JAMO_T_FIRST && (u) <= U8_HANGUL_JAMO_T_LAST) - -#define U8_HANGUL_JAMO(u) \ - ((u) >= U8_HANGUL_JAMO_L_FIRST && (u) <= U8_HANGUL_JAMO_T_LAST) - -#define U8_HANGUL_SYLLABLE(u) \ - ((u) >= U8_HANGUL_SYL_FIRST && (u) <= U8_HANGUL_SYL_LAST) - -#define U8_HANGUL_COMPOSABLE_L_V(s, u) \ - ((s) == U8_STATE_HANGUL_L && U8_HANGUL_JAMO_V((u))) - -#define U8_HANGUL_COMPOSABLE_LV_T(s, u) \ - ((s) == U8_STATE_HANGUL_LV && U8_HANGUL_JAMO_T((u))) - -/* The types of decomposition mappings. */ -#define U8_DECOMP_BOTH (0xF5U) -#define U8_DECOMP_CANONICAL (0xF6U) - -/* The indicator for 16-bit table. */ -#define U8_16BIT_TABLE_INDICATOR (0x8000U) - -/* The following are some convenience macros. */ -#define U8_PUT_3BYTES_INTO_UTF32(u, b1, b2, b3) \ - (u) = ((((uint32_t)(b1) & 0x0F) << 12) | \ - (((uint32_t)(b2) & 0x3F) << 6) | \ - ((uint32_t)(b3) & 0x3F)); -#define U8_SIMPLE_SWAP(a, b, t) \ - (t) = (a); \ - (a) = (b); \ - (b) = (t); - -#define U8_ASCII_TOUPPER(c) \ - (((c) >= 'a' && (c) <= 'z') ? (c) - 'a' + 'A' : (c)) - -#define U8_ASCII_TOLOWER(c) \ - (((c) >= 'A' && (c) <= 'Z') ? (c) - 'A' + 'a' : (c)) - -#define U8_ISASCII(c) (((uchar_t)(c)) < 0x80U) -/* - * The following macro assumes that the two characters that are to be - * swapped are adjacent to each other and 'a' comes before 'b'. - * - * If the assumptions are not met, then, the macro will fail. - */ -#define U8_SWAP_COMB_MARKS(a, b) \ - for (k = 0; k < disp[(a)]; k++) \ - u8t[k] = u8s[start[(a)] + k]; \ - for (k = 0; k < disp[(b)]; k++) \ - u8s[start[(a)] + k] = u8s[start[(b)] + k]; \ - start[(b)] = start[(a)] + disp[(b)]; \ - for (k = 0; k < disp[(a)]; k++) \ - u8s[start[(b)] + k] = u8t[k]; \ - U8_SIMPLE_SWAP(comb_class[(a)], comb_class[(b)], tc); \ - U8_SIMPLE_SWAP(disp[(a)], disp[(b)], tc); - -/* The possible states during normalization. */ -typedef enum { - U8_STATE_START = 0, - U8_STATE_HANGUL_L = 1, - U8_STATE_HANGUL_LV = 2, - U8_STATE_HANGUL_LVT = 3, - U8_STATE_HANGUL_V = 4, - U8_STATE_HANGUL_T = 5, - U8_STATE_COMBINING_MARK = 6 -} u8_normalization_states_t; - -/* - * The three vectors at below are used to check bytes of a given UTF-8 - * character are valid and not containing any malformed byte values. - * - * We used to have a quite relaxed UTF-8 binary representation but then there - * was some security related issues and so the Unicode Consortium defined - * and announced the UTF-8 Corrigendum at Unicode 3.1 and then refined it - * one more time at the Unicode 3.2. The following three tables are based on - * that. - */ - -#define U8_ILLEGAL_NEXT_BYTE_COMMON(c) ((c) < 0x80 || (c) > 0xBF) - -#define I_ U8_ILLEGAL_CHAR -#define O_ U8_OUT_OF_RANGE_CHAR - -const int8_t u8_number_of_bytes[0x100] = { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - -/* 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F */ - I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, - -/* 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F */ - I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, - -/* A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF */ - I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, - -/* B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF */ - I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, - -/* C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF */ - I_, I_, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - -/* D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF */ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - -/* E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF */ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - -/* F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF */ - 4, 4, 4, 4, 4, O_, O_, O_, O_, O_, O_, O_, O_, O_, O_, O_, -}; - -#undef I_ -#undef O_ - -const uint8_t u8_valid_min_2nd_byte[0x100] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -/* C0 C1 C2 C3 C4 C5 C6 C7 */ - 0, 0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* C8 C9 CA CB CC CD CE CF */ - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* D0 D1 D2 D3 D4 D5 D6 D7 */ - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* D8 D9 DA DB DC DD DE DF */ - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* E0 E1 E2 E3 E4 E5 E6 E7 */ - 0xa0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* E8 E9 EA EB EC ED EE EF */ - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* F0 F1 F2 F3 F4 F5 F6 F7 */ - 0x90, 0x80, 0x80, 0x80, 0x80, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -}; - -const uint8_t u8_valid_max_2nd_byte[0x100] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -/* C0 C1 C2 C3 C4 C5 C6 C7 */ - 0, 0, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, -/* C8 C9 CA CB CC CD CE CF */ - 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, -/* D0 D1 D2 D3 D4 D5 D6 D7 */ - 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, -/* D8 D9 DA DB DC DD DE DF */ - 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, -/* E0 E1 E2 E3 E4 E5 E6 E7 */ - 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, -/* E8 E9 EA EB EC ED EE EF */ - 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0x9f, 0xbf, 0xbf, -/* F0 F1 F2 F3 F4 F5 F6 F7 */ - 0xbf, 0xbf, 0xbf, 0xbf, 0x8f, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -}; - - -/* - * The u8_validate() validates on the given UTF-8 character string and - * calculate the byte length. It is quite similar to mblen(3C) except that - * this will validate against the list of characters if required and - * specific to UTF-8 and Unicode. - */ -int -u8_validate(char *u8str, size_t n, char **list, int flag, int *errnum) -{ - uchar_t *ib; - uchar_t *ibtail; - uchar_t **p; - uchar_t *s1; - uchar_t *s2; - uchar_t f; - int sz; - size_t i; - int ret_val; - boolean_t second; - boolean_t no_need_to_validate_entire; - boolean_t check_additional; - boolean_t validate_ucs2_range_only; - - if (! u8str) - return (0); - - ib = (uchar_t *)u8str; - ibtail = ib + n; - - ret_val = 0; - - no_need_to_validate_entire = ! (flag & U8_VALIDATE_ENTIRE); - check_additional = flag & U8_VALIDATE_CHECK_ADDITIONAL; - validate_ucs2_range_only = flag & U8_VALIDATE_UCS2_RANGE; - - while (ib < ibtail) { - /* - * The first byte of a UTF-8 character tells how many - * bytes will follow for the character. If the first byte - * is an illegal byte value or out of range value, we just - * return -1 with an appropriate error number. - */ - sz = u8_number_of_bytes[*ib]; - if (sz == U8_ILLEGAL_CHAR) { - *errnum = EILSEQ; - return (-1); - } - - if (sz == U8_OUT_OF_RANGE_CHAR || - (validate_ucs2_range_only && sz > U8_MAX_BYTES_UCS2)) { - *errnum = ERANGE; - return (-1); - } - - /* - * If we don't have enough bytes to check on, that's also - * an error. As you can see, we give illegal byte sequence - * checking higher priority then EINVAL cases. - */ - if ((ibtail - ib) < sz) { - *errnum = EINVAL; - return (-1); - } - - if (sz == 1) { - ib++; - ret_val++; - } else { - /* - * Check on the multi-byte UTF-8 character. For more - * details on this, see comment added for the used - * data structures at the beginning of the file. - */ - f = *ib++; - ret_val++; - second = B_TRUE; - for (i = 1; i < sz; i++) { - if (second) { - if (*ib < u8_valid_min_2nd_byte[f] || - *ib > u8_valid_max_2nd_byte[f]) { - *errnum = EILSEQ; - return (-1); - } - second = B_FALSE; - } else if (U8_ILLEGAL_NEXT_BYTE_COMMON(*ib)) { - *errnum = EILSEQ; - return (-1); - } - ib++; - ret_val++; - } - } - - if (check_additional) { - for (p = (uchar_t **)list, i = 0; p[i]; i++) { - s1 = ib - sz; - s2 = p[i]; - while (s1 < ib) { - if (*s1 != *s2 || *s2 == '\0') - break; - s1++; - s2++; - } - - if (s1 >= ib && *s2 == '\0') { - *errnum = EBADF; - return (-1); - } - } - } - - if (no_need_to_validate_entire) - break; - } - - return (ret_val); -} - -/* - * The do_case_conv() looks at the mapping tables and returns found - * bytes if any. If not found, the input bytes are returned. The function - * always terminate the return bytes with a null character assuming that - * there are plenty of room to do so. - * - * The case conversions are simple case conversions mapping a character to - * another character as specified in the Unicode data. The byte size of - * the mapped character could be different from that of the input character. - * - * The return value is the byte length of the returned character excluding - * the terminating null byte. - */ -static size_t -do_case_conv(int uv, uchar_t *u8s, uchar_t *s, int sz, boolean_t is_it_toupper) -{ - size_t i; - uint16_t b1 = 0; - uint16_t b2 = 0; - uint16_t b3 = 0; - uint16_t b3_tbl; - uint16_t b3_base; - uint16_t b4 = 0; - size_t start_id; - size_t end_id; - - /* - * At this point, the only possible values for sz are 2, 3, and 4. - * The u8s should point to a vector that is well beyond the size of - * 5 bytes. - */ - if (sz == 2) { - b3 = u8s[0] = s[0]; - b4 = u8s[1] = s[1]; - } else if (sz == 3) { - b2 = u8s[0] = s[0]; - b3 = u8s[1] = s[1]; - b4 = u8s[2] = s[2]; - } else if (sz == 4) { - b1 = u8s[0] = s[0]; - b2 = u8s[1] = s[1]; - b3 = u8s[2] = s[2]; - b4 = u8s[3] = s[3]; - } else { - /* This is not possible but just in case as a fallback. */ - if (is_it_toupper) - *u8s = U8_ASCII_TOUPPER(*s); - else - *u8s = U8_ASCII_TOLOWER(*s); - u8s[1] = '\0'; - - return (1); - } - u8s[sz] = '\0'; - - /* - * Let's find out if we have a corresponding character. - */ - b1 = u8_common_b1_tbl[uv][b1]; - if (b1 == U8_TBL_ELEMENT_NOT_DEF) - return ((size_t)sz); - - b2 = u8_case_common_b2_tbl[uv][b1][b2]; - if (b2 == U8_TBL_ELEMENT_NOT_DEF) - return ((size_t)sz); - - if (is_it_toupper) { - b3_tbl = u8_toupper_b3_tbl[uv][b2][b3].tbl_id; - if (b3_tbl == U8_TBL_ELEMENT_NOT_DEF) - return ((size_t)sz); - - start_id = u8_toupper_b4_tbl[uv][b3_tbl][b4]; - end_id = u8_toupper_b4_tbl[uv][b3_tbl][b4 + 1]; - - /* Either there is no match or an error at the table. */ - if (start_id >= end_id || (end_id - start_id) > U8_MB_CUR_MAX) - return ((size_t)sz); - - b3_base = u8_toupper_b3_tbl[uv][b2][b3].base; - - for (i = 0; start_id < end_id; start_id++) - u8s[i++] = u8_toupper_final_tbl[uv][b3_base + start_id]; - } else { - b3_tbl = u8_tolower_b3_tbl[uv][b2][b3].tbl_id; - if (b3_tbl == U8_TBL_ELEMENT_NOT_DEF) - return ((size_t)sz); - - start_id = u8_tolower_b4_tbl[uv][b3_tbl][b4]; - end_id = u8_tolower_b4_tbl[uv][b3_tbl][b4 + 1]; - - if (start_id >= end_id || (end_id - start_id) > U8_MB_CUR_MAX) - return ((size_t)sz); - - b3_base = u8_tolower_b3_tbl[uv][b2][b3].base; - - for (i = 0; start_id < end_id; start_id++) - u8s[i++] = u8_tolower_final_tbl[uv][b3_base + start_id]; - } - - /* - * If i is still zero, that means there is no corresponding character. - */ - if (i == 0) - return ((size_t)sz); - - u8s[i] = '\0'; - - return (i); -} - -/* - * The do_case_compare() function compares the two input strings, s1 and s2, - * one character at a time doing case conversions if applicable and return - * the comparison result as like strcmp(). - * - * Since, in empirical sense, most of text data are 7-bit ASCII characters, - * we treat the 7-bit ASCII characters as a special case trying to yield - * faster processing time. - */ -static int -do_case_compare(size_t uv, uchar_t *s1, uchar_t *s2, size_t n1, - size_t n2, boolean_t is_it_toupper, int *errnum) -{ - int f; - int sz1; - int sz2; - size_t j; - size_t i1; - size_t i2; - uchar_t u8s1[U8_MB_CUR_MAX + 1]; - uchar_t u8s2[U8_MB_CUR_MAX + 1]; - - i1 = i2 = 0; - while (i1 < n1 && i2 < n2) { - /* - * Find out what would be the byte length for this UTF-8 - * character at string s1 and also find out if this is - * an illegal start byte or not and if so, issue a proper - * error number and yet treat this byte as a character. - */ - sz1 = u8_number_of_bytes[*s1]; - if (sz1 < 0) { - *errnum = EILSEQ; - sz1 = 1; - } - - /* - * For 7-bit ASCII characters mainly, we do a quick case - * conversion right at here. - * - * If we don't have enough bytes for this character, issue - * an EINVAL error and use what are available. - * - * If we have enough bytes, find out if there is - * a corresponding uppercase character and if so, copy over - * the bytes for a comparison later. If there is no - * corresponding uppercase character, then, use what we have - * for the comparison. - */ - if (sz1 == 1) { - if (is_it_toupper) - u8s1[0] = U8_ASCII_TOUPPER(*s1); - else - u8s1[0] = U8_ASCII_TOLOWER(*s1); - s1++; - u8s1[1] = '\0'; - } else if ((i1 + sz1) > n1) { - *errnum = EINVAL; - for (j = 0; (i1 + j) < n1; ) - u8s1[j++] = *s1++; - u8s1[j] = '\0'; - } else { - (void) do_case_conv(uv, u8s1, s1, sz1, is_it_toupper); - s1 += sz1; - } - - /* Do the same for the string s2. */ - sz2 = u8_number_of_bytes[*s2]; - if (sz2 < 0) { - *errnum = EILSEQ; - sz2 = 1; - } - - if (sz2 == 1) { - if (is_it_toupper) - u8s2[0] = U8_ASCII_TOUPPER(*s2); - else - u8s2[0] = U8_ASCII_TOLOWER(*s2); - s2++; - u8s2[1] = '\0'; - } else if ((i2 + sz2) > n2) { - *errnum = EINVAL; - for (j = 0; (i2 + j) < n2; ) - u8s2[j++] = *s2++; - u8s2[j] = '\0'; - } else { - (void) do_case_conv(uv, u8s2, s2, sz2, is_it_toupper); - s2 += sz2; - } - - /* Now compare the two characters. */ - if (sz1 == 1 && sz2 == 1) { - if (*u8s1 > *u8s2) - return (1); - if (*u8s1 < *u8s2) - return (-1); - } else { - f = strcmp((const char *)u8s1, (const char *)u8s2); - if (f != 0) - return (f); - } - - /* - * They were the same. Let's move on to the next - * characters then. - */ - i1 += sz1; - i2 += sz2; - } - - /* - * We compared until the end of either or both strings. - * - * If we reached to or went over the ends for the both, that means - * they are the same. - * - * If we reached only one of the two ends, that means the other string - * has something which then the fact can be used to determine - * the return value. - */ - if (i1 >= n1) { - if (i2 >= n2) - return (0); - return (-1); - } - return (1); -} - -/* - * The combining_class() function checks on the given bytes and find out - * the corresponding Unicode combining class value. The return value 0 means - * it is a Starter. Any illegal UTF-8 character will also be treated as - * a Starter. - */ -static uchar_t -combining_class(size_t uv, uchar_t *s, size_t sz) -{ - uint16_t b1 = 0; - uint16_t b2 = 0; - uint16_t b3 = 0; - uint16_t b4 = 0; - - if (sz == 1 || sz > 4) - return (0); - - if (sz == 2) { - b3 = s[0]; - b4 = s[1]; - } else if (sz == 3) { - b2 = s[0]; - b3 = s[1]; - b4 = s[2]; - } else if (sz == 4) { - b1 = s[0]; - b2 = s[1]; - b3 = s[2]; - b4 = s[3]; - } - - b1 = u8_common_b1_tbl[uv][b1]; - if (b1 == U8_TBL_ELEMENT_NOT_DEF) - return (0); - - b2 = u8_combining_class_b2_tbl[uv][b1][b2]; - if (b2 == U8_TBL_ELEMENT_NOT_DEF) - return (0); - - b3 = u8_combining_class_b3_tbl[uv][b2][b3]; - if (b3 == U8_TBL_ELEMENT_NOT_DEF) - return (0); - - return (u8_combining_class_b4_tbl[uv][b3][b4]); -} - -/* - * The do_decomp() function finds out a matching decomposition if any - * and return. If there is no match, the input bytes are copied and returned. - * The function also checks if there is a Hangul, decomposes it if necessary - * and returns. - * - * To save time, a single byte 7-bit ASCII character should be handled by - * the caller. - * - * The function returns the number of bytes returned sans always terminating - * the null byte. It will also return a state that will tell if there was - * a Hangul character decomposed which then will be used by the caller. - */ -static size_t -do_decomp(size_t uv, uchar_t *u8s, uchar_t *s, int sz, - boolean_t canonical_decomposition, u8_normalization_states_t *state) -{ - uint16_t b1 = 0; - uint16_t b2 = 0; - uint16_t b3 = 0; - uint16_t b3_tbl; - uint16_t b3_base; - uint16_t b4 = 0; - size_t start_id; - size_t end_id; - size_t i; - uint32_t u1; - - if (sz == 2) { - b3 = u8s[0] = s[0]; - b4 = u8s[1] = s[1]; - u8s[2] = '\0'; - } else if (sz == 3) { - /* Convert it to a Unicode scalar value. */ - U8_PUT_3BYTES_INTO_UTF32(u1, s[0], s[1], s[2]); - - /* - * If this is a Hangul syllable, we decompose it into - * a leading consonant, a vowel, and an optional trailing - * consonant and then return. - */ - if (U8_HANGUL_SYLLABLE(u1)) { - u1 -= U8_HANGUL_SYL_FIRST; - - b1 = U8_HANGUL_JAMO_L_FIRST + u1 / U8_HANGUL_VT_COUNT; - b2 = U8_HANGUL_JAMO_V_FIRST + (u1 % U8_HANGUL_VT_COUNT) - / U8_HANGUL_T_COUNT; - b3 = u1 % U8_HANGUL_T_COUNT; - - U8_SAVE_HANGUL_AS_UTF8(u8s, 0, 1, 2, b1); - U8_SAVE_HANGUL_AS_UTF8(u8s, 3, 4, 5, b2); - if (b3) { - b3 += U8_HANGUL_JAMO_T_FIRST; - U8_SAVE_HANGUL_AS_UTF8(u8s, 6, 7, 8, b3); - - u8s[9] = '\0'; - *state = U8_STATE_HANGUL_LVT; - return (9); - } - - u8s[6] = '\0'; - *state = U8_STATE_HANGUL_LV; - return (6); - } - - b2 = u8s[0] = s[0]; - b3 = u8s[1] = s[1]; - b4 = u8s[2] = s[2]; - u8s[3] = '\0'; - - /* - * If this is a Hangul Jamo, we know there is nothing - * further that we can decompose. - */ - if (U8_HANGUL_JAMO_L(u1)) { - *state = U8_STATE_HANGUL_L; - return (3); - } - - if (U8_HANGUL_JAMO_V(u1)) { - if (*state == U8_STATE_HANGUL_L) - *state = U8_STATE_HANGUL_LV; - else - *state = U8_STATE_HANGUL_V; - return (3); - } - - if (U8_HANGUL_JAMO_T(u1)) { - if (*state == U8_STATE_HANGUL_LV) - *state = U8_STATE_HANGUL_LVT; - else - *state = U8_STATE_HANGUL_T; - return (3); - } - } else if (sz == 4) { - b1 = u8s[0] = s[0]; - b2 = u8s[1] = s[1]; - b3 = u8s[2] = s[2]; - b4 = u8s[3] = s[3]; - u8s[4] = '\0'; - } else { - /* - * This is a fallback and should not happen if the function - * was called properly. - */ - u8s[0] = s[0]; - u8s[1] = '\0'; - *state = U8_STATE_START; - return (1); - } - - /* - * At this point, this rountine does not know what it would get. - * The caller should sort it out if the state isn't a Hangul one. - */ - *state = U8_STATE_START; - - /* Try to find matching decomposition mapping byte sequence. */ - b1 = u8_common_b1_tbl[uv][b1]; - if (b1 == U8_TBL_ELEMENT_NOT_DEF) - return ((size_t)sz); - - b2 = u8_decomp_b2_tbl[uv][b1][b2]; - if (b2 == U8_TBL_ELEMENT_NOT_DEF) - return ((size_t)sz); - - b3_tbl = u8_decomp_b3_tbl[uv][b2][b3].tbl_id; - if (b3_tbl == U8_TBL_ELEMENT_NOT_DEF) - return ((size_t)sz); - - /* - * If b3_tbl is bigger than or equal to U8_16BIT_TABLE_INDICATOR - * which is 0x8000, this means we couldn't fit the mappings into - * the cardinality of a unsigned byte. - */ - if (b3_tbl >= U8_16BIT_TABLE_INDICATOR) { - b3_tbl -= U8_16BIT_TABLE_INDICATOR; - start_id = u8_decomp_b4_16bit_tbl[uv][b3_tbl][b4]; - end_id = u8_decomp_b4_16bit_tbl[uv][b3_tbl][b4 + 1]; - } else { - start_id = u8_decomp_b4_tbl[uv][b3_tbl][b4]; - end_id = u8_decomp_b4_tbl[uv][b3_tbl][b4 + 1]; - } - - /* This also means there wasn't any matching decomposition. */ - if (start_id >= end_id) - return ((size_t)sz); - - /* - * The final table for decomposition mappings has three types of - * byte sequences depending on whether a mapping is for compatibility - * decomposition, canonical decomposition, or both like the following: - * - * (1) Compatibility decomposition mappings: - * - * +---+---+-...-+---+ - * | B0| B1| ... | Bm| - * +---+---+-...-+---+ - * - * The first byte, B0, is always less then 0xF5 (U8_DECOMP_BOTH). - * - * (2) Canonical decomposition mappings: - * - * +---+---+---+-...-+---+ - * | T | b0| b1| ... | bn| - * +---+---+---+-...-+---+ - * - * where the first byte, T, is 0xF6 (U8_DECOMP_CANONICAL). - * - * (3) Both mappings: - * - * +---+---+---+---+-...-+---+---+---+-...-+---+ - * | T | D | b0| b1| ... | bn| B0| B1| ... | Bm| - * +---+---+---+---+-...-+---+---+---+-...-+---+ - * - * where T is 0xF5 (U8_DECOMP_BOTH) and D is a displacement - * byte, b0 to bn are canonical mapping bytes and B0 to Bm are - * compatibility mapping bytes. - * - * Note that compatibility decomposition means doing recursive - * decompositions using both compatibility decomposition mappings and - * canonical decomposition mappings. On the other hand, canonical - * decomposition means doing recursive decompositions using only - * canonical decomposition mappings. Since the table we have has gone - * through the recursions already, we do not need to do so during - * runtime, i.e., the table has been completely flattened out - * already. - */ - - b3_base = u8_decomp_b3_tbl[uv][b2][b3].base; - - /* Get the type, T, of the byte sequence. */ - b1 = u8_decomp_final_tbl[uv][b3_base + start_id]; - - /* - * If necessary, adjust start_id, end_id, or both. Note that if - * this is compatibility decomposition mapping, there is no - * adjustment. - */ - if (canonical_decomposition) { - /* Is the mapping only for compatibility decomposition? */ - if (b1 < U8_DECOMP_BOTH) - return ((size_t)sz); - - start_id++; - - if (b1 == U8_DECOMP_BOTH) { - end_id = start_id + - u8_decomp_final_tbl[uv][b3_base + start_id]; - start_id++; - } - } else { - /* - * Unless this is a compatibility decomposition mapping, - * we adjust the start_id. - */ - if (b1 == U8_DECOMP_BOTH) { - start_id++; - start_id += u8_decomp_final_tbl[uv][b3_base + start_id]; - } else if (b1 == U8_DECOMP_CANONICAL) { - start_id++; - } - } - - for (i = 0; start_id < end_id; start_id++) - u8s[i++] = u8_decomp_final_tbl[uv][b3_base + start_id]; - u8s[i] = '\0'; - - return (i); -} - -/* - * The find_composition_start() function uses the character bytes given and - * find out the matching composition mappings if any and return the address - * to the composition mappings as explained in the do_composition(). - */ -static uchar_t * -find_composition_start(size_t uv, uchar_t *s, size_t sz) -{ - uint16_t b1 = 0; - uint16_t b2 = 0; - uint16_t b3 = 0; - uint16_t b3_tbl; - uint16_t b3_base; - uint16_t b4 = 0; - size_t start_id; - size_t end_id; - - if (sz == 1) { - b4 = s[0]; - } else if (sz == 2) { - b3 = s[0]; - b4 = s[1]; - } else if (sz == 3) { - b2 = s[0]; - b3 = s[1]; - b4 = s[2]; - } else if (sz == 4) { - b1 = s[0]; - b2 = s[1]; - b3 = s[2]; - b4 = s[3]; - } else { - /* - * This is a fallback and should not happen if the function - * was called properly. - */ - return (NULL); - } - - b1 = u8_composition_b1_tbl[uv][b1]; - if (b1 == U8_TBL_ELEMENT_NOT_DEF) - return (NULL); - - b2 = u8_composition_b2_tbl[uv][b1][b2]; - if (b2 == U8_TBL_ELEMENT_NOT_DEF) - return (NULL); - - b3_tbl = u8_composition_b3_tbl[uv][b2][b3].tbl_id; - if (b3_tbl == U8_TBL_ELEMENT_NOT_DEF) - return (NULL); - - if (b3_tbl >= U8_16BIT_TABLE_INDICATOR) { - b3_tbl -= U8_16BIT_TABLE_INDICATOR; - start_id = u8_composition_b4_16bit_tbl[uv][b3_tbl][b4]; - end_id = u8_composition_b4_16bit_tbl[uv][b3_tbl][b4 + 1]; - } else { - start_id = u8_composition_b4_tbl[uv][b3_tbl][b4]; - end_id = u8_composition_b4_tbl[uv][b3_tbl][b4 + 1]; - } - - if (start_id >= end_id) - return (NULL); - - b3_base = u8_composition_b3_tbl[uv][b2][b3].base; - - return ((uchar_t *)&(u8_composition_final_tbl[uv][b3_base + start_id])); -} - -/* - * The blocked() function checks on the combining class values of previous - * characters in this sequence and return whether it is blocked or not. - */ -static boolean_t -blocked(uchar_t *comb_class, size_t last) -{ - uchar_t my_comb_class; - size_t i; - - my_comb_class = comb_class[last]; - for (i = 1; i < last; i++) - if (comb_class[i] >= my_comb_class || - comb_class[i] == U8_COMBINING_CLASS_STARTER) - return (B_TRUE); - - return (B_FALSE); -} - -/* - * The do_composition() reads the character string pointed by 's' and - * do necessary canonical composition and then copy over the result back to - * the 's'. - * - * The input argument 's' cannot contain more than 32 characters. - */ -static size_t -do_composition(size_t uv, uchar_t *s, uchar_t *comb_class, uchar_t *start, - uchar_t *disp, size_t last, uchar_t **os, uchar_t *oslast) -{ - uchar_t t[U8_STREAM_SAFE_TEXT_MAX + 1]; - uchar_t tc[U8_MB_CUR_MAX]; - uint8_t saved_marks[U8_MAX_CHARS_A_SEQ]; - size_t saved_marks_count; - uchar_t *p; - uchar_t *saved_p; - uchar_t *q; - size_t i; - size_t saved_i; - size_t j; - size_t k; - size_t l; - size_t C; - size_t saved_l; - size_t size; - uint32_t u1; - uint32_t u2; - boolean_t match_not_found = B_TRUE; - - /* - * This should never happen unless the callers are doing some strange - * and unexpected things. - * - * The "last" is the index pointing to the last character not last + 1. - */ - if (last >= U8_MAX_CHARS_A_SEQ) - last = U8_UPPER_LIMIT_IN_A_SEQ; - - for (i = l = 0; i <= last; i++) { - /* - * The last or any non-Starters at the beginning, we don't - * have any chance to do composition and so we just copy them - * to the temporary buffer. - */ - if (i >= last || comb_class[i] != U8_COMBINING_CLASS_STARTER) { -SAVE_THE_CHAR: - p = s + start[i]; - size = disp[i]; - for (k = 0; k < size; k++) - t[l++] = *p++; - continue; - } - - /* - * If this could be a start of Hangul Jamos, then, we try to - * conjoin them. - */ - if (s[start[i]] == U8_HANGUL_JAMO_1ST_BYTE) { - U8_PUT_3BYTES_INTO_UTF32(u1, s[start[i]], - s[start[i] + 1], s[start[i] + 2]); - U8_PUT_3BYTES_INTO_UTF32(u2, s[start[i] + 3], - s[start[i] + 4], s[start[i] + 5]); - - if (U8_HANGUL_JAMO_L(u1) && U8_HANGUL_JAMO_V(u2)) { - u1 -= U8_HANGUL_JAMO_L_FIRST; - u2 -= U8_HANGUL_JAMO_V_FIRST; - u1 = U8_HANGUL_SYL_FIRST + - (u1 * U8_HANGUL_V_COUNT + u2) * - U8_HANGUL_T_COUNT; - - i += 2; - if (i <= last) { - U8_PUT_3BYTES_INTO_UTF32(u2, - s[start[i]], s[start[i] + 1], - s[start[i] + 2]); - - if (U8_HANGUL_JAMO_T(u2)) { - u1 += u2 - - U8_HANGUL_JAMO_T_FIRST; - i++; - } - } - - U8_SAVE_HANGUL_AS_UTF8(t + l, 0, 1, 2, u1); - i--; - l += 3; - continue; - } - } - - /* - * Let's then find out if this Starter has composition - * mapping. - */ - p = find_composition_start(uv, s + start[i], disp[i]); - if (p == NULL) - goto SAVE_THE_CHAR; - - /* - * We have a Starter with composition mapping and the next - * character is a non-Starter. Let's try to find out if - * we can do composition. - */ - - saved_p = p; - saved_i = i; - saved_l = l; - saved_marks_count = 0; - -TRY_THE_NEXT_MARK: - q = s + start[++i]; - size = disp[i]; - - /* - * The next for() loop compares the non-Starter pointed by - * 'q' with the possible (joinable) characters pointed by 'p'. - * - * The composition final table entry pointed by the 'p' - * looks like the following: - * - * +---+---+---+-...-+---+---+---+---+-...-+---+---+ - * | C | b0| b2| ... | bn| F | B0| B1| ... | Bm| F | - * +---+---+---+-...-+---+---+---+---+-...-+---+---+ - * - * where C is the count byte indicating the number of - * mapping pairs where each pair would be look like - * (b0-bn F, B0-Bm F). The b0-bn are the bytes of the second - * character of a canonical decomposition and the B0-Bm are - * the bytes of a matching composite character. The F is - * a filler byte after each character as the separator. - */ - - match_not_found = B_TRUE; - - for (C = *p++; C > 0; C--) { - for (k = 0; k < size; p++, k++) - if (*p != q[k]) - break; - - /* Have we found it? */ - if (k >= size && *p == U8_TBL_ELEMENT_FILLER) { - match_not_found = B_FALSE; - - l = saved_l; - - while (*++p != U8_TBL_ELEMENT_FILLER) - t[l++] = *p; - - break; - } - - /* We didn't find; skip to the next pair. */ - if (*p != U8_TBL_ELEMENT_FILLER) - while (*++p != U8_TBL_ELEMENT_FILLER) - ; - while (*++p != U8_TBL_ELEMENT_FILLER) - ; - p++; - } - - /* - * If there was no match, we will need to save the combining - * mark for later appending. After that, if the next one - * is a non-Starter and not blocked, then, we try once - * again to do composition with the next non-Starter. - * - * If there was no match and this was a Starter, then, - * this is a new start. - * - * If there was a match and a composition done and we have - * more to check on, then, we retrieve a new composition final - * table entry for the composite and then try to do the - * composition again. - */ - - if (match_not_found) { - if (comb_class[i] == U8_COMBINING_CLASS_STARTER) { - i--; - goto SAVE_THE_CHAR; - } - - saved_marks[saved_marks_count++] = i; - } - - if (saved_l == l) { - while (i < last) { - if (blocked(comb_class, i + 1)) - saved_marks[saved_marks_count++] = ++i; - else - break; - } - if (i < last) { - p = saved_p; - goto TRY_THE_NEXT_MARK; - } - } else if (i < last) { - p = find_composition_start(uv, t + saved_l, - l - saved_l); - if (p != NULL) { - saved_p = p; - goto TRY_THE_NEXT_MARK; - } - } - - /* - * There is no more composition possible. - * - * If there was no composition what so ever then we copy - * over the original Starter and then append any non-Starters - * remaining at the target string sequentially after that. - */ - - if (saved_l == l) { - p = s + start[saved_i]; - size = disp[saved_i]; - for (j = 0; j < size; j++) - t[l++] = *p++; - } - - for (k = 0; k < saved_marks_count; k++) { - p = s + start[saved_marks[k]]; - size = disp[saved_marks[k]]; - for (j = 0; j < size; j++) - t[l++] = *p++; - } - } - - /* - * If the last character is a Starter and if we have a character - * (possibly another Starter) that can be turned into a composite, - * we do so and we do so until there is no more of composition - * possible. - */ - if (comb_class[last] == U8_COMBINING_CLASS_STARTER) { - p = *os; - saved_l = l - disp[last]; - - while (p < oslast) { - size = u8_number_of_bytes[*p]; - if (size <= 1 || (p + size) > oslast) - break; - - saved_p = p; - - for (i = 0; i < size; i++) - tc[i] = *p++; - - q = find_composition_start(uv, t + saved_l, - l - saved_l); - if (q == NULL) { - p = saved_p; - break; - } - - match_not_found = B_TRUE; - - for (C = *q++; C > 0; C--) { - for (k = 0; k < size; q++, k++) - if (*q != tc[k]) - break; - - if (k >= size && *q == U8_TBL_ELEMENT_FILLER) { - match_not_found = B_FALSE; - - l = saved_l; - - while (*++q != U8_TBL_ELEMENT_FILLER) { - /* - * This is practically - * impossible but we don't - * want to take any chances. - */ - if (l >= - U8_STREAM_SAFE_TEXT_MAX) { - p = saved_p; - goto SAFE_RETURN; - } - t[l++] = *q; - } - - break; - } - - if (*q != U8_TBL_ELEMENT_FILLER) - while (*++q != U8_TBL_ELEMENT_FILLER) - ; - while (*++q != U8_TBL_ELEMENT_FILLER) - ; - q++; - } - - if (match_not_found) { - p = saved_p; - break; - } - } -SAFE_RETURN: - *os = p; - } - - /* - * Now we copy over the temporary string to the target string. - * Since composition always reduces the number of characters or - * the number of characters stay, we don't need to worry about - * the buffer overflow here. - */ - for (i = 0; i < l; i++) - s[i] = t[i]; - s[l] = '\0'; - - return (l); -} - -/* - * The collect_a_seq() function checks on the given string s, collect - * a sequence of characters at u8s, and return the sequence. While it collects - * a sequence, it also applies case conversion, canonical or compatibility - * decomposition, canonical decomposition, or some or all of them and - * in that order. - * - * The collected sequence cannot be bigger than 32 characters since if - * it is having more than 31 characters, the sequence will be terminated - * with a U+034F COMBINING GRAPHEME JOINER (CGJ) character and turned into - * a Stream-Safe Text. The collected sequence is always terminated with - * a null byte and the return value is the byte length of the sequence - * including 0. The return value does not include the terminating - * null byte. - */ -static size_t -collect_a_seq(size_t uv, uchar_t *u8s, uchar_t **source, uchar_t *slast, - boolean_t is_it_toupper, - boolean_t is_it_tolower, - boolean_t canonical_decomposition, - boolean_t compatibility_decomposition, - boolean_t canonical_composition, - int *errnum, u8_normalization_states_t *state) -{ - uchar_t *s; - int sz; - int saved_sz; - size_t i; - size_t j; - size_t k; - size_t l; - uchar_t comb_class[U8_MAX_CHARS_A_SEQ]; - uchar_t disp[U8_MAX_CHARS_A_SEQ]; - uchar_t start[U8_MAX_CHARS_A_SEQ]; - uchar_t u8t[U8_MB_CUR_MAX]; - uchar_t uts[U8_STREAM_SAFE_TEXT_MAX + 1]; - uchar_t tc; - size_t last; - size_t saved_last; - uint32_t u1; - - /* - * Save the source string pointer which we will return a changed - * pointer if we do processing. - */ - s = *source; - - /* - * The following is a fallback for just in case callers are not - * checking the string boundaries before the calling. - */ - if (s >= slast) { - u8s[0] = '\0'; - - return (0); - } - - /* - * As the first thing, let's collect a character and do case - * conversion if necessary. - */ - - sz = u8_number_of_bytes[*s]; - - if (sz < 0) { - *errnum = EILSEQ; - - u8s[0] = *s++; - u8s[1] = '\0'; - - *source = s; - - return (1); - } - - if (sz == 1) { - if (is_it_toupper) - u8s[0] = U8_ASCII_TOUPPER(*s); - else if (is_it_tolower) - u8s[0] = U8_ASCII_TOLOWER(*s); - else - u8s[0] = *s; - s++; - u8s[1] = '\0'; - } else if ((s + sz) > slast) { - *errnum = EINVAL; - - for (i = 0; s < slast; ) - u8s[i++] = *s++; - u8s[i] = '\0'; - - *source = s; - - return (i); - } else { - if (is_it_toupper || is_it_tolower) { - i = do_case_conv(uv, u8s, s, sz, is_it_toupper); - s += sz; - sz = i; - } else { - for (i = 0; i < sz; ) - u8s[i++] = *s++; - u8s[i] = '\0'; - } - } - - /* - * And then canonical/compatibility decomposition followed by - * an optional canonical composition. Please be noted that - * canonical composition is done only when a decomposition is - * done. - */ - if (canonical_decomposition || compatibility_decomposition) { - if (sz == 1) { - *state = U8_STATE_START; - - saved_sz = 1; - - comb_class[0] = 0; - start[0] = 0; - disp[0] = 1; - - last = 1; - } else { - saved_sz = do_decomp(uv, u8s, u8s, sz, - canonical_decomposition, state); - - last = 0; - - for (i = 0; i < saved_sz; ) { - sz = u8_number_of_bytes[u8s[i]]; - - comb_class[last] = combining_class(uv, - u8s + i, sz); - start[last] = i; - disp[last] = sz; - - last++; - i += sz; - } - - /* - * Decomposition yields various Hangul related - * states but not on combining marks. We need to - * find out at here by checking on the last - * character. - */ - if (*state == U8_STATE_START) { - if (comb_class[last - 1]) - *state = U8_STATE_COMBINING_MARK; - } - } - - saved_last = last; - - while (s < slast) { - sz = u8_number_of_bytes[*s]; - - /* - * If this is an illegal character, an incomplete - * character, or an 7-bit ASCII Starter character, - * then we have collected a sequence; break and let - * the next call deal with the two cases. - * - * Note that this is okay only if you are using this - * function with a fixed length string, not on - * a buffer with multiple calls of one chunk at a time. - */ - if (sz <= 1) { - break; - } else if ((s + sz) > slast) { - break; - } else { - /* - * If the previous character was a Hangul Jamo - * and this character is a Hangul Jamo that - * can be conjoined, we collect the Jamo. - */ - if (*s == U8_HANGUL_JAMO_1ST_BYTE) { - U8_PUT_3BYTES_INTO_UTF32(u1, - *s, *(s + 1), *(s + 2)); - - if (U8_HANGUL_COMPOSABLE_L_V(*state, - u1)) { - i = 0; - *state = U8_STATE_HANGUL_LV; - goto COLLECT_A_HANGUL; - } - - if (U8_HANGUL_COMPOSABLE_LV_T(*state, - u1)) { - i = 0; - *state = U8_STATE_HANGUL_LVT; - goto COLLECT_A_HANGUL; - } - } - - /* - * Regardless of whatever it was, if this is - * a Starter, we don't collect the character - * since that's a new start and we will deal - * with it at the next time. - */ - i = combining_class(uv, s, sz); - if (i == U8_COMBINING_CLASS_STARTER) - break; - - /* - * We know the current character is a combining - * mark. If the previous character wasn't - * a Starter (not Hangul) or a combining mark, - * then, we don't collect this combining mark. - */ - if (*state != U8_STATE_START && - *state != U8_STATE_COMBINING_MARK) - break; - - *state = U8_STATE_COMBINING_MARK; -COLLECT_A_HANGUL: - /* - * If we collected a Starter and combining - * marks up to 30, i.e., total 31 characters, - * then, we terminate this degenerately long - * combining sequence with a U+034F COMBINING - * GRAPHEME JOINER (CGJ) which is 0xCD 0x8F in - * UTF-8 and turn this into a Stream-Safe - * Text. This will be extremely rare but - * possible. - * - * The following will also guarantee that - * we are not writing more than 32 characters - * plus a NULL at u8s[]. - */ - if (last >= U8_UPPER_LIMIT_IN_A_SEQ) { -TURN_STREAM_SAFE: - *state = U8_STATE_START; - comb_class[last] = 0; - start[last] = saved_sz; - disp[last] = 2; - last++; - - u8s[saved_sz++] = 0xCD; - u8s[saved_sz++] = 0x8F; - - break; - } - - /* - * Some combining marks also do decompose into - * another combining mark or marks. - */ - if (*state == U8_STATE_COMBINING_MARK) { - k = last; - l = sz; - i = do_decomp(uv, uts, s, sz, - canonical_decomposition, state); - for (j = 0; j < i; ) { - sz = u8_number_of_bytes[uts[j]]; - - comb_class[last] = - combining_class(uv, - uts + j, sz); - start[last] = saved_sz + j; - disp[last] = sz; - - last++; - if (last >= - U8_UPPER_LIMIT_IN_A_SEQ) { - last = k; - goto TURN_STREAM_SAFE; - } - j += sz; - } - - *state = U8_STATE_COMBINING_MARK; - sz = i; - s += l; - - for (i = 0; i < sz; i++) - u8s[saved_sz++] = uts[i]; - } else { - comb_class[last] = i; - start[last] = saved_sz; - disp[last] = sz; - last++; - - for (i = 0; i < sz; i++) - u8s[saved_sz++] = *s++; - } - - /* - * If this is U+0345 COMBINING GREEK - * YPOGEGRAMMENI (0xCD 0x85 in UTF-8), a.k.a., - * iota subscript, and need to be converted to - * uppercase letter, convert it to U+0399 GREEK - * CAPITAL LETTER IOTA (0xCE 0x99 in UTF-8), - * i.e., convert to capital adscript form as - * specified in the Unicode standard. - * - * This is the only special case of (ambiguous) - * case conversion at combining marks and - * probably the standard will never have - * anything similar like this in future. - */ - if (is_it_toupper && sz >= 2 && - u8s[saved_sz - 2] == 0xCD && - u8s[saved_sz - 1] == 0x85) { - u8s[saved_sz - 2] = 0xCE; - u8s[saved_sz - 1] = 0x99; - } - } - } - - /* - * Let's try to ensure a canonical ordering for the collected - * combining marks. We do this only if we have collected - * at least one more non-Starter. (The decomposition mapping - * data tables have fully (and recursively) expanded and - * canonically ordered decompositions.) - * - * The U8_SWAP_COMB_MARKS() convenience macro has some - * assumptions and we are meeting the assumptions. - */ - last--; - if (last >= saved_last) { - for (i = 0; i < last; i++) - for (j = last; j > i; j--) - if (comb_class[j] && - comb_class[j - 1] > comb_class[j]) { - U8_SWAP_COMB_MARKS(j - 1, j); - } - } - - *source = s; - - if (! canonical_composition) { - u8s[saved_sz] = '\0'; - return (saved_sz); - } - - /* - * Now do the canonical composition. Note that we do this - * only after a canonical or compatibility decomposition to - * finish up NFC or NFKC. - */ - sz = do_composition(uv, u8s, comb_class, start, disp, last, - &s, slast); - } - - *source = s; - - return ((size_t)sz); -} - -/* - * The do_norm_compare() function does string comparion based on Unicode - * simple case mappings and Unicode Normalization definitions. - * - * It does so by collecting a sequence of character at a time and comparing - * the collected sequences from the strings. - * - * The meanings on the return values are the same as the usual strcmp(). - */ -static int -do_norm_compare(size_t uv, uchar_t *s1, uchar_t *s2, size_t n1, size_t n2, - int flag, int *errnum) -{ - int result; - size_t sz1; - size_t sz2; - uchar_t u8s1[U8_STREAM_SAFE_TEXT_MAX + 1]; - uchar_t u8s2[U8_STREAM_SAFE_TEXT_MAX + 1]; - uchar_t *s1last; - uchar_t *s2last; - boolean_t is_it_toupper; - boolean_t is_it_tolower; - boolean_t canonical_decomposition; - boolean_t compatibility_decomposition; - boolean_t canonical_composition; - u8_normalization_states_t state; - - s1last = s1 + n1; - s2last = s2 + n2; - - is_it_toupper = flag & U8_TEXTPREP_TOUPPER; - is_it_tolower = flag & U8_TEXTPREP_TOLOWER; - canonical_decomposition = flag & U8_CANON_DECOMP; - compatibility_decomposition = flag & U8_COMPAT_DECOMP; - canonical_composition = flag & U8_CANON_COMP; - - while (s1 < s1last && s2 < s2last) { - /* - * If the current character is a 7-bit ASCII and the last - * character, or, if the current character and the next - * character are both some 7-bit ASCII characters then - * we treat the current character as a sequence. - * - * In any other cases, we need to call collect_a_seq(). - */ - - if (U8_ISASCII(*s1) && ((s1 + 1) >= s1last || - ((s1 + 1) < s1last && U8_ISASCII(*(s1 + 1))))) { - if (is_it_toupper) - u8s1[0] = U8_ASCII_TOUPPER(*s1); - else if (is_it_tolower) - u8s1[0] = U8_ASCII_TOLOWER(*s1); - else - u8s1[0] = *s1; - u8s1[1] = '\0'; - sz1 = 1; - s1++; - } else { - state = U8_STATE_START; - sz1 = collect_a_seq(uv, u8s1, &s1, s1last, - is_it_toupper, is_it_tolower, - canonical_decomposition, - compatibility_decomposition, - canonical_composition, errnum, &state); - } - - if (U8_ISASCII(*s2) && ((s2 + 1) >= s2last || - ((s2 + 1) < s2last && U8_ISASCII(*(s2 + 1))))) { - if (is_it_toupper) - u8s2[0] = U8_ASCII_TOUPPER(*s2); - else if (is_it_tolower) - u8s2[0] = U8_ASCII_TOLOWER(*s2); - else - u8s2[0] = *s2; - u8s2[1] = '\0'; - sz2 = 1; - s2++; - } else { - state = U8_STATE_START; - sz2 = collect_a_seq(uv, u8s2, &s2, s2last, - is_it_toupper, is_it_tolower, - canonical_decomposition, - compatibility_decomposition, - canonical_composition, errnum, &state); - } - - /* - * Now compare the two characters. If they are the same, - * we move on to the next character sequences. - */ - if (sz1 == 1 && sz2 == 1) { - if (*u8s1 > *u8s2) - return (1); - if (*u8s1 < *u8s2) - return (-1); - } else { - result = strcmp((const char *)u8s1, (const char *)u8s2); - if (result != 0) - return (result); - } - } - - /* - * We compared until the end of either or both strings. - * - * If we reached to or went over the ends for the both, that means - * they are the same. - * - * If we reached only one end, that means the other string has - * something which then can be used to determine the return value. - */ - if (s1 >= s1last) { - if (s2 >= s2last) - return (0); - return (-1); - } - return (1); -} - -/* - * The u8_strcmp() function compares two UTF-8 strings quite similar to - * the strcmp(). For the comparison, however, Unicode Normalization specific - * equivalency and Unicode simple case conversion mappings based equivalency - * can be requested and checked against. - */ -int -u8_strcmp(const char *s1, const char *s2, size_t n, int flag, size_t uv, - int *errnum) -{ - int f; - size_t n1; - size_t n2; - - *errnum = 0; - - /* - * Check on the requested Unicode version, case conversion, and - * normalization flag values. - */ - - if (uv > U8_UNICODE_LATEST) { - *errnum = ERANGE; - uv = U8_UNICODE_LATEST; - } - - if (flag == 0) { - flag = U8_STRCMP_CS; - } else { - f = flag & (U8_STRCMP_CS | U8_STRCMP_CI_UPPER | - U8_STRCMP_CI_LOWER); - if (f == 0) { - flag |= U8_STRCMP_CS; - } else if (f != U8_STRCMP_CS && f != U8_STRCMP_CI_UPPER && - f != U8_STRCMP_CI_LOWER) { - *errnum = EBADF; - flag = U8_STRCMP_CS; - } - - f = flag & (U8_CANON_DECOMP | U8_COMPAT_DECOMP | U8_CANON_COMP); - if (f && f != U8_STRCMP_NFD && f != U8_STRCMP_NFC && - f != U8_STRCMP_NFKD && f != U8_STRCMP_NFKC) { - *errnum = EBADF; - flag = U8_STRCMP_CS; - } - } - - if (flag == U8_STRCMP_CS) { - return (n == 0 ? strcmp(s1, s2) : strncmp(s1, s2, n)); - } - - n1 = strlen(s1); - n2 = strlen(s2); - if (n != 0) { - if (n < n1) - n1 = n; - if (n < n2) - n2 = n; - } - - /* - * Simple case conversion can be done much faster and so we do - * them separately here. - */ - if (flag == U8_STRCMP_CI_UPPER) { - return (do_case_compare(uv, (uchar_t *)s1, (uchar_t *)s2, - n1, n2, B_TRUE, errnum)); - } else if (flag == U8_STRCMP_CI_LOWER) { - return (do_case_compare(uv, (uchar_t *)s1, (uchar_t *)s2, - n1, n2, B_FALSE, errnum)); - } - - return (do_norm_compare(uv, (uchar_t *)s1, (uchar_t *)s2, n1, n2, - flag, errnum)); -} - -size_t -u8_textprep_str(char *inarray, size_t *inlen, char *outarray, size_t *outlen, - int flag, size_t unicode_version, int *errnum) -{ - int f; - int sz; - uchar_t *ib; - uchar_t *ibtail; - uchar_t *ob; - uchar_t *obtail; - boolean_t do_not_ignore_null; - boolean_t do_not_ignore_invalid; - boolean_t is_it_toupper; - boolean_t is_it_tolower; - boolean_t canonical_decomposition; - boolean_t compatibility_decomposition; - boolean_t canonical_composition; - size_t ret_val; - size_t i; - size_t j; - uchar_t u8s[U8_STREAM_SAFE_TEXT_MAX + 1]; - u8_normalization_states_t state; - - if (unicode_version > U8_UNICODE_LATEST) { - *errnum = ERANGE; - return ((size_t)-1); - } - - f = flag & (U8_TEXTPREP_TOUPPER | U8_TEXTPREP_TOLOWER); - if (f == (U8_TEXTPREP_TOUPPER | U8_TEXTPREP_TOLOWER)) { - *errnum = EBADF; - return ((size_t)-1); - } - - f = flag & (U8_CANON_DECOMP | U8_COMPAT_DECOMP | U8_CANON_COMP); - if (f && f != U8_TEXTPREP_NFD && f != U8_TEXTPREP_NFC && - f != U8_TEXTPREP_NFKD && f != U8_TEXTPREP_NFKC) { - *errnum = EBADF; - return ((size_t)-1); - } - - if (inarray == NULL || *inlen == 0) - return (0); - - if (outarray == NULL) { - *errnum = E2BIG; - return ((size_t)-1); - } - - ib = (uchar_t *)inarray; - ob = (uchar_t *)outarray; - ibtail = ib + *inlen; - obtail = ob + *outlen; - - do_not_ignore_null = !(flag & U8_TEXTPREP_IGNORE_NULL); - do_not_ignore_invalid = !(flag & U8_TEXTPREP_IGNORE_INVALID); - is_it_toupper = flag & U8_TEXTPREP_TOUPPER; - is_it_tolower = flag & U8_TEXTPREP_TOLOWER; - - ret_val = 0; - - /* - * If we don't have a normalization flag set, we do the simple case - * conversion based text preparation separately below. Text - * preparation involving Normalization will be done in the false task - * block, again, separately since it will take much more time and - * resource than doing simple case conversions. - */ - if (f == 0) { - while (ib < ibtail) { - if (*ib == '\0' && do_not_ignore_null) - break; - - sz = u8_number_of_bytes[*ib]; - - if (sz < 0) { - if (do_not_ignore_invalid) { - *errnum = EILSEQ; - ret_val = (size_t)-1; - break; - } - - sz = 1; - ret_val++; - } - - if (sz == 1) { - if (ob >= obtail) { - *errnum = E2BIG; - ret_val = (size_t)-1; - break; - } - - if (is_it_toupper) - *ob = U8_ASCII_TOUPPER(*ib); - else if (is_it_tolower) - *ob = U8_ASCII_TOLOWER(*ib); - else - *ob = *ib; - ib++; - ob++; - } else if ((ib + sz) > ibtail) { - if (do_not_ignore_invalid) { - *errnum = EINVAL; - ret_val = (size_t)-1; - break; - } - - if ((obtail - ob) < (ibtail - ib)) { - *errnum = E2BIG; - ret_val = (size_t)-1; - break; - } - - /* - * We treat the remaining incomplete character - * bytes as a character. - */ - ret_val++; - - while (ib < ibtail) - *ob++ = *ib++; - } else { - if (is_it_toupper || is_it_tolower) { - i = do_case_conv(unicode_version, u8s, - ib, sz, is_it_toupper); - - if ((obtail - ob) < i) { - *errnum = E2BIG; - ret_val = (size_t)-1; - break; - } - - ib += sz; - - for (sz = 0; sz < i; sz++) - *ob++ = u8s[sz]; - } else { - if ((obtail - ob) < sz) { - *errnum = E2BIG; - ret_val = (size_t)-1; - break; - } - - for (i = 0; i < sz; i++) - *ob++ = *ib++; - } - } - } - } else { - canonical_decomposition = flag & U8_CANON_DECOMP; - compatibility_decomposition = flag & U8_COMPAT_DECOMP; - canonical_composition = flag & U8_CANON_COMP; - - while (ib < ibtail) { - if (*ib == '\0' && do_not_ignore_null) - break; - - /* - * If the current character is a 7-bit ASCII - * character and it is the last character, or, - * if the current character is a 7-bit ASCII - * character and the next character is also a 7-bit - * ASCII character, then, we copy over this - * character without going through collect_a_seq(). - * - * In any other cases, we need to look further with - * the collect_a_seq() function. - */ - if (U8_ISASCII(*ib) && ((ib + 1) >= ibtail || - ((ib + 1) < ibtail && U8_ISASCII(*(ib + 1))))) { - if (ob >= obtail) { - *errnum = E2BIG; - ret_val = (size_t)-1; - break; - } - - if (is_it_toupper) - *ob = U8_ASCII_TOUPPER(*ib); - else if (is_it_tolower) - *ob = U8_ASCII_TOLOWER(*ib); - else - *ob = *ib; - ib++; - ob++; - } else { - *errnum = 0; - state = U8_STATE_START; - - j = collect_a_seq(unicode_version, u8s, - &ib, ibtail, - is_it_toupper, - is_it_tolower, - canonical_decomposition, - compatibility_decomposition, - canonical_composition, - errnum, &state); - - if (*errnum && do_not_ignore_invalid) { - ret_val = (size_t)-1; - break; - } - - if ((obtail - ob) < j) { - *errnum = E2BIG; - ret_val = (size_t)-1; - break; - } - - for (i = 0; i < j; i++) - *ob++ = u8s[i]; - } - } - } - - *inlen = ibtail - ib; - *outlen = obtail - ob; - - return (ret_val); -} diff --git a/sys/contrib/openzfs/CODE_OF_CONDUCT.md b/sys/contrib/openzfs/CODE_OF_CONDUCT.md index d314a66b4e2d..2dcc251e553d 100644 --- a/sys/contrib/openzfs/CODE_OF_CONDUCT.md +++ b/sys/contrib/openzfs/CODE_OF_CONDUCT.md @@ -1,2 +1,2 @@ The [OpenZFS Code of Conduct](http://www.open-zfs.org/wiki/Code_of_Conduct) -applies to spaces associated with the ZFS on Linux project, including GitHub. +applies to spaces associated with the OpenZFS project, including GitHub. diff --git a/sys/contrib/openzfs/META b/sys/contrib/openzfs/META index ab33031b2e2a..87ffae5f4c09 100644 --- a/sys/contrib/openzfs/META +++ b/sys/contrib/openzfs/META @@ -2,9 +2,9 @@ Meta: 1 Name: zfs Branch: 1.0 Version: 2.0.0 -Release: rc2 +Release: rc3 Release-Tags: relext License: CDDL Author: OpenZFS -Linux-Maximum: 5.8 +Linux-Maximum: 5.9 Linux-Minimum: 3.10 diff --git a/sys/contrib/openzfs/README.md b/sys/contrib/openzfs/README.md index d215cd5d8ca5..31d99386e90e 100644 --- a/sys/contrib/openzfs/README.md +++ b/sys/contrib/openzfs/README.md @@ -16,8 +16,8 @@ This repository contains the code for running OpenZFS on Linux and FreeBSD. # Installation -Full documentation for installing OpenZFS on your favorite Linux distribution can -be found at the [ZoL Site](https://zfsonlinux.org/). +Full documentation for installing OpenZFS on your favorite operating system can +be found at the [Getting Started Page](https://openzfs.github.io/openzfs-docs/Getting%20Started/index.html). # Contribute & Develop diff --git a/sys/contrib/openzfs/cmd/arc_summary/arc_summary2 b/sys/contrib/openzfs/cmd/arc_summary/arc_summary2 index 5dc40d759dce..a925d32788ea 100755 --- a/sys/contrib/openzfs/cmd/arc_summary/arc_summary2 +++ b/sys/contrib/openzfs/cmd/arc_summary/arc_summary2 @@ -42,7 +42,7 @@ Provides basic information on the ARC, its efficiency, the L2ARC (if present), the Data Management Unit (DMU), Virtual Devices (VDEVs), and tunables. See the in-source documentation and code at -https://github.com/zfsonlinux/zfs/blob/master/module/zfs/arc.c for details. +https://github.com/openzfs/zfs/blob/master/module/zfs/arc.c for details. """ import getopt diff --git a/sys/contrib/openzfs/cmd/arc_summary/arc_summary3 b/sys/contrib/openzfs/cmd/arc_summary/arc_summary3 index c920b8e5395d..83cbf0f1728d 100755 --- a/sys/contrib/openzfs/cmd/arc_summary/arc_summary3 +++ b/sys/contrib/openzfs/cmd/arc_summary/arc_summary3 @@ -32,7 +32,7 @@ Provides basic information on the ARC, its efficiency, the L2ARC (if present), the Data Management Unit (DMU), Virtual Devices (VDEVs), and tunables. See the in-source documentation and code at -https://github.com/zfsonlinux/zfs/blob/master/module/zfs/arc.c for details. +https://github.com/openzfs/zfs/blob/master/module/zfs/arc.c for details. The original introduction to arc_summary can be found at http://cuddletech.com/?p=454 """ @@ -43,7 +43,7 @@ import subprocess import sys import time -DESCRIPTION = 'Print ARC and other statistics for ZFS on Linux' +DESCRIPTION = 'Print ARC and other statistics for OpenZFS' INDENT = ' '*8 LINE_LENGTH = 72 DATE_FORMAT = '%a %b %d %H:%M:%S %Y' @@ -831,7 +831,7 @@ def section_vdev(kstats_dict): # Currently [Nov 2017] the VDEV cache is disabled, because it is actually # harmful. When this is the case, we just skip the whole entry. See - # https://github.com/zfsonlinux/zfs/blob/master/module/zfs/vdev_cache.c + # https://github.com/openzfs/zfs/blob/master/module/zfs/vdev_cache.c # for details tunables = get_vdev_params() @@ -857,7 +857,7 @@ def section_vdev(kstats_dict): def section_zil(kstats_dict): """Collect information on the ZFS Intent Log. Some of the information - taken from https://github.com/zfsonlinux/zfs/blob/master/include/sys/zil.h + taken from https://github.com/openzfs/zfs/blob/master/include/sys/zil.h """ zil_stats = isolate_section('zil', kstats_dict) diff --git a/sys/contrib/openzfs/cmd/dbufstat/dbufstat.in b/sys/contrib/openzfs/cmd/dbufstat/dbufstat.in index 98eb79057388..1d4eb39d7242 100755 --- a/sys/contrib/openzfs/cmd/dbufstat/dbufstat.in +++ b/sys/contrib/openzfs/cmd/dbufstat/dbufstat.in @@ -113,6 +113,21 @@ cmd = ("Usage: dbufstat [-bdhnrtvx] [-i file] [-f fields] [-o file] " raw = 0 +if sys.platform.startswith("freebsd"): + import io + # Requires py-sysctl on FreeBSD + import sysctl + + def default_ifile(): + dbufs = sysctl.filter("kstat.zfs.misc.dbufs")[0].value + sys.stdin = io.StringIO(dbufs) + return "-" + +elif sys.platform.startswith("linux"): + def default_ifile(): + return "/proc/spl/kstat/zfs/dbufs" + + def print_incompat_helper(incompat): cnt = 0 for key in sorted(incompat): @@ -645,7 +660,7 @@ def main(): sys.exit(1) if not ifile: - ifile = '/proc/spl/kstat/zfs/dbufs' + ifile = default_ifile() if ifile is not "-": try: diff --git a/sys/contrib/openzfs/cmd/zdb/zdb.c b/sys/contrib/openzfs/cmd/zdb/zdb.c index c070a1f8c4da..376b24db1eec 100644 --- a/sys/contrib/openzfs/cmd/zdb/zdb.c +++ b/sys/contrib/openzfs/cmd/zdb/zdb.c @@ -1120,7 +1120,21 @@ dump_zap(objset_t *os, uint64_t object, void *data, size_t size) (void) zap_lookup(os, object, attr.za_name, attr.za_integer_length, attr.za_num_integers, prop); if (attr.za_integer_length == 1) { - (void) printf("%s", (char *)prop); + if (strcmp(attr.za_name, + DSL_CRYPTO_KEY_MASTER_KEY) == 0 || + strcmp(attr.za_name, + DSL_CRYPTO_KEY_HMAC_KEY) == 0 || + strcmp(attr.za_name, DSL_CRYPTO_KEY_IV) == 0 || + strcmp(attr.za_name, DSL_CRYPTO_KEY_MAC) == 0 || + strcmp(attr.za_name, DMU_POOL_CHECKSUM_SALT) == 0) { + uint8_t *u8 = prop; + + for (i = 0; i < attr.za_num_integers; i++) { + (void) printf("%02x", u8[i]); + } + } else { + (void) printf("%s", (char *)prop); + } } else { for (i = 0; i < attr.za_num_integers; i++) { switch (attr.za_integer_length) { diff --git a/sys/contrib/openzfs/cmd/zdb/zdb_il.c b/sys/contrib/openzfs/cmd/zdb/zdb_il.c index c12178effae0..553765b71716 100644 --- a/sys/contrib/openzfs/cmd/zdb/zdb_il.c +++ b/sys/contrib/openzfs/cmd/zdb/zdb_il.c @@ -62,9 +62,9 @@ print_log_bp(const blkptr_t *bp, const char *prefix) /* ARGSUSED */ static void -zil_prt_rec_create(zilog_t *zilog, int txtype, void *arg) +zil_prt_rec_create(zilog_t *zilog, int txtype, const void *arg) { - lr_create_t *lr = arg; + const lr_create_t *lr = arg; time_t crtime = lr->lr_crtime[0]; char *name, *link; lr_attr_t *lrattr; @@ -98,9 +98,9 @@ zil_prt_rec_create(zilog_t *zilog, int txtype, void *arg) /* ARGSUSED */ static void -zil_prt_rec_remove(zilog_t *zilog, int txtype, void *arg) +zil_prt_rec_remove(zilog_t *zilog, int txtype, const void *arg) { - lr_remove_t *lr = arg; + const lr_remove_t *lr = arg; (void) printf("%sdoid %llu, name %s\n", tab_prefix, (u_longlong_t)lr->lr_doid, (char *)(lr + 1)); @@ -108,9 +108,9 @@ zil_prt_rec_remove(zilog_t *zilog, int txtype, void *arg) /* ARGSUSED */ static void -zil_prt_rec_link(zilog_t *zilog, int txtype, void *arg) +zil_prt_rec_link(zilog_t *zilog, int txtype, const void *arg) { - lr_link_t *lr = arg; + const lr_link_t *lr = arg; (void) printf("%sdoid %llu, link_obj %llu, name %s\n", tab_prefix, (u_longlong_t)lr->lr_doid, (u_longlong_t)lr->lr_link_obj, @@ -119,9 +119,9 @@ zil_prt_rec_link(zilog_t *zilog, int txtype, void *arg) /* ARGSUSED */ static void -zil_prt_rec_rename(zilog_t *zilog, int txtype, void *arg) +zil_prt_rec_rename(zilog_t *zilog, int txtype, const void *arg) { - lr_rename_t *lr = arg; + const lr_rename_t *lr = arg; char *snm = (char *)(lr + 1); char *tnm = snm + strlen(snm) + 1; @@ -148,11 +148,11 @@ zil_prt_rec_write_cb(void *data, size_t len, void *unused) /* ARGSUSED */ static void -zil_prt_rec_write(zilog_t *zilog, int txtype, void *arg) +zil_prt_rec_write(zilog_t *zilog, int txtype, const void *arg) { - lr_write_t *lr = arg; + const lr_write_t *lr = arg; abd_t *data; - blkptr_t *bp = &lr->lr_blkptr; + const blkptr_t *bp = &lr->lr_blkptr; zbookmark_phys_t zb; int verbose = MAX(dump_opt['d'], dump_opt['i']); int error; @@ -211,9 +211,9 @@ zil_prt_rec_write(zilog_t *zilog, int txtype, void *arg) /* ARGSUSED */ static void -zil_prt_rec_truncate(zilog_t *zilog, int txtype, void *arg) +zil_prt_rec_truncate(zilog_t *zilog, int txtype, const void *arg) { - lr_truncate_t *lr = arg; + const lr_truncate_t *lr = arg; (void) printf("%sfoid %llu, offset 0x%llx, length 0x%llx\n", tab_prefix, (u_longlong_t)lr->lr_foid, (longlong_t)lr->lr_offset, @@ -222,9 +222,9 @@ zil_prt_rec_truncate(zilog_t *zilog, int txtype, void *arg) /* ARGSUSED */ static void -zil_prt_rec_setattr(zilog_t *zilog, int txtype, void *arg) +zil_prt_rec_setattr(zilog_t *zilog, int txtype, const void *arg) { - lr_setattr_t *lr = arg; + const lr_setattr_t *lr = arg; time_t atime = (time_t)lr->lr_atime[0]; time_t mtime = (time_t)lr->lr_mtime[0]; @@ -268,15 +268,15 @@ zil_prt_rec_setattr(zilog_t *zilog, int txtype, void *arg) /* ARGSUSED */ static void -zil_prt_rec_acl(zilog_t *zilog, int txtype, void *arg) +zil_prt_rec_acl(zilog_t *zilog, int txtype, const void *arg) { - lr_acl_t *lr = arg; + const lr_acl_t *lr = arg; (void) printf("%sfoid %llu, aclcnt %llu\n", tab_prefix, (u_longlong_t)lr->lr_foid, (u_longlong_t)lr->lr_aclcnt); } -typedef void (*zil_prt_rec_func_t)(zilog_t *, int, void *); +typedef void (*zil_prt_rec_func_t)(zilog_t *, int, const void *); typedef struct zil_rec_info { zil_prt_rec_func_t zri_print; const char *zri_name; @@ -309,7 +309,7 @@ static zil_rec_info_t zil_rec_info[TX_MAX_TYPE] = { /* ARGSUSED */ static int -print_log_record(zilog_t *zilog, lr_t *lr, void *arg, uint64_t claim_txg) +print_log_record(zilog_t *zilog, const lr_t *lr, void *arg, uint64_t claim_txg) { int txtype; int verbose = MAX(dump_opt['d'], dump_opt['i']); @@ -343,7 +343,8 @@ print_log_record(zilog_t *zilog, lr_t *lr, void *arg, uint64_t claim_txg) /* ARGSUSED */ static int -print_log_block(zilog_t *zilog, blkptr_t *bp, void *arg, uint64_t claim_txg) +print_log_block(zilog_t *zilog, const blkptr_t *bp, void *arg, + uint64_t claim_txg) { char blkbuf[BP_SPRINTF_LEN + 10]; int verbose = MAX(dump_opt['d'], dump_opt['i']); diff --git a/sys/contrib/openzfs/cmd/zed/agents/zfs_agents.c b/sys/contrib/openzfs/cmd/zed/agents/zfs_agents.c index 006e0ab99f47..6c40470e83d7 100644 --- a/sys/contrib/openzfs/cmd/zed/agents/zfs_agents.c +++ b/sys/contrib/openzfs/cmd/zed/agents/zfs_agents.c @@ -177,9 +177,9 @@ zfs_agent_post_event(const char *class, const char *subclass, nvlist_t *nvl) } /* - * On ZFS on Linux, we don't get the expected FM_RESOURCE_REMOVED - * ereport from vdev_disk layer after a hot unplug. Fortunately we - * get a EC_DEV_REMOVE from our disk monitor and it is a suitable + * On Linux, we don't get the expected FM_RESOURCE_REMOVED ereport + * from the vdev_disk layer after a hot unplug. Fortunately we do + * get an EC_DEV_REMOVE from our disk monitor and it is a suitable * proxy so we remap it here for the benefit of the diagnosis engine. */ if ((strcmp(class, EC_DEV_REMOVE) == 0) && diff --git a/sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c b/sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c index 8d0a3b420086..8190beb0c9e7 100644 --- a/sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c +++ b/sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c @@ -63,9 +63,7 @@ * If the device could not be replaced, then the second online attempt will * trigger the FMA fault that we skipped earlier. * - * ZFS on Linux porting notes: - * Linux udev provides a disk insert for both the disk and the partition - * + * On Linux udev provides a disk insert for both the disk and the partition. */ #include diff --git a/sys/contrib/openzfs/cmd/zed/agents/zfs_retire.c b/sys/contrib/openzfs/cmd/zed/agents/zfs_retire.c index 9e95e20d5683..ba8a6de3a66f 100644 --- a/sys/contrib/openzfs/cmd/zed/agents/zfs_retire.c +++ b/sys/contrib/openzfs/cmd/zed/agents/zfs_retire.c @@ -364,7 +364,7 @@ zfs_retire_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, return; /* - * Note: on zfsonlinux statechange events are more than just + * Note: on Linux statechange events are more than just * healthy ones so we need to confirm the actual state value. */ if (strcmp(class, "resource.fs.zfs.statechange") == 0 && diff --git a/sys/contrib/openzfs/cmd/zed/zed.c b/sys/contrib/openzfs/cmd/zed/zed.c index 0784e3834733..907b8af0d01f 100644 --- a/sys/contrib/openzfs/cmd/zed/zed.c +++ b/sys/contrib/openzfs/cmd/zed/zed.c @@ -1,6 +1,6 @@ /* - * This file is part of the ZFS Event Daemon (ZED) - * for ZFS on Linux (ZoL) . + * This file is part of the ZFS Event Daemon (ZED). + * * Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049). * Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC. * Refer to the ZoL git commit log for authoritative copyright attribution. diff --git a/sys/contrib/openzfs/cmd/zed/zed.h b/sys/contrib/openzfs/cmd/zed/zed.h index 3ac0e63141e8..be57f1136fea 100644 --- a/sys/contrib/openzfs/cmd/zed/zed.h +++ b/sys/contrib/openzfs/cmd/zed/zed.h @@ -1,6 +1,6 @@ /* - * This file is part of the ZFS Event Daemon (ZED) - * for ZFS on Linux (ZoL) . + * This file is part of the ZFS Event Daemon (ZED). + * * Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049). * Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC. * Refer to the ZoL git commit log for authoritative copyright attribution. diff --git a/sys/contrib/openzfs/cmd/zed/zed_conf.c b/sys/contrib/openzfs/cmd/zed/zed_conf.c index 52370eb87b29..c15f01fecb41 100644 --- a/sys/contrib/openzfs/cmd/zed/zed_conf.c +++ b/sys/contrib/openzfs/cmd/zed/zed_conf.c @@ -1,6 +1,6 @@ /* - * This file is part of the ZFS Event Daemon (ZED) - * for ZFS on Linux (ZoL) . + * This file is part of the ZFS Event Daemon (ZED). + * * Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049). * Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC. * Refer to the ZoL git commit log for authoritative copyright attribution. diff --git a/sys/contrib/openzfs/cmd/zed/zed_conf.h b/sys/contrib/openzfs/cmd/zed/zed_conf.h index 424cb2c01c8c..f44d20382968 100644 --- a/sys/contrib/openzfs/cmd/zed/zed_conf.h +++ b/sys/contrib/openzfs/cmd/zed/zed_conf.h @@ -1,6 +1,6 @@ /* - * This file is part of the ZFS Event Daemon (ZED) - * for ZFS on Linux (ZoL) . + * This file is part of the ZFS Event Daemon (ZED). + * * Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049). * Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC. * Refer to the ZoL git commit log for authoritative copyright attribution. diff --git a/sys/contrib/openzfs/cmd/zed/zed_event.c b/sys/contrib/openzfs/cmd/zed/zed_event.c index 1c5d00e297ff..8892087d6e62 100644 --- a/sys/contrib/openzfs/cmd/zed/zed_event.c +++ b/sys/contrib/openzfs/cmd/zed/zed_event.c @@ -1,6 +1,6 @@ /* - * This file is part of the ZFS Event Daemon (ZED) - * for ZFS on Linux (ZoL) . + * This file is part of the ZFS Event Daemon (ZED). + * * Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049). * Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC. * Refer to the ZoL git commit log for authoritative copyright attribution. diff --git a/sys/contrib/openzfs/cmd/zed/zed_event.h b/sys/contrib/openzfs/cmd/zed/zed_event.h index c1455c3a0629..264c377ed91a 100644 --- a/sys/contrib/openzfs/cmd/zed/zed_event.h +++ b/sys/contrib/openzfs/cmd/zed/zed_event.h @@ -1,6 +1,6 @@ /* - * This file is part of the ZFS Event Daemon (ZED) - * for ZFS on Linux (ZoL) . + * This file is part of the ZFS Event Daemon (ZED). + * * Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049). * Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC. * Refer to the ZoL git commit log for authoritative copyright attribution. diff --git a/sys/contrib/openzfs/cmd/zed/zed_exec.c b/sys/contrib/openzfs/cmd/zed/zed_exec.c index 08b7b5568362..aae607a9b7de 100644 --- a/sys/contrib/openzfs/cmd/zed/zed_exec.c +++ b/sys/contrib/openzfs/cmd/zed/zed_exec.c @@ -1,6 +1,6 @@ /* - * This file is part of the ZFS Event Daemon (ZED) - * for ZFS on Linux (ZoL) . + * This file is part of the ZFS Event Daemon (ZED). + * * Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049). * Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC. * Refer to the ZoL git commit log for authoritative copyright attribution. diff --git a/sys/contrib/openzfs/cmd/zed/zed_exec.h b/sys/contrib/openzfs/cmd/zed/zed_exec.h index 4153e5519a46..5eb9170abfe3 100644 --- a/sys/contrib/openzfs/cmd/zed/zed_exec.h +++ b/sys/contrib/openzfs/cmd/zed/zed_exec.h @@ -1,6 +1,6 @@ /* - * This file is part of the ZFS Event Daemon (ZED) - * for ZFS on Linux (ZoL) . + * This file is part of the ZFS Event Daemon (ZED). + * * Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049). * Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC. * Refer to the ZoL git commit log for authoritative copyright attribution. diff --git a/sys/contrib/openzfs/cmd/zed/zed_file.c b/sys/contrib/openzfs/cmd/zed/zed_file.c index c3cf3d421c6f..b51b1ca9dcf6 100644 --- a/sys/contrib/openzfs/cmd/zed/zed_file.c +++ b/sys/contrib/openzfs/cmd/zed/zed_file.c @@ -1,6 +1,6 @@ /* - * This file is part of the ZFS Event Daemon (ZED) - * for ZFS on Linux (ZoL) . + * This file is part of the ZFS Event Daemon (ZED). + * * Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049). * Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC. * Refer to the ZoL git commit log for authoritative copyright attribution. diff --git a/sys/contrib/openzfs/cmd/zed/zed_file.h b/sys/contrib/openzfs/cmd/zed/zed_file.h index 05f360d20efd..7dcae83810ef 100644 --- a/sys/contrib/openzfs/cmd/zed/zed_file.h +++ b/sys/contrib/openzfs/cmd/zed/zed_file.h @@ -1,6 +1,6 @@ /* - * This file is part of the ZFS Event Daemon (ZED) - * for ZFS on Linux (ZoL) . + * This file is part of the ZFS Event Daemon (ZED). + * * Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049). * Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC. * Refer to the ZoL git commit log for authoritative copyright attribution. diff --git a/sys/contrib/openzfs/cmd/zed/zed_log.c b/sys/contrib/openzfs/cmd/zed/zed_log.c index 5a3f2dbdb832..948dad52adb8 100644 --- a/sys/contrib/openzfs/cmd/zed/zed_log.c +++ b/sys/contrib/openzfs/cmd/zed/zed_log.c @@ -1,6 +1,6 @@ /* - * This file is part of the ZFS Event Daemon (ZED) - * for ZFS on Linux (ZoL) . + * This file is part of the ZFS Event Daemon (ZED). + * * Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049). * Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC. * Refer to the ZoL git commit log for authoritative copyright attribution. diff --git a/sys/contrib/openzfs/cmd/zed/zed_log.h b/sys/contrib/openzfs/cmd/zed/zed_log.h index a03a4f53967c..0daaad11df5c 100644 --- a/sys/contrib/openzfs/cmd/zed/zed_log.h +++ b/sys/contrib/openzfs/cmd/zed/zed_log.h @@ -1,6 +1,6 @@ /* - * This file is part of the ZFS Event Daemon (ZED) - * for ZFS on Linux (ZoL) . + * This file is part of the ZFS Event Daemon (ZED). + * * Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049). * Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC. * Refer to the ZoL git commit log for authoritative copyright attribution. diff --git a/sys/contrib/openzfs/cmd/zed/zed_strings.c b/sys/contrib/openzfs/cmd/zed/zed_strings.c index 6b1c669d71f4..89964317e48c 100644 --- a/sys/contrib/openzfs/cmd/zed/zed_strings.c +++ b/sys/contrib/openzfs/cmd/zed/zed_strings.c @@ -1,6 +1,6 @@ /* - * This file is part of the ZFS Event Daemon (ZED) - * for ZFS on Linux (ZoL) . + * This file is part of the ZFS Event Daemon (ZED). + * * Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049). * Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC. * Refer to the ZoL git commit log for authoritative copyright attribution. diff --git a/sys/contrib/openzfs/cmd/zed/zed_strings.h b/sys/contrib/openzfs/cmd/zed/zed_strings.h index 37a84cad7ffc..63d776f9b48f 100644 --- a/sys/contrib/openzfs/cmd/zed/zed_strings.h +++ b/sys/contrib/openzfs/cmd/zed/zed_strings.h @@ -1,6 +1,6 @@ /* - * This file is part of the ZFS Event Daemon (ZED) - * for ZFS on Linux (ZoL) . + * This file is part of the ZFS Event Daemon (ZED). + * * Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049). * Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC. * Refer to the ZoL git commit log for authoritative copyright attribution. diff --git a/sys/contrib/openzfs/cmd/zvol_id/Makefile.am b/sys/contrib/openzfs/cmd/zvol_id/Makefile.am index a584875081eb..8f9f3053ce8e 100644 --- a/sys/contrib/openzfs/cmd/zvol_id/Makefile.am +++ b/sys/contrib/openzfs/cmd/zvol_id/Makefile.am @@ -1,7 +1,7 @@ include $(top_srcdir)/config/Rules.am # Disable GCC stack protection for zvol_id. This is a kludge and should be -# removed once https://github.com/zfsonlinux/zfs/issues/569 is resolved. +# removed once https://github.com/openzfs/zfs/issues/569 is resolved. AM_CFLAGS += -fno-stack-protector udev_PROGRAMS = zvol_id diff --git a/sys/contrib/openzfs/config/kernel-bio.m4 b/sys/contrib/openzfs/config/kernel-bio.m4 index afa1f1cabeb0..534282780d3e 100644 --- a/sys/contrib/openzfs/config/kernel-bio.m4 +++ b/sys/contrib/openzfs/config/kernel-bio.m4 @@ -344,7 +344,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKG_TRYGET], [ #include #include ],[ - struct blkcg_gq blkg __attribute__ ((unused)); + struct blkcg_gq blkg __attribute__ ((unused)) = {}; bool rc __attribute__ ((unused)); rc = blkg_tryget(&blkg); ], [], [$ZFS_META_LICENSE]) diff --git a/sys/contrib/openzfs/configure.ac b/sys/contrib/openzfs/configure.ac index a1664151bc9a..9323aa7a0c28 100644 --- a/sys/contrib/openzfs/configure.ac +++ b/sys/contrib/openzfs/configure.ac @@ -237,6 +237,7 @@ AC_CONFIG_FILES([ tests/zfs-tests/tests/functional/Makefile tests/zfs-tests/tests/functional/acl/Makefile tests/zfs-tests/tests/functional/acl/posix/Makefile + tests/zfs-tests/tests/functional/acl/posix-sa/Makefile tests/zfs-tests/tests/functional/alloc_class/Makefile tests/zfs-tests/tests/functional/arc/Makefile tests/zfs-tests/tests/functional/atime/Makefile diff --git a/sys/contrib/openzfs/contrib/dracut/90zfs/module-setup.sh.in b/sys/contrib/openzfs/contrib/dracut/90zfs/module-setup.sh.in index 5b746049fb23..db5670cd5253 100755 --- a/sys/contrib/openzfs/contrib/dracut/90zfs/module-setup.sh.in +++ b/sys/contrib/openzfs/contrib/dracut/90zfs/module-setup.sh.in @@ -41,7 +41,8 @@ install() { dracut_install @bindir@/zgenhostid dracut_install @sbindir@/zfs dracut_install @sbindir@/zpool - # Workaround for zfsonlinux/zfs#4749 by ensuring libgcc_s.so(.1) is included + # Workaround for https://github.com/openzfs/zfs/issues/4749 by + # ensuring libgcc_s.so(.1) is included if [[ -n "$(ldd @sbindir@/zpool | grep -F 'libgcc_s.so')" ]]; then # Dracut will have already tracked and included it :; diff --git a/sys/contrib/openzfs/contrib/pyzfs/README b/sys/contrib/openzfs/contrib/pyzfs/README index 52983e5a90e0..bd224097951f 100644 --- a/sys/contrib/openzfs/contrib/pyzfs/README +++ b/sys/contrib/openzfs/contrib/pyzfs/README @@ -25,4 +25,4 @@ a temporary directory specified by, for instance, TMP environment variable on a memory backed filesystem. Package documentation: http://pyzfs.readthedocs.org -Package development: https://github.com/zfsonlinux/zfs +Package development: https://github.com/openzfs/zfs diff --git a/sys/contrib/openzfs/contrib/pyzfs/libzfs_core/__init__.py b/sys/contrib/openzfs/contrib/pyzfs/libzfs_core/__init__.py index 78e96738e29e..25ea3e495b02 100644 --- a/sys/contrib/openzfs/contrib/pyzfs/libzfs_core/__init__.py +++ b/sys/contrib/openzfs/contrib/pyzfs/libzfs_core/__init__.py @@ -32,7 +32,7 @@ in which the error code is produced. To submit an issue or contribute to development of this package -please visit its `GitHub repository `_. +please visit its `GitHub repository `_. .. data:: MAXNAMELEN diff --git a/sys/contrib/openzfs/copy-builtin b/sys/contrib/openzfs/copy-builtin index f42f4d1a4828..36e19545d9c4 100755 --- a/sys/contrib/openzfs/copy-builtin +++ b/sys/contrib/openzfs/copy-builtin @@ -35,9 +35,9 @@ config ZFS select ZLIB_INFLATE select ZLIB_DEFLATE help - This is the ZFS filesystem from the ZFS On Linux project. + This is the ZFS filesystem from the OpenZFS project. - See https://zfsonlinux.org/ + See https://github.com/openzfs/zfs To compile this file system support as a module, choose M here. diff --git a/sys/contrib/openzfs/etc/init.d/README.md b/sys/contrib/openzfs/etc/init.d/README.md index ad7c053aacab..c14b01937db2 100644 --- a/sys/contrib/openzfs/etc/init.d/README.md +++ b/sys/contrib/openzfs/etc/init.d/README.md @@ -16,7 +16,7 @@ DESCRIPTION SUPPORT If you find that they don't work for your platform, please report this - at the ZFS On Linux issue tracker at https://github.com/zfsonlinux/zfs/issues. + at the OpenZFS issue tracker at https://github.com/openzfs/zfs/issues. Please include: diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/kstat.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/kstat.h index 56280d3f5439..f5157c7f4fe3 100644 --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/kstat.h +++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/kstat.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/simd_x86.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/simd_x86.h index 63d6017b79e0..480bfd28973b 100644 --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/simd_x86.h +++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/simd_x86.h @@ -26,15 +26,12 @@ * $FreeBSD$ */ -#include #include -#include +#include #include -#ifdef __i386__ -#include -#else -#include -#endif +#include + +#include #include #include diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/sunddi.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/sunddi.h index 41d0f4512977..bfbc3e10a1d2 100644 --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/sunddi.h +++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/sunddi.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_ctldir.h b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_ctldir.h index 28a026603f07..da02863a78e6 100644 --- a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_ctldir.h +++ b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_ctldir.h @@ -48,7 +48,7 @@ int zfsctl_root(zfsvfs_t *, int, vnode_t **); void zfsctl_init(void); void zfsctl_fini(void); boolean_t zfsctl_is_node(vnode_t *); -int zfsctl_snapshot_unmount(char *snapname, int flags); +int zfsctl_snapshot_unmount(const char *snapname, int flags); int zfsctl_rename_snapshot(const char *from, const char *to); int zfsctl_destroy_snapshot(const char *snapname, int force); int zfsctl_umount_snapshots(vfs_t *, int, cred_t *); diff --git a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_dir.h b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_dir.h index f6f8ab5c4e69..4197e1188c9b 100644 --- a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_dir.h +++ b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_dir.h @@ -52,11 +52,7 @@ extern int zfs_dirent_lookup(znode_t *, const char *, znode_t **, int); extern int zfs_link_create(znode_t *, const char *, znode_t *, dmu_tx_t *, int); extern int zfs_link_destroy(znode_t *, const char *, znode_t *, dmu_tx_t *, int, boolean_t *); -#if 0 -extern int zfs_dirlook(vnode_t *, const char *, vnode_t **, int); -#else extern int zfs_dirlook(znode_t *, const char *name, znode_t **); -#endif extern void zfs_mknode(znode_t *, vattr_t *, dmu_tx_t *, cred_t *, uint_t, znode_t **, zfs_acl_ids_t *); extern void zfs_rmnode(znode_t *); diff --git a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h index e816e393378a..c7f464d034bd 100644 --- a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h +++ b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h @@ -72,6 +72,7 @@ struct zfsvfs { boolean_t z_fuid_dirty; /* need to sync fuid table ? */ struct zfs_fuid_info *z_fuid_replay; /* fuid info for replay */ zilog_t *z_log; /* intent log pointer */ + uint_t z_acl_type; /* type of acl usable on this fs */ uint_t z_acl_mode; /* acl chmod/mode behavior */ uint_t z_acl_inherit; /* acl inheritance behavior */ zfs_case_t z_case; /* case-sense */ diff --git a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vnops.h b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vnops.h index 6237372b905f..587650af6ce3 100644 --- a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vnops.h +++ b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vnops.h @@ -32,21 +32,21 @@ int dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, struct vm_page **ppa, dmu_tx_t *tx); int dmu_read_pages(objset_t *os, uint64_t object, vm_page_t *ma, int count, int *rbehind, int *rahead, int last_size); -extern int zfs_remove(znode_t *dzp, char *name, cred_t *cr, int flags); -extern int zfs_mkdir(znode_t *dzp, char *dirname, vattr_t *vap, +extern int zfs_remove(znode_t *dzp, const char *name, cred_t *cr, int flags); +extern int zfs_mkdir(znode_t *dzp, const char *dirname, vattr_t *vap, znode_t **zpp, cred_t *cr, int flags, vsecattr_t *vsecp); -extern int zfs_rmdir(znode_t *dzp, char *name, znode_t *cwd, +extern int zfs_rmdir(znode_t *dzp, const char *name, znode_t *cwd, cred_t *cr, int flags); extern int zfs_setattr(znode_t *zp, vattr_t *vap, int flag, cred_t *cr); -extern int zfs_rename(znode_t *sdzp, char *snm, znode_t *tdzp, - char *tnm, cred_t *cr, int flags); +extern int zfs_rename(znode_t *sdzp, const char *snm, znode_t *tdzp, + const char *tnm, cred_t *cr, int flags); extern int zfs_symlink(znode_t *dzp, const char *name, vattr_t *vap, const char *link, znode_t **zpp, cred_t *cr, int flags); extern int zfs_link(znode_t *tdzp, znode_t *sp, - char *name, cred_t *cr, int flags); + const char *name, cred_t *cr, int flags); extern int zfs_space(znode_t *zp, int cmd, struct flock *bfp, int flag, offset_t offset, cred_t *cr); -extern int zfs_create(znode_t *dzp, char *name, vattr_t *vap, int excl, +extern int zfs_create(znode_t *dzp, const char *name, vattr_t *vap, int excl, int mode, znode_t **zpp, cred_t *cr, int flag, vsecattr_t *vsecp); extern int zfs_setsecattr(znode_t *zp, vsecattr_t *vsecp, int flag, cred_t *cr); diff --git a/sys/contrib/openzfs/include/os/linux/spl/rpc/xdr.h b/sys/contrib/openzfs/include/os/linux/spl/rpc/xdr.h index 0b39b46cf6a2..c62080a1178a 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/rpc/xdr.h +++ b/sys/contrib/openzfs/include/os/linux/spl/rpc/xdr.h @@ -3,7 +3,6 @@ * Written by Ricardo Correia * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/acl.h b/sys/contrib/openzfs/include/os/linux/spl/sys/acl.h index 9fc79c025caf..5a3d226c7664 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/acl.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/acl.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/atomic.h b/sys/contrib/openzfs/include/os/linux/spl/sys/atomic.h index 51b5479235ab..2d21cbb3e140 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/atomic.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/atomic.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/byteorder.h b/sys/contrib/openzfs/include/os/linux/spl/sys/byteorder.h index 70847edbc8a9..bb5e173ce5e4 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/byteorder.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/byteorder.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/callb.h b/sys/contrib/openzfs/include/os/linux/spl/sys/callb.h index f1826bfd353a..19ba41ff9e25 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/callb.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/callb.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/callo.h b/sys/contrib/openzfs/include/os/linux/spl/sys/callo.h index c43ac92e7c32..e93a15f7a0d4 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/callo.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/callo.h @@ -5,7 +5,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/cmn_err.h b/sys/contrib/openzfs/include/os/linux/spl/sys/cmn_err.h index be57358b0a8a..314bbbaf9e95 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/cmn_err.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/cmn_err.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/condvar.h b/sys/contrib/openzfs/include/os/linux/spl/sys/condvar.h index fa321403bf74..ef405763ca56 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/condvar.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/condvar.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/console.h b/sys/contrib/openzfs/include/os/linux/spl/sys/console.h index 33c8b3c6b4d7..6af395cc2d78 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/console.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/console.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/cred.h b/sys/contrib/openzfs/include/os/linux/spl/sys/cred.h index 0b07c4369940..9cc85deb5c8a 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/cred.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/cred.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/ctype.h b/sys/contrib/openzfs/include/os/linux/spl/sys/ctype.h index 18beb1daa5d9..351320600472 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/ctype.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/ctype.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/debug.h b/sys/contrib/openzfs/include/os/linux/spl/sys/debug.h index e2dbd6804056..46da5c783397 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/debug.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/debug.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/disp.h b/sys/contrib/openzfs/include/os/linux/spl/sys/disp.h index 413b623c8145..e106d3c5438e 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/disp.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/disp.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/dkio.h b/sys/contrib/openzfs/include/os/linux/spl/sys/dkio.h index 49f166a9c4aa..a90b67d36702 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/dkio.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/dkio.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/fcntl.h b/sys/contrib/openzfs/include/os/linux/spl/sys/fcntl.h index 3faa5dad78cb..a87fdcac7fce 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/fcntl.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/fcntl.h @@ -5,7 +5,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/file.h b/sys/contrib/openzfs/include/os/linux/spl/sys/file.h index 05dbc0814296..e0bbd6d98cba 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/file.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/file.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/inttypes.h b/sys/contrib/openzfs/include/os/linux/spl/sys/inttypes.h index 92e76206ba52..c99973abd19e 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/inttypes.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/inttypes.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/isa_defs.h b/sys/contrib/openzfs/include/os/linux/spl/sys/isa_defs.h index af064e567e13..2207ee20256c 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/isa_defs.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/isa_defs.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/kmem.h b/sys/contrib/openzfs/include/os/linux/spl/sys/kmem.h index c09c40fa34b9..a93e87df8069 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/kmem.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/kmem.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/kmem_cache.h b/sys/contrib/openzfs/include/os/linux/spl/sys/kmem_cache.h index ffb8c97c9c91..48006ec5d27e 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/kmem_cache.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/kmem_cache.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/kstat.h b/sys/contrib/openzfs/include/os/linux/spl/sys/kstat.h index c93c53171d88..905d8257c8d3 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/kstat.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/kstat.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/list.h b/sys/contrib/openzfs/include/os/linux/spl/sys/list.h index be38f328fc65..80300df15abe 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/list.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/list.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/mod_os.h b/sys/contrib/openzfs/include/os/linux/spl/sys/mod_os.h index 8adf6212907f..bb43313d1869 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/mod_os.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/mod_os.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/mutex.h b/sys/contrib/openzfs/include/os/linux/spl/sys/mutex.h index 93f3af8fe016..047607f826bc 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/mutex.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/mutex.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/param.h b/sys/contrib/openzfs/include/os/linux/spl/sys/param.h index 4ef929151ae4..d8a12d532136 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/param.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/param.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/proc.h b/sys/contrib/openzfs/include/os/linux/spl/sys/proc.h index fefce515eb24..fe4841407da8 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/proc.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/proc.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/processor.h b/sys/contrib/openzfs/include/os/linux/spl/sys/processor.h index a70101fa2f90..5514f07c0b44 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/processor.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/processor.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/random.h b/sys/contrib/openzfs/include/os/linux/spl/sys/random.h index 93e244f566be..1b8cb60d094f 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/random.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/random.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/rwlock.h b/sys/contrib/openzfs/include/os/linux/spl/sys/rwlock.h index 60f5bfd986b4..ba7620a1f344 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/rwlock.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/rwlock.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/shrinker.h b/sys/contrib/openzfs/include/os/linux/spl/sys/shrinker.h index cc34d8ab1931..e5b7a9c955dd 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/shrinker.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/shrinker.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/sid.h b/sys/contrib/openzfs/include/os/linux/spl/sys/sid.h index 731b62c47e70..3cf27111b6d0 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/sid.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/sid.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/signal.h b/sys/contrib/openzfs/include/os/linux/spl/sys/signal.h index 36b8b5d985a9..fd32f08b3489 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/signal.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/signal.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/simd.h b/sys/contrib/openzfs/include/os/linux/spl/sys/simd.h index f2048d9e121c..6fb84d3a52c0 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/simd.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/simd.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/stat.h b/sys/contrib/openzfs/include/os/linux/spl/sys/stat.h index 83018e89442f..5987849641fc 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/stat.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/stat.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/strings.h b/sys/contrib/openzfs/include/os/linux/spl/sys/strings.h index 4fb80320635c..48e417d14605 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/strings.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/strings.h @@ -4,7 +4,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/sunddi.h b/sys/contrib/openzfs/include/os/linux/spl/sys/sunddi.h index 29a6fe00d1f4..8524ec9c300e 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/sunddi.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/sunddi.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/sysmacros.h b/sys/contrib/openzfs/include/os/linux/spl/sys/sysmacros.h index 7314588bcf82..eb3494bc7904 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/sysmacros.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/sysmacros.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/systeminfo.h b/sys/contrib/openzfs/include/os/linux/spl/sys/systeminfo.h index 2255691580f9..d4037a0900d0 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/systeminfo.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/systeminfo.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/taskq.h b/sys/contrib/openzfs/include/os/linux/spl/sys/taskq.h index 7a1ee9ec4f1b..16f4349e78e4 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/taskq.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/taskq.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/thread.h b/sys/contrib/openzfs/include/os/linux/spl/sys/thread.h index 72dcf9f05d0d..99d9c9bf3821 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/thread.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/thread.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/time.h b/sys/contrib/openzfs/include/os/linux/spl/sys/time.h index 4309c300b268..fec85f8b8d13 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/time.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/time.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/timer.h b/sys/contrib/openzfs/include/os/linux/spl/sys/timer.h index 40be12047ae4..02c3c7893477 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/timer.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/timer.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/tsd.h b/sys/contrib/openzfs/include/os/linux/spl/sys/tsd.h index 39a291bf3dee..8cdb9e4ffe93 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/tsd.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/tsd.h @@ -5,7 +5,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/types.h b/sys/contrib/openzfs/include/os/linux/spl/sys/types.h index 719a44646e6b..b44c94518750 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/types.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/types.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/types32.h b/sys/contrib/openzfs/include/os/linux/spl/sys/types32.h index c60ba8c97019..cb62c75e5a7a 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/types32.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/types32.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/uio.h b/sys/contrib/openzfs/include/os/linux/spl/sys/uio.h index 0e631d6779a2..abcd90dd570c 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/uio.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/uio.h @@ -7,7 +7,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/user.h b/sys/contrib/openzfs/include/os/linux/spl/sys/user.h index b12cb240e39b..13a2edf5f6c7 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/user.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/user.h @@ -4,7 +4,6 @@ * Written by Richard Yao . * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/vfs.h b/sys/contrib/openzfs/include/os/linux/spl/sys/vfs.h index 0d5e1d51d7aa..488f1827ec34 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/vfs.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/vfs.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/vmem.h b/sys/contrib/openzfs/include/os/linux/spl/sys/vmem.h index a31b4728c367..e77af2a7a48c 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/vmem.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/vmem.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/vmsystm.h b/sys/contrib/openzfs/include/os/linux/spl/sys/vmsystm.h index 8783231dcf2a..b3f121ecf0ca 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/vmsystm.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/vmsystm.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/vnode.h b/sys/contrib/openzfs/include/os/linux/spl/sys/vnode.h index 07eac8e44173..6f17db89fe53 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/vnode.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/vnode.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/wait.h b/sys/contrib/openzfs/include/os/linux/spl/sys/wait.h index 5311ff8b971b..65cd83e5ef12 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/wait.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/wait.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/zmod.h b/sys/contrib/openzfs/include/os/linux/spl/sys/zmod.h index 5380bd6fd022..8d27b62f4712 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/zmod.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/zmod.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/zone.h b/sys/contrib/openzfs/include/os/linux/spl/sys/zone.h index b2efd13b8e0d..00e30f690c38 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/zone.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/zone.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_ctldir.h b/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_ctldir.h index 51933bc4fe47..beee34979b64 100644 --- a/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_ctldir.h +++ b/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_ctldir.h @@ -60,22 +60,22 @@ extern boolean_t zfsctl_is_snapdir(struct inode *ip); extern int zfsctl_fid(struct inode *ip, fid_t *fidp); /* zfsctl '.zfs' functions */ -extern int zfsctl_root_lookup(struct inode *dip, char *name, +extern int zfsctl_root_lookup(struct inode *dip, const char *name, struct inode **ipp, int flags, cred_t *cr, int *direntflags, pathname_t *realpnp); /* zfsctl '.zfs/snapshot' functions */ -extern int zfsctl_snapdir_lookup(struct inode *dip, char *name, +extern int zfsctl_snapdir_lookup(struct inode *dip, const char *name, struct inode **ipp, int flags, cred_t *cr, int *direntflags, pathname_t *realpnp); -extern int zfsctl_snapdir_rename(struct inode *sdip, char *sname, - struct inode *tdip, char *tname, cred_t *cr, int flags); -extern int zfsctl_snapdir_remove(struct inode *dip, char *name, cred_t *cr, - int flags); -extern int zfsctl_snapdir_mkdir(struct inode *dip, char *dirname, vattr_t *vap, - struct inode **ipp, cred_t *cr, int flags); +extern int zfsctl_snapdir_rename(struct inode *sdip, const char *sname, + struct inode *tdip, const char *tname, cred_t *cr, int flags); +extern int zfsctl_snapdir_remove(struct inode *dip, const char *name, + cred_t *cr, int flags); +extern int zfsctl_snapdir_mkdir(struct inode *dip, const char *dirname, + vattr_t *vap, struct inode **ipp, cred_t *cr, int flags); extern int zfsctl_snapshot_mount(struct path *path, int flags); -extern int zfsctl_snapshot_unmount(char *snapname, int flags); +extern int zfsctl_snapshot_unmount(const char *snapname, int flags); extern int zfsctl_snapshot_unmount_delay(spa_t *spa, uint64_t objsetid, int delay); extern int zfsctl_snapdir_vget(struct super_block *sb, uint64_t objsetid, diff --git a/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_vnops.h b/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_vnops.h index 24a2082d35d6..2b41f3863425 100644 --- a/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_vnops.h +++ b/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_vnops.h @@ -46,8 +46,8 @@ extern int zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr); extern int zfs_write_simple(znode_t *zp, const void *data, size_t len, loff_t pos, size_t *resid); extern int zfs_access(struct inode *ip, int mode, int flag, cred_t *cr); -extern int zfs_lookup(znode_t *dzp, char *nm, znode_t **zpp, - int flags, cred_t *cr, int *direntflags, pathname_t *realpnp); +extern int zfs_lookup(znode_t *dzp, char *nm, znode_t **zpp, int flags, + cred_t *cr, int *direntflags, pathname_t *realpnp); extern int zfs_create(znode_t *dzp, char *name, vattr_t *vap, int excl, int mode, znode_t **zpp, cred_t *cr, int flag, vsecattr_t *vsecp); extern int zfs_tmpfile(struct inode *dip, vattr_t *vapzfs, int excl, diff --git a/sys/contrib/openzfs/include/sys/dmu.h b/sys/contrib/openzfs/include/sys/dmu.h index d6efe2595be0..54fdbc9ad227 100644 --- a/sys/contrib/openzfs/include/sys/dmu.h +++ b/sys/contrib/openzfs/include/sys/dmu.h @@ -337,7 +337,6 @@ int dmu_objset_clone(const char *name, const char *origin); int dsl_destroy_snapshots_nvl(struct nvlist *snaps, boolean_t defer, struct nvlist *errlist); int dmu_objset_snapshot_one(const char *fsname, const char *snapname); -int dmu_objset_snapshot_tmp(const char *, const char *, int); int dmu_objset_find(const char *name, int func(const char *, void *), void *arg, int flags); void dmu_objset_byteswap(void *buf, size_t size); @@ -1009,7 +1008,7 @@ extern int dmu_objset_blksize(objset_t *os); extern int dmu_snapshot_list_next(objset_t *os, int namelen, char *name, uint64_t *id, uint64_t *offp, boolean_t *case_conflict); extern int dmu_snapshot_lookup(objset_t *os, const char *name, uint64_t *val); -extern int dmu_snapshot_realname(objset_t *os, char *name, char *real, +extern int dmu_snapshot_realname(objset_t *os, const char *name, char *real, int maxlen, boolean_t *conflict); extern int dmu_dir_list_next(objset_t *os, int namelen, char *name, uint64_t *idp, uint64_t *offp); diff --git a/sys/contrib/openzfs/include/sys/mod.h b/sys/contrib/openzfs/include/sys/mod.h index 0ad7704afe99..a5a73ed0ee00 100644 --- a/sys/contrib/openzfs/include/sys/mod.h +++ b/sys/contrib/openzfs/include/sys/mod.h @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/include/sys/pathname.h b/sys/contrib/openzfs/include/sys/pathname.h index d79cc5c01afd..52f21316c23d 100644 --- a/sys/contrib/openzfs/include/sys/pathname.h +++ b/sys/contrib/openzfs/include/sys/pathname.h @@ -54,10 +54,6 @@ extern "C" { */ typedef struct pathname { char *pn_buf; /* underlying storage */ -#if 0 /* unused in ZoL */ - char *pn_path; /* remaining pathname */ - size_t pn_pathlen; /* remaining length */ -#endif size_t pn_bufsize; /* total size of pn_buf */ } pathname_t; diff --git a/sys/contrib/openzfs/include/sys/spa.h b/sys/contrib/openzfs/include/sys/spa.h index ddce8cc914f8..045431c2096b 100644 --- a/sys/contrib/openzfs/include/sys/spa.h +++ b/sys/contrib/openzfs/include/sys/spa.h @@ -768,12 +768,12 @@ extern int spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props, extern int spa_import(char *pool, nvlist_t *config, nvlist_t *props, uint64_t flags); extern nvlist_t *spa_tryimport(nvlist_t *tryconfig); -extern int spa_destroy(char *pool); +extern int spa_destroy(const char *pool); extern int spa_checkpoint(const char *pool); extern int spa_checkpoint_discard(const char *pool); -extern int spa_export(char *pool, nvlist_t **oldconfig, boolean_t force, +extern int spa_export(const char *pool, nvlist_t **oldconfig, boolean_t force, boolean_t hardforce); -extern int spa_reset(char *pool); +extern int spa_reset(const char *pool); extern void spa_async_request(spa_t *spa, int flag); extern void spa_async_unrequest(spa_t *spa, int flag); extern void spa_async_suspend(spa_t *spa); diff --git a/sys/contrib/openzfs/include/sys/u8_textprep.h b/sys/contrib/openzfs/include/sys/u8_textprep.h index f8b5bed6e420..09ab13af268c 100644 --- a/sys/contrib/openzfs/include/sys/u8_textprep.h +++ b/sys/contrib/openzfs/include/sys/u8_textprep.h @@ -101,7 +101,7 @@ extern int uconv_u8tou32(const uchar_t *, size_t *, uint32_t *, size_t *, int); #define U8_ILLEGAL_CHAR (-1) #define U8_OUT_OF_RANGE_CHAR (-2) -extern int u8_validate(char *, size_t, char **, int, int *); +extern int u8_validate(const char *, size_t, char **, int, int *); extern int u8_strcmp(const char *, const char *, size_t, int, size_t, int *); extern size_t u8_textprep_str(char *, size_t *, char *, size_t *, int, size_t, int *); diff --git a/sys/contrib/openzfs/include/sys/zfs_ioctl.h b/sys/contrib/openzfs/include/sys/zfs_ioctl.h index 53629cfc2c3f..afae576ea21a 100644 --- a/sys/contrib/openzfs/include/sys/zfs_ioctl.h +++ b/sys/contrib/openzfs/include/sys/zfs_ioctl.h @@ -68,6 +68,7 @@ extern "C" { */ #define ZFS_ACLTYPE_OFF 0 #define ZFS_ACLTYPE_POSIX 1 +#define ZFS_ACLTYPE_NFSV4 2 /* * Field manipulation macros for the drr_versioninfo field of the diff --git a/sys/contrib/openzfs/include/sys/zfs_znode.h b/sys/contrib/openzfs/include/sys/zfs_znode.h index d7823221eb77..4138f6eba0a0 100644 --- a/sys/contrib/openzfs/include/sys/zfs_znode.h +++ b/sys/contrib/openzfs/include/sys/zfs_znode.h @@ -262,19 +262,20 @@ extern boolean_t zfs_get_vfs_flag_unmounted(objset_t *os); extern void zfs_znode_dmu_fini(znode_t *); extern void zfs_log_create(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, - znode_t *dzp, znode_t *zp, char *name, vsecattr_t *, zfs_fuid_info_t *, - vattr_t *vap); + znode_t *dzp, znode_t *zp, const char *name, vsecattr_t *, + zfs_fuid_info_t *, vattr_t *vap); extern int zfs_log_create_txtype(zil_create_t, vsecattr_t *vsecp, vattr_t *vap); extern void zfs_log_remove(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, - znode_t *dzp, char *name, uint64_t foid, boolean_t unlinked); + znode_t *dzp, const char *name, uint64_t foid, boolean_t unlinked); #define ZFS_NO_OBJECT 0 /* no object id */ extern void zfs_log_link(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, - znode_t *dzp, znode_t *zp, char *name); + znode_t *dzp, znode_t *zp, const char *name); extern void zfs_log_symlink(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, - znode_t *dzp, znode_t *zp, char *name, char *link); + znode_t *dzp, znode_t *zp, const char *name, const char *link); extern void zfs_log_rename(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, - znode_t *sdzp, char *sname, znode_t *tdzp, char *dname, znode_t *szp); + znode_t *sdzp, const char *sname, znode_t *tdzp, const char *dname, + znode_t *szp); extern void zfs_log_write(zilog_t *zilog, dmu_tx_t *tx, int txtype, znode_t *zp, offset_t off, ssize_t len, int ioflag, zil_callback_t callback, void *callback_data); diff --git a/sys/contrib/openzfs/include/sys/zil.h b/sys/contrib/openzfs/include/sys/zil.h index 7e61a13301c0..ec89de38d443 100644 --- a/sys/contrib/openzfs/include/sys/zil.h +++ b/sys/contrib/openzfs/include/sys/zil.h @@ -462,9 +462,9 @@ extern zil_stats_t zil_stats; #define ZIL_STAT_BUMP(stat) \ ZIL_STAT_INCR(stat, 1); -typedef int zil_parse_blk_func_t(zilog_t *zilog, blkptr_t *bp, void *arg, +typedef int zil_parse_blk_func_t(zilog_t *zilog, const blkptr_t *bp, void *arg, uint64_t txg); -typedef int zil_parse_lr_func_t(zilog_t *zilog, lr_t *lr, void *arg, +typedef int zil_parse_lr_func_t(zilog_t *zilog, const lr_t *lr, void *arg, uint64_t txg); typedef int zil_replay_func_t(void *arg1, void *arg2, boolean_t byteswap); typedef int zil_get_data_t(void *arg, lr_write_t *lr, char *dbuf, diff --git a/sys/contrib/openzfs/lib/libspl/include/sys/acl.h b/sys/contrib/openzfs/lib/libspl/include/sys/acl.h index e6df864f850f..31168421b088 100644 --- a/sys/contrib/openzfs/lib/libspl/include/sys/acl.h +++ b/sys/contrib/openzfs/lib/libspl/include/sys/acl.h @@ -19,8 +19,12 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * + * Copyright 2014 Garrett D'Amore + * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + * Copyright 2017 RackTop Systems. */ #ifndef _SYS_ACL_H @@ -75,23 +79,24 @@ typedef struct acl_info acl_t; /* * The following are defined for ace_t. */ -#define ACE_READ_DATA 0x00000001 -#define ACE_LIST_DIRECTORY 0x00000001 -#define ACE_WRITE_DATA 0x00000002 -#define ACE_ADD_FILE 0x00000002 -#define ACE_APPEND_DATA 0x00000004 -#define ACE_ADD_SUBDIRECTORY 0x00000004 -#define ACE_READ_NAMED_ATTRS 0x00000008 -#define ACE_WRITE_NAMED_ATTRS 0x00000010 -#define ACE_EXECUTE 0x00000020 -#define ACE_DELETE_CHILD 0x00000040 -#define ACE_READ_ATTRIBUTES 0x00000080 -#define ACE_WRITE_ATTRIBUTES 0x00000100 -#define ACE_DELETE 0x00010000 -#define ACE_READ_ACL 0x00020000 -#define ACE_WRITE_ACL 0x00040000 -#define ACE_WRITE_OWNER 0x00080000 -#define ACE_SYNCHRONIZE 0x00100000 +#define ACE_READ_DATA 0x00000001 /* file: read data */ +#define ACE_LIST_DIRECTORY 0x00000001 /* dir: list files */ +#define ACE_WRITE_DATA 0x00000002 /* file: write data */ +#define ACE_ADD_FILE 0x00000002 /* dir: create file */ +#define ACE_APPEND_DATA 0x00000004 /* file: append data */ +#define ACE_ADD_SUBDIRECTORY 0x00000004 /* dir: create subdir */ +#define ACE_READ_NAMED_ATTRS 0x00000008 /* FILE_READ_EA */ +#define ACE_WRITE_NAMED_ATTRS 0x00000010 /* FILE_WRITE_EA */ +#define ACE_EXECUTE 0x00000020 /* file: execute */ +#define ACE_TRAVERSE 0x00000020 /* dir: lookup name */ +#define ACE_DELETE_CHILD 0x00000040 /* dir: unlink child */ +#define ACE_READ_ATTRIBUTES 0x00000080 /* (all) stat, etc. */ +#define ACE_WRITE_ATTRIBUTES 0x00000100 /* (all) utimes, etc. */ +#define ACE_DELETE 0x00010000 /* (all) unlink self */ +#define ACE_READ_ACL 0x00020000 /* (all) getsecattr */ +#define ACE_WRITE_ACL 0x00040000 /* (all) setsecattr */ +#define ACE_WRITE_OWNER 0x00080000 /* (all) chown */ +#define ACE_SYNCHRONIZE 0x00100000 /* (all) */ #define ACE_FILE_INHERIT_ACE 0x0001 #define ACE_DIRECTORY_INHERIT_ACE 0x0002 @@ -116,8 +121,6 @@ typedef struct acl_info acl_t; #define ACL_FLAGS_ALL (ACL_AUTO_INHERIT|ACL_PROTECTED| \ ACL_DEFAULTED) -#ifdef _KERNEL - /* * These are only applicable in a CIFS context. */ @@ -137,6 +140,8 @@ typedef struct acl_info acl_t; #define ACE_ALL_TYPES 0x001F +#if defined(_KERNEL) + typedef struct ace_object { uid_t a_who; /* uid or gid */ uint32_t a_access_mask; /* read,write,... */ @@ -154,6 +159,21 @@ typedef struct ace_object { ACE_WRITE_ATTRIBUTES|ACE_DELETE|ACE_READ_ACL|ACE_WRITE_ACL| \ ACE_WRITE_OWNER|ACE_SYNCHRONIZE) +#define ACE_ALL_WRITE_PERMS (ACE_WRITE_DATA|ACE_APPEND_DATA| \ + ACE_WRITE_ATTRIBUTES|ACE_WRITE_NAMED_ATTRS|ACE_WRITE_ACL| \ + ACE_WRITE_OWNER|ACE_DELETE|ACE_DELETE_CHILD) + +#define ACE_READ_PERMS (ACE_READ_DATA|ACE_READ_ACL|ACE_READ_ATTRIBUTES| \ + ACE_READ_NAMED_ATTRS) + +#define ACE_WRITE_PERMS (ACE_WRITE_DATA|ACE_APPEND_DATA|ACE_WRITE_ATTRIBUTES| \ + ACE_WRITE_NAMED_ATTRS) + +#define ACE_MODIFY_PERMS (ACE_READ_DATA|ACE_LIST_DIRECTORY|ACE_WRITE_DATA| \ + ACE_ADD_FILE|ACE_APPEND_DATA|ACE_ADD_SUBDIRECTORY|ACE_READ_NAMED_ATTRS| \ + ACE_WRITE_NAMED_ATTRS|ACE_EXECUTE|ACE_DELETE_CHILD|ACE_READ_ATTRIBUTES| \ + ACE_WRITE_ATTRIBUTES|ACE_DELETE|ACE_READ_ACL|ACE_SYNCHRONIZE) + /* * The following flags are supported by both NFSv4 ACLs and ace_t. */ @@ -217,6 +237,7 @@ typedef struct ace_object { #define ACL_APPEND_ID 0x1 /* append uid/gid to user/group entries */ #define ACL_COMPACT_FMT 0x2 /* build ACL in ls -V format */ #define ACL_NORESOLVE 0x4 /* don't do name service lookups */ +#define ACL_SID_FMT 0x8 /* use usersid/groupsid when appropriate */ /* * Legacy aclcheck errors for aclent_t ACLs @@ -272,13 +293,8 @@ extern int cmp2acls(void *, void *); #endif /* !defined(_KERNEL) */ -#if defined(__STDC__) extern int acl(const char *path, int cmd, int cnt, void *buf); extern int facl(int fd, int cmd, int cnt, void *buf); -#else /* !__STDC__ */ -extern int acl(); -extern int facl(); -#endif /* defined(__STDC__) */ #ifdef __cplusplus } diff --git a/sys/contrib/openzfs/lib/libspl/os/freebsd/getmntany.c b/sys/contrib/openzfs/lib/libspl/os/freebsd/getmntany.c index b41e763cee43..0ef24059e84f 100644 --- a/sys/contrib/openzfs/lib/libspl/os/freebsd/getmntany.c +++ b/sys/contrib/openzfs/lib/libspl/os/freebsd/getmntany.c @@ -37,10 +37,6 @@ #include #include -#define BUFSIZE (MNT_LINE_MAX + 2) - -__thread char buf[BUFSIZE]; - int getextmntent(const char *path, struct extmnttab *entry, struct stat64 *statbuf) { diff --git a/sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c b/sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c index b46a4f122c47..3de7d7d9cc26 100644 --- a/sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c +++ b/sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c @@ -2119,8 +2119,6 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap, avl_tree_t *fsavl = NULL; static uint64_t holdseq; int spa_version; - pthread_t tid = 0; - int pipefd[2]; int featureflags = 0; FILE *fout; @@ -2172,10 +2170,7 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap, /* dump each stream */ sdd.fromsnap = fromsnap; sdd.tosnap = tosnap; - if (tid != 0) - sdd.outfd = pipefd[0]; - else - sdd.outfd = outfd; + sdd.outfd = outfd; sdd.replicate = flags->replicate; sdd.doall = flags->doall; sdd.fromorigin = flags->fromorigin; @@ -2278,13 +2273,6 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap, if (err == 0 && !sdd.seento) err = ENOENT; - if (tid != 0) { - if (err != 0) - (void) pthread_cancel(tid); - (void) close(pipefd[0]); - (void) pthread_join(tid, NULL); - } - if (sdd.cleanup_fd != -1) { VERIFY(0 == close(sdd.cleanup_fd)); sdd.cleanup_fd = -1; @@ -2313,11 +2301,6 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap, if (sdd.cleanup_fd != -1) VERIFY(0 == close(sdd.cleanup_fd)); - if (tid != 0) { - (void) pthread_cancel(tid); - (void) close(pipefd[0]); - (void) pthread_join(tid, NULL); - } return (err); } @@ -4108,7 +4091,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap, char errbuf[1024]; const char *chopprefix; boolean_t newfs = B_FALSE; - boolean_t stream_wantsnewfs; + boolean_t stream_wantsnewfs, stream_resumingnewfs; boolean_t newprops = B_FALSE; uint64_t read_bytes = 0; uint64_t errflags = 0; @@ -4329,6 +4312,8 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap, DMU_BACKUP_FEATURE_EMBED_DATA; stream_wantsnewfs = (drrb->drr_fromguid == 0 || (drrb->drr_flags & DRR_FLAG_CLONE) || originsnap) && !resuming; + stream_resumingnewfs = (drrb->drr_fromguid == 0 || + (drrb->drr_flags & DRR_FLAG_CLONE) || originsnap) && resuming; if (stream_wantsnewfs) { /* @@ -4496,7 +4481,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap, } if (!flags->dryrun && zhp->zfs_type == ZFS_TYPE_FILESYSTEM && - stream_wantsnewfs) { + (stream_wantsnewfs || stream_resumingnewfs)) { /* We can't do online recv in this case */ clp = changelist_gather(zhp, ZFS_PROP_NAME, 0, flags->forceunmount ? MS_FORCE : 0); diff --git a/sys/contrib/openzfs/lib/libzfs/libzfs_util.c b/sys/contrib/openzfs/lib/libzfs/libzfs_util.c index 651bca2978ce..a457fbfd0639 100644 --- a/sys/contrib/openzfs/lib/libzfs/libzfs_util.c +++ b/sys/contrib/openzfs/lib/libzfs/libzfs_util.c @@ -1010,8 +1010,7 @@ libzfs_init(void) int error; char *env; - error = libzfs_load_module(); - if (error) { + if ((error = libzfs_load_module()) != 0) { errno = error; return (NULL); } diff --git a/sys/contrib/openzfs/lib/libzfs/os/freebsd/libzfs_compat.c b/sys/contrib/openzfs/lib/libzfs/os/freebsd/libzfs_compat.c index 037ba56efe1c..2de90c7ceea5 100644 --- a/sys/contrib/openzfs/lib/libzfs/os/freebsd/libzfs_compat.c +++ b/sys/contrib/openzfs/lib/libzfs/os/freebsd/libzfs_compat.c @@ -176,11 +176,26 @@ execvpe(const char *name, char * const argv[], char * const envp[]) return (execvPe(name, path, argv, envp)); } +#define ERRBUFLEN 256 + +__thread static char errbuf[ERRBUFLEN]; + const char * libzfs_error_init(int error) { + char *msg = errbuf; + size_t len, msglen = ERRBUFLEN; - return (strerror(error)); + if (modfind("zfs") < 0) { + len = snprintf(msg, msglen, dgettext(TEXT_DOMAIN, + "Failed to load %s module: "), ZFS_KMOD); + msg += len; + msglen -= len; + } + + (void) snprintf(msg, msglen, "%s", strerror(error)); + + return (errbuf); } int @@ -193,10 +208,6 @@ zfs_ioctl(libzfs_handle_t *hdl, int request, zfs_cmd_t *zc) * Verify the required ZFS_DEV device is available and optionally attempt * to load the ZFS modules. Under normal circumstances the modules * should already have been loaded by some external mechanism. - * - * Environment variables: - * - ZFS_MODULE_LOADING="YES|yes|ON|on" - Attempt to load modules. - * - ZFS_MODULE_TIMEOUT="" - Seconds to wait for ZFS_DEV */ int libzfs_load_module(void) diff --git a/sys/contrib/openzfs/lib/libzfsbootenv/libzfsbootenv.pc.in b/sys/contrib/openzfs/lib/libzfsbootenv/libzfsbootenv.pc.in index 61bafa66e3fd..50865050bbfb 100644 --- a/sys/contrib/openzfs/lib/libzfsbootenv/libzfsbootenv.pc.in +++ b/sys/contrib/openzfs/lib/libzfsbootenv/libzfsbootenv.pc.in @@ -6,7 +6,7 @@ includedir=@includedir@ Name: libzfsbootenv Description: LibZFSBootENV library Version: @VERSION@ -URL: https://zfsonlinux.org +URL: https://github.com/openzfs/zfs Requires: libzfs libnvpair Cflags: -I${includedir} Libs: -L${libdir} -lzfsbootenv diff --git a/sys/contrib/openzfs/lib/libzutil/os/linux/zutil_import_os.c b/sys/contrib/openzfs/lib/libzutil/os/linux/zutil_import_os.c index a4bf01749da8..519ab3a078e3 100644 --- a/sys/contrib/openzfs/lib/libzutil/os/linux/zutil_import_os.c +++ b/sys/contrib/openzfs/lib/libzutil/os/linux/zutil_import_os.c @@ -813,9 +813,9 @@ update_vdev_config_dev_strs(nvlist_t *nv) * env ZFS_VDEV_DEVID_OPT_OUT=YES zpool import dozer * * explanation: - * Older ZFS on Linux implementations had issues when attempting to - * display pool config VDEV names if a "devid" NVP value is present - * in the pool's config. + * Older OpenZFS implementations had issues when attempting to + * display pool config VDEV names if a "devid" NVP value is + * present in the pool's config. * * For example, a pool that originated on illumos platform would * have a devid value in the config and "zpool status" would fail diff --git a/sys/contrib/openzfs/man/man1/raidz_test.1 b/sys/contrib/openzfs/man/man1/raidz_test.1 index 63e9144ad201..94e48bf49bd7 100644 --- a/sys/contrib/openzfs/man/man1/raidz_test.1 +++ b/sys/contrib/openzfs/man/man1/raidz_test.1 @@ -94,4 +94,4 @@ Debugging option. Specify to attach gdb when SIGSEGV or SIGABRT are received. .SH "SEE ALSO" .BR "ztest (1)" .SH "AUTHORS" -vdev_raidz, created for ZFS on Linux by Gvozden Nešković +vdev_raidz, created for OpenZFS by Gvozden Nešković diff --git a/sys/contrib/openzfs/man/man5/zfs-module-parameters.5 b/sys/contrib/openzfs/man/man5/zfs-module-parameters.5 index a266d9a7e96c..1b1a0d56a3ab 100644 --- a/sys/contrib/openzfs/man/man5/zfs-module-parameters.5 +++ b/sys/contrib/openzfs/man/man5/zfs-module-parameters.5 @@ -809,9 +809,20 @@ Default value: \fB1,048,576\fR. \fBzfetch_max_distance\fR (uint) .ad .RS 12n -Max bytes to prefetch per stream (default 8MB). +Max bytes to prefetch per stream. .sp -Default value: \fB8,388,608\fR. +Default value: \fB8,388,608\fR (8MB). +.RE + +.sp +.ne 2 +.na +\fBzfetch_max_idistance\fR (uint) +.ad +.RS 12n +Max bytes to prefetch indirects for per stream. +.sp +Default vaule: \fB67,108,864\fR (64MB). .RE .sp @@ -1555,7 +1566,7 @@ Default value: \fB500,000\fR. .RS 12n Disables requirement for IVset guids to be present and match when doing a raw receive of encrypted datasets. Intended for users whose pools were created with -ZFS on Linux pre-release versions and now have compatibility issues. +OpenZFS pre-release versions and now have compatibility issues. .sp Default value: \fB0\fR. .RE diff --git a/sys/contrib/openzfs/man/man8/zed.8.in b/sys/contrib/openzfs/man/man8/zed.8.in index 9d494d5e8ff4..3d36c33ac9ca 100644 --- a/sys/contrib/openzfs/man/man8/zed.8.in +++ b/sys/contrib/openzfs/man/man8/zed.8.in @@ -1,6 +1,5 @@ .\" -.\" This file is part of the ZFS Event Daemon (ZED) -.\" for ZFS on Linux (ZoL) . +.\" This file is part of the ZFS Event Daemon (ZED). .\" Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049). .\" Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC. .\" Refer to the ZoL git commit log for authoritative copyright attribution. diff --git a/sys/contrib/openzfs/man/man8/zfsprops.8 b/sys/contrib/openzfs/man/man8/zfsprops.8 index 2c4a2af29480..88995db0cb0c 100644 --- a/sys/contrib/openzfs/man/man8/zfsprops.8 +++ b/sys/contrib/openzfs/man/man8/zfsprops.8 @@ -651,17 +651,28 @@ you must first remove all .Tn ACL entries which do not represent the current mode. .El -.It Sy acltype Ns = Ns Sy off Ns | Ns Sy posix +.It Sy acltype Ns = Ns Sy off Ns | Ns Sy nfsv4 Ns | Ns Sy posix Controls whether ACLs are enabled and if so what type of ACL to use. -This property is not visible on FreeBSD yet. +When this property is set to a type of ACL not supported by the current +platform, the behavior is the same as if it were set to +.Sy off . .Bl -tag -width "posixacl" .It Sy off -default, when a file system has the +default on Linux, when a file system has the .Sy acltype property set to off then ACLs are disabled. .It Sy noacl an alias for .Sy off +.It Sy nfsv4 +default on FreeBSD, indicates that NFSv4-style ZFS ACLs should be used. +These ACLs can be managed with the +.Xr getfacl 1 +and +.Xr setfacl 1 +commands on FreeBSD. The +.Sy nfsv4 +ZFS ACL type is not yet supported on Linux. .It Sy posix indicates POSIX ACLs should be used. POSIX ACLs are specific to Linux and are not functional on other platforms. POSIX ACLs are stored as an extended @@ -1794,7 +1805,7 @@ on platforms which do not support the feature. .Pp The use of system attribute based xattrs is strongly encouraged for users of -SELinux or POSIX ACLs. Both of these features heavily rely of extended +SELinux or POSIX ACLs. Both of these features heavily rely on extended attributes and benefit significantly from the reduced access time. .Pp The values diff --git a/sys/contrib/openzfs/man/man8/zpool.8 b/sys/contrib/openzfs/man/man8/zpool.8 index 7c12798da49c..15e50838fee5 100644 --- a/sys/contrib/openzfs/man/man8/zpool.8 +++ b/sys/contrib/openzfs/man/man8/zpool.8 @@ -503,7 +503,7 @@ command line option. .El .Bl -tag -width "ZFS_VDEV_DEVID_OPT_OUT" .It Ev ZFS_VDEV_DEVID_OPT_OUT -Older ZFS on Linux implementations had issues when attempting to display pool +Older OpenZFS implementations had issues when attempting to display pool config VDEV names if a .Sy devid NVP value is present in the pool's config. diff --git a/sys/contrib/openzfs/module/Makefile.in b/sys/contrib/openzfs/module/Makefile.in index ead4ff1360b2..0ee2c447221a 100644 --- a/sys/contrib/openzfs/module/Makefile.in +++ b/sys/contrib/openzfs/module/Makefile.in @@ -96,7 +96,7 @@ modules_install: modules_install-@ac_system@ modules_uninstall-Linux: @# Uninstall the kernel modules - kmoddir=$(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@ \ + kmoddir=$(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@; \ for objdir in $(ZFS_MODULES); do \ $(RM) -R $$kmoddir/$(INSTALL_MOD_DIR)/$$objdir; \ done diff --git a/sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c b/sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c index 4cc77e20a4eb..b26753bacc21 100644 --- a/sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c +++ b/sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c @@ -231,6 +231,7 @@ kstat_sysctl_raw(SYSCTL_HANDLER_ARGS) } free(ksp->ks_raw_buf, M_TEMP); mutex_exit(ksp->ks_lock); + sbuf_trim(sb); rc = sbuf_finish(sb); if (rc == 0) rc = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb)); diff --git a/sys/contrib/openzfs/module/os/freebsd/spl/spl_taskq.c b/sys/contrib/openzfs/module/os/freebsd/spl/spl_taskq.c index bc24a562f8fb..8ad6de9b5e9f 100644 --- a/sys/contrib/openzfs/module/os/freebsd/spl/spl_taskq.c +++ b/sys/contrib/openzfs/module/os/freebsd/spl/spl_taskq.c @@ -29,18 +29,21 @@ #include __FBSDID("$FreeBSD$"); -#include #include +#include +#include #include #include #include #include #include -#include #include +#include #include -#include -#include + +#if defined(__i386__) || defined(__amd64__) || defined(__aarch64__) +#include +#endif #include @@ -124,8 +127,14 @@ SYSUNINIT(system_taskq_fini, SI_SUB_CONFIGURE, SI_ORDER_ANY, system_taskq_fini, static taskqid_t __taskq_genid(void) { + taskqid_t tqid; - return (atomic_fetchadd_long(&tqidnext, 1) + 1); + /* + * Assume a 64-bit counter will not wrap in practice. + */ + tqid = atomic_add_64_nv(&tqidnext, 1); + VERIFY(tqid); + return (tqid); } #else static taskqid_t @@ -134,10 +143,11 @@ __taskq_genid(void) taskqid_t tqid; for (;;) { - tqid = atomic_fetchadd_int(&tqidnext, 1) + 1; + tqid = atomic_add_32_nv(&tqidnext, 1); if (__predict_true(tqid != 0)) break; } + VERIFY(tqid); return (tqid); } #endif @@ -164,7 +174,6 @@ taskq_insert(taskq_ent_t *ent) taskqid_t tqid; tqid = __taskq_genid(); - VERIFY(tqid); ent->tqent_id = tqid; ent->tqent_registered = B_TRUE; sx_xlock(TQIDHASHLOCK(tqid)); diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c b/sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c index 3a13271aac6f..c11d4dbcf660 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c @@ -28,73 +28,68 @@ #include __FBSDID("$FreeBSD$"); -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include -#include +#include #include -#include -#include -#include -#include -#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include - +#include +#include +#include #include #include +#include +#include +#include +#include +#include +#include +#include "zfs_comutil.h" +#include "zfs_deleg.h" #include "zfs_namecheck.h" #include "zfs_prop.h" -#include "zfs_deleg.h" -#include "zfs_comutil.h" SYSCTL_DECL(_vfs_zfs); SYSCTL_DECL(_vfs_zfs_vdev); @@ -122,7 +117,6 @@ extern zfsdev_state_t *zfsdev_state_list; #define ZFS_MIN_KSTACK_PAGES 4 - static int zfsdev_ioctl(struct cdev *dev, ulong_t zcmd, caddr_t arg, int flag, struct thread *td) @@ -333,7 +327,6 @@ zfs_shutdown(void *arg __unused, int howto __unused) zfs__fini(); } - static int zfs_modevent(module_t mod, int type, void *unused __unused) { diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/sysctl_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/sysctl_os.c index c9b350a540ea..1b37ce0d7f6b 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/sysctl_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/sysctl_os.c @@ -300,8 +300,9 @@ SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, max_distance, CTLFLAG_RWTUN, /* max bytes to prefetch indirects for per stream (default 64MB) */ extern uint32_t zfetch_max_idistance; -SYSCTL_UINT(_vfs_zfs_prefetch, OID_AUTO, max_idistance, CTLFLAG_RWTUN, - &zfetch_max_idistance, 0, "Max bytes to prefetch indirects for per stream"); +SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, max_idistance, CTLFLAG_RWTUN, + &zfetch_max_idistance, 0, + "Max bytes to prefetch indirects for per stream (LEGACY)"); /* dsl_pool.c */ diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c index 018120c82ab3..23b87de8bd0d 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c @@ -2494,7 +2494,7 @@ zfs_zaccess(znode_t *zp, int mode, int flags, boolean_t skipaclchk, cred_t *cr) /* * Translate traditional unix VREAD/VWRITE/VEXEC mode into - * native ACL format and call zfs_zaccess() + * NFSv4-style ZFS ACL format and call zfs_zaccess() */ int zfs_zaccess_rwx(znode_t *zp, mode_t mode, int flags, cred_t *cr) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c index e69b30446f4a..6901f1ca915a 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c @@ -796,7 +796,9 @@ zfsctl_common_getacl(struct vop_getacl_args *ap) static struct vop_vector zfsctl_ops_root = { .vop_default = &default_vnodeops, +#if __FreeBSD_version >= 1300121 .vop_fplookup_vexec = VOP_EAGAIN, +#endif .vop_open = zfsctl_common_open, .vop_close = zfsctl_common_close, .vop_ioctl = VOP_EINVAL, @@ -1114,7 +1116,9 @@ zfsctl_snapdir_getattr(struct vop_getattr_args *ap) static struct vop_vector zfsctl_ops_snapdir = { .vop_default = &default_vnodeops, +#if __FreeBSD_version >= 1300121 .vop_fplookup_vexec = VOP_EAGAIN, +#endif .vop_open = zfsctl_common_open, .vop_close = zfsctl_common_close, .vop_getattr = zfsctl_snapdir_getattr, @@ -1215,8 +1219,9 @@ zfsctl_snapshot_vptocnp(struct vop_vptocnp_args *ap) * be covered. */ static struct vop_vector zfsctl_ops_snapshot = { - .vop_default = NULL, /* ensure very restricted access */ +#if __FreeBSD_version >= 1300121 .vop_fplookup_vexec = VOP_EAGAIN, +#endif .vop_inactive = zfsctl_snapshot_inactive, #if __FreeBSD_version >= 1300045 .vop_need_inactive = vop_stdneed_inactive, @@ -1328,7 +1333,7 @@ zfsctl_umount_snapshots(vfs_t *vfsp, int fflags, cred_t *cr) } int -zfsctl_snapshot_unmount(char *snapname, int flags __unused) +zfsctl_snapshot_unmount(const char *snapname, int flags __unused) { vfs_t *vfsp = NULL; zfsvfs_t *zfsvfs = NULL; diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c index ec8303283414..4e437f5bacc1 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c @@ -592,6 +592,14 @@ acl_inherit_changed_cb(void *arg, uint64_t newval) zfsvfs->z_acl_inherit = newval; } +static void +acl_type_changed_cb(void *arg, uint64_t newval) +{ + zfsvfs_t *zfsvfs = arg; + + zfsvfs->z_acl_type = newval; +} + static int zfs_register_callbacks(vfs_t *vfsp) { @@ -722,6 +730,8 @@ zfs_register_callbacks(vfs_t *vfsp) zfs_prop_to_name(ZFS_PROP_EXEC), exec_changed_cb, zfsvfs); error = error ? error : dsl_prop_register(ds, zfs_prop_to_name(ZFS_PROP_SNAPDIR), snapdir_changed_cb, zfsvfs); + error = error ? error : dsl_prop_register(ds, + zfs_prop_to_name(ZFS_PROP_ACLTYPE), acl_type_changed_cb, zfsvfs); error = error ? error : dsl_prop_register(ds, zfs_prop_to_name(ZFS_PROP_ACLMODE), acl_mode_changed_cb, zfsvfs); error = error ? error : dsl_prop_register(ds, @@ -797,6 +807,11 @@ zfsvfs_init(zfsvfs_t *zfsvfs, objset_t *os) return (error); zfsvfs->z_case = (uint_t)val; + error = zfs_get_zplprop(os, ZFS_PROP_ACLTYPE, &val); + if (error != 0) + return (error); + zfsvfs->z_acl_type = (uint_t)val; + /* * Fold case on file systems that are always or sometimes case * insensitive. @@ -1232,6 +1247,10 @@ zfs_domount(vfs_t *vfsp, char *osname) "xattr", &pval, NULL))) goto out; xattr_changed_cb(zfsvfs, pval); + if ((error = dsl_prop_get_integer(osname, + "acltype", &pval, NULL))) + goto out; + acl_type_changed_cb(zfsvfs, pval); zfsvfs->z_issnap = B_TRUE; zfsvfs->z_os->os_sync = ZFS_SYNC_DISABLED; @@ -2220,6 +2239,9 @@ zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value) case ZFS_PROP_CASE: *value = ZFS_CASE_SENSITIVE; break; + case ZFS_PROP_ACLTYPE: + *value = ZFS_ACLTYPE_NFSV4; + break; default: return (error); } diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c index 52c3edd2d9c4..18c71511fccd 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c @@ -104,14 +104,6 @@ VFS_SMR_DECLARE; #define vm_page_wire_unlock(pp) vm_page_unlock(pp) #endif -static int -zfs_u8_validate(const char *u8str, size_t n, char **list, int flag, int *errnum) -{ - - return (u8_validate(__DECONST(char *, u8str), n, list, flag, errnum)); -} -#define u8_validate zfs_u8_validate - #ifdef DEBUG_VFS_LOCKS #define VNCHECKREF(vp) \ VNASSERT((vp)->v_holdcnt > 0 && (vp)->v_usecount > 0, vp, \ @@ -1536,8 +1528,9 @@ zfs_lookup_lock(vnode_t *dvp, vnode_t *vp, const char *name, int lkflags) */ /* ARGSUSED */ static int -zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp, - int nameiop, cred_t *cr, kthread_t *td, int flags, boolean_t cached) +zfs_lookup(vnode_t *dvp, const char *nm, vnode_t **vpp, + struct componentname *cnp, int nameiop, cred_t *cr, kthread_t *td, + int flags, boolean_t cached) { znode_t *zdp = VTOZ(dvp); znode_t *zp; @@ -1561,7 +1554,8 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp, } } - DTRACE_PROBE2(zfs__fastpath__lookup__miss, vnode_t *, dvp, char *, nm); + DTRACE_PROBE2(zfs__fastpath__lookup__miss, vnode_t *, dvp, + const char *, nm); ZFS_ENTER(zfsvfs); ZFS_VERIFY_ZP(zdp); @@ -1778,7 +1772,7 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp, /* ARGSUSED */ int -zfs_create(znode_t *dzp, char *name, vattr_t *vap, int excl, int mode, +zfs_create(znode_t *dzp, const char *name, vattr_t *vap, int excl, int mode, znode_t **zpp, cred_t *cr, int flag, vsecattr_t *vsecp) { znode_t *zp; @@ -1945,7 +1939,7 @@ zfs_create(znode_t *dzp, char *name, vattr_t *vap, int excl, int mode, /*ARGSUSED*/ static int -zfs_remove_(vnode_t *dvp, vnode_t *vp, char *name, cred_t *cr) +zfs_remove_(vnode_t *dvp, vnode_t *vp, const char *name, cred_t *cr) { znode_t *dzp = VTOZ(dvp); znode_t *zp; @@ -2059,13 +2053,13 @@ zfs_remove_(vnode_t *dvp, vnode_t *vp, char *name, cred_t *cr) static int -zfs_lookup_internal(znode_t *dzp, char *name, vnode_t **vpp, +zfs_lookup_internal(znode_t *dzp, const char *name, vnode_t **vpp, struct componentname *cnp, int nameiop) { zfsvfs_t *zfsvfs = dzp->z_zfsvfs; int error; - cnp->cn_nameptr = name; + cnp->cn_nameptr = __DECONST(char *, name); cnp->cn_namelen = strlen(name); cnp->cn_nameiop = nameiop; cnp->cn_flags = ISLASTCN | SAVENAME; @@ -2096,7 +2090,7 @@ zfs_lookup_internal(znode_t *dzp, char *name, vnode_t **vpp, } int -zfs_remove(znode_t *dzp, char *name, cred_t *cr, int flags) +zfs_remove(znode_t *dzp, const char *name, cred_t *cr, int flags) { vnode_t *vp; int error; @@ -2131,8 +2125,8 @@ zfs_remove(znode_t *dzp, char *name, cred_t *cr, int flags) */ /*ARGSUSED*/ int -zfs_mkdir(znode_t *dzp, char *dirname, vattr_t *vap, znode_t **zpp, cred_t *cr, - int flags, vsecattr_t *vsecp) +zfs_mkdir(znode_t *dzp, const char *dirname, vattr_t *vap, znode_t **zpp, + cred_t *cr, int flags, vsecattr_t *vsecp) { znode_t *zp; zfsvfs_t *zfsvfs = dzp->z_zfsvfs; @@ -2298,7 +2292,7 @@ zfs_mkdir(znode_t *dzp, char *dirname, vattr_t *vap, znode_t **zpp, cred_t *cr, */ /*ARGSUSED*/ static int -zfs_rmdir_(vnode_t *dvp, vnode_t *vp, char *name, cred_t *cr) +zfs_rmdir_(vnode_t *dvp, vnode_t *vp, const char *name, cred_t *cr) { znode_t *dzp = VTOZ(dvp); znode_t *zp = VTOZ(vp); @@ -2360,7 +2354,7 @@ zfs_rmdir_(vnode_t *dvp, vnode_t *vp, char *name, cred_t *cr) } int -zfs_rmdir(znode_t *dzp, char *name, znode_t *cwd, cred_t *cr, int flags) +zfs_rmdir(znode_t *dzp, const char *name, znode_t *cwd, cred_t *cr, int flags) { struct componentname cn; vnode_t *vp; @@ -3907,6 +3901,19 @@ zfs_rename_check(znode_t *szp, znode_t *sdzp, znode_t *tdzp) return (error); } +#if __FreeBSD_version < 1300110 +static void +cache_rename(struct vnode *fdvp, struct vnode *fvp, struct vnode *tdvp, + struct vnode *tvp, struct componentname *fcnp, struct componentname *tcnp) +{ + + cache_purge(fvp); + if (tvp != NULL) + cache_purge(tvp); + cache_purge_negative(tdvp); +} +#endif + /* * Move an entry from the provided source directory to the target * directory. Change the entry name as indicated. @@ -3934,8 +3941,8 @@ zfs_rename_(vnode_t *sdvp, vnode_t **svpp, struct componentname *scnp, znode_t *sdzp, *tdzp, *szp, *tzp; zilog_t *zilog = NULL; dmu_tx_t *tx; - char *snm = scnp->cn_nameptr; - char *tnm = tcnp->cn_nameptr; + const char *snm = scnp->cn_nameptr; + const char *tnm = tcnp->cn_nameptr; int error = 0; bool want_seqc_end __maybe_unused = false; @@ -4198,7 +4205,7 @@ zfs_rename_(vnode_t *sdvp, vnode_t **svpp, struct componentname *scnp, } int -zfs_rename(znode_t *sdzp, char *sname, znode_t *tdzp, char *tname, +zfs_rename(znode_t *sdzp, const char *sname, znode_t *tdzp, const char *tname, cred_t *cr, int flags) { struct componentname scn, tcn; @@ -4357,8 +4364,7 @@ zfs_symlink(znode_t *dzp, const char *name, vattr_t *vap, */ (void) zfs_link_create(dzp, name, zp, tx, ZNEW); - zfs_log_symlink(zilog, tx, txtype, dzp, zp, - __DECONST(char *, name), __DECONST(char *, link)); + zfs_log_symlink(zilog, tx, txtype, dzp, zp, name, link); *zpp = zp; zfs_acl_ids_free(&acl_ids); @@ -4429,7 +4435,7 @@ zfs_readlink(vnode_t *vp, uio_t *uio, cred_t *cr, caller_context_t *ct) */ /* ARGSUSED */ int -zfs_link(znode_t *tdzp, znode_t *szp, char *name, cred_t *cr, +zfs_link(znode_t *tdzp, znode_t *szp, const char *name, cred_t *cr, int flags) { znode_t *tzp; @@ -4738,6 +4744,8 @@ static int zfs_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr, caller_context_t *ct) { + znode_t *zp; + zfsvfs_t *zfsvfs; switch (cmd) { case _PC_LINK_MAX: @@ -4751,11 +4759,25 @@ zfs_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr, *valp = (int)SPA_MINBLOCKSIZE; return (0); case _PC_ACL_EXTENDED: +#if 0 /* POSIX ACLs are not implemented for ZFS on FreeBSD yet. */ + zp = VTOZ(vp); + zfsvfs = zp->z_zfsvfs; + ZFS_ENTER(zfsvfs); + ZFS_VERIFY_ZP(zp); + *valp = zfsvfs->z_acl_type == ZFSACLTYPE_POSIX ? 1 : 0; + ZFS_EXIT(zfsvfs); +#else *valp = 0; +#endif return (0); case _PC_ACL_NFS4: - *valp = 1; + zp = VTOZ(vp); + zfsvfs = zp->z_zfsvfs; + ZFS_ENTER(zfsvfs); + ZFS_VERIFY_ZP(zp); + *valp = zfsvfs->z_acl_type == ZFS_ACLTYPE_NFSV4 ? 1 : 0; + ZFS_EXIT(zfsvfs); return (0); case _PC_ACL_PATH_MAX: @@ -6619,7 +6641,9 @@ VFS_VOP_VECTOR_REGISTER(zfs_fifoops); */ struct vop_vector zfs_shareops = { .vop_default = &default_vnodeops, +#if __FreeBSD_version >= 1300121 .vop_fplookup_vexec = VOP_EAGAIN, +#endif .vop_access = zfs_freebsd_access, .vop_inactive = zfs_freebsd_inactive, .vop_reclaim = zfs_freebsd_reclaim, diff --git a/sys/contrib/openzfs/module/os/linux/spl/README.md b/sys/contrib/openzfs/module/os/linux/spl/README.md index 51166425f063..906530bcf2ad 100644 --- a/sys/contrib/openzfs/module/os/linux/spl/README.md +++ b/sys/contrib/openzfs/module/os/linux/spl/README.md @@ -1,5 +1,5 @@ The Solaris Porting Layer, SPL, is a Linux kernel module which provides a -compatibility layer used by the [ZFS on Linux](https://zfsonlinux.org) project. +compatibility layer used by the [OpenZFS](https://github.com/openzfs/zfs) project. # Installation diff --git a/sys/contrib/openzfs/module/os/linux/spl/spl-atomic.c b/sys/contrib/openzfs/module/os/linux/spl/spl-atomic.c index 47ed1886e157..accf656fbcc6 100644 --- a/sys/contrib/openzfs/module/os/linux/spl/spl-atomic.c +++ b/sys/contrib/openzfs/module/os/linux/spl/spl-atomic.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/module/os/linux/spl/spl-condvar.c b/sys/contrib/openzfs/module/os/linux/spl/spl-condvar.c index 49f48664503a..d0461a9f1298 100644 --- a/sys/contrib/openzfs/module/os/linux/spl/spl-condvar.c +++ b/sys/contrib/openzfs/module/os/linux/spl/spl-condvar.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/module/os/linux/spl/spl-cred.c b/sys/contrib/openzfs/module/os/linux/spl/spl-cred.c index 6e93a32e60d7..8fe1cc30ba99 100644 --- a/sys/contrib/openzfs/module/os/linux/spl/spl-cred.c +++ b/sys/contrib/openzfs/module/os/linux/spl/spl-cred.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/module/os/linux/spl/spl-err.c b/sys/contrib/openzfs/module/os/linux/spl/spl-err.c index 3c0bb71c0629..10b768d57360 100644 --- a/sys/contrib/openzfs/module/os/linux/spl/spl-err.c +++ b/sys/contrib/openzfs/module/os/linux/spl/spl-err.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/module/os/linux/spl/spl-generic.c b/sys/contrib/openzfs/module/os/linux/spl/spl-generic.c index 820fb86c3c7d..1da7618185ec 100644 --- a/sys/contrib/openzfs/module/os/linux/spl/spl-generic.c +++ b/sys/contrib/openzfs/module/os/linux/spl/spl-generic.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/module/os/linux/spl/spl-kmem-cache.c b/sys/contrib/openzfs/module/os/linux/spl/spl-kmem-cache.c index 15dc27624c55..6b3d559ffc1c 100644 --- a/sys/contrib/openzfs/module/os/linux/spl/spl-kmem-cache.c +++ b/sys/contrib/openzfs/module/os/linux/spl/spl-kmem-cache.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/module/os/linux/spl/spl-kmem.c b/sys/contrib/openzfs/module/os/linux/spl/spl-kmem.c index f19421cfcc03..943966cbb17a 100644 --- a/sys/contrib/openzfs/module/os/linux/spl/spl-kmem.c +++ b/sys/contrib/openzfs/module/os/linux/spl/spl-kmem.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -217,7 +216,7 @@ spl_kmem_alloc_impl(size_t size, int flags, int node) !(flags & KM_VMEM)) { printk(KERN_WARNING "Large kmem_alloc(%lu, 0x%x), please file an issue at:\n" - "https://github.com/zfsonlinux/zfs/issues/new\n", + "https://github.com/openzfs/zfs/issues/new\n", (unsigned long)size, flags); dump_stack(); } diff --git a/sys/contrib/openzfs/module/os/linux/spl/spl-kstat.c b/sys/contrib/openzfs/module/os/linux/spl/spl-kstat.c index b9eeb332ee57..dbbf72c8569d 100644 --- a/sys/contrib/openzfs/module/os/linux/spl/spl-kstat.c +++ b/sys/contrib/openzfs/module/os/linux/spl/spl-kstat.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/module/os/linux/spl/spl-proc.c b/sys/contrib/openzfs/module/os/linux/spl/spl-proc.c index 6936db5d6466..3e58598d43f8 100644 --- a/sys/contrib/openzfs/module/os/linux/spl/spl-proc.c +++ b/sys/contrib/openzfs/module/os/linux/spl/spl-proc.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/module/os/linux/spl/spl-taskq.c b/sys/contrib/openzfs/module/os/linux/spl/spl-taskq.c index 9cbf3e38137c..fafadffc751c 100644 --- a/sys/contrib/openzfs/module/os/linux/spl/spl-taskq.c +++ b/sys/contrib/openzfs/module/os/linux/spl/spl-taskq.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/module/os/linux/spl/spl-thread.c b/sys/contrib/openzfs/module/os/linux/spl/spl-thread.c index 0352a31ea835..db23fb64a298 100644 --- a/sys/contrib/openzfs/module/os/linux/spl/spl-thread.c +++ b/sys/contrib/openzfs/module/os/linux/spl/spl-thread.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/module/os/linux/spl/spl-tsd.c b/sys/contrib/openzfs/module/os/linux/spl/spl-tsd.c index b955ed65470f..546db9ab8bd7 100644 --- a/sys/contrib/openzfs/module/os/linux/spl/spl-tsd.c +++ b/sys/contrib/openzfs/module/os/linux/spl/spl-tsd.c @@ -5,7 +5,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/module/os/linux/spl/spl-vmem.c b/sys/contrib/openzfs/module/os/linux/spl/spl-vmem.c index 32372e6f2b60..cab3e9549cfe 100644 --- a/sys/contrib/openzfs/module/os/linux/spl/spl-vmem.c +++ b/sys/contrib/openzfs/module/os/linux/spl/spl-vmem.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/module/os/linux/spl/spl-xdr.c b/sys/contrib/openzfs/module/os/linux/spl/spl-xdr.c index 1dd31ffc1483..5e763c25606f 100644 --- a/sys/contrib/openzfs/module/os/linux/spl/spl-xdr.c +++ b/sys/contrib/openzfs/module/os/linux/spl/spl-xdr.c @@ -3,7 +3,6 @@ * Written by Ricardo Correia * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/module/os/linux/spl/spl-zlib.c b/sys/contrib/openzfs/module/os/linux/spl/spl-zlib.c index db05e28925b5..589496da0c78 100644 --- a/sys/contrib/openzfs/module/os/linux/spl/spl-zlib.c +++ b/sys/contrib/openzfs/module/os/linux/spl/spl-zlib.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/sys/contrib/openzfs/module/os/linux/zfs/zfs_acl.c b/sys/contrib/openzfs/module/os/linux/zfs/zfs_acl.c index 11b5559321ad..2628325c0ba9 100644 --- a/sys/contrib/openzfs/module/os/linux/zfs/zfs_acl.c +++ b/sys/contrib/openzfs/module/os/linux/zfs/zfs_acl.c @@ -2666,7 +2666,7 @@ zfs_zaccess(znode_t *zp, int mode, int flags, boolean_t skipaclchk, cred_t *cr) /* * Translate traditional unix S_IRUSR/S_IWUSR/S_IXUSR mode into - * native ACL format and call zfs_zaccess() + * NFSv4-style ZFS ACL format and call zfs_zaccess() */ int zfs_zaccess_rwx(znode_t *zp, mode_t mode, int flags, cred_t *cr) diff --git a/sys/contrib/openzfs/module/os/linux/zfs/zfs_ctldir.c b/sys/contrib/openzfs/module/os/linux/zfs/zfs_ctldir.c index 26e785a0d422..c13a9771235d 100644 --- a/sys/contrib/openzfs/module/os/linux/zfs/zfs_ctldir.c +++ b/sys/contrib/openzfs/module/os/linux/zfs/zfs_ctldir.c @@ -131,7 +131,7 @@ static void zfsctl_snapshot_unmount_delay_impl(zfs_snapentry_t *se, int delay); * the snapshot name and provided mount point. No reference is taken. */ static zfs_snapentry_t * -zfsctl_snapshot_alloc(char *full_name, char *full_path, spa_t *spa, +zfsctl_snapshot_alloc(const char *full_name, const char *full_path, spa_t *spa, uint64_t objsetid, struct dentry *root_dentry) { zfs_snapentry_t *se; @@ -261,13 +261,13 @@ snapentry_compare_by_objsetid(const void *a, const void *b) * NULL will be returned. */ static zfs_snapentry_t * -zfsctl_snapshot_find_by_name(char *snapname) +zfsctl_snapshot_find_by_name(const char *snapname) { zfs_snapentry_t *se, search; ASSERT(RW_LOCK_HELD(&zfs_snapshot_lock)); - search.se_name = snapname; + search.se_name = (char *)snapname; se = avl_find(&zfs_snapshots_by_name, &search, NULL); if (se) zfsctl_snapshot_hold(se); @@ -301,7 +301,7 @@ zfsctl_snapshot_find_by_objsetid(spa_t *spa, uint64_t objsetid) * removed, renamed, and added back to the new correct location in the tree. */ static int -zfsctl_snapshot_rename(char *old_snapname, char *new_snapname) +zfsctl_snapshot_rename(const char *old_snapname, const char *new_snapname) { zfs_snapentry_t *se; @@ -410,7 +410,7 @@ zfsctl_snapshot_unmount_delay(spa_t *spa, uint64_t objsetid, int delay) * and zero when unmounted. */ static boolean_t -zfsctl_snapshot_ismounted(char *snapname) +zfsctl_snapshot_ismounted(const char *snapname) { zfs_snapentry_t *se; boolean_t ismounted = B_FALSE; @@ -751,7 +751,7 @@ zfsctl_snapshot_path_objset(zfsvfs_t *zfsvfs, uint64_t objsetid, * Special case the handling of "..". */ int -zfsctl_root_lookup(struct inode *dip, char *name, struct inode **ipp, +zfsctl_root_lookup(struct inode *dip, const char *name, struct inode **ipp, int flags, cred_t *cr, int *direntflags, pathname_t *realpnp) { zfsvfs_t *zfsvfs = ITOZSB(dip); @@ -784,7 +784,7 @@ zfsctl_root_lookup(struct inode *dip, char *name, struct inode **ipp, * snapshot if it exist, creating the pseudo filesystem inode as necessary. */ int -zfsctl_snapdir_lookup(struct inode *dip, char *name, struct inode **ipp, +zfsctl_snapdir_lookup(struct inode *dip, const char *name, struct inode **ipp, int flags, cred_t *cr, int *direntflags, pathname_t *realpnp) { zfsvfs_t *zfsvfs = ITOZSB(dip); @@ -815,8 +815,8 @@ zfsctl_snapdir_lookup(struct inode *dip, char *name, struct inode **ipp, * to the '.zfs/snapshot' directory snapshots cannot be moved elsewhere. */ int -zfsctl_snapdir_rename(struct inode *sdip, char *snm, - struct inode *tdip, char *tnm, cred_t *cr, int flags) +zfsctl_snapdir_rename(struct inode *sdip, const char *snm, + struct inode *tdip, const char *tnm, cred_t *cr, int flags) { zfsvfs_t *zfsvfs = ITOZSB(sdip); char *to, *from, *real, *fsname; @@ -893,7 +893,8 @@ zfsctl_snapdir_rename(struct inode *sdip, char *snm, * the removal of the snapshot with the given name. */ int -zfsctl_snapdir_remove(struct inode *dip, char *name, cred_t *cr, int flags) +zfsctl_snapdir_remove(struct inode *dip, const char *name, cred_t *cr, + int flags) { zfsvfs_t *zfsvfs = ITOZSB(dip); char *snapname, *real; @@ -941,7 +942,7 @@ zfsctl_snapdir_remove(struct inode *dip, char *name, cred_t *cr, int flags) * the creation of a new snapshot with the given name. */ int -zfsctl_snapdir_mkdir(struct inode *dip, char *dirname, vattr_t *vap, +zfsctl_snapdir_mkdir(struct inode *dip, const char *dirname, vattr_t *vap, struct inode **ipp, cred_t *cr, int flags) { zfsvfs_t *zfsvfs = ITOZSB(dip); @@ -1001,7 +1002,7 @@ exportfs_flush(void) * it's in use, the unmount will fail harmlessly. */ int -zfsctl_snapshot_unmount(char *snapname, int flags) +zfsctl_snapshot_unmount(const char *snapname, int flags) { char *argv[] = { "/usr/bin/env", "umount", "-t", "zfs", "-n", NULL, NULL }; diff --git a/sys/contrib/openzfs/module/os/linux/zfs/zfs_dir.c b/sys/contrib/openzfs/module/os/linux/zfs/zfs_dir.c index 383657208df3..207a51d75bc9 100644 --- a/sys/contrib/openzfs/module/os/linux/zfs/zfs_dir.c +++ b/sys/contrib/openzfs/module/os/linux/zfs/zfs_dir.c @@ -60,8 +60,9 @@ * of names after deciding which is the appropriate lookup interface. */ static int -zfs_match_find(zfsvfs_t *zfsvfs, znode_t *dzp, char *name, matchtype_t mt, - boolean_t update, int *deflags, pathname_t *rpnp, uint64_t *zoid) +zfs_match_find(zfsvfs_t *zfsvfs, znode_t *dzp, const char *name, + matchtype_t mt, boolean_t update, int *deflags, pathname_t *rpnp, + uint64_t *zoid) { boolean_t conflict = B_FALSE; int error; @@ -139,8 +140,8 @@ zfs_match_find(zfsvfs_t *zfsvfs, znode_t *dzp, char *name, matchtype_t mt, * but return znode pointers to a single match. */ int -zfs_dirent_lock(zfs_dirlock_t **dlpp, znode_t *dzp, char *name, znode_t **zpp, - int flag, int *direntflags, pathname_t *realpnp) +zfs_dirent_lock(zfs_dirlock_t **dlpp, znode_t *dzp, char *name, + znode_t **zpp, int flag, int *direntflags, pathname_t *realpnp) { zfsvfs_t *zfsvfs = ZTOZSB(dzp); zfs_dirlock_t *dl; diff --git a/sys/contrib/openzfs/module/os/linux/zfs/zfs_vfsops.c b/sys/contrib/openzfs/module/os/linux/zfs/zfs_vfsops.c index 15ec7b91b001..b218237d07ff 100644 --- a/sys/contrib/openzfs/module/os/linux/zfs/zfs_vfsops.c +++ b/sys/contrib/openzfs/module/os/linux/zfs/zfs_vfsops.c @@ -352,6 +352,7 @@ acltype_changed_cb(void *arg, uint64_t newval) zfsvfs_t *zfsvfs = arg; switch (newval) { + case ZFS_ACLTYPE_NFSV4: case ZFS_ACLTYPE_OFF: zfsvfs->z_acl_type = ZFS_ACLTYPE_OFF; zfsvfs->z_sb->s_flags &= ~SB_POSIXACL; diff --git a/sys/contrib/openzfs/module/os/linux/zfs/zfs_vnops.c b/sys/contrib/openzfs/module/os/linux/zfs/zfs_vnops.c index 2d104a5001ec..b668c7dff013 100644 --- a/sys/contrib/openzfs/module/os/linux/zfs/zfs_vnops.c +++ b/sys/contrib/openzfs/module/os/linux/zfs/zfs_vnops.c @@ -1234,8 +1234,8 @@ zfs_access(struct inode *ip, int mode, int flag, cred_t *cr) */ /* ARGSUSED */ int -zfs_lookup(znode_t *zdp, char *nm, znode_t **zpp, int flags, - cred_t *cr, int *direntflags, pathname_t *realpnp) +zfs_lookup(znode_t *zdp, char *nm, znode_t **zpp, int flags, cred_t *cr, + int *direntflags, pathname_t *realpnp) { zfsvfs_t *zfsvfs = ZTOZSB(zdp); int error = 0; @@ -2543,7 +2543,7 @@ zfs_setattr_dir(znode_t *dzp) zap_cursor_t zc; zap_attribute_t zap; zfs_dirlock_t *dl; - znode_t *zp; + znode_t *zp = NULL; dmu_tx_t *tx = NULL; uint64_t uid, gid; sa_bulk_attr_t bulk[4]; diff --git a/sys/contrib/openzfs/module/unicode/u8_textprep.c b/sys/contrib/openzfs/module/unicode/u8_textprep.c index 65f555d88947..be816d728359 100644 --- a/sys/contrib/openzfs/module/unicode/u8_textprep.c +++ b/sys/contrib/openzfs/module/unicode/u8_textprep.c @@ -330,7 +330,7 @@ const uint8_t u8_valid_max_2nd_byte[0x100] = { * specific to UTF-8 and Unicode. */ int -u8_validate(char *u8str, size_t n, char **list, int flag, int *errnum) +u8_validate(const char *u8str, size_t n, char **list, int flag, int *errnum) { uchar_t *ib; uchar_t *ibtail; diff --git a/sys/contrib/openzfs/module/zcommon/zfs_prop.c b/sys/contrib/openzfs/module/zcommon/zfs_prop.c index f3dbbc15d25e..0352b13aa240 100644 --- a/sys/contrib/openzfs/module/zcommon/zfs_prop.c +++ b/sys/contrib/openzfs/module/zcommon/zfs_prop.c @@ -254,6 +254,7 @@ zfs_prop_init(void) static zprop_index_t acltype_table[] = { { "off", ZFS_ACLTYPE_OFF }, { "posix", ZFS_ACLTYPE_POSIX }, + { "nfsv4", ZFS_ACLTYPE_NFSV4 }, { "disabled", ZFS_ACLTYPE_OFF }, /* bkwrd compatibility */ { "noacl", ZFS_ACLTYPE_OFF }, /* bkwrd compatibility */ { "posixacl", ZFS_ACLTYPE_POSIX }, /* bkwrd compatibility */ @@ -428,11 +429,15 @@ zfs_prop_init(void) PROP_INHERIT, ZFS_TYPE_FILESYSTEM, "discard | groupmask | passthrough | restricted", "ACLMODE", acl_mode_table); -#ifndef __FreeBSD__ - zprop_register_index(ZFS_PROP_ACLTYPE, "acltype", ZFS_ACLTYPE_OFF, - PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_SNAPSHOT, - "off | posix", "ACLTYPE", acltype_table); + zprop_register_index(ZFS_PROP_ACLTYPE, "acltype", +#ifdef __linux__ + /* Linux doesn't natively support ZFS's NFSv4-style ACLs. */ + ZFS_ACLTYPE_OFF, +#else + ZFS_ACLTYPE_NFSV4, #endif + PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_SNAPSHOT, + "off | nfsv4 | posix", "ACLTYPE", acltype_table); zprop_register_index(ZFS_PROP_ACLINHERIT, "aclinherit", ZFS_ACL_RESTRICTED, PROP_INHERIT, ZFS_TYPE_FILESYSTEM, "discard | noallow | restricted | passthrough | passthrough-x", @@ -702,12 +707,6 @@ zfs_prop_init(void) * that we don't have to change the values of the zfs_prop_t enum, or * have NULL pointers in the zfs_prop_table[]. */ -#ifdef __FreeBSD__ - zprop_register_impl(ZFS_PROP_ACLTYPE, "acltype", PROP_TYPE_INDEX, - ZFS_ACLTYPE_OFF, NULL, PROP_INHERIT, - ZFS_TYPE_FILESYSTEM | ZFS_TYPE_SNAPSHOT, - "off | posix", "ACLTYPE", B_FALSE, B_FALSE, acltype_table); -#endif zprop_register_hidden(ZFS_PROP_REMAPTXG, "remaptxg", PROP_TYPE_NUMBER, PROP_READONLY, ZFS_TYPE_DATASET, "REMAPTXG"); diff --git a/sys/contrib/openzfs/module/zfs/dmu_objset.c b/sys/contrib/openzfs/module/zfs/dmu_objset.c index b1590d7dba91..af5935e2374d 100644 --- a/sys/contrib/openzfs/module/zfs/dmu_objset.c +++ b/sys/contrib/openzfs/module/zfs/dmu_objset.c @@ -2413,7 +2413,7 @@ dmu_objset_is_snapshot(objset_t *os) } int -dmu_snapshot_realname(objset_t *os, char *name, char *real, int maxlen, +dmu_snapshot_realname(objset_t *os, const char *name, char *real, int maxlen, boolean_t *conflict) { dsl_dataset_t *ds = os->os_dsl_dataset; diff --git a/sys/contrib/openzfs/module/zfs/dmu_redact.c b/sys/contrib/openzfs/module/zfs/dmu_redact.c index c53fba75cc51..225ec40537ec 100644 --- a/sys/contrib/openzfs/module/zfs/dmu_redact.c +++ b/sys/contrib/openzfs/module/zfs/dmu_redact.c @@ -1062,9 +1062,9 @@ dmu_redact_snap(const char *snapname, nvlist_t *redactnvl, } } - VERIFY3P(nvlist_next_nvpair(redactnvl, pair), ==, NULL); if (err != 0) goto out; + VERIFY3P(nvlist_next_nvpair(redactnvl, pair), ==, NULL); boolean_t resuming = B_FALSE; zfs_bookmark_phys_t bookmark; diff --git a/sys/contrib/openzfs/module/zfs/dmu_traverse.c b/sys/contrib/openzfs/module/zfs/dmu_traverse.c index 83830fe39279..31db49dae68c 100644 --- a/sys/contrib/openzfs/module/zfs/dmu_traverse.c +++ b/sys/contrib/openzfs/module/zfs/dmu_traverse.c @@ -73,7 +73,8 @@ static void prefetch_dnode_metadata(traverse_data_t *td, const dnode_phys_t *, uint64_t objset, uint64_t object); static int -traverse_zil_block(zilog_t *zilog, blkptr_t *bp, void *arg, uint64_t claim_txg) +traverse_zil_block(zilog_t *zilog, const blkptr_t *bp, void *arg, + uint64_t claim_txg) { traverse_data_t *td = arg; zbookmark_phys_t zb; @@ -93,7 +94,8 @@ traverse_zil_block(zilog_t *zilog, blkptr_t *bp, void *arg, uint64_t claim_txg) } static int -traverse_zil_record(zilog_t *zilog, lr_t *lrc, void *arg, uint64_t claim_txg) +traverse_zil_record(zilog_t *zilog, const lr_t *lrc, void *arg, + uint64_t claim_txg) { traverse_data_t *td = arg; diff --git a/sys/contrib/openzfs/module/zfs/dmu_zfetch.c b/sys/contrib/openzfs/module/zfs/dmu_zfetch.c index 5935b5f995be..4d86863f30ea 100644 --- a/sys/contrib/openzfs/module/zfs/dmu_zfetch.c +++ b/sys/contrib/openzfs/module/zfs/dmu_zfetch.c @@ -377,7 +377,10 @@ ZFS_MODULE_PARAM(zfs_prefetch, zfetch_, min_sec_reap, UINT, ZMOD_RW, "Min time before stream reclaim"); ZFS_MODULE_PARAM(zfs_prefetch, zfetch_, max_distance, UINT, ZMOD_RW, - "Max bytes to prefetch per stream (default 8MB)"); + "Max bytes to prefetch per stream"); + +ZFS_MODULE_PARAM(zfs_prefetch, zfetch_, max_idistance, UINT, ZMOD_RW, + "Max bytes to prefetch indirects for per stream"); ZFS_MODULE_PARAM(zfs_prefetch, zfetch_, array_rd_sz, ULONG, ZMOD_RW, "Number of bytes in a array_read"); diff --git a/sys/contrib/openzfs/module/zfs/dsl_scan.c b/sys/contrib/openzfs/module/zfs/dsl_scan.c index 0ebda2f77074..4704781bfa45 100644 --- a/sys/contrib/openzfs/module/zfs/dsl_scan.c +++ b/sys/contrib/openzfs/module/zfs/dsl_scan.c @@ -1375,7 +1375,8 @@ typedef struct zil_scan_arg { /* ARGSUSED */ static int -dsl_scan_zil_block(zilog_t *zilog, blkptr_t *bp, void *arg, uint64_t claim_txg) +dsl_scan_zil_block(zilog_t *zilog, const blkptr_t *bp, void *arg, + uint64_t claim_txg) { zil_scan_arg_t *zsa = arg; dsl_pool_t *dp = zsa->zsa_dp; @@ -1405,15 +1406,16 @@ dsl_scan_zil_block(zilog_t *zilog, blkptr_t *bp, void *arg, uint64_t claim_txg) /* ARGSUSED */ static int -dsl_scan_zil_record(zilog_t *zilog, lr_t *lrc, void *arg, uint64_t claim_txg) +dsl_scan_zil_record(zilog_t *zilog, const lr_t *lrc, void *arg, + uint64_t claim_txg) { if (lrc->lrc_txtype == TX_WRITE) { zil_scan_arg_t *zsa = arg; dsl_pool_t *dp = zsa->zsa_dp; dsl_scan_t *scn = dp->dp_scan; zil_header_t *zh = zsa->zsa_zh; - lr_write_t *lr = (lr_write_t *)lrc; - blkptr_t *bp = &lr->lr_blkptr; + const lr_write_t *lr = (const lr_write_t *)lrc; + const blkptr_t *bp = &lr->lr_blkptr; zbookmark_phys_t zb; ASSERT(!BP_IS_REDACTED(bp)); diff --git a/sys/contrib/openzfs/module/zfs/pathname.c b/sys/contrib/openzfs/module/zfs/pathname.c index 4766762f37d1..84ab7b7e1111 100644 --- a/sys/contrib/openzfs/module/zfs/pathname.c +++ b/sys/contrib/openzfs/module/zfs/pathname.c @@ -73,10 +73,6 @@ pn_alloc_sz(struct pathname *pnp, size_t sz) { pnp->pn_buf = kmem_alloc(sz, KM_SLEEP); pnp->pn_bufsize = sz; -#if 0 /* unused in ZoL */ - pnp->pn_path = pnp->pn_buf; - pnp->pn_pathlen = 0; -#endif } /* @@ -89,8 +85,4 @@ pn_free(struct pathname *pnp) kmem_free(pnp->pn_buf, pnp->pn_bufsize); pnp->pn_buf = NULL; pnp->pn_bufsize = 0; -#if 0 /* unused in ZoL */ - pnp->pn_path = NULL; - pnp->pn_pathlen = 0; -#endif } diff --git a/sys/contrib/openzfs/module/zfs/range_tree.c b/sys/contrib/openzfs/module/zfs/range_tree.c index 2ce0139c9137..5219fd079b73 100644 --- a/sys/contrib/openzfs/module/zfs/range_tree.c +++ b/sys/contrib/openzfs/module/zfs/range_tree.c @@ -314,7 +314,6 @@ range_tree_add_impl(void *arg, uint64_t start, uint64_t size, uint64_t fill) return; } - zfs_btree_remove(&rt->rt_root, rs); if (rt->rt_ops != NULL && rt->rt_ops->rtop_remove != NULL) rt->rt_ops->rtop_remove(rt, rs, rt->rt_arg); @@ -326,6 +325,7 @@ range_tree_add_impl(void *arg, uint64_t start, uint64_t size, uint64_t fill) end = MAX(end, rend); size = end - start; + zfs_btree_remove(&rt->rt_root, rs); range_tree_add_impl(rt, start, size, fill); return; } diff --git a/sys/contrib/openzfs/module/zfs/spa.c b/sys/contrib/openzfs/module/zfs/spa.c index 532f04b91ca1..9d1d4e0cca64 100644 --- a/sys/contrib/openzfs/module/zfs/spa.c +++ b/sys/contrib/openzfs/module/zfs/spa.c @@ -1260,7 +1260,7 @@ spa_activate(spa_t *spa, spa_mode_t mode) /* * This taskq is used to perform zvol-minor-related tasks * asynchronously. This has several advantages, including easy - * resolution of various deadlocks (zfsonlinux bug #3681). + * resolution of various deadlocks. * * The taskq must be single threaded to ensure tasks are always * processed in the order in which they were dispatched. @@ -6225,7 +6225,7 @@ spa_tryimport(nvlist_t *tryconfig) * we don't sync the labels or remove the configuration cache. */ static int -spa_export_common(char *pool, int new_state, nvlist_t **oldconfig, +spa_export_common(const char *pool, int new_state, nvlist_t **oldconfig, boolean_t force, boolean_t hardforce) { spa_t *spa; @@ -6369,7 +6369,7 @@ spa_export_common(char *pool, int new_state, nvlist_t **oldconfig, * Destroy a storage pool. */ int -spa_destroy(char *pool) +spa_destroy(const char *pool) { return (spa_export_common(pool, POOL_STATE_DESTROYED, NULL, B_FALSE, B_FALSE)); @@ -6379,7 +6379,7 @@ spa_destroy(char *pool) * Export a storage pool. */ int -spa_export(char *pool, nvlist_t **oldconfig, boolean_t force, +spa_export(const char *pool, nvlist_t **oldconfig, boolean_t force, boolean_t hardforce) { return (spa_export_common(pool, POOL_STATE_EXPORTED, oldconfig, @@ -6391,7 +6391,7 @@ spa_export(char *pool, nvlist_t **oldconfig, boolean_t force, * from the namespace in any way. */ int -spa_reset(char *pool) +spa_reset(const char *pool) { return (spa_export_common(pool, POOL_STATE_UNINITIALIZED, NULL, B_FALSE, B_FALSE)); diff --git a/sys/contrib/openzfs/module/zfs/vdev.c b/sys/contrib/openzfs/module/zfs/vdev.c index a94101485c94..6af61cdcd9bf 100644 --- a/sys/contrib/openzfs/module/zfs/vdev.c +++ b/sys/contrib/openzfs/module/zfs/vdev.c @@ -1286,9 +1286,9 @@ vdev_metaslab_group_create(vdev_t *vd) spa->spa_alloc_count); /* - * The spa ashift values currently only reflect the - * general vdev classes. Class destination is late - * binding so ashift checking had to wait until now + * The spa ashift min/max only apply for the normal metaslab + * class. Class destination is late binding so ashift boundry + * setting had to wait until now. */ if (vd->vdev_top == vd && vd->vdev_ashift != 0 && mc == spa_normal_class(spa) && vd->vdev_aux == NULL) { @@ -1952,18 +1952,6 @@ vdev_open(vdev_t *vd) return (error); } - /* - * Track the min and max ashift values for normal data devices. - */ - if (vd->vdev_top == vd && vd->vdev_ashift != 0 && - vd->vdev_alloc_bias == VDEV_BIAS_NONE && - vd->vdev_islog == 0 && vd->vdev_aux == NULL) { - if (vd->vdev_ashift > spa->spa_max_ashift) - spa->spa_max_ashift = vd->vdev_ashift; - if (vd->vdev_ashift < spa->spa_min_ashift) - spa->spa_min_ashift = vd->vdev_ashift; - } - /* * If this is a leaf vdev, assess whether a resilver is needed. * But don't do this if we are doing a reopen for a scrub, since diff --git a/sys/contrib/openzfs/module/zfs/vdev_label.c b/sys/contrib/openzfs/module/zfs/vdev_label.c index 7fab7d0d7950..d063b77ea836 100644 --- a/sys/contrib/openzfs/module/zfs/vdev_label.c +++ b/sys/contrib/openzfs/module/zfs/vdev_label.c @@ -613,7 +613,8 @@ vdev_config_generate(spa_t *spa, vdev_t *vd, boolean_t getstats, * as a single mapping. */ for (int i = 0; i < RANGE_TREE_HISTOGRAM_SIZE; i++) { - if (1ULL << (i + 1) < vdev_removal_max_span) { + if (i + 1 < highbit64(vdev_removal_max_span) + - 1) { to_alloc += vd->vdev_mg->mg_histogram[i] << (i + 1); @@ -1433,7 +1434,7 @@ vdev_uberblock_compare(const uberblock_t *ub1, const uberblock_t *ub2) /* * If MMP_VALID(ub) && MMP_SEQ_VALID(ub) then the host has an MMP-aware - * ZFS, e.g. zfsonlinux >= 0.7. + * ZFS, e.g. OpenZFS >= 0.7. * * If one ub has MMP and the other does not, they were written by * different hosts, which matters for MMP. So we treat no MMP/no SEQ as diff --git a/sys/contrib/openzfs/module/zfs/vdev_removal.c b/sys/contrib/openzfs/module/zfs/vdev_removal.c index fdeca7ab3418..ed7d1d4b3030 100644 --- a/sys/contrib/openzfs/module/zfs/vdev_removal.c +++ b/sys/contrib/openzfs/module/zfs/vdev_removal.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2019 by Delphix. All rights reserved. + * Copyright (c) 2011, 2020 by Delphix. All rights reserved. * Copyright (c) 2019, loli10K . All rights reserved. */ @@ -2030,6 +2030,15 @@ spa_vdev_remove_top_check(vdev_t *vd) return (SET_ERROR(EINVAL)); } + /* + * A removed special/dedup vdev must have same ashift as normal class. + */ + ASSERT(!vd->vdev_islog); + if (vd->vdev_alloc_bias != VDEV_BIAS_NONE && + vd->vdev_ashift != spa->spa_max_ashift) { + return (SET_ERROR(EINVAL)); + } + /* * All vdevs in normal class must have the same ashift * and not be raidz. @@ -2038,7 +2047,18 @@ spa_vdev_remove_top_check(vdev_t *vd) int num_indirect = 0; for (uint64_t id = 0; id < rvd->vdev_children; id++) { vdev_t *cvd = rvd->vdev_child[id]; - if (cvd->vdev_ashift != 0 && !cvd->vdev_islog) + + /* + * A removed special/dedup vdev must have the same ashift + * across all vdevs in its class. + */ + if (vd->vdev_alloc_bias != VDEV_BIAS_NONE && + cvd->vdev_alloc_bias == vd->vdev_alloc_bias && + cvd->vdev_ashift != vd->vdev_ashift) { + return (SET_ERROR(EINVAL)); + } + if (cvd->vdev_ashift != 0 && + cvd->vdev_alloc_bias == VDEV_BIAS_NONE) ASSERT3U(cvd->vdev_ashift, ==, spa->spa_max_ashift); if (cvd->vdev_ops == &vdev_indirect_ops) num_indirect++; diff --git a/sys/contrib/openzfs/module/zfs/zfeature.c b/sys/contrib/openzfs/module/zfs/zfeature.c index 3757443a5a68..9d16fff81d0a 100644 --- a/sys/contrib/openzfs/module/zfs/zfeature.c +++ b/sys/contrib/openzfs/module/zfs/zfeature.c @@ -203,7 +203,7 @@ spa_features_check(spa_t *spa, boolean_t for_write, supported = B_FALSE; if (NULL != unsup_feat) { - char *desc = ""; + const char *desc = ""; if (zap_lookup(os, spa->spa_feat_desc_obj, za->za_name, 1, MAXPATHLEN, buf) == 0) diff --git a/sys/contrib/openzfs/module/zfs/zfs_ioctl.c b/sys/contrib/openzfs/module/zfs/zfs_ioctl.c index eff66b32fcb1..94cd1a3dc834 100644 --- a/sys/contrib/openzfs/module/zfs/zfs_ioctl.c +++ b/sys/contrib/openzfs/module/zfs/zfs_ioctl.c @@ -270,7 +270,7 @@ static int zfs_ioc_userspace_upgrade(zfs_cmd_t *zc); static int zfs_ioc_id_quota_upgrade(zfs_cmd_t *zc); static int zfs_check_settable(const char *name, nvpair_t *property, cred_t *cr); -static int zfs_check_clearable(char *dataset, nvlist_t *props, +static int zfs_check_clearable(const char *dataset, nvlist_t *props, nvlist_t **errors); static int zfs_fill_zplprops_root(uint64_t, nvlist_t *, nvlist_t *, boolean_t *); @@ -498,7 +498,7 @@ zfs_secpolicy_write_perms(const char *name, const char *perm, cred_t *cr) * Returns 0 for success, non-zero for access and other errors. */ static int -zfs_set_slabel_policy(const char *name, char *strval, cred_t *cr) +zfs_set_slabel_policy(const char *name, const char *strval, cred_t *cr) { #ifdef HAVE_MLSLABEL char ds_hexsl[MAXNAMELEN]; @@ -553,7 +553,7 @@ zfs_set_slabel_policy(const char *name, char *strval, cred_t *cr) */ if (strcasecmp(ds_hexsl, ZFS_MLSLABEL_DEFAULT) != 0) { objset_t *os; - static char *setsl_tag = "setsl_tag"; + static const char *setsl_tag = "setsl_tag"; /* * Try to own the dataset; abort if there is any error, @@ -680,7 +680,7 @@ zfs_secpolicy_send(zfs_cmd_t *zc, nvlist_t *innvl, cred_t *cr) { dsl_pool_t *dp; dsl_dataset_t *ds; - char *cp; + const char *cp; int error; /* @@ -1443,7 +1443,7 @@ zfs_ioc_pool_create(zfs_cmd_t *zc) nvlist_t *rootprops = NULL; nvlist_t *zplprops = NULL; dsl_crypto_params_t *dcp = NULL; - char *spa_name = zc->zc_name; + const char *spa_name = zc->zc_name; boolean_t unload_wkey = B_TRUE; if ((error = get_nvlist(zc->zc_nvlist_conf, zc->zc_nvlist_conf_size, @@ -1997,7 +1997,7 @@ static int zfs_ioc_vdev_setpath(zfs_cmd_t *zc) { spa_t *spa; - char *path = zc->zc_value; + const char *path = zc->zc_value; uint64_t guid = zc->zc_guid; int error; @@ -2014,7 +2014,7 @@ static int zfs_ioc_vdev_setfru(zfs_cmd_t *zc) { spa_t *spa; - char *fru = zc->zc_value; + const char *fru = zc->zc_value; uint64_t guid = zc->zc_guid; int error; @@ -2351,8 +2351,7 @@ zfs_prop_set_userquota(const char *dsname, nvpair_t *pair) const char *propname = nvpair_name(pair); uint64_t *valary; unsigned int vallen; - const char *domain; - char *dash; + const char *dash, *domain; zfs_userquota_prop_t type; uint64_t rid; uint64_t quota; @@ -2405,7 +2404,7 @@ zfs_prop_set_special(const char *dsname, zprop_source_t source, const char *propname = nvpair_name(pair); zfs_prop_t prop = zfs_name_to_prop(propname); uint64_t intval = 0; - char *strval = NULL; + const char *strval = NULL; int err = -1; if (prop == ZPROP_INVAL) { @@ -2531,7 +2530,7 @@ zfs_set_prop_nvlist(const char *dsname, zprop_source_t source, nvlist_t *nvl, nvpair_t *propval; int rv = 0; uint64_t intval; - char *strval; + const char *strval; nvlist_t *genericnvl = fnvlist_alloc(); nvlist_t *retrynvl = fnvlist_alloc(); @@ -3349,7 +3348,7 @@ zfs_ioc_clone(const char *fsname, nvlist_t *innvl, nvlist_t *outnvl) { int error = 0; nvlist_t *nvprops = NULL; - char *origin_name; + const char *origin_name; origin_name = fnvlist_lookup_string(innvl, "origin"); (void) nvlist_lookup_nvlist(innvl, "props", &nvprops); @@ -3475,10 +3474,10 @@ static const zfs_ioc_key_t zfs_keys_log_history[] = { static int zfs_ioc_log_history(const char *unused, nvlist_t *innvl, nvlist_t *outnvl) { - char *message; + const char *message; + char *poolname; spa_t *spa; int error; - char *poolname; /* * The poolname in the ioctl is not set, we get it from the TSD, @@ -3574,7 +3573,7 @@ zfs_unmount_snap(const char *snapname) if (strchr(snapname, '@') == NULL) return; - (void) zfsctl_snapshot_unmount((char *)snapname, MNT_FORCE); + (void) zfsctl_snapshot_unmount(snapname, MNT_FORCE); } /* ARGSUSED */ @@ -4617,7 +4616,7 @@ zfs_check_settable(const char *dsname, nvpair_t *pair, cred_t *cr) * pointed at by errlist is NULL. */ static int -zfs_check_clearable(char *dataset, nvlist_t *props, nvlist_t **errlist) +zfs_check_clearable(const char *dataset, nvlist_t *props, nvlist_t **errlist) { zfs_cmd_t *zc; nvpair_t *pair, *next_pair; @@ -6429,8 +6428,10 @@ send_space_sum(objset_t *os, void *buf, int len, void *arg) * presence indicates DRR_WRITE_EMBEDDED records are permitted * (optional) "compressok" -> (value ignored) * presence indicates compressed DRR_WRITE records are permitted - * (optional) "rawok" -> (value ignored) + * (optional) "rawok" -> (value ignored) * presence indicates raw encrypted records should be used. + * (optional) "resume_object" and "resume_offset" -> (uint64) + * if present, resume send stream from specified object and offset. * (optional) "fd" -> file descriptor to use as a cookie for progress * tracking (int32) * } @@ -6448,9 +6449,9 @@ static const zfs_ioc_key_t zfs_keys_send_space[] = { {"rawok", DATA_TYPE_BOOLEAN, ZK_OPTIONAL}, {"fd", DATA_TYPE_INT32, ZK_OPTIONAL}, {"redactbook", DATA_TYPE_STRING, ZK_OPTIONAL}, - {"resumeobj", DATA_TYPE_UINT64, ZK_OPTIONAL}, - {"resumeoff", DATA_TYPE_UINT64, ZK_OPTIONAL}, - {"bytes", DATA_TYPE_UINT64, ZK_OPTIONAL}, + {"resume_object", DATA_TYPE_UINT64, ZK_OPTIONAL}, + {"resume_offset", DATA_TYPE_UINT64, ZK_OPTIONAL}, + {"bytes", DATA_TYPE_UINT64, ZK_OPTIONAL}, }; static int diff --git a/sys/contrib/openzfs/module/zfs/zfs_log.c b/sys/contrib/openzfs/module/zfs/zfs_log.c index fb44007fefc3..4bb529f78838 100644 --- a/sys/contrib/openzfs/module/zfs/zfs_log.c +++ b/sys/contrib/openzfs/module/zfs/zfs_log.c @@ -299,7 +299,7 @@ zfs_xattr_owner_unlinked(znode_t *zp) */ void zfs_log_create(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, - znode_t *dzp, znode_t *zp, char *name, vsecattr_t *vsecp, + znode_t *dzp, znode_t *zp, const char *name, vsecattr_t *vsecp, zfs_fuid_info_t *fuidp, vattr_t *vap) { itx_t *itx; @@ -413,7 +413,7 @@ zfs_log_create(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, */ void zfs_log_remove(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, - znode_t *dzp, char *name, uint64_t foid, boolean_t unlinked) + znode_t *dzp, const char *name, uint64_t foid, boolean_t unlinked) { itx_t *itx; lr_remove_t *lr; @@ -448,7 +448,7 @@ zfs_log_remove(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, */ void zfs_log_link(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, - znode_t *dzp, znode_t *zp, char *name) + znode_t *dzp, znode_t *zp, const char *name) { itx_t *itx; lr_link_t *lr; @@ -471,7 +471,7 @@ zfs_log_link(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, */ void zfs_log_symlink(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, - znode_t *dzp, znode_t *zp, char *name, char *link) + znode_t *dzp, znode_t *zp, const char *name, const char *link) { itx_t *itx; lr_create_t *lr; @@ -502,8 +502,8 @@ zfs_log_symlink(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, * Handles TX_RENAME transactions. */ void -zfs_log_rename(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, - znode_t *sdzp, char *sname, znode_t *tdzp, char *dname, znode_t *szp) +zfs_log_rename(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, znode_t *sdzp, + const char *sname, znode_t *tdzp, const char *dname, znode_t *szp) { itx_t *itx; lr_rename_t *lr; diff --git a/sys/contrib/openzfs/module/zfs/zil.c b/sys/contrib/openzfs/module/zfs/zil.c index 9dc20ba14f37..632fef29bff4 100644 --- a/sys/contrib/openzfs/module/zfs/zil.c +++ b/sys/contrib/openzfs/module/zfs/zil.c @@ -432,7 +432,8 @@ zil_parse(zilog_t *zilog, zil_parse_blk_func_t *parse_blk_func, /* ARGSUSED */ static int -zil_clear_log_block(zilog_t *zilog, blkptr_t *bp, void *tx, uint64_t first_txg) +zil_clear_log_block(zilog_t *zilog, const blkptr_t *bp, void *tx, + uint64_t first_txg) { ASSERT(!BP_IS_HOLE(bp)); @@ -454,13 +455,15 @@ zil_clear_log_block(zilog_t *zilog, blkptr_t *bp, void *tx, uint64_t first_txg) /* ARGSUSED */ static int -zil_noop_log_record(zilog_t *zilog, lr_t *lrc, void *tx, uint64_t first_txg) +zil_noop_log_record(zilog_t *zilog, const lr_t *lrc, void *tx, + uint64_t first_txg) { return (0); } static int -zil_claim_log_block(zilog_t *zilog, blkptr_t *bp, void *tx, uint64_t first_txg) +zil_claim_log_block(zilog_t *zilog, const blkptr_t *bp, void *tx, + uint64_t first_txg) { /* * Claim log block if not already committed and not already claimed. @@ -476,7 +479,8 @@ zil_claim_log_block(zilog_t *zilog, blkptr_t *bp, void *tx, uint64_t first_txg) } static int -zil_claim_log_record(zilog_t *zilog, lr_t *lrc, void *tx, uint64_t first_txg) +zil_claim_log_record(zilog_t *zilog, const lr_t *lrc, void *tx, + uint64_t first_txg) { lr_write_t *lr = (lr_write_t *)lrc; int error; @@ -503,7 +507,8 @@ zil_claim_log_record(zilog_t *zilog, lr_t *lrc, void *tx, uint64_t first_txg) /* ARGSUSED */ static int -zil_free_log_block(zilog_t *zilog, blkptr_t *bp, void *tx, uint64_t claim_txg) +zil_free_log_block(zilog_t *zilog, const blkptr_t *bp, void *tx, + uint64_t claim_txg) { zio_free(zilog->zl_spa, dmu_tx_get_txg(tx), bp); @@ -511,7 +516,8 @@ zil_free_log_block(zilog_t *zilog, blkptr_t *bp, void *tx, uint64_t claim_txg) } static int -zil_free_log_record(zilog_t *zilog, lr_t *lrc, void *tx, uint64_t claim_txg) +zil_free_log_record(zilog_t *zilog, const lr_t *lrc, void *tx, + uint64_t claim_txg) { lr_write_t *lr = (lr_write_t *)lrc; blkptr_t *bp = &lr->lr_blkptr; @@ -3471,7 +3477,7 @@ typedef struct zil_replay_arg { } zil_replay_arg_t; static int -zil_replay_error(zilog_t *zilog, lr_t *lr, int error) +zil_replay_error(zilog_t *zilog, const lr_t *lr, int error) { char name[ZFS_MAX_DATASET_NAME_LEN]; @@ -3489,7 +3495,8 @@ zil_replay_error(zilog_t *zilog, lr_t *lr, int error) } static int -zil_replay_log_record(zilog_t *zilog, lr_t *lr, void *zra, uint64_t claim_txg) +zil_replay_log_record(zilog_t *zilog, const lr_t *lr, void *zra, + uint64_t claim_txg) { zil_replay_arg_t *zr = zra; const zil_header_t *zh = zilog->zl_header; @@ -3572,7 +3579,7 @@ zil_replay_log_record(zilog_t *zilog, lr_t *lr, void *zra, uint64_t claim_txg) /* ARGSUSED */ static int -zil_incr_blks(zilog_t *zilog, blkptr_t *bp, void *arg, uint64_t claim_txg) +zil_incr_blks(zilog_t *zilog, const blkptr_t *bp, void *arg, uint64_t claim_txg) { zilog->zl_replay_blks++; diff --git a/sys/contrib/openzfs/module/zstd/lib/zstd.c b/sys/contrib/openzfs/module/zstd/lib/zstd.c index 949b8e47ec27..acdd4d9dac9d 100644 --- a/sys/contrib/openzfs/module/zstd/lib/zstd.c +++ b/sys/contrib/openzfs/module/zstd/lib/zstd.c @@ -3074,7 +3074,7 @@ size_t FSE_decompress(void* dst, size_t dstCapacity, const void* cSrc, size_t cS /*-************************************* * Dependencies ***************************************/ -#ifdef __aarch64__ +#if !defined(ZSTD_NO_INTRINSICS) && defined(__ARM_NEON) #include #endif /**** skipping file: compiler.h ****/ @@ -6525,7 +6525,7 @@ static const U32 OF_defaultNormLog = OF_DEFAULTNORMLOG; * Shared functions to include for inlining *********************************************/ static void ZSTD_copy8(void* dst, const void* src) { -#ifdef __aarch64__ +#if !defined(ZSTD_NO_INTRINSICS) && defined(__ARM_NEON) vst1_u8((uint8_t*)dst, vld1_u8((const uint8_t*)src)); #else memcpy(dst, src, 8); @@ -6534,7 +6534,7 @@ static void ZSTD_copy8(void* dst, const void* src) { #define COPY8(d,s) { ZSTD_copy8(d,s); d+=8; s+=8; } static void ZSTD_copy16(void* dst, const void* src) { -#ifdef __aarch64__ +#if !defined(ZSTD_NO_INTRINSICS) && defined(__ARM_NEON) vst1q_u8((uint8_t*)dst, vld1q_u8((const uint8_t*)src)); #else memcpy(dst, src, 16); diff --git a/sys/contrib/openzfs/rpm/generic/zfs-dkms.spec.in b/sys/contrib/openzfs/rpm/generic/zfs-dkms.spec.in index 5b05e1c332ab..6cdc224fcd89 100644 --- a/sys/contrib/openzfs/rpm/generic/zfs-dkms.spec.in +++ b/sys/contrib/openzfs/rpm/generic/zfs-dkms.spec.in @@ -18,7 +18,7 @@ Summary: Kernel module(s) (dkms) Group: System Environment/Kernel License: @ZFS_META_LICENSE@ -URL: https://zfsonlinux.org/ +URL: https://github.com/openzfs/zfs Source0: %{module}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch diff --git a/sys/contrib/openzfs/rpm/generic/zfs-kmod.spec.in b/sys/contrib/openzfs/rpm/generic/zfs-kmod.spec.in index bc033733afc4..782ad465e36d 100644 --- a/sys/contrib/openzfs/rpm/generic/zfs-kmod.spec.in +++ b/sys/contrib/openzfs/rpm/generic/zfs-kmod.spec.in @@ -48,7 +48,7 @@ Summary: Kernel module(s) Group: System Environment/Kernel License: @ZFS_META_LICENSE@ -URL: https://zfsonlinux.org/ +URL: https://github.com/openzfs/zfs Source0: %{module}-%{version}.tar.gz Source10: kmodtool BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id} -u -n) diff --git a/sys/contrib/openzfs/rpm/generic/zfs.spec.in b/sys/contrib/openzfs/rpm/generic/zfs.spec.in index c410620a8f9b..86e983718ee8 100644 --- a/sys/contrib/openzfs/rpm/generic/zfs.spec.in +++ b/sys/contrib/openzfs/rpm/generic/zfs.spec.in @@ -117,7 +117,7 @@ Summary: Commands to control the kernel modules and libraries Group: System Environment/Kernel License: @ZFS_META_LICENSE@ -URL: https://zfsonlinux.org/ +URL: https://github.com/openzfs/zfs Source0: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: libzpool2 = %{version} @@ -191,7 +191,7 @@ Summary: Solaris userland utility library for Linux Group: System Environment/Kernel %description -n libuutil1 -This library provides a variety of compatibility functions for ZFS on Linux: +This library provides a variety of compatibility functions for OpenZFS: * libspl: The Solaris Porting Layer userland library, which provides APIs that make it possible to run Solaris user code in a Linux environment with relatively minimal modification. diff --git a/sys/contrib/openzfs/rpm/redhat/zfs-kmod.spec.in b/sys/contrib/openzfs/rpm/redhat/zfs-kmod.spec.in index 6d928ec74ca7..9bc756c5aae6 100644 --- a/sys/contrib/openzfs/rpm/redhat/zfs-kmod.spec.in +++ b/sys/contrib/openzfs/rpm/redhat/zfs-kmod.spec.in @@ -8,7 +8,7 @@ Release: @RELEASE@%{?dist} Summary: Kernel module(s) Group: System Environment/Kernel License: @ZFS_META_LICENSE@ -URL: https://zfsonlinux.org/ +URL: https://github.com/openzfs/zfs BuildRequires: %kernel_module_package_buildreqs Source0: @PACKAGE@-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) diff --git a/sys/contrib/openzfs/scripts/zimport.sh b/sys/contrib/openzfs/scripts/zimport.sh index 304ab7623d42..56dfbadae47b 100755 --- a/sys/contrib/openzfs/scripts/zimport.sh +++ b/sys/contrib/openzfs/scripts/zimport.sh @@ -39,7 +39,7 @@ # -s "zfs-0.6.2 master installed" \ # -p "zevo-1.1.1 zol-0.6.2 zol-0.6.2-173 master installed" # -# --------------------- ZFS on Linux Source Versions -------------- +# ------------------------ OpenZFS Source Versions ---------------- # zfs-0.6.2 master 0.6.2-175_g36eb554 # ----------------------------------------------------------------- # Clone ZFS Local Local Skip @@ -68,9 +68,9 @@ TEST_DIR=$(mktemp -u -d -p /var/tmp zimport.XXXXXXXX) KEEP="no" VERBOSE="no" COLOR="yes" -REPO="https://github.com/zfsonlinux" +REPO="https://github.com/openzfs" IMAGES_DIR="$SCRIPTDIR/zfs-images/" -IMAGES_TAR="https://github.com/zfsonlinux/zfs-images/tarball/master" +IMAGES_TAR="https://github.com/openzfs/zfs-images/tarball/master" ERROR=0 CONFIG_LOG="configure.log" @@ -365,7 +365,7 @@ if [ ! -d "$SRC_DIR" ]; then fi # Print a header for all tags which are being tested. -echo "--------------------- ZFS on Linux Source Versions --------------" +echo "------------------------ OpenZFS Source Versions ----------------" printf "%-16s" " " for TAG in $SRC_TAGS; do src_set_vars "$TAG" diff --git a/sys/contrib/openzfs/tests/runfiles/common.run b/sys/contrib/openzfs/tests/runfiles/common.run index e06281648e70..d2e22f8681dc 100644 --- a/sys/contrib/openzfs/tests/runfiles/common.run +++ b/sys/contrib/openzfs/tests/runfiles/common.run @@ -30,6 +30,11 @@ tests = ['alloc_class_001_pos', 'alloc_class_002_neg', 'alloc_class_003_pos', 'alloc_class_013_pos'] tags = ['functional', 'alloc_class'] +[tests/functional/arc] +tests = ['dbufstats_001_pos', 'dbufstats_002_pos', 'dbufstats_003_pos', + 'arcstats_runtime_tuning'] +tags = ['functional', 'arc'] + [tests/functional/atime] tests = ['atime_001_pos', 'atime_002_neg', 'root_atime_off', 'root_atime_on'] tags = ['functional', 'atime'] diff --git a/sys/contrib/openzfs/tests/runfiles/linux.run b/sys/contrib/openzfs/tests/runfiles/linux.run index b6508a5cb3cf..ac4d6af1cf42 100644 --- a/sys/contrib/openzfs/tests/runfiles/linux.run +++ b/sys/contrib/openzfs/tests/runfiles/linux.run @@ -23,13 +23,12 @@ outputdir = /var/tmp/test_results tags = ['functional'] [tests/functional/acl/posix:Linux] -tests = ['posix_001_pos', 'posix_002_pos', 'posix_003_pos'] +tests = ['posix_001_pos', 'posix_002_pos', 'posix_003_pos', 'posix_004_pos'] tags = ['functional', 'acl', 'posix'] -[tests/functional/arc:Linux] -tests = ['dbufstats_001_pos', 'dbufstats_002_pos', 'dbufstats_003_pos', - 'arcstats_runtime_tuning'] -tags = ['functional', 'arc'] +[tests/functional/acl/posix-sa:Linux] +tests = ['posix_001_pos', 'posix_002_pos', 'posix_003_pos', 'posix_004_pos'] +tags = ['functional', 'acl', 'posix-sa'] [tests/functional/atime:Linux] tests = ['atime_003_pos', 'root_relatime_on'] diff --git a/sys/contrib/openzfs/tests/zfs-tests/include/libtest.shlib b/sys/contrib/openzfs/tests/zfs-tests/include/libtest.shlib index 1618c92bd57f..dec723e9a477 100644 --- a/sys/contrib/openzfs/tests/zfs-tests/include/libtest.shlib +++ b/sys/contrib/openzfs/tests/zfs-tests/include/libtest.shlib @@ -4154,18 +4154,36 @@ function ls_xattr # path esac } +function kstat # stat flags? +{ + typeset stat=$1 + typeset flags=${2-"-n"} + + case $(uname) in + FreeBSD) + sysctl $flags kstat.zfs.misc.$stat + ;; + Linux) + typeset zfs_kstat="/proc/spl/kstat/zfs/$stat" + [[ -f "$zfs_kstat" ]] || return 1 + cat $zfs_kstat + ;; + *) + false + ;; + esac +} + function get_arcstat # stat { typeset stat=$1 case $(uname) in FreeBSD) - sysctl -n kstat.zfs.misc.arcstats.$stat + kstat arcstats.$stat ;; Linux) - typeset zfs_arcstats="/proc/spl/kstat/zfs/arcstats" - [[ -f "$zfs_arcstats" ]] || return 1 - grep $stat $zfs_arcstats | awk '{print $3}' + kstat arcstats | awk "/$stat/ { print \$3 }" ;; *) false diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/Makefile.am index 6086930e36fa..382bb5f064e1 100644 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/Makefile.am +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/Makefile.am @@ -3,4 +3,4 @@ dist_pkgdata_DATA = \ acl.cfg \ acl_common.kshlib -SUBDIRS = posix +SUBDIRS = posix posix-sa diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/Makefile.am new file mode 100644 index 000000000000..31d1237ce265 --- /dev/null +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/Makefile.am @@ -0,0 +1,8 @@ +pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/acl/posix-sa +dist_pkgdata_SCRIPTS = \ + cleanup.ksh \ + setup.ksh \ + posix_001_pos.ksh \ + posix_002_pos.ksh \ + posix_003_pos.ksh \ + posix_004_pos.ksh diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/cleanup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/cleanup.ksh new file mode 100644 index 000000000000..bb58a8cf2e7b --- /dev/null +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/cleanup.ksh @@ -0,0 +1,33 @@ +#!/bin/ksh -p +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/acl/acl_common.kshlib + +cleanup_user_group + +default_cleanup diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/posix_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/posix_001_pos.ksh new file mode 100644 index 000000000000..e6467b3470c8 --- /dev/null +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/posix_001_pos.ksh @@ -0,0 +1 @@ +../posix/posix_001_pos.ksh \ No newline at end of file diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/posix_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/posix_002_pos.ksh new file mode 100644 index 000000000000..10140d0e87ec --- /dev/null +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/posix_002_pos.ksh @@ -0,0 +1 @@ +../posix/posix_002_pos.ksh \ No newline at end of file diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/posix_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/posix_003_pos.ksh new file mode 100644 index 000000000000..3f3db2807ddc --- /dev/null +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/posix_003_pos.ksh @@ -0,0 +1 @@ +../posix/posix_003_pos.ksh \ No newline at end of file diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/posix_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/posix_004_pos.ksh new file mode 100644 index 000000000000..2c2bab4477bd --- /dev/null +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/posix_004_pos.ksh @@ -0,0 +1 @@ +../posix/posix_004_pos.ksh \ No newline at end of file diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/setup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/setup.ksh new file mode 100644 index 000000000000..d8bf8a638e7b --- /dev/null +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/setup.ksh @@ -0,0 +1,52 @@ +#!/bin/ksh -p +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# Copyright (c) 2016 by Delphix. All rights reserved. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/acl/acl_common.kshlib + +log_must getfacl --version +log_must setfacl --version + +cleanup_user_group + +# Create staff group and add user to it +log_must add_group $ZFS_ACL_STAFF_GROUP +log_must add_user $ZFS_ACL_STAFF_GROUP $ZFS_ACL_STAFF1 + +DISK=${DISKS%% *} +default_setup_noexit $DISK +log_must chmod 777 $TESTDIR + +# Use POSIX ACLs on filesystem +log_must zfs set acltype=posix $TESTPOOL/$TESTFS +log_must zfs set xattr=sa $TESTPOOL/$TESTFS + +log_pass diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/Makefile.am index dcf278858090..e63f63185afe 100644 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/Makefile.am +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/Makefile.am @@ -4,4 +4,5 @@ dist_pkgdata_SCRIPTS = \ setup.ksh \ posix_001_pos.ksh \ posix_002_pos.ksh \ - posix_003_pos.ksh + posix_003_pos.ksh \ + posix_004_pos.ksh diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_003_pos.ksh index dc6ef0d2477d..1b04a024f2ad 100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_003_pos.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_003_pos.ksh @@ -25,7 +25,6 @@ # # DESCRIPTION: # Verify that ACLs survive remount. -# Regression test for https://github.com/zfsonlinux/zfs/issues/4520 # # STRATEGY: # 1. Test presence of default and regular ACLs after remount diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_004_pos.ksh new file mode 100644 index 000000000000..6c6b592fbb9e --- /dev/null +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_004_pos.ksh @@ -0,0 +1,49 @@ +#!/bin/ksh -p +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Portions Copyright 2020 iXsystems, Inc. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/acl/acl_common.kshlib + +# +# DESCRIPTION: +# Verify chown works with POSIX ACLs. +# Regression test for https://github.com/openzfs/zfs/issues/10043 +# +# STRATEGY: +# 1. Prepare an appropriate ACL on the test directory +# 2. Change the owner of the directory +# + +verify_runnable "both" +log_assert "Verify chown works with POSIX ACLs" + +log_must setfacl -d -m u:$ZFS_ACL_STAFF1:rwx $TESTDIR +log_must setfacl -b $TESTDIR + +log_must chown $ZFS_ACL_STAFF1 $TESTDIR +log_must chown 0 $TESTDIR + +log_pass "chown works with POSIX ACLs" diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/setup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/setup.ksh index d8bf8a638e7b..526c78e17f1a 100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/setup.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/setup.ksh @@ -47,6 +47,5 @@ log_must chmod 777 $TESTDIR # Use POSIX ACLs on filesystem log_must zfs set acltype=posix $TESTPOOL/$TESTFS -log_must zfs set xattr=sa $TESTPOOL/$TESTFS log_pass diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/arc/dbufstats_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/arc/dbufstats_001_pos.ksh index 4884f11bb811..0577a6b80c04 100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/arc/dbufstats_001_pos.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/arc/dbufstats_001_pos.ksh @@ -55,7 +55,13 @@ function testdbufstat # stat_name dbufstat_filter [[ -n "$2" ]] && filter="-F $2" - from_dbufstat=$(grep -w "$name" "$DBUFSTATS_FILE" | awk '{ print $3 }') + if is_linux; then + from_dbufstat=$(grep -w "$name" "$DBUFSTATS_FILE" | + awk '{ print $3 }') + else + from_dbufstat=$(awk "/dbufstats\.$name:/ { print \$2 }" \ + "$DBUFSTATS_FILE") + fi from_dbufs=$(dbufstat -bxn -i "$DBUFS_FILE" "$filter" | wc -l) within_tolerance $from_dbufstat $from_dbufs 15 \ @@ -71,8 +77,8 @@ log_onexit cleanup log_must file_write -o create -f "$TESTDIR/file" -b 1048576 -c 20 -d R log_must zpool sync -log_must eval "cat /proc/spl/kstat/zfs/dbufs > $DBUFS_FILE" -log_must eval "cat /proc/spl/kstat/zfs/dbufstats > $DBUFSTATS_FILE" +log_must eval "kstat dbufs > $DBUFS_FILE" +log_must eval "kstat dbufstats '' > $DBUFSTATS_FILE" for level in {0..11}; do testdbufstat "cache_level_$level" "dbc=1,level=$level" diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/arc/dbufstats_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/arc/dbufstats_002_pos.ksh index dc30b660656d..58d401539ed1 100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/arc/dbufstats_002_pos.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/arc/dbufstats_002_pos.ksh @@ -58,10 +58,10 @@ log_onexit cleanup log_must file_write -o create -f "$TESTDIR/file" -b 1048576 -c 1 -d R log_must zpool sync -objid=$(stat --format="%i" "$TESTDIR/file") +objid=$(get_objnum "$TESTDIR/file") log_note "Object ID for $TESTDIR/file is $objid" -log_must eval "cat /proc/spl/kstat/zfs/dbufs > $DBUFS_FILE" +log_must eval "kstat dbufs > $DBUFS_FILE" dbuf=$(dbufstat -bxn -i "$DBUFS_FILE" -F "object=$objid" | wc -l) mru=$(dbufstat -bxn -i "$DBUFS_FILE" -F "object=$objid,list=1" | wc -l) mfu=$(dbufstat -bxn -i "$DBUFS_FILE" -F "object=$objid,list=3" | wc -l) @@ -70,7 +70,7 @@ verify_ne "0" "$mru" "mru count" verify_eq "0" "$mfu" "mfu count" log_must eval "cat $TESTDIR/file > /dev/null" -log_must eval "cat /proc/spl/kstat/zfs/dbufs > $DBUFS_FILE" +log_must eval "kstat dbufs > $DBUFS_FILE" dbuf=$(dbufstat -bxn -i "$DBUFS_FILE" -F "object=$objid" | wc -l) mru=$(dbufstat -bxn -i "$DBUFS_FILE" -F "object=$objid,list=1" | wc -l) mfu=$(dbufstat -bxn -i "$DBUFS_FILE" -F "object=$objid,list=3" | wc -l) diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.get_number_props.zcp b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.get_number_props.zcp index 79969509be89..744230db0521 100644 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.get_number_props.zcp +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.get_number_props.zcp @@ -41,7 +41,7 @@ props['logicalused'] = {{true, nil}, {nil, nil}, {true, ni props['logicalreferenced'] = {{true, nil}, {true, nil}, {true, nil}} props['quota'] = {{true, 'default'}, {nil, nil}, {nil, nil}} props['reservation'] = {{true, 'default'}, {nil, nil}, {true, 'default'}} --- Note that zfsonlinux allows volsize for snapshot which differs from openzfs +-- Note that OpenZFS allows volsize for snapshot -- props['volsize'] = {{nil, nil}, {nil, nil}, {true, vol}} props['refquota'] = {{true, 'default'}, {nil, nil}, {nil, nil}} props['refreservation'] = {{true, 'default'}, {nil, nil}, {true, vol}} diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_test_race.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_test_race.ksh index 404770b2727f..135b31354f07 100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_test_race.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_test_race.ksh @@ -26,7 +26,7 @@ # under race condition which resulted in undefined mount order. The purpose # of this test is to verify `zfs unmount -a` succeeds (not `zfs mount -a` # succeeds, it always does) after `zfs mount -a`, which could fail if threads -# race. See github.com/zfsonlinux/zfs/issues/{8450,8833,8878} for details. +# race. See github.com/openzfs/zfs/issues/{8450,8833,8878} for details. # # STRATEGY: # 1. Create pools and filesystems. diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_sparse.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_sparse.ksh index e37c3f28ae9d..4878c06108e4 100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_sparse.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_sparse.ksh @@ -24,7 +24,7 @@ # 1. Create sparse files of various size # 2. Snapshot and send these sparse files # 3. Verify these files are received correctly and we don't trigger any issue -# like the one described in https://github.com/zfsonlinux/zfs/pull/6760 +# like the one described in https://github.com/openzfs/zfs/pull/6760 # verify_runnable "both" diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/misc.cfg b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/misc.cfg index cd0cf771e1fb..1a96ff5d93fa 100644 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/misc.cfg +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/misc.cfg @@ -49,7 +49,7 @@ if is_linux; then # these are an alternate set of property values PROP_ALTVALS="\ - off off \ + nfsv4 off \ fletcher4 lzjb off \ off /tmp/zfstest 100M off \ 512 10m off \ @@ -74,7 +74,7 @@ elif is_freebsd; then # these are an alternate set of property values PROP_ALTVALS="\ - off off \ + nfsv4 off \ fletcher4 lzjb off \ off /tmp/zfstest 100M off \ 512 10m off \ diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_002_pos.ksh index b077603e828f..a53bcaf4ec64 100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_002_pos.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_002_pos.ksh @@ -73,7 +73,7 @@ props=( mountpoint none compression lz4 compression on compression off compression lzjb acltype off - acltype posix xattr sa + acltype posix acltype nfsv4 atime on atime off devices on devices off exec on exec off @@ -84,11 +84,11 @@ props=( aclinherit discard aclinherit noallow aclinherit secure aclinherit passthrough canmount off canmount on - xattr on xattr off compression gzip compression gzip-$((RANDOM%9 + 1)) compression zstd compression zstd-$((RANDOM%9 + 1)) compression zstd-fast copies $((RANDOM%3 + 1)) - compression zstd-fast-$((RANDOM%9 + 1)) + compression zstd-fast-$((RANDOM%9 + 1)) xattr sa + xattr on xattr off ) elif is_freebsd; then # property value property value @@ -115,7 +115,8 @@ props=( compression gzip compression gzip-$((RANDOM%9 + 1)) compression zstd compression zstd-$((RANDOM%9 + 1)) compression zstd-fast copies $((RANDOM%3 + 1)) - compression zstd-fast-$((RANDOM%9 + 1)) + compression zstd-fast-$((RANDOM%9 + 1)) acltype off + acltype posix acltype nfsv4 ) else # property value property value diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/nopwrite/nopwrite_recsize.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/nopwrite/nopwrite_recsize.ksh index 14caedbf204a..205b3357d8d0 100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/nopwrite/nopwrite_recsize.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/nopwrite/nopwrite_recsize.ksh @@ -50,7 +50,7 @@ log_must zfs clone $origin@a $origin/clone for rs in 512 1024 2048 4096 8192 16384 32768 65536 131072 ; do log_must zfs set recsize=$rs $origin/clone dd if=/$TESTDIR/file of=/$TESTDIR/clone/file bs=1024k count=$MEGS \ - conv=notrunc > $TEST_BASE_DIR/null 2>&1 || log_fail "dd failed." + conv=notrunc >/dev/null 2>&1 || log_fail "dd failed." log_must verify_nopwrite $origin $origin@a $origin/clone done diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_negative.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_negative.ksh index 56b990be1bee..432460fa2fcd 100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_negative.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_negative.ksh @@ -56,6 +56,8 @@ done log_mustnot zfs redact $sendfs@snap1 log_mustnot zfs redact $sendfs@snap1 book log_mustnot zfs redact $sendfs#book1 book4 $clone1 +log_mustnot zfs redact $sendfs@snap1 book snap2 snap3 +log_mustnot zfs redact $sendfs@snap1 book @snap2 @snap3 log_mustnot eval "zfs send --redact $sendfs#book $sendfs@snap >/dev/null" # Redaction snapshots not a descendant of tosnap diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend.kshlib index c82b0f008e32..26755e87d0a5 100644 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend.kshlib +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend.kshlib @@ -635,12 +635,14 @@ function file_check # $1 The ZFS send command # $2 The filesystem where the streams are sent # $3 The receive filesystem +# $4 Test dry-run (optional) # function resume_test { - sendcmd=$1 - streamfs=$2 - recvfs=$3 + typeset sendcmd=$1 + typeset streamfs=$2 + typeset recvfs=$3 + typeset dryrun=${4:-1} stream_num=1 log_must eval "$sendcmd >/$streamfs/$stream_num" @@ -651,6 +653,11 @@ function resume_test stream_num=$((stream_num+1)) token=$(zfs get -Hp -o value receive_resume_token $recvfs) + + # Do a dry-run + [ $dryrun -ne 0 ] && \ + log_must eval "zfs send -nvt $token > /dev/null" + log_must eval "zfs send -t $token >/$streamfs/$stream_num" [[ -f /$streamfs/$stream_num ]] || \ log_fail "NO FILE /$streamfs/$stream_num" diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend_008_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend_008_pos.ksh index 531478760457..8e1821d88a68 100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend_008_pos.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend_008_pos.ksh @@ -43,7 +43,7 @@ verify_runnable "both" -# See issue: https://github.com/zfsonlinux/zfs/issues/6066 +# See issue: https://github.com/openzfs/zfs/issues/6066 log_unsupported "Occasionally hangs" # Origin Clone diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh index 499c05fc9835..594357dc4b7a 100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh @@ -116,7 +116,7 @@ for fs in "$POOL" "$POOL/pclone" "$POOL/$FS" "$POOL/$FS/fs1" \ "$POOL/$FS/fs1/fs2" "$POOL/$FS/fs1/fclone" ; do rand_set_prop $fs aclinherit "discard" "noallow" "secure" "passthrough" rand_set_prop $fs checksum "on" "off" "fletcher2" "fletcher4" "sha256" - rand_set_prop $fs acltype "off" "posix" "noacl" "posixacl" + rand_set_prop $fs acltype "off" "posix" "nfsv4" "noacl" "posixacl" rand_set_prop $fs atime "on" "off" rand_set_prop $fs checksum "on" "off" "fletcher2" "fletcher4" "sha256" rand_set_prop $fs compression "${compress_prop_vals[@]}" diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend_024_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend_024_pos.ksh index 2d9fb01af10f..c44985ae8c1d 100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend_024_pos.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend_024_pos.ksh @@ -46,7 +46,7 @@ log_onexit resume_cleanup $sendfs $streamfs test_fs_setup $sendfs $recvfs $streamfs log_must zfs unmount -f $sendfs -resume_test "zfs send $sendfs" $streamfs $recvfs +resume_test "zfs send $sendfs" $streamfs $recvfs 0 file_check $sendfs $recvfs log_pass "Verify resumability of a full ZFS send/receive with the source " \ diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send_freeobjects.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send_freeobjects.ksh index 6533352a9a14..925f667ee9a6 100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send_freeobjects.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send_freeobjects.ksh @@ -21,7 +21,7 @@ # # Description: # Verify FREEOBJECTS record frees sequential objects (See -# https://github.com/zfsonlinux/zfs/issues/6694) +# https://github.com/openzfs/zfs/issues/6694) # # Strategy: # 1. Create three files with sequential object numbers, f1 f2 and f3 diff --git a/sys/modules/dtrace/fasttrap/Makefile b/sys/modules/dtrace/fasttrap/Makefile index 52fe1ef46e60..1be1b97736ea 100644 --- a/sys/modules/dtrace/fasttrap/Makefile +++ b/sys/modules/dtrace/fasttrap/Makefile @@ -19,7 +19,7 @@ CFLAGS+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/powerpc .PATH: ${SYSDIR}/cddl/contrib/opensolaris/uts/powerpc/dtrace .endif -.PATH: ${SYSDIR}/cddl/contrib/opensolaris/common/unicode +.PATH: ${SYSDIR}/contrib/openzfs/module/unicode SRCS+= u8_textprep.c .include