Add this kernel function so we can use it in userspace.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
[hch: split from a larger patch]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
}
return rval;
}
+
+void *
+memchr_inv(const void *start, int c, size_t bytes)
+{
+ const unsigned char *p = start;
+
+ while (bytes > 0) {
+ if (*p != (unsigned char)c)
+ return (void *)p;
+ bytes--;
+ }
+
+ return NULL;
+}
#ifndef __LIBFROG_UTIL_H__
#define __LIBFROG_UTIL_H__
+#include <sys/types.h>
+
unsigned int log2_roundup(unsigned int i);
#define min_t(type,x,y) \
#define max_t(type,x,y) \
({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
+void *memchr_inv(const void *start, int c, size_t bytes);
+
#endif /* __LIBFROG_UTIL_H__ */