]> git.sesse.net Git - bcachefs-tools-debian/blob - linux/vsprintf.c
bcache in userspace; userspace fsck
[bcachefs-tools-debian] / linux / vsprintf.c
1 #include <linux/kernel.h>
2 #include "kstrtox.h"
3
4 /**
5  * simple_strtoull - convert a string to an unsigned long long
6  * @cp: The start of the string
7  * @endp: A pointer to the end of the parsed string will be placed here
8  * @base: The number base to use
9  *
10  * This function is obsolete. Please use kstrtoull instead.
11  */
12 unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int base)
13 {
14         unsigned long long result;
15         unsigned int rv;
16
17         cp = _parse_integer_fixup_radix(cp, &base);
18         rv = _parse_integer(cp, base, &result);
19         /* FIXME */
20         cp += (rv & ~KSTRTOX_OVERFLOW);
21
22         if (endp)
23                 *endp = (char *)cp;
24
25         return result;
26 }
27 EXPORT_SYMBOL(simple_strtoull);
28
29 /**
30  * simple_strtoul - convert a string to an unsigned long
31  * @cp: The start of the string
32  * @endp: A pointer to the end of the parsed string will be placed here
33  * @base: The number base to use
34  *
35  * This function is obsolete. Please use kstrtoul instead.
36  */
37 unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base)
38 {
39         return simple_strtoull(cp, endp, base);
40 }
41 EXPORT_SYMBOL(simple_strtoul);
42
43 /**
44  * simple_strtol - convert a string to a signed long
45  * @cp: The start of the string
46  * @endp: A pointer to the end of the parsed string will be placed here
47  * @base: The number base to use
48  *
49  * This function is obsolete. Please use kstrtol instead.
50  */
51 long simple_strtol(const char *cp, char **endp, unsigned int base)
52 {
53         if (*cp == '-')
54                 return -simple_strtoul(cp + 1, endp, base);
55
56         return simple_strtoul(cp, endp, base);
57 }
58 EXPORT_SYMBOL(simple_strtol);
59
60 /**
61  * simple_strtoll - convert a string to a signed long long
62  * @cp: The start of the string
63  * @endp: A pointer to the end of the parsed string will be placed here
64  * @base: The number base to use
65  *
66  * This function is obsolete. Please use kstrtoll instead.
67  */
68 long long simple_strtoll(const char *cp, char **endp, unsigned int base)
69 {
70         if (*cp == '-')
71                 return -simple_strtoull(cp + 1, endp, base);
72
73         return simple_strtoull(cp, endp, base);
74 }
75 EXPORT_SYMBOL(simple_strtoll);