| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: udf_allocation.c,v 1.24 2009/06/18 15:06:38 reinoud Exp $ */ | | 1 | /* $NetBSD: udf_allocation.c,v 1.25 2009/06/18 15:09: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. |
| @@ -18,27 +18,27 @@ | | | @@ -18,27 +18,27 @@ |
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
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 | #include <sys/cdefs.h> | | 29 | #include <sys/cdefs.h> |
30 | #ifndef lint | | 30 | #ifndef lint |
31 | __KERNEL_RCSID(0, "$NetBSD: udf_allocation.c,v 1.24 2009/06/18 15:06:38 reinoud Exp $"); | | 31 | __KERNEL_RCSID(0, "$NetBSD: udf_allocation.c,v 1.25 2009/06/18 15:09:18 reinoud Exp $"); |
32 | #endif /* not lint */ | | 32 | #endif /* not lint */ |
33 | | | 33 | |
34 | | | 34 | |
35 | #if defined(_KERNEL_OPT) | | 35 | #if defined(_KERNEL_OPT) |
36 | #include "opt_compat_netbsd.h" | | 36 | #include "opt_compat_netbsd.h" |
37 | #endif | | 37 | #endif |
38 | | | 38 | |
39 | /* TODO strip */ | | 39 | /* TODO strip */ |
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> |
| @@ -1018,27 +1018,27 @@ udf_allocate_space(struct udf_mount *ump | | | @@ -1018,27 +1018,27 @@ udf_allocate_space(struct udf_mount *ump |
1018 | case UDF_ALLOC_RELAXEDSEQUENTIAL : /* UDF 2.50/~meta BluRay-R */ | | 1018 | case UDF_ALLOC_RELAXEDSEQUENTIAL : /* UDF 2.50/~meta BluRay-R */ |
1019 | printf("ALERT: udf_allocate_space : allocation %d " | | 1019 | printf("ALERT: udf_allocate_space : allocation %d " |
1020 | "not implemented yet!\n", alloc_type); | | 1020 | "not implemented yet!\n", alloc_type); |
1021 | /* TODO implement, doesn't have to be contiguous */ | | 1021 | /* TODO implement, doesn't have to be contiguous */ |
1022 | error = ENOSPC; | | 1022 | error = ENOSPC; |
1023 | break; | | 1023 | break; |
1024 | } | | 1024 | } |
1025 | | | 1025 | |
1026 | #ifdef DEBUG | | 1026 | #ifdef DEBUG |
1027 | if (udf_verbose & UDF_DEBUG_ALLOC) { | | 1027 | if (udf_verbose & UDF_DEBUG_ALLOC) { |
1028 | lmappos = lmapping; | | 1028 | lmappos = lmapping; |
1029 | printf("udf_allocate_space, allocated logical lba :\n"); | | 1029 | printf("udf_allocate_space, allocated logical lba :\n"); |
1030 | for (lb_num = 0; lb_num < num_lb; lb_num++) { | | 1030 | for (lb_num = 0; lb_num < num_lb; lb_num++) { |
1031 | printf("%s %"PRIu64",", (lb_num > 0)?",":"", | | 1031 | printf("%s %"PRIu64, (lb_num > 0)?",":"", |
1032 | *lmappos++); | | 1032 | *lmappos++); |
1033 | } | | 1033 | } |
1034 | printf("\n"); | | 1034 | printf("\n"); |
1035 | } | | 1035 | } |
1036 | #endif | | 1036 | #endif |
1037 | mutex_exit(&ump->allocate_mutex); | | 1037 | mutex_exit(&ump->allocate_mutex); |
1038 | | | 1038 | |
1039 | return error; | | 1039 | return error; |
1040 | } | | 1040 | } |
1041 | | | 1041 | |
1042 | /* --------------------------------------------------------------------- */ | | 1042 | /* --------------------------------------------------------------------- */ |
1043 | | | 1043 | |
1044 | void | | 1044 | void |
| @@ -2243,27 +2243,27 @@ udf_grow_node(struct udf_node *udf_node, | | | @@ -2243,27 +2243,27 @@ udf_grow_node(struct udf_node *udf_node, |
2243 | /* read in using the `normal' vn_rdwr() */ | | 2243 | /* read in using the `normal' vn_rdwr() */ |
2244 | error = vn_rdwr(UIO_READ, udf_node->vnode, | | 2244 | error = vn_rdwr(UIO_READ, udf_node->vnode, |
2245 | evacuated_data, old_size, 0, | | 2245 | evacuated_data, old_size, 0, |
2246 | UIO_SYSSPACE, IO_ALTSEMANTICS | IO_NODELOCKED, | | 2246 | UIO_SYSSPACE, IO_ALTSEMANTICS | IO_NODELOCKED, |
2247 | FSCRED, NULL, NULL); | | 2247 | FSCRED, NULL, NULL); |
2248 | | | 2248 | |
2249 | /* enter again */ | | 2249 | /* enter again */ |
2250 | UDF_LOCK_NODE(udf_node, 0); | | 2250 | UDF_LOCK_NODE(udf_node, 0); |
2251 | } | | 2251 | } |
2252 | | | 2252 | |
2253 | /* convert to a normal alloc and select type */ | | 2253 | /* convert to a normal alloc and select type */ |
2254 | isdir = (vp->v_type == VDIR); | | 2254 | isdir = (vp->v_type == VDIR); |
2255 | my_part = udf_rw16(udf_node->loc.loc.part_num); | | 2255 | my_part = udf_rw16(udf_node->loc.loc.part_num); |
2256 | dst_part = isdir? ump->fids_part : ump->data_part; | | 2256 | dst_part = isdir ? ump->fids_part : ump->data_part; |
2257 | addr_type = UDF_ICB_SHORT_ALLOC; | | 2257 | addr_type = UDF_ICB_SHORT_ALLOC; |
2258 | if (dst_part != my_part) | | 2258 | if (dst_part != my_part) |
2259 | addr_type = UDF_ICB_LONG_ALLOC; | | 2259 | addr_type = UDF_ICB_LONG_ALLOC; |
2260 | | | 2260 | |
2261 | icbflags &= ~UDF_ICB_TAG_FLAGS_ALLOC_MASK; | | 2261 | icbflags &= ~UDF_ICB_TAG_FLAGS_ALLOC_MASK; |
2262 | icbflags |= addr_type; | | 2262 | icbflags |= addr_type; |
2263 | icbtag->flags = udf_rw16(icbflags); | | 2263 | icbtag->flags = udf_rw16(icbflags); |
2264 | | | 2264 | |
2265 | /* wipe old descriptor space */ | | 2265 | /* wipe old descriptor space */ |
2266 | udf_wipe_adslots(udf_node); | | 2266 | udf_wipe_adslots(udf_node); |
2267 | | | 2267 | |
2268 | memset(&c_ad, 0, sizeof(struct long_ad)); | | 2268 | memset(&c_ad, 0, sizeof(struct long_ad)); |
2269 | c_ad.len = udf_rw32(old_size | UDF_EXT_FREE); | | 2269 | c_ad.len = udf_rw32(old_size | UDF_EXT_FREE); |