FreeBSD Bugzilla – Attachment 173807 Details for
Bug 210686
NCQ_TRIM_BROKEN quirk mismatch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix regex code in cam_strmatch
alt.diff (text/plain), 3.31 KB, created by
Warner Losh
on 2016-08-18 04:13:39 UTC
(
hide
)
Description:
Fix regex code in cam_strmatch
Filename:
MIME Type:
Creator:
Warner Losh
Created:
2016-08-18 04:13:39 UTC
Size:
3.31 KB
patch
obsolete
>diff -r 313659496522 sys/cam/cam.c >--- a/sys/cam/cam.c >+++ b/sys/cam/cam.c >@@ -207,32 +207,72 @@ cam_strvis_sbuf(struct sbuf *sb, const u > /* > * Compare string with pattern, returning 0 on match. > * Short pattern matches trailing blanks in name, >- * wildcard '*' in pattern matches rest of name, >- * wildcard '?' matches a single non-space character. >+ * Shell globbing rules apply: * matches 0 or more characters, >+ * ? matchces one character, [...] denotes a set to match one char, >+ * [^...] denotes a complimented set to match one character. >+ * Spaces in str used to match anything in the pattern string >+ * but was removed because it's a bug. No current patterns require >+ * it, as far as I know, but it's impossible to know what drives >+ * returned. >+ * >+ * Each '*' generates recursion, so keep the number of * in check. > */ > int > cam_strmatch(const u_int8_t *str, const u_int8_t *pattern, int str_len) > { > >- while (*pattern != '\0'&& str_len > 0) { >+ while (*pattern != '\0' && str_len > 0) { >+ if (*pattern == '*') { >+ pattern++; >+ if (*pattern == '\0') >+ return (0); >+ do { >+ if (cam_strmatch(str, pattern, str_len) == 0) >+ return (0); >+ str++; >+ str_len--; >+ } while (str_len > 0); >+ return (1); >+ } else if (*pattern == '[') { >+ int negate_range, ok; >+ uint8_t pc, sc; > >- if (*pattern == '*') { >- return (0); >+ ok = 0; >+ sc = *str++; >+ str_len--; >+ if ((negate_range = (*pattern == '^')) != 0) >+ pattern++; >+ while (((pc = *pattern) != ']') && *pattern != '\0') { >+ pattern++; >+ if (*pattern == '-') { >+ if (pattern[1] == '\0') /* Bad pattern */ >+ return (1); >+ if (sc >= pc && sc <= pattern[1]) >+ ok = 1; >+ pattern += 2; >+ } else if (pc == sc) >+ ok = 1; >+ } >+ if (ok == negate_range) >+ return (1); >+ } else if (*pattern == '?') { >+ /* NB: || *str == ' ' of the old code is a bug and was removed */ >+ /* if you add it back, keep this the last if before the naked else */ >+ pattern++; >+ str++; >+ str_len--; >+ } else { >+ if (*str != *pattern) >+ return (1); >+ pattern++; >+ str++; >+ str_len--; > } >- if ((*pattern != *str) >- && (*pattern != '?' || *str == ' ')) { >- return (1); >- } >- pattern++; >- str++; >- str_len--; > } > while (str_len > 0 && *str == ' ') { > str++; > str_len--; > } >- if (str_len > 0 && *str == 0) >- str_len = 0; > > return (str_len); > } >diff -r 313659496522 sys/kern/vfs_bio.c >--- a/sys/kern/vfs_bio.c >+++ b/sys/kern/vfs_bio.c >@@ -1063,15 +1063,15 @@ bufinit(void) > bufspacethresh = lobufspace + (hibufspace - lobufspace) / 2; > > /* >- * Note: The 16 MiB upper limit for hirunningspace was chosen >- * arbitrarily and may need further tuning. It corresponds to >- * 128 outstanding write IO requests (if IO size is 128 KiB), >- * which fits with many RAID controllers' tagged queuing limits. >+ * Note: The 128 MiB upper limit for hirunningspace was chosen >+ * arbitrarily and may need further tuning. Historically, this >+ * was 16 MiB (128 * 128k), but 32 drive systems with 32 tags >+ * of 128kiB is 128MB. > * The lower 1 MiB limit is the historical upper limit for > * hirunningspace. > */ > hirunningspace = lmax(lmin(roundup(hibufspace / 64, MAXBCACHEBUF), >- 16 * 1024 * 1024), 1024 * 1024); >+ 128 * 1024 * 1024), 1024 * 1024); > lorunningspace = roundup((hirunningspace * 2) / 3, MAXBCACHEBUF); > > /*
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 210686
:
171939
| 173807