aboutsummaryrefslogtreecommitdiff
path: root/lib/parser.c
AgeCommit message (Collapse)AuthorFilesLines
2021-07-01kernel.h: split out kstrtox() and simple_strtox() to a separate headerAndy Shevchenko1-0/+1
kernel.h is being used as a dump for all kinds of stuff for a long time. Here is the attempt to start cleaning it up by splitting out kstrtox() and simple_strtox() helpers. At the same time convert users in header and lib folders to use new header. Though for time being include new header back to kernel.h to avoid twisted indirected includes for existing users. [[email protected]: fix documentation references] Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Jonathan Cameron <[email protected]> Cc: Francis Laniel <[email protected]> Cc: Randy Dunlap <[email protected]> Cc: Kars Mulder <[email protected]> Cc: Trond Myklebust <[email protected]> Cc: Anna Schumaker <[email protected]> Cc: "J. Bruce Fields" <[email protected]> Cc: Chuck Lever <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2021-05-06lib: parser: clean up kernel-docRandy Dunlap1-23/+38
Mark match_uint() as kernel-doc notation since it is already fully annotated as such. Use % prefix on constants in kernel-doc comments. Convert function return descriptions to use the "Return:" kernel-doc notation. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Randy Dunlap <[email protected]> Cc: Alexander Viro <[email protected]> Cc: David Howells <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2021-02-03parser: Fix kernel-doc markupsBingJing Chang1-11/+11
Fix existing issues at the kernel-doc markups Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Randy Dunlap <[email protected]> Signed-off-by: BingJing Chang <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2021-02-03parser: add unsigned int parserBingJing Chang1-0/+22
Will be used by fs parsing options Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Robbie Ko<[email protected]> Reviewed-by: Chung-Chiang Cheng <[email protected]> Signed-off-by: BingJing Chang <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2019-06-19treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 230Thomas Gleixner1-3/+1
Based on 2 normalized pattern(s): this source code is licensed under the gnu general public license version 2 see the file copying for more details this source code is licensed under general public license version 2 see extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 52 file(s). Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Enrico Weigelt <[email protected]> Reviewed-by: Allison Randal <[email protected]> Reviewed-by: Alexios Zavras <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-10-31lib/parser.c: switch match_number() over to use match_strdup()Eric Biggers1-4/+1
This simplifies the code. No change in behavior. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Eric Biggers <[email protected]> Reviewed-by: Andrew Morton <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2018-10-31lib/parser.c: switch match_u64int() over to use match_strdup()Eric Biggers1-4/+1
This simplifies the code. No change in behavior. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Eric Biggers <[email protected]> Reviewed-by: Andrew Morton <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2018-10-31lib/parser.c: switch match_strdup() over to use kmemdup_nul()Eric Biggers1-5/+1
This simplifies the code. No change in behavior. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Eric Biggers <[email protected]> Reviewed-by: Andrew Morton <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2016-12-06parser: add u64 number parserJames Smart1-0/+47
Will be used by the nvme-fabrics FC transport in parsing options Signed-off-by: James Smart <[email protected]> Signed-off-by: Sagi Grimberg <[email protected]>
2014-01-23lib/parser.c: put EXPORT_SYMBOLs in the conventional placeAndrew Morton1-7/+6
Cc: Du, Changbin <[email protected]> Cc: Joe Perches <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-01-23lib/parser.c: add match_wildcard() functionDu, Changbin1-0/+51
match_wildcard function is a simple implementation of wildcard matching algorithm. It only supports two usual wildcardes: '*' - matches zero or more characters '?' - matches one character This algorithm is safe since it is non-recursive. Signed-off-by: Du, Changbin <[email protected]> Cc: Jason Baron <[email protected]> Cc: Joe Perches <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-21lib/parser.c: fix up comments for valid return values from match_numberNamjae Jeon1-3/+3
match_number() has return values of -ENOMEM, -EINVAL and -ERANGE. So, for all the functions calling match_number, the return value should include these values. Fix up the comments to reflect the correct values. Signed-off-by: Namjae Jeon <[email protected]> Signed-off-by: Amit Sahrawat <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2012-10-06lib/parser.c: avoid overflow in match_number()Alex Elder1-2/+8
The result of converting an integer value to another signed integer type that's unable to represent the original value is implementation defined. (See notes in section 6.3.1.3 of the C standard.) In match_number(), the result of simple_strtol() (which returns type long) is assigned to a value of type int. Instead, handle the result of simple_strtol() in a well-defined way, and return -ERANGE if the result won't fit in the int variable used to hold the parsed result. No current callers pay attention to the particular error value returned, so this additional return code shouldn't do any harm. [[email protected]: coding-style tweaks] Signed-off-by: Alex Elder <[email protected]> Cc: Randy Dunlap <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2012-03-07lib: reduce the use of module.h wherever possiblePaul Gortmaker1-1/+2
For files only using THIS_MODULE and/or EXPORT_SYMBOL, map them onto including export.h -- or if the file isn't even using those, then just delete the include. Fix up any implicit include dependencies that were being masked by module.h along the way. Signed-off-by: Paul Gortmaker <[email protected]>
2011-03-31Fix common misspellingsLucas De Marchi1-1/+1
Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <[email protected]>
2010-10-26lib/parser: cleanup match_number()Namhyung Kim1-3/+4
Use new variable 'len' to make code more readable. Signed-off-by: Namhyung Kim <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2009-12-15parser: remove unnecessary strlen()André Goddard Rosa1-4/+7
No functional change. Cache strlen() result to avoid recalculating it up to 3 times on the worst case. Reduces code size a little by 32 bytes: text data bss dec hex filename 1385 0 0 1385 569 lib/parser.o-BEFORE 1353 0 0 1353 549 lib/parser.o-AFTER Signed-off-by: André Goddard Rosa <[email protected]> Cc: Randy Dunlap <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-10-13vfs: Use const for kernel parser tableSteven Whitehouse1-1/+1
This is a much better version of a previous patch to make the parser tables constant. Rather than changing the typedef, we put the "const" in all the various places where its required, allowing the __initconst exception for nfsroot which was the cause of the previous trouble. This was posted for review some time ago and I believe its been in -mm since then. Signed-off-by: Steven Whitehouse <[email protected]> Cc: Alexander Viro <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-05-14add match_strlcpy() us it to make v9fs make uname and remotename parsing ↵Markus Armbruster1-12/+20
more robust match_strcpy() is a somewhat creepy function: the caller needs to make sure that the destination buffer is big enough, and when he screws up or forgets, match_strcpy() happily overruns the buffer. There's exactly one customer: v9fs_parse_options(). I believe it currently can't overflow its buffer, but that's not exactly obvious. The source string is a substing of the mount options. The kernel silently truncates those to PAGE_SIZE bytes, including the terminating zero. See compat_sys_mount() and do_mount(). The destination buffer is obtained from __getname(), which allocates from name_cachep, which is initialized by vfs_caches_init() for size PATH_MAX. We're safe as long as PATH_MAX <= PAGE_SIZE. PATH_MAX is 4096. As far as I know, the smallest PAGE_SIZE is also 4096. Here's a patch that makes the code a bit more obviously correct. It doesn't depend on PATH_MAX <= PAGE_SIZE. Signed-off-by: Markus Armbruster <[email protected]> Cc: Latchesar Ionkov <[email protected]> Cc: Jim Meyering <[email protected]> Cc: "Randy.Dunlap" <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Eric Van Hensbergen <[email protected]>
2007-05-03[AFS]: Make the match_*() functions take const options.David Howells1-5/+5
Make the match_*() functions take a const pointer to the options table and make strings pointers in the options table const too. Signed-off-by: David Howells <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2005-04-16Linux-2.6.12-rc2Linus Torvalds1-0/+220
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!