fix various typos, mainly in comments.diff -r1.325 -r1.326 src/UPDATING
(andvar)
--- src/UPDATING 2021/11/22 12:30:34 1.325
+++ src/UPDATING 2021/12/07 21:37:36 1.326
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | $NetBSD: UPDATING,v 1.325 2021/11/22 12:30:34 martin Exp $ | 1 | $NetBSD: UPDATING,v 1.326 2021/12/07 21:37:36 andvar Exp $ | |
2 | 2 | |||
3 | This file (UPDATING) is intended to be a brief reference to recent | 3 | This file (UPDATING) is intended to be a brief reference to recent | |
4 | changes that might cause problems in the build process, and a guide for | 4 | changes that might cause problems in the build process, and a guide for | |
5 | what to do if something doesn't work. | 5 | what to do if something doesn't work. | |
6 | 6 | |||
7 | For a more detailed description of the recommended way to build NetBSD | 7 | For a more detailed description of the recommended way to build NetBSD | |
8 | using build.sh, see the BUILDING file. | 8 | using build.sh, see the BUILDING file. | |
9 | 9 | |||
10 | Note that much of the advice in this UPDATING file was written before | 10 | Note that much of the advice in this UPDATING file was written before | |
11 | build.sh existed. Nevertheless, the advice here may be useful for | 11 | build.sh existed. Nevertheless, the advice here may be useful for | |
12 | working around specific problems with build.sh. | 12 | working around specific problems with build.sh. | |
13 | 13 | |||
14 | Sections are marked with "^^^^^". After the section on "Recent changes" | 14 | Sections are marked with "^^^^^". After the section on "Recent changes" | |
@@ -182,27 +182,27 @@ Recent changes: | @@ -182,27 +182,27 @@ Recent changes: | |||
182 | 182 | |||
183 | We will re-import these radeon firmware images another way | 183 | We will re-import these radeon firmware images another way | |
184 | later. | 184 | later. | |
185 | 185 | |||
186 | 20190727: | 186 | 20190727: | |
187 | The uefi bootloader has gained tftp support and needs a clean | 187 | The uefi bootloader has gained tftp support and needs a clean | |
188 | build. If you do update builds, manually clean its object | 188 | build. If you do update builds, manually clean its object | |
189 | directory by something like: | 189 | directory by something like: | |
190 | cd sys/arch/i386/stand/efiboot && make clean | 190 | cd sys/arch/i386/stand/efiboot && make clean | |
191 | 191 | |||
192 | 20190723: | 192 | 20190723: | |
193 | The jemalloc allocator in libc is now build without extended | 193 | The jemalloc allocator in libc is now build without extended | |
194 | debugging (for performance reasons). In update builds make sure | 194 | debugging (for performance reasons). In update builds make sure | |
195 | to rebuild it completly, by removing all affected object files, | 195 | to rebuild it completely, by removing all affected object files, | |
196 | including compat builds, something like: | 196 | including compat builds, something like: | |
197 | cd /usr/obj && find . -type d -name jemalloc|xargs rm -rf | 197 | cd /usr/obj && find . -type d -name jemalloc|xargs rm -rf | |
198 | 198 | |||
199 | 20190207: | 199 | 20190207: | |
200 | GCC 7 switched for many ports. Update builds are likely to fail. | 200 | GCC 7 switched for many ports. Update builds are likely to fail. | |
201 | 201 | |||
202 | 20180924: | 202 | 20180924: | |
203 | A newer OpenSSL version has been imported. If you are doing | 203 | A newer OpenSSL version has been imported. If you are doing | |
204 | update builds, make sure to remove all old obj dirs, like: | 204 | update builds, make sure to remove all old obj dirs, like: | |
205 | cd /usr/obj && find . -type d -name openssl | xargs rm -rf | 205 | cd /usr/obj && find . -type d -name openssl | xargs rm -rf | |
206 | 206 | |||
207 | 20180717: | 207 | 20180717: | |
208 | On aarch64 int64_t and related types have changed from long long | 208 | On aarch64 int64_t and related types have changed from long long |
--- src/sys/arch/aarch64/aarch64/pmap.c 2021/10/23 06:49:46 1.119
+++ src/sys/arch/aarch64/aarch64/pmap.c 2021/12/07 21:37:36 1.120
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pmap.c,v 1.119 2021/10/23 06:49:46 skrll Exp $ */ | 1 | /* $NetBSD: pmap.c,v 1.120 2021/12/07 21:37:36 andvar Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2017 Ryo Shimizu <ryo@nerv.org> | 4 | * Copyright (c) 2017 Ryo Shimizu <ryo@nerv.org> | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -17,27 +17,27 @@ | @@ -17,27 +17,27 @@ | |||
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
19 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | 19 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | |
20 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
24 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 24 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
25 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 25 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
26 | * POSSIBILITY OF SUCH DAMAGE. | 26 | * POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | #include <sys/cdefs.h> | 29 | #include <sys/cdefs.h> | |
30 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.119 2021/10/23 06:49:46 skrll Exp $"); | 30 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.120 2021/12/07 21:37:36 andvar Exp $"); | |
31 | 31 | |||
32 | #include "opt_arm_debug.h" | 32 | #include "opt_arm_debug.h" | |
33 | #include "opt_ddb.h" | 33 | #include "opt_ddb.h" | |
34 | #include "opt_modular.h" | 34 | #include "opt_modular.h" | |
35 | #include "opt_multiprocessor.h" | 35 | #include "opt_multiprocessor.h" | |
36 | #include "opt_pmap.h" | 36 | #include "opt_pmap.h" | |
37 | #include "opt_uvmhist.h" | 37 | #include "opt_uvmhist.h" | |
38 | 38 | |||
39 | #include <sys/param.h> | 39 | #include <sys/param.h> | |
40 | #include <sys/types.h> | 40 | #include <sys/types.h> | |
41 | 41 | |||
42 | #include <sys/asan.h> | 42 | #include <sys/asan.h> | |
43 | #include <sys/atomic.h> | 43 | #include <sys/atomic.h> | |
@@ -169,27 +169,27 @@ PMAP_COUNTER(unwire_failure, "pmap_unwir | @@ -169,27 +169,27 @@ PMAP_COUNTER(unwire_failure, "pmap_unwir | |||
169 | aarch64_tlbi_by_va_ll((va)); \ | 169 | aarch64_tlbi_by_va_ll((va)); \ | |
170 | else \ | 170 | else \ | |
171 | aarch64_tlbi_by_asid_va_ll((asid), (va)); \ | 171 | aarch64_tlbi_by_asid_va_ll((asid), (va)); \ | |
172 | } else { \ | 172 | } else { \ | |
173 | if ((asid) == 0) \ | 173 | if ((asid) == 0) \ | |
174 | aarch64_tlbi_by_va((va)); \ | 174 | aarch64_tlbi_by_va((va)); \ | |
175 | else \ | 175 | else \ | |
176 | aarch64_tlbi_by_asid_va((asid), (va)); \ | 176 | aarch64_tlbi_by_asid_va((asid), (va)); \ | |
177 | } \ | 177 | } \ | |
178 | } while (0/*CONSTCOND*/) | 178 | } while (0/*CONSTCOND*/) | |
179 | 179 | |||
180 | /* | 180 | /* | |
181 | * require access permission in pte to invalidate instruction cache. | 181 | * require access permission in pte to invalidate instruction cache. | |
182 | * change the pte to accessible temporarly before cpu_icache_sync_range(). | 182 | * change the pte to be accessible temporarily before cpu_icache_sync_range(). | |
183 | * this macro modifies PTE (*ptep). need to update PTE after this. | 183 | * this macro modifies PTE (*ptep). need to update PTE after this. | |
184 | */ | 184 | */ | |
185 | #define PTE_ICACHE_SYNC_PAGE(pte, ptep, asid, va, ll) \ | 185 | #define PTE_ICACHE_SYNC_PAGE(pte, ptep, asid, va, ll) \ | |
186 | do { \ | 186 | do { \ | |
187 | atomic_swap_64((ptep), (pte) | LX_BLKPAG_AF); \ | 187 | atomic_swap_64((ptep), (pte) | LX_BLKPAG_AF); \ | |
188 | AARCH64_TLBI_BY_ASID_VA((asid), (va), (ll)); \ | 188 | AARCH64_TLBI_BY_ASID_VA((asid), (va), (ll)); \ | |
189 | cpu_icache_sync_range((va), PAGE_SIZE); \ | 189 | cpu_icache_sync_range((va), PAGE_SIZE); \ | |
190 | } while (0/*CONSTCOND*/) | 190 | } while (0/*CONSTCOND*/) | |
191 | 191 | |||
192 | #define VM_PAGE_TO_PP(pg) (&(pg)->mdpage.mdpg_pp) | 192 | #define VM_PAGE_TO_PP(pg) (&(pg)->mdpage.mdpg_pp) | |
193 | 193 | |||
194 | #define L3INDEXMASK (L3_SIZE * Ln_ENTRIES - 1) | 194 | #define L3INDEXMASK (L3_SIZE * Ln_ENTRIES - 1) | |
195 | #define PDPSWEEP_TRIGGER 512 | 195 | #define PDPSWEEP_TRIGGER 512 |
--- src/sys/arch/m68k/fpsp/res_func.sa 2001/09/16 16:34:32 1.5
+++ src/sys/arch/m68k/fpsp/res_func.sa 2021/12/07 21:37:36 1.6
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | * $NetBSD: res_func.sa,v 1.5 2001/09/16 16:34:32 wiz Exp $ | 1 | * $NetBSD: res_func.sa,v 1.6 2021/12/07 21:37:36 andvar Exp $ | |
2 | 2 | |||
3 | * MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP | 3 | * MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP | |
4 | * M68000 Hi-Performance Microprocessor Division | 4 | * M68000 Hi-Performance Microprocessor Division | |
5 | * M68040 Software Package | 5 | * M68040 Software Package | |
6 | * | 6 | * | |
7 | * M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc. | 7 | * M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc. | |
8 | * All rights reserved. | 8 | * All rights reserved. | |
9 | * | 9 | * | |
10 | * THE SOFTWARE is provided on an "AS IS" basis and without warranty. | 10 | * THE SOFTWARE is provided on an "AS IS" basis and without warranty. | |
11 | * To the maximum extent permitted by applicable law, | 11 | * To the maximum extent permitted by applicable law, | |
12 | * MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, | 12 | * MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, | |
13 | * INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A | 13 | * INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A | |
14 | * PARTICULAR PURPOSE and any warranty against infringement with | 14 | * PARTICULAR PURPOSE and any warranty against infringement with | |
@@ -428,27 +428,27 @@ normal: | @@ -428,27 +428,27 @@ normal: | |||
428 | bne ck_wrap ;if so, check if it is a potential | 428 | bne ck_wrap ;if so, check if it is a potential | |
429 | * ;wrap-around case | 429 | * ;wrap-around case | |
430 | fix_stk: | 430 | fix_stk: | |
431 | move.b #$fe,CU_SAVEPC(a6) | 431 | move.b #$fe,CU_SAVEPC(a6) | |
432 | bclr.b #E1,E_BYTE(a6) | 432 | bclr.b #E1,E_BYTE(a6) | |
433 | 433 | |||
434 | clr.w NMNEXC(a6) | 434 | clr.w NMNEXC(a6) | |
435 | 435 | |||
436 | st.b RES_FLG(a6) ;indicate that a restore is needed | 436 | st.b RES_FLG(a6) ;indicate that a restore is needed | |
437 | rts | 437 | rts | |
438 | 438 | |||
439 | * | 439 | * | |
440 | * cu_dnrm handles all cu-only instructions (fmove, fabs, fneg, and | 440 | * cu_dnrm handles all cu-only instructions (fmove, fabs, fneg, and | |
441 | * ftst) completly in software without an frestore to the 040. | 441 | * ftst) completely in software without an frestore to the 040. | |
442 | * | 442 | * | |
443 | cu_dnrm: | 443 | cu_dnrm: | |
444 | st.b CU_ONLY(a6) | 444 | st.b CU_ONLY(a6) | |
445 | move.w CMDREG1B(a6),d0 | 445 | move.w CMDREG1B(a6),d0 | |
446 | andi.b #$3b,d0 ;isolate bits to select inst | 446 | andi.b #$3b,d0 ;isolate bits to select inst | |
447 | tst.b d0 | 447 | tst.b d0 | |
448 | beq.l cu_dmove ;if zero, it is an fmove | 448 | beq.l cu_dmove ;if zero, it is an fmove | |
449 | cmpi.b #$18,d0 | 449 | cmpi.b #$18,d0 | |
450 | beq.l cu_dabs ;if $18, it is fabs | 450 | beq.l cu_dabs ;if $18, it is fabs | |
451 | cmpi.b #$1a,d0 | 451 | cmpi.b #$1a,d0 | |
452 | beq.l cu_dneg ;if $1a, it is fneg | 452 | beq.l cu_dneg ;if $1a, it is fneg | |
453 | * | 453 | * | |
454 | * Inst is ftst. Check the source operand and set the cc's accordingly. | 454 | * Inst is ftst. Check the source operand and set the cc's accordingly. |
--- src/sys/dev/acpi/vald_acpi.c 2021/11/01 21:28:03 1.7
+++ src/sys/dev/acpi/vald_acpi.c 2021/12/07 21:37:36 1.8
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: vald_acpi.c,v 1.7 2021/11/01 21:28:03 andvar Exp $ */ | 1 | /* $NetBSD: vald_acpi.c,v 1.8 2021/12/07 21:37:36 andvar Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2002 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2002 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Masanori Kanaoka. | 8 | * by Masanori Kanaoka. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -64,27 +64,27 @@ | @@ -64,27 +64,27 @@ | |||
64 | 64 | |||
65 | /* | 65 | /* | |
66 | * ACPI VALD Driver for Toshiba Libretto L3. | 66 | * ACPI VALD Driver for Toshiba Libretto L3. | |
67 | * This driver is based on acpibat driver. | 67 | * This driver is based on acpibat driver. | |
68 | */ | 68 | */ | |
69 | 69 | |||
70 | /* | 70 | /* | |
71 | * Obtain information of Toshiba "GHCI" Method from next URL. | 71 | * Obtain information of Toshiba "GHCI" Method from next URL. | |
72 | * http://www.buzzard.org.uk/toshiba/docs.html | 72 | * http://www.buzzard.org.uk/toshiba/docs.html | |
73 | * http://memebeam.org/toys/ToshibaAcpiDriver | 73 | * http://memebeam.org/toys/ToshibaAcpiDriver | |
74 | */ | 74 | */ | |
75 | 75 | |||
76 | #include <sys/cdefs.h> | 76 | #include <sys/cdefs.h> | |
77 | __KERNEL_RCSID(0, "$NetBSD: vald_acpi.c,v 1.7 2021/11/01 21:28:03 andvar Exp $"); | 77 | __KERNEL_RCSID(0, "$NetBSD: vald_acpi.c,v 1.8 2021/12/07 21:37:36 andvar Exp $"); | |
78 | 78 | |||
79 | #include <sys/param.h> | 79 | #include <sys/param.h> | |
80 | #include <sys/systm.h> | 80 | #include <sys/systm.h> | |
81 | #include <sys/device.h> | 81 | #include <sys/device.h> | |
82 | 82 | |||
83 | #include <dev/acpi/acpica.h> | 83 | #include <dev/acpi/acpica.h> | |
84 | #include <dev/acpi/acpireg.h> | 84 | #include <dev/acpi/acpireg.h> | |
85 | #include <dev/acpi/acpivar.h> | 85 | #include <dev/acpi/acpivar.h> | |
86 | 86 | |||
87 | #define _COMPONENT ACPI_RESOURCE_COMPONENT | 87 | #define _COMPONENT ACPI_RESOURCE_COMPONENT | |
88 | ACPI_MODULE_NAME ("vald_acpi") | 88 | ACPI_MODULE_NAME ("vald_acpi") | |
89 | 89 | |||
90 | #define GHCI_WORDS 6 | 90 | #define GHCI_WORDS 6 | |
@@ -429,27 +429,27 @@ vald_acpi_libright_get_bus(ACPI_HANDLE h | @@ -429,27 +429,27 @@ vald_acpi_libright_get_bus(ACPI_HANDLE h | |||
429 | struct vald_acpi_softc *sc = context; | 429 | struct vald_acpi_softc *sc = context; | |
430 | ACPI_STATUS rv; | 430 | ACPI_STATUS rv; | |
431 | ACPI_BUFFER buf; | 431 | ACPI_BUFFER buf; | |
432 | ACPI_OBJECT *param, *PrtElement; | 432 | ACPI_OBJECT *param, *PrtElement; | |
433 | int i, *pi; | 433 | int i, *pi; | |
434 | 434 | |||
435 | rv = acpi_eval_struct(handle, "_BCL", &buf); | 435 | rv = acpi_eval_struct(handle, "_BCL", &buf); | |
436 | if (ACPI_FAILURE(rv)) | 436 | if (ACPI_FAILURE(rv)) | |
437 | return (AE_OK); | 437 | return (AE_OK); | |
438 | 438 | |||
439 | sc->lcd_handle = handle; | 439 | sc->lcd_handle = handle; | |
440 | param = buf.Pointer; | 440 | param = buf.Pointer; | |
441 | if (param->Type == ACPI_TYPE_PACKAGE) { | 441 | if (param->Type == ACPI_TYPE_PACKAGE) { | |
442 | printf("_BCL retrun: %d packages\n", param->Package.Count); | 442 | printf("_BCL return: %d packages\n", param->Package.Count); | |
443 | 443 | |||
444 | sc->lcd_num = param->Package.Count; | 444 | sc->lcd_num = param->Package.Count; | |
445 | sc->lcd_level = ACPI_ALLOCATE(sizeof(int) * sc->lcd_num); | 445 | sc->lcd_level = ACPI_ALLOCATE(sizeof(int) * sc->lcd_num); | |
446 | if (sc->lcd_level == NULL) { | 446 | if (sc->lcd_level == NULL) { | |
447 | if (buf.Pointer) | 447 | if (buf.Pointer) | |
448 | ACPI_FREE(buf.Pointer); | 448 | ACPI_FREE(buf.Pointer); | |
449 | return (AE_NO_MEMORY); | 449 | return (AE_NO_MEMORY); | |
450 | } | 450 | } | |
451 | 451 | |||
452 | PrtElement = param->Package.Elements; | 452 | PrtElement = param->Package.Elements; | |
453 | pi = sc->lcd_level; | 453 | pi = sc->lcd_level; | |
454 | for (i = 0; i < param->Package.Count; i++) { | 454 | for (i = 0; i < param->Package.Count; i++) { | |
455 | if (PrtElement->Type == ACPI_TYPE_INTEGER) { | 455 | if (PrtElement->Type == ACPI_TYPE_INTEGER) { |
--- src/sys/dev/nand/hamming.c 2011/02/26 18:07:31 1.1
+++ src/sys/dev/nand/hamming.c 2021/12/07 21:37:37 1.2
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: hamming.c,v 1.1 2011/02/26 18:07:31 ahoka Exp $ */ | 1 | /* $NetBSD: hamming.c,v 1.2 2021/12/07 21:37:37 andvar Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2008, Atmel Corporation | 4 | * Copyright (c) 2008, Atmel Corporation | |
5 | * | 5 | * | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions are met: | 9 | * modification, are permitted provided that the following conditions are met: | |
10 | * | 10 | * | |
11 | * - Redistributions of source code must retain the above copyright notice, | 11 | * - Redistributions of source code must retain the above copyright notice, | |
12 | * this list of conditions and the disclaimer below. | 12 | * this list of conditions and the disclaimer below. | |
13 | * | 13 | * | |
14 | * Atmel's name may not be used to endorse or promote products derived from | 14 | * Atmel's name may not be used to endorse or promote products derived from | |
@@ -17,27 +17,27 @@ | @@ -17,27 +17,27 @@ | |||
17 | * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR | 17 | * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR | |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE | 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE | |
20 | * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, | 20 | * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, | |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
22 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | 22 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | |
23 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | 23 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
24 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 24 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
25 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | 25 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | |
26 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | #include <sys/cdefs.h> | 29 | #include <sys/cdefs.h> | |
30 | __KERNEL_RCSID(0, "$NetBSD: hamming.c,v 1.1 2011/02/26 18:07:31 ahoka Exp $"); | 30 | __KERNEL_RCSID(0, "$NetBSD: hamming.c,v 1.2 2021/12/07 21:37:37 andvar Exp $"); | |
31 | 31 | |||
32 | #include <sys/param.h> | 32 | #include <sys/param.h> | |
33 | #include <lib/libkern/libkern.h> | 33 | #include <lib/libkern/libkern.h> | |
34 | #include "hamming.h" | 34 | #include "hamming.h" | |
35 | 35 | |||
36 | /** | 36 | /** | |
37 | * Calculates the 22-bit hamming code for a 256-bytes block of data. | 37 | * Calculates the 22-bit hamming code for a 256-bytes block of data. | |
38 | * \param data Data buffer to calculate code for. | 38 | * \param data Data buffer to calculate code for. | |
39 | * \param code Pointer to a buffer where the code should be stored. | 39 | * \param code Pointer to a buffer where the code should be stored. | |
40 | */ | 40 | */ | |
41 | void | 41 | void | |
42 | hamming_compute_256(const uint8_t *data, uint8_t *code) | 42 | hamming_compute_256(const uint8_t *data, uint8_t *code) | |
43 | { | 43 | { | |
@@ -92,27 +92,27 @@ hamming_compute_256(const uint8_t *data, | @@ -92,27 +92,27 @@ hamming_compute_256(const uint8_t *data, | |||
92 | * even_line_code and odd_line_code, such as | 92 | * even_line_code and odd_line_code, such as | |
93 | * even_line_code bits: P128 P64 P32 | 93 | * even_line_code bits: P128 P64 P32 | |
94 | * P16 P8 P4 P2 P1 | 94 | * P16 P8 P4 P2 P1 | |
95 | * odd_line_code bits: P128' P64' P32' P16' | 95 | * odd_line_code bits: P128' P64' P32' P16' | |
96 | * P8' P4' P2' P1' | 96 | * P8' P4' P2' P1' | |
97 | */ | 97 | */ | |
98 | even_line_code ^= (255 - i); | 98 | even_line_code ^= (255 - i); | |
99 | odd_line_code ^= i; | 99 | odd_line_code ^= i; | |
100 | } | 100 | } | |
101 | } | 101 | } | |
102 | 102 | |||
103 | /*- | 103 | /*- | |
104 | * At this point, we have the line parities, and the column sum. | 104 | * At this point, we have the line parities, and the column sum. | |
105 | * First, We must caculate the parity group values on the column sum. | 105 | * First, We must calculate the parity group values on the column sum. | |
106 | */ | 106 | */ | |
107 | for (i = 0; i < 8; i++) { | 107 | for (i = 0; i < 8; i++) { | |
108 | if (column_sum & 1) { | 108 | if (column_sum & 1) { | |
109 | even_column_code ^= (7 - i); | 109 | even_column_code ^= (7 - i); | |
110 | odd_column_code ^= i; | 110 | odd_column_code ^= i; | |
111 | } | 111 | } | |
112 | column_sum >>= 1; | 112 | column_sum >>= 1; | |
113 | } | 113 | } | |
114 | 114 | |||
115 | /*- | 115 | /*- | |
116 | * Now, we must interleave the parity values, | 116 | * Now, we must interleave the parity values, | |
117 | * to obtain the following layout: | 117 | * to obtain the following layout: | |
118 | * Code[0] = Line1 | 118 | * Code[0] = Line1 |
--- src/sys/ufs/chfs/chfs.h 2018/04/19 21:50:10 1.10
+++ src/sys/ufs/chfs/chfs.h 2021/12/07 21:37:37 1.11
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: chfs.h,v 1.10 2018/04/19 21:50:10 christos Exp $ */ | 1 | /* $NetBSD: chfs.h,v 1.11 2021/12/07 21:37:37 andvar Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2010 Department of Software Engineering, | 4 | * Copyright (c) 2010 Department of Software Engineering, | |
5 | * University of Szeged, Hungary | 5 | * University of Szeged, Hungary | |
6 | * Copyright (C) 2009 Ferenc Havasi <havasi@inf.u-szeged.hu> | 6 | * Copyright (C) 2009 Ferenc Havasi <havasi@inf.u-szeged.hu> | |
7 | * Copyright (C) 2009 Zoltan Sogor <weth@inf.u-szeged.hu> | 7 | * Copyright (C) 2009 Zoltan Sogor <weth@inf.u-szeged.hu> | |
8 | * Copyright (C) 2009 David Tengeri <dtengeri@inf.u-szeged.hu> | 8 | * Copyright (C) 2009 David Tengeri <dtengeri@inf.u-szeged.hu> | |
9 | * Copyright (C) 2009 Tamas Toth <ttoth@inf.u-szeged.hu> | 9 | * Copyright (C) 2009 Tamas Toth <ttoth@inf.u-szeged.hu> | |
10 | * Copyright (C) 2010 Adam Hoka <ahoka@NetBSD.org> | 10 | * Copyright (C) 2010 Adam Hoka <ahoka@NetBSD.org> | |
11 | * All rights reserved. | 11 | * All rights reserved. | |
12 | * | 12 | * | |
13 | * This code is derived from software contributed to The NetBSD Foundation | 13 | * This code is derived from software contributed to The NetBSD Foundation | |
14 | * by the Department of Software Engineering, University of Szeged, Hungary | 14 | * by the Department of Software Engineering, University of Szeged, Hungary | |
@@ -189,27 +189,27 @@ node_next(struct chfs_node_ref *nref) | @@ -189,27 +189,27 @@ node_next(struct chfs_node_ref *nref) | |||
189 | /* struct chfs_dirent - full representation of a directory entry */ | 189 | /* struct chfs_dirent - full representation of a directory entry */ | |
190 | struct chfs_dirent | 190 | struct chfs_dirent | |
191 | { | 191 | { | |
192 | struct chfs_node_ref *nref; /* nref of the dirent */ | 192 | struct chfs_node_ref *nref; /* nref of the dirent */ | |
193 | TAILQ_ENTRY(chfs_dirent) fds; /* directory entries */ | 193 | TAILQ_ENTRY(chfs_dirent) fds; /* directory entries */ | |
194 | uint64_t version; /* version */ | 194 | uint64_t version; /* version */ | |
195 | ino_t vno; /* vnode number */ | 195 | ino_t vno; /* vnode number */ | |
196 | uint32_t nhash; /* name hash */ | 196 | uint32_t nhash; /* name hash */ | |
197 | enum chtype type; /* type of the dirent */ | 197 | enum chtype type; /* type of the dirent */ | |
198 | uint8_t nsize; /* length of its name */ | 198 | uint8_t nsize; /* length of its name */ | |
199 | uint8_t name[0]; /* name of the directory */ | 199 | uint8_t name[0]; /* name of the directory */ | |
200 | }; | 200 | }; | |
201 | 201 | |||
202 | /* struct chfs_tmp_dnode - used temporarly while building a data node */ | 202 | /* struct chfs_tmp_dnode - used temporarily while building a data node */ | |
203 | struct chfs_tmp_dnode { | 203 | struct chfs_tmp_dnode { | |
204 | struct chfs_full_dnode *node; /* associated full dnode */ | 204 | struct chfs_full_dnode *node; /* associated full dnode */ | |
205 | uint64_t version; /* version of the tmp node */ | 205 | uint64_t version; /* version of the tmp node */ | |
206 | uint32_t data_crc; /* CRC of the data */ | 206 | uint32_t data_crc; /* CRC of the data */ | |
207 | uint16_t overlapped; /* is overlapped */ | 207 | uint16_t overlapped; /* is overlapped */ | |
208 | struct chfs_tmp_dnode *next; /* next tmp node */ | 208 | struct chfs_tmp_dnode *next; /* next tmp node */ | |
209 | }; | 209 | }; | |
210 | 210 | |||
211 | /* struct chfs_tmp_dnode_info - tmp nodes are stored in rb trees */ | 211 | /* struct chfs_tmp_dnode_info - tmp nodes are stored in rb trees */ | |
212 | struct chfs_tmp_dnode_info { | 212 | struct chfs_tmp_dnode_info { | |
213 | struct rb_node rb_node; /* rb tree entry */ | 213 | struct rb_node rb_node; /* rb tree entry */ | |
214 | struct chfs_tmp_dnode *tmpnode; /* associated tmp node */ | 214 | struct chfs_tmp_dnode *tmpnode; /* associated tmp node */ | |
215 | }; | 215 | }; | |
@@ -366,27 +366,27 @@ struct chfs_mount { | @@ -366,27 +366,27 @@ struct chfs_mount { | |||
366 | uint32_t chm_wasted_size; /* padding */ | 366 | uint32_t chm_wasted_size; /* padding */ | |
367 | 367 | |||
368 | /* | 368 | /* | |
369 | * chm_lock_sizes: | 369 | * chm_lock_sizes: | |
370 | * Used to protect the (free, used, etc.) sizes of the FS | 370 | * Used to protect the (free, used, etc.) sizes of the FS | |
371 | * (and also the sizes of each eraseblock). | 371 | * (and also the sizes of each eraseblock). | |
372 | * If you have to lock chm_lock_mountfields and also chm_lock_sizes, | 372 | * If you have to lock chm_lock_mountfields and also chm_lock_sizes, | |
373 | * you must lock chm_lock_mountfields first. | 373 | * you must lock chm_lock_mountfields first. | |
374 | */ | 374 | */ | |
375 | kmutex_t chm_lock_sizes; | 375 | kmutex_t chm_lock_sizes; | |
376 | 376 | |||
377 | /* | 377 | /* | |
378 | * eraseblock queues | 378 | * eraseblock queues | |
379 | * free: completly free | 379 | * free: completely free | |
380 | * clean: contains only valid data | 380 | * clean: contains only valid data | |
381 | * dirty: contains valid and deleted data | 381 | * dirty: contains valid and deleted data | |
382 | * very_dirty: contains mostly deleted data (should be GC'd) | 382 | * very_dirty: contains mostly deleted data (should be GC'd) | |
383 | * erasable: doesn't contain valid data (should be erased) | 383 | * erasable: doesn't contain valid data (should be erased) | |
384 | * erase_pending: we can erase blocks from this queue | 384 | * erase_pending: we can erase blocks from this queue | |
385 | */ | 385 | */ | |
386 | struct chfs_eraseblock_queue chm_free_queue; | 386 | struct chfs_eraseblock_queue chm_free_queue; | |
387 | struct chfs_eraseblock_queue chm_clean_queue; | 387 | struct chfs_eraseblock_queue chm_clean_queue; | |
388 | struct chfs_eraseblock_queue chm_dirty_queue; | 388 | struct chfs_eraseblock_queue chm_dirty_queue; | |
389 | struct chfs_eraseblock_queue chm_very_dirty_queue; | 389 | struct chfs_eraseblock_queue chm_very_dirty_queue; | |
390 | struct chfs_eraseblock_queue chm_erasable_pending_wbuf_queue; | 390 | struct chfs_eraseblock_queue chm_erasable_pending_wbuf_queue; | |
391 | struct chfs_eraseblock_queue chm_erase_pending_queue; | 391 | struct chfs_eraseblock_queue chm_erase_pending_queue; | |
392 | 392 |
--- src/sys/ufs/chfs/chfs_malloc.c 2019/06/17 17:14:56 1.6
+++ src/sys/ufs/chfs/chfs_malloc.c 2021/12/07 21:37:37 1.7
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: chfs_malloc.c,v 1.6 2019/06/17 17:14:56 ryoon Exp $ */ | 1 | /* $NetBSD: chfs_malloc.c,v 1.7 2021/12/07 21:37:37 andvar Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2010 Department of Software Engineering, | 4 | * Copyright (c) 2010 Department of Software Engineering, | |
5 | * University of Szeged, Hungary | 5 | * University of Szeged, Hungary | |
6 | * Copyright (C) 2010 Tamas Toth <ttoth@inf.u-szeged.hu> | 6 | * Copyright (C) 2010 Tamas Toth <ttoth@inf.u-szeged.hu> | |
7 | * Copyright (C) 2010 Adam Hoka <ahoka@NetBSD.org> | 7 | * Copyright (C) 2010 Adam Hoka <ahoka@NetBSD.org> | |
8 | * All rights reserved. | 8 | * All rights reserved. | |
9 | * | 9 | * | |
10 | * This code is derived from software contributed to The NetBSD Foundation | 10 | * This code is derived from software contributed to The NetBSD Foundation | |
11 | * by the Department of Software Engineering, University of Szeged, Hungary | 11 | * by the Department of Software Engineering, University of Szeged, Hungary | |
12 | * | 12 | * | |
13 | * Redistribution and use in source and binary forms, with or without | 13 | * Redistribution and use in source and binary forms, with or without | |
14 | * modification, are permitted provided that the following conditions | 14 | * modification, are permitted provided that the following conditions | |
@@ -363,47 +363,47 @@ chfs_alloc_node_frag(void) | @@ -363,47 +363,47 @@ chfs_alloc_node_frag(void) | |||
363 | { | 363 | { | |
364 | struct chfs_node_frag *ret; | 364 | struct chfs_node_frag *ret; | |
365 | ret = pool_cache_get(chfs_node_frag_cache, PR_WAITOK); | 365 | ret = pool_cache_get(chfs_node_frag_cache, PR_WAITOK); | |
366 | return ret; | 366 | return ret; | |
367 | } | 367 | } | |
368 | 368 | |||
369 | /* chfs_free_node_frag - freeing a fragment of a node */ | 369 | /* chfs_free_node_frag - freeing a fragment of a node */ | |
370 | void | 370 | void | |
371 | chfs_free_node_frag(struct chfs_node_frag *frag) | 371 | chfs_free_node_frag(struct chfs_node_frag *frag) | |
372 | { | 372 | { | |
373 | pool_cache_put(chfs_node_frag_cache, frag); | 373 | pool_cache_put(chfs_node_frag_cache, frag); | |
374 | } | 374 | } | |
375 | 375 | |||
376 | /* chfs_alloc_tmp_dnode - allocating a temporarly used dnode */ | 376 | /* chfs_alloc_tmp_dnode - allocating a temporarily used dnode */ | |
377 | struct chfs_tmp_dnode * | 377 | struct chfs_tmp_dnode * | |
378 | chfs_alloc_tmp_dnode(void) | 378 | chfs_alloc_tmp_dnode(void) | |
379 | { | 379 | { | |
380 | struct chfs_tmp_dnode *ret; | 380 | struct chfs_tmp_dnode *ret; | |
381 | ret = pool_cache_get(chfs_tmp_dnode_cache, PR_WAITOK); | 381 | ret = pool_cache_get(chfs_tmp_dnode_cache, PR_WAITOK); | |
382 | ret->next = NULL; | 382 | ret->next = NULL; | |
383 | return ret; | 383 | return ret; | |
384 | } | 384 | } | |
385 | 385 | |||
386 | /* chfs_free_tmp_dnode - freeing a temporarly used dnode */ | 386 | /* chfs_free_tmp_dnode - freeing a temporarily used dnode */ | |
387 | void | 387 | void | |
388 | chfs_free_tmp_dnode(struct chfs_tmp_dnode *td) | 388 | chfs_free_tmp_dnode(struct chfs_tmp_dnode *td) | |
389 | { | 389 | { | |
390 | pool_cache_put(chfs_tmp_dnode_cache, td); | 390 | pool_cache_put(chfs_tmp_dnode_cache, td); | |
391 | } | 391 | } | |
392 | 392 | |||
393 | /* chfs_alloc_tmp_dnode_info - allocating a temporarly used dnode descriptor */ | 393 | /* chfs_alloc_tmp_dnode_info - allocating a temporarily used dnode descriptor */ | |
394 | struct chfs_tmp_dnode_info * | 394 | struct chfs_tmp_dnode_info * | |
395 | chfs_alloc_tmp_dnode_info(void) | 395 | chfs_alloc_tmp_dnode_info(void) | |
396 | { | 396 | { | |
397 | struct chfs_tmp_dnode_info *ret; | 397 | struct chfs_tmp_dnode_info *ret; | |
398 | ret = pool_cache_get(chfs_tmp_dnode_info_cache, PR_WAITOK); | 398 | ret = pool_cache_get(chfs_tmp_dnode_info_cache, PR_WAITOK); | |
399 | ret->tmpnode = NULL; | 399 | ret->tmpnode = NULL; | |
400 | return ret; | 400 | return ret; | |
401 | } | 401 | } | |
402 | 402 | |||
403 | /* chfs_free_tmp_dnode_info - freeing a temporarly used dnode descriptor */ | 403 | /* chfs_free_tmp_dnode_info - freeing a temporarily used dnode descriptor */ | |
404 | void | 404 | void | |
405 | chfs_free_tmp_dnode_info(struct chfs_tmp_dnode_info *di) | 405 | chfs_free_tmp_dnode_info(struct chfs_tmp_dnode_info *di) | |
406 | { | 406 | { | |
407 | pool_cache_put(chfs_tmp_dnode_info_cache, di); | 407 | pool_cache_put(chfs_tmp_dnode_info_cache, di); | |
408 | } | 408 | } | |
409 | 409 |
--- src/sys/ufs/chfs/chfs_write.c 2021/07/19 21:04:39 1.6
+++ src/sys/ufs/chfs/chfs_write.c 2021/12/07 21:37:37 1.7
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: chfs_write.c,v 1.6 2021/07/19 21:04:39 andvar Exp $ */ | 1 | /* $NetBSD: chfs_write.c,v 1.7 2021/12/07 21:37:37 andvar Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2010 Department of Software Engineering, | 4 | * Copyright (c) 2010 Department of Software Engineering, | |
5 | * University of Szeged, Hungary | 5 | * University of Szeged, Hungary | |
6 | * Copyright (C) 2010 David Tengeri <dtengeri@inf.u-szeged.hu> | 6 | * Copyright (C) 2010 David Tengeri <dtengeri@inf.u-szeged.hu> | |
7 | * Copyright (C) 2010 Tamas Toth <ttoth@inf.u-szeged.hu> | 7 | * Copyright (C) 2010 Tamas Toth <ttoth@inf.u-szeged.hu> | |
8 | * Copyright (C) 2010 Adam Hoka <ahoka@NetBSD.org> | 8 | * Copyright (C) 2010 Adam Hoka <ahoka@NetBSD.org> | |
9 | * All rights reserved. | 9 | * All rights reserved. | |
10 | * | 10 | * | |
11 | * This code is derived from software contributed to The NetBSD Foundation | 11 | * This code is derived from software contributed to The NetBSD Foundation | |
12 | * by the Department of Software Engineering, University of Szeged, Hungary | 12 | * by the Department of Software Engineering, University of Szeged, Hungary | |
13 | * | 13 | * | |
14 | * Redistribution and use in source and binary forms, with or without | 14 | * Redistribution and use in source and binary forms, with or without | |
@@ -100,27 +100,27 @@ retry: | @@ -100,27 +100,27 @@ retry: | |||
100 | if (err) | 100 | if (err) | |
101 | goto out; | 101 | goto out; | |
102 | } | 102 | } | |
103 | 103 | |||
104 | /* allocating a new node reference */ | 104 | /* allocating a new node reference */ | |
105 | nref = chfs_alloc_node_ref(chmp->chm_nextblock); | 105 | nref = chfs_alloc_node_ref(chmp->chm_nextblock); | |
106 | if (!nref) { | 106 | if (!nref) { | |
107 | err = ENOMEM; | 107 | err = ENOMEM; | |
108 | goto out; | 108 | goto out; | |
109 | } | 109 | } | |
110 | 110 | |||
111 | mutex_enter(&chmp->chm_lock_sizes); | 111 | mutex_enter(&chmp->chm_lock_sizes); | |
112 | 112 | |||
113 | /* caculating offset and sizes */ | 113 | /* calculating offset and sizes */ | |
114 | nref->nref_offset = chmp->chm_ebh->eb_size - chmp->chm_nextblock->free_size; | 114 | nref->nref_offset = chmp->chm_ebh->eb_size - chmp->chm_nextblock->free_size; | |
115 | chfs_change_size_free(chmp, chmp->chm_nextblock, -CHFS_PAD(size)); | 115 | chfs_change_size_free(chmp, chmp->chm_nextblock, -CHFS_PAD(size)); | |
116 | vec.iov_base = fvnode; | 116 | vec.iov_base = fvnode; | |
117 | vec.iov_len = CHFS_PAD(size); | 117 | vec.iov_len = CHFS_PAD(size); | |
118 | 118 | |||
119 | /* write it into the writebuffer */ | 119 | /* write it into the writebuffer */ | |
120 | err = chfs_write_wbuf(chmp, &vec, 1, nref->nref_offset, &retlen); | 120 | err = chfs_write_wbuf(chmp, &vec, 1, nref->nref_offset, &retlen); | |
121 | if (err || retlen != CHFS_PAD(size)) { | 121 | if (err || retlen != CHFS_PAD(size)) { | |
122 | /* there was an error during write */ | 122 | /* there was an error during write */ | |
123 | chfs_err("error while writing out flash vnode to the media\n"); | 123 | chfs_err("error while writing out flash vnode to the media\n"); | |
124 | chfs_err("err: %d | size: %zu | retlen : %zu\n", | 124 | chfs_err("err: %d | size: %zu | retlen : %zu\n", | |
125 | err, CHFS_PAD(size), retlen); | 125 | err, CHFS_PAD(size), retlen); | |
126 | chfs_change_size_dirty(chmp, | 126 | chfs_change_size_dirty(chmp, |
--- src/sys/ufs/chfs/chfs_nodeops.c 2013/12/09 09:35:17 1.4
+++ src/sys/ufs/chfs/chfs_nodeops.c 2021/12/07 21:37:37 1.5
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: chfs_nodeops.c,v 1.4 2013/12/09 09:35:17 wiz Exp $ */ | 1 | /* $NetBSD: chfs_nodeops.c,v 1.5 2021/12/07 21:37:37 andvar Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2010 Department of Software Engineering, | 4 | * Copyright (c) 2010 Department of Software Engineering, | |
5 | * University of Szeged, Hungary | 5 | * University of Szeged, Hungary | |
6 | * Copyright (C) 2010 David Tengeri <dtengeri@inf.u-szeged.hu> | 6 | * Copyright (C) 2010 David Tengeri <dtengeri@inf.u-szeged.hu> | |
7 | * Copyright (C) 2010 Tamas Toth <ttoth@inf.u-szeged.hu> | 7 | * Copyright (C) 2010 Tamas Toth <ttoth@inf.u-szeged.hu> | |
8 | * Copyright (C) 2010 Adam Hoka <ahoka@NetBSD.org> | 8 | * Copyright (C) 2010 Adam Hoka <ahoka@NetBSD.org> | |
9 | * All rights reserved. | 9 | * All rights reserved. | |
10 | * | 10 | * | |
11 | * This code is derived from software contributed to The NetBSD Foundation | 11 | * This code is derived from software contributed to The NetBSD Foundation | |
12 | * by the Department of Software Engineering, University of Szeged, Hungary | 12 | * by the Department of Software Engineering, University of Szeged, Hungary | |
13 | * | 13 | * | |
14 | * Redistribution and use in source and binary forms, with or without | 14 | * Redistribution and use in source and binary forms, with or without | |
@@ -196,27 +196,27 @@ chfs_add_fd_to_inode(struct chfs_mount * | @@ -196,27 +196,27 @@ chfs_add_fd_to_inode(struct chfs_mount * | |||
196 | chfs_remove_and_obsolete(chmp, parent->chvc, fd->nref, | 196 | chfs_remove_and_obsolete(chmp, parent->chvc, fd->nref, | |
197 | &parent->chvc->dirents); | 197 | &parent->chvc->dirents); | |
198 | mutex_exit(&chmp->chm_lock_vnocache); | 198 | mutex_exit(&chmp->chm_lock_vnocache); | |
199 | } | 199 | } | |
200 | chfs_free_dirent(fd); | 200 | chfs_free_dirent(fd); | |
201 | } else { | 201 | } else { | |
202 | /* new is older (normally it's not an option) */ | 202 | /* new is older (normally it's not an option) */ | |
203 | chfs_mark_node_obsolete(chmp, new->nref); | 203 | chfs_mark_node_obsolete(chmp, new->nref); | |
204 | chfs_free_dirent(new); | 204 | chfs_free_dirent(new); | |
205 | } | 205 | } | |
206 | return; | 206 | return; | |
207 | } | 207 | } | |
208 | } | 208 | } | |
209 | /* if we couldnt fit it elsewhere, lets add to the end */ | 209 | /* if we couldn't fit it elsewhere, lets add to the end */ | |
210 | /* FIXME insert tail or insert head? */ | 210 | /* FIXME insert tail or insert head? */ | |
211 | TAILQ_INSERT_HEAD(&parent->dents, new, fds); | 211 | TAILQ_INSERT_HEAD(&parent->dents, new, fds); | |
212 | } | 212 | } | |
213 | 213 | |||
214 | 214 | |||
215 | /* chfs_add_vnode_ref_to_vc - adds a vnode info to the vnode cache */ | 215 | /* chfs_add_vnode_ref_to_vc - adds a vnode info to the vnode cache */ | |
216 | void | 216 | void | |
217 | chfs_add_vnode_ref_to_vc(struct chfs_mount *chmp, | 217 | chfs_add_vnode_ref_to_vc(struct chfs_mount *chmp, | |
218 | struct chfs_vnode_cache *vc, struct chfs_node_ref *new) | 218 | struct chfs_vnode_cache *vc, struct chfs_node_ref *new) | |
219 | { | 219 | { | |
220 | KASSERT(mutex_owned(&chmp->chm_lock_vnocache)); | 220 | KASSERT(mutex_owned(&chmp->chm_lock_vnocache)); | |
221 | struct chfs_node_ref *nref; | 221 | struct chfs_node_ref *nref; | |
222 | 222 |
--- src/sys/ufs/chfs/chfs_vnops.c 2021/10/20 03:08:19 1.46
+++ src/sys/ufs/chfs/chfs_vnops.c 2021/12/07 21:37:37 1.47
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: chfs_vnops.c,v 1.46 2021/10/20 03:08:19 thorpej Exp $ */ | 1 | /* $NetBSD: chfs_vnops.c,v 1.47 2021/12/07 21:37:37 andvar Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2010 Department of Software Engineering, | 4 | * Copyright (c) 2010 Department of Software Engineering, | |
5 | * University of Szeged, Hungary | 5 | * University of Szeged, Hungary | |
6 | * Copyright (C) 2010 Tamas Toth <ttoth@inf.u-szeged.hu> | 6 | * Copyright (C) 2010 Tamas Toth <ttoth@inf.u-szeged.hu> | |
7 | * Copyright (C) 2010 Adam Hoka <ahoka@NetBSD.org> | 7 | * Copyright (C) 2010 Adam Hoka <ahoka@NetBSD.org> | |
8 | * All rights reserved. | 8 | * All rights reserved. | |
9 | * | 9 | * | |
10 | * This code is derived from software contributed to The NetBSD Foundation | 10 | * This code is derived from software contributed to The NetBSD Foundation | |
11 | * by the Department of Software Engineering, University of Szeged, Hungary | 11 | * by the Department of Software Engineering, University of Szeged, Hungary | |
12 | * | 12 | * | |
13 | * Redistribution and use in source and binary forms, with or without | 13 | * Redistribution and use in source and binary forms, with or without | |
14 | * modification, are permitted provided that the following conditions | 14 | * modification, are permitted provided that the following conditions | |
@@ -148,27 +148,27 @@ chfs_lookup(void *v) | @@ -148,27 +148,27 @@ chfs_lookup(void *v) | |||
148 | & ISLASTCN)) { | 148 | & ISLASTCN)) { | |
149 | error = ENOTDIR; | 149 | error = ENOTDIR; | |
150 | goto out; | 150 | goto out; | |
151 | } | 151 | } | |
152 | 152 | |||
153 | dbg("vno@allocating new vnode: %llu\n", | 153 | dbg("vno@allocating new vnode: %llu\n", | |
154 | (unsigned long long)fd->vno); | 154 | (unsigned long long)fd->vno); | |
155 | error = VFS_VGET(dvp->v_mount, fd->vno, LK_EXCLUSIVE, | 155 | error = VFS_VGET(dvp->v_mount, fd->vno, LK_EXCLUSIVE, | |
156 | vpp); | 156 | vpp); | |
157 | } | 157 | } | |
158 | } | 158 | } | |
159 | /* Store the result of this lookup in the cache. Avoid this if the | 159 | /* Store the result of this lookup in the cache. Avoid this if the | |
160 | * request was for creation, as it does not improve timings on | 160 | * request was for creation, as it does not improve timings on | |
161 | * emprical tests. */ | 161 | * empirical tests. */ | |
162 | if (cnp->cn_nameiop != CREATE && (cnp->cn_flags & ISDOTDOT) == 0) { | 162 | if (cnp->cn_nameiop != CREATE && (cnp->cn_flags & ISDOTDOT) == 0) { | |
163 | cache_enter(dvp, *vpp, cnp->cn_nameptr, cnp->cn_namelen, | 163 | cache_enter(dvp, *vpp, cnp->cn_nameptr, cnp->cn_namelen, | |
164 | cnp->cn_flags); | 164 | cnp->cn_flags); | |
165 | } | 165 | } | |
166 | 166 | |||
167 | out: | 167 | out: | |
168 | /* If there were no errors, *vpp cannot be NULL. */ | 168 | /* If there were no errors, *vpp cannot be NULL. */ | |
169 | KASSERT(IFF(error == 0, *vpp != NULL)); | 169 | KASSERT(IFF(error == 0, *vpp != NULL)); | |
170 | KASSERT(VOP_ISLOCKED(dvp)); | 170 | KASSERT(VOP_ISLOCKED(dvp)); | |
171 | 171 | |||
172 | if (error) | 172 | if (error) | |
173 | return error; | 173 | return error; | |
174 | if (*vpp != dvp) | 174 | if (*vpp != dvp) |
--- src/sys/ufs/chfs/ebh.c 2021/08/09 21:38:05 1.8
+++ src/sys/ufs/chfs/ebh.c 2021/12/07 21:37:37 1.9
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ebh.c,v 1.8 2021/08/09 21:38:05 andvar Exp $ */ | 1 | /* $NetBSD: ebh.c,v 1.9 2021/12/07 21:37:37 andvar Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2010 Department of Software Engineering, | 4 | * Copyright (c) 2010 Department of Software Engineering, | |
5 | * University of Szeged, Hungary | 5 | * University of Szeged, Hungary | |
6 | * Copyright (C) 2009 Ferenc Havasi <havasi@inf.u-szeged.hu> | 6 | * Copyright (C) 2009 Ferenc Havasi <havasi@inf.u-szeged.hu> | |
7 | * Copyright (C) 2009 Zoltan Sogor <weth@inf.u-szeged.hu> | 7 | * Copyright (C) 2009 Zoltan Sogor <weth@inf.u-szeged.hu> | |
8 | * Copyright (C) 2009 David Tengeri <dtengeri@inf.u-szeged.hu> | 8 | * Copyright (C) 2009 David Tengeri <dtengeri@inf.u-szeged.hu> | |
9 | * Copyright (C) 2009 Tamas Toth <ttoth@inf.u-szeged.hu> | 9 | * Copyright (C) 2009 Tamas Toth <ttoth@inf.u-szeged.hu> | |
10 | * Copyright (C) 2010 Adam Hoka <ahoka@NetBSD.org> | 10 | * Copyright (C) 2010 Adam Hoka <ahoka@NetBSD.org> | |
11 | * All rights reserved. | 11 | * All rights reserved. | |
12 | * | 12 | * | |
13 | * This code is derived from software contributed to The NetBSD Foundation | 13 | * This code is derived from software contributed to The NetBSD Foundation | |
14 | * by the Department of Software Engineering, University of Szeged, Hungary | 14 | * by the Department of Software Engineering, University of Szeged, Hungary | |
@@ -119,27 +119,27 @@ nor_calc_data_offs(struct chfs_ebh *ebh, | @@ -119,27 +119,27 @@ nor_calc_data_offs(struct chfs_ebh *ebh, | |||
119 | * nand_calc_data_offs - calculates data offset on NAND flash | 119 | * nand_calc_data_offs - calculates data offset on NAND flash | |
120 | * @ebh: chfs eraseblock handler | 120 | * @ebh: chfs eraseblock handler | |
121 | * @pebnr: eraseblock number | 121 | * @pebnr: eraseblock number | |
122 | * @offset: offset within the eraseblock | 122 | * @offset: offset within the eraseblock | |
123 | */ | 123 | */ | |
124 | int | 124 | int | |
125 | nand_calc_data_offs(struct chfs_ebh *ebh, int pebnr, int offset) | 125 | nand_calc_data_offs(struct chfs_ebh *ebh, int pebnr, int offset) | |
126 | { | 126 | { | |
127 | return pebnr * ebh->flash_if->erasesize + offset + | 127 | return pebnr * ebh->flash_if->erasesize + offset + | |
128 | 2 * ebh->flash_if->page_size; | 128 | 2 * ebh->flash_if->page_size; | |
129 | } | 129 | } | |
130 | 130 | |||
131 | /** | 131 | /** | |
132 | * nor_read_eb_hdr - read ereaseblock header from NOR flash | 132 | * nor_read_eb_hdr - read eraseblock header from NOR flash | |
133 | * | 133 | * | |
134 | * @ebh: chfs eraseblock handler | 134 | * @ebh: chfs eraseblock handler | |
135 | * @pebnr: eraseblock number | 135 | * @pebnr: eraseblock number | |
136 | * @ebhdr: whereto store the data | 136 | * @ebhdr: whereto store the data | |
137 | * | 137 | * | |
138 | * Reads the eraseblock header from media. | 138 | * Reads the eraseblock header from media. | |
139 | * Returns zero in case of success, error code in case of fail. | 139 | * Returns zero in case of success, error code in case of fail. | |
140 | */ | 140 | */ | |
141 | int | 141 | int | |
142 | nor_read_eb_hdr(struct chfs_ebh *ebh, | 142 | nor_read_eb_hdr(struct chfs_ebh *ebh, | |
143 | int pebnr, struct chfs_eb_hdr *ebhdr) | 143 | int pebnr, struct chfs_eb_hdr *ebhdr) | |
144 | { | 144 | { | |
145 | int ret; | 145 | int ret; | |
@@ -157,27 +157,27 @@ nor_read_eb_hdr(struct chfs_ebh *ebh, | @@ -157,27 +157,27 @@ nor_read_eb_hdr(struct chfs_ebh *ebh, | |||
157 | 157 | |||
158 | ofs += CHFS_EB_EC_HDR_SIZE; | 158 | ofs += CHFS_EB_EC_HDR_SIZE; | |
159 | ret = flash_read(ebh->flash_dev, | 159 | ret = flash_read(ebh->flash_dev, | |
160 | ofs, CHFS_EB_HDR_NOR_SIZE, | 160 | ofs, CHFS_EB_HDR_NOR_SIZE, | |
161 | &retlen, (unsigned char *) &ebhdr->u.nor_hdr); | 161 | &retlen, (unsigned char *) &ebhdr->u.nor_hdr); | |
162 | 162 | |||
163 | if (ret || retlen != CHFS_EB_HDR_NOR_SIZE) | 163 | if (ret || retlen != CHFS_EB_HDR_NOR_SIZE) | |
164 | return ret; | 164 | return ret; | |
165 | 165 | |||
166 | return 0; | 166 | return 0; | |
167 | } | 167 | } | |
168 | 168 | |||
169 | /** | 169 | /** | |
170 | * nand_read_eb_hdr - read ereaseblock header from NAND flash | 170 | * nand_read_eb_hdr - read eraseblock header from NAND flash | |
171 | * | 171 | * | |
172 | * @ebh: chfs eraseblock handler | 172 | * @ebh: chfs eraseblock handler | |
173 | * @pebnr: eraseblock number | 173 | * @pebnr: eraseblock number | |
174 | * @ebhdr: whereto store the data | 174 | * @ebhdr: whereto store the data | |
175 | * | 175 | * | |
176 | * Reads the eraseblock header from media. It is on the first two page. | 176 | * Reads the eraseblock header from media. It is on the first two page. | |
177 | * Returns zero in case of success, error code in case of fail. | 177 | * Returns zero in case of success, error code in case of fail. | |
178 | */ | 178 | */ | |
179 | int | 179 | int | |
180 | nand_read_eb_hdr(struct chfs_ebh *ebh, int pebnr, | 180 | nand_read_eb_hdr(struct chfs_ebh *ebh, int pebnr, | |
181 | struct chfs_eb_hdr *ebhdr) | 181 | struct chfs_eb_hdr *ebhdr) | |
182 | { | 182 | { | |
183 | int ret; | 183 | int ret; | |
@@ -196,27 +196,27 @@ nand_read_eb_hdr(struct chfs_ebh *ebh, i | @@ -196,27 +196,27 @@ nand_read_eb_hdr(struct chfs_ebh *ebh, i | |||
196 | 196 | |||
197 | /* Read NAND eraseblock header from the second page */ | 197 | /* Read NAND eraseblock header from the second page */ | |
198 | ofs += ebh->flash_if->page_size; | 198 | ofs += ebh->flash_if->page_size; | |
199 | ret = flash_read(ebh->flash_dev, | 199 | ret = flash_read(ebh->flash_dev, | |
200 | ofs, CHFS_EB_HDR_NAND_SIZE, &retlen, | 200 | ofs, CHFS_EB_HDR_NAND_SIZE, &retlen, | |
201 | (unsigned char *) &ebhdr->u.nand_hdr); | 201 | (unsigned char *) &ebhdr->u.nand_hdr); | |
202 | if (ret || retlen != CHFS_EB_HDR_NAND_SIZE) | 202 | if (ret || retlen != CHFS_EB_HDR_NAND_SIZE) | |
203 | return ret; | 203 | return ret; | |
204 | 204 | |||
205 | return 0; | 205 | return 0; | |
206 | } | 206 | } | |
207 | 207 | |||
208 | /** | 208 | /** | |
209 | * nor_write_eb_hdr - write ereaseblock header to NOR flash | 209 | * nor_write_eb_hdr - write eraseblock header to NOR flash | |
210 | * | 210 | * | |
211 | * @ebh: chfs eraseblock handler | 211 | * @ebh: chfs eraseblock handler | |
212 | * @pebnr: eraseblock number whereto write | 212 | * @pebnr: eraseblock number whereto write | |
213 | * @ebh: ebh to write | 213 | * @ebh: ebh to write | |
214 | * | 214 | * | |
215 | * Writes the eraseblock header to media. | 215 | * Writes the eraseblock header to media. | |
216 | * Returns zero in case of success, error code in case of fail. | 216 | * Returns zero in case of success, error code in case of fail. | |
217 | */ | 217 | */ | |
218 | int | 218 | int | |
219 | nor_write_eb_hdr(struct chfs_ebh *ebh, int pebnr, struct chfs_eb_hdr *ebhdr) | 219 | nor_write_eb_hdr(struct chfs_ebh *ebh, int pebnr, struct chfs_eb_hdr *ebhdr) | |
220 | { | 220 | { | |
221 | int ret, crc; | 221 | int ret, crc; | |
222 | size_t retlen; | 222 | size_t retlen; | |
@@ -233,27 +233,27 @@ nor_write_eb_hdr(struct chfs_ebh *ebh, i | @@ -233,27 +233,27 @@ nor_write_eb_hdr(struct chfs_ebh *ebh, i | |||
233 | KASSERT(pebnr >= 0 && pebnr < ebh->peb_nr); | 233 | KASSERT(pebnr >= 0 && pebnr < ebh->peb_nr); | |
234 | 234 | |||
235 | ret = flash_write(ebh->flash_dev, | 235 | ret = flash_write(ebh->flash_dev, | |
236 | ofs, CHFS_EB_HDR_NOR_SIZE, &retlen, | 236 | ofs, CHFS_EB_HDR_NOR_SIZE, &retlen, | |
237 | (unsigned char *) &ebhdr->u.nor_hdr); | 237 | (unsigned char *) &ebhdr->u.nor_hdr); | |
238 | 238 | |||
239 | if (ret || retlen != CHFS_EB_HDR_NOR_SIZE) | 239 | if (ret || retlen != CHFS_EB_HDR_NOR_SIZE) | |
240 | return ret; | 240 | return ret; | |
241 | 241 | |||
242 | return 0; | 242 | return 0; | |
243 | } | 243 | } | |
244 | 244 | |||
245 | /** | 245 | /** | |
246 | * nand_write_eb_hdr - write ereaseblock header to NAND flash | 246 | * nand_write_eb_hdr - write eraseblock header to NAND flash | |
247 | * | 247 | * | |
248 | * @ebh: chfs eraseblock handler | 248 | * @ebh: chfs eraseblock handler | |
249 | * @pebnr: eraseblock number whereto write | 249 | * @pebnr: eraseblock number whereto write | |
250 | * @ebh: ebh to write | 250 | * @ebh: ebh to write | |
251 | * | 251 | * | |
252 | * Writes the eraseblock header to media. | 252 | * Writes the eraseblock header to media. | |
253 | * Returns zero in case of success, error code in case of fail. | 253 | * Returns zero in case of success, error code in case of fail. | |
254 | */ | 254 | */ | |
255 | int | 255 | int | |
256 | nand_write_eb_hdr(struct chfs_ebh *ebh, int pebnr, | 256 | nand_write_eb_hdr(struct chfs_ebh *ebh, int pebnr, | |
257 | struct chfs_eb_hdr *ebhdr) | 257 | struct chfs_eb_hdr *ebhdr) | |
258 | { | 258 | { | |
259 | int ret, crc; | 259 | int ret, crc; | |
@@ -272,27 +272,27 @@ nand_write_eb_hdr(struct chfs_ebh *ebh, | @@ -272,27 +272,27 @@ nand_write_eb_hdr(struct chfs_ebh *ebh, | |||
272 | ebhdr->u.nand_hdr.crc = htole32(crc); | 272 | ebhdr->u.nand_hdr.crc = htole32(crc); | |
273 | 273 | |||
274 | ret = flash_write(ebh->flash_dev, ofs, | 274 | ret = flash_write(ebh->flash_dev, ofs, | |
275 | CHFS_EB_HDR_NAND_SIZE, &retlen, | 275 | CHFS_EB_HDR_NAND_SIZE, &retlen, | |
276 | (unsigned char *) &ebhdr->u.nand_hdr); | 276 | (unsigned char *) &ebhdr->u.nand_hdr); | |
277 | 277 | |||
278 | if (ret || retlen != CHFS_EB_HDR_NAND_SIZE) | 278 | if (ret || retlen != CHFS_EB_HDR_NAND_SIZE) | |
279 | return ret; | 279 | return ret; | |
280 | 280 | |||
281 | return 0; | 281 | return 0; | |
282 | } | 282 | } | |
283 | 283 | |||
284 | /** | 284 | /** | |
285 | * nor_check_eb_hdr - check ereaseblock header read from NOR flash | 285 | * nor_check_eb_hdr - check eraseblock header read from NOR flash | |
286 | * | 286 | * | |
287 | * @ebh: chfs eraseblock handler | 287 | * @ebh: chfs eraseblock handler | |
288 | * @buf: eraseblock header to check | 288 | * @buf: eraseblock header to check | |
289 | * | 289 | * | |
290 | * Returns eraseblock header status. | 290 | * Returns eraseblock header status. | |
291 | */ | 291 | */ | |
292 | int | 292 | int | |
293 | nor_check_eb_hdr(struct chfs_ebh *ebh, void *buf) | 293 | nor_check_eb_hdr(struct chfs_ebh *ebh, void *buf) | |
294 | { | 294 | { | |
295 | uint32_t magic, crc, hdr_crc; | 295 | uint32_t magic, crc, hdr_crc; | |
296 | struct chfs_eb_hdr *ebhdr = buf; | 296 | struct chfs_eb_hdr *ebhdr = buf; | |
297 | le32 lid_save; | 297 | le32 lid_save; | |
298 | 298 | |||
@@ -351,27 +351,27 @@ nor_check_eb_hdr(struct chfs_ebh *ebh, v | @@ -351,27 +351,27 @@ nor_check_eb_hdr(struct chfs_ebh *ebh, v | |||
351 | return EBHDR_LEB_BADCRC; | 351 | return EBHDR_LEB_BADCRC; | |
352 | } | 352 | } | |
353 | 353 | |||
354 | // check dirty | 354 | // check dirty | |
355 | if (!(le32toh(lid_save) & CHFS_LID_NOT_DIRTY_BIT)) { | 355 | if (!(le32toh(lid_save) & CHFS_LID_NOT_DIRTY_BIT)) { | |
356 | dbg_ebh("dirty ebhdr found\n"); | 356 | dbg_ebh("dirty ebhdr found\n"); | |
357 | return EBHDR_LEB_DIRTY; | 357 | return EBHDR_LEB_DIRTY; | |
358 | } | 358 | } | |
359 | 359 | |||
360 | return EBHDR_LEB_OK; | 360 | return EBHDR_LEB_OK; | |
361 | } | 361 | } | |
362 | 362 | |||
363 | /** | 363 | /** | |
364 | * nand_check_eb_hdr - check ereaseblock header read from NAND flash | 364 | * nand_check_eb_hdr - check eraseblock header read from NAND flash | |
365 | * | 365 | * | |
366 | * @ebh: chfs eraseblock handler | 366 | * @ebh: chfs eraseblock handler | |
367 | * @buf: eraseblock header to check | 367 | * @buf: eraseblock header to check | |
368 | * | 368 | * | |
369 | * Returns eraseblock header status. | 369 | * Returns eraseblock header status. | |
370 | */ | 370 | */ | |
371 | int | 371 | int | |
372 | nand_check_eb_hdr(struct chfs_ebh *ebh, void *buf) | 372 | nand_check_eb_hdr(struct chfs_ebh *ebh, void *buf) | |
373 | { | 373 | { | |
374 | uint32_t magic, crc, hdr_crc; | 374 | uint32_t magic, crc, hdr_crc; | |
375 | struct chfs_eb_hdr *ebhdr = buf; | 375 | struct chfs_eb_hdr *ebhdr = buf; | |
376 | 376 | |||
377 | //check is there a header | 377 | //check is there a header | |
@@ -411,27 +411,27 @@ nand_check_eb_hdr(struct chfs_ebh *ebh, | @@ -411,27 +411,27 @@ nand_check_eb_hdr(struct chfs_ebh *ebh, | |||
411 | 411 | |||
412 | crc = crc32(0, (uint8_t *) &ebhdr->u.nand_hdr + 4, | 412 | crc = crc32(0, (uint8_t *) &ebhdr->u.nand_hdr + 4, | |
413 | CHFS_EB_HDR_NAND_SIZE - 4); | 413 | CHFS_EB_HDR_NAND_SIZE - 4); | |
414 | 414 | |||
415 | if (crc != hdr_crc) { | 415 | if (crc != hdr_crc) { | |
416 | dbg_ebh("bad crc found\n"); | 416 | dbg_ebh("bad crc found\n"); | |
417 | return EBHDR_LEB_BADCRC; | 417 | return EBHDR_LEB_BADCRC; | |
418 | } | 418 | } | |
419 | 419 | |||
420 | return EBHDR_LEB_OK; | 420 | return EBHDR_LEB_OK; | |
421 | } | 421 | } | |
422 | 422 | |||
423 | /** | 423 | /** | |
424 | * nor_mark_eb_hdr_dirty_flash- mark ereaseblock header dirty on NOR flash | 424 | * nor_mark_eb_hdr_dirty_flash- mark eraseblock header dirty on NOR flash | |
425 | * | 425 | * | |
426 | * @ebh: chfs eraseblock handler | 426 | * @ebh: chfs eraseblock handler | |
427 | * @pebnr: eraseblock number | 427 | * @pebnr: eraseblock number | |
428 | * @lid: leb id (its bit number 31 will be set to 0) | 428 | * @lid: leb id (its bit number 31 will be set to 0) | |
429 | * | 429 | * | |
430 | * It pulls the CHFS_LID_NOT_DIRTY_BIT to zero on flash. | 430 | * It pulls the CHFS_LID_NOT_DIRTY_BIT to zero on flash. | |
431 | * | 431 | * | |
432 | * Returns zero in case of success, error code in case of fail. | 432 | * Returns zero in case of success, error code in case of fail. | |
433 | */ | 433 | */ | |
434 | int | 434 | int | |
435 | nor_mark_eb_hdr_dirty_flash(struct chfs_ebh *ebh, int pebnr, int lid) | 435 | nor_mark_eb_hdr_dirty_flash(struct chfs_ebh *ebh, int pebnr, int lid) | |
436 | { | 436 | { | |
437 | int ret; | 437 | int ret; | |
@@ -446,27 +446,27 @@ nor_mark_eb_hdr_dirty_flash(struct chfs_ | @@ -446,27 +446,27 @@ nor_mark_eb_hdr_dirty_flash(struct chfs_ | |||
446 | + CHFS_GET_MEMBER_POS(struct chfs_nor_eb_hdr , lid); | 446 | + CHFS_GET_MEMBER_POS(struct chfs_nor_eb_hdr , lid); | |
447 | 447 | |||
448 | ret = flash_write(ebh->flash_dev, ofs, sizeof(lid), &retlen, | 448 | ret = flash_write(ebh->flash_dev, ofs, sizeof(lid), &retlen, | |
449 | (unsigned char *) &lid); | 449 | (unsigned char *) &lid); | |
450 | if (ret || retlen != sizeof(lid)) { | 450 | if (ret || retlen != sizeof(lid)) { | |
451 | chfs_err("can't mark peb dirty"); | 451 | chfs_err("can't mark peb dirty"); | |
452 | return ret; | 452 | return ret; | |
453 | } | 453 | } | |
454 | 454 | |||
455 | return 0; | 455 | return 0; | |
456 | } | 456 | } | |
457 | 457 | |||
458 | /** | 458 | /** | |
459 | * nor_invalidate_eb_hdr - invalidate ereaseblock header on NOR flash | 459 | * nor_invalidate_eb_hdr - invalidate eraseblock header on NOR flash | |
460 | * | 460 | * | |
461 | * @ebh: chfs eraseblock handler | 461 | * @ebh: chfs eraseblock handler | |
462 | * @pebnr: eraseblock number | 462 | * @pebnr: eraseblock number | |
463 | * | 463 | * | |
464 | * Sets crc and lip field to zero. | 464 | * Sets crc and lip field to zero. | |
465 | * Returns zero in case of success, error code in case of fail. | 465 | * Returns zero in case of success, error code in case of fail. | |
466 | */ | 466 | */ | |
467 | int | 467 | int | |
468 | nor_invalidate_eb_hdr(struct chfs_ebh *ebh, int pebnr) | 468 | nor_invalidate_eb_hdr(struct chfs_ebh *ebh, int pebnr) | |
469 | { | 469 | { | |
470 | int ret; | 470 | int ret; | |
471 | size_t retlen; | 471 | size_t retlen; | |
472 | off_t ofs; | 472 | off_t ofs; | |
@@ -481,27 +481,27 @@ nor_invalidate_eb_hdr(struct chfs_ebh *e | @@ -481,27 +481,27 @@ nor_invalidate_eb_hdr(struct chfs_ebh *e | |||
481 | 481 | |||
482 | ret = flash_write(ebh->flash_dev, | 482 | ret = flash_write(ebh->flash_dev, | |
483 | ofs, CHFS_INVALIDATE_SIZE, &retlen, | 483 | ofs, CHFS_INVALIDATE_SIZE, &retlen, | |
484 | (unsigned char *) &zero_buf); | 484 | (unsigned char *) &zero_buf); | |
485 | if (ret || retlen != CHFS_INVALIDATE_SIZE) { | 485 | if (ret || retlen != CHFS_INVALIDATE_SIZE) { | |
486 | chfs_err("can't invalidate peb"); | 486 | chfs_err("can't invalidate peb"); | |
487 | return ret; | 487 | return ret; | |
488 | } | 488 | } | |
489 | 489 | |||
490 | return 0; | 490 | return 0; | |
491 | } | 491 | } | |
492 | 492 | |||
493 | /** | 493 | /** | |
494 | * mark_eb_hdr_free - free ereaseblock header on NOR or NAND flash | 494 | * mark_eb_hdr_free - free eraseblock header on NOR or NAND flash | |
495 | * | 495 | * | |
496 | * @ebh: chfs eraseblock handler | 496 | * @ebh: chfs eraseblock handler | |
497 | * @pebnr: eraseblock number | 497 | * @pebnr: eraseblock number | |
498 | * @ec: erase counter of PEB | 498 | * @ec: erase counter of PEB | |
499 | * | 499 | * | |
500 | * Write out the magic and erase counter to the physical eraseblock. | 500 | * Write out the magic and erase counter to the physical eraseblock. | |
501 | * Returns zero in case of success, error code in case of fail. | 501 | * Returns zero in case of success, error code in case of fail. | |
502 | */ | 502 | */ | |
503 | int | 503 | int | |
504 | mark_eb_hdr_free(struct chfs_ebh *ebh, int pebnr, int ec) | 504 | mark_eb_hdr_free(struct chfs_ebh *ebh, int pebnr, int ec) | |
505 | { | 505 | { | |
506 | int ret, crc; | 506 | int ret, crc; | |
507 | size_t retlen; | 507 | size_t retlen; | |
@@ -1413,27 +1413,27 @@ nand_process_eb(struct chfs_ebh *ebh, st | @@ -1413,27 +1413,27 @@ nand_process_eb(struct chfs_ebh *ebh, st | |||
1413 | max_serial = le64toh(ebhdr->u.nand_hdr.serial); | 1413 | max_serial = le64toh(ebhdr->u.nand_hdr.serial); | |
1414 | if (max_serial > *ebh->max_serial) { | 1414 | if (max_serial > *ebh->max_serial) { | |
1415 | *ebh->max_serial = max_serial; | 1415 | *ebh->max_serial = max_serial; | |
1416 | } | 1416 | } | |
1417 | 1417 | |||
1418 | count_mean: | 1418 | count_mean: | |
1419 | si->sum_of_ec += erase_cnt; | 1419 | si->sum_of_ec += erase_cnt; | |
1420 | si->num_of_eb++; | 1420 | si->num_of_eb++; | |
1421 | 1421 | |||
1422 | return err; | 1422 | return err; | |
1423 | } | 1423 | } | |
1424 | 1424 | |||
1425 | /** | 1425 | /** | |
1426 | * chfs_scan - scans the media and returns informations about it | 1426 | * chfs_scan - scans the media and returns information about it | |
1427 | * @ebh: chfs eraseblock handler | 1427 | * @ebh: chfs eraseblock handler | |
1428 | * | 1428 | * | |
1429 | * This function scans through the media and returns information about it or if | 1429 | * This function scans through the media and returns information about it or if | |
1430 | * it fails NULL will be returned. | 1430 | * it fails NULL will be returned. | |
1431 | */ | 1431 | */ | |
1432 | struct chfs_scan_info * | 1432 | struct chfs_scan_info * | |
1433 | chfs_scan(struct chfs_ebh *ebh) | 1433 | chfs_scan(struct chfs_ebh *ebh) | |
1434 | { | 1434 | { | |
1435 | struct chfs_scan_info *si; | 1435 | struct chfs_scan_info *si; | |
1436 | struct chfs_eb_hdr *ebhdr; | 1436 | struct chfs_eb_hdr *ebhdr; | |
1437 | int pebnr, err; | 1437 | int pebnr, err; | |
1438 | 1438 | |||
1439 | si = kmem_alloc(sizeof(*si), KM_SLEEP); | 1439 | si = kmem_alloc(sizeof(*si), KM_SLEEP); | |
@@ -1583,27 +1583,27 @@ scan_media(struct chfs_ebh *ebh) | @@ -1583,27 +1583,27 @@ scan_media(struct chfs_ebh *ebh) | |||
1583 | out_free: | 1583 | out_free: | |
1584 | mutex_exit(&ebh->erase_lock); | 1584 | mutex_exit(&ebh->erase_lock); | |
1585 | kmem_free(ebh->lmap, ebh->peb_nr * sizeof(int)); | 1585 | kmem_free(ebh->lmap, ebh->peb_nr * sizeof(int)); | |
1586 | scan_info_destroy(si); | 1586 | scan_info_destroy(si); | |
1587 | dbg_ebh("[SCAN_MEDIA] returning with error: %d\n", err); | 1587 | dbg_ebh("[SCAN_MEDIA] returning with error: %d\n", err); | |
1588 | return err; | 1588 | return err; | |
1589 | } | 1589 | } | |
1590 | 1590 | |||
1591 | /*****************************************************************************/ | 1591 | /*****************************************************************************/ | |
1592 | /* End of Scan related operations */ | 1592 | /* End of Scan related operations */ | |
1593 | /*****************************************************************************/ | 1593 | /*****************************************************************************/ | |
1594 | 1594 | |||
1595 | /** | 1595 | /** | |
1596 | * ebh_open - opens mtd device and init ereaseblock header | 1596 | * ebh_open - opens mtd device and init eraseblock header | |
1597 | * @ebh: eraseblock handler | 1597 | * @ebh: eraseblock handler | |
1598 | * @flash_nr: flash device number to use | 1598 | * @flash_nr: flash device number to use | |
1599 | * | 1599 | * | |
1600 | * Returns zero in case of success, error code in case of fail. | 1600 | * Returns zero in case of success, error code in case of fail. | |
1601 | */ | 1601 | */ | |
1602 | int | 1602 | int | |
1603 | ebh_open(struct chfs_ebh *ebh, dev_t dev) | 1603 | ebh_open(struct chfs_ebh *ebh, dev_t dev) | |
1604 | { | 1604 | { | |
1605 | int err; | 1605 | int err; | |
1606 | 1606 | |||
1607 | ebh->flash_dev = flash_get_device(dev); | 1607 | ebh->flash_dev = flash_get_device(dev); | |
1608 | if (!ebh->flash_dev) { | 1608 | if (!ebh->flash_dev) { | |
1609 | aprint_error("ebh_open: cant get flash device\n"); | 1609 | aprint_error("ebh_open: cant get flash device\n"); | |
@@ -1988,48 +1988,48 @@ write_error: | @@ -1988,48 +1988,48 @@ write_error: | |||
1988 | if (err || CHFS_MAX_GET_PEB_RETRIES < ++retries) { | 1988 | if (err || CHFS_MAX_GET_PEB_RETRIES < ++retries) { | |
1989 | leb_write_unlock(ebh, lnr); | 1989 | leb_write_unlock(ebh, lnr); | |
1990 | kmem_free(ebhdr, sizeof(struct chfs_eb_hdr)); | 1990 | kmem_free(ebhdr, sizeof(struct chfs_eb_hdr)); | |
1991 | return err; | 1991 | return err; | |
1992 | } | 1992 | } | |
1993 | goto retry; | 1993 | goto retry; | |
1994 | } | 1994 | } | |
1995 | 1995 | |||
1996 | /** | 1996 | /** | |
1997 | * ebh_unmap_leb - | 1997 | * ebh_unmap_leb - | |
1998 | * @ebh: eraseblock handler | 1998 | * @ebh: eraseblock handler | |
1999 | * @lnr: leb number | 1999 | * @lnr: leb number | |
2000 | * | 2000 | * | |
2001 | * Retruns zero on success, error code in case of fail. | 2001 | * Returns zero on success, error code in case of fail. | |
2002 | */ | 2002 | */ | |
2003 | int | 2003 | int | |
2004 | ebh_unmap_leb(struct chfs_ebh *ebh, int lnr) | 2004 | ebh_unmap_leb(struct chfs_ebh *ebh, int lnr) | |
2005 | { | 2005 | { | |
2006 | int err; | 2006 | int err; | |
2007 | 2007 | |||
2008 | if (ebh_is_mapped(ebh, lnr) < 0) | 2008 | if (ebh_is_mapped(ebh, lnr) < 0) | |
2009 | /* If the eraseblock already unmapped */ | 2009 | /* If the eraseblock already unmapped */ | |
2010 | return 0; | 2010 | return 0; | |
2011 | 2011 | |||
2012 | err = ebh_erase_leb(ebh, lnr); | 2012 | err = ebh_erase_leb(ebh, lnr); | |
2013 | 2013 | |||
2014 | return err; | 2014 | return err; | |
2015 | } | 2015 | } | |
2016 | 2016 | |||
2017 | /** | 2017 | /** | |
2018 | * ebh_is_mapped - check if a PEB is mapped to @lnr | 2018 | * ebh_is_mapped - check if a PEB is mapped to @lnr | |
2019 | * @ebh: eraseblock handler | 2019 | * @ebh: eraseblock handler | |
2020 | * @lnr: leb number | 2020 | * @lnr: leb number | |
2021 | * | 2021 | * | |
2022 | * Retruns 0 if the logical eraseblock is mapped, negative error code otherwise. | 2022 | * Returns 0 if the logical eraseblock is mapped, negative error code otherwise. | |
2023 | */ | 2023 | */ | |
2024 | int | 2024 | int | |
2025 | ebh_is_mapped(struct chfs_ebh *ebh, int lnr) | 2025 | ebh_is_mapped(struct chfs_ebh *ebh, int lnr) | |
2026 | { | 2026 | { | |
2027 | int err, result; | 2027 | int err, result; | |
2028 | err = leb_read_lock(ebh, lnr); | 2028 | err = leb_read_lock(ebh, lnr); | |
2029 | if (err) | 2029 | if (err) | |
2030 | return err; | 2030 | return err; | |
2031 | 2031 | |||
2032 | result = ebh->lmap[lnr]; | 2032 | result = ebh->lmap[lnr]; | |
2033 | leb_read_unlock(ebh, lnr); | 2033 | leb_read_unlock(ebh, lnr); | |
2034 | 2034 | |||
2035 | return result; | 2035 | return result; |
--- src/usr.bin/mail/list.c 2017/11/09 20:27:50 1.28
+++ src/usr.bin/mail/list.c 2021/12/07 21:37:37 1.29
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: list.c,v 1.28 2017/11/09 20:27:50 christos Exp $ */ | 1 | /* $NetBSD: list.c,v 1.29 2021/12/07 21:37:37 andvar Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1980, 1993 | 4 | * Copyright (c) 1980, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -24,27 +24,27 @@ | @@ -24,27 +24,27 @@ | |||
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
29 | * SUCH DAMAGE. | 29 | * SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | #ifndef lint | 33 | #ifndef lint | |
34 | #if 0 | 34 | #if 0 | |
35 | static char sccsid[] = "@(#)list.c 8.4 (Berkeley) 5/1/95"; | 35 | static char sccsid[] = "@(#)list.c 8.4 (Berkeley) 5/1/95"; | |
36 | #else | 36 | #else | |
37 | __RCSID("$NetBSD: list.c,v 1.28 2017/11/09 20:27:50 christos Exp $"); | 37 | __RCSID("$NetBSD: list.c,v 1.29 2021/12/07 21:37:37 andvar Exp $"); | |
38 | #endif | 38 | #endif | |
39 | #endif /* not lint */ | 39 | #endif /* not lint */ | |
40 | 40 | |||
41 | #include <assert.h> | 41 | #include <assert.h> | |
42 | #include <regex.h> | 42 | #include <regex.h> | |
43 | #include <util.h> | 43 | #include <util.h> | |
44 | 44 | |||
45 | #include "rcv.h" | 45 | #include "rcv.h" | |
46 | #include "extern.h" | 46 | #include "extern.h" | |
47 | #include "format.h" | 47 | #include "format.h" | |
48 | #include "thread.h" | 48 | #include "thread.h" | |
49 | #include "mime.h" | 49 | #include "mime.h" | |
50 | 50 | |||
@@ -936,27 +936,27 @@ check(int mesg, int f) | @@ -936,27 +936,27 @@ check(int mesg, int f) | |||
936 | } | 936 | } | |
937 | 937 | |||
938 | 938 | |||
939 | static int | 939 | static int | |
940 | markall_core(int *markarray, char **bufp, int f, int level) | 940 | markall_core(int *markarray, char **bufp, int f, int level) | |
941 | { | 941 | { | |
942 | enum token_e tok; | 942 | enum token_e tok; | |
943 | enum logic_op_e { | 943 | enum logic_op_e { | |
944 | LOP_AND, | 944 | LOP_AND, | |
945 | LOP_OR, | 945 | LOP_OR, | |
946 | LOP_XOR | 946 | LOP_XOR | |
947 | } logic_op; /* binary logic operation */ | 947 | } logic_op; /* binary logic operation */ | |
948 | int logic_invert; /* invert the result */ | 948 | int logic_invert; /* invert the result */ | |
949 | int *tmparray; /* temporarly array with result */ | 949 | int *tmparray; /* temporary array with result */ | |
950 | int msgCount; /* tmparray length and message count */ | 950 | int msgCount; /* tmparray length and message count */ | |
951 | int beg; /* first value of a range */ | 951 | int beg; /* first value of a range */ | |
952 | int colmod; /* the colon-modifier for this group */ | 952 | int colmod; /* the colon-modifier for this group */ | |
953 | int got_not; /* for syntax checking of '!' */ | 953 | int got_not; /* for syntax checking of '!' */ | |
954 | int got_one; /* we have a message spec, valid or not */ | 954 | int got_one; /* we have a message spec, valid or not */ | |
955 | int got_bin; /* we have a pending binary operation */ | 955 | int got_bin; /* we have a pending binary operation */ | |
956 | int i; | 956 | int i; | |
957 | 957 | |||
958 | logic_op = LOP_OR; | 958 | logic_op = LOP_OR; | |
959 | logic_invert = 0; | 959 | logic_invert = 0; | |
960 | colmod = 0; | 960 | colmod = 0; | |
961 | 961 | |||
962 | msgCount = get_msgCount(); | 962 | msgCount = get_msgCount(); |