return bitcount;
}
EXPORT_SYMBOL(brcmu_bitcount);
-
-/* Initialization of brcmu_strbuf structure */
-void brcmu_binit(struct brcmu_strbuf *b, char *buf, uint size)
-{
- b->origsize = b->size = size;
- b->origbuf = b->buf = buf;
-}
-EXPORT_SYMBOL(brcmu_binit);
-
-/* Buffer sprintf wrapper to guard against buffer overflow */
-int brcmu_bprintf(struct brcmu_strbuf *b, const char *fmt, ...)
-{
- va_list ap;
- int r;
-
- va_start(ap, fmt);
- r = vsnprintf(b->buf, b->size, fmt, ap);
-
- /* Non Ansi C99 compliant returns -1,
- * Ansi compliant return r >= b->size,
- * stdlib returns 0, handle all
- */
- if ((r == -1) || (r >= (int)b->size) || (r == 0)) {
- b->size = 0;
- } else {
- b->size -= r;
- b->buf += r;
- }
-
- va_end(ap);
-
- return r;
-}
-EXPORT_SYMBOL(brcmu_bprintf);
#include <linux/skbuff.h>
-/* Buffer structure for collecting string-formatted data
-* using brcmu_bprintf() API.
-* Use brcmu_binit() to initialize before use
-*/
-
-struct brcmu_strbuf {
- char *buf; /* pointer to current position in origbuf */
- unsigned int size; /* current (residual) size in bytes */
- char *origbuf; /* unmodified pointer to orignal buffer */
- unsigned int origsize; /* unmodified orignal buffer size in bytes */
-};
-
/*
* Spin at most 'us' microseconds while 'exp' is true.
* Caller should explicitly test 'exp' when this completes
extern u16 brcmu_qdbm_to_mw(u8 qdbm);
extern u8 brcmu_mw_to_qdbm(u16 mw);
-extern void brcmu_binit(struct brcmu_strbuf *b, char *buf, uint size);
-extern int brcmu_bprintf(struct brcmu_strbuf *b, const char *fmt, ...);
-
extern uint brcmu_mkiovar(char *name, char *data, uint datalen,
char *buf, uint len);
extern uint brcmu_bitcount(u8 *bitmap, uint bytelength);