*/
#include <typedefs.h>
#include <osl.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
#include <bcmutils.h>
#include <bcmendian.h>
#include <dngl_stats.h>
printf("\n");
}
-#define strtoul(nptr, endptr, base) simple_strtoul((nptr), (endptr), (base))
-
/* Convert user's input in hex pattern to byte-size mask */
static int wl_pattern_atoh(char *src, char *dst)
{
char num[3];
strncpy(num, src, 2);
num[2] = '\0';
- dst[i] = (u8) strtoul(num, NULL, 16);
+ dst[i] = (u8) simple_strtoul(num, NULL, 16);
src += 2;
}
return i;
arg_org = arg_save;
memcpy(arg_save, arg, strlen(arg) + 1);
- argv[i] = bcmstrtok(&arg_save, " ", 0);
+ argv[i] = strsep(&arg_save, " ");
i = 0;
if (NULL == argv[i]) {
pkt_filterp = (wl_pkt_filter_enable_t *) (buf + str_len + 1);
/* Parse packet filter id. */
- enable_parm.id = htod32(strtoul(argv[i], NULL, 0));
+ enable_parm.id = htod32(simple_strtoul(argv[i], NULL, 0));
/* Parse enable/disable value. */
enable_parm.enable = htod32(enable);
goto fail;
}
- argv[i] = bcmstrtok(&arg_save, " ", 0);
+ argv[i] = strsep(&arg_save, " ");
while (argv[i++])
- argv[i] = bcmstrtok(&arg_save, " ", 0);
+ argv[i] = strsep(&arg_save, " ");
i = 0;
if (NULL == argv[i]) {
pkt_filterp = (wl_pkt_filter_t *) (buf + str_len + 1);
/* Parse packet filter id. */
- pkt_filter.id = htod32(strtoul(argv[i], NULL, 0));
+ pkt_filter.id = htod32(simple_strtoul(argv[i], NULL, 0));
if (NULL == argv[++i]) {
DHD_ERROR(("Polarity not provided\n"));
}
/* Parse filter polarity. */
- pkt_filter.negate_match = htod32(strtoul(argv[i], NULL, 0));
+ pkt_filter.negate_match = htod32(simple_strtoul(argv[i], NULL, 0));
if (NULL == argv[++i]) {
DHD_ERROR(("Filter type not provided\n"));
}
/* Parse filter type. */
- pkt_filter.type = htod32(strtoul(argv[i], NULL, 0));
+ pkt_filter.type = htod32(simple_strtoul(argv[i], NULL, 0));
if (NULL == argv[++i]) {
DHD_ERROR(("Offset not provided\n"));
}
/* Parse pattern filter offset. */
- pkt_filter.u.pattern.offset = htod32(strtoul(argv[i], NULL, 0));
+ pkt_filter.u.pattern.offset = htod32(simple_strtoul(argv[i], NULL, 0));
if (NULL == argv[++i]) {
DHD_ERROR(("Bitmask not provided\n"));
ptr = buf;
bcm_mkiovar("ver", 0, 0, buf, sizeof(buf));
dhdcdc_query_ioctl(dhd, 0, WLC_GET_VAR, buf, sizeof(buf));
- bcmstrtok(&ptr, "\n", 0);
+ strsep(&ptr, "\n");
/* Print fw version info */
DHD_ERROR(("Firmware version = %s\n", buf));
#include <typedefs.h>
#include <linuxver.h>
#include <osl.h>
+#include <linux/kernel.h>
#include <bcmutils.h>
#include <bcmendian.h>
static s32 wl_pattern_atoh(s8 *src, s8 *dst)
{
-#define strtoul(nptr, endptr, base) bcm_strtoul((nptr), (endptr), (base))
int i;
if (strncmp(src, "0x", 2) != 0 && strncmp(src, "0X", 2) != 0) {
WL_ERR(("Mask invalid format. Needs to start with 0x\n"));
char num[3];
strncpy(num, src, 2);
num[2] = '\0';
- dst[i] = (u8) strtoul(num, NULL, 16);
+ dst[i] = (u8) simple_strtoul(num, NULL, 16);
src += 2;
}
return i;
return r;
}
-/****************************************************************************
-* Function: bcmstrtok
-*
-* Purpose:
-* Tokenizes a string. This function is conceptually similiar to ANSI C strtok(),
-* but allows strToken() to be used by different strings or callers at the same
-* time. Each call modifies '*string' by substituting a NULL character for the
-* first delimiter that is encountered, and updates 'string' to point to the char
-* after the delimiter. Leading delimiters are skipped.
-*
-* Parameters:
-* string (mod) Ptr to string ptr, updated by token.
-* delimiters (in) Set of delimiter characters.
-* tokdelim (out) Character that delimits the returned token. (May
-* be set to NULL if token delimiter is not required).
-*
-* Returns: Pointer to the next token found. NULL when no more tokens are found.
-*****************************************************************************
-*/
-char *bcmstrtok(char **string, const char *delimiters, char *tokdelim)
-{
- unsigned char *str;
- unsigned long map[8];
- int count;
- char *nextoken;
-
- if (tokdelim != NULL) {
- /* Prime the token delimiter */
- *tokdelim = '\0';
- }
-
- /* Clear control map */
- for (count = 0; count < 8; count++) {
- map[count] = 0;
- }
-
- /* Set bits in delimiter table */
- do {
- map[*delimiters >> 5] |= (1 << (*delimiters & 31));
- } while (*delimiters++);
-
- str = (unsigned char *)*string;
-
- /* Find beginning of token (skip over leading delimiters). Note that
- * there is no token iff this loop sets str to point to the terminal
- * null (*str == '\0')
- */
- while (((map[*str >> 5] & (1 << (*str & 31))) && *str) || (*str == ' ')) {
- str++;
- }
-
- nextoken = (char *)str;
-
- /* Find the end of the token. If it is not the end of the string,
- * put a null there.
- */
- for (; *str; str++) {
- if (map[*str >> 5] & (1 << (*str & 31))) {
- if (tokdelim != NULL) {
- *tokdelim = *str;
- }
-
- *str++ = '\0';
- break;
- }
- }
-
- *string = (char *)str;
-
- /* Determine if a token has been found. */
- if (nextoken == (char *)str) {
- return NULL;
- } else {
- return nextoken;
- }
-}