| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: udf_subr.c,v 1.112 2011/01/22 14:51:43 reinoud Exp $ */ | | 1 | /* $NetBSD: udf_subr.c,v 1.113 2011/01/22 18:02:18 reinoud Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2006, 2008 Reinoud Zandijk | | 4 | * Copyright (c) 2006, 2008 Reinoud Zandijk |
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. |
| @@ -19,27 +19,27 @@ | | | @@ -19,27 +19,27 @@ |
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | | 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | | 26 | * |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | | | 29 | |
30 | #include <sys/cdefs.h> | | 30 | #include <sys/cdefs.h> |
31 | #ifndef lint | | 31 | #ifndef lint |
32 | __KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.112 2011/01/22 14:51:43 reinoud Exp $"); | | 32 | __KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.113 2011/01/22 18:02:18 reinoud Exp $"); |
33 | #endif /* not lint */ | | 33 | #endif /* not lint */ |
34 | | | 34 | |
35 | | | 35 | |
36 | #if defined(_KERNEL_OPT) | | 36 | #if defined(_KERNEL_OPT) |
37 | #include "opt_compat_netbsd.h" | | 37 | #include "opt_compat_netbsd.h" |
38 | #endif | | 38 | #endif |
39 | | | 39 | |
40 | #include <sys/param.h> | | 40 | #include <sys/param.h> |
41 | #include <sys/systm.h> | | 41 | #include <sys/systm.h> |
42 | #include <sys/sysctl.h> | | 42 | #include <sys/sysctl.h> |
43 | #include <sys/namei.h> | | 43 | #include <sys/namei.h> |
44 | #include <sys/proc.h> | | 44 | #include <sys/proc.h> |
45 | #include <sys/kernel.h> | | 45 | #include <sys/kernel.h> |
| @@ -1450,27 +1450,26 @@ again: | | | @@ -1450,27 +1450,26 @@ again: |
1450 | trace++; | | 1450 | trace++; |
1451 | } | | 1451 | } |
1452 | | | 1452 | |
1453 | /* check if there is space to append */ | | 1453 | /* check if there is space to append */ |
1454 | space = (trace->end - trace->start) - trace->wpos; | | 1454 | space = (trace->end - trace->start) - trace->wpos; |
1455 | DPRINTF(VOLUMES, ("write start = %d, end = %d, pos = %d, wpos = %d, " | | 1455 | DPRINTF(VOLUMES, ("write start = %d, end = %d, pos = %d, wpos = %d, " |
1456 | "space = %d\n", trace->start, trace->end, trace->pos, | | 1456 | "space = %d\n", trace->start, trace->end, trace->pos, |
1457 | trace->wpos, space)); | | 1457 | trace->wpos, space)); |
1458 | | | 1458 | |
1459 | /* get state */ | | 1459 | /* get state */ |
1460 | logvol_integrity = udf_rw32(ump->logvol_integrity->integrity_type); | | 1460 | logvol_integrity = udf_rw32(ump->logvol_integrity->integrity_type); |
1461 | if (logvol_integrity == UDF_INTEGRITY_CLOSED) { | | 1461 | if (logvol_integrity == UDF_INTEGRITY_CLOSED) { |
1462 | if ((space < 3) && (lvflag & UDF_APPENDONLY_LVINT)) { | | 1462 | if ((space < 3) && (lvflag & UDF_APPENDONLY_LVINT)) { |
1463 | /* don't allow this logvol to be opened */ | | | |
1464 | /* TODO extent LVINT space if possible */ | | 1463 | /* TODO extent LVINT space if possible */ |
1465 | return EROFS; | | 1464 | return EROFS; |
1466 | } | | 1465 | } |
1467 | } | | 1466 | } |
1468 | | | 1467 | |
1469 | if (space < 1) { | | 1468 | if (space < 1) { |
1470 | if (lvflag & UDF_APPENDONLY_LVINT) | | 1469 | if (lvflag & UDF_APPENDONLY_LVINT) |
1471 | return EROFS; | | 1470 | return EROFS; |
1472 | /* loose history by re-writing extents */ | | 1471 | /* loose history by re-writing extents */ |
1473 | error = udf_loose_lvint_history(ump); | | 1472 | error = udf_loose_lvint_history(ump); |
1474 | if (error) | | 1473 | if (error) |
1475 | return error; | | 1474 | return error; |
1476 | goto again; | | 1475 | goto again; |
| @@ -2046,27 +2045,29 @@ udf_process_vds(struct udf_mount *ump) { | | | @@ -2046,27 +2045,29 @@ udf_process_vds(struct udf_mount *ump) { |
2046 | /* determine logical volume open/closure actions */ | | 2045 | /* determine logical volume open/closure actions */ |
2047 | if (n_virt) { | | 2046 | if (n_virt) { |
2048 | ump->lvopen = 0; | | 2047 | ump->lvopen = 0; |
2049 | if (ump->discinfo.last_session_state == MMC_STATE_EMPTY) | | 2048 | if (ump->discinfo.last_session_state == MMC_STATE_EMPTY) |
2050 | ump->lvopen |= UDF_OPEN_SESSION ; | | 2049 | ump->lvopen |= UDF_OPEN_SESSION ; |
2051 | ump->lvclose = UDF_WRITE_VAT; | | 2050 | ump->lvclose = UDF_WRITE_VAT; |
2052 | if (ump->mount_args.udfmflags & UDFMNT_CLOSESESSION) | | 2051 | if (ump->mount_args.udfmflags & UDFMNT_CLOSESESSION) |
2053 | ump->lvclose |= UDF_CLOSE_SESSION; | | 2052 | ump->lvclose |= UDF_CLOSE_SESSION; |
2054 | } else { | | 2053 | } else { |
2055 | /* `normal' rewritable or non sequential media */ | | 2054 | /* `normal' rewritable or non sequential media */ |
2056 | ump->lvopen = UDF_WRITE_LVINT; | | 2055 | ump->lvopen = UDF_WRITE_LVINT; |
2057 | ump->lvclose = UDF_WRITE_LVINT; | | 2056 | ump->lvclose = UDF_WRITE_LVINT; |
2058 | if ((ump->discinfo.mmc_cur & MMC_CAP_REWRITABLE) == 0) | | 2057 | if ((ump->discinfo.mmc_cur & MMC_CAP_REWRITABLE) == 0) |
2059 | ump->lvopen |= UDF_APPENDONLY_LVINT; | | 2058 | ump->lvopen |= UDF_APPENDONLY_LVINT; |
| | | 2059 | if ((ump->discinfo.mmc_cur & MMC_CAP_PSEUDOOVERWRITE)) |
| | | 2060 | ump->lvopen &= ~UDF_APPENDONLY_LVINT; |
2060 | } | | 2061 | } |
2061 | | | 2062 | |
2062 | /* | | 2063 | /* |
2063 | * Determine sheduler error behaviour. For virtual partitions, update | | 2064 | * Determine sheduler error behaviour. For virtual partitions, update |
2064 | * the trackinfo; for sparable partitions replace a whole block on the | | 2065 | * the trackinfo; for sparable partitions replace a whole block on the |
2065 | * sparable table. Allways requeue. | | 2066 | * sparable table. Allways requeue. |
2066 | */ | | 2067 | */ |
2067 | ump->lvreadwrite = 0; | | 2068 | ump->lvreadwrite = 0; |
2068 | if (n_virt) | | 2069 | if (n_virt) |
2069 | ump->lvreadwrite = UDF_UPDATE_TRACKINFO; | | 2070 | ump->lvreadwrite = UDF_UPDATE_TRACKINFO; |
2070 | if (n_spar) | | 2071 | if (n_spar) |
2071 | ump->lvreadwrite = UDF_REMAP_BLOCK; | | 2072 | ump->lvreadwrite = UDF_REMAP_BLOCK; |
2072 | | | 2073 | |