Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 6292 → Rev 6293

/drivers/ddk/Makefile
12,6 → 12,7
 
DEFINES = -DKOLIBRI -D__KERNEL__ -DCONFIG_X86_32 -DCONFIG_DMI -DCONFIG_TINY_RCU
DEFINES+= -DCONFIG_X86_L1_CACHE_SHIFT=6 -DCONFIG_ARCH_HAS_CACHE_LINE_SIZE
DEFINES+= -DCONFIG_PRINTK
 
CFLAGS = -c -Os $(INCLUDES) $(DEFINES) -march=i686 -fomit-frame-pointer -fno-builtin-printf \
-mno-stack-arg-probe -mpreferred-stack-boundary=2 -mincoming-stack-boundary=2 -fno-ident
/drivers/ddk/linux/scatterlist.c
349,9 → 349,70
}
EXPORT_SYMBOL(sg_alloc_table);
 
/**
* sg_alloc_table_from_pages - Allocate and initialize an sg table from
* an array of pages
* @sgt: The sg table header to use
* @pages: Pointer to an array of page pointers
* @n_pages: Number of pages in the pages array
* @offset: Offset from start of the first page to the start of a buffer
* @size: Number of valid bytes in the buffer (after offset)
* @gfp_mask: GFP allocation mask
*
* Description:
* Allocate and initialize an sg table from a list of pages. Contiguous
* ranges of the pages are squashed into a single scatterlist node. A user
* may provide an offset at a start and a size of valid data in a buffer
* specified by the page array. The returned sg table is released by
* sg_free_table.
*
* Returns:
* 0 on success, negative error on failure
*/
int sg_alloc_table_from_pages(struct sg_table *sgt,
struct page **pages, unsigned int n_pages,
unsigned long offset, unsigned long size,
gfp_t gfp_mask)
{
unsigned int chunks;
unsigned int i;
unsigned int cur_page;
int ret;
struct scatterlist *s;
 
/* compute number of contiguous chunks */
chunks = 1;
for (i = 1; i < n_pages; ++i)
if (page_to_pfn(pages[i]) != page_to_pfn(pages[i - 1]) + 1)
++chunks;
 
ret = sg_alloc_table(sgt, chunks, gfp_mask);
if (unlikely(ret))
return ret;
 
/* merging chunks and putting them into the scatterlist */
cur_page = 0;
for_each_sg(sgt->sgl, s, sgt->orig_nents, i) {
unsigned long chunk_size;
unsigned int j;
 
/* look for the end of the current chunk */
for (j = cur_page + 1; j < n_pages; ++j)
if (page_to_pfn(pages[j]) !=
page_to_pfn(pages[j - 1]) + 1)
break;
 
chunk_size = ((j - cur_page) << PAGE_SHIFT) - offset;
sg_set_page(s, pages[cur_page], min(size, chunk_size), offset);
size -= chunk_size;
offset = 0;
cur_page = j;
}
 
return 0;
}
EXPORT_SYMBOL(sg_alloc_table_from_pages);
 
void __sg_page_iter_start(struct sg_page_iter *piter,
struct scatterlist *sglist, unsigned int nents,
unsigned long pgoffset)
/drivers/ddk/stdio/vsprintf.c
41,9 → 41,8
 
#define KSTRTOX_OVERFLOW (1U << 31)
 
const char hex_asc[] = "0123456789abcdef";
const char hex_asc_upper[] = "0123456789ABCDEF";
 
 
/* Works only for digits and letters, but small and fast */
#define TOLOWER(x) ((x) | 0x20)
 
1080,6 → 1079,8
* (legacy clock framework) of the clock
* - 'Cr' For a clock, it prints the current rate of the clock
*
* ** Please update also Documentation/printk-formats.txt when making changes **
*
* Note: The difference between 'S' and 'F' is that on ia64 and ppc64
* function pointers are really function descriptors, which contain a
* pointer to the real address.
1088,7 → 1089,7
char *pointer(const char *fmt, char *buf, char *end, void *ptr,
struct printf_spec spec)
{
int default_width = 2 * sizeof(void *) + (spec.flags & SPECIAL ? 2 : 0);
const int default_width = 2 * sizeof(void *);
 
if (!ptr && *fmt != 'K') {
/*
1315,11 → 1316,10
 
case 'n':
/*
* Since %n poses a greater security risk than utility, treat
* it as an invalid format specifier. Warn about its use so
* that new instances don't get added.
* Since %n poses a greater security risk than
* utility, treat it as any other invalid or
* unsupported format specifier.
*/
// WARN_ONCE(1, "Please remove ignored %%n in '%s'\n", fmt);
/* Fall-through */
 
default:
1357,42 → 1357,17
* @fmt: The format string to use
* @args: Arguments for the format string
*
* This function follows C99 vsnprintf, but has some extensions:
* %pS output the name of a text symbol with offset
* %ps output the name of a text symbol without offset
* %pF output the name of a function pointer with its offset
* %pf output the name of a function pointer without its offset
* %pB output the name of a backtrace symbol with its offset
* %pR output the address range in a struct resource with decoded flags
* %pr output the address range in a struct resource with raw flags
* %pb output the bitmap with field width as the number of bits
* %pbl output the bitmap as range list with field width as the number of bits
* %pM output a 6-byte MAC address with colons
* %pMR output a 6-byte MAC address with colons in reversed order
* %pMF output a 6-byte MAC address with dashes
* %pm output a 6-byte MAC address without colons
* %pmR output a 6-byte MAC address without colons in reversed order
* %pI4 print an IPv4 address without leading zeros
* %pi4 print an IPv4 address with leading zeros
* %pI6 print an IPv6 address with colons
* %pi6 print an IPv6 address without colons
* %pI6c print an IPv6 address as specified by RFC 5952
* %pIS depending on sa_family of 'struct sockaddr *' print IPv4/IPv6 address
* %piS depending on sa_family of 'struct sockaddr *' print IPv4/IPv6 address
* %pU[bBlL] print a UUID/GUID in big or little endian using lower or upper
* case.
* %*pE[achnops] print an escaped buffer
* %*ph[CDN] a variable-length hex string with a separator (supports up to 64
* bytes of the input)
* %pC output the name (Common Clock Framework) or address (legacy clock
* framework) of a clock
* %pCn output the name (Common Clock Framework) or address (legacy clock
* framework) of a clock
* %pCr output the current rate of a clock
* %n is ignored
* This function generally follows C99 vsnprintf, but has some
* extensions and a few limitations:
*
* ** Please update Documentation/printk-formats.txt when making changes **
* %n is unsupported
* %p* is handled by pointer()
*
* See pointer() or Documentation/printk-formats.txt for more
* extensive description.
*
* ** Please update the documentation in both places when making changes **
*
* The return value is the number of characters which would
* be generated for the given input, excluding the trailing
* '\0', as per ISO C99. If you want to have the exact
1490,10 → 1465,15
break;
 
case FORMAT_TYPE_INVALID:
if (str < end)
*str = '%';
++str;
break;
/*
* Presumably the arguments passed gcc's type
* checking, but there is no safe or sane way
* for us to continue parsing the format and
* fetching from the va_list; the remaining
* specifiers and arguments would be out of
* sync.
*/
goto out;
 
default:
switch (spec.type) {
1538,6 → 1518,7
}
}
 
out:
if (size > 0) {
if (str < end)
*str = '\0';