Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 6934 → Rev 6936

/drivers/ddk/linux/div64.c
13,7 → 13,8
*
* Code generated for this function might be very inefficient
* for some CPUs. __div64_32() can be overridden by linking arch-specific
* assembly versions such as arch/ppc/lib/div64.S and arch/sh/lib/div64.S.
* assembly versions such as arch/ppc/lib/div64.S and arch/sh/lib/div64.S
* or by defining a preprocessor macro in arch/include/asm/div64.h.
*/
 
#include <linux/export.h>
23,6 → 24,7
/* Not needed on 64bit architectures */
#if BITS_PER_LONG == 32
 
#ifndef __div64_32
uint32_t __attribute__((weak)) __div64_32(uint64_t *n, uint32_t base)
{
uint64_t rem = *n;
55,8 → 57,8
*n = res;
return rem;
}
 
EXPORT_SYMBOL(__div64_32);
#endif
 
#ifndef div_s64_rem
s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder)
/drivers/ddk/linux/kasprintf.c
13,24 → 13,42
/* Simplified asprintf. */
char *kvasprintf(gfp_t gfp, const char *fmt, va_list ap)
{
unsigned int len;
unsigned int first, second;
char *p;
va_list aq;
 
va_copy(aq, ap);
len = vsnprintf(NULL, 0, fmt, aq);
first = vsnprintf(NULL, 0, fmt, aq);
va_end(aq);
 
p = kmalloc(len+1, gfp);
p = kmalloc(first+1, gfp);
if (!p)
return NULL;
 
vsnprintf(p, len+1, fmt, ap);
second = vsnprintf(p, first+1, fmt, ap);
WARN(first != second, "different return values (%u and %u) from vsnprintf(\"%s\", ...)",
first, second, fmt);
 
return p;
}
EXPORT_SYMBOL(kvasprintf);
 
/*
* If fmt contains no % (or is exactly %s), use kstrdup_const. If fmt
* (or the sole vararg) points to rodata, we will then save a memory
* allocation and string copy. In any case, the return value should be
* freed using kfree_const().
*/
const char *kvasprintf_const(gfp_t gfp, const char *fmt, va_list ap)
{
if (!strchr(fmt, '%'))
return strdup(fmt);
if (!strcmp(fmt, "%s"))
return strdup(va_arg(ap, const char*));
return kvasprintf(gfp, fmt, ap);
}
EXPORT_SYMBOL(kvasprintf_const);
 
char *kasprintf(gfp_t gfp, const char *fmt, ...)
{
va_list ap;
/drivers/ddk/linux/scatterlist.c
578,9 → 578,9
*
* Description:
* Stops mapping iterator @miter. @miter should have been started
* started using sg_miter_start(). A stopped iteration can be
* resumed by calling sg_miter_next() on it. This is useful when
* resources (kmap) need to be released during iteration.
* using sg_miter_start(). A stopped iteration can be resumed by
* calling sg_miter_next() on it. This is useful when resources (kmap)
* need to be released during iteration.
*
* Context:
* Preemption disabled if the SG_MITER_ATOMIC is set. Don't care
/drivers/ddk/linux/string.c
28,7 → 28,35
#include <linux/errno.h>
 
 
#ifndef __HAVE_ARCH_STRNCPY
/**
* strncpy - Copy a length-limited, C-string
* @dest: Where to copy the string to
* @src: Where to copy the string from
* @count: The maximum number of bytes to copy
*
* The result is not %NUL-terminated if the source exceeds
* @count bytes.
*
* In the case where the length of @src is less than that of
* count, the remainder of @dest will be padded with %NUL.
*
*/
char *strncpy(char *dest, const char *src, size_t count)
{
char *tmp = dest;
 
while (count) {
if ((*tmp = *src) != 0)
src++;
tmp++;
count--;
}
return dest;
}
EXPORT_SYMBOL(strncpy);
#endif
 
#ifndef __HAVE_ARCH_STRLCPY
/**
* strlcpy - Copy a C-string into a sized buffer