View | Details | Raw Unified | Return to bug 210686
Collapse All | Expand All

(-)b/sys/cam/cam.c (-14 / +54 lines)
Lines 207-238 cam_strvis_sbuf(struct sbuf *sb, const u Link Here
207
/*
207
/*
208
 * Compare string with pattern, returning 0 on match.
208
 * Compare string with pattern, returning 0 on match.
209
 * Short pattern matches trailing blanks in name,
209
 * Short pattern matches trailing blanks in name,
210
 * wildcard '*' in pattern matches rest of name,
210
 * Shell globbing rules apply: * matches 0 or more characters,
211
 * wildcard '?' matches a single non-space character.
211
 * ? matchces one character, [...] denotes a set to match one char,
212
 * [^...] denotes a complimented set to match one character.
213
 * Spaces in str used to match anything in the pattern string
214
 * but was removed because it's a bug. No current patterns require
215
 * it, as far as I know, but it's impossible to know what drives
216
 * returned.
217
 *
218
 * Each '*' generates recursion, so keep the number of * in check.
212
 */
219
 */
213
int
220
int
214
cam_strmatch(const u_int8_t *str, const u_int8_t *pattern, int str_len)
221
cam_strmatch(const u_int8_t *str, const u_int8_t *pattern, int str_len)
215
{
222
{
216
223
217
	while (*pattern != '\0'&& str_len > 0) {  
224
	while (*pattern != '\0' && str_len > 0) {  
225
		if (*pattern == '*') {
226
			pattern++;
227
			if (*pattern == '\0')
228
				return (0);
229
			do {
230
				if (cam_strmatch(str, pattern, str_len) == 0)
231
					return (0);
232
				str++;
233
				str_len--;
234
			} while (str_len > 0);
235
			return (1);
236
		} else if (*pattern == '[') {
237
			int negate_range, ok;
238
			uint8_t pc, sc;
218
239
219
		if (*pattern == '*') {
240
			ok = 0;
220
			return (0);
241
			sc = *str++;
242
			str_len--;
243
			if ((negate_range = (*pattern == '^')) != 0)
244
				pattern++;
245
			while (((pc = *pattern) != ']') && *pattern != '\0') {
246
				pattern++;
247
				if (*pattern == '-') {
248
					if (pattern[1] == '\0') /* Bad pattern */
249
						return (1);
250
					if (sc >= pc && sc <= pattern[1])
251
						ok = 1;
252
					pattern += 2;
253
				} else if (pc == sc)
254
					ok = 1;
255
			}
256
			if (ok == negate_range)
257
				return (1);
258
		} else if (*pattern == '?') {
259
			/* NB: || *str == ' ' of the old code is a bug and was removed */
260
			/* if you add it back, keep this the last if before the naked else */
261
			pattern++;
262
			str++;
263
			str_len--;
264
		} else {
265
			if (*str != *pattern)
266
				return (1);
267
			pattern++;
268
			str++;
269
			str_len--;
221
		}
270
		}
222
		if ((*pattern != *str)
223
		 && (*pattern != '?' || *str == ' ')) {
224
			return (1);
225
		}
226
		pattern++;
227
		str++;
228
		str_len--;
229
	}
271
	}
230
	while (str_len > 0 && *str == ' ') {
272
	while (str_len > 0 && *str == ' ') {
231
		str++;
273
		str++;
232
		str_len--;
274
		str_len--;
233
	}
275
	}
234
	if (str_len > 0 && *str == 0)
235
		str_len = 0;
236
276
237
	return (str_len);
277
	return (str_len);
238
}
278
}
(-)b/sys/kern/vfs_bio.c (-5 / +5 lines)
Lines 1063-1077 bufinit(void) Link Here
1063
	bufspacethresh = lobufspace + (hibufspace - lobufspace) / 2;
1063
	bufspacethresh = lobufspace + (hibufspace - lobufspace) / 2;
1064
1064
1065
	/*
1065
	/*
1066
	 * Note: The 16 MiB upper limit for hirunningspace was chosen
1066
	 * Note: The 128 MiB upper limit for hirunningspace was chosen
1067
	 * arbitrarily and may need further tuning. It corresponds to
1067
	 * arbitrarily and may need further tuning. Historically, this
1068
	 * 128 outstanding write IO requests (if IO size is 128 KiB),
1068
	 * was 16 MiB (128 * 128k), but 32 drive systems with 32 tags
1069
	 * which fits with many RAID controllers' tagged queuing limits.
1069
	 * of 128kiB is 128MB.
1070
	 * The lower 1 MiB limit is the historical upper limit for
1070
	 * The lower 1 MiB limit is the historical upper limit for
1071
	 * hirunningspace.
1071
	 * hirunningspace.
1072
	 */
1072
	 */
1073
	hirunningspace = lmax(lmin(roundup(hibufspace / 64, MAXBCACHEBUF),
1073
	hirunningspace = lmax(lmin(roundup(hibufspace / 64, MAXBCACHEBUF),
1074
	    16 * 1024 * 1024), 1024 * 1024);
1074
	    128 * 1024 * 1024), 1024 * 1024);
1075
	lorunningspace = roundup((hirunningspace * 2) / 3, MAXBCACHEBUF);
1075
	lorunningspace = roundup((hirunningspace * 2) / 3, MAXBCACHEBUF);
1076
1076
1077
	/*
1077
	/*

Return to bug 210686