Latest Broadcom NDIS driver requires 4 additional functions
Scot Hetzel
swhetzel at gmail.com
Mon Dec 11 21:56:09 PST 2006
On 11/25/06, Scot Hetzel <swhetzel at gmail.com> wrote:
> Unimplemented Functions:
> memchr - implemented but causes "cast discards qualifiers from pointer target type"
:
>
> Any ideas as to how to fix memchr, ... ?
>
I was able to fix memchr with the help of one of my college
professors, he provided me with two different solutions to get rid of
the cast problem.
#ifdef BROKEN_MEMCHR
static void *ntoskrnl_memchr(const void *, int, size_t);
/*
* /usr/src/sys/modules/ndis/../../compat/ndis/subr_ntoskrnl.c: In
function `ntoskrnl_memchr':
* /usr/src/sys/modules/ndis/../../compat/ndis/subr_ntoskrnl.c:465:
warning: cast discards qualifiers from pointer target type
* *** Error code 1
*/
static void *
ntoskrnl_memchr(buf, ch, len)
const void *buf;
unsigned char ch;
size_t len;
{
if (len != 0) {
const unsigned char *p = buf;
do {
if (*p++ == ch) {
return ((void *)(p - 1)); /* error
occurs here */
}
} while (--len != 0);
}
return (NULL);
}
#endif
#ifdef FIX1_MEMCHR
static void *ntoskrnl_memchr(void *, int, size_t);
static void *
ntoskrnl_memchr(buf, ch, len)
void *buf;
unsigned char ch;
size_t len;
{
if (len != 0) {
unsigned char *p = buf;
do {
if (*p++ == ch) {
return ((void *)(p - 1));
}
} while (--len != 0);
}
return (NULL);
}
#endif
#ifdef FIX2_MEMCHR
static const void *ntoskrnl_memchr(const void *, int, size_t);
static const void *
ntoskrnl_memchr(buf, ch, len)
const void *buf;
unsigned char ch;
size_t len;
{
if (len != 0) {
const unsigned char *p = buf;
do {
if (*p++ == ch) {
return ((const void *)(p - 1));
}
} while (--len != 0);
}
return (NULL);
}
#endif
Which version should I use as a follow up to PR 106131.
http://www.freebsd.org/cgi/query-pr.cgi?pr=106131
Scot
--
DISCLAIMER:
No electrons were mamed while sending this message. Only slightly bruised.
More information about the freebsd-current
mailing list