ansify function definitionsdiff -r1.55 -r1.56 src/sys/fs/adosfs/advfsops.c
(cegger)
--- src/sys/fs/adosfs/advfsops.c 2009/03/14 15:36:21 1.55
+++ src/sys/fs/adosfs/advfsops.c 2009/03/15 17:15:57 1.56
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: advfsops.c,v 1.55 2009/03/14 15:36:21 dsl Exp $ */ | 1 | /* $NetBSD: advfsops.c,v 1.56 2009/03/15 17:15:57 cegger Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1994 Christian E. Hopps | 4 | * Copyright (c) 1994 Christian E. Hopps | |
5 | * Copyright (c) 1996 Matthias Scheler | 5 | * Copyright (c) 1996 Matthias Scheler | |
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 | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -22,27 +22,27 @@ | @@ -22,27 +22,27 @@ | |||
22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
32 | */ | 32 | */ | |
33 | 33 | |||
34 | #include <sys/cdefs.h> | 34 | #include <sys/cdefs.h> | |
35 | __KERNEL_RCSID(0, "$NetBSD: advfsops.c,v 1.55 2009/03/14 15:36:21 dsl Exp $"); | 35 | __KERNEL_RCSID(0, "$NetBSD: advfsops.c,v 1.56 2009/03/15 17:15:57 cegger Exp $"); | |
36 | 36 | |||
37 | #if defined(_KERNEL_OPT) | 37 | #if defined(_KERNEL_OPT) | |
38 | #include "opt_compat_netbsd.h" | 38 | #include "opt_compat_netbsd.h" | |
39 | #endif | 39 | #endif | |
40 | 40 | |||
41 | #include <sys/param.h> | 41 | #include <sys/param.h> | |
42 | #include <sys/systm.h> | 42 | #include <sys/systm.h> | |
43 | #include <sys/sysctl.h> | 43 | #include <sys/sysctl.h> | |
44 | #include <sys/vnode.h> | 44 | #include <sys/vnode.h> | |
45 | #include <sys/mount.h> | 45 | #include <sys/mount.h> | |
46 | #include <sys/proc.h> | 46 | #include <sys/proc.h> | |
47 | #include <sys/time.h> | 47 | #include <sys/time.h> | |
48 | #include <sys/malloc.h> | 48 | #include <sys/malloc.h> | |
@@ -721,39 +721,39 @@ adosfs_vptofh(struct vnode *vp, struct f | @@ -721,39 +721,39 @@ adosfs_vptofh(struct vnode *vp, struct f | |||
721 | return(0); | 721 | return(0); | |
722 | } | 722 | } | |
723 | 723 | |||
724 | int | 724 | int | |
725 | adosfs_sync(struct mount *mp, int waitfor, kauth_cred_t uc) | 725 | adosfs_sync(struct mount *mp, int waitfor, kauth_cred_t uc) | |
726 | { | 726 | { | |
727 | #ifdef ADOSFS_DIAGNOSTIC | 727 | #ifdef ADOSFS_DIAGNOSTIC | |
728 | printf("ad_sync(%x, %x)\n", mp, waitfor); | 728 | printf("ad_sync(%x, %x)\n", mp, waitfor); | |
729 | #endif | 729 | #endif | |
730 | return(0); | 730 | return(0); | |
731 | } | 731 | } | |
732 | 732 | |||
733 | void | 733 | void | |
734 | adosfs_init() | 734 | adosfs_init(void) | |
735 | { | 735 | { | |
736 | 736 | |||
737 | malloc_type_attach(M_ADOSFSMNT); | 737 | malloc_type_attach(M_ADOSFSMNT); | |
738 | malloc_type_attach(M_ANODE); | 738 | malloc_type_attach(M_ANODE); | |
739 | malloc_type_attach(M_ADOSFSBITMAP); | 739 | malloc_type_attach(M_ADOSFSBITMAP); | |
740 | pool_init(&adosfs_node_pool, sizeof(struct anode), 0, 0, 0, "adosndpl", | 740 | pool_init(&adosfs_node_pool, sizeof(struct anode), 0, 0, 0, "adosndpl", | |
741 | &pool_allocator_nointr, IPL_NONE); | 741 | &pool_allocator_nointr, IPL_NONE); | |
742 | simple_lock_init(&adosfs_hashlock); | 742 | simple_lock_init(&adosfs_hashlock); | |
743 | } | 743 | } | |
744 | 744 | |||
745 | void | 745 | void | |
746 | adosfs_done() | 746 | adosfs_done(void) | |
747 | { | 747 | { | |
748 | 748 | |||
749 | pool_destroy(&adosfs_node_pool); | 749 | pool_destroy(&adosfs_node_pool); | |
750 | malloc_type_detach(M_ADOSFSBITMAP); | 750 | malloc_type_detach(M_ADOSFSBITMAP); | |
751 | malloc_type_detach(M_ANODE); | 751 | malloc_type_detach(M_ANODE); | |
752 | malloc_type_detach(M_ADOSFSMNT); | 752 | malloc_type_detach(M_ADOSFSMNT); | |
753 | } | 753 | } | |
754 | 754 | |||
755 | /* | 755 | /* | |
756 | * vfs generic function call table | 756 | * vfs generic function call table | |
757 | */ | 757 | */ | |
758 | 758 | |||
759 | extern const struct vnodeopv_desc adosfs_vnodeop_opv_desc; | 759 | extern const struct vnodeopv_desc adosfs_vnodeop_opv_desc; |
--- src/sys/fs/msdosfs/msdosfs_conv.c 2009/03/14 15:36:21 1.6
+++ src/sys/fs/msdosfs/msdosfs_conv.c 2009/03/15 17:15:57 1.7
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: msdosfs_conv.c,v 1.6 2009/03/14 15:36:21 dsl Exp $ */ | 1 | /* $NetBSD: msdosfs_conv.c,v 1.7 2009/03/15 17:15:57 cegger Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (C) 1995, 1997 Wolfgang Solfrank. | 4 | * Copyright (C) 1995, 1997 Wolfgang Solfrank. | |
5 | * Copyright (C) 1995, 1997 TooLs GmbH. | 5 | * Copyright (C) 1995, 1997 TooLs GmbH. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below). | 7 | * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below). | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -38,27 +38,27 @@ | @@ -38,27 +38,27 @@ | |||
38 | * it, and don't remove this notice. | 38 | * it, and don't remove this notice. | |
39 | * | 39 | * | |
40 | * This software is provided "as is". | 40 | * This software is provided "as is". | |
41 | * | 41 | * | |
42 | * The author supplies this software to be publicly redistributed on the | 42 | * The author supplies this software to be publicly redistributed on the | |
43 | * understanding that the author is not responsible for the correct | 43 | * understanding that the author is not responsible for the correct | |
44 | * functioning of this software in any circumstances and is not liable for | 44 | * functioning of this software in any circumstances and is not liable for | |
45 | * any damages caused by this software. | 45 | * any damages caused by this software. | |
46 | * | 46 | * | |
47 | * October 1992 | 47 | * October 1992 | |
48 | */ | 48 | */ | |
49 | 49 | |||
50 | #include <sys/cdefs.h> | 50 | #include <sys/cdefs.h> | |
51 | __KERNEL_RCSID(0, "$NetBSD: msdosfs_conv.c,v 1.6 2009/03/14 15:36:21 dsl Exp $"); | 51 | __KERNEL_RCSID(0, "$NetBSD: msdosfs_conv.c,v 1.7 2009/03/15 17:15:57 cegger Exp $"); | |
52 | 52 | |||
53 | /* | 53 | /* | |
54 | * System include files. | 54 | * System include files. | |
55 | */ | 55 | */ | |
56 | #include <sys/param.h> | 56 | #include <sys/param.h> | |
57 | #include <sys/systm.h> | 57 | #include <sys/systm.h> | |
58 | #include <sys/time.h> | 58 | #include <sys/time.h> | |
59 | #include <sys/kernel.h> | 59 | #include <sys/kernel.h> | |
60 | #include <sys/dirent.h> | 60 | #include <sys/dirent.h> | |
61 | #include <sys/vnode.h> | 61 | #include <sys/vnode.h> | |
62 | 62 | |||
63 | /* | 63 | /* | |
64 | * MSDOSFS include files. | 64 | * MSDOSFS include files. | |
@@ -334,30 +334,27 @@ u2l[256] = { | @@ -334,30 +334,27 @@ u2l[256] = { | |||
334 | /* | 334 | /* | |
335 | * DOS filenames are made of 2 parts, the name part and the extension part. | 335 | * DOS filenames are made of 2 parts, the name part and the extension part. | |
336 | * The name part is 8 characters long and the extension part is 3 | 336 | * The name part is 8 characters long and the extension part is 3 | |
337 | * characters long. They may contain trailing blanks if the name or | 337 | * characters long. They may contain trailing blanks if the name or | |
338 | * extension are not long enough to fill their respective fields. | 338 | * extension are not long enough to fill their respective fields. | |
339 | */ | 339 | */ | |
340 | 340 | |||
341 | /* | 341 | /* | |
342 | * Convert a DOS filename to a unix filename. And, return the number of | 342 | * Convert a DOS filename to a unix filename. And, return the number of | |
343 | * characters in the resulting unix filename excluding the terminating | 343 | * characters in the resulting unix filename excluding the terminating | |
344 | * null. | 344 | * null. | |
345 | */ | 345 | */ | |
346 | int | 346 | int | |
347 | dos2unixfn(dn, un, lower) | 347 | dos2unixfn(u_char dn[11], u_char *un, int lower) | |
348 | u_char dn[11]; | |||
349 | u_char *un; | |||
350 | int lower; | |||
351 | { | 348 | { | |
352 | int i, j; | 349 | int i, j; | |
353 | int thislong = 1; | 350 | int thislong = 1; | |
354 | u_char c; | 351 | u_char c; | |
355 | 352 | |||
356 | /* | 353 | /* | |
357 | * If first char of the filename is SLOT_E5 (0x05), then the real | 354 | * If first char of the filename is SLOT_E5 (0x05), then the real | |
358 | * first char of the filename should be 0xe5. But, they couldn't | 355 | * first char of the filename should be 0xe5. But, they couldn't | |
359 | * just have a 0xe5 mean 0xe5 because that is used to mean a freed | 356 | * just have a 0xe5 mean 0xe5 because that is used to mean a freed | |
360 | * directory slot. Another dos quirk. | 357 | * directory slot. Another dos quirk. | |
361 | */ | 358 | */ | |
362 | if (*dn == SLOT_E5) | 359 | if (*dn == SLOT_E5) | |
363 | c = dos2unix[0xe5]; | 360 | c = dos2unix[0xe5]; | |
@@ -400,31 +397,27 @@ dos2unixfn(dn, un, lower) | @@ -400,31 +397,27 @@ dos2unixfn(dn, un, lower) | |||
400 | 397 | |||
401 | /* | 398 | /* | |
402 | * Convert a unix filename to a DOS filename according to Win95 rules. | 399 | * Convert a unix filename to a DOS filename according to Win95 rules. | |
403 | * If applicable and gen is not 0, it is inserted into the converted | 400 | * If applicable and gen is not 0, it is inserted into the converted | |
404 | * filename as a generation number. | 401 | * filename as a generation number. | |
405 | * Returns | 402 | * Returns | |
406 | * 0 if name couldn't be converted | 403 | * 0 if name couldn't be converted | |
407 | * 1 if the converted name is the same as the original | 404 | * 1 if the converted name is the same as the original | |
408 | * (no long filename entry necessary for Win95) | 405 | * (no long filename entry necessary for Win95) | |
409 | * 2 if conversion was successful | 406 | * 2 if conversion was successful | |
410 | * 3 if conversion was successful and generation number was inserted | 407 | * 3 if conversion was successful and generation number was inserted | |
411 | */ | 408 | */ | |
412 | int | 409 | int | |
413 | unix2dosfn(un, dn, unlen, gen) | 410 | unix2dosfn(const u_char *un, u_char dn[12], int unlen, u_int gen) | |
414 | const u_char *un; | |||
415 | u_char dn[12]; | |||
416 | int unlen; | |||
417 | u_int gen; | |||
418 | { | 411 | { | |
419 | int i, j, l; | 412 | int i, j, l; | |
420 | int conv = 1; | 413 | int conv = 1; | |
421 | const u_char *cp, *dp, *dp1; | 414 | const u_char *cp, *dp, *dp1; | |
422 | u_char gentext[6], *wcp; | 415 | u_char gentext[6], *wcp; | |
423 | int shortlen; | 416 | int shortlen; | |
424 | 417 | |||
425 | /* | 418 | /* | |
426 | * Fill the dos filename string with blanks. These are DOS's pad | 419 | * Fill the dos filename string with blanks. These are DOS's pad | |
427 | * characters. | 420 | * characters. | |
428 | */ | 421 | */ | |
429 | for (i = 0; i < 11; i++) | 422 | for (i = 0; i < 11; i++) | |
430 | dn[i] = ' '; | 423 | dn[i] = ' '; |
--- src/sys/fs/msdosfs/msdosfs_denode.c 2009/03/14 21:04:23 1.35
+++ src/sys/fs/msdosfs/msdosfs_denode.c 2009/03/15 17:15:57 1.36
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: msdosfs_denode.c,v 1.35 2009/03/14 21:04:23 dsl Exp $ */ | 1 | /* $NetBSD: msdosfs_denode.c,v 1.36 2009/03/15 17:15:57 cegger Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. | 4 | * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. | |
5 | * Copyright (C) 1994, 1995, 1997 TooLs GmbH. | 5 | * Copyright (C) 1994, 1995, 1997 TooLs GmbH. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below). | 7 | * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below). | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -38,27 +38,27 @@ | @@ -38,27 +38,27 @@ | |||
38 | * it, and don't remove this notice. | 38 | * it, and don't remove this notice. | |
39 | * | 39 | * | |
40 | * This software is provided "as is". | 40 | * This software is provided "as is". | |
41 | * | 41 | * | |
42 | * The author supplies this software to be publicly redistributed on the | 42 | * The author supplies this software to be publicly redistributed on the | |
43 | * understanding that the author is not responsible for the correct | 43 | * understanding that the author is not responsible for the correct | |
44 | * functioning of this software in any circumstances and is not liable for | 44 | * functioning of this software in any circumstances and is not liable for | |
45 | * any damages caused by this software. | 45 | * any damages caused by this software. | |
46 | * | 46 | * | |
47 | * October 1992 | 47 | * October 1992 | |
48 | */ | 48 | */ | |
49 | 49 | |||
50 | #include <sys/cdefs.h> | 50 | #include <sys/cdefs.h> | |
51 | __KERNEL_RCSID(0, "$NetBSD: msdosfs_denode.c,v 1.35 2009/03/14 21:04:23 dsl Exp $"); | 51 | __KERNEL_RCSID(0, "$NetBSD: msdosfs_denode.c,v 1.36 2009/03/15 17:15:57 cegger Exp $"); | |
52 | 52 | |||
53 | #include <sys/param.h> | 53 | #include <sys/param.h> | |
54 | #include <sys/systm.h> | 54 | #include <sys/systm.h> | |
55 | #include <sys/mount.h> | 55 | #include <sys/mount.h> | |
56 | #include <sys/malloc.h> | 56 | #include <sys/malloc.h> | |
57 | #include <sys/pool.h> | 57 | #include <sys/pool.h> | |
58 | #include <sys/proc.h> | 58 | #include <sys/proc.h> | |
59 | #include <sys/buf.h> | 59 | #include <sys/buf.h> | |
60 | #include <sys/vnode.h> | 60 | #include <sys/vnode.h> | |
61 | #include <sys/kernel.h> /* defines "time" */ | 61 | #include <sys/kernel.h> /* defines "time" */ | |
62 | #include <sys/dirent.h> | 62 | #include <sys/dirent.h> | |
63 | #include <sys/namei.h> | 63 | #include <sys/namei.h> | |
64 | #include <sys/kauth.h> | 64 | #include <sys/kauth.h> | |
@@ -87,72 +87,72 @@ static const struct genfs_ops msdosfs_ge | @@ -87,72 +87,72 @@ static const struct genfs_ops msdosfs_ge | |||
87 | .gop_size = genfs_size, | 87 | .gop_size = genfs_size, | |
88 | .gop_alloc = msdosfs_gop_alloc, | 88 | .gop_alloc = msdosfs_gop_alloc, | |
89 | .gop_write = genfs_gop_write, | 89 | .gop_write = genfs_gop_write, | |
90 | .gop_markupdate = msdosfs_gop_markupdate, | 90 | .gop_markupdate = msdosfs_gop_markupdate, | |
91 | }; | 91 | }; | |
92 | 92 | |||
93 | static struct denode *msdosfs_hashget(dev_t, u_long, u_long, int); | 93 | static struct denode *msdosfs_hashget(dev_t, u_long, u_long, int); | |
94 | static void msdosfs_hashins(struct denode *); | 94 | static void msdosfs_hashins(struct denode *); | |
95 | static void msdosfs_hashrem(struct denode *); | 95 | static void msdosfs_hashrem(struct denode *); | |
96 | 96 | |||
97 | MALLOC_DECLARE(M_MSDOSFSFAT); | 97 | MALLOC_DECLARE(M_MSDOSFSFAT); | |
98 | 98 | |||
99 | void | 99 | void | |
100 | msdosfs_init() | 100 | msdosfs_init(void) | |
101 | { | 101 | { | |
102 | 102 | |||
103 | malloc_type_attach(M_MSDOSFSMNT); | 103 | malloc_type_attach(M_MSDOSFSMNT); | |
104 | malloc_type_attach(M_MSDOSFSFAT); | 104 | malloc_type_attach(M_MSDOSFSFAT); | |
105 | malloc_type_attach(M_MSDOSFSTMP); | 105 | malloc_type_attach(M_MSDOSFSTMP); | |
106 | pool_init(&msdosfs_denode_pool, sizeof(struct denode), 0, 0, 0, | 106 | pool_init(&msdosfs_denode_pool, sizeof(struct denode), 0, 0, 0, | |
107 | "msdosnopl", &pool_allocator_nointr, IPL_NONE); | 107 | "msdosnopl", &pool_allocator_nointr, IPL_NONE); | |
108 | dehashtbl = hashinit(desiredvnodes / 2, HASH_LIST, true, &dehash); | 108 | dehashtbl = hashinit(desiredvnodes / 2, HASH_LIST, true, &dehash); | |
109 | mutex_init(&msdosfs_ihash_lock, MUTEX_DEFAULT, IPL_NONE); | 109 | mutex_init(&msdosfs_ihash_lock, MUTEX_DEFAULT, IPL_NONE); | |
110 | mutex_init(&msdosfs_hashlock, MUTEX_DEFAULT, IPL_NONE); | 110 | mutex_init(&msdosfs_hashlock, MUTEX_DEFAULT, IPL_NONE); | |
111 | } | 111 | } | |
112 | 112 | |||
113 | /* | 113 | /* | |
114 | * Reinitialize inode hash table. | 114 | * Reinitialize inode hash table. | |
115 | */ | 115 | */ | |
116 | 116 | |||
117 | void | 117 | void | |
118 | msdosfs_reinit() | 118 | msdosfs_reinit(void) | |
119 | { | 119 | { | |
120 | struct denode *dep; | 120 | struct denode *dep; | |
121 | struct ihashhead *oldhash, *hash; | 121 | struct ihashhead *oldhash, *hash; | |
122 | u_long oldmask, mask, val; | 122 | u_long oldmask, mask, val; | |
123 | int i; | 123 | int i; | |
124 | 124 | |||
125 | hash = hashinit(desiredvnodes / 2, HASH_LIST, true, &mask); | 125 | hash = hashinit(desiredvnodes / 2, HASH_LIST, true, &mask); | |
126 | 126 | |||
127 | mutex_enter(&msdosfs_ihash_lock); | 127 | mutex_enter(&msdosfs_ihash_lock); | |
128 | oldhash = dehashtbl; | 128 | oldhash = dehashtbl; | |
129 | oldmask = dehash; | 129 | oldmask = dehash; | |
130 | dehashtbl = hash; | 130 | dehashtbl = hash; | |
131 | dehash = mask; | 131 | dehash = mask; | |
132 | for (i = 0; i <= oldmask; i++) { | 132 | for (i = 0; i <= oldmask; i++) { | |
133 | while ((dep = LIST_FIRST(&oldhash[i])) != NULL) { | 133 | while ((dep = LIST_FIRST(&oldhash[i])) != NULL) { | |
134 | LIST_REMOVE(dep, de_hash); | 134 | LIST_REMOVE(dep, de_hash); | |
135 | val = DEHASH(dep->de_dev, dep->de_dirclust, | 135 | val = DEHASH(dep->de_dev, dep->de_dirclust, | |
136 | dep->de_diroffset); | 136 | dep->de_diroffset); | |
137 | LIST_INSERT_HEAD(&hash[val], dep, de_hash); | 137 | LIST_INSERT_HEAD(&hash[val], dep, de_hash); | |
138 | } | 138 | } | |
139 | } | 139 | } | |
140 | mutex_exit(&msdosfs_ihash_lock); | 140 | mutex_exit(&msdosfs_ihash_lock); | |
141 | hashdone(oldhash, HASH_LIST, oldmask); | 141 | hashdone(oldhash, HASH_LIST, oldmask); | |
142 | } | 142 | } | |
143 | 143 | |||
144 | void | 144 | void | |
145 | msdosfs_done() | 145 | msdosfs_done(void) | |
146 | { | 146 | { | |
147 | hashdone(dehashtbl, HASH_LIST, dehash); | 147 | hashdone(dehashtbl, HASH_LIST, dehash); | |
148 | pool_destroy(&msdosfs_denode_pool); | 148 | pool_destroy(&msdosfs_denode_pool); | |
149 | mutex_destroy(&msdosfs_ihash_lock); | 149 | mutex_destroy(&msdosfs_ihash_lock); | |
150 | mutex_destroy(&msdosfs_hashlock); | 150 | mutex_destroy(&msdosfs_hashlock); | |
151 | malloc_type_detach(M_MSDOSFSTMP); | 151 | malloc_type_detach(M_MSDOSFSTMP); | |
152 | malloc_type_detach(M_MSDOSFSFAT); | 152 | malloc_type_detach(M_MSDOSFSFAT); | |
153 | malloc_type_detach(M_MSDOSFSMNT); | 153 | malloc_type_detach(M_MSDOSFSMNT); | |
154 | } | 154 | } | |
155 | 155 | |||
156 | static struct denode * | 156 | static struct denode * | |
157 | msdosfs_hashget(dev_t dev, u_long dirclust, u_long diroff, int flags) | 157 | msdosfs_hashget(dev_t dev, u_long dirclust, u_long diroff, int flags) | |
158 | { | 158 | { |
--- src/sys/fs/msdosfs/msdosfs_vfsops.c 2009/03/14 15:36:21 1.72
+++ src/sys/fs/msdosfs/msdosfs_vfsops.c 2009/03/15 17:15:57 1.73
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: msdosfs_vfsops.c,v 1.72 2009/03/14 15:36:21 dsl Exp $ */ | 1 | /* $NetBSD: msdosfs_vfsops.c,v 1.73 2009/03/15 17:15:57 cegger Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. | 4 | * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. | |
5 | * Copyright (C) 1994, 1995, 1997 TooLs GmbH. | 5 | * Copyright (C) 1994, 1995, 1997 TooLs GmbH. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below). | 7 | * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below). | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -38,27 +38,27 @@ | @@ -38,27 +38,27 @@ | |||
38 | * it, and don't remove this notice. | 38 | * it, and don't remove this notice. | |
39 | * | 39 | * | |
40 | * This software is provided "as is". | 40 | * This software is provided "as is". | |
41 | * | 41 | * | |
42 | * The author supplies this software to be publicly redistributed on the | 42 | * The author supplies this software to be publicly redistributed on the | |
43 | * understanding that the author is not responsible for the correct | 43 | * understanding that the author is not responsible for the correct | |
44 | * functioning of this software in any circumstances and is not liable for | 44 | * functioning of this software in any circumstances and is not liable for | |
45 | * any damages caused by this software. | 45 | * any damages caused by this software. | |
46 | * | 46 | * | |
47 | * October 1992 | 47 | * October 1992 | |
48 | */ | 48 | */ | |
49 | 49 | |||
50 | #include <sys/cdefs.h> | 50 | #include <sys/cdefs.h> | |
51 | __KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.72 2009/03/14 15:36:21 dsl Exp $"); | 51 | __KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.73 2009/03/15 17:15:57 cegger Exp $"); | |
52 | 52 | |||
53 | #if defined(_KERNEL_OPT) | 53 | #if defined(_KERNEL_OPT) | |
54 | #include "opt_compat_netbsd.h" | 54 | #include "opt_compat_netbsd.h" | |
55 | #endif | 55 | #endif | |
56 | 56 | |||
57 | #include <sys/param.h> | 57 | #include <sys/param.h> | |
58 | #include <sys/systm.h> | 58 | #include <sys/systm.h> | |
59 | #include <sys/sysctl.h> | 59 | #include <sys/sysctl.h> | |
60 | #include <sys/namei.h> | 60 | #include <sys/namei.h> | |
61 | #include <sys/proc.h> | 61 | #include <sys/proc.h> | |
62 | #include <sys/kernel.h> | 62 | #include <sys/kernel.h> | |
63 | #include <sys/vnode.h> | 63 | #include <sys/vnode.h> | |
64 | #include <miscfs/genfs/genfs.h> | 64 | #include <miscfs/genfs/genfs.h> | |
@@ -222,27 +222,27 @@ update_mp(struct mount *mp, struct msdos | @@ -222,27 +222,27 @@ update_mp(struct mount *mp, struct msdos | |||
222 | pmp->pm_flags |= findwin95(VTODE(rtvp)) | 222 | pmp->pm_flags |= findwin95(VTODE(rtvp)) | |
223 | ? MSDOSFSMNT_LONGNAME | 223 | ? MSDOSFSMNT_LONGNAME | |
224 | : MSDOSFSMNT_SHORTNAME; | 224 | : MSDOSFSMNT_SHORTNAME; | |
225 | vput(rtvp); | 225 | vput(rtvp); | |
226 | } | 226 | } | |
227 | } | 227 | } | |
228 | 228 | |||
229 | mp->mnt_stat.f_namemax = MSDOSFS_NAMEMAX(pmp); | 229 | mp->mnt_stat.f_namemax = MSDOSFS_NAMEMAX(pmp); | |
230 | 230 | |||
231 | return 0; | 231 | return 0; | |
232 | } | 232 | } | |
233 | 233 | |||
234 | int | 234 | int | |
235 | msdosfs_mountroot() | 235 | msdosfs_mountroot(void) | |
236 | { | 236 | { | |
237 | struct mount *mp; | 237 | struct mount *mp; | |
238 | struct lwp *l = curlwp; /* XXX */ | 238 | struct lwp *l = curlwp; /* XXX */ | |
239 | int error; | 239 | int error; | |
240 | struct msdosfs_args args; | 240 | struct msdosfs_args args; | |
241 | 241 | |||
242 | if (device_class(root_device) != DV_DISK) | 242 | if (device_class(root_device) != DV_DISK) | |
243 | return (ENODEV); | 243 | return (ENODEV); | |
244 | 244 | |||
245 | if ((error = vfs_rootmountalloc(MOUNT_MSDOS, "root_device", &mp))) { | 245 | if ((error = vfs_rootmountalloc(MOUNT_MSDOS, "root_device", &mp))) { | |
246 | vrele(rootvp); | 246 | vrele(rootvp); | |
247 | return (error); | 247 | return (error); | |
248 | } | 248 | } |
--- src/sys/fs/ntfs/ntfs_ihash.c 2009/03/14 15:36:22 1.8
+++ src/sys/fs/ntfs/ntfs_ihash.c 2009/03/15 17:15:58 1.9
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ntfs_ihash.c,v 1.8 2009/03/14 15:36:22 dsl Exp $ */ | 1 | /* $NetBSD: ntfs_ihash.c,v 1.9 2009/03/15 17:15:58 cegger Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1982, 1986, 1989, 1991, 1993, 1995 | 4 | * Copyright (c) 1982, 1986, 1989, 1991, 1993, 1995 | |
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. | |
@@ -23,66 +23,66 @@ | @@ -23,66 +23,66 @@ | |||
23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
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 | * @(#)ufs_ihash.c 8.7 (Berkeley) 5/17/95 | 31 | * @(#)ufs_ihash.c 8.7 (Berkeley) 5/17/95 | |
32 | * Id: ntfs_ihash.c,v 1.5 1999/05/12 09:42:58 semenu Exp | 32 | * Id: ntfs_ihash.c,v 1.5 1999/05/12 09:42:58 semenu Exp | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | #include <sys/cdefs.h> | 35 | #include <sys/cdefs.h> | |
36 | __KERNEL_RCSID(0, "$NetBSD: ntfs_ihash.c,v 1.8 2009/03/14 15:36:22 dsl Exp $"); | 36 | __KERNEL_RCSID(0, "$NetBSD: ntfs_ihash.c,v 1.9 2009/03/15 17:15:58 cegger Exp $"); | |
37 | 37 | |||
38 | #include <sys/param.h> | 38 | #include <sys/param.h> | |
39 | #include <sys/systm.h> | 39 | #include <sys/systm.h> | |
40 | #include <sys/kernel.h> | 40 | #include <sys/kernel.h> | |
41 | #include <sys/lock.h> | 41 | #include <sys/lock.h> | |
42 | #include <sys/vnode.h> | 42 | #include <sys/vnode.h> | |
43 | #include <sys/proc.h> | 43 | #include <sys/proc.h> | |
44 | #include <sys/mount.h> | 44 | #include <sys/mount.h> | |
45 | 45 | |||
46 | #include <fs/ntfs/ntfs.h> | 46 | #include <fs/ntfs/ntfs.h> | |
47 | #include <fs/ntfs/ntfs_inode.h> | 47 | #include <fs/ntfs/ntfs_inode.h> | |
48 | #include <fs/ntfs/ntfs_ihash.h> | 48 | #include <fs/ntfs/ntfs_ihash.h> | |
49 | 49 | |||
50 | /* | 50 | /* | |
51 | * Structures associated with inode cacheing. | 51 | * Structures associated with inode cacheing. | |
52 | */ | 52 | */ | |
53 | static LIST_HEAD(nthashhead, ntnode) *ntfs_nthashtbl; | 53 | static LIST_HEAD(nthashhead, ntnode) *ntfs_nthashtbl; | |
54 | static u_long ntfs_nthash; /* size of hash table - 1 */ | 54 | static u_long ntfs_nthash; /* size of hash table - 1 */ | |
55 | #define NTNOHASH(device, inum) ((minor(device) + (inum)) & ntfs_nthash) | 55 | #define NTNOHASH(device, inum) ((minor(device) + (inum)) & ntfs_nthash) | |
56 | static kmutex_t ntfs_nthash_lock; | 56 | static kmutex_t ntfs_nthash_lock; | |
57 | kmutex_t ntfs_hashlock; | 57 | kmutex_t ntfs_hashlock; | |
58 | 58 | |||
59 | /* | 59 | /* | |
60 | * Initialize inode hash table. | 60 | * Initialize inode hash table. | |
61 | */ | 61 | */ | |
62 | void | 62 | void | |
63 | ntfs_nthashinit() | 63 | ntfs_nthashinit(void) | |
64 | { | 64 | { | |
65 | mutex_init(&ntfs_hashlock, MUTEX_DEFAULT, IPL_NONE); | 65 | mutex_init(&ntfs_hashlock, MUTEX_DEFAULT, IPL_NONE); | |
66 | mutex_init(&ntfs_nthash_lock, MUTEX_DEFAULT, IPL_NONE); | 66 | mutex_init(&ntfs_nthash_lock, MUTEX_DEFAULT, IPL_NONE); | |
67 | ntfs_nthashtbl = hashinit(desiredvnodes, HASH_LIST, true, &ntfs_nthash); | 67 | ntfs_nthashtbl = hashinit(desiredvnodes, HASH_LIST, true, &ntfs_nthash); | |
68 | } | 68 | } | |
69 | 69 | |||
70 | /* | 70 | /* | |
71 | * Reinitialize inode hash table. | 71 | * Reinitialize inode hash table. | |
72 | */ | 72 | */ | |
73 | 73 | |||
74 | void | 74 | void | |
75 | ntfs_nthashreinit() | 75 | ntfs_nthashreinit(void) | |
76 | { | 76 | { | |
77 | struct ntnode *ip; | 77 | struct ntnode *ip; | |
78 | struct nthashhead *oldhash, *hash; | 78 | struct nthashhead *oldhash, *hash; | |
79 | u_long oldmask, mask, val; | 79 | u_long oldmask, mask, val; | |
80 | int i; | 80 | int i; | |
81 | 81 | |||
82 | hash = hashinit(desiredvnodes, HASH_LIST, true, &mask); | 82 | hash = hashinit(desiredvnodes, HASH_LIST, true, &mask); | |
83 | 83 | |||
84 | mutex_enter(&ntfs_nthash_lock); | 84 | mutex_enter(&ntfs_nthash_lock); | |
85 | oldhash = ntfs_nthashtbl; | 85 | oldhash = ntfs_nthashtbl; | |
86 | oldmask = ntfs_nthash; | 86 | oldmask = ntfs_nthash; | |
87 | ntfs_nthashtbl = hash; | 87 | ntfs_nthashtbl = hash; | |
88 | ntfs_nthash = mask; | 88 | ntfs_nthash = mask; | |
@@ -92,27 +92,27 @@ ntfs_nthashreinit() | @@ -92,27 +92,27 @@ ntfs_nthashreinit() | |||
92 | val = NTNOHASH(ip->i_dev, ip->i_number); | 92 | val = NTNOHASH(ip->i_dev, ip->i_number); | |
93 | LIST_INSERT_HEAD(&hash[val], ip, i_hash); | 93 | LIST_INSERT_HEAD(&hash[val], ip, i_hash); | |
94 | } | 94 | } | |
95 | } | 95 | } | |
96 | mutex_exit(&ntfs_nthash_lock); | 96 | mutex_exit(&ntfs_nthash_lock); | |
97 | hashdone(oldhash, HASH_LIST, oldmask); | 97 | hashdone(oldhash, HASH_LIST, oldmask); | |
98 | } | 98 | } | |
99 | 99 | |||
100 | /* | 100 | /* | |
101 | * Free the inode hash table. Called from ntfs_done(), only needed | 101 | * Free the inode hash table. Called from ntfs_done(), only needed | |
102 | * on NetBSD. | 102 | * on NetBSD. | |
103 | */ | 103 | */ | |
104 | void | 104 | void | |
105 | ntfs_nthashdone() | 105 | ntfs_nthashdone(void) | |
106 | { | 106 | { | |
107 | hashdone(ntfs_nthashtbl, HASH_LIST, ntfs_nthash); | 107 | hashdone(ntfs_nthashtbl, HASH_LIST, ntfs_nthash); | |
108 | mutex_destroy(&ntfs_hashlock); | 108 | mutex_destroy(&ntfs_hashlock); | |
109 | mutex_destroy(&ntfs_nthash_lock); | 109 | mutex_destroy(&ntfs_nthash_lock); | |
110 | } | 110 | } | |
111 | 111 | |||
112 | /* | 112 | /* | |
113 | * Use the device/inum pair to find the incore inode, and return a pointer | 113 | * Use the device/inum pair to find the incore inode, and return a pointer | |
114 | * to it. If it is in core, return it, even if it is locked. | 114 | * to it. If it is in core, return it, even if it is locked. | |
115 | */ | 115 | */ | |
116 | struct ntnode * | 116 | struct ntnode * | |
117 | ntfs_nthashlookup(dev_t dev, ino_t inum) | 117 | ntfs_nthashlookup(dev_t dev, ino_t inum) | |
118 | { | 118 | { |
--- src/sys/fs/ntfs/ntfs_subr.c 2009/03/14 21:04:24 1.40
+++ src/sys/fs/ntfs/ntfs_subr.c 2009/03/15 17:15:58 1.41
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ntfs_subr.c,v 1.40 2009/03/14 21:04:24 dsl Exp $ */ | 1 | /* $NetBSD: ntfs_subr.c,v 1.41 2009/03/15 17:15:58 cegger Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1998, 1999 Semen Ustimenko (semenu@FreeBSD.org) | 4 | * Copyright (c) 1998, 1999 Semen Ustimenko (semenu@FreeBSD.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. | |
@@ -19,27 +19,27 @@ | @@ -19,27 +19,27 @@ | |||
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 | * Id: ntfs_subr.c,v 1.4 1999/05/12 09:43:01 semenu Exp | 28 | * Id: ntfs_subr.c,v 1.4 1999/05/12 09:43:01 semenu Exp | |
29 | */ | 29 | */ | |
30 | 30 | |||
31 | #include <sys/cdefs.h> | 31 | #include <sys/cdefs.h> | |
32 | __KERNEL_RCSID(0, "$NetBSD: ntfs_subr.c,v 1.40 2009/03/14 21:04:24 dsl Exp $"); | 32 | __KERNEL_RCSID(0, "$NetBSD: ntfs_subr.c,v 1.41 2009/03/15 17:15:58 cegger Exp $"); | |
33 | 33 | |||
34 | #include <sys/param.h> | 34 | #include <sys/param.h> | |
35 | #include <sys/systm.h> | 35 | #include <sys/systm.h> | |
36 | #include <sys/namei.h> | 36 | #include <sys/namei.h> | |
37 | #include <sys/proc.h> | 37 | #include <sys/proc.h> | |
38 | #include <sys/kernel.h> | 38 | #include <sys/kernel.h> | |
39 | #include <sys/vnode.h> | 39 | #include <sys/vnode.h> | |
40 | #include <sys/mount.h> | 40 | #include <sys/mount.h> | |
41 | #include <sys/buf.h> | 41 | #include <sys/buf.h> | |
42 | #include <sys/file.h> | 42 | #include <sys/file.h> | |
43 | #include <sys/malloc.h> | 43 | #include <sys/malloc.h> | |
44 | #include <sys/lock.h> | 44 | #include <sys/lock.h> | |
45 | #include <sys/kauth.h> | 45 | #include <sys/kauth.h> | |
@@ -2001,27 +2001,27 @@ ntfs_runtocn( | @@ -2001,27 +2001,27 @@ ntfs_runtocn( | |||
2001 | return (error); | 2001 | return (error); | |
2002 | } | 2002 | } | |
2003 | } while (ccl <= vcn); | 2003 | } while (ccl <= vcn); | |
2004 | *cn = ccn + vcn; | 2004 | *cn = ccn + vcn; | |
2005 | return (0); | 2005 | return (0); | |
2006 | } | 2006 | } | |
2007 | #endif | 2007 | #endif | |
2008 | 2008 | |||
2009 | /* | 2009 | /* | |
2010 | * this initializes toupper table & dependant variables to be ready for | 2010 | * this initializes toupper table & dependant variables to be ready for | |
2011 | * later work | 2011 | * later work | |
2012 | */ | 2012 | */ | |
2013 | void | 2013 | void | |
2014 | ntfs_toupper_init() | 2014 | ntfs_toupper_init(void) | |
2015 | { | 2015 | { | |
2016 | ntfs_toupper_tab = (wchar *) NULL; | 2016 | ntfs_toupper_tab = (wchar *) NULL; | |
2017 | mutex_init(&ntfs_toupper_lock, MUTEX_DEFAULT, IPL_NONE); | 2017 | mutex_init(&ntfs_toupper_lock, MUTEX_DEFAULT, IPL_NONE); | |
2018 | ntfs_toupper_usecount = 0; | 2018 | ntfs_toupper_usecount = 0; | |
2019 | } | 2019 | } | |
2020 | 2020 | |||
2021 | /* | 2021 | /* | |
2022 | * if the ntfs_toupper_tab[] is filled already, just raise use count; | 2022 | * if the ntfs_toupper_tab[] is filled already, just raise use count; | |
2023 | * otherwise read the data from the filesystem we are currently mounting | 2023 | * otherwise read the data from the filesystem we are currently mounting | |
2024 | */ | 2024 | */ | |
2025 | int | 2025 | int | |
2026 | ntfs_toupper_use(struct mount *mp, struct ntfsmount *ntmp) | 2026 | ntfs_toupper_use(struct mount *mp, struct ntfsmount *ntmp) | |
2027 | { | 2027 | { | |
@@ -2052,27 +2052,27 @@ ntfs_toupper_use(struct mount *mp, struc | @@ -2052,27 +2052,27 @@ ntfs_toupper_use(struct mount *mp, struc | |||
2052 | vput(vp); | 2052 | vput(vp); | |
2053 | 2053 | |||
2054 | out: | 2054 | out: | |
2055 | ntfs_toupper_usecount++; | 2055 | ntfs_toupper_usecount++; | |
2056 | mutex_exit(&ntfs_toupper_lock); | 2056 | mutex_exit(&ntfs_toupper_lock); | |
2057 | return (error); | 2057 | return (error); | |
2058 | } | 2058 | } | |
2059 | 2059 | |||
2060 | /* | 2060 | /* | |
2061 | * lower the use count and if it reaches zero, free the memory | 2061 | * lower the use count and if it reaches zero, free the memory | |
2062 | * tied by toupper table | 2062 | * tied by toupper table | |
2063 | */ | 2063 | */ | |
2064 | void | 2064 | void | |
2065 | ntfs_toupper_unuse() | 2065 | ntfs_toupper_unuse(void) | |
2066 | { | 2066 | { | |
2067 | /* get exclusive access */ | 2067 | /* get exclusive access */ | |
2068 | mutex_enter(&ntfs_toupper_lock); | 2068 | mutex_enter(&ntfs_toupper_lock); | |
2069 | 2069 | |||
2070 | ntfs_toupper_usecount--; | 2070 | ntfs_toupper_usecount--; | |
2071 | if (ntfs_toupper_usecount == 0) { | 2071 | if (ntfs_toupper_usecount == 0) { | |
2072 | free(ntfs_toupper_tab, M_NTFSRDATA); | 2072 | free(ntfs_toupper_tab, M_NTFSRDATA); | |
2073 | ntfs_toupper_tab = NULL; | 2073 | ntfs_toupper_tab = NULL; | |
2074 | } | 2074 | } | |
2075 | #ifdef DIAGNOSTIC | 2075 | #ifdef DIAGNOSTIC | |
2076 | else if (ntfs_toupper_usecount < 0) { | 2076 | else if (ntfs_toupper_usecount < 0) { | |
2077 | panic("ntfs_toupper_unuse(): use count negative: %d", | 2077 | panic("ntfs_toupper_unuse(): use count negative: %d", | |
2078 | ntfs_toupper_usecount); | 2078 | ntfs_toupper_usecount); |
--- src/sys/fs/ntfs/ntfs_vfsops.c 2009/03/14 15:36:22 1.75
+++ src/sys/fs/ntfs/ntfs_vfsops.c 2009/03/15 17:15:58 1.76
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ntfs_vfsops.c,v 1.75 2009/03/14 15:36:22 dsl Exp $ */ | 1 | /* $NetBSD: ntfs_vfsops.c,v 1.76 2009/03/15 17:15:58 cegger Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1998, 1999 Semen Ustimenko | 4 | * Copyright (c) 1998, 1999 Semen Ustimenko | |
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 | * 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 | * Id: ntfs_vfsops.c,v 1.7 1999/05/31 11:28:30 phk Exp | 28 | * Id: ntfs_vfsops.c,v 1.7 1999/05/31 11:28:30 phk Exp | |
29 | */ | 29 | */ | |
30 | 30 | |||
31 | #include <sys/cdefs.h> | 31 | #include <sys/cdefs.h> | |
32 | __KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.75 2009/03/14 15:36:22 dsl Exp $"); | 32 | __KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.76 2009/03/15 17:15:58 cegger Exp $"); | |
33 | 33 | |||
34 | #include <sys/param.h> | 34 | #include <sys/param.h> | |
35 | #include <sys/systm.h> | 35 | #include <sys/systm.h> | |
36 | #include <sys/namei.h> | 36 | #include <sys/namei.h> | |
37 | #include <sys/proc.h> | 37 | #include <sys/proc.h> | |
38 | #include <sys/kernel.h> | 38 | #include <sys/kernel.h> | |
39 | #include <sys/vnode.h> | 39 | #include <sys/vnode.h> | |
40 | #include <sys/mount.h> | 40 | #include <sys/mount.h> | |
41 | #include <sys/buf.h> | 41 | #include <sys/buf.h> | |
42 | #include <sys/fcntl.h> | 42 | #include <sys/fcntl.h> | |
43 | #include <sys/malloc.h> | 43 | #include <sys/malloc.h> | |
44 | #include <sys/sysctl.h> | 44 | #include <sys/sysctl.h> | |
45 | #include <sys/device.h> | 45 | #include <sys/device.h> | |
@@ -82,27 +82,27 @@ static void ntfs_init(void); | @@ -82,27 +82,27 @@ static void ntfs_init(void); | |||
82 | static void ntfs_reinit(void); | 82 | static void ntfs_reinit(void); | |
83 | static void ntfs_done(void); | 83 | static void ntfs_done(void); | |
84 | static int ntfs_fhtovp(struct mount *, struct fid *, | 84 | static int ntfs_fhtovp(struct mount *, struct fid *, | |
85 | struct vnode **); | 85 | struct vnode **); | |
86 | static int ntfs_mountroot(void); | 86 | static int ntfs_mountroot(void); | |
87 | 87 | |||
88 | static const struct genfs_ops ntfs_genfsops = { | 88 | static const struct genfs_ops ntfs_genfsops = { | |
89 | .gop_write = genfs_compat_gop_write, | 89 | .gop_write = genfs_compat_gop_write, | |
90 | }; | 90 | }; | |
91 | 91 | |||
92 | static struct sysctllog *ntfs_sysctl_log; | 92 | static struct sysctllog *ntfs_sysctl_log; | |
93 | 93 | |||
94 | static int | 94 | static int | |
95 | ntfs_mountroot() | 95 | ntfs_mountroot(void) | |
96 | { | 96 | { | |
97 | struct mount *mp; | 97 | struct mount *mp; | |
98 | struct lwp *l = curlwp; /* XXX */ | 98 | struct lwp *l = curlwp; /* XXX */ | |
99 | int error; | 99 | int error; | |
100 | struct ntfs_args args; | 100 | struct ntfs_args args; | |
101 | 101 | |||
102 | if (device_class(root_device) != DV_DISK) | 102 | if (device_class(root_device) != DV_DISK) | |
103 | return (ENODEV); | 103 | return (ENODEV); | |
104 | 104 | |||
105 | if ((error = vfs_rootmountalloc(MOUNT_NTFS, "root_device", &mp))) { | 105 | if ((error = vfs_rootmountalloc(MOUNT_NTFS, "root_device", &mp))) { | |
106 | vrele(rootvp); | 106 | vrele(rootvp); | |
107 | return (error); | 107 | return (error); | |
108 | } | 108 | } | |
@@ -117,49 +117,49 @@ ntfs_mountroot() | @@ -117,49 +117,49 @@ ntfs_mountroot() | |||
117 | vfs_destroy(mp); | 117 | vfs_destroy(mp); | |
118 | return (error); | 118 | return (error); | |
119 | } | 119 | } | |
120 | 120 | |||
121 | mutex_enter(&mountlist_lock); | 121 | mutex_enter(&mountlist_lock); | |
122 | CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list); | 122 | CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list); | |
123 | mutex_exit(&mountlist_lock); | 123 | mutex_exit(&mountlist_lock); | |
124 | (void)ntfs_statvfs(mp, &mp->mnt_stat); | 124 | (void)ntfs_statvfs(mp, &mp->mnt_stat); | |
125 | vfs_unbusy(mp, false, NULL); | 125 | vfs_unbusy(mp, false, NULL); | |
126 | return (0); | 126 | return (0); | |
127 | } | 127 | } | |
128 | 128 | |||
129 | static void | 129 | static void | |
130 | ntfs_init() | 130 | ntfs_init(void) | |
131 | { | 131 | { | |
132 | 132 | |||
133 | malloc_type_attach(M_NTFSMNT); | 133 | malloc_type_attach(M_NTFSMNT); | |
134 | malloc_type_attach(M_NTFSNTNODE); | 134 | malloc_type_attach(M_NTFSNTNODE); | |
135 | malloc_type_attach(M_NTFSFNODE); | 135 | malloc_type_attach(M_NTFSFNODE); | |
136 | malloc_type_attach(M_NTFSDIR); | 136 | malloc_type_attach(M_NTFSDIR); | |
137 | malloc_type_attach(M_NTFSNTVATTR); | 137 | malloc_type_attach(M_NTFSNTVATTR); | |
138 | malloc_type_attach(M_NTFSRDATA); | 138 | malloc_type_attach(M_NTFSRDATA); | |
139 | malloc_type_attach(M_NTFSDECOMP); | 139 | malloc_type_attach(M_NTFSDECOMP); | |
140 | malloc_type_attach(M_NTFSRUN); | 140 | malloc_type_attach(M_NTFSRUN); | |
141 | ntfs_nthashinit(); | 141 | ntfs_nthashinit(); | |
142 | ntfs_toupper_init(); | 142 | ntfs_toupper_init(); | |
143 | } | 143 | } | |
144 | 144 | |||
145 | static void | 145 | static void | |
146 | ntfs_reinit() | 146 | ntfs_reinit(void) | |
147 | { | 147 | { | |
148 | ntfs_nthashreinit(); | 148 | ntfs_nthashreinit(); | |
149 | } | 149 | } | |
150 | 150 | |||
151 | static void | 151 | static void | |
152 | ntfs_done() | 152 | ntfs_done(void) | |
153 | { | 153 | { | |
154 | ntfs_nthashdone(); | 154 | ntfs_nthashdone(); | |
155 | malloc_type_detach(M_NTFSMNT); | 155 | malloc_type_detach(M_NTFSMNT); | |
156 | malloc_type_detach(M_NTFSNTNODE); | 156 | malloc_type_detach(M_NTFSNTNODE); | |
157 | malloc_type_detach(M_NTFSFNODE); | 157 | malloc_type_detach(M_NTFSFNODE); | |
158 | malloc_type_detach(M_NTFSDIR); | 158 | malloc_type_detach(M_NTFSDIR); | |
159 | malloc_type_detach(M_NTFSNTVATTR); | 159 | malloc_type_detach(M_NTFSNTVATTR); | |
160 | malloc_type_detach(M_NTFSRDATA); | 160 | malloc_type_detach(M_NTFSRDATA); | |
161 | malloc_type_detach(M_NTFSDECOMP); | 161 | malloc_type_detach(M_NTFSDECOMP); | |
162 | malloc_type_detach(M_NTFSRUN); | 162 | malloc_type_detach(M_NTFSRUN); | |
163 | } | 163 | } | |
164 | 164 | |||
165 | static int | 165 | static int |