8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Miscellaneous support subroutines for High Sierra filesystem
23 *
24 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
26 */
27
28 #pragma ident "%Z%%M% %I% %E% SMI"
29
30 #include <sys/types.h>
31 #include <sys/param.h>
32 #include <sys/time.h>
33 #include <sys/cmn_err.h>
34 #include <sys/systm.h>
35 #include <sys/sysmacros.h>
36 #include <sys/buf.h>
37 #include <sys/conf.h>
38 #include <sys/user.h>
39 #include <sys/vfs.h>
40 #include <sys/vnode.h>
41 #include <sys/proc.h>
42 #include <sys/debug.h>
43 #include <sys/kmem.h>
44 #include <sys/uio.h>
45 #include <vm/hat.h>
46 #include <vm/as.h>
47 #include <vm/seg.h>
48 #include <vm/page.h>
49 #include <vm/pvn.h>
60 extern int hsfs_lostpage;
61
62 #ifdef __STDC__
63 static time_t hs_date_to_gmtime(int year, int mon, int day, int gmtoff);
64 #else
65 static time_t hs_date_to_gmtime();
66 #endif
67
68 /*
69 * Table used in logging non-fatal errors which should be recorded
70 * once per mount. Indexed by HSFS_ERR values (defined in hsfs_node.h).
71 */
72 struct hsfs_error {
73 char *hdr_text; /* msg prefix: general error type */
74 /* must contain %s for mnt pt */
75 char *err_text; /* specific error message */
76 uchar_t multiple; /* > 1 such error per fs possible? */
77 uchar_t n_printf_args; /* if err_text printf-like, # addtl args */
78 } hsfs_error[] = {
79 /* HSFS_ERR_TRAILING_JUNK */
80 "hsfs: Warning: the file system mounted on %s "
81 "does not conform to the ISO-9660 specification:",
82 "trailing blanks or null characters in file or directory name.\n",
83 1, 0,
84 /* HSFS_ERR_LOWER_CASE_NM */
85 "hsfs: Warning: the file system mounted on %s "
86 "does not conform to the ISO-9660 specification:",
87 "lower case characters in file or directory name.\n",
88 1, 0,
89 /* HSFS_ERR_BAD_ROOT_DIR */
90 "hsfs: Warning: the file system mounted on %s "
91 "does not conform to the ISO-9660 specification:",
92 "invalid root directory.\n",
93 0, 0,
94 /* HSFS_ERR_UNSUP_TYPE */
95 "hsfs: Warning: the file system mounted on %s "
96 "contains a file or directory with an unsupported type:",
97 " 0x%x.\n",
98 1, 1,
99 /* HSFS_ERR_BAD_FILE_LEN */
100 "hsfs: Warning: file system mounted on %s "
101 "does not conform to the ISO-9660 specification:",
102 "file name length greater than max allowed\n",
103 1, 0,
104 /* HSFS_ERR_BAD_JOLIET_FILE_LEN */
105 "hsfs: Warning: file system mounted on %s "
106 "does not conform to the Joliet specification:",
107 "file name length greater than max allowed\n",
108 1, 0,
109 /* HSFS_ERR_TRUNC_JOLIET_FILE_LEN */
110 "hsfs: Warning: file system mounted on %s "
111 "does not conform to the Joliet specification:",
112 "file name length greater than MAXNAMELEN (truncated)\n",
113 1, 0,
114 /* HSFS_ERR_BAD_DIR_ENTRY */
115 "hsfs: Warning: file system mounted on %s "
116 "has inconsistent data:",
117 "invalid directory or file name length (ignored)\n",
118 1, 0,
119 /* HSFS_ERR_NEG_SUA_LEN */
120 "hsfs: Warning: file system mounted on %s "
121 "has inconsistent Rock Ridge data:",
122 "negative SUA len\n",
123 1, 0,
124 /* HSFS_ERR_BAD_SUA_LEN */
125 "hsfs: Warning: file system mounted on %s "
126 "has inconsistent Rock Ridge data:",
127 "SUA len too big\n",
128 1, 0,
129 };
130
131 /*
132 * Local datatype for defining tables of (Offset, Name) pairs for
133 * kstats.
134 */
135 typedef struct {
136 offset_t index;
137 char *name;
138 } hsfs_ksindex_t;
139
140 static const hsfs_ksindex_t hsfs_kstats[] = {
141 { 0, "mountpoint" },
142 { 1, "pages_lost" },
143 { 2, "physical_read_pages" },
144 { 3, "cache_read_pages" },
145 { 4, "readahead_pages" },
146 { 5, "coalesced_pages" },
147 { 6, "total_pages_requested" },
148 {-1, NULL }
|
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Miscellaneous support subroutines for High Sierra filesystem
23 *
24 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
26 */
27
28 #include <sys/types.h>
29 #include <sys/param.h>
30 #include <sys/time.h>
31 #include <sys/cmn_err.h>
32 #include <sys/systm.h>
33 #include <sys/sysmacros.h>
34 #include <sys/buf.h>
35 #include <sys/conf.h>
36 #include <sys/user.h>
37 #include <sys/vfs.h>
38 #include <sys/vnode.h>
39 #include <sys/proc.h>
40 #include <sys/debug.h>
41 #include <sys/kmem.h>
42 #include <sys/uio.h>
43 #include <vm/hat.h>
44 #include <vm/as.h>
45 #include <vm/seg.h>
46 #include <vm/page.h>
47 #include <vm/pvn.h>
58 extern int hsfs_lostpage;
59
60 #ifdef __STDC__
61 static time_t hs_date_to_gmtime(int year, int mon, int day, int gmtoff);
62 #else
63 static time_t hs_date_to_gmtime();
64 #endif
65
66 /*
67 * Table used in logging non-fatal errors which should be recorded
68 * once per mount. Indexed by HSFS_ERR values (defined in hsfs_node.h).
69 */
70 struct hsfs_error {
71 char *hdr_text; /* msg prefix: general error type */
72 /* must contain %s for mnt pt */
73 char *err_text; /* specific error message */
74 uchar_t multiple; /* > 1 such error per fs possible? */
75 uchar_t n_printf_args; /* if err_text printf-like, # addtl args */
76 } hsfs_error[] = {
77 /* HSFS_ERR_TRAILING_JUNK */
78 { "hsfs: Warning: the file system mounted on %s "
79 "does not conform to the ISO-9660 specification:",
80 "trailing blanks or null characters in file or directory name.\n",
81 1, 0 },
82 /* HSFS_ERR_LOWER_CASE_NM */
83 { "hsfs: Warning: the file system mounted on %s "
84 "does not conform to the ISO-9660 specification:",
85 "lower case characters in file or directory name.\n",
86 1, 0 },
87 /* HSFS_ERR_BAD_ROOT_DIR */
88 { "hsfs: Warning: the file system mounted on %s "
89 "does not conform to the ISO-9660 specification:",
90 "invalid root directory.\n",
91 0, 0 },
92 /* HSFS_ERR_UNSUP_TYPE */
93 { "hsfs: Warning: the file system mounted on %s "
94 "contains a file or directory with an unsupported type:",
95 " 0x%x.\n",
96 1, 1 },
97 /* HSFS_ERR_BAD_FILE_LEN */
98 { "hsfs: Warning: file system mounted on %s "
99 "does not conform to the ISO-9660 specification:",
100 "file name length greater than max allowed\n",
101 1, 0 },
102 /* HSFS_ERR_BAD_JOLIET_FILE_LEN */
103 { "hsfs: Warning: file system mounted on %s "
104 "does not conform to the Joliet specification:",
105 "file name length greater than max allowed\n",
106 1, 0 },
107 /* HSFS_ERR_TRUNC_JOLIET_FILE_LEN */
108 { "hsfs: Warning: file system mounted on %s "
109 "does not conform to the Joliet specification:",
110 "file name length greater than MAXNAMELEN (truncated)\n",
111 1, 0 },
112 /* HSFS_ERR_BAD_DIR_ENTRY */
113 { "hsfs: Warning: file system mounted on %s "
114 "has inconsistent data:",
115 "invalid directory or file name length (ignored)\n",
116 1, 0 },
117 /* HSFS_ERR_NEG_SUA_LEN */
118 { "hsfs: Warning: file system mounted on %s "
119 "has inconsistent Rock Ridge data:",
120 "negative SUA len\n",
121 1, 0 },
122 /* HSFS_ERR_BAD_SUA_LEN */
123 { "hsfs: Warning: file system mounted on %s "
124 "has inconsistent Rock Ridge data:",
125 "SUA len too big\n",
126 1, 0 }
127 };
128
129 /*
130 * Local datatype for defining tables of (Offset, Name) pairs for
131 * kstats.
132 */
133 typedef struct {
134 offset_t index;
135 char *name;
136 } hsfs_ksindex_t;
137
138 static const hsfs_ksindex_t hsfs_kstats[] = {
139 { 0, "mountpoint" },
140 { 1, "pages_lost" },
141 { 2, "physical_read_pages" },
142 { 3, "cache_read_pages" },
143 { 4, "readahead_pages" },
144 { 5, "coalesced_pages" },
145 { 6, "total_pages_requested" },
146 {-1, NULL }
|