| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: citrus_csmapper.c,v 1.11 2011/11/20 07:43:52 tnozaki Exp $ */ | | 1 | /* $NetBSD: citrus_csmapper.c,v 1.12 2019/10/09 23:23:41 christos Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c)2003 Citrus Project, | | 4 | * Copyright (c)2003 Citrus Project, |
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 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | | 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
26 | * SUCH DAMAGE. | | 26 | * SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | #include <sys/cdefs.h> | | 29 | #include <sys/cdefs.h> |
30 | #if defined(LIBC_SCCS) && !defined(lint) | | 30 | #if defined(LIBC_SCCS) && !defined(lint) |
31 | __RCSID("$NetBSD: citrus_csmapper.c,v 1.11 2011/11/20 07:43:52 tnozaki Exp $"); | | 31 | __RCSID("$NetBSD: citrus_csmapper.c,v 1.12 2019/10/09 23:23:41 christos Exp $"); |
32 | #endif /* LIBC_SCCS and not lint */ | | 32 | #endif /* LIBC_SCCS and not lint */ |
33 | | | 33 | |
34 | #include "namespace.h" | | 34 | #include "namespace.h" |
35 | #include "reentrant.h" | | 35 | #include "reentrant.h" |
36 | #include <assert.h> | | 36 | #include <assert.h> |
37 | #include <stdio.h> | | 37 | #include <stdio.h> |
38 | #include <stdlib.h> | | 38 | #include <stdlib.h> |
39 | #include <string.h> | | 39 | #include <string.h> |
40 | #include <errno.h> | | 40 | #include <errno.h> |
41 | #include <limits.h> | | 41 | #include <limits.h> |
42 | #include <paths.h> | | 42 | #include <paths.h> |
43 | #include <sys/types.h> | | 43 | #include <sys/types.h> |
44 | #include <sys/queue.h> | | 44 | #include <sys/queue.h> |
| @@ -295,27 +295,27 @@ find_best_pivot(const char *src, const c | | | @@ -295,27 +295,27 @@ find_best_pivot(const char *src, const c |
295 | | | 295 | |
296 | ret = find_best_pivot_pvdb(src, dst, pivot, pvlen, rnorm); | | 296 | ret = find_best_pivot_pvdb(src, dst, pivot, pvlen, rnorm); |
297 | if (ret == NO_SUCH_FILE) | | 297 | if (ret == NO_SUCH_FILE) |
298 | ret = find_best_pivot_lookup(src, dst, pivot, pvlen, rnorm); | | 298 | ret = find_best_pivot_lookup(src, dst, pivot, pvlen, rnorm); |
299 | | | 299 | |
300 | return ret; | | 300 | return ret; |
301 | } | | 301 | } |
302 | | | 302 | |
303 | static __inline int | | 303 | static __inline int |
304 | open_serial_mapper(struct _citrus_mapper_area *__restrict ma, | | 304 | open_serial_mapper(struct _citrus_mapper_area *__restrict ma, |
305 | struct _citrus_mapper * __restrict * __restrict rcm, | | 305 | struct _citrus_mapper * __restrict * __restrict rcm, |
306 | const char *src, const char *pivot, const char *dst) | | 306 | const char *src, const char *pivot, const char *dst) |
307 | { | | 307 | { |
308 | char buf[PATH_MAX]; | | 308 | char buf[4 * PATH_MAX]; |
309 | | | 309 | |
310 | snprintf(buf, sizeof(buf), "%s/%s,%s/%s", src, pivot, pivot, dst); | | 310 | snprintf(buf, sizeof(buf), "%s/%s,%s/%s", src, pivot, pivot, dst); |
311 | | | 311 | |
312 | return _mapper_open_direct(ma, rcm, "mapper_serial", buf); | | 312 | return _mapper_open_direct(ma, rcm, "mapper_serial", buf); |
313 | } | | 313 | } |
314 | | | 314 | |
315 | static struct _citrus_csmapper *csm_none = NULL; | | 315 | static struct _citrus_csmapper *csm_none = NULL; |
316 | static int | | 316 | static int |
317 | get_none(struct _citrus_mapper_area *__restrict ma, | | 317 | get_none(struct _citrus_mapper_area *__restrict ma, |
318 | struct _citrus_csmapper *__restrict *__restrict rcsm) | | 318 | struct _citrus_csmapper *__restrict *__restrict rcsm) |
319 | { | | 319 | { |
320 | int ret; | | 320 | int ret; |
321 | | | 321 | |