Compare commits
	
		
			66 Commits
		
	
	
		
			android-4.
			...
			tools_r22
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					ff220f7003 | ||
| 
						 | 
					63dd03cced | ||
| 
						 | 
					b9256adab3 | ||
| 
						 | 
					52171b9bdc | ||
| 
						 | 
					d541ba1719 | ||
| 
						 | 
					1c462b7a04 | ||
| 
						 | 
					b01f7afd5f | ||
| 
						 | 
					532d6f09b1 | ||
| 
						 | 
					e4ac8feb58 | ||
| 
						 | 
					4f40e511b0 | ||
| 
						 | 
					5e3b502b6b | ||
| 
						 | 
					277226bf43 | ||
| 
						 | 
					8c00c91aa0 | ||
| 
						 | 
					80541922e3 | ||
| 
						 | 
					bee0ab16e4 | ||
| 
						 | 
					3b2e6bc9ac | ||
| 
						 | 
					c46871302e | ||
| 
						 | 
					9020fd503c | ||
| 
						 | 
					b94b2851d7 | ||
| 
						 | 
					78d6d9888c | ||
| 
						 | 
					382a775378 | ||
| 
						 | 
					1aae9bd170 | ||
| 
						 | 
					c6dc62f09c | ||
| 
						 | 
					e66ad7809e | ||
| 
						 | 
					f7153fd13f | ||
| 
						 | 
					9ff1ffd805 | ||
| 
						 | 
					e7aaad8b83 | ||
| 
						 | 
					5f28fde8ae | ||
| 
						 | 
					8d3e91d4f8 | ||
| 
						 | 
					e8f46e8edd | ||
| 
						 | 
					87efcd2e63 | ||
| 
						 | 
					85aeb49144 | ||
| 
						 | 
					c705daa0a2 | ||
| 
						 | 
					21da42ea91 | ||
| 
						 | 
					2c60c18c50 | ||
| 
						 | 
					bda2fb5efa | ||
| 
						 | 
					676e66db25 | ||
| 
						 | 
					2379088a90 | ||
| 
						 | 
					70e0bd3a44 | ||
| 
						 | 
					f8dff7d449 | ||
| 
						 | 
					8c181aa8fe | ||
| 
						 | 
					516a897053 | ||
| 
						 | 
					b3c8c4d865 | ||
| 
						 | 
					796cbe249b | ||
| 
						 | 
					ea489745dc | ||
| 
						 | 
					0b25f633a2 | ||
| 
						 | 
					ed36d95fac | ||
| 
						 | 
					6b05c8e280 | ||
| 
						 | 
					b632857a50 | ||
| 
						 | 
					4ca685e36e | ||
| 
						 | 
					fc76c7d394 | ||
| 
						 | 
					bf0d1ad72b | ||
| 
						 | 
					68fd78efa0 | ||
| 
						 | 
					185ce72d00 | ||
| 
						 | 
					240fb8623b | ||
| 
						 | 
					0d787c1fa1 | ||
| 
						 | 
					014c75c78b | ||
| 
						 | 
					8baa929d5d | ||
| 
						 | 
					14c840df90 | ||
| 
						 | 
					a51916b58b | ||
| 
						 | 
					162b4411fc | ||
| 
						 | 
					4ace92c62a | ||
| 
						 | 
					7a29f404e1 | ||
| 
						 | 
					378b0e1ea2 | ||
| 
						 | 
					6bb17dfad3 | ||
| 
						 | 
					cfa089df23 | 
@@ -15,58 +15,29 @@ libc_common_src_files := \
 | 
			
		||||
	unistd/system.c \
 | 
			
		||||
	unistd/time.c \
 | 
			
		||||
	stdio/asprintf.c \
 | 
			
		||||
	stdio/clrerr.c \
 | 
			
		||||
	stdio/fclose.c \
 | 
			
		||||
	stdio/fdopen.c \
 | 
			
		||||
	stdio/feof.c \
 | 
			
		||||
	stdio/ferror.c \
 | 
			
		||||
	stdio/fflush.c \
 | 
			
		||||
	stdio/fgetc.c \
 | 
			
		||||
	stdio/fgetln.c \
 | 
			
		||||
	stdio/fgetpos.c \
 | 
			
		||||
	stdio/fgets.c \
 | 
			
		||||
	stdio/fileno.c \
 | 
			
		||||
	stdio/findfp.c \
 | 
			
		||||
	stdio/flags.c \
 | 
			
		||||
	stdio/fopen.c \
 | 
			
		||||
	stdio/fprintf.c \
 | 
			
		||||
	stdio/fpurge.c \
 | 
			
		||||
	stdio/fputc.c \
 | 
			
		||||
	stdio/fputs.c \
 | 
			
		||||
	stdio/fread.c \
 | 
			
		||||
	stdio/freopen.c \
 | 
			
		||||
	stdio/fscanf.c \
 | 
			
		||||
	stdio/fseek.c \
 | 
			
		||||
	stdio/fsetpos.c \
 | 
			
		||||
	stdio/ftell.c \
 | 
			
		||||
	stdio/funopen.c \
 | 
			
		||||
	stdio/fvwrite.c \
 | 
			
		||||
	stdio/fwalk.c \
 | 
			
		||||
	stdio/fwrite.c \
 | 
			
		||||
	stdio/getc.c \
 | 
			
		||||
	stdio/getchar.c \
 | 
			
		||||
	stdio/gets.c \
 | 
			
		||||
	stdio/makebuf.c \
 | 
			
		||||
	stdio/mktemp.c \
 | 
			
		||||
	stdio/printf.c \
 | 
			
		||||
	stdio/putc.c \
 | 
			
		||||
	stdio/putchar.c \
 | 
			
		||||
	stdio/puts.c \
 | 
			
		||||
	stdio/putw.c \
 | 
			
		||||
	stdio/refill.c \
 | 
			
		||||
	stdio/remove.c \
 | 
			
		||||
	stdio/rewind.c \
 | 
			
		||||
	stdio/rget.c \
 | 
			
		||||
	stdio/scanf.c \
 | 
			
		||||
	stdio/setbuf.c \
 | 
			
		||||
	stdio/setbuffer.c \
 | 
			
		||||
	stdio/setvbuf.c \
 | 
			
		||||
	stdio/snprintf.c\
 | 
			
		||||
	stdio/sprintf.c \
 | 
			
		||||
	stdio/sscanf.c \
 | 
			
		||||
	stdio/stdio.c \
 | 
			
		||||
	stdio/tempnam.c \
 | 
			
		||||
	stdio/tmpnam.c \
 | 
			
		||||
	stdio/ungetc.c \
 | 
			
		||||
	stdio/vasprintf.c \
 | 
			
		||||
	stdio/vfprintf.c \
 | 
			
		||||
@@ -77,13 +48,11 @@ libc_common_src_files := \
 | 
			
		||||
	stdio/vscanf.c \
 | 
			
		||||
	stdio/vsscanf.c \
 | 
			
		||||
	stdio/wbuf.c \
 | 
			
		||||
	stdio/wsetup.c \
 | 
			
		||||
	stdlib/atexit.c \
 | 
			
		||||
	stdlib/ctype_.c \
 | 
			
		||||
	stdlib/exit.c \
 | 
			
		||||
	stdlib/getenv.c \
 | 
			
		||||
	stdlib/putenv.c \
 | 
			
		||||
	stdlib/qsort.c \
 | 
			
		||||
	stdlib/setenv.c \
 | 
			
		||||
	stdlib/strtod.c \
 | 
			
		||||
	stdlib/strtoimax.c \
 | 
			
		||||
@@ -97,7 +66,6 @@ libc_common_src_files := \
 | 
			
		||||
	string/index.c \
 | 
			
		||||
	string/strcasecmp.c \
 | 
			
		||||
	string/strcat.c \
 | 
			
		||||
	string/strchr.c \
 | 
			
		||||
	string/strcspn.c \
 | 
			
		||||
	string/strdup.c \
 | 
			
		||||
	string/strlcat.c \
 | 
			
		||||
@@ -170,7 +138,6 @@ libc_common_src_files := \
 | 
			
		||||
	bionic/recv.c \
 | 
			
		||||
	bionic/sched_cpualloc.c \
 | 
			
		||||
	bionic/sched_cpucount.c \
 | 
			
		||||
	bionic/sched_getaffinity.c \
 | 
			
		||||
	bionic/sched_getcpu.c \
 | 
			
		||||
	bionic/semaphore.c \
 | 
			
		||||
	bionic/send.c \
 | 
			
		||||
@@ -264,11 +231,13 @@ libc_bionic_src_files := \
 | 
			
		||||
    bionic/raise.cpp \
 | 
			
		||||
    bionic/sbrk.cpp \
 | 
			
		||||
    bionic/scandir.cpp \
 | 
			
		||||
    bionic/sched_getaffinity.cpp \
 | 
			
		||||
    bionic/__set_errno.cpp \
 | 
			
		||||
    bionic/setlocale.cpp \
 | 
			
		||||
    bionic/signalfd.cpp \
 | 
			
		||||
    bionic/sigwait.cpp \
 | 
			
		||||
    bionic/__strcat_chk.cpp \
 | 
			
		||||
    bionic/strchr.cpp \
 | 
			
		||||
    bionic/__strcpy_chk.cpp \
 | 
			
		||||
    bionic/strerror.cpp \
 | 
			
		||||
    bionic/strerror_r.cpp \
 | 
			
		||||
@@ -289,6 +258,37 @@ libc_bionic_src_files := \
 | 
			
		||||
    bionic/wchar.cpp \
 | 
			
		||||
 | 
			
		||||
libc_upstream_freebsd_src_files := \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/clrerr.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fclose.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fdopen.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/feof.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/ferror.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fgetln.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fgetpos.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fgets.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fileno.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/flags.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fopen.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fpurge.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fputs.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fsetpos.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/funopen.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fwalk.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fwrite.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/getc.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/getchar.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/putc.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/putchar.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/puts.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/putw.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/remove.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/rget.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/setbuf.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/setbuffer.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/tempnam.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/tmpnam.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/wsetup.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdlib/qsort.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdlib/realpath.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcpcpy.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcpncpy.c \
 | 
			
		||||
@@ -764,9 +764,6 @@ LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 | 
			
		||||
LOCAL_WHOLE_STATIC_LIBRARIES := libbionic_ssp libc_bionic libc_freebsd libc_netbsd
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
 | 
			
		||||
# TODO: split out the asflags.
 | 
			
		||||
LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
 | 
			
		||||
 | 
			
		||||
include $(BUILD_STATIC_LIBRARY)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -60,52 +60,52 @@ size_t strlen(const char *s)
 | 
			
		||||
    // We need to process 32 bytes per loop to schedule PLD properly
 | 
			
		||||
    // and achieve the maximum bus speed.
 | 
			
		||||
    asm(
 | 
			
		||||
        "ldr     %[v], [ %[s] ], #4         \n"
 | 
			
		||||
        "ldr     %[v], [%[s]], #4           \n"
 | 
			
		||||
        "sub     %[l], %[l], %[s]           \n"
 | 
			
		||||
        "0:                                 \n"
 | 
			
		||||
#if __ARM_HAVE_PLD
 | 
			
		||||
        "pld     [ %[s], #64 ]              \n"
 | 
			
		||||
        "pld     [%[s], #64]                \n"
 | 
			
		||||
#endif
 | 
			
		||||
        "sub     %[t], %[v], %[mask], lsr #7\n"
 | 
			
		||||
        "and     %[t], %[t], %[mask]        \n"
 | 
			
		||||
        "bics    %[t], %[t], %[v]           \n"
 | 
			
		||||
        "ldreq   %[v], [ %[s] ], #4         \n"
 | 
			
		||||
        "ldreq   %[v], [%[s]], #4           \n"
 | 
			
		||||
#if !defined(__OPTIMIZE_SIZE__)
 | 
			
		||||
        "bne     1f                         \n"
 | 
			
		||||
        "sub     %[t], %[v], %[mask], lsr #7\n"
 | 
			
		||||
        "and     %[t], %[t], %[mask]        \n"
 | 
			
		||||
        "bics    %[t], %[t], %[v]           \n"
 | 
			
		||||
        "ldreq   %[v], [ %[s] ], #4         \n"
 | 
			
		||||
        "ldreq   %[v], [%[s]], #4           \n"
 | 
			
		||||
        "bne     1f                         \n"
 | 
			
		||||
        "sub     %[t], %[v], %[mask], lsr #7\n"
 | 
			
		||||
        "and     %[t], %[t], %[mask]        \n"
 | 
			
		||||
        "bics    %[t], %[t], %[v]           \n"
 | 
			
		||||
        "ldreq   %[v], [ %[s] ], #4         \n"
 | 
			
		||||
        "ldreq   %[v], [%[s]], #4           \n"
 | 
			
		||||
        "bne     1f                         \n"
 | 
			
		||||
        "sub     %[t], %[v], %[mask], lsr #7\n"
 | 
			
		||||
        "and     %[t], %[t], %[mask]        \n"
 | 
			
		||||
        "bics    %[t], %[t], %[v]           \n"
 | 
			
		||||
        "ldreq   %[v], [ %[s] ], #4         \n"
 | 
			
		||||
        "ldreq   %[v], [%[s]], #4           \n"
 | 
			
		||||
        "bne     1f                         \n"
 | 
			
		||||
        "sub     %[t], %[v], %[mask], lsr #7\n"
 | 
			
		||||
        "and     %[t], %[t], %[mask]        \n"
 | 
			
		||||
        "bics    %[t], %[t], %[v]           \n"
 | 
			
		||||
        "ldreq   %[v], [ %[s] ], #4         \n"
 | 
			
		||||
        "ldreq   %[v], [%[s]], #4           \n"
 | 
			
		||||
        "bne     1f                         \n"
 | 
			
		||||
        "sub     %[t], %[v], %[mask], lsr #7\n"
 | 
			
		||||
        "and     %[t], %[t], %[mask]        \n"
 | 
			
		||||
        "bics    %[t], %[t], %[v]           \n"
 | 
			
		||||
        "ldreq   %[v], [ %[s] ], #4         \n"
 | 
			
		||||
        "ldreq   %[v], [%[s]], #4           \n"
 | 
			
		||||
        "bne     1f                         \n"
 | 
			
		||||
        "sub     %[t], %[v], %[mask], lsr #7\n"
 | 
			
		||||
        "and     %[t], %[t], %[mask]        \n"
 | 
			
		||||
        "bics    %[t], %[t], %[v]           \n"
 | 
			
		||||
        "ldreq   %[v], [ %[s] ], #4         \n"
 | 
			
		||||
        "ldreq   %[v], [%[s]], #4           \n"
 | 
			
		||||
        "bne     1f                         \n"
 | 
			
		||||
        "sub     %[t], %[v], %[mask], lsr #7\n"
 | 
			
		||||
        "and     %[t], %[t], %[mask]        \n"
 | 
			
		||||
        "bics    %[t], %[t], %[v]           \n"
 | 
			
		||||
        "ldreq   %[v], [ %[s] ], #4         \n"
 | 
			
		||||
        "ldreq   %[v], [%[s]], #4           \n"
 | 
			
		||||
#endif
 | 
			
		||||
        "beq     0b                         \n"
 | 
			
		||||
        "1:                                 \n"
 | 
			
		||||
 
 | 
			
		||||
@@ -24,81 +24,110 @@
 | 
			
		||||
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 | 
			
		||||
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2013 ARM Ltd
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 * 1. Redistributions of source code must retain the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer.
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. The name of the company may not be used to endorse or promote
 | 
			
		||||
 *    products derived from this software without specific prior written
 | 
			
		||||
 *    permission.
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
 | 
			
		||||
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 | 
			
		||||
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 | 
			
		||||
 * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
			
		||||
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
 | 
			
		||||
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 | 
			
		||||
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 | 
			
		||||
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 | 
			
		||||
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 | 
			
		||||
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* Assumes neon instructions and a cache line size of 64 bytes. */
 | 
			
		||||
    /* Prototype: void *memcpy (void *dst, const void *src, size_t count).  */
 | 
			
		||||
 | 
			
		||||
        // This version is tuned for the Cortex-A15 processor.
 | 
			
		||||
 | 
			
		||||
#include <machine/cpu-features.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This code assumes it is running on a processor that supports all arm v7
 | 
			
		||||
 * instructions, that supports neon instructions, and that has a 64 byte
 | 
			
		||||
 * cache line.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
        .text
 | 
			
		||||
        .syntax unified
 | 
			
		||||
        .fpu    neon
 | 
			
		||||
 | 
			
		||||
#define CACHE_LINE_SIZE     64
 | 
			
		||||
#define CACHE_LINE_SIZE 64
 | 
			
		||||
 | 
			
		||||
ENTRY(memcpy)
 | 
			
		||||
        .save       {r0, lr}
 | 
			
		||||
        /* start preloading as early as possible */
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE*0)]
 | 
			
		||||
        stmfd       sp!, {r0, lr}
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE*1)]
 | 
			
		||||
        // Assumes that n >= 0, and dst, src are valid pointers.
 | 
			
		||||
        // For any sizes less than 832 use the neon code that doesn't
 | 
			
		||||
        // care about the src alignment. This avoids any checks
 | 
			
		||||
        // for src alignment, and offers the best improvement since
 | 
			
		||||
        // smaller sized copies are dominated by the overhead of
 | 
			
		||||
        // the pre and post main loop.
 | 
			
		||||
        // For larger copies, if src and dst cannot both be aligned to
 | 
			
		||||
        // word boundaries, use the neon code.
 | 
			
		||||
        // For all other copies, align dst to a double word boundary
 | 
			
		||||
        // and copy using LDRD/STRD instructions.
 | 
			
		||||
 | 
			
		||||
        /* do we have at least 16-bytes to copy (needed for alignment below) */
 | 
			
		||||
        cmp         r2, #16
 | 
			
		||||
        blo         5f
 | 
			
		||||
        // Save registers (r0 holds the return value):
 | 
			
		||||
        // optimized push {r0, lr}.
 | 
			
		||||
        .save   {r0, lr}
 | 
			
		||||
        pld     [r1, #(CACHE_LINE_SIZE*16)]
 | 
			
		||||
        push    {r0, lr}
 | 
			
		||||
 | 
			
		||||
        /* align destination to cache-line for the write-buffer */
 | 
			
		||||
        cmp     r2, #16
 | 
			
		||||
        blo     copy_less_than_16_unknown_align
 | 
			
		||||
 | 
			
		||||
        cmp     r2, #832
 | 
			
		||||
        bge     check_alignment
 | 
			
		||||
 | 
			
		||||
copy_unknown_alignment:
 | 
			
		||||
        // Unknown alignment of src and dst.
 | 
			
		||||
        // Assumes that the first few bytes have already been prefetched.
 | 
			
		||||
 | 
			
		||||
        // Align destination to 128 bits. The mainloop store instructions
 | 
			
		||||
        // require this alignment or they will throw an exception.
 | 
			
		||||
        rsb         r3, r0, #0
 | 
			
		||||
        ands        r3, r3, #0xF
 | 
			
		||||
        beq         0f
 | 
			
		||||
        beq         2f
 | 
			
		||||
 | 
			
		||||
        /* copy up to 15-bytes (count in r3) */
 | 
			
		||||
        // Copy up to 15 bytes (count in r3).
 | 
			
		||||
        sub         r2, r2, r3
 | 
			
		||||
        movs        ip, r3, lsl #31
 | 
			
		||||
        ldrmib      lr, [r1], #1
 | 
			
		||||
        strmib      lr, [r0], #1
 | 
			
		||||
        ldrcsb      ip, [r1], #1
 | 
			
		||||
        ldrcsb      lr, [r1], #1
 | 
			
		||||
        strcsb      ip, [r0], #1
 | 
			
		||||
        strcsb      lr, [r0], #1
 | 
			
		||||
 | 
			
		||||
        itt         mi
 | 
			
		||||
        ldrbmi      lr, [r1], #1
 | 
			
		||||
        strbmi      lr, [r0], #1
 | 
			
		||||
        itttt       cs
 | 
			
		||||
        ldrbcs      ip, [r1], #1
 | 
			
		||||
        ldrbcs      lr, [r1], #1
 | 
			
		||||
        strbcs      ip, [r0], #1
 | 
			
		||||
        strbcs      lr, [r0], #1
 | 
			
		||||
 | 
			
		||||
        movs        ip, r3, lsl #29
 | 
			
		||||
        bge         1f
 | 
			
		||||
        // copies 4 bytes, destination 32-bits aligned
 | 
			
		||||
        // Copies 4 bytes, dst 32 bits aligned before, at least 64 bits after.
 | 
			
		||||
        vld4.8      {d0[0], d1[0], d2[0], d3[0]}, [r1]!
 | 
			
		||||
        vst4.8      {d0[0], d1[0], d2[0], d3[0]}, [r0, :32]!
 | 
			
		||||
1:      bcc         2f
 | 
			
		||||
        // copies 8 bytes, destination 64-bits aligned
 | 
			
		||||
        // Copies 8 bytes, dst 64 bits aligned before, at least 128 bits after.
 | 
			
		||||
        vld1.8      {d0}, [r1]!
 | 
			
		||||
        vst1.8      {d0}, [r0, :64]!
 | 
			
		||||
2:
 | 
			
		||||
 | 
			
		||||
0:      /* preload immediately the next cache line, which we may need */
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE*0)]
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE*1)]
 | 
			
		||||
 | 
			
		||||
        /* make sure we have at least 64 bytes to copy */
 | 
			
		||||
2:      // Make sure we have at least 64 bytes to copy.
 | 
			
		||||
        subs        r2, r2, #64
 | 
			
		||||
        blo         2f
 | 
			
		||||
 | 
			
		||||
        /* Preload all the cache lines we need.
 | 
			
		||||
         * NOTE: The number of pld below depends on CACHE_LINE_SIZE,
 | 
			
		||||
         * ideally we would increase the distance in the main loop to
 | 
			
		||||
         * avoid the goofy code below. In practice this doesn't seem to make
 | 
			
		||||
         * a big difference.
 | 
			
		||||
         * NOTE: The value CACHE_LINE_SIZE * 4 was chosen through
 | 
			
		||||
         * experimentation.
 | 
			
		||||
         */
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE*2)]
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE*3)]
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE*4)]
 | 
			
		||||
 | 
			
		||||
1:      /* The main loop copies 64 bytes at a time */
 | 
			
		||||
1:      // The main loop copies 64 bytes at a time.
 | 
			
		||||
        vld1.8      {d0  - d3},   [r1]!
 | 
			
		||||
        vld1.8      {d4  - d7},   [r1]!
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE*4)]
 | 
			
		||||
@@ -107,25 +136,24 @@ ENTRY(memcpy)
 | 
			
		||||
        vst1.8      {d4  - d7},   [r0, :128]!
 | 
			
		||||
        bhs         1b
 | 
			
		||||
 | 
			
		||||
2:      /* fix-up the remaining count and make sure we have >= 32 bytes left */
 | 
			
		||||
        add         r2, r2, #64
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        blo         4f
 | 
			
		||||
2:      // Fix-up the remaining count and make sure we have >= 32 bytes left.
 | 
			
		||||
        adds        r2, r2, #32
 | 
			
		||||
        blo         3f
 | 
			
		||||
 | 
			
		||||
3:      /* 32 bytes at a time. These cache lines were already preloaded */
 | 
			
		||||
        // 32 bytes. These cache lines were already preloaded.
 | 
			
		||||
        vld1.8      {d0 - d3},  [r1]!
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        sub         r2, r2, #32
 | 
			
		||||
        vst1.8      {d0 - d3},  [r0, :128]!
 | 
			
		||||
        bhs         3b
 | 
			
		||||
4:      /* less than 32 left */
 | 
			
		||||
3:      // Less than 32 left.
 | 
			
		||||
        add         r2, r2, #32
 | 
			
		||||
        tst         r2, #0x10
 | 
			
		||||
        beq         5f
 | 
			
		||||
        // copies 16 bytes, 128-bits aligned
 | 
			
		||||
        beq         copy_less_than_16_unknown_align
 | 
			
		||||
        // Copies 16 bytes, destination 128 bits aligned.
 | 
			
		||||
        vld1.8      {d0, d1}, [r1]!
 | 
			
		||||
        vst1.8      {d0, d1}, [r0, :128]!
 | 
			
		||||
 | 
			
		||||
5:      /* copy up to 15-bytes (count in r2) */
 | 
			
		||||
copy_less_than_16_unknown_align:
 | 
			
		||||
        // Copy up to 15 bytes (count in r2).
 | 
			
		||||
        movs        ip, r2, lsl #29
 | 
			
		||||
        bcc         1f
 | 
			
		||||
        vld1.8      {d0}, [r1]!
 | 
			
		||||
@@ -133,14 +161,164 @@ ENTRY(memcpy)
 | 
			
		||||
1:      bge         2f
 | 
			
		||||
        vld4.8      {d0[0], d1[0], d2[0], d3[0]}, [r1]!
 | 
			
		||||
        vst4.8      {d0[0], d1[0], d2[0], d3[0]}, [r0]!
 | 
			
		||||
2:      movs        ip, r2, lsl #31
 | 
			
		||||
        ldrmib      r3, [r1], #1
 | 
			
		||||
        ldrcsb      ip, [r1], #1
 | 
			
		||||
        ldrcsb      lr, [r1], #1
 | 
			
		||||
        strmib      r3, [r0], #1
 | 
			
		||||
        strcsb      ip, [r0], #1
 | 
			
		||||
        strcsb      lr, [r0], #1
 | 
			
		||||
 | 
			
		||||
        ldmfd       sp!, {r0, lr}
 | 
			
		||||
        bx          lr
 | 
			
		||||
2:      // Copy 0 to 4 bytes.
 | 
			
		||||
        lsls        r2, r2, #31
 | 
			
		||||
        itt         ne
 | 
			
		||||
        ldrbne      lr, [r1], #1
 | 
			
		||||
        strbne      lr, [r0], #1
 | 
			
		||||
        itttt       cs
 | 
			
		||||
        ldrbcs      ip, [r1], #1
 | 
			
		||||
        ldrbcs      lr, [r1]
 | 
			
		||||
        strbcs      ip, [r0], #1
 | 
			
		||||
        strbcs      lr, [r0]
 | 
			
		||||
 | 
			
		||||
        pop         {r0, pc}
 | 
			
		||||
 | 
			
		||||
check_alignment:
 | 
			
		||||
        // If src and dst cannot both be aligned to a word boundary,
 | 
			
		||||
        // use the unaligned copy version.
 | 
			
		||||
        eor     r3, r0, r1
 | 
			
		||||
        ands    r3, r3, #0x3
 | 
			
		||||
        bne     copy_unknown_alignment
 | 
			
		||||
 | 
			
		||||
        // To try and improve performance, stack layout changed,
 | 
			
		||||
        // i.e., not keeping the stack looking like users expect
 | 
			
		||||
        // (highest numbered register at highest address).
 | 
			
		||||
        // TODO: Add debug frame directives.
 | 
			
		||||
        // We don't need exception unwind directives, because the code below
 | 
			
		||||
        // does not throw any exceptions and does not call any other functions.
 | 
			
		||||
        // Generally, newlib functions like this lack debug information for
 | 
			
		||||
        // assembler source.
 | 
			
		||||
        .save   {r4, r5}
 | 
			
		||||
        strd    r4, r5, [sp, #-8]!
 | 
			
		||||
        .save   {r6, r7}
 | 
			
		||||
        strd    r6, r7, [sp, #-8]!
 | 
			
		||||
        .save   {r8, r9}
 | 
			
		||||
        strd    r8, r9, [sp, #-8]!
 | 
			
		||||
 | 
			
		||||
        // Optimized for already aligned dst code.
 | 
			
		||||
        ands    ip, r0, #3
 | 
			
		||||
        bne     dst_not_word_aligned
 | 
			
		||||
 | 
			
		||||
word_aligned:
 | 
			
		||||
        // Align the destination buffer to 8 bytes, to make sure double
 | 
			
		||||
        // loads and stores don't cross a cache line boundary,
 | 
			
		||||
        // as they are then more expensive even if the data is in the cache
 | 
			
		||||
        // (require two load/store issue cycles instead of one).
 | 
			
		||||
        // If only one of the buffers is not 8 bytes aligned,
 | 
			
		||||
        // then it's more important to align dst than src,
 | 
			
		||||
        // because there is more penalty for stores
 | 
			
		||||
        // than loads that cross a cacheline boundary.
 | 
			
		||||
        // This check and realignment are only done if there is >= 832
 | 
			
		||||
        // bytes to copy.
 | 
			
		||||
 | 
			
		||||
        // Dst is word aligned, but check if it is already double word aligned.
 | 
			
		||||
        ands    r3, r0, #4
 | 
			
		||||
        beq     1f
 | 
			
		||||
        ldr     r3, [r1], #4
 | 
			
		||||
        str     r3, [r0], #4
 | 
			
		||||
        sub     r2, #4
 | 
			
		||||
 | 
			
		||||
1:      // Can only get here if > 64 bytes to copy, so don't do check r2.
 | 
			
		||||
        sub     r2, #64
 | 
			
		||||
 | 
			
		||||
2:      // Every loop iteration copies 64 bytes.
 | 
			
		||||
        .irp    offset, #0, #8, #16, #24, #32
 | 
			
		||||
        ldrd    r4, r5, [r1, \offset]
 | 
			
		||||
        strd    r4, r5, [r0, \offset]
 | 
			
		||||
        .endr
 | 
			
		||||
 | 
			
		||||
        ldrd    r4, r5, [r1, #40]
 | 
			
		||||
        ldrd    r6, r7, [r1, #48]
 | 
			
		||||
        ldrd    r8, r9, [r1, #56]
 | 
			
		||||
 | 
			
		||||
        // Keep the pld as far from the next load as possible.
 | 
			
		||||
        // The amount to prefetch was determined experimentally using
 | 
			
		||||
        // large sizes, and verifying the prefetch size does not affect
 | 
			
		||||
        // the smaller copies too much.
 | 
			
		||||
        // WARNING: If the ldrd and strd instructions get too far away
 | 
			
		||||
        //          from each other, performance suffers. Three loads
 | 
			
		||||
        //          in a row is the best tradeoff.
 | 
			
		||||
        pld     [r1, #(CACHE_LINE_SIZE*16)]
 | 
			
		||||
        strd    r4, r5, [r0, #40]
 | 
			
		||||
        strd    r6, r7, [r0, #48]
 | 
			
		||||
        strd    r8, r9, [r0, #56]
 | 
			
		||||
 | 
			
		||||
        add     r0, r0, #64
 | 
			
		||||
        add     r1, r1, #64
 | 
			
		||||
        subs    r2, r2, #64
 | 
			
		||||
        bge     2b
 | 
			
		||||
 | 
			
		||||
        // Fix-up the remaining count and make sure we have >= 32 bytes left.
 | 
			
		||||
        adds    r2, r2, #32
 | 
			
		||||
        blo     4f
 | 
			
		||||
 | 
			
		||||
        // Copy 32 bytes. These cache lines were already preloaded.
 | 
			
		||||
        .irp    offset, #0, #8, #16, #24
 | 
			
		||||
        ldrd    r4, r5, [r1, \offset]
 | 
			
		||||
        strd    r4, r5, [r0, \offset]
 | 
			
		||||
        .endr
 | 
			
		||||
        add     r1, r1, #32
 | 
			
		||||
        add     r0, r0, #32
 | 
			
		||||
        sub     r2, r2, #32
 | 
			
		||||
4:      // Less than 32 left.
 | 
			
		||||
        add     r2, r2, #32
 | 
			
		||||
        tst     r2, #0x10
 | 
			
		||||
        beq     5f
 | 
			
		||||
        // Copy 16 bytes.
 | 
			
		||||
        .irp    offset, #0, #8
 | 
			
		||||
        ldrd    r4, r5, [r1, \offset]
 | 
			
		||||
        strd    r4, r5, [r0, \offset]
 | 
			
		||||
        .endr
 | 
			
		||||
        add     r1, r1, #16
 | 
			
		||||
        add     r0, r0, #16
 | 
			
		||||
 | 
			
		||||
5:      // Copy up to 15 bytes (count in r2).
 | 
			
		||||
        movs    ip, r2, lsl #29
 | 
			
		||||
        bcc     1f
 | 
			
		||||
        // Copy 8 bytes.
 | 
			
		||||
        ldrd    r4, r5, [r1], #8
 | 
			
		||||
        strd    r4, r5, [r0], #8
 | 
			
		||||
1:      bge         2f
 | 
			
		||||
        // Copy 4 bytes.
 | 
			
		||||
        ldr     r4, [r1], #4
 | 
			
		||||
        str     r4, [r0], #4
 | 
			
		||||
2:      // Copy 0 to 4 bytes.
 | 
			
		||||
        lsls    r2, r2, #31
 | 
			
		||||
        itt     ne
 | 
			
		||||
        ldrbne  lr, [r1], #1
 | 
			
		||||
        strbne  lr, [r0], #1
 | 
			
		||||
        itttt   cs
 | 
			
		||||
        ldrbcs  ip, [r1], #1
 | 
			
		||||
        ldrbcs  lr, [r1]
 | 
			
		||||
        strbcs  ip, [r0], #1
 | 
			
		||||
        strbcs  lr, [r0]
 | 
			
		||||
 | 
			
		||||
        // Restore registers: optimized pop {r0, pc}
 | 
			
		||||
        ldrd    r8, r9, [sp], #8
 | 
			
		||||
        ldrd    r6, r7, [sp], #8
 | 
			
		||||
        ldrd    r4, r5, [sp], #8
 | 
			
		||||
        pop     {r0, pc}
 | 
			
		||||
 | 
			
		||||
dst_not_word_aligned:
 | 
			
		||||
        // Align dst to word.
 | 
			
		||||
        rsb     ip, ip, #4
 | 
			
		||||
        cmp     ip, #2
 | 
			
		||||
 | 
			
		||||
        itt     gt
 | 
			
		||||
        ldrbgt  lr, [r1], #1
 | 
			
		||||
        strbgt  lr, [r0], #1
 | 
			
		||||
 | 
			
		||||
        itt     ge
 | 
			
		||||
        ldrbge  lr, [r1], #1
 | 
			
		||||
        strbge  lr, [r0], #1
 | 
			
		||||
 | 
			
		||||
        ldrb    lr, [r1], #1
 | 
			
		||||
        strb    lr, [r0], #1
 | 
			
		||||
 | 
			
		||||
        sub     r2, r2, ip
 | 
			
		||||
 | 
			
		||||
        // Src is guaranteed to be at least word aligned by this point.
 | 
			
		||||
        b       word_aligned
 | 
			
		||||
END(memcpy)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2008 The Android Open Source Project
 | 
			
		||||
 * Copyright (C) 2013 The Android Open Source Project
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
@@ -35,11 +35,12 @@
 | 
			
		||||
         * memset() returns its first argument.
 | 
			
		||||
		 */
 | 
			
		||||
 | 
			
		||||
    .fpu    neon
 | 
			
		||||
        .fpu        neon
 | 
			
		||||
        .syntax     unified
 | 
			
		||||
 | 
			
		||||
ENTRY(bzero)
 | 
			
		||||
        mov     r2, r1
 | 
			
		||||
        mov     r1, #0
 | 
			
		||||
        mov         r2, r1
 | 
			
		||||
        mov         r1, #0
 | 
			
		||||
        // Fall through to memset...
 | 
			
		||||
END(bzero)
 | 
			
		||||
 | 
			
		||||
@@ -47,60 +48,117 @@ ENTRY(memset)
 | 
			
		||||
        .save       {r0}
 | 
			
		||||
        stmfd       sp!, {r0}
 | 
			
		||||
 | 
			
		||||
        vdup.8      q0, r1
 | 
			
		||||
 | 
			
		||||
        /* do we have at least 16-bytes to write (needed for alignment below) */
 | 
			
		||||
        // The new algorithm is slower for copies < 16 so use the old
 | 
			
		||||
        // neon code in that case.
 | 
			
		||||
        cmp         r2, #16
 | 
			
		||||
        blo         3f
 | 
			
		||||
        blo         set_less_than_16_unknown_align
 | 
			
		||||
 | 
			
		||||
        /* align destination to 16 bytes for the write-buffer */
 | 
			
		||||
        rsb         r3, r0, #0
 | 
			
		||||
        ands        r3, r3, #0xF
 | 
			
		||||
        beq         2f
 | 
			
		||||
        // Use strd which requires an even and odd register so move the
 | 
			
		||||
        // values so that:
 | 
			
		||||
        //   r0 and r1 contain the memset value
 | 
			
		||||
        //   r2 is the number of bytes to set
 | 
			
		||||
        //   r3 is the destination pointer
 | 
			
		||||
        mov         r3, r0
 | 
			
		||||
 | 
			
		||||
        /* write up to 15-bytes (count in r3) */
 | 
			
		||||
        sub         r2, r2, r3
 | 
			
		||||
        movs        ip, r3, lsl #31
 | 
			
		||||
        strmib      r1, [r0], #1
 | 
			
		||||
        strcsb      r1, [r0], #1
 | 
			
		||||
        strcsb      r1, [r0], #1
 | 
			
		||||
        movs        ip, r3, lsl #29
 | 
			
		||||
        bge         1f
 | 
			
		||||
        // Copy the byte value in every byte of r1.
 | 
			
		||||
        mov         r1, r1, lsl #24
 | 
			
		||||
        orr         r1, r1, r1, lsr #8
 | 
			
		||||
        orr         r1, r1, r1, lsr #16
 | 
			
		||||
 | 
			
		||||
        // writes 4 bytes, 32-bits aligned
 | 
			
		||||
        vst1.32     {d0[0]}, [r0, :32]!
 | 
			
		||||
1:      bcc         2f
 | 
			
		||||
check_alignment:
 | 
			
		||||
        // Align destination to a double word to avoid the strd crossing
 | 
			
		||||
        // a cache line boundary.
 | 
			
		||||
        ands        ip, r3, #7
 | 
			
		||||
        bne         do_double_word_align
 | 
			
		||||
 | 
			
		||||
        // writes 8 bytes, 64-bits aligned
 | 
			
		||||
        vst1.8      {d0}, [r0, :64]!
 | 
			
		||||
2:
 | 
			
		||||
        /* make sure we have at least 32 bytes to write */
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        blo         2f
 | 
			
		||||
        vmov        q1, q0
 | 
			
		||||
double_word_aligned:
 | 
			
		||||
        mov         r0, r1
 | 
			
		||||
 | 
			
		||||
1:      /* The main loop writes 32 bytes at a time */
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        vst1.8      {d0 - d3}, [r0, :128]!
 | 
			
		||||
        bhs         1b
 | 
			
		||||
        subs        r2, #64
 | 
			
		||||
        blo         set_less_than_64
 | 
			
		||||
 | 
			
		||||
2:      /* less than 32 left */
 | 
			
		||||
        add         r2, r2, #32
 | 
			
		||||
        tst         r2, #0x10
 | 
			
		||||
        beq         3f
 | 
			
		||||
1:      // Main loop sets 64 bytes at a time.
 | 
			
		||||
        .irp        offset, #0, #8, #16, #24, #32, #40, #48, #56
 | 
			
		||||
        strd        r0, r1, [r3, \offset]
 | 
			
		||||
        .endr
 | 
			
		||||
 | 
			
		||||
        // writes 16 bytes, 128-bits aligned
 | 
			
		||||
        vst1.8      {d0, d1}, [r0, :128]!
 | 
			
		||||
3:      /* write up to 15-bytes (count in r2) */
 | 
			
		||||
        add         r3, #64
 | 
			
		||||
        subs        r2, #64
 | 
			
		||||
        bge         1b
 | 
			
		||||
 | 
			
		||||
set_less_than_64:
 | 
			
		||||
        // Restore r2 to the count of bytes left to set.
 | 
			
		||||
        add         r2, #64
 | 
			
		||||
        lsls        ip, r2, #27
 | 
			
		||||
        bcc         set_less_than_32
 | 
			
		||||
        // Set 32 bytes.
 | 
			
		||||
        .irp        offset, #0, #8, #16, #24
 | 
			
		||||
        strd        r0, r1, [r3, \offset]
 | 
			
		||||
        .endr
 | 
			
		||||
        add         r3, #32
 | 
			
		||||
 | 
			
		||||
set_less_than_32:
 | 
			
		||||
        bpl         set_less_than_16
 | 
			
		||||
        // Set 16 bytes.
 | 
			
		||||
        .irp        offset, #0, #8
 | 
			
		||||
        strd        r0, r1, [r3, \offset]
 | 
			
		||||
        .endr
 | 
			
		||||
        add         r3, #16
 | 
			
		||||
 | 
			
		||||
set_less_than_16:
 | 
			
		||||
        // Less than 16 bytes to set.
 | 
			
		||||
        lsls        ip, r2, #29
 | 
			
		||||
        bcc         set_less_than_8
 | 
			
		||||
 | 
			
		||||
        // Set 8 bytes.
 | 
			
		||||
        strd        r0, r1, [r3], #8
 | 
			
		||||
 | 
			
		||||
set_less_than_8:
 | 
			
		||||
        bpl         set_less_than_4
 | 
			
		||||
        // Set 4 bytes
 | 
			
		||||
        str         r1, [r3], #4
 | 
			
		||||
 | 
			
		||||
set_less_than_4:
 | 
			
		||||
        lsls        ip, r2, #31
 | 
			
		||||
        it          ne
 | 
			
		||||
        strbne      r1, [r3], #1
 | 
			
		||||
        itt         cs
 | 
			
		||||
        strbcs      r1, [r3], #1
 | 
			
		||||
        strbcs      r1, [r3]
 | 
			
		||||
 | 
			
		||||
        ldmfd       sp!, {r0}
 | 
			
		||||
        bx          lr
 | 
			
		||||
 | 
			
		||||
do_double_word_align:
 | 
			
		||||
        rsb         ip, ip, #8
 | 
			
		||||
        sub         r2, r2, ip
 | 
			
		||||
        movs        r0, ip, lsl #31
 | 
			
		||||
        it          mi
 | 
			
		||||
        strbmi      r1, [r3], #1
 | 
			
		||||
        itt         cs
 | 
			
		||||
        strbcs      r1, [r3], #1
 | 
			
		||||
        strbcs      r1, [r3], #1
 | 
			
		||||
 | 
			
		||||
        // Dst is at least word aligned by this point.
 | 
			
		||||
        cmp         ip, #4
 | 
			
		||||
        blo         double_word_aligned
 | 
			
		||||
        str         r1, [r3], #4
 | 
			
		||||
        b           double_word_aligned
 | 
			
		||||
 | 
			
		||||
set_less_than_16_unknown_align:
 | 
			
		||||
        // Set up to 15 bytes.
 | 
			
		||||
        vdup.8      d0, r1
 | 
			
		||||
        movs        ip, r2, lsl #29
 | 
			
		||||
        bcc         1f
 | 
			
		||||
        vst1.8      {d0}, [r0]!
 | 
			
		||||
1:      bge         2f
 | 
			
		||||
        vst1.32     {d0[0]}, [r0]!
 | 
			
		||||
2:      movs        ip, r2, lsl #31
 | 
			
		||||
        strmib      r1, [r0], #1
 | 
			
		||||
        strcsb      r1, [r0], #1
 | 
			
		||||
        strcsb      r1, [r0], #1
 | 
			
		||||
        it          mi
 | 
			
		||||
        strbmi      r1, [r0], #1
 | 
			
		||||
        itt         cs
 | 
			
		||||
        strbcs      r1, [r0], #1
 | 
			
		||||
        strbcs      r1, [r0], #1
 | 
			
		||||
        ldmfd       sp!, {r0}
 | 
			
		||||
        bx          lr
 | 
			
		||||
END(memset)
 | 
			
		||||
 
 | 
			
		||||
@@ -1 +0,0 @@
 | 
			
		||||
include bionic/libc/arch-arm/cortex-a15/cortex-a15.mk
 | 
			
		||||
@@ -45,7 +45,7 @@
 | 
			
		||||
extern "C" void *__memcpy_chk(void *dest, const void *src,
 | 
			
		||||
              size_t copy_amount, size_t dest_len)
 | 
			
		||||
{
 | 
			
		||||
    if (__builtin_expect(copy_amount > dest_len, 0)) {
 | 
			
		||||
    if (__predict_false(copy_amount > dest_len)) {
 | 
			
		||||
        __fortify_chk_fail("memcpy buffer overflow",
 | 
			
		||||
                             BIONIC_EVENT_MEMCPY_BUFFER_OVERFLOW);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,7 @@
 | 
			
		||||
extern "C" void *__memmove_chk (void *dest, const void *src,
 | 
			
		||||
              size_t len, size_t dest_len)
 | 
			
		||||
{
 | 
			
		||||
    if (len > dest_len) {
 | 
			
		||||
    if (__predict_false(len > dest_len)) {
 | 
			
		||||
        __fortify_chk_fail("memmove buffer overflow",
 | 
			
		||||
                             BIONIC_EVENT_MEMMOVE_BUFFER_OVERFLOW);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -42,7 +42,7 @@
 | 
			
		||||
 * greater than 0.
 | 
			
		||||
 */
 | 
			
		||||
extern "C" void *__memset_chk (void *dest, int c, size_t n, size_t dest_len) {
 | 
			
		||||
    if (n > dest_len) {
 | 
			
		||||
    if (__predict_false(n > dest_len)) {
 | 
			
		||||
        __fortify_chk_fail("memset buffer overflow",
 | 
			
		||||
                             BIONIC_EVENT_MEMSET_BUFFER_OVERFLOW);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,7 @@
 | 
			
		||||
extern "C" char *__strcpy_chk (char *dest, const char *src, size_t dest_len) {
 | 
			
		||||
    // TODO: optimize so we don't scan src twice.
 | 
			
		||||
    size_t src_len = strlen(src) + 1;
 | 
			
		||||
    if (src_len > dest_len) {
 | 
			
		||||
    if (__predict_false(src_len > dest_len)) {
 | 
			
		||||
        __fortify_chk_fail("strcpy buffer overflow",
 | 
			
		||||
                             BIONIC_EVENT_STRCPY_BUFFER_OVERFLOW);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,7 @@
 | 
			
		||||
extern "C" size_t __strlcat_chk(char *dest, const char *src,
 | 
			
		||||
              size_t supplied_size, size_t dest_len_from_compiler)
 | 
			
		||||
{
 | 
			
		||||
    if (supplied_size > dest_len_from_compiler) {
 | 
			
		||||
    if (__predict_false(supplied_size > dest_len_from_compiler)) {
 | 
			
		||||
        __fortify_chk_fail("strlcat buffer overflow", 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,7 @@
 | 
			
		||||
extern "C" size_t __strlcpy_chk(char *dest, const char *src,
 | 
			
		||||
              size_t supplied_size, size_t dest_len_from_compiler)
 | 
			
		||||
{
 | 
			
		||||
    if (supplied_size > dest_len_from_compiler) {
 | 
			
		||||
    if (__predict_false(supplied_size > dest_len_from_compiler)) {
 | 
			
		||||
        __fortify_chk_fail("strlcpy buffer overflow", 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -56,7 +56,7 @@
 | 
			
		||||
extern "C" size_t __strlen_chk(const char *s, size_t s_len) {
 | 
			
		||||
    size_t ret = strlen(s);
 | 
			
		||||
 | 
			
		||||
    if (__builtin_expect(ret >= s_len, 0)) {
 | 
			
		||||
    if (__predict_false(ret >= s_len)) {
 | 
			
		||||
        __fortify_chk_fail("strlen read overflow", 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,7 @@
 | 
			
		||||
extern "C" char *__strncpy_chk (char *dest, const char *src,
 | 
			
		||||
              size_t len, size_t dest_len)
 | 
			
		||||
{
 | 
			
		||||
    if (len > dest_len) {
 | 
			
		||||
    if (__predict_false(len > dest_len)) {
 | 
			
		||||
        __fortify_chk_fail("strncpy buffer overflow",
 | 
			
		||||
                             BIONIC_EVENT_STRNCPY_BUFFER_OVERFLOW);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -42,7 +42,7 @@
 | 
			
		||||
 * greater than 0.
 | 
			
		||||
 */
 | 
			
		||||
extern "C" mode_t __umask_chk(mode_t mode) {
 | 
			
		||||
    if ((mode & 0777) != mode) {
 | 
			
		||||
    if (__predict_false((mode & 0777) != mode)) {
 | 
			
		||||
        __fortify_chk_fail("umask called with invalid mask", 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -50,7 +50,7 @@ extern "C" int __vsnprintf_chk(
 | 
			
		||||
        const char *format,
 | 
			
		||||
        va_list va)
 | 
			
		||||
{
 | 
			
		||||
    if (supplied_size > dest_len_from_compiler) {
 | 
			
		||||
    if (__predict_false(supplied_size > dest_len_from_compiler)) {
 | 
			
		||||
        __fortify_chk_fail("vsnprintf buffer overflow", 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -524,7 +524,7 @@ static pthread_once_t  malloc_fini_once_ctl = PTHREAD_ONCE_INIT;
 | 
			
		||||
 * This routine is called from __libc_init routines implemented
 | 
			
		||||
 * in libc_init_static.c and libc_init_dynamic.c files.
 | 
			
		||||
 */
 | 
			
		||||
extern "C" void malloc_debug_init() {
 | 
			
		||||
extern "C" __LIBC_HIDDEN__ void malloc_debug_init() {
 | 
			
		||||
    /* We need to initialize malloc iff we implement here custom
 | 
			
		||||
     * malloc routines (i.e. USE_DL_PREFIX is defined) for libc.so */
 | 
			
		||||
#if defined(USE_DL_PREFIX) && !defined(LIBC_STATIC)
 | 
			
		||||
@@ -534,7 +534,7 @@ extern "C" void malloc_debug_init() {
 | 
			
		||||
#endif  // USE_DL_PREFIX && !LIBC_STATIC
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern "C" void malloc_debug_fini() {
 | 
			
		||||
extern "C" __LIBC_HIDDEN__ void malloc_debug_fini() {
 | 
			
		||||
    /* We need to finalize malloc iff we implement here custom
 | 
			
		||||
     * malloc routines (i.e. USE_DL_PREFIX is defined) for libc.so */
 | 
			
		||||
#if defined(USE_DL_PREFIX) && !defined(LIBC_STATIC)
 | 
			
		||||
 
 | 
			
		||||
@@ -52,7 +52,7 @@ int open(const char *pathname, int flags, ...)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int __open_2(const char *pathname, int flags) {
 | 
			
		||||
    if (flags & O_CREAT) {
 | 
			
		||||
    if (__predict_false(flags & O_CREAT)) {
 | 
			
		||||
        __fortify_chk_fail("open(O_CREAT) called without specifying a mode", 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -25,17 +25,21 @@
 | 
			
		||||
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define _GNU_SOURCE 1
 | 
			
		||||
#include <sched.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
int  sched_getaffinity(pid_t pid, size_t setsize, cpu_set_t* set)
 | 
			
		||||
{
 | 
			
		||||
    int ret = __sched_getaffinity(pid, setsize, set);
 | 
			
		||||
    if (ret >= 0) {
 | 
			
		||||
        if ((size_t)ret < setsize) {
 | 
			
		||||
            memset((char*)set + ret, '\0', setsize - (size_t)ret);
 | 
			
		||||
        }
 | 
			
		||||
        ret = 0;
 | 
			
		||||
    }
 | 
			
		||||
    return ret;
 | 
			
		||||
extern "C" int __sched_getaffinity(pid_t, size_t, cpu_set_t*);
 | 
			
		||||
 | 
			
		||||
int sched_getaffinity(pid_t pid, size_t set_size, cpu_set_t* set) {
 | 
			
		||||
  int rc = __sched_getaffinity(pid, set_size, set);
 | 
			
		||||
  if (rc == -1) {
 | 
			
		||||
      return -1;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Clear any bytes the kernel didn't touch.
 | 
			
		||||
  // (The kernel returns the number of bytes written on success.)
 | 
			
		||||
  memset(reinterpret_cast<char*>(set) + rc, 0, set_size - rc);
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: index.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990 The Regents of the University of California.
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
@@ -31,21 +30,21 @@
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include "libc_logging.h"
 | 
			
		||||
 | 
			
		||||
char *
 | 
			
		||||
__strchr_chk(const char *p, int ch, size_t s_len)
 | 
			
		||||
{
 | 
			
		||||
	for (;; ++p, s_len--) {
 | 
			
		||||
		if (s_len == 0)
 | 
			
		||||
			__fortify_chk_fail("strchr read beyond buffer", 0);
 | 
			
		||||
		if (*p == (char) ch)
 | 
			
		||||
			return((char *)p);
 | 
			
		||||
		if (!*p)
 | 
			
		||||
			return((char *)NULL);
 | 
			
		||||
	}
 | 
			
		||||
	/* NOTREACHED */
 | 
			
		||||
extern "C" char* __strchr_chk(const char* p, int ch, size_t s_len) {
 | 
			
		||||
  for (;; ++p, s_len--) {
 | 
			
		||||
    if (__predict_false(s_len == 0)) {
 | 
			
		||||
      __fortify_chk_fail("read beyond buffer", 0);
 | 
			
		||||
    }
 | 
			
		||||
    if (*p == static_cast<char>(ch)) {
 | 
			
		||||
      return const_cast<char*>(p);
 | 
			
		||||
    }
 | 
			
		||||
    if (*p == '\0') {
 | 
			
		||||
      return NULL;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  /* NOTREACHED */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
char *
 | 
			
		||||
strchr(const char *p, int ch) {
 | 
			
		||||
    return __strchr_chk(p, ch, __BIONIC_FORTIFY_UNKNOWN_SIZE);
 | 
			
		||||
extern "C" char* strchr(const char* p, int ch) {
 | 
			
		||||
  return __strchr_chk(p, ch, __BIONIC_FORTIFY_UNKNOWN_SIZE);
 | 
			
		||||
}
 | 
			
		||||
@@ -207,13 +207,11 @@ void endprotoent(void);
 | 
			
		||||
void endservent(void);
 | 
			
		||||
void freehostent(struct hostent *);
 | 
			
		||||
struct hostent	*gethostbyaddr(const void *, socklen_t, int);
 | 
			
		||||
struct hostent	*android_gethostbyaddrforiface(const void *, socklen_t, int, const char*);
 | 
			
		||||
int gethostbyaddr_r(const void *, int, int, struct hostent *, char *, size_t, struct hostent **, int *);
 | 
			
		||||
struct hostent	*gethostbyname(const char *);
 | 
			
		||||
int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
 | 
			
		||||
struct hostent	*gethostbyname2(const char *, int);
 | 
			
		||||
int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *);
 | 
			
		||||
struct hostent	*android_gethostbynameforiface(const char *, int, const char *);
 | 
			
		||||
struct hostent	*gethostent(void);
 | 
			
		||||
int gethostent_r(struct hostent *, char *, size_t, struct hostent **, int *);
 | 
			
		||||
struct hostent	*getipnodebyaddr(const void *, size_t, int, int *);
 | 
			
		||||
@@ -241,9 +239,7 @@ void sethostent(int);
 | 
			
		||||
void setnetent(int);
 | 
			
		||||
void setprotoent(int);
 | 
			
		||||
int getaddrinfo(const char *, const char *, const struct addrinfo *, struct addrinfo **);
 | 
			
		||||
int android_getaddrinfoforiface(const char *, const char *, const struct addrinfo *, const char *, struct addrinfo **);
 | 
			
		||||
int getnameinfo(const struct sockaddr *, socklen_t, char *, size_t, char *, size_t, int);
 | 
			
		||||
int android_getnameinfoforiface(const struct sockaddr *, socklen_t, char *, size_t, char *, size_t, int, const char *);
 | 
			
		||||
void freeaddrinfo(struct addrinfo *);
 | 
			
		||||
const char	*gai_strerror(int);
 | 
			
		||||
void setnetgrent(const char *);
 | 
			
		||||
 
 | 
			
		||||
@@ -466,8 +466,7 @@ __attribute__((__format__ (printf, 3, 0)))
 | 
			
		||||
__attribute__((__nonnull__ (3)))
 | 
			
		||||
int vsnprintf(char *dest, size_t size, const char *format, __va_list ap)
 | 
			
		||||
{
 | 
			
		||||
    return __builtin___vsnprintf_chk(dest, size, 0,
 | 
			
		||||
        __builtin_object_size(dest, 0), format, ap);
 | 
			
		||||
    return __builtin___vsnprintf_chk(dest, size, 0, __bos(dest), format, ap);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__BIONIC_FORTIFY_INLINE
 | 
			
		||||
@@ -475,8 +474,7 @@ __attribute__((__format__ (printf, 2, 0)))
 | 
			
		||||
__attribute__((__nonnull__ (2)))
 | 
			
		||||
int vsprintf(char *dest, const char *format, __va_list ap)
 | 
			
		||||
{
 | 
			
		||||
    return __builtin___vsprintf_chk(dest, 0,
 | 
			
		||||
        __builtin_object_size(dest, 0), format, ap);
 | 
			
		||||
    return __builtin___vsprintf_chk(dest, 0, __bos(dest), format, ap);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__BIONIC_FORTIFY_INLINE
 | 
			
		||||
@@ -485,7 +483,7 @@ __attribute__((__nonnull__ (3)))
 | 
			
		||||
int snprintf(char *str, size_t size, const char *format, ...)
 | 
			
		||||
{
 | 
			
		||||
    return __builtin___snprintf_chk(str, size, 0,
 | 
			
		||||
        __builtin_object_size(str, 0), format, __builtin_va_arg_pack());
 | 
			
		||||
        __bos(str), format, __builtin_va_arg_pack());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__BIONIC_FORTIFY_INLINE
 | 
			
		||||
@@ -494,7 +492,7 @@ __attribute__((__nonnull__ (2)))
 | 
			
		||||
int sprintf(char *dest, const char *format, ...)
 | 
			
		||||
{
 | 
			
		||||
    return __builtin___sprintf_chk(dest, 0,
 | 
			
		||||
        __builtin_object_size(dest, 0), format, __builtin_va_arg_pack());
 | 
			
		||||
        __bos(dest), format, __builtin_va_arg_pack());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern char *__fgets_real(char *, int, FILE *)
 | 
			
		||||
@@ -508,7 +506,7 @@ extern char *__fgets_chk(char *, int, FILE *, size_t);
 | 
			
		||||
__BIONIC_FORTIFY_INLINE
 | 
			
		||||
char *fgets(char *dest, int size, FILE *stream)
 | 
			
		||||
{
 | 
			
		||||
    size_t bos = __builtin_object_size(dest, 0);
 | 
			
		||||
    size_t bos = __bos(dest);
 | 
			
		||||
 | 
			
		||||
    // Compiler can prove, at compile time, that the passed in size
 | 
			
		||||
    // is always negative. Force a compiler error.
 | 
			
		||||
 
 | 
			
		||||
@@ -34,11 +34,11 @@
 | 
			
		||||
 | 
			
		||||
__BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
extern void*  memccpy(void *, const void *, int, size_t);
 | 
			
		||||
extern void*  memccpy(void* __restrict, const void* __restrict, int, size_t);
 | 
			
		||||
extern void*  memchr(const void *, int, size_t) __purefunc;
 | 
			
		||||
extern void*  memrchr(const void *, int, size_t) __purefunc;
 | 
			
		||||
extern int    memcmp(const void *, const void *, size_t) __purefunc;
 | 
			
		||||
extern void*  memcpy(void *, const void *, size_t);
 | 
			
		||||
extern void*  memcpy(void* __restrict, const void* __restrict, size_t);
 | 
			
		||||
extern void*  memmove(void *, const void *, size_t);
 | 
			
		||||
extern void*  memset(void *, int, size_t);
 | 
			
		||||
extern void*  memmem(const void *, size_t, const void *, size_t) __purefunc;
 | 
			
		||||
@@ -50,8 +50,8 @@ extern char*  strrchr(const char *, int) __purefunc;
 | 
			
		||||
 | 
			
		||||
extern size_t strlen(const char *) __purefunc;
 | 
			
		||||
extern int    strcmp(const char *, const char *) __purefunc;
 | 
			
		||||
extern char*  strcpy(char *, const char *);
 | 
			
		||||
extern char*  strcat(char *, const char *);
 | 
			
		||||
extern char*  strcpy(char* __restrict, const char* __restrict);
 | 
			
		||||
extern char*  strcat(char* __restrict, const char* __restrict);
 | 
			
		||||
 | 
			
		||||
extern int    strcasecmp(const char *, const char *) __purefunc;
 | 
			
		||||
extern int    strncasecmp(const char *, const char *, size_t) __purefunc;
 | 
			
		||||
@@ -59,30 +59,30 @@ extern char*  strdup(const char *);
 | 
			
		||||
 | 
			
		||||
extern char*  strstr(const char *, const char *) __purefunc;
 | 
			
		||||
extern char*  strcasestr(const char *haystack, const char *needle) __purefunc;
 | 
			
		||||
extern char*  strtok(char *, const char *);
 | 
			
		||||
extern char*  strtok_r(char *, const char *, char**);
 | 
			
		||||
extern char*  strtok(char* __restrict, const char* __restrict);
 | 
			
		||||
extern char*  strtok_r(char* __restrict, const char* __restrict, char** __restrict);
 | 
			
		||||
 | 
			
		||||
extern char*  strerror(int);
 | 
			
		||||
extern int    strerror_r(int errnum, char *buf, size_t n);
 | 
			
		||||
 | 
			
		||||
extern size_t strnlen(const char *, size_t) __purefunc;
 | 
			
		||||
extern char*  strncat(char *, const char *, size_t);
 | 
			
		||||
extern char*  strncat(char* __restrict, const char* __restrict, size_t);
 | 
			
		||||
extern char*  strndup(const char *, size_t);
 | 
			
		||||
extern int    strncmp(const char *, const char *, size_t) __purefunc;
 | 
			
		||||
extern char*  strncpy(char *, const char *, size_t);
 | 
			
		||||
extern char*  strncpy(char* __restrict, const char* __restrict, size_t);
 | 
			
		||||
 | 
			
		||||
extern size_t strlcat(char *, const char *, size_t);
 | 
			
		||||
extern size_t strlcpy(char *, const char *, size_t);
 | 
			
		||||
extern size_t strlcat(char* __restrict, const char* __restrict, size_t);
 | 
			
		||||
extern size_t strlcpy(char* __restrict, const char* __restrict, size_t);
 | 
			
		||||
 | 
			
		||||
extern size_t strcspn(const char *, const char *) __purefunc;
 | 
			
		||||
extern char*  strpbrk(const char *, const char *) __purefunc;
 | 
			
		||||
extern char*  strsep(char **, const char *);
 | 
			
		||||
extern char*  strsep(char** __restrict, const char* __restrict);
 | 
			
		||||
extern size_t strspn(const char *, const char *);
 | 
			
		||||
 | 
			
		||||
extern char*  strsignal(int  sig);
 | 
			
		||||
 | 
			
		||||
extern int    strcoll(const char *, const char *) __purefunc;
 | 
			
		||||
extern size_t strxfrm(char *, const char *, size_t);
 | 
			
		||||
extern size_t strxfrm(char* __restrict, const char* __restrict, size_t);
 | 
			
		||||
 | 
			
		||||
#if defined(__BIONIC_FORTIFY)
 | 
			
		||||
 | 
			
		||||
@@ -92,7 +92,7 @@ extern void __memcpy_src_size_error()
 | 
			
		||||
    __attribute__((__error__("memcpy called with size bigger than source")));
 | 
			
		||||
 | 
			
		||||
__BIONIC_FORTIFY_INLINE
 | 
			
		||||
void *memcpy (void *dest, const void *src, size_t copy_amount) {
 | 
			
		||||
void *memcpy (void* __restrict dest, const void* __restrict src, size_t copy_amount) {
 | 
			
		||||
    char *d = (char *) dest;
 | 
			
		||||
    const char *s = (const char *) src;
 | 
			
		||||
    size_t s_len = __builtin_object_size(s, 0);
 | 
			
		||||
@@ -115,23 +115,30 @@ void *memmove (void *dest, const void *src, size_t len) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__BIONIC_FORTIFY_INLINE
 | 
			
		||||
char *strcpy(char *dest, const char *src) {
 | 
			
		||||
    return __builtin___strcpy_chk(dest, src, __builtin_object_size (dest, 0));
 | 
			
		||||
char *strcpy(char* __restrict dest, const char* __restrict src) {
 | 
			
		||||
    return __builtin___strcpy_chk(dest, src, __bos(dest));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern void __strncpy_error()
 | 
			
		||||
    __attribute__((__error__("strncpy called with size bigger than buffer")));
 | 
			
		||||
 | 
			
		||||
__BIONIC_FORTIFY_INLINE
 | 
			
		||||
char *strncpy(char* __restrict dest, const char* __restrict src, size_t n) {
 | 
			
		||||
    size_t bos = __bos(dest);
 | 
			
		||||
    if (__builtin_constant_p(n) && (n > bos)) {
 | 
			
		||||
        __strncpy_error();
 | 
			
		||||
    }
 | 
			
		||||
    return __builtin___strncpy_chk(dest, src, n, bos);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__BIONIC_FORTIFY_INLINE
 | 
			
		||||
char *strncpy(char *dest, const char *src, size_t n) {
 | 
			
		||||
    return __builtin___strncpy_chk(dest, src, n, __builtin_object_size (dest, 0));
 | 
			
		||||
char *strcat(char* __restrict dest, const char* __restrict src) {
 | 
			
		||||
    return __builtin___strcat_chk(dest, src, __bos(dest));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__BIONIC_FORTIFY_INLINE
 | 
			
		||||
char *strcat(char *dest, const char *src) {
 | 
			
		||||
    return __builtin___strcat_chk(dest, src, __builtin_object_size (dest, 0));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__BIONIC_FORTIFY_INLINE
 | 
			
		||||
char *strncat(char *dest, const char *src, size_t n) {
 | 
			
		||||
    return __builtin___strncat_chk(dest, src, n, __builtin_object_size (dest, 0));
 | 
			
		||||
char *strncat(char* __restrict dest, const char* __restrict src, size_t n) {
 | 
			
		||||
    return __builtin___strncat_chk(dest, src, n, __bos(dest));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__BIONIC_FORTIFY_INLINE
 | 
			
		||||
@@ -139,15 +146,15 @@ void *memset (void *s, int c, size_t n) {
 | 
			
		||||
    return __builtin___memset_chk(s, c, n, __builtin_object_size (s, 0));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern size_t __strlcpy_real(char *, const char *, size_t)
 | 
			
		||||
extern size_t __strlcpy_real(char* __restrict, const char* __restrict, size_t)
 | 
			
		||||
    __asm__(__USER_LABEL_PREFIX__ "strlcpy");
 | 
			
		||||
extern void __strlcpy_error()
 | 
			
		||||
    __attribute__((__error__("strlcpy called with size bigger than buffer")));
 | 
			
		||||
extern size_t __strlcpy_chk(char *, const char *, size_t, size_t);
 | 
			
		||||
 | 
			
		||||
__BIONIC_FORTIFY_INLINE
 | 
			
		||||
size_t strlcpy(char *dest, const char *src, size_t size) {
 | 
			
		||||
    size_t bos = __builtin_object_size(dest, 0);
 | 
			
		||||
size_t strlcpy(char* __restrict dest, const char* __restrict src, size_t size) {
 | 
			
		||||
    size_t bos = __bos(dest);
 | 
			
		||||
 | 
			
		||||
    // Compiler doesn't know destination size. Don't call __strlcpy_chk
 | 
			
		||||
    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
 | 
			
		||||
@@ -169,16 +176,16 @@ size_t strlcpy(char *dest, const char *src, size_t size) {
 | 
			
		||||
    return __strlcpy_chk(dest, src, size, bos);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern size_t __strlcat_real(char *, const char *, size_t)
 | 
			
		||||
extern size_t __strlcat_real(char* __restrict, const char* __restrict, size_t)
 | 
			
		||||
    __asm__(__USER_LABEL_PREFIX__ "strlcat");
 | 
			
		||||
extern void __strlcat_error()
 | 
			
		||||
    __attribute__((__error__("strlcat called with size bigger than buffer")));
 | 
			
		||||
extern size_t __strlcat_chk(char *, const char *, size_t, size_t);
 | 
			
		||||
extern size_t __strlcat_chk(char* __restrict, const char* __restrict, size_t, size_t);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
__BIONIC_FORTIFY_INLINE
 | 
			
		||||
size_t strlcat(char *dest, const char *src, size_t size) {
 | 
			
		||||
    size_t bos = __builtin_object_size(dest, 0);
 | 
			
		||||
size_t strlcat(char* __restrict dest, const char* __restrict src, size_t size) {
 | 
			
		||||
    size_t bos = __bos(dest);
 | 
			
		||||
 | 
			
		||||
    // Compiler doesn't know destination size. Don't call __strlcat_chk
 | 
			
		||||
    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
 | 
			
		||||
@@ -204,7 +211,7 @@ extern size_t __strlen_chk(const char *, size_t);
 | 
			
		||||
 | 
			
		||||
__BIONIC_FORTIFY_INLINE
 | 
			
		||||
size_t strlen(const char *s) {
 | 
			
		||||
    size_t bos = __builtin_object_size(s, 0);
 | 
			
		||||
    size_t bos = __bos(s);
 | 
			
		||||
 | 
			
		||||
    // Compiler doesn't know destination size. Don't call __strlen_chk
 | 
			
		||||
    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
 | 
			
		||||
@@ -223,7 +230,7 @@ extern char* __strchr_chk(const char *, int, size_t);
 | 
			
		||||
 | 
			
		||||
__BIONIC_FORTIFY_INLINE
 | 
			
		||||
char* strchr(const char *s, int c) {
 | 
			
		||||
    size_t bos = __builtin_object_size(s, 0);
 | 
			
		||||
    size_t bos = __bos(s);
 | 
			
		||||
 | 
			
		||||
    // Compiler doesn't know destination size. Don't call __strchr_chk
 | 
			
		||||
    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
 | 
			
		||||
@@ -242,7 +249,7 @@ extern char* __strrchr_chk(const char *, int, size_t);
 | 
			
		||||
 | 
			
		||||
__BIONIC_FORTIFY_INLINE
 | 
			
		||||
char* strrchr(const char *s, int c) {
 | 
			
		||||
    size_t bos = __builtin_object_size(s, 0);
 | 
			
		||||
    size_t bos = __bos(s);
 | 
			
		||||
 | 
			
		||||
    // Compiler doesn't know destination size. Don't call __strrchr_chk
 | 
			
		||||
    if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
 | 
			
		||||
 
 | 
			
		||||
@@ -517,6 +517,12 @@
 | 
			
		||||
 | 
			
		||||
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 && !defined(__clang__)
 | 
			
		||||
#define __BIONIC_FORTIFY 1
 | 
			
		||||
#if _FORTIFY_SOURCE == 2
 | 
			
		||||
#define __bos(s) __builtin_object_size((s), 1)
 | 
			
		||||
#else
 | 
			
		||||
#define __bos(s) __builtin_object_size((s), 0)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define __BIONIC_FORTIFY_INLINE \
 | 
			
		||||
    extern inline \
 | 
			
		||||
    __attribute__ ((always_inline)) \
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										109
									
								
								libc/kernel/common/linux/mfd/msm-adie-codec.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								libc/kernel/common/linux/mfd/msm-adie-codec.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,109 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __LINUX_MFD_MSM_ADIE_CODEC_H
 | 
			
		||||
#define __LINUX_MFD_MSM_ADIE_CODEC_H
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#define ADIE_CODEC_ACTION_ENTRY 0x1
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ADIE_CODEC_ACTION_DELAY_WAIT 0x2
 | 
			
		||||
#define ADIE_CODEC_ACTION_STAGE_REACHED 0x3
 | 
			
		||||
#define ADIE_CODEC_PATH_OFF 0x0050
 | 
			
		||||
#define ADIE_CODEC_DIGITAL_READY 0x0100
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ADIE_CODEC_DIGITAL_ANALOG_READY 0x1000
 | 
			
		||||
#define ADIE_CODEC_ANALOG_OFF 0x0750
 | 
			
		||||
#define ADIE_CODEC_DIGITAL_OFF 0x0600
 | 
			
		||||
#define ADIE_CODEC_FLASH_IMAGE 0x0001
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ADIE_CODEC_RX 0
 | 
			
		||||
#define ADIE_CODEC_TX 1
 | 
			
		||||
#define ADIE_CODEC_LB 3
 | 
			
		||||
#define ADIE_CODEC_MAX 4
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ADIE_CODEC_PACK_ENTRY(reg, mask, val) ((val)|(mask << 8)|(reg << 16))
 | 
			
		||||
#define ADIE_CODEC_UNPACK_ENTRY(packed, reg, mask, val)   do {   ((reg) = ((packed >> 16) & (0xff)));   ((mask) = ((packed >> 8) & (0xff)));   ((val) = ((packed) & (0xff)));   } while (0);
 | 
			
		||||
struct adie_codec_action_unit {
 | 
			
		||||
 u32 type;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 action;
 | 
			
		||||
};
 | 
			
		||||
struct adie_codec_hwsetting_entry{
 | 
			
		||||
 struct adie_codec_action_unit *actions;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 action_sz;
 | 
			
		||||
 u32 freq_plan;
 | 
			
		||||
 u32 osr;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct adie_codec_dev_profile {
 | 
			
		||||
 u32 path_type;
 | 
			
		||||
 u32 setting_sz;
 | 
			
		||||
 struct adie_codec_hwsetting_entry *settings;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct adie_codec_register {
 | 
			
		||||
 u8 reg;
 | 
			
		||||
 u8 mask;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u8 val;
 | 
			
		||||
};
 | 
			
		||||
struct adie_codec_register_image {
 | 
			
		||||
 struct adie_codec_register *regs;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 img_sz;
 | 
			
		||||
};
 | 
			
		||||
struct adie_codec_path;
 | 
			
		||||
struct adie_codec_anc_data {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 size;
 | 
			
		||||
 u32 writes[];
 | 
			
		||||
};
 | 
			
		||||
struct adie_codec_operations {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int codec_id;
 | 
			
		||||
 int (*codec_open) (struct adie_codec_dev_profile *profile,
 | 
			
		||||
 struct adie_codec_path **path_pptr);
 | 
			
		||||
 int (*codec_close) (struct adie_codec_path *path_ptr);
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int (*codec_setpath) (struct adie_codec_path *path_ptr,
 | 
			
		||||
 u32 freq_plan, u32 osr);
 | 
			
		||||
 int (*codec_proceed_stage) (struct adie_codec_path *path_ptr,
 | 
			
		||||
 u32 state);
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 (*codec_freq_supported) (struct adie_codec_dev_profile *profile,
 | 
			
		||||
 u32 requested_freq);
 | 
			
		||||
 int (*codec_enable_sidetone) (struct adie_codec_path *rx_path_ptr,
 | 
			
		||||
 u32 enable);
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int (*codec_enable_anc) (struct adie_codec_path *rx_path_ptr,
 | 
			
		||||
 u32 enable, struct adie_codec_anc_data *calibration_writes);
 | 
			
		||||
 int (*codec_set_device_digital_volume) (
 | 
			
		||||
 struct adie_codec_path *path_ptr,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 num_channels,
 | 
			
		||||
 u32 vol_percentage);
 | 
			
		||||
 int (*codec_set_device_analog_volume) (struct adie_codec_path *path_ptr,
 | 
			
		||||
 u32 num_channels,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 volume);
 | 
			
		||||
 int (*codec_set_master_mode) (struct adie_codec_path *path_ptr,
 | 
			
		||||
 u8 master);
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										60
									
								
								libc/kernel/common/linux/msm_adsp.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								libc/kernel/common/linux/msm_adsp.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,60 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __LINUX_MSM_ADSP_H
 | 
			
		||||
#define __LINUX_MSM_ADSP_H
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#include <linux/ioctl.h>
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ADSP_IOCTL_MAGIC 'q'
 | 
			
		||||
struct adsp_command_t {
 | 
			
		||||
 uint16_t queue;
 | 
			
		||||
 uint32_t len;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint8_t *data;
 | 
			
		||||
};
 | 
			
		||||
struct adsp_event_t {
 | 
			
		||||
 uint16_t type;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t timeout_ms;
 | 
			
		||||
 uint16_t msg_id;
 | 
			
		||||
 uint16_t flags;
 | 
			
		||||
 uint32_t len;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint8_t *data;
 | 
			
		||||
};
 | 
			
		||||
#define ADSP_IOCTL_ENABLE _IOR(ADSP_IOCTL_MAGIC, 1, unsigned)
 | 
			
		||||
#define ADSP_IOCTL_DISABLE _IOR(ADSP_IOCTL_MAGIC, 2, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ADSP_IOCTL_DISABLE_ACK _IOR(ADSP_IOCTL_MAGIC, 3, unsigned)
 | 
			
		||||
#define ADSP_IOCTL_WRITE_COMMAND _IOR(ADSP_IOCTL_MAGIC, 4, struct adsp_command_t *)
 | 
			
		||||
#define ADSP_IOCTL_GET_EVENT _IOWR(ADSP_IOCTL_MAGIC, 5, struct adsp_event_data_t *)
 | 
			
		||||
#define ADSP_IOCTL_SET_CLKRATE _IOR(ADSP_IOCTL_MAGIC, 6, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ADSP_IOCTL_DISABLE_EVENT_RSP _IOR(ADSP_IOCTL_MAGIC, 10, unsigned)
 | 
			
		||||
struct adsp_pmem_info {
 | 
			
		||||
 int fd;
 | 
			
		||||
 void *vaddr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#define ADSP_IOCTL_REGISTER_PMEM _IOW(ADSP_IOCTL_MAGIC, 13, unsigned)
 | 
			
		||||
#define ADSP_IOCTL_UNREGISTER_PMEM _IOW(ADSP_IOCTL_MAGIC, 14, unsigned)
 | 
			
		||||
#define ADSP_IOCTL_ABORT_EVENT_READ _IOW(ADSP_IOCTL_MAGIC, 15, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ADSP_IOCTL_LINK_TASK _IOW(ADSP_IOCTL_MAGIC, 16, unsigned)
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										345
									
								
								libc/kernel/common/linux/msm_audio.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										345
									
								
								libc/kernel/common/linux/msm_audio.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,345 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __LINUX_MSM_AUDIO_H
 | 
			
		||||
#define __LINUX_MSM_AUDIO_H
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#include <linux/ioctl.h>
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_IOCTL_MAGIC 'a'
 | 
			
		||||
#define AUDIO_START _IOW(AUDIO_IOCTL_MAGIC, 0, unsigned)
 | 
			
		||||
#define AUDIO_STOP _IOW(AUDIO_IOCTL_MAGIC, 1, unsigned)
 | 
			
		||||
#define AUDIO_FLUSH _IOW(AUDIO_IOCTL_MAGIC, 2, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_GET_CONFIG _IOR(AUDIO_IOCTL_MAGIC, 3, unsigned)
 | 
			
		||||
#define AUDIO_SET_CONFIG _IOW(AUDIO_IOCTL_MAGIC, 4, unsigned)
 | 
			
		||||
#define AUDIO_GET_STATS _IOR(AUDIO_IOCTL_MAGIC, 5, unsigned)
 | 
			
		||||
#define AUDIO_ENABLE_AUDPP _IOW(AUDIO_IOCTL_MAGIC, 6, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_SET_ADRC _IOW(AUDIO_IOCTL_MAGIC, 7, unsigned)
 | 
			
		||||
#define AUDIO_SET_EQ _IOW(AUDIO_IOCTL_MAGIC, 8, unsigned)
 | 
			
		||||
#define AUDIO_SET_RX_IIR _IOW(AUDIO_IOCTL_MAGIC, 9, unsigned)
 | 
			
		||||
#define AUDIO_SET_VOLUME _IOW(AUDIO_IOCTL_MAGIC, 10, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_PAUSE _IOW(AUDIO_IOCTL_MAGIC, 11, unsigned)
 | 
			
		||||
#define AUDIO_PLAY_DTMF _IOW(AUDIO_IOCTL_MAGIC, 12, unsigned)
 | 
			
		||||
#define AUDIO_GET_EVENT _IOR(AUDIO_IOCTL_MAGIC, 13, unsigned)
 | 
			
		||||
#define AUDIO_ABORT_GET_EVENT _IOW(AUDIO_IOCTL_MAGIC, 14, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_REGISTER_PMEM _IOW(AUDIO_IOCTL_MAGIC, 15, unsigned)
 | 
			
		||||
#define AUDIO_DEREGISTER_PMEM _IOW(AUDIO_IOCTL_MAGIC, 16, unsigned)
 | 
			
		||||
#define AUDIO_ASYNC_WRITE _IOW(AUDIO_IOCTL_MAGIC, 17, unsigned)
 | 
			
		||||
#define AUDIO_ASYNC_READ _IOW(AUDIO_IOCTL_MAGIC, 18, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_SET_INCALL _IOW(AUDIO_IOCTL_MAGIC, 19, struct msm_voicerec_mode)
 | 
			
		||||
#define AUDIO_GET_NUM_SND_DEVICE _IOR(AUDIO_IOCTL_MAGIC, 20, unsigned)
 | 
			
		||||
#define AUDIO_GET_SND_DEVICES _IOWR(AUDIO_IOCTL_MAGIC, 21,   struct msm_snd_device_list)
 | 
			
		||||
#define AUDIO_ENABLE_SND_DEVICE _IOW(AUDIO_IOCTL_MAGIC, 22, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_DISABLE_SND_DEVICE _IOW(AUDIO_IOCTL_MAGIC, 23, unsigned)
 | 
			
		||||
#define AUDIO_ROUTE_STREAM _IOW(AUDIO_IOCTL_MAGIC, 24,   struct msm_audio_route_config)
 | 
			
		||||
#define AUDIO_GET_PCM_CONFIG _IOR(AUDIO_IOCTL_MAGIC, 30, unsigned)
 | 
			
		||||
#define AUDIO_SET_PCM_CONFIG _IOW(AUDIO_IOCTL_MAGIC, 31, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_SWITCH_DEVICE _IOW(AUDIO_IOCTL_MAGIC, 32, unsigned)
 | 
			
		||||
#define AUDIO_SET_MUTE _IOW(AUDIO_IOCTL_MAGIC, 33, unsigned)
 | 
			
		||||
#define AUDIO_UPDATE_ACDB _IOW(AUDIO_IOCTL_MAGIC, 34, unsigned)
 | 
			
		||||
#define AUDIO_START_VOICE _IOW(AUDIO_IOCTL_MAGIC, 35, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_STOP_VOICE _IOW(AUDIO_IOCTL_MAGIC, 36, unsigned)
 | 
			
		||||
#define AUDIO_REINIT_ACDB _IOW(AUDIO_IOCTL_MAGIC, 39, unsigned)
 | 
			
		||||
#define AUDIO_OUTPORT_FLUSH _IOW(AUDIO_IOCTL_MAGIC, 40, unsigned short)
 | 
			
		||||
#define AUDIO_SET_ERR_THRESHOLD_VALUE _IOW(AUDIO_IOCTL_MAGIC, 41,   unsigned short)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_GET_BITSTREAM_ERROR_INFO _IOR(AUDIO_IOCTL_MAGIC, 42,   struct msm_audio_bitstream_error_info)
 | 
			
		||||
#define AUDIO_SET_SRS_TRUMEDIA_PARAM _IOW(AUDIO_IOCTL_MAGIC, 43, unsigned)
 | 
			
		||||
#define AUDIO_SET_STREAM_CONFIG _IOW(AUDIO_IOCTL_MAGIC, 80,   struct msm_audio_stream_config)
 | 
			
		||||
#define AUDIO_GET_STREAM_CONFIG _IOR(AUDIO_IOCTL_MAGIC, 81,   struct msm_audio_stream_config)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_GET_SESSION_ID _IOR(AUDIO_IOCTL_MAGIC, 82, unsigned short)
 | 
			
		||||
#define AUDIO_GET_STREAM_INFO _IOR(AUDIO_IOCTL_MAGIC, 83,   struct msm_audio_bitstream_info)
 | 
			
		||||
#define AUDIO_SET_PAN _IOW(AUDIO_IOCTL_MAGIC, 84, unsigned)
 | 
			
		||||
#define AUDIO_SET_QCONCERT_PLUS _IOW(AUDIO_IOCTL_MAGIC, 85, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_SET_MBADRC _IOW(AUDIO_IOCTL_MAGIC, 86, unsigned)
 | 
			
		||||
#define AUDIO_SET_VOLUME_PATH _IOW(AUDIO_IOCTL_MAGIC, 87,   struct msm_vol_info)
 | 
			
		||||
#define AUDIO_SET_MAX_VOL_ALL _IOW(AUDIO_IOCTL_MAGIC, 88, unsigned)
 | 
			
		||||
#define AUDIO_ENABLE_AUDPRE _IOW(AUDIO_IOCTL_MAGIC, 89, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_SET_AGC _IOW(AUDIO_IOCTL_MAGIC, 90, unsigned)
 | 
			
		||||
#define AUDIO_SET_NS _IOW(AUDIO_IOCTL_MAGIC, 91, unsigned)
 | 
			
		||||
#define AUDIO_SET_TX_IIR _IOW(AUDIO_IOCTL_MAGIC, 92, unsigned)
 | 
			
		||||
#define AUDIO_GET_BUF_CFG _IOW(AUDIO_IOCTL_MAGIC, 93,   struct msm_audio_buf_cfg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_SET_BUF_CFG _IOW(AUDIO_IOCTL_MAGIC, 94,   struct msm_audio_buf_cfg)
 | 
			
		||||
#define AUDIO_SET_ACDB_BLK _IOW(AUDIO_IOCTL_MAGIC, 95,   struct msm_acdb_cmd_device)
 | 
			
		||||
#define AUDIO_GET_ACDB_BLK _IOW(AUDIO_IOCTL_MAGIC, 96,   struct msm_acdb_cmd_device)
 | 
			
		||||
#define AUDIO_REGISTER_ION _IOW(AUDIO_IOCTL_MAGIC, 97, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_DEREGISTER_ION _IOW(AUDIO_IOCTL_MAGIC, 98, unsigned)
 | 
			
		||||
#define AUDIO_MAX_COMMON_IOCTL_NUM 100
 | 
			
		||||
#define HANDSET_MIC 0x01
 | 
			
		||||
#define HANDSET_SPKR 0x02
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define HEADSET_MIC 0x03
 | 
			
		||||
#define HEADSET_SPKR_MONO 0x04
 | 
			
		||||
#define HEADSET_SPKR_STEREO 0x05
 | 
			
		||||
#define SPKR_PHONE_MIC 0x06
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SPKR_PHONE_MONO 0x07
 | 
			
		||||
#define SPKR_PHONE_STEREO 0x08
 | 
			
		||||
#define BT_SCO_MIC 0x09
 | 
			
		||||
#define BT_SCO_SPKR 0x0A
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define BT_A2DP_SPKR 0x0B
 | 
			
		||||
#define TTY_HEADSET_MIC 0x0C
 | 
			
		||||
#define TTY_HEADSET_SPKR 0x0D
 | 
			
		||||
#define DEFAULT_TX 0x0E
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define DEFAULT_RX 0x0F
 | 
			
		||||
#define BT_A2DP_TX 0x10
 | 
			
		||||
#define HEADSET_MONO_PLUS_SPKR_MONO_RX 0x11
 | 
			
		||||
#define HEADSET_MONO_PLUS_SPKR_STEREO_RX 0x12
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define HEADSET_STEREO_PLUS_SPKR_MONO_RX 0x13
 | 
			
		||||
#define HEADSET_STEREO_PLUS_SPKR_STEREO_RX 0x14
 | 
			
		||||
#define I2S_RX 0x20
 | 
			
		||||
#define I2S_TX 0x21
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ADRC_ENABLE 0x0001
 | 
			
		||||
#define EQ_ENABLE 0x0002
 | 
			
		||||
#define IIR_ENABLE 0x0004
 | 
			
		||||
#define QCONCERT_PLUS_ENABLE 0x0008
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MBADRC_ENABLE 0x0010
 | 
			
		||||
#define SRS_ENABLE 0x0020
 | 
			
		||||
#define SRS_DISABLE 0x0040
 | 
			
		||||
#define AGC_ENABLE 0x0001
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define NS_ENABLE 0x0002
 | 
			
		||||
#define TX_IIR_ENABLE 0x0004
 | 
			
		||||
#define FLUENCE_ENABLE 0x0008
 | 
			
		||||
#define VOC_REC_UPLINK 0x00
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VOC_REC_DOWNLINK 0x01
 | 
			
		||||
#define VOC_REC_BOTH 0x02
 | 
			
		||||
struct msm_audio_config {
 | 
			
		||||
 uint32_t buffer_size;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t buffer_count;
 | 
			
		||||
 uint32_t channel_count;
 | 
			
		||||
 uint32_t sample_rate;
 | 
			
		||||
 uint32_t type;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t meta_field;
 | 
			
		||||
 uint32_t bits;
 | 
			
		||||
 uint32_t unused[3];
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_audio_stream_config {
 | 
			
		||||
 uint32_t buffer_size;
 | 
			
		||||
 uint32_t buffer_count;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_audio_buf_cfg{
 | 
			
		||||
 uint32_t meta_info_enable;
 | 
			
		||||
 uint32_t frames_per_buf;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_audio_stats {
 | 
			
		||||
 uint32_t byte_count;
 | 
			
		||||
 uint32_t sample_count;
 | 
			
		||||
 uint32_t unused[2];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct msm_audio_ion_info {
 | 
			
		||||
 int fd;
 | 
			
		||||
 void *vaddr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct msm_audio_pmem_info {
 | 
			
		||||
 int fd;
 | 
			
		||||
 void *vaddr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct msm_audio_aio_buf {
 | 
			
		||||
 void *buf_addr;
 | 
			
		||||
 uint32_t buf_len;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t data_len;
 | 
			
		||||
 void *private_data;
 | 
			
		||||
 unsigned short mfield_sz;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_IOCTL_MAGIC 's'
 | 
			
		||||
#define SND_MUTE_UNMUTED 0
 | 
			
		||||
#define SND_MUTE_MUTED 1
 | 
			
		||||
struct msm_mute_info {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t mute;
 | 
			
		||||
 uint32_t path;
 | 
			
		||||
};
 | 
			
		||||
struct msm_vol_info {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t vol;
 | 
			
		||||
 uint32_t path;
 | 
			
		||||
};
 | 
			
		||||
struct msm_voicerec_mode {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t rec_mode;
 | 
			
		||||
};
 | 
			
		||||
struct msm_snd_device_config {
 | 
			
		||||
 uint32_t device;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t ear_mute;
 | 
			
		||||
 uint32_t mic_mute;
 | 
			
		||||
};
 | 
			
		||||
#define SND_SET_DEVICE _IOW(SND_IOCTL_MAGIC, 2, struct msm_device_config *)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_METHOD_VOICE 0
 | 
			
		||||
struct msm_snd_volume_config {
 | 
			
		||||
 uint32_t device;
 | 
			
		||||
 uint32_t method;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t volume;
 | 
			
		||||
};
 | 
			
		||||
#define SND_SET_VOLUME _IOW(SND_IOCTL_MAGIC, 3, struct msm_snd_volume_config *)
 | 
			
		||||
#define SND_GET_NUM_ENDPOINTS _IOR(SND_IOCTL_MAGIC, 4, unsigned *)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_snd_endpoint {
 | 
			
		||||
 int id;
 | 
			
		||||
 char name[64];
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_GET_ENDPOINT _IOWR(SND_IOCTL_MAGIC, 5, struct msm_snd_endpoint *)
 | 
			
		||||
#define SND_AVC_CTL _IOW(SND_IOCTL_MAGIC, 6, unsigned *)
 | 
			
		||||
#define SND_AGC_CTL _IOW(SND_IOCTL_MAGIC, 7, unsigned *)
 | 
			
		||||
struct msm_audio_pcm_config {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t pcm_feedback;
 | 
			
		||||
 uint32_t buffer_count;
 | 
			
		||||
 uint32_t buffer_size;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_EVENT_SUSPEND 0
 | 
			
		||||
#define AUDIO_EVENT_RESUME 1
 | 
			
		||||
#define AUDIO_EVENT_WRITE_DONE 2
 | 
			
		||||
#define AUDIO_EVENT_READ_DONE 3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_EVENT_STREAM_INFO 4
 | 
			
		||||
#define AUDIO_EVENT_BITSTREAM_ERROR_INFO 5
 | 
			
		||||
#define AUDIO_CODEC_TYPE_MP3 0
 | 
			
		||||
#define AUDIO_CODEC_TYPE_AAC 1
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_audio_bitstream_info {
 | 
			
		||||
 uint32_t codec_type;
 | 
			
		||||
 uint32_t chan_info;
 | 
			
		||||
 uint32_t sample_rate;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t bit_stream_info;
 | 
			
		||||
 uint32_t bit_rate;
 | 
			
		||||
 uint32_t unused[3];
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_audio_bitstream_error_info {
 | 
			
		||||
 uint32_t dec_id;
 | 
			
		||||
 uint32_t err_msg_indicator;
 | 
			
		||||
 uint32_t err_type;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
union msm_audio_event_payload {
 | 
			
		||||
 struct msm_audio_aio_buf aio_buf;
 | 
			
		||||
 struct msm_audio_bitstream_info stream_info;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct msm_audio_bitstream_error_info error_info;
 | 
			
		||||
 int reserved;
 | 
			
		||||
};
 | 
			
		||||
struct msm_audio_event {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int event_type;
 | 
			
		||||
 int timeout_ms;
 | 
			
		||||
 union msm_audio_event_payload event_payload;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_SNDDEV_CAP_RX 0x1
 | 
			
		||||
#define MSM_SNDDEV_CAP_TX 0x2
 | 
			
		||||
#define MSM_SNDDEV_CAP_VOICE 0x4
 | 
			
		||||
struct msm_snd_device_info {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t dev_id;
 | 
			
		||||
 uint32_t dev_cap;
 | 
			
		||||
 char dev_name[64];
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_snd_device_list {
 | 
			
		||||
 uint32_t num_dev;
 | 
			
		||||
 struct msm_snd_device_info *list;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_dtmf_config {
 | 
			
		||||
 uint16_t path;
 | 
			
		||||
 uint16_t dtmf_hi;
 | 
			
		||||
 uint16_t dtmf_low;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint16_t duration;
 | 
			
		||||
 uint16_t tx_gain;
 | 
			
		||||
 uint16_t rx_gain;
 | 
			
		||||
 uint16_t mixing;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#define AUDIO_ROUTE_STREAM_VOICE_RX 0
 | 
			
		||||
#define AUDIO_ROUTE_STREAM_VOICE_TX 1
 | 
			
		||||
#define AUDIO_ROUTE_STREAM_PLAYBACK 2
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_ROUTE_STREAM_REC 3
 | 
			
		||||
struct msm_audio_route_config {
 | 
			
		||||
 uint32_t stream_type;
 | 
			
		||||
 uint32_t stream_id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t dev_id;
 | 
			
		||||
};
 | 
			
		||||
#define AUDIO_MAX_EQ_BANDS 12
 | 
			
		||||
struct msm_audio_eq_band {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint16_t band_idx;
 | 
			
		||||
 uint32_t filter_type;
 | 
			
		||||
 uint32_t center_freq_hz;
 | 
			
		||||
 uint32_t filter_gain;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t q_factor;
 | 
			
		||||
} __attribute__ ((packed));
 | 
			
		||||
struct msm_audio_eq_stream_config {
 | 
			
		||||
 uint32_t enable;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t num_bands;
 | 
			
		||||
 struct msm_audio_eq_band eq_bands[AUDIO_MAX_EQ_BANDS];
 | 
			
		||||
} __attribute__ ((packed));
 | 
			
		||||
struct msm_acdb_cmd_device {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t command_id;
 | 
			
		||||
 uint32_t device_id;
 | 
			
		||||
 uint32_t network_id;
 | 
			
		||||
 uint32_t sample_rate_id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t interface_id;
 | 
			
		||||
 uint32_t algorithm_block_id;
 | 
			
		||||
 uint32_t total_bytes;
 | 
			
		||||
 uint32_t *phys_buf;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										79
									
								
								libc/kernel/common/linux/msm_audio_aac.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										79
									
								
								libc/kernel/common/linux/msm_audio_aac.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,79 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __MSM_AUDIO_AAC_H
 | 
			
		||||
#define __MSM_AUDIO_AAC_H
 | 
			
		||||
#include <linux/msm_audio.h>
 | 
			
		||||
#define AUDIO_SET_AAC_CONFIG _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+0), unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_GET_AAC_CONFIG _IOR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+1), unsigned)
 | 
			
		||||
#define AUDIO_SET_AAC_ENC_CONFIG _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+3), struct msm_audio_aac_enc_config)
 | 
			
		||||
#define AUDIO_GET_AAC_ENC_CONFIG _IOR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+4), struct msm_audio_aac_enc_config)
 | 
			
		||||
#define AUDIO_AAC_FORMAT_ADTS -1
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_AAC_FORMAT_RAW 0x0000
 | 
			
		||||
#define AUDIO_AAC_FORMAT_PSUEDO_RAW 0x0001
 | 
			
		||||
#define AUDIO_AAC_FORMAT_LOAS 0x0002
 | 
			
		||||
#define AUDIO_AAC_FORMAT_ADIF 0x0003
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_AAC_OBJECT_LC 0x0002
 | 
			
		||||
#define AUDIO_AAC_OBJECT_LTP 0x0004
 | 
			
		||||
#define AUDIO_AAC_OBJECT_ERLC 0x0011
 | 
			
		||||
#define AUDIO_AAC_OBJECT_BSAC 0x0016
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_AAC_SEC_DATA_RES_ON 0x0001
 | 
			
		||||
#define AUDIO_AAC_SEC_DATA_RES_OFF 0x0000
 | 
			
		||||
#define AUDIO_AAC_SCA_DATA_RES_ON 0x0001
 | 
			
		||||
#define AUDIO_AAC_SCA_DATA_RES_OFF 0x0000
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_AAC_SPEC_DATA_RES_ON 0x0001
 | 
			
		||||
#define AUDIO_AAC_SPEC_DATA_RES_OFF 0x0000
 | 
			
		||||
#define AUDIO_AAC_SBR_ON_FLAG_ON 0x0001
 | 
			
		||||
#define AUDIO_AAC_SBR_ON_FLAG_OFF 0x0000
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_AAC_SBR_PS_ON_FLAG_ON 0x0001
 | 
			
		||||
#define AUDIO_AAC_SBR_PS_ON_FLAG_OFF 0x0000
 | 
			
		||||
#define AUDIO_AAC_DUAL_MONO_PL_PR 0
 | 
			
		||||
#define AUDIO_AAC_DUAL_MONO_SL_SR 1
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_AAC_DUAL_MONO_SL_PR 2
 | 
			
		||||
#define AUDIO_AAC_DUAL_MONO_PL_SR 3
 | 
			
		||||
struct msm_audio_aac_config {
 | 
			
		||||
 signed short format;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned short audio_object;
 | 
			
		||||
 unsigned short ep_config;
 | 
			
		||||
 unsigned short aac_section_data_resilience_flag;
 | 
			
		||||
 unsigned short aac_scalefactor_data_resilience_flag;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned short aac_spectral_data_resilience_flag;
 | 
			
		||||
 unsigned short sbr_on_flag;
 | 
			
		||||
 unsigned short sbr_ps_on_flag;
 | 
			
		||||
 unsigned short dual_mono_mode;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned short channel_configuration;
 | 
			
		||||
};
 | 
			
		||||
struct msm_audio_aac_enc_config {
 | 
			
		||||
 uint32_t channels;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t sample_rate;
 | 
			
		||||
 uint32_t bit_rate;
 | 
			
		||||
 uint32_t stream_format;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										70
									
								
								libc/kernel/common/linux/msm_audio_acdb.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								libc/kernel/common/linux/msm_audio_acdb.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,70 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __MSM_AUDIO_ACDB_H
 | 
			
		||||
#define __MSM_AUDIO_ACDB_H
 | 
			
		||||
#include <linux/msm_audio.h>
 | 
			
		||||
#define AUDIO_SET_VOCPROC_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+0), unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_SET_VOCPROC_STREAM_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+1), unsigned)
 | 
			
		||||
#define AUDIO_SET_VOCPROC_VOL_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+2), unsigned)
 | 
			
		||||
#define AUDIO_SET_AUDPROC_RX_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+3), unsigned)
 | 
			
		||||
#define AUDIO_SET_AUDPROC_RX_STREAM_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+4), unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_SET_AUDPROC_RX_VOL_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+5), unsigned)
 | 
			
		||||
#define AUDIO_SET_AUDPROC_TX_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+6), unsigned)
 | 
			
		||||
#define AUDIO_SET_AUDPROC_TX_STREAM_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+7), unsigned)
 | 
			
		||||
#define AUDIO_SET_AUDPROC_TX_VOL_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+8), unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_SET_SIDETONE_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+9), unsigned)
 | 
			
		||||
#define AUDIO_SET_ANC_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+10), unsigned)
 | 
			
		||||
#define AUDIO_SET_VOICE_RX_TOPOLOGY _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+11), unsigned)
 | 
			
		||||
#define AUDIO_SET_VOICE_TX_TOPOLOGY _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+12), unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_SET_ADM_RX_TOPOLOGY _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+13), unsigned)
 | 
			
		||||
#define AUDIO_SET_ADM_TX_TOPOLOGY _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+14), unsigned)
 | 
			
		||||
#define AUDIO_SET_ASM_TOPOLOGY _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+15), unsigned)
 | 
			
		||||
#define AUDIO_SET_AFE_TX_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+16), unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_SET_AFE_RX_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+17), unsigned)
 | 
			
		||||
#define AUDIO_MAX_ACDB_IOCTL (AUDIO_MAX_COMMON_IOCTL_NUM+30)
 | 
			
		||||
struct cal_block {
 | 
			
		||||
 uint32_t cal_size;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t cal_offset;
 | 
			
		||||
};
 | 
			
		||||
struct sidetone_cal {
 | 
			
		||||
 uint16_t enable;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint16_t gain;
 | 
			
		||||
};
 | 
			
		||||
#define AUDIO_GET_RTAC_ADM_INFO _IOR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_ACDB_IOCTL+1), unsigned)
 | 
			
		||||
#define AUDIO_GET_RTAC_VOICE_INFO _IOR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_ACDB_IOCTL+2), unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_GET_RTAC_ADM_CAL _IOWR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_ACDB_IOCTL+3), unsigned)
 | 
			
		||||
#define AUDIO_SET_RTAC_ADM_CAL _IOWR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_ACDB_IOCTL+4), unsigned)
 | 
			
		||||
#define AUDIO_GET_RTAC_ASM_CAL _IOWR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_ACDB_IOCTL+5), unsigned)
 | 
			
		||||
#define AUDIO_SET_RTAC_ASM_CAL _IOWR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_ACDB_IOCTL+6), unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_GET_RTAC_CVS_CAL _IOWR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_ACDB_IOCTL+7), unsigned)
 | 
			
		||||
#define AUDIO_SET_RTAC_CVS_CAL _IOWR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_ACDB_IOCTL+8), unsigned)
 | 
			
		||||
#define AUDIO_GET_RTAC_CVP_CAL _IOWR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_ACDB_IOCTL+9), unsigned)
 | 
			
		||||
#define AUDIO_SET_RTAC_CVP_CAL _IOWR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_ACDB_IOCTL+10), unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_MAX_RTAC_IOCTL (AUDIO_MAX_ACDB_IOCTL+20)
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										48
									
								
								libc/kernel/common/linux/msm_audio_wma.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								libc/kernel/common/linux/msm_audio_wma.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __MSM_AUDIO_WMA_H
 | 
			
		||||
#define __MSM_AUDIO_WMA_H
 | 
			
		||||
#define AUDIO_GET_WMA_CONFIG _IOR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+0), unsigned)
 | 
			
		||||
#define AUDIO_SET_WMA_CONFIG _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+1), unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_GET_WMA_CONFIG_V2 _IOR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+2), struct msm_audio_wma_config_v2)
 | 
			
		||||
#define AUDIO_SET_WMA_CONFIG_V2 _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+3), struct msm_audio_wma_config_v2)
 | 
			
		||||
struct msm_audio_wma_config {
 | 
			
		||||
 unsigned short armdatareqthr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned short channelsdecoded;
 | 
			
		||||
 unsigned short wmabytespersec;
 | 
			
		||||
 unsigned short wmasamplingfreq;
 | 
			
		||||
 unsigned short wmaencoderopts;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct msm_audio_wma_config_v2 {
 | 
			
		||||
 unsigned short format_tag;
 | 
			
		||||
 unsigned short numchannels;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t samplingrate;
 | 
			
		||||
 uint32_t avgbytespersecond;
 | 
			
		||||
 unsigned short block_align;
 | 
			
		||||
 unsigned short validbitspersample;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t channelmask;
 | 
			
		||||
 unsigned short encodeopt;
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
							
								
								
									
										40
									
								
								libc/kernel/common/linux/msm_audio_wmapro.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								libc/kernel/common/linux/msm_audio_wmapro.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __MSM_AUDIO_WMAPRO_H
 | 
			
		||||
#define __MSM_AUDIO_WMAPRO_H
 | 
			
		||||
#define AUDIO_GET_WMAPRO_CONFIG _IOR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+0), unsigned)
 | 
			
		||||
#define AUDIO_SET_WMAPRO_CONFIG _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+1), unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_audio_wmapro_config {
 | 
			
		||||
 unsigned short armdatareqthr;
 | 
			
		||||
 uint8_t validbitspersample;
 | 
			
		||||
 uint8_t numchannels;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned short formattag;
 | 
			
		||||
 unsigned short samplingrate;
 | 
			
		||||
 unsigned short avgbytespersecond;
 | 
			
		||||
 unsigned short asfpacketlength;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned short channelmask;
 | 
			
		||||
 unsigned short encodeopt;
 | 
			
		||||
 unsigned short advancedencodeopt;
 | 
			
		||||
 uint32_t advancedencodeopt2;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										38
									
								
								libc/kernel/common/linux/msm_charm.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								libc/kernel/common/linux/msm_charm.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef _ARCH_ARM_MACH_MSM_MDM_IOCTLS_H
 | 
			
		||||
#define _ARXH_ARM_MACH_MSM_MDM_IOCTLS_H
 | 
			
		||||
#define CHARM_CODE 0xCC
 | 
			
		||||
#define WAKE_CHARM _IO(CHARM_CODE, 1)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define RESET_CHARM _IO(CHARM_CODE, 2)
 | 
			
		||||
#define CHECK_FOR_BOOT _IOR(CHARM_CODE, 3, int)
 | 
			
		||||
#define WAIT_FOR_BOOT _IO(CHARM_CODE, 4)
 | 
			
		||||
#define NORMAL_BOOT_DONE _IOW(CHARM_CODE, 5, int)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define RAM_DUMP_DONE _IOW(CHARM_CODE, 6, int)
 | 
			
		||||
#define WAIT_FOR_RESTART _IOR(CHARM_CODE, 7, int)
 | 
			
		||||
#define GET_DLOAD_STATUS _IOR(CHARM_CODE, 8, int)
 | 
			
		||||
enum charm_boot_type {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 CHARM_NORMAL_BOOT = 0,
 | 
			
		||||
 CHARM_RAM_DUMPS,
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
							
								
								
									
										30
									
								
								libc/kernel/common/linux/msm_dsps.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								libc/kernel/common/linux/msm_dsps.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef _DSPS_H_
 | 
			
		||||
#define _DSPS_H_
 | 
			
		||||
#include <linux/ioctl.h>
 | 
			
		||||
#define DSPS_IOCTL_MAGIC 'd'
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define DSPS_IOCTL_ON _IO(DSPS_IOCTL_MAGIC, 1)
 | 
			
		||||
#define DSPS_IOCTL_OFF _IO(DSPS_IOCTL_MAGIC, 2)
 | 
			
		||||
#define DSPS_IOCTL_READ_SLOW_TIMER _IOR(DSPS_IOCTL_MAGIC, 3, unsigned int*)
 | 
			
		||||
#define DSPS_IOCTL_READ_FAST_TIMER _IOR(DSPS_IOCTL_MAGIC, 4, unsigned int*)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define DSPS_IOCTL_RESET _IO(DSPS_IOCTL_MAGIC, 5)
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										48
									
								
								libc/kernel/common/linux/msm_hw3d.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								libc/kernel/common/linux/msm_hw3d.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef _MSM_HW3D_H_
 | 
			
		||||
#define _MSM_HW3D_H_
 | 
			
		||||
#include <linux/fs.h>
 | 
			
		||||
#include <linux/ioctl.h>
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct hw3d_region;
 | 
			
		||||
#define HW3D_IOCTL_MAGIC 'h'
 | 
			
		||||
#define HW3D_WAIT_FOR_REVOKE _IO(HW3D_IOCTL_MAGIC, 0x80)
 | 
			
		||||
#define HW3D_WAIT_FOR_INTERRUPT _IO(HW3D_IOCTL_MAGIC, 0x81)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define HW3D_GET_REGIONS   _IOR(HW3D_IOCTL_MAGIC, 0x82, struct hw3d_region *)
 | 
			
		||||
#define HW3D_REGION_OFFSET(id) ((((uint32_t)(id)) & 0xf) << 28)
 | 
			
		||||
#define HW3D_REGION_ID(addr) (((uint32_t)(addr) >> 28) & 0xf)
 | 
			
		||||
#define HW3D_OFFSET_IN_REGION(addr) ((uint32_t)(addr) & ~(0xfUL << 28))
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum {
 | 
			
		||||
 HW3D_EBI = 0,
 | 
			
		||||
 HW3D_SMI = 1,
 | 
			
		||||
 HW3D_REGS = 2,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 HW3D_NUM_REGIONS = HW3D_REGS + 1,
 | 
			
		||||
};
 | 
			
		||||
struct hw3d_region {
 | 
			
		||||
 unsigned long phys;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long map_offset;
 | 
			
		||||
 unsigned long len;
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
							
								
								
									
										105
									
								
								libc/kernel/common/linux/msm_ion.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										105
									
								
								libc/kernel/common/linux/msm_ion.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,105 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __LINUX_MSM_ION_H__
 | 
			
		||||
#define __LINUX_MSM_ION_H__
 | 
			
		||||
#include <linux/ion.h>
 | 
			
		||||
enum msm_ion_heap_types {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 ION_HEAP_TYPE_IOMMU = ION_HEAP_TYPE_CUSTOM + 1,
 | 
			
		||||
 ION_HEAP_TYPE_CP = ION_HEAP_TYPE_CUSTOM + 2,
 | 
			
		||||
};
 | 
			
		||||
enum ion_heap_ids {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 INVALID_HEAP_ID = -1,
 | 
			
		||||
 ION_CP_MM_HEAP_ID = 8,
 | 
			
		||||
 ION_CP_MFC_HEAP_ID = 12,
 | 
			
		||||
 ION_CP_WB_HEAP_ID = 16,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 ION_CAMERA_HEAP_ID = 20,
 | 
			
		||||
 ION_SF_HEAP_ID = 24,
 | 
			
		||||
 ION_IOMMU_HEAP_ID = 25,
 | 
			
		||||
 ION_QSECOM_HEAP_ID = 27,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 ION_AUDIO_HEAP_ID = 28,
 | 
			
		||||
 ION_MM_FIRMWARE_HEAP_ID = 29,
 | 
			
		||||
 ION_SYSTEM_HEAP_ID = 30,
 | 
			
		||||
 ION_HEAP_ID_RESERVED = 31
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
enum ion_fixed_position {
 | 
			
		||||
 NOT_FIXED,
 | 
			
		||||
 FIXED_LOW,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 FIXED_MIDDLE,
 | 
			
		||||
 FIXED_HIGH,
 | 
			
		||||
};
 | 
			
		||||
enum cp_mem_usage {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VIDEO_BITSTREAM = 0x1,
 | 
			
		||||
 VIDEO_PIXEL = 0x2,
 | 
			
		||||
 VIDEO_NONPIXEL = 0x3,
 | 
			
		||||
 MAX_USAGE = 0x4,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 UNKNOWN = 0x7FFFFFFF,
 | 
			
		||||
};
 | 
			
		||||
#define ION_HEAP_CP_MASK (1 << ION_HEAP_TYPE_CP)
 | 
			
		||||
#define ION_SECURE (1 << ION_HEAP_ID_RESERVED)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ION_HEAP(bit) (1 << (bit))
 | 
			
		||||
#define ION_VMALLOC_HEAP_NAME "vmalloc"
 | 
			
		||||
#define ION_AUDIO_HEAP_NAME "audio"
 | 
			
		||||
#define ION_SF_HEAP_NAME "sf"
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ION_MM_HEAP_NAME "mm"
 | 
			
		||||
#define ION_CAMERA_HEAP_NAME "camera_preview"
 | 
			
		||||
#define ION_IOMMU_HEAP_NAME "iommu"
 | 
			
		||||
#define ION_MFC_HEAP_NAME "mfc"
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ION_WB_HEAP_NAME "wb"
 | 
			
		||||
#define ION_MM_FIRMWARE_HEAP_NAME "mm_fw"
 | 
			
		||||
#define ION_QSECOM_HEAP_NAME "qsecom"
 | 
			
		||||
#define ION_FMEM_HEAP_NAME "fmem"
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define CACHED 1
 | 
			
		||||
#define UNCACHED 0
 | 
			
		||||
#define ION_CACHE_SHIFT 0
 | 
			
		||||
#define ION_SET_CACHE(__cache) ((__cache) << ION_CACHE_SHIFT)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ION_IS_CACHED(__flags) ((__flags) & (1 << ION_CACHE_SHIFT))
 | 
			
		||||
struct ion_flush_data {
 | 
			
		||||
 struct ion_handle *handle;
 | 
			
		||||
 int fd;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 void *vaddr;
 | 
			
		||||
 unsigned int offset;
 | 
			
		||||
 unsigned int length;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct ion_flag_data {
 | 
			
		||||
 struct ion_handle *handle;
 | 
			
		||||
 unsigned long flags;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ION_IOC_CLEAN_CACHES _IOWR(ION_IOC_MAGIC, 20,   struct ion_flush_data)
 | 
			
		||||
#define ION_IOC_INV_CACHES _IOWR(ION_IOC_MAGIC, 21,   struct ion_flush_data)
 | 
			
		||||
#define ION_IOC_CLEAN_INV_CACHES _IOWR(ION_IOC_MAGIC, 22,   struct ion_flush_data)
 | 
			
		||||
#define ION_IOC_GET_FLAGS _IOWR(ION_IOC_MAGIC, 23,   struct ion_flag_data)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										365
									
								
								libc/kernel/common/linux/msm_kgsl.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										365
									
								
								libc/kernel/common/linux/msm_kgsl.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,365 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef _MSM_KGSL_H
 | 
			
		||||
#define _MSM_KGSL_H
 | 
			
		||||
#define KGSL_VERSION_MAJOR 3
 | 
			
		||||
#define KGSL_VERSION_MINOR 12
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define KGSL_CONTEXT_SAVE_GMEM 0x00000001
 | 
			
		||||
#define KGSL_CONTEXT_NO_GMEM_ALLOC 0x00000002
 | 
			
		||||
#define KGSL_CONTEXT_SUBMIT_IB_LIST 0x00000004
 | 
			
		||||
#define KGSL_CONTEXT_CTX_SWITCH 0x00000008
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define KGSL_CONTEXT_PREAMBLE 0x00000010
 | 
			
		||||
#define KGSL_CONTEXT_TRASH_STATE 0x00000020
 | 
			
		||||
#define KGSL_CONTEXT_PER_CONTEXT_TS 0x00000040
 | 
			
		||||
#define KGSL_CONTEXT_INVALID 0xffffffff
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define KGSL_MEMFLAGS_GPUREADONLY 0x01000000
 | 
			
		||||
#define KGSL_FLAGS_NORMALMODE 0x00000000
 | 
			
		||||
#define KGSL_FLAGS_SAFEMODE 0x00000001
 | 
			
		||||
#define KGSL_FLAGS_INITIALIZED0 0x00000002
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define KGSL_FLAGS_INITIALIZED 0x00000004
 | 
			
		||||
#define KGSL_FLAGS_STARTED 0x00000008
 | 
			
		||||
#define KGSL_FLAGS_ACTIVE 0x00000010
 | 
			
		||||
#define KGSL_FLAGS_RESERVED0 0x00000020
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define KGSL_FLAGS_RESERVED1 0x00000040
 | 
			
		||||
#define KGSL_FLAGS_RESERVED2 0x00000080
 | 
			
		||||
#define KGSL_FLAGS_SOFT_RESET 0x00000100
 | 
			
		||||
#define KGSL_FLAGS_PER_CONTEXT_TIMESTAMPS 0x00000200
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define KGSL_CLK_SRC 0x00000001
 | 
			
		||||
#define KGSL_CLK_CORE 0x00000002
 | 
			
		||||
#define KGSL_CLK_IFACE 0x00000004
 | 
			
		||||
#define KGSL_CLK_MEM 0x00000008
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define KGSL_CLK_MEM_IFACE 0x00000010
 | 
			
		||||
#define KGSL_CLK_AXI 0x00000020
 | 
			
		||||
enum kgsl_ctx_reset_stat {
 | 
			
		||||
 KGSL_CTX_STAT_NO_ERROR = 0x00000000,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 KGSL_CTX_STAT_GUILTY_CONTEXT_RESET_EXT = 0x00000001,
 | 
			
		||||
 KGSL_CTX_STAT_INNOCENT_CONTEXT_RESET_EXT = 0x00000002,
 | 
			
		||||
 KGSL_CTX_STAT_UNKNOWN_CONTEXT_RESET_EXT = 0x00000003
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define KGSL_CONVERT_TO_MBPS(val)   (val*1000*1000U)
 | 
			
		||||
enum kgsl_deviceid {
 | 
			
		||||
 KGSL_DEVICE_3D0 = 0x00000000,
 | 
			
		||||
 KGSL_DEVICE_2D0 = 0x00000001,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 KGSL_DEVICE_2D1 = 0x00000002,
 | 
			
		||||
 KGSL_DEVICE_MAX = 0x00000003
 | 
			
		||||
};
 | 
			
		||||
enum kgsl_user_mem_type {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 KGSL_USER_MEM_TYPE_PMEM = 0x00000000,
 | 
			
		||||
 KGSL_USER_MEM_TYPE_ASHMEM = 0x00000001,
 | 
			
		||||
 KGSL_USER_MEM_TYPE_ADDR = 0x00000002,
 | 
			
		||||
 KGSL_USER_MEM_TYPE_ION = 0x00000003,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 KGSL_USER_MEM_TYPE_MAX = 0x00000004,
 | 
			
		||||
};
 | 
			
		||||
struct kgsl_devinfo {
 | 
			
		||||
 unsigned int device_id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int chip_id;
 | 
			
		||||
 unsigned int mmu_enabled;
 | 
			
		||||
 unsigned int gmem_gpubaseaddr;
 | 
			
		||||
 unsigned int gpu_id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int gmem_sizebytes;
 | 
			
		||||
};
 | 
			
		||||
struct kgsl_devmemstore {
 | 
			
		||||
 volatile unsigned int soptimestamp;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int sbz;
 | 
			
		||||
 volatile unsigned int eoptimestamp;
 | 
			
		||||
 unsigned int sbz2;
 | 
			
		||||
 volatile unsigned int ts_cmp_enable;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int sbz3;
 | 
			
		||||
 volatile unsigned int ref_wait_ts;
 | 
			
		||||
 unsigned int sbz4;
 | 
			
		||||
 unsigned int current_context;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int sbz5;
 | 
			
		||||
};
 | 
			
		||||
#define KGSL_MEMSTORE_OFFSET(ctxt_id, field)   ((ctxt_id)*sizeof(struct kgsl_devmemstore) +   offsetof(struct kgsl_devmemstore, field))
 | 
			
		||||
enum kgsl_timestamp_type {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 KGSL_TIMESTAMP_CONSUMED = 0x00000001,
 | 
			
		||||
 KGSL_TIMESTAMP_RETIRED = 0x00000002,
 | 
			
		||||
 KGSL_TIMESTAMP_QUEUED = 0x00000003,
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum kgsl_property_type {
 | 
			
		||||
 KGSL_PROP_DEVICE_INFO = 0x00000001,
 | 
			
		||||
 KGSL_PROP_DEVICE_SHADOW = 0x00000002,
 | 
			
		||||
 KGSL_PROP_DEVICE_POWER = 0x00000003,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 KGSL_PROP_SHMEM = 0x00000004,
 | 
			
		||||
 KGSL_PROP_SHMEM_APERTURES = 0x00000005,
 | 
			
		||||
 KGSL_PROP_MMU_ENABLE = 0x00000006,
 | 
			
		||||
 KGSL_PROP_INTERRUPT_WAITS = 0x00000007,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 KGSL_PROP_VERSION = 0x00000008,
 | 
			
		||||
 KGSL_PROP_GPU_RESET_STAT = 0x00000009,
 | 
			
		||||
 KGSL_PROP_PWRCTRL = 0x0000000E,
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct kgsl_shadowprop {
 | 
			
		||||
 unsigned int gpuaddr;
 | 
			
		||||
 unsigned int size;
 | 
			
		||||
 unsigned int flags;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct kgsl_version {
 | 
			
		||||
 unsigned int drv_major;
 | 
			
		||||
 unsigned int drv_minor;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int dev_major;
 | 
			
		||||
 unsigned int dev_minor;
 | 
			
		||||
};
 | 
			
		||||
struct kgsl_ibdesc {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int gpuaddr;
 | 
			
		||||
 void *hostptr;
 | 
			
		||||
 unsigned int sizedwords;
 | 
			
		||||
 unsigned int ctrl;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#define KGSL_IOC_TYPE 0x09
 | 
			
		||||
struct kgsl_device_getproperty {
 | 
			
		||||
 unsigned int type;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 void *value;
 | 
			
		||||
 unsigned int sizebytes;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_DEVICE_GETPROPERTY   _IOWR(KGSL_IOC_TYPE, 0x2, struct kgsl_device_getproperty)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct kgsl_device_waittimestamp {
 | 
			
		||||
 unsigned int timestamp;
 | 
			
		||||
 unsigned int timeout;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define IOCTL_KGSL_DEVICE_WAITTIMESTAMP   _IOW(KGSL_IOC_TYPE, 0x6, struct kgsl_device_waittimestamp)
 | 
			
		||||
struct kgsl_device_waittimestamp_ctxtid {
 | 
			
		||||
 unsigned int context_id;
 | 
			
		||||
 unsigned int timestamp;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int timeout;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID   _IOW(KGSL_IOC_TYPE, 0x7, struct kgsl_device_waittimestamp_ctxtid)
 | 
			
		||||
struct kgsl_ringbuffer_issueibcmds {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int drawctxt_id;
 | 
			
		||||
 unsigned int ibdesc_addr;
 | 
			
		||||
 unsigned int numibs;
 | 
			
		||||
 unsigned int timestamp;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int flags;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_RINGBUFFER_ISSUEIBCMDS   _IOWR(KGSL_IOC_TYPE, 0x10, struct kgsl_ringbuffer_issueibcmds)
 | 
			
		||||
struct kgsl_cmdstream_readtimestamp {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int type;
 | 
			
		||||
 unsigned int timestamp;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_CMDSTREAM_READTIMESTAMP_OLD   _IOR(KGSL_IOC_TYPE, 0x11, struct kgsl_cmdstream_readtimestamp)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define IOCTL_KGSL_CMDSTREAM_READTIMESTAMP   _IOWR(KGSL_IOC_TYPE, 0x11, struct kgsl_cmdstream_readtimestamp)
 | 
			
		||||
struct kgsl_cmdstream_freememontimestamp {
 | 
			
		||||
 unsigned int gpuaddr;
 | 
			
		||||
 unsigned int type;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int timestamp;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP   _IOW(KGSL_IOC_TYPE, 0x12, struct kgsl_cmdstream_freememontimestamp)
 | 
			
		||||
#define IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP_OLD   _IOR(KGSL_IOC_TYPE, 0x12, struct kgsl_cmdstream_freememontimestamp)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct kgsl_drawctxt_create {
 | 
			
		||||
 unsigned int flags;
 | 
			
		||||
 unsigned int drawctxt_id;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define IOCTL_KGSL_DRAWCTXT_CREATE   _IOWR(KGSL_IOC_TYPE, 0x13, struct kgsl_drawctxt_create)
 | 
			
		||||
struct kgsl_drawctxt_destroy {
 | 
			
		||||
 unsigned int drawctxt_id;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define IOCTL_KGSL_DRAWCTXT_DESTROY   _IOW(KGSL_IOC_TYPE, 0x14, struct kgsl_drawctxt_destroy)
 | 
			
		||||
struct kgsl_map_user_mem {
 | 
			
		||||
 int fd;
 | 
			
		||||
 unsigned int gpuaddr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int len;
 | 
			
		||||
 unsigned int offset;
 | 
			
		||||
 unsigned int hostptr;
 | 
			
		||||
 enum kgsl_user_mem_type memtype;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int reserved;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_MAP_USER_MEM   _IOWR(KGSL_IOC_TYPE, 0x15, struct kgsl_map_user_mem)
 | 
			
		||||
struct kgsl_cmdstream_readtimestamp_ctxtid {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int context_id;
 | 
			
		||||
 unsigned int type;
 | 
			
		||||
 unsigned int timestamp;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define IOCTL_KGSL_CMDSTREAM_READTIMESTAMP_CTXTID   _IOWR(KGSL_IOC_TYPE, 0x16, struct kgsl_cmdstream_readtimestamp_ctxtid)
 | 
			
		||||
struct kgsl_cmdstream_freememontimestamp_ctxtid {
 | 
			
		||||
 unsigned int context_id;
 | 
			
		||||
 unsigned int gpuaddr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int type;
 | 
			
		||||
 unsigned int timestamp;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP_CTXTID   _IOW(KGSL_IOC_TYPE, 0x17,   struct kgsl_cmdstream_freememontimestamp_ctxtid)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct kgsl_sharedmem_from_pmem {
 | 
			
		||||
 int pmem_fd;
 | 
			
		||||
 unsigned int gpuaddr;
 | 
			
		||||
 unsigned int len;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int offset;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_SHAREDMEM_FROM_PMEM   _IOWR(KGSL_IOC_TYPE, 0x20, struct kgsl_sharedmem_from_pmem)
 | 
			
		||||
struct kgsl_sharedmem_free {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int gpuaddr;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_SHAREDMEM_FREE   _IOW(KGSL_IOC_TYPE, 0x21, struct kgsl_sharedmem_free)
 | 
			
		||||
struct kgsl_cff_user_event {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned char cff_opcode;
 | 
			
		||||
 unsigned int op1;
 | 
			
		||||
 unsigned int op2;
 | 
			
		||||
 unsigned int op3;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int op4;
 | 
			
		||||
 unsigned int op5;
 | 
			
		||||
 unsigned int __pad[2];
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define IOCTL_KGSL_CFF_USER_EVENT   _IOW(KGSL_IOC_TYPE, 0x31, struct kgsl_cff_user_event)
 | 
			
		||||
struct kgsl_gmem_desc {
 | 
			
		||||
 unsigned int x;
 | 
			
		||||
 unsigned int y;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int width;
 | 
			
		||||
 unsigned int height;
 | 
			
		||||
 unsigned int pitch;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct kgsl_buffer_desc {
 | 
			
		||||
 void *hostptr;
 | 
			
		||||
 unsigned int gpuaddr;
 | 
			
		||||
 int size;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int format;
 | 
			
		||||
 unsigned int pitch;
 | 
			
		||||
 unsigned int enabled;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct kgsl_bind_gmem_shadow {
 | 
			
		||||
 unsigned int drawctxt_id;
 | 
			
		||||
 struct kgsl_gmem_desc gmem_desc;
 | 
			
		||||
 unsigned int shadow_x;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int shadow_y;
 | 
			
		||||
 struct kgsl_buffer_desc shadow_buffer;
 | 
			
		||||
 unsigned int buffer_id;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define IOCTL_KGSL_DRAWCTXT_BIND_GMEM_SHADOW   _IOW(KGSL_IOC_TYPE, 0x22, struct kgsl_bind_gmem_shadow)
 | 
			
		||||
struct kgsl_sharedmem_from_vmalloc {
 | 
			
		||||
 unsigned int gpuaddr;
 | 
			
		||||
 unsigned int hostptr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int flags;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_SHAREDMEM_FROM_VMALLOC   _IOWR(KGSL_IOC_TYPE, 0x23, struct kgsl_sharedmem_from_vmalloc)
 | 
			
		||||
#define IOCTL_KGSL_SHAREDMEM_FLUSH_CACHE   _IOW(KGSL_IOC_TYPE, 0x24, struct kgsl_sharedmem_free)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct kgsl_drawctxt_set_bin_base_offset {
 | 
			
		||||
 unsigned int drawctxt_id;
 | 
			
		||||
 unsigned int offset;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define IOCTL_KGSL_DRAWCTXT_SET_BIN_BASE_OFFSET   _IOW(KGSL_IOC_TYPE, 0x25, struct kgsl_drawctxt_set_bin_base_offset)
 | 
			
		||||
enum kgsl_cmdwindow_type {
 | 
			
		||||
 KGSL_CMDWINDOW_MIN = 0x00000000,
 | 
			
		||||
 KGSL_CMDWINDOW_2D = 0x00000000,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 KGSL_CMDWINDOW_3D = 0x00000001,
 | 
			
		||||
 KGSL_CMDWINDOW_MMU = 0x00000002,
 | 
			
		||||
 KGSL_CMDWINDOW_ARBITER = 0x000000FF,
 | 
			
		||||
 KGSL_CMDWINDOW_MAX = 0x000000FF,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct kgsl_cmdwindow_write {
 | 
			
		||||
 enum kgsl_cmdwindow_type target;
 | 
			
		||||
 unsigned int addr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int data;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_CMDWINDOW_WRITE   _IOW(KGSL_IOC_TYPE, 0x2e, struct kgsl_cmdwindow_write)
 | 
			
		||||
struct kgsl_gpumem_alloc {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long gpuaddr;
 | 
			
		||||
 size_t size;
 | 
			
		||||
 unsigned int flags;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define IOCTL_KGSL_GPUMEM_ALLOC   _IOWR(KGSL_IOC_TYPE, 0x2f, struct kgsl_gpumem_alloc)
 | 
			
		||||
struct kgsl_cff_syncmem {
 | 
			
		||||
 unsigned int gpuaddr;
 | 
			
		||||
 unsigned int len;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int __pad[2];
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_CFF_SYNCMEM   _IOW(KGSL_IOC_TYPE, 0x30, struct kgsl_cff_syncmem)
 | 
			
		||||
struct kgsl_timestamp_event {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int type;
 | 
			
		||||
 unsigned int timestamp;
 | 
			
		||||
 unsigned int context_id;
 | 
			
		||||
 void *priv;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 size_t len;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_TIMESTAMP_EVENT_OLD   _IOW(KGSL_IOC_TYPE, 0x31, struct kgsl_timestamp_event)
 | 
			
		||||
#define KGSL_TIMESTAMP_EVENT_GENLOCK 1
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct kgsl_timestamp_event_genlock {
 | 
			
		||||
 int handle;
 | 
			
		||||
};
 | 
			
		||||
#define KGSL_TIMESTAMP_EVENT_FENCE 2
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct kgsl_timestamp_event_fence {
 | 
			
		||||
 int fence_fd;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_SETPROPERTY   _IOW(KGSL_IOC_TYPE, 0x32, struct kgsl_device_getproperty)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define IOCTL_KGSL_TIMESTAMP_EVENT   _IOWR(KGSL_IOC_TYPE, 0x33, struct kgsl_timestamp_event)
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										530
									
								
								libc/kernel/common/linux/msm_mdp.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										530
									
								
								libc/kernel/common/linux/msm_mdp.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,530 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef _MSM_MDP_H_
 | 
			
		||||
#define _MSM_MDP_H_
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#include <linux/fb.h>
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSMFB_IOCTL_MAGIC 'm'
 | 
			
		||||
#define MSMFB_GRP_DISP _IOW(MSMFB_IOCTL_MAGIC, 1, unsigned int)
 | 
			
		||||
#define MSMFB_BLIT _IOW(MSMFB_IOCTL_MAGIC, 2, unsigned int)
 | 
			
		||||
#define MSMFB_SUSPEND_SW_REFRESHER _IOW(MSMFB_IOCTL_MAGIC, 128, unsigned int)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSMFB_RESUME_SW_REFRESHER _IOW(MSMFB_IOCTL_MAGIC, 129, unsigned int)
 | 
			
		||||
#define MSMFB_CURSOR _IOW(MSMFB_IOCTL_MAGIC, 130, struct fb_cursor)
 | 
			
		||||
#define MSMFB_SET_LUT _IOW(MSMFB_IOCTL_MAGIC, 131, struct fb_cmap)
 | 
			
		||||
#define MSMFB_HISTOGRAM _IOWR(MSMFB_IOCTL_MAGIC, 132, struct mdp_histogram_data)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSMFB_GET_CCS_MATRIX _IOWR(MSMFB_IOCTL_MAGIC, 133, struct mdp_ccs)
 | 
			
		||||
#define MSMFB_SET_CCS_MATRIX _IOW(MSMFB_IOCTL_MAGIC, 134, struct mdp_ccs)
 | 
			
		||||
#define MSMFB_OVERLAY_SET _IOWR(MSMFB_IOCTL_MAGIC, 135,   struct mdp_overlay)
 | 
			
		||||
#define MSMFB_OVERLAY_UNSET _IOW(MSMFB_IOCTL_MAGIC, 136, unsigned int)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSMFB_OVERLAY_PLAY _IOW(MSMFB_IOCTL_MAGIC, 137,   struct msmfb_overlay_data)
 | 
			
		||||
#define MSMFB_OVERLAY_QUEUE MSMFB_OVERLAY_PLAY
 | 
			
		||||
#define MSMFB_GET_PAGE_PROTECTION _IOR(MSMFB_IOCTL_MAGIC, 138,   struct mdp_page_protection)
 | 
			
		||||
#define MSMFB_SET_PAGE_PROTECTION _IOW(MSMFB_IOCTL_MAGIC, 139,   struct mdp_page_protection)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSMFB_OVERLAY_GET _IOR(MSMFB_IOCTL_MAGIC, 140,   struct mdp_overlay)
 | 
			
		||||
#define MSMFB_OVERLAY_PLAY_ENABLE _IOW(MSMFB_IOCTL_MAGIC, 141, unsigned int)
 | 
			
		||||
#define MSMFB_OVERLAY_BLT _IOWR(MSMFB_IOCTL_MAGIC, 142,   struct msmfb_overlay_blt)
 | 
			
		||||
#define MSMFB_OVERLAY_BLT_OFFSET _IOW(MSMFB_IOCTL_MAGIC, 143, unsigned int)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSMFB_HISTOGRAM_START _IOR(MSMFB_IOCTL_MAGIC, 144,   struct mdp_histogram_start_req)
 | 
			
		||||
#define MSMFB_HISTOGRAM_STOP _IOR(MSMFB_IOCTL_MAGIC, 145, unsigned int)
 | 
			
		||||
#define MSMFB_NOTIFY_UPDATE _IOW(MSMFB_IOCTL_MAGIC, 146, unsigned int)
 | 
			
		||||
#define MSMFB_OVERLAY_3D _IOWR(MSMFB_IOCTL_MAGIC, 147,   struct msmfb_overlay_3d)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSMFB_MIXER_INFO _IOWR(MSMFB_IOCTL_MAGIC, 148,   struct msmfb_mixer_info_req)
 | 
			
		||||
#define MSMFB_OVERLAY_PLAY_WAIT _IOWR(MSMFB_IOCTL_MAGIC, 149,   struct msmfb_overlay_data)
 | 
			
		||||
#define MSMFB_WRITEBACK_INIT _IO(MSMFB_IOCTL_MAGIC, 150)
 | 
			
		||||
#define MSMFB_WRITEBACK_START _IO(MSMFB_IOCTL_MAGIC, 151)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSMFB_WRITEBACK_STOP _IO(MSMFB_IOCTL_MAGIC, 152)
 | 
			
		||||
#define MSMFB_WRITEBACK_QUEUE_BUFFER _IOW(MSMFB_IOCTL_MAGIC, 153,   struct msmfb_data)
 | 
			
		||||
#define MSMFB_WRITEBACK_DEQUEUE_BUFFER _IOW(MSMFB_IOCTL_MAGIC, 154,   struct msmfb_data)
 | 
			
		||||
#define MSMFB_WRITEBACK_TERMINATE _IO(MSMFB_IOCTL_MAGIC, 155)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSMFB_MDP_PP _IOWR(MSMFB_IOCTL_MAGIC, 156, struct msmfb_mdp_pp)
 | 
			
		||||
#define MSMFB_OVERLAY_VSYNC_CTRL _IOW(MSMFB_IOCTL_MAGIC, 160, unsigned int)
 | 
			
		||||
#define MSMFB_VSYNC_CTRL _IOW(MSMFB_IOCTL_MAGIC, 161, unsigned int)
 | 
			
		||||
#define MSMFB_BUFFER_SYNC _IOW(MSMFB_IOCTL_MAGIC, 162, struct mdp_buf_sync)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSMFB_DISPLAY_COMMIT _IOW(MSMFB_IOCTL_MAGIC, 164,   struct mdp_display_commit)
 | 
			
		||||
#define FB_TYPE_3D_PANEL 0x10101010
 | 
			
		||||
#define MDP_IMGTYPE2_START 0x10000
 | 
			
		||||
#define MSMFB_DRIVER_VERSION 0xF9E8D701
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum {
 | 
			
		||||
 NOTIFY_UPDATE_START,
 | 
			
		||||
 NOTIFY_UPDATE_STOP,
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum {
 | 
			
		||||
 MDP_RGB_565,
 | 
			
		||||
 MDP_XRGB_8888,
 | 
			
		||||
 MDP_Y_CBCR_H2V2,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 MDP_Y_CBCR_H2V2_ADRENO,
 | 
			
		||||
 MDP_ARGB_8888,
 | 
			
		||||
 MDP_RGB_888,
 | 
			
		||||
 MDP_Y_CRCB_H2V2,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 MDP_YCRYCB_H2V1,
 | 
			
		||||
 MDP_Y_CRCB_H2V1,
 | 
			
		||||
 MDP_Y_CBCR_H2V1,
 | 
			
		||||
 MDP_Y_CRCB_H1V2,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 MDP_Y_CBCR_H1V2,
 | 
			
		||||
 MDP_RGBA_8888,
 | 
			
		||||
 MDP_BGRA_8888,
 | 
			
		||||
 MDP_RGBX_8888,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 MDP_Y_CRCB_H2V2_TILE,
 | 
			
		||||
 MDP_Y_CBCR_H2V2_TILE,
 | 
			
		||||
 MDP_Y_CR_CB_H2V2,
 | 
			
		||||
 MDP_Y_CR_CB_GH2V2,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 MDP_Y_CB_CR_H2V2,
 | 
			
		||||
 MDP_Y_CRCB_H1V1,
 | 
			
		||||
 MDP_Y_CBCR_H1V1,
 | 
			
		||||
 MDP_YCRCB_H1V1,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 MDP_YCBCR_H1V1,
 | 
			
		||||
 MDP_BGR_565,
 | 
			
		||||
 MDP_IMGTYPE_LIMIT,
 | 
			
		||||
 MDP_RGB_BORDERFILL,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 MDP_FB_FORMAT = MDP_IMGTYPE2_START,
 | 
			
		||||
 MDP_IMGTYPE_LIMIT2
 | 
			
		||||
};
 | 
			
		||||
enum {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 PMEM_IMG,
 | 
			
		||||
 FB_IMG,
 | 
			
		||||
};
 | 
			
		||||
enum {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 HSIC_HUE = 0,
 | 
			
		||||
 HSIC_SAT,
 | 
			
		||||
 HSIC_INT,
 | 
			
		||||
 HSIC_CON,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 NUM_HSIC_PARAM,
 | 
			
		||||
};
 | 
			
		||||
#define MDSS_MDP_ROT_ONLY 0x80
 | 
			
		||||
#define MDSS_MDP_RIGHT_MIXER 0x100
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_ROT_NOP 0
 | 
			
		||||
#define MDP_FLIP_LR 0x1
 | 
			
		||||
#define MDP_FLIP_UD 0x2
 | 
			
		||||
#define MDP_ROT_90 0x4
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_ROT_180 (MDP_FLIP_UD|MDP_FLIP_LR)
 | 
			
		||||
#define MDP_ROT_270 (MDP_ROT_90|MDP_FLIP_UD|MDP_FLIP_LR)
 | 
			
		||||
#define MDP_DITHER 0x8
 | 
			
		||||
#define MDP_BLUR 0x10
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_BLEND_FG_PREMULT 0x20000
 | 
			
		||||
#define MDP_DEINTERLACE 0x80000000
 | 
			
		||||
#define MDP_SHARPENING 0x40000000
 | 
			
		||||
#define MDP_NO_DMA_BARRIER_START 0x20000000
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_NO_DMA_BARRIER_END 0x10000000
 | 
			
		||||
#define MDP_NO_BLIT 0x08000000
 | 
			
		||||
#define MDP_BLIT_WITH_DMA_BARRIERS 0x000
 | 
			
		||||
#define MDP_BLIT_WITH_NO_DMA_BARRIERS   (MDP_NO_DMA_BARRIER_START | MDP_NO_DMA_BARRIER_END)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_BLIT_SRC_GEM 0x04000000
 | 
			
		||||
#define MDP_BLIT_DST_GEM 0x02000000
 | 
			
		||||
#define MDP_BLIT_NON_CACHED 0x01000000
 | 
			
		||||
#define MDP_OV_PIPE_SHARE 0x00800000
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_DEINTERLACE_ODD 0x00400000
 | 
			
		||||
#define MDP_OV_PLAY_NOWAIT 0x00200000
 | 
			
		||||
#define MDP_SOURCE_ROTATED_90 0x00100000
 | 
			
		||||
#define MDP_OVERLAY_PP_CFG_EN 0x00080000
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_BACKEND_COMPOSITION 0x00040000
 | 
			
		||||
#define MDP_BORDERFILL_SUPPORTED 0x00010000
 | 
			
		||||
#define MDP_SECURE_OVERLAY_SESSION 0x00008000
 | 
			
		||||
#define MDP_MEMORY_ID_TYPE_FB 0x00001000
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_TRANSP_NOP 0xffffffff
 | 
			
		||||
#define MDP_ALPHA_NOP 0xff
 | 
			
		||||
#define MDP_FB_PAGE_PROTECTION_NONCACHED (0)
 | 
			
		||||
#define MDP_FB_PAGE_PROTECTION_WRITECOMBINE (1)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_FB_PAGE_PROTECTION_WRITETHROUGHCACHE (2)
 | 
			
		||||
#define MDP_FB_PAGE_PROTECTION_WRITEBACKCACHE (3)
 | 
			
		||||
#define MDP_FB_PAGE_PROTECTION_WRITEBACKWACACHE (4)
 | 
			
		||||
#define MDP_FB_PAGE_PROTECTION_INVALID (5)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_NUM_FB_PAGE_PROTECTION_VALUES (5)
 | 
			
		||||
struct mdp_rect {
 | 
			
		||||
 uint32_t x;
 | 
			
		||||
 uint32_t y;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t w;
 | 
			
		||||
 uint32_t h;
 | 
			
		||||
};
 | 
			
		||||
struct mdp_img {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t width;
 | 
			
		||||
 uint32_t height;
 | 
			
		||||
 uint32_t format;
 | 
			
		||||
 uint32_t offset;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int memory_id;
 | 
			
		||||
 uint32_t priv;
 | 
			
		||||
};
 | 
			
		||||
#define MDP_CCS_RGB2YUV 0
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_CCS_YUV2RGB 1
 | 
			
		||||
#define MDP_CCS_SIZE 9
 | 
			
		||||
#define MDP_BV_SIZE 3
 | 
			
		||||
struct mdp_ccs {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int direction;
 | 
			
		||||
 uint16_t ccs[MDP_CCS_SIZE];
 | 
			
		||||
 uint16_t bv[MDP_BV_SIZE];
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct mdp_csc {
 | 
			
		||||
 int id;
 | 
			
		||||
 uint32_t csc_mv[9];
 | 
			
		||||
 uint32_t csc_pre_bv[3];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t csc_post_bv[3];
 | 
			
		||||
 uint32_t csc_pre_lv[6];
 | 
			
		||||
 uint32_t csc_post_lv[6];
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_BLIT_REQ_VERSION 2
 | 
			
		||||
struct mdp_blit_req {
 | 
			
		||||
 struct mdp_img src;
 | 
			
		||||
 struct mdp_img dst;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct mdp_rect src_rect;
 | 
			
		||||
 struct mdp_rect dst_rect;
 | 
			
		||||
 uint32_t alpha;
 | 
			
		||||
 uint32_t transp_mask;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t flags;
 | 
			
		||||
 int sharpening_strength;
 | 
			
		||||
};
 | 
			
		||||
struct mdp_blit_req_list {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t count;
 | 
			
		||||
 struct mdp_blit_req req[];
 | 
			
		||||
};
 | 
			
		||||
#define MSMFB_DATA_VERSION 2
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msmfb_data {
 | 
			
		||||
 uint32_t offset;
 | 
			
		||||
 int memory_id;
 | 
			
		||||
 int id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t flags;
 | 
			
		||||
 uint32_t priv;
 | 
			
		||||
 uint32_t iova;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSMFB_NEW_REQUEST -1
 | 
			
		||||
struct msmfb_overlay_data {
 | 
			
		||||
 uint32_t id;
 | 
			
		||||
 struct msmfb_data data;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t version_key;
 | 
			
		||||
 struct msmfb_data plane1_data;
 | 
			
		||||
 struct msmfb_data plane2_data;
 | 
			
		||||
 struct msmfb_data dst_data;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct msmfb_img {
 | 
			
		||||
 uint32_t width;
 | 
			
		||||
 uint32_t height;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t format;
 | 
			
		||||
};
 | 
			
		||||
#define MSMFB_WRITEBACK_DEQUEUE_BLOCKING 0x1
 | 
			
		||||
struct msmfb_writeback_data {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct msmfb_data buf_info;
 | 
			
		||||
 struct msmfb_img img;
 | 
			
		||||
};
 | 
			
		||||
#define MDP_PP_OPS_READ 0x2
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_PP_OPS_WRITE 0x4
 | 
			
		||||
struct mdp_qseed_cfg {
 | 
			
		||||
 uint32_t table_num;
 | 
			
		||||
 uint32_t ops;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t len;
 | 
			
		||||
 uint32_t *data;
 | 
			
		||||
};
 | 
			
		||||
struct mdp_qseed_cfg_data {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t block;
 | 
			
		||||
 struct mdp_qseed_cfg qseed_data;
 | 
			
		||||
};
 | 
			
		||||
#define MDP_OVERLAY_PP_CSC_CFG 0x1
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_OVERLAY_PP_QSEED_CFG 0x2
 | 
			
		||||
#define MDP_CSC_FLAG_ENABLE 0x1
 | 
			
		||||
#define MDP_CSC_FLAG_YUV_IN 0x2
 | 
			
		||||
#define MDP_CSC_FLAG_YUV_OUT 0x4
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct mdp_csc_cfg {
 | 
			
		||||
 uint32_t flags;
 | 
			
		||||
 uint32_t csc_mv[9];
 | 
			
		||||
 uint32_t csc_pre_bv[3];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t csc_post_bv[3];
 | 
			
		||||
 uint32_t csc_pre_lv[6];
 | 
			
		||||
 uint32_t csc_post_lv[6];
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct mdp_csc_cfg_data {
 | 
			
		||||
 uint32_t block;
 | 
			
		||||
 struct mdp_csc_cfg csc_data;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct mdp_overlay_pp_params {
 | 
			
		||||
 uint32_t config_ops;
 | 
			
		||||
 struct mdp_csc_cfg csc_cfg;
 | 
			
		||||
 struct mdp_qseed_cfg qseed_cfg[2];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct mdp_overlay {
 | 
			
		||||
 struct msmfb_img src;
 | 
			
		||||
 struct mdp_rect src_rect;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct mdp_rect dst_rect;
 | 
			
		||||
 uint32_t z_order;
 | 
			
		||||
 uint32_t is_fg;
 | 
			
		||||
 uint32_t alpha;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t transp_mask;
 | 
			
		||||
 uint32_t flags;
 | 
			
		||||
 uint32_t id;
 | 
			
		||||
 uint32_t user_data[8];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct mdp_overlay_pp_params overlay_pp_cfg;
 | 
			
		||||
};
 | 
			
		||||
struct msmfb_overlay_3d {
 | 
			
		||||
 uint32_t is_3d;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t width;
 | 
			
		||||
 uint32_t height;
 | 
			
		||||
};
 | 
			
		||||
struct msmfb_overlay_blt {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t enable;
 | 
			
		||||
 uint32_t offset;
 | 
			
		||||
 uint32_t width;
 | 
			
		||||
 uint32_t height;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t bpp;
 | 
			
		||||
};
 | 
			
		||||
struct mdp_histogram {
 | 
			
		||||
 uint32_t frame_cnt;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t bin_cnt;
 | 
			
		||||
 uint32_t *r;
 | 
			
		||||
 uint32_t *g;
 | 
			
		||||
 uint32_t *b;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
enum {
 | 
			
		||||
 MDP_BLOCK_RESERVED = 0,
 | 
			
		||||
 MDP_BLOCK_OVERLAY_0,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 MDP_BLOCK_OVERLAY_1,
 | 
			
		||||
 MDP_BLOCK_VG_1,
 | 
			
		||||
 MDP_BLOCK_VG_2,
 | 
			
		||||
 MDP_BLOCK_RGB_1,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 MDP_BLOCK_RGB_2,
 | 
			
		||||
 MDP_BLOCK_DMA_P,
 | 
			
		||||
 MDP_BLOCK_DMA_S,
 | 
			
		||||
 MDP_BLOCK_DMA_E,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 MDP_BLOCK_OVERLAY_2,
 | 
			
		||||
 MDP_BLOCK_MAX,
 | 
			
		||||
};
 | 
			
		||||
struct mdp_histogram_start_req {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t block;
 | 
			
		||||
 uint8_t frame_cnt;
 | 
			
		||||
 uint8_t bit_mask;
 | 
			
		||||
 uint8_t num_bins;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct mdp_histogram_data {
 | 
			
		||||
 uint32_t block;
 | 
			
		||||
 uint8_t bin_cnt;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t *c0;
 | 
			
		||||
 uint32_t *c1;
 | 
			
		||||
 uint32_t *c2;
 | 
			
		||||
 uint32_t *extra_info;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct mdp_pcc_coeff {
 | 
			
		||||
 uint32_t c, r, g, b, rr, gg, bb, rg, gb, rb, rgb_0, rgb_1;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct mdp_pcc_cfg_data {
 | 
			
		||||
 uint32_t block;
 | 
			
		||||
 uint32_t ops;
 | 
			
		||||
 struct mdp_pcc_coeff r, g, b;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
enum {
 | 
			
		||||
 mdp_lut_igc,
 | 
			
		||||
 mdp_lut_pgc,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 mdp_lut_hist,
 | 
			
		||||
 mdp_lut_max,
 | 
			
		||||
};
 | 
			
		||||
struct mdp_igc_lut_data {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t block;
 | 
			
		||||
 uint32_t len, ops;
 | 
			
		||||
 uint32_t *c0_c1_data;
 | 
			
		||||
 uint32_t *c2_data;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct mdp_ar_gc_lut_data {
 | 
			
		||||
 uint32_t x_start;
 | 
			
		||||
 uint32_t slope;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t offset;
 | 
			
		||||
};
 | 
			
		||||
struct mdp_pgc_lut_data {
 | 
			
		||||
 uint32_t block;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t flags;
 | 
			
		||||
 uint8_t num_r_stages;
 | 
			
		||||
 uint8_t num_g_stages;
 | 
			
		||||
 uint8_t num_b_stages;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct mdp_ar_gc_lut_data *r_data;
 | 
			
		||||
 struct mdp_ar_gc_lut_data *g_data;
 | 
			
		||||
 struct mdp_ar_gc_lut_data *b_data;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct mdp_hist_lut_data {
 | 
			
		||||
 uint32_t block;
 | 
			
		||||
 uint32_t ops;
 | 
			
		||||
 uint32_t len;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t *data;
 | 
			
		||||
};
 | 
			
		||||
struct mdp_lut_cfg_data {
 | 
			
		||||
 uint32_t lut_type;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 union {
 | 
			
		||||
 struct mdp_igc_lut_data igc_lut_data;
 | 
			
		||||
 struct mdp_pgc_lut_data pgc_lut_data;
 | 
			
		||||
 struct mdp_hist_lut_data hist_lut_data;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 } data;
 | 
			
		||||
};
 | 
			
		||||
struct mdp_bl_scale_data {
 | 
			
		||||
 uint32_t min_lvl;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t scale;
 | 
			
		||||
};
 | 
			
		||||
enum {
 | 
			
		||||
 mdp_op_pcc_cfg,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 mdp_op_csc_cfg,
 | 
			
		||||
 mdp_op_lut_cfg,
 | 
			
		||||
 mdp_op_qseed_cfg,
 | 
			
		||||
 mdp_bl_scale_cfg,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 mdp_op_max,
 | 
			
		||||
};
 | 
			
		||||
struct msmfb_mdp_pp {
 | 
			
		||||
 uint32_t op;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 union {
 | 
			
		||||
 struct mdp_pcc_cfg_data pcc_cfg_data;
 | 
			
		||||
 struct mdp_csc_cfg_data csc_cfg_data;
 | 
			
		||||
 struct mdp_lut_cfg_data lut_cfg_data;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct mdp_qseed_cfg_data qseed_cfg_data;
 | 
			
		||||
 struct mdp_bl_scale_data bl_scale_data;
 | 
			
		||||
 } data;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_MAX_FENCE_FD 10
 | 
			
		||||
#define MDP_BUF_SYNC_FLAG_WAIT 1
 | 
			
		||||
struct mdp_buf_sync {
 | 
			
		||||
 uint32_t flags;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t acq_fen_fd_cnt;
 | 
			
		||||
 int *acq_fen_fd;
 | 
			
		||||
 int *rel_fen_fd;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct mdp_buf_fence {
 | 
			
		||||
 uint32_t flags;
 | 
			
		||||
 uint32_t acq_fen_fd_cnt;
 | 
			
		||||
 int acq_fen_fd[MDP_MAX_FENCE_FD];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int rel_fen_fd[MDP_MAX_FENCE_FD];
 | 
			
		||||
};
 | 
			
		||||
#define MDP_DISPLAY_COMMIT_OVERLAY 0x00000001
 | 
			
		||||
struct mdp_display_commit {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t flags;
 | 
			
		||||
 uint32_t wait_for_finish;
 | 
			
		||||
 struct fb_var_screeninfo var;
 | 
			
		||||
 struct mdp_buf_fence buf_fence;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct mdp_page_protection {
 | 
			
		||||
 uint32_t page_protection;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct mdp_mixer_info {
 | 
			
		||||
 int pndx;
 | 
			
		||||
 int pnum;
 | 
			
		||||
 int ptype;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int mixer_num;
 | 
			
		||||
 int z_order;
 | 
			
		||||
};
 | 
			
		||||
#define MAX_PIPE_PER_MIXER 4
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msmfb_mixer_info_req {
 | 
			
		||||
 int mixer_num;
 | 
			
		||||
 int cnt;
 | 
			
		||||
 struct mdp_mixer_info info[MAX_PIPE_PER_MIXER];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
enum {
 | 
			
		||||
 DISPLAY_SUBSYSTEM_ID,
 | 
			
		||||
 ROTATOR_SUBSYSTEM_ID,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										231
									
								
								libc/kernel/common/linux/msm_q6vdec.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										231
									
								
								libc/kernel/common/linux/msm_q6vdec.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,231 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef _MSM_VDEC_H_
 | 
			
		||||
#define _MSM_VDEC_H_
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#define VDEC_IOCTL_MAGIC 'v'
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_INITIALIZE _IOWR(VDEC_IOCTL_MAGIC, 1, struct vdec_init)
 | 
			
		||||
#define VDEC_IOCTL_SETBUFFERS _IOW(VDEC_IOCTL_MAGIC, 2, struct vdec_buffer)
 | 
			
		||||
#define VDEC_IOCTL_QUEUE _IOWR(VDEC_IOCTL_MAGIC, 3,   struct vdec_input_buf)
 | 
			
		||||
#define VDEC_IOCTL_REUSEFRAMEBUFFER _IOW(VDEC_IOCTL_MAGIC, 4, unsigned int)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_FLUSH _IOW(VDEC_IOCTL_MAGIC, 5, unsigned int)
 | 
			
		||||
#define VDEC_IOCTL_EOS _IO(VDEC_IOCTL_MAGIC, 6)
 | 
			
		||||
#define VDEC_IOCTL_GETMSG _IOR(VDEC_IOCTL_MAGIC, 7, struct vdec_msg)
 | 
			
		||||
#define VDEC_IOCTL_CLOSE _IO(VDEC_IOCTL_MAGIC, 8)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_FREEBUFFERS _IOW(VDEC_IOCTL_MAGIC, 9, struct vdec_buf_info)
 | 
			
		||||
#define VDEC_IOCTL_GETDECATTRIBUTES _IOR(VDEC_IOCTL_MAGIC, 10,   struct vdec_dec_attributes)
 | 
			
		||||
enum {
 | 
			
		||||
 VDEC_FRAME_DECODE_OK,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_FRAME_DECODE_ERR,
 | 
			
		||||
 VDEC_FATAL_ERR,
 | 
			
		||||
 VDEC_FLUSH_FINISH,
 | 
			
		||||
 VDEC_EOS,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_FRAME_FLUSH,
 | 
			
		||||
 VDEC_STREAM_SWITCH,
 | 
			
		||||
 VDEC_SUSPEND_FINISH,
 | 
			
		||||
 VDEC_BUFFER_CONSUMED
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
enum {
 | 
			
		||||
 VDEC_FLUSH_INPUT,
 | 
			
		||||
 VDEC_FLUSH_OUTPUT,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_FLUSH_ALL
 | 
			
		||||
};
 | 
			
		||||
enum {
 | 
			
		||||
 VDEC_BUFFER_TYPE_INPUT,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_BUFFER_TYPE_OUTPUT,
 | 
			
		||||
 VDEC_BUFFER_TYPE_INTERNAL1,
 | 
			
		||||
 VDEC_BUFFER_TYPE_INTERNAL2,
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum {
 | 
			
		||||
 VDEC_QUEUE_SUCCESS,
 | 
			
		||||
 VDEC_QUEUE_FAILED,
 | 
			
		||||
 VDEC_QUEUE_BADSTATE,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct vdec_input_buf_info {
 | 
			
		||||
 u32 offset;
 | 
			
		||||
 u32 data;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 size;
 | 
			
		||||
 int timestamp_lo;
 | 
			
		||||
 int timestamp_hi;
 | 
			
		||||
 int avsync_state;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 flags;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_buf_desc {
 | 
			
		||||
 u32 bufsize;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 num_min_buffers;
 | 
			
		||||
 u32 num_max_buffers;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_buf_req {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 max_input_queue_size;
 | 
			
		||||
 struct vdec_buf_desc input;
 | 
			
		||||
 struct vdec_buf_desc output;
 | 
			
		||||
 struct vdec_buf_desc dec_req1;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct vdec_buf_desc dec_req2;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_region_info {
 | 
			
		||||
 u32 src_id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 offset;
 | 
			
		||||
 u32 size;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_config {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 fourcc;
 | 
			
		||||
 u32 width;
 | 
			
		||||
 u32 height;
 | 
			
		||||
 u32 order;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 notify_enable;
 | 
			
		||||
 u32 vc1_rowbase;
 | 
			
		||||
 u32 h264_startcode_detect;
 | 
			
		||||
 u32 h264_nal_len_size;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 postproc_flag;
 | 
			
		||||
 u32 fruc_enable;
 | 
			
		||||
 u32 reserved;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct vdec_vc1_panscan_regions {
 | 
			
		||||
 int num;
 | 
			
		||||
 int width[4];
 | 
			
		||||
 int height[4];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int xoffset[4];
 | 
			
		||||
 int yoffset[4];
 | 
			
		||||
};
 | 
			
		||||
struct vdec_cropping_window {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 x1;
 | 
			
		||||
 u32 y1;
 | 
			
		||||
 u32 x2;
 | 
			
		||||
 u32 y2;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct vdec_frame_info {
 | 
			
		||||
 u32 status;
 | 
			
		||||
 u32 offset;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 data1;
 | 
			
		||||
 u32 data2;
 | 
			
		||||
 int timestamp_lo;
 | 
			
		||||
 int timestamp_hi;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int cal_timestamp_lo;
 | 
			
		||||
 int cal_timestamp_hi;
 | 
			
		||||
 u32 dec_width;
 | 
			
		||||
 u32 dec_height;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct vdec_cropping_window cwin;
 | 
			
		||||
 u32 picture_type[2];
 | 
			
		||||
 u32 picture_format;
 | 
			
		||||
 u32 vc1_rangeY;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 vc1_rangeUV;
 | 
			
		||||
 u32 picture_resolution;
 | 
			
		||||
 u32 frame_disp_repeat;
 | 
			
		||||
 u32 repeat_first_field;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 top_field_first;
 | 
			
		||||
 u32 interframe_interp;
 | 
			
		||||
 struct vdec_vc1_panscan_regions panscan;
 | 
			
		||||
 u32 concealed_macblk_num;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 flags;
 | 
			
		||||
 u32 performance_stats;
 | 
			
		||||
 u32 data3;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct vdec_buf_info {
 | 
			
		||||
 u32 buf_type;
 | 
			
		||||
 struct vdec_region_info region;
 | 
			
		||||
 u32 num_buf;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 islast;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_buffer {
 | 
			
		||||
 u32 pmem_id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct vdec_buf_info buf;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_sequence {
 | 
			
		||||
 u8 *header;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 len;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_config_sps {
 | 
			
		||||
 struct vdec_config cfg;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct vdec_sequence seq;
 | 
			
		||||
};
 | 
			
		||||
#define VDEC_MSG_REUSEINPUTBUFFER 1
 | 
			
		||||
#define VDEC_MSG_FRAMEDONE 2
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct vdec_msg {
 | 
			
		||||
 u32 id;
 | 
			
		||||
 union {
 | 
			
		||||
 u32 buf_id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct vdec_frame_info vfr_info;
 | 
			
		||||
 };
 | 
			
		||||
};
 | 
			
		||||
struct vdec_init {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct vdec_config_sps sps_cfg;
 | 
			
		||||
 struct vdec_buf_req *buf_req;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_input_buf {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 pmem_id;
 | 
			
		||||
 struct vdec_input_buf_info buffer;
 | 
			
		||||
 struct vdec_queue_status *queue_status;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct vdec_queue_status {
 | 
			
		||||
 u32 status;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_dec_attributes {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 fourcc;
 | 
			
		||||
 u32 profile;
 | 
			
		||||
 u32 level;
 | 
			
		||||
 u32 dec_pic_width;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 dec_pic_height;
 | 
			
		||||
 struct vdec_buf_desc input;
 | 
			
		||||
 struct vdec_buf_desc output;
 | 
			
		||||
 struct vdec_buf_desc dec_req1;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct vdec_buf_desc dec_req2;
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										305
									
								
								libc/kernel/common/linux/msm_q6venc.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										305
									
								
								libc/kernel/common/linux/msm_q6venc.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,305 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef _MSM_VENC_H_
 | 
			
		||||
#define _MSM_VENC_H_
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#define VENC_MAX_RECON_BUFFERS 2
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VENC_FLAG_EOS 0x00000001
 | 
			
		||||
#define VENC_FLAG_END_OF_FRAME 0x00000010
 | 
			
		||||
#define VENC_FLAG_SYNC_FRAME 0x00000020
 | 
			
		||||
#define VENC_FLAG_EXTRA_DATA 0x00000040
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VENC_FLAG_CODEC_CONFIG 0x00000080
 | 
			
		||||
enum venc_flush_type {
 | 
			
		||||
 VENC_FLUSH_INPUT,
 | 
			
		||||
 VENC_FLUSH_OUTPUT,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_FLUSH_ALL
 | 
			
		||||
};
 | 
			
		||||
enum venc_state_type {
 | 
			
		||||
 VENC_STATE_PAUSE = 0x1,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_STATE_START = 0x2,
 | 
			
		||||
 VENC_STATE_STOP = 0x4
 | 
			
		||||
};
 | 
			
		||||
enum venc_event_type_enum {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_EVENT_START_STATUS,
 | 
			
		||||
 VENC_EVENT_STOP_STATUS,
 | 
			
		||||
 VENC_EVENT_SUSPEND_STATUS,
 | 
			
		||||
 VENC_EVENT_RESUME_STATUS,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_EVENT_FLUSH_STATUS,
 | 
			
		||||
 VENC_EVENT_RELEASE_INPUT,
 | 
			
		||||
 VENC_EVENT_DELIVER_OUTPUT,
 | 
			
		||||
 VENC_EVENT_UNKNOWN_STATUS
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
enum venc_status_code {
 | 
			
		||||
 VENC_STATUS_SUCCESS,
 | 
			
		||||
 VENC_STATUS_ERROR,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_STATUS_INVALID_STATE,
 | 
			
		||||
 VENC_STATUS_FLUSHING,
 | 
			
		||||
 VENC_STATUS_INVALID_PARAM,
 | 
			
		||||
 VENC_STATUS_CMD_QUEUE_FULL,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_STATUS_CRITICAL,
 | 
			
		||||
 VENC_STATUS_INSUFFICIENT_RESOURCES,
 | 
			
		||||
 VENC_STATUS_TIMEOUT
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum venc_msg_code {
 | 
			
		||||
 VENC_MSG_INDICATION,
 | 
			
		||||
 VENC_MSG_INPUT_BUFFER_DONE,
 | 
			
		||||
 VENC_MSG_OUTPUT_BUFFER_DONE,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_MSG_NEED_OUTPUT_BUFFER,
 | 
			
		||||
 VENC_MSG_FLUSH,
 | 
			
		||||
 VENC_MSG_START,
 | 
			
		||||
 VENC_MSG_STOP,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_MSG_PAUSE,
 | 
			
		||||
 VENC_MSG_RESUME,
 | 
			
		||||
 VENC_MSG_STOP_READING_MSG
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum venc_error_code {
 | 
			
		||||
 VENC_S_SUCCESS,
 | 
			
		||||
 VENC_S_EFAIL,
 | 
			
		||||
 VENC_S_EFATAL,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_S_EBADPARAM,
 | 
			
		||||
 VENC_S_EINVALSTATE,
 | 
			
		||||
 VENC_S_ENOSWRES,
 | 
			
		||||
 VENC_S_ENOHWRES,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_S_EBUFFREQ,
 | 
			
		||||
 VENC_S_EINVALCMD,
 | 
			
		||||
 VENC_S_ETIMEOUT,
 | 
			
		||||
 VENC_S_ENOREATMPT,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_S_ENOPREREQ,
 | 
			
		||||
 VENC_S_ECMDQFULL,
 | 
			
		||||
 VENC_S_ENOTSUPP,
 | 
			
		||||
 VENC_S_ENOTIMPL,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_S_ENOTPMEM,
 | 
			
		||||
 VENC_S_EFLUSHED,
 | 
			
		||||
 VENC_S_EINSUFBUF,
 | 
			
		||||
 VENC_S_ESAMESTATE,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_S_EINVALTRANS
 | 
			
		||||
};
 | 
			
		||||
enum venc_mem_region_enum {
 | 
			
		||||
 VENC_PMEM_EBI1,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_PMEM_SMI
 | 
			
		||||
};
 | 
			
		||||
struct venc_buf_type {
 | 
			
		||||
 unsigned int region;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int phys;
 | 
			
		||||
 unsigned int size;
 | 
			
		||||
 int offset;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_qp_range {
 | 
			
		||||
 unsigned int min_qp;
 | 
			
		||||
 unsigned int max_qp;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_frame_rate {
 | 
			
		||||
 unsigned int frame_rate_num;
 | 
			
		||||
 unsigned int frame_rate_den;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_slice_info {
 | 
			
		||||
 unsigned int slice_mode;
 | 
			
		||||
 unsigned int units_per_slice;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_extra_data {
 | 
			
		||||
 unsigned int slice_extra_data_flag;
 | 
			
		||||
 unsigned int slice_client_data1;
 | 
			
		||||
 unsigned int slice_client_data2;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int slice_client_data3;
 | 
			
		||||
 unsigned int none_extra_data_flag;
 | 
			
		||||
 unsigned int none_client_data1;
 | 
			
		||||
 unsigned int none_client_data2;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int none_client_data3;
 | 
			
		||||
};
 | 
			
		||||
struct venc_common_config {
 | 
			
		||||
 unsigned int standard;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int input_frame_height;
 | 
			
		||||
 unsigned int input_frame_width;
 | 
			
		||||
 unsigned int output_frame_height;
 | 
			
		||||
 unsigned int output_frame_width;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int rotation_angle;
 | 
			
		||||
 unsigned int intra_period;
 | 
			
		||||
 unsigned int rate_control;
 | 
			
		||||
 struct venc_frame_rate frame_rate;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int bitrate;
 | 
			
		||||
 struct venc_qp_range qp_range;
 | 
			
		||||
 unsigned int iframe_qp;
 | 
			
		||||
 unsigned int pframe_qp;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct venc_slice_info slice_config;
 | 
			
		||||
 struct venc_extra_data extra_data;
 | 
			
		||||
};
 | 
			
		||||
struct venc_nonio_buf_config {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct venc_buf_type recon_buf1;
 | 
			
		||||
 struct venc_buf_type recon_buf2;
 | 
			
		||||
 struct venc_buf_type wb_buf;
 | 
			
		||||
 struct venc_buf_type cmd_buf;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct venc_buf_type vlc_buf;
 | 
			
		||||
};
 | 
			
		||||
struct venc_mpeg4_config {
 | 
			
		||||
 unsigned int profile;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int level;
 | 
			
		||||
 unsigned int time_resolution;
 | 
			
		||||
 unsigned int ac_prediction;
 | 
			
		||||
 unsigned int hec_interval;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int data_partition;
 | 
			
		||||
 unsigned int short_header;
 | 
			
		||||
 unsigned int rvlc_enable;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_h263_config {
 | 
			
		||||
 unsigned int profile;
 | 
			
		||||
 unsigned int level;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_h264_config {
 | 
			
		||||
 unsigned int profile;
 | 
			
		||||
 unsigned int level;
 | 
			
		||||
 unsigned int max_nal;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int idr_period;
 | 
			
		||||
};
 | 
			
		||||
struct venc_pmem {
 | 
			
		||||
 int src;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int fd;
 | 
			
		||||
 unsigned int offset;
 | 
			
		||||
 void *virt;
 | 
			
		||||
 void *phys;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int size;
 | 
			
		||||
};
 | 
			
		||||
struct venc_buffer {
 | 
			
		||||
 unsigned char *ptr_buffer;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int size;
 | 
			
		||||
 unsigned int len;
 | 
			
		||||
 unsigned int offset;
 | 
			
		||||
 long long time_stamp;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int flags;
 | 
			
		||||
 unsigned int client_data;
 | 
			
		||||
};
 | 
			
		||||
struct venc_buffers {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct venc_pmem recon_buf[VENC_MAX_RECON_BUFFERS];
 | 
			
		||||
 struct venc_pmem wb_buf;
 | 
			
		||||
 struct venc_pmem cmd_buf;
 | 
			
		||||
 struct venc_pmem vlc_buf;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct venc_buffer_flush {
 | 
			
		||||
 unsigned int flush_mode;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
union venc_msg_data {
 | 
			
		||||
 struct venc_buffer buf;
 | 
			
		||||
 struct venc_buffer_flush flush_ret;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_msg {
 | 
			
		||||
 unsigned int status_code;
 | 
			
		||||
 unsigned int msg_code;
 | 
			
		||||
 union venc_msg_data msg_data;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int msg_data_size;
 | 
			
		||||
};
 | 
			
		||||
union venc_codec_config {
 | 
			
		||||
 struct venc_mpeg4_config mpeg4_params;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct venc_h263_config h263_params;
 | 
			
		||||
 struct venc_h264_config h264_params;
 | 
			
		||||
};
 | 
			
		||||
struct venc_q6_config {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct venc_common_config config_params;
 | 
			
		||||
 union venc_codec_config codec_params;
 | 
			
		||||
 struct venc_nonio_buf_config buf_params;
 | 
			
		||||
 void *callback_event;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct venc_hdr_config {
 | 
			
		||||
 struct venc_common_config config_params;
 | 
			
		||||
 union venc_codec_config codec_params;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct venc_init_config {
 | 
			
		||||
 struct venc_q6_config q6_config;
 | 
			
		||||
 struct venc_buffers q6_bufs;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct venc_seq_config {
 | 
			
		||||
 int size;
 | 
			
		||||
 struct venc_pmem buf;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct venc_q6_config q6_config;
 | 
			
		||||
};
 | 
			
		||||
#define VENC_IOCTL_MAGIC 'V'
 | 
			
		||||
#define VENC_IOCTL_CMD_READ_NEXT_MSG   _IOWR(VENC_IOCTL_MAGIC, 1, struct venc_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VENC_IOCTL_CMD_STOP_READ_MSG _IO(VENC_IOCTL_MAGIC, 2)
 | 
			
		||||
#define VENC_IOCTL_SET_INPUT_BUFFER   _IOW(VENC_IOCTL_MAGIC, 3, struct venc_pmem)
 | 
			
		||||
#define VENC_IOCTL_SET_OUTPUT_BUFFER   _IOW(VENC_IOCTL_MAGIC, 4, struct venc_pmem)
 | 
			
		||||
#define VENC_IOCTL_CMD_START _IOW(VENC_IOCTL_MAGIC, 5, struct venc_init_config)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VENC_IOCTL_CMD_ENCODE_FRAME   _IOW(VENC_IOCTL_MAGIC, 6, struct venc_buffer)
 | 
			
		||||
#define VENC_IOCTL_CMD_FILL_OUTPUT_BUFFER   _IOW(VENC_IOCTL_MAGIC, 7, struct venc_buffer)
 | 
			
		||||
#define VENC_IOCTL_CMD_FLUSH   _IOW(VENC_IOCTL_MAGIC, 8, struct venc_buffer_flush)
 | 
			
		||||
#define VENC_IOCTL_CMD_PAUSE _IO(VENC_IOCTL_MAGIC, 9)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VENC_IOCTL_CMD_RESUME _IO(VENC_IOCTL_MAGIC, 10)
 | 
			
		||||
#define VENC_IOCTL_CMD_STOP _IO(VENC_IOCTL_MAGIC, 11)
 | 
			
		||||
#define VENC_IOCTL_SET_INTRA_PERIOD   _IOW(VENC_IOCTL_MAGIC, 12, int)
 | 
			
		||||
#define VENC_IOCTL_CMD_REQUEST_IFRAME _IO(VENC_IOCTL_MAGIC, 13)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VENC_IOCTL_GET_SEQUENCE_HDR   _IOWR(VENC_IOCTL_MAGIC, 14, struct venc_seq_config)
 | 
			
		||||
#define VENC_IOCTL_SET_INTRA_REFRESH   _IOW(VENC_IOCTL_MAGIC, 15, int)
 | 
			
		||||
#define VENC_IOCTL_SET_FRAME_RATE   _IOW(VENC_IOCTL_MAGIC, 16, struct venc_frame_rate)
 | 
			
		||||
#define VENC_IOCTL_SET_TARGET_BITRATE   _IOW(VENC_IOCTL_MAGIC, 17, int)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VENC_IOCTL_SET_QP_RANGE   _IOW(VENC_IOCTL_MAGIC, 18, struct venc_qp_range)
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										53
									
								
								libc/kernel/common/linux/msm_rmnet.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								libc/kernel/common/linux/msm_rmnet.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,53 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef _MSM_RMNET_H_
 | 
			
		||||
#define _MSM_RMNET_H_
 | 
			
		||||
#define RMNET_MODE_NONE (0x00)
 | 
			
		||||
#define RMNET_MODE_LLP_ETH (0x01)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define RMNET_MODE_LLP_IP (0x02)
 | 
			
		||||
#define RMNET_MODE_QOS (0x04)
 | 
			
		||||
#define RMNET_MODE_MASK (RMNET_MODE_LLP_ETH |   RMNET_MODE_LLP_IP |   RMNET_MODE_QOS)
 | 
			
		||||
#define RMNET_IS_MODE_QOS(mode)   ((mode & RMNET_MODE_QOS) == RMNET_MODE_QOS)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define RMNET_IS_MODE_IP(mode)   ((mode & RMNET_MODE_LLP_IP) == RMNET_MODE_LLP_IP)
 | 
			
		||||
enum rmnet_ioctl_cmds_e {
 | 
			
		||||
 RMNET_IOCTL_SET_LLP_ETHERNET = 0x000089F1,
 | 
			
		||||
 RMNET_IOCTL_SET_LLP_IP = 0x000089F2,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 RMNET_IOCTL_GET_LLP = 0x000089F3,
 | 
			
		||||
 RMNET_IOCTL_SET_QOS_ENABLE = 0x000089F4,
 | 
			
		||||
 RMNET_IOCTL_SET_QOS_DISABLE = 0x000089F5,
 | 
			
		||||
 RMNET_IOCTL_GET_QOS = 0x000089F6,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 RMNET_IOCTL_GET_OPMODE = 0x000089F7,
 | 
			
		||||
 RMNET_IOCTL_OPEN = 0x000089F8,
 | 
			
		||||
 RMNET_IOCTL_CLOSE = 0x000089F9,
 | 
			
		||||
 RMNET_IOCTL_MAX
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#define QMI_QOS_HDR_S __attribute((__packed__)) qmi_qos_hdr_s
 | 
			
		||||
struct QMI_QOS_HDR_S {
 | 
			
		||||
 unsigned char version;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned char flags;
 | 
			
		||||
 unsigned long flow_id;
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
							
								
								
									
										75
									
								
								libc/kernel/common/linux/msm_rotator.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										75
									
								
								libc/kernel/common/linux/msm_rotator.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,75 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __MSM_ROTATOR_H__
 | 
			
		||||
#define __MSM_ROTATOR_H__
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#include <linux/msm_mdp.h>
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_ROTATOR_IOCTL_MAGIC 'R'
 | 
			
		||||
#define MSM_ROTATOR_IOCTL_START   _IOWR(MSM_ROTATOR_IOCTL_MAGIC, 1, struct msm_rotator_img_info)
 | 
			
		||||
#define MSM_ROTATOR_IOCTL_ROTATE   _IOW(MSM_ROTATOR_IOCTL_MAGIC, 2, struct msm_rotator_data_info)
 | 
			
		||||
#define MSM_ROTATOR_IOCTL_FINISH   _IOW(MSM_ROTATOR_IOCTL_MAGIC, 3, int)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ROTATOR_VERSION_01 0xA5B4C301
 | 
			
		||||
enum rotator_clk_type {
 | 
			
		||||
 ROTATOR_CORE_CLK,
 | 
			
		||||
 ROTATOR_PCLK,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 ROTATOR_IMEM_CLK
 | 
			
		||||
};
 | 
			
		||||
struct msm_rotator_img_info {
 | 
			
		||||
 unsigned int session_id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct msmfb_img src;
 | 
			
		||||
 struct msmfb_img dst;
 | 
			
		||||
 struct mdp_rect src_rect;
 | 
			
		||||
 unsigned int dst_x;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int dst_y;
 | 
			
		||||
 unsigned char rotations;
 | 
			
		||||
 int enable;
 | 
			
		||||
 unsigned int downscale_ratio;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int secure;
 | 
			
		||||
};
 | 
			
		||||
struct msm_rotator_data_info {
 | 
			
		||||
 int session_id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct msmfb_data src;
 | 
			
		||||
 struct msmfb_data dst;
 | 
			
		||||
 unsigned int version_key;
 | 
			
		||||
 struct msmfb_data src_chroma;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct msmfb_data dst_chroma;
 | 
			
		||||
};
 | 
			
		||||
struct msm_rot_clocks {
 | 
			
		||||
 const char *clk_name;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 enum rotator_clk_type clk_type;
 | 
			
		||||
 unsigned int clk_rate;
 | 
			
		||||
};
 | 
			
		||||
struct msm_rotator_platform_data {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int number_of_clocks;
 | 
			
		||||
 unsigned int hardware_version_number;
 | 
			
		||||
 struct msm_rot_clocks *rotator_clks;
 | 
			
		||||
 char rot_iommu_split_domain;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										539
									
								
								libc/kernel/common/linux/msm_vidc_dec.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										539
									
								
								libc/kernel/common/linux/msm_vidc_dec.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,539 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef _MSM_VIDC_DEC_H_
 | 
			
		||||
#define _MSM_VIDC_DEC_H_
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#include <linux/ioctl.h>
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_S_BASE 0x40000000
 | 
			
		||||
#define VDEC_S_SUCCESS (VDEC_S_BASE)
 | 
			
		||||
#define VDEC_S_EFAIL (VDEC_S_BASE + 1)
 | 
			
		||||
#define VDEC_S_EFATAL (VDEC_S_BASE + 2)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_S_EBADPARAM (VDEC_S_BASE + 3)
 | 
			
		||||
#define VDEC_S_EINVALSTATE (VDEC_S_BASE + 4)
 | 
			
		||||
#define VDEC_S_ENOSWRES (VDEC_S_BASE + 5)
 | 
			
		||||
#define VDEC_S_ENOHWRES (VDEC_S_BASE + 6)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_S_EINVALCMD (VDEC_S_BASE + 7)
 | 
			
		||||
#define VDEC_S_ETIMEOUT (VDEC_S_BASE + 8)
 | 
			
		||||
#define VDEC_S_ENOPREREQ (VDEC_S_BASE + 9)
 | 
			
		||||
#define VDEC_S_ECMDQFULL (VDEC_S_BASE + 10)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_S_ENOTSUPP (VDEC_S_BASE + 11)
 | 
			
		||||
#define VDEC_S_ENOTIMPL (VDEC_S_BASE + 12)
 | 
			
		||||
#define VDEC_S_BUSY (VDEC_S_BASE + 13)
 | 
			
		||||
#define VDEC_S_INPUT_BITSTREAM_ERR (VDEC_S_BASE + 14)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_INTF_VER 1
 | 
			
		||||
#define VDEC_MSG_BASE 0x0000000
 | 
			
		||||
#define VDEC_MSG_INVALID (VDEC_MSG_BASE + 0)
 | 
			
		||||
#define VDEC_MSG_RESP_INPUT_BUFFER_DONE (VDEC_MSG_BASE + 1)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_MSG_RESP_OUTPUT_BUFFER_DONE (VDEC_MSG_BASE + 2)
 | 
			
		||||
#define VDEC_MSG_RESP_INPUT_FLUSHED (VDEC_MSG_BASE + 3)
 | 
			
		||||
#define VDEC_MSG_RESP_OUTPUT_FLUSHED (VDEC_MSG_BASE + 4)
 | 
			
		||||
#define VDEC_MSG_RESP_FLUSH_INPUT_DONE (VDEC_MSG_BASE + 5)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_MSG_RESP_FLUSH_OUTPUT_DONE (VDEC_MSG_BASE + 6)
 | 
			
		||||
#define VDEC_MSG_RESP_START_DONE (VDEC_MSG_BASE + 7)
 | 
			
		||||
#define VDEC_MSG_RESP_STOP_DONE (VDEC_MSG_BASE + 8)
 | 
			
		||||
#define VDEC_MSG_RESP_PAUSE_DONE (VDEC_MSG_BASE + 9)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_MSG_RESP_RESUME_DONE (VDEC_MSG_BASE + 10)
 | 
			
		||||
#define VDEC_MSG_RESP_RESOURCE_LOADED (VDEC_MSG_BASE + 11)
 | 
			
		||||
#define VDEC_EVT_RESOURCES_LOST (VDEC_MSG_BASE + 12)
 | 
			
		||||
#define VDEC_MSG_EVT_CONFIG_CHANGED (VDEC_MSG_BASE + 13)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_MSG_EVT_HW_ERROR (VDEC_MSG_BASE + 14)
 | 
			
		||||
#define VDEC_MSG_EVT_INFO_CONFIG_CHANGED (VDEC_MSG_BASE + 15)
 | 
			
		||||
#define VDEC_MSG_EVT_INFO_FIELD_DROPPED (VDEC_MSG_BASE + 16)
 | 
			
		||||
#define VDEC_BUFFERFLAG_EOS 0x00000001
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_BUFFERFLAG_DECODEONLY 0x00000004
 | 
			
		||||
#define VDEC_BUFFERFLAG_DATACORRUPT 0x00000008
 | 
			
		||||
#define VDEC_BUFFERFLAG_ENDOFFRAME 0x00000010
 | 
			
		||||
#define VDEC_BUFFERFLAG_SYNCFRAME 0x00000020
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_BUFFERFLAG_EXTRADATA 0x00000040
 | 
			
		||||
#define VDEC_BUFFERFLAG_CODECCONFIG 0x00000080
 | 
			
		||||
#define VDEC_EXTRADATA_NONE 0x001
 | 
			
		||||
#define VDEC_EXTRADATA_QP 0x004
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_EXTRADATA_MB_ERROR_MAP 0x008
 | 
			
		||||
#define VDEC_EXTRADATA_SEI 0x010
 | 
			
		||||
#define VDEC_EXTRADATA_VUI 0x020
 | 
			
		||||
#define VDEC_EXTRADATA_VC1 0x040
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_CMDBASE 0x800
 | 
			
		||||
#define VDEC_CMD_SET_INTF_VERSION (VDEC_CMDBASE)
 | 
			
		||||
#define VDEC_IOCTL_MAGIC 'v'
 | 
			
		||||
struct vdec_ioctl_msg {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 void __user *in;
 | 
			
		||||
 void __user *out;
 | 
			
		||||
};
 | 
			
		||||
#define VDEC_IOCTL_GET_PROFILE_LEVEL_SUPPORTED   _IOWR(VDEC_IOCTL_MAGIC, 0, struct vdec_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_GET_INTERLACE_FORMAT   _IOR(VDEC_IOCTL_MAGIC, 1, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_GET_CURRENT_PROFILE_LEVEL   _IOWR(VDEC_IOCTL_MAGIC, 2, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_SET_OUTPUT_FORMAT   _IOWR(VDEC_IOCTL_MAGIC, 3, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_GET_OUTPUT_FORMAT   _IOWR(VDEC_IOCTL_MAGIC, 4, struct vdec_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_SET_CODEC   _IOW(VDEC_IOCTL_MAGIC, 5, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_GET_CODEC   _IOR(VDEC_IOCTL_MAGIC, 6, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_SET_PICRES   _IOW(VDEC_IOCTL_MAGIC, 7, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_GET_PICRES   _IOR(VDEC_IOCTL_MAGIC, 8, struct vdec_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_SET_EXTRADATA   _IOW(VDEC_IOCTL_MAGIC, 9, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_GET_EXTRADATA   _IOR(VDEC_IOCTL_MAGIC, 10, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_SET_SEQUENCE_HEADER   _IOW(VDEC_IOCTL_MAGIC, 11, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_SET_BUFFER_REQ   _IOW(VDEC_IOCTL_MAGIC, 12, struct vdec_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_GET_BUFFER_REQ   _IOR(VDEC_IOCTL_MAGIC, 13, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_ALLOCATE_BUFFER   _IOWR(VDEC_IOCTL_MAGIC, 14, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_FREE_BUFFER   _IOW(VDEC_IOCTL_MAGIC, 15, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_SET_BUFFER   _IOW(VDEC_IOCTL_MAGIC, 16, struct vdec_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_FILL_OUTPUT_BUFFER   _IOW(VDEC_IOCTL_MAGIC, 17, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_DECODE_FRAME   _IOW(VDEC_IOCTL_MAGIC, 18, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_LOAD_RESOURCES _IO(VDEC_IOCTL_MAGIC, 19)
 | 
			
		||||
#define VDEC_IOCTL_CMD_START _IO(VDEC_IOCTL_MAGIC, 20)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_CMD_STOP _IO(VDEC_IOCTL_MAGIC, 21)
 | 
			
		||||
#define VDEC_IOCTL_CMD_PAUSE _IO(VDEC_IOCTL_MAGIC, 22)
 | 
			
		||||
#define VDEC_IOCTL_CMD_RESUME _IO(VDEC_IOCTL_MAGIC, 23)
 | 
			
		||||
#define VDEC_IOCTL_CMD_FLUSH _IOW(VDEC_IOCTL_MAGIC, 24, struct vdec_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_GET_NEXT_MSG   _IOR(VDEC_IOCTL_MAGIC, 25, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_STOP_NEXT_MSG _IO(VDEC_IOCTL_MAGIC, 26)
 | 
			
		||||
#define VDEC_IOCTL_GET_NUMBER_INSTANCES   _IOR(VDEC_IOCTL_MAGIC, 27, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_SET_PICTURE_ORDER   _IOW(VDEC_IOCTL_MAGIC, 28, struct vdec_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_SET_FRAME_RATE   _IOW(VDEC_IOCTL_MAGIC, 29, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_SET_H264_MV_BUFFER   _IOW(VDEC_IOCTL_MAGIC, 30, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_FREE_H264_MV_BUFFER   _IOW(VDEC_IOCTL_MAGIC, 31, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_GET_MV_BUFFER_SIZE   _IOR(VDEC_IOCTL_MAGIC, 32, struct vdec_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_SET_IDR_ONLY_DECODING   _IO(VDEC_IOCTL_MAGIC, 33)
 | 
			
		||||
#define VDEC_IOCTL_SET_CONT_ON_RECONFIG   _IO(VDEC_IOCTL_MAGIC, 34)
 | 
			
		||||
#define VDEC_IOCTL_SET_DISABLE_DMX   _IOW(VDEC_IOCTL_MAGIC, 35, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_GET_DISABLE_DMX   _IOR(VDEC_IOCTL_MAGIC, 36, struct vdec_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_GET_DISABLE_DMX_SUPPORT   _IOR(VDEC_IOCTL_MAGIC, 37, struct vdec_ioctl_msg)
 | 
			
		||||
enum vdec_picture {
 | 
			
		||||
 PICTURE_TYPE_I,
 | 
			
		||||
 PICTURE_TYPE_P,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 PICTURE_TYPE_B,
 | 
			
		||||
 PICTURE_TYPE_BI,
 | 
			
		||||
 PICTURE_TYPE_SKIP,
 | 
			
		||||
 PICTURE_TYPE_IDR,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 PICTURE_TYPE_UNKNOWN
 | 
			
		||||
};
 | 
			
		||||
enum vdec_buffer {
 | 
			
		||||
 VDEC_BUFFER_TYPE_INPUT,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_BUFFER_TYPE_OUTPUT
 | 
			
		||||
};
 | 
			
		||||
struct vdec_allocatorproperty {
 | 
			
		||||
 enum vdec_buffer buffer_type;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t mincount;
 | 
			
		||||
 uint32_t maxcount;
 | 
			
		||||
 uint32_t actualcount;
 | 
			
		||||
 size_t buffer_size;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t alignment;
 | 
			
		||||
 uint32_t buf_poolid;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_bufferpayload {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 void __user *bufferaddr;
 | 
			
		||||
 size_t buffer_len;
 | 
			
		||||
 int pmem_fd;
 | 
			
		||||
 size_t offset;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 size_t mmaped_size;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_setbuffer_cmd {
 | 
			
		||||
 enum vdec_buffer buffer_type;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct vdec_bufferpayload buffer;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_fillbuffer_cmd {
 | 
			
		||||
 struct vdec_bufferpayload buffer;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 void *client_data;
 | 
			
		||||
};
 | 
			
		||||
enum vdec_bufferflush {
 | 
			
		||||
 VDEC_FLUSH_TYPE_INPUT,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_FLUSH_TYPE_OUTPUT,
 | 
			
		||||
 VDEC_FLUSH_TYPE_ALL
 | 
			
		||||
};
 | 
			
		||||
enum vdec_codec {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_CODECTYPE_H264 = 0x1,
 | 
			
		||||
 VDEC_CODECTYPE_H263 = 0x2,
 | 
			
		||||
 VDEC_CODECTYPE_MPEG4 = 0x3,
 | 
			
		||||
 VDEC_CODECTYPE_DIVX_3 = 0x4,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_CODECTYPE_DIVX_4 = 0x5,
 | 
			
		||||
 VDEC_CODECTYPE_DIVX_5 = 0x6,
 | 
			
		||||
 VDEC_CODECTYPE_DIVX_6 = 0x7,
 | 
			
		||||
 VDEC_CODECTYPE_XVID = 0x8,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_CODECTYPE_MPEG1 = 0x9,
 | 
			
		||||
 VDEC_CODECTYPE_MPEG2 = 0xa,
 | 
			
		||||
 VDEC_CODECTYPE_VC1 = 0xb,
 | 
			
		||||
 VDEC_CODECTYPE_VC1_RCV = 0xc
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
enum vdec_mpeg2_profile {
 | 
			
		||||
 VDEC_MPEG2ProfileSimple = 0x1,
 | 
			
		||||
 VDEC_MPEG2ProfileMain = 0x2,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_MPEG2Profile422 = 0x4,
 | 
			
		||||
 VDEC_MPEG2ProfileSNR = 0x8,
 | 
			
		||||
 VDEC_MPEG2ProfileSpatial = 0x10,
 | 
			
		||||
 VDEC_MPEG2ProfileHigh = 0x20,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_MPEG2ProfileKhronosExtensions = 0x6F000000,
 | 
			
		||||
 VDEC_MPEG2ProfileVendorStartUnused = 0x7F000000,
 | 
			
		||||
 VDEC_MPEG2ProfileMax = 0x7FFFFFFF
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum vdec_mpeg2_level {
 | 
			
		||||
 VDEC_MPEG2LevelLL = 0x1,
 | 
			
		||||
 VDEC_MPEG2LevelML = 0x2,
 | 
			
		||||
 VDEC_MPEG2LevelH14 = 0x4,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_MPEG2LevelHL = 0x8,
 | 
			
		||||
 VDEC_MPEG2LevelKhronosExtensions = 0x6F000000,
 | 
			
		||||
 VDEC_MPEG2LevelVendorStartUnused = 0x7F000000,
 | 
			
		||||
 VDEC_MPEG2LevelMax = 0x7FFFFFFF
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
enum vdec_mpeg4_profile {
 | 
			
		||||
 VDEC_MPEG4ProfileSimple = 0x01,
 | 
			
		||||
 VDEC_MPEG4ProfileSimpleScalable = 0x02,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_MPEG4ProfileCore = 0x04,
 | 
			
		||||
 VDEC_MPEG4ProfileMain = 0x08,
 | 
			
		||||
 VDEC_MPEG4ProfileNbit = 0x10,
 | 
			
		||||
 VDEC_MPEG4ProfileScalableTexture = 0x20,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_MPEG4ProfileSimpleFace = 0x40,
 | 
			
		||||
 VDEC_MPEG4ProfileSimpleFBA = 0x80,
 | 
			
		||||
 VDEC_MPEG4ProfileBasicAnimated = 0x100,
 | 
			
		||||
 VDEC_MPEG4ProfileHybrid = 0x200,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_MPEG4ProfileAdvancedRealTime = 0x400,
 | 
			
		||||
 VDEC_MPEG4ProfileCoreScalable = 0x800,
 | 
			
		||||
 VDEC_MPEG4ProfileAdvancedCoding = 0x1000,
 | 
			
		||||
 VDEC_MPEG4ProfileAdvancedCore = 0x2000,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_MPEG4ProfileAdvancedScalable = 0x4000,
 | 
			
		||||
 VDEC_MPEG4ProfileAdvancedSimple = 0x8000,
 | 
			
		||||
 VDEC_MPEG4ProfileKhronosExtensions = 0x6F000000,
 | 
			
		||||
 VDEC_MPEG4ProfileVendorStartUnused = 0x7F000000,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_MPEG4ProfileMax = 0x7FFFFFFF
 | 
			
		||||
};
 | 
			
		||||
enum vdec_mpeg4_level {
 | 
			
		||||
 VDEC_MPEG4Level0 = 0x01,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_MPEG4Level0b = 0x02,
 | 
			
		||||
 VDEC_MPEG4Level1 = 0x04,
 | 
			
		||||
 VDEC_MPEG4Level2 = 0x08,
 | 
			
		||||
 VDEC_MPEG4Level3 = 0x10,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_MPEG4Level4 = 0x20,
 | 
			
		||||
 VDEC_MPEG4Level4a = 0x40,
 | 
			
		||||
 VDEC_MPEG4Level5 = 0x80,
 | 
			
		||||
 VDEC_MPEG4LevelKhronosExtensions = 0x6F000000,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_MPEG4LevelVendorStartUnused = 0x7F000000,
 | 
			
		||||
 VDEC_MPEG4LevelMax = 0x7FFFFFFF
 | 
			
		||||
};
 | 
			
		||||
enum vdec_avc_profile {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_AVCProfileBaseline = 0x01,
 | 
			
		||||
 VDEC_AVCProfileMain = 0x02,
 | 
			
		||||
 VDEC_AVCProfileExtended = 0x04,
 | 
			
		||||
 VDEC_AVCProfileHigh = 0x08,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_AVCProfileHigh10 = 0x10,
 | 
			
		||||
 VDEC_AVCProfileHigh422 = 0x20,
 | 
			
		||||
 VDEC_AVCProfileHigh444 = 0x40,
 | 
			
		||||
 VDEC_AVCProfileKhronosExtensions = 0x6F000000,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_AVCProfileVendorStartUnused = 0x7F000000,
 | 
			
		||||
 VDEC_AVCProfileMax = 0x7FFFFFFF
 | 
			
		||||
};
 | 
			
		||||
enum vdec_avc_level {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_AVCLevel1 = 0x01,
 | 
			
		||||
 VDEC_AVCLevel1b = 0x02,
 | 
			
		||||
 VDEC_AVCLevel11 = 0x04,
 | 
			
		||||
 VDEC_AVCLevel12 = 0x08,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_AVCLevel13 = 0x10,
 | 
			
		||||
 VDEC_AVCLevel2 = 0x20,
 | 
			
		||||
 VDEC_AVCLevel21 = 0x40,
 | 
			
		||||
 VDEC_AVCLevel22 = 0x80,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_AVCLevel3 = 0x100,
 | 
			
		||||
 VDEC_AVCLevel31 = 0x200,
 | 
			
		||||
 VDEC_AVCLevel32 = 0x400,
 | 
			
		||||
 VDEC_AVCLevel4 = 0x800,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_AVCLevel41 = 0x1000,
 | 
			
		||||
 VDEC_AVCLevel42 = 0x2000,
 | 
			
		||||
 VDEC_AVCLevel5 = 0x4000,
 | 
			
		||||
 VDEC_AVCLevel51 = 0x8000,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_AVCLevelKhronosExtensions = 0x6F000000,
 | 
			
		||||
 VDEC_AVCLevelVendorStartUnused = 0x7F000000,
 | 
			
		||||
 VDEC_AVCLevelMax = 0x7FFFFFFF
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum vdec_divx_profile {
 | 
			
		||||
 VDEC_DIVXProfile_qMobile = 0x01,
 | 
			
		||||
 VDEC_DIVXProfile_Mobile = 0x02,
 | 
			
		||||
 VDEC_DIVXProfile_HD = 0x04,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_DIVXProfile_Handheld = 0x08,
 | 
			
		||||
 VDEC_DIVXProfile_Portable = 0x10,
 | 
			
		||||
 VDEC_DIVXProfile_HomeTheater = 0x20
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum vdec_xvid_profile {
 | 
			
		||||
 VDEC_XVIDProfile_Simple = 0x1,
 | 
			
		||||
 VDEC_XVIDProfile_Advanced_Realtime_Simple = 0x2,
 | 
			
		||||
 VDEC_XVIDProfile_Advanced_Simple = 0x4
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
enum vdec_xvid_level {
 | 
			
		||||
 VDEC_XVID_LEVEL_S_L0 = 0x1,
 | 
			
		||||
 VDEC_XVID_LEVEL_S_L1 = 0x2,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_XVID_LEVEL_S_L2 = 0x4,
 | 
			
		||||
 VDEC_XVID_LEVEL_S_L3 = 0x8,
 | 
			
		||||
 VDEC_XVID_LEVEL_ARTS_L1 = 0x10,
 | 
			
		||||
 VDEC_XVID_LEVEL_ARTS_L2 = 0x20,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_XVID_LEVEL_ARTS_L3 = 0x40,
 | 
			
		||||
 VDEC_XVID_LEVEL_ARTS_L4 = 0x80,
 | 
			
		||||
 VDEC_XVID_LEVEL_AS_L0 = 0x100,
 | 
			
		||||
 VDEC_XVID_LEVEL_AS_L1 = 0x200,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_XVID_LEVEL_AS_L2 = 0x400,
 | 
			
		||||
 VDEC_XVID_LEVEL_AS_L3 = 0x800,
 | 
			
		||||
 VDEC_XVID_LEVEL_AS_L4 = 0x1000
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum vdec_h263profile {
 | 
			
		||||
 VDEC_H263ProfileBaseline = 0x01,
 | 
			
		||||
 VDEC_H263ProfileH320Coding = 0x02,
 | 
			
		||||
 VDEC_H263ProfileBackwardCompatible = 0x04,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_H263ProfileISWV2 = 0x08,
 | 
			
		||||
 VDEC_H263ProfileISWV3 = 0x10,
 | 
			
		||||
 VDEC_H263ProfileHighCompression = 0x20,
 | 
			
		||||
 VDEC_H263ProfileInternet = 0x40,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_H263ProfileInterlace = 0x80,
 | 
			
		||||
 VDEC_H263ProfileHighLatency = 0x100,
 | 
			
		||||
 VDEC_H263ProfileKhronosExtensions = 0x6F000000,
 | 
			
		||||
 VDEC_H263ProfileVendorStartUnused = 0x7F000000,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_H263ProfileMax = 0x7FFFFFFF
 | 
			
		||||
};
 | 
			
		||||
enum vdec_h263level {
 | 
			
		||||
 VDEC_H263Level10 = 0x01,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_H263Level20 = 0x02,
 | 
			
		||||
 VDEC_H263Level30 = 0x04,
 | 
			
		||||
 VDEC_H263Level40 = 0x08,
 | 
			
		||||
 VDEC_H263Level45 = 0x10,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_H263Level50 = 0x20,
 | 
			
		||||
 VDEC_H263Level60 = 0x40,
 | 
			
		||||
 VDEC_H263Level70 = 0x80,
 | 
			
		||||
 VDEC_H263LevelKhronosExtensions = 0x6F000000,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_H263LevelVendorStartUnused = 0x7F000000,
 | 
			
		||||
 VDEC_H263LevelMax = 0x7FFFFFFF
 | 
			
		||||
};
 | 
			
		||||
enum vdec_wmv_format {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_WMVFormatUnused = 0x01,
 | 
			
		||||
 VDEC_WMVFormat7 = 0x02,
 | 
			
		||||
 VDEC_WMVFormat8 = 0x04,
 | 
			
		||||
 VDEC_WMVFormat9 = 0x08,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_WMFFormatKhronosExtensions = 0x6F000000,
 | 
			
		||||
 VDEC_WMFFormatVendorStartUnused = 0x7F000000,
 | 
			
		||||
 VDEC_WMVFormatMax = 0x7FFFFFFF
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum vdec_vc1_profile {
 | 
			
		||||
 VDEC_VC1ProfileSimple = 0x1,
 | 
			
		||||
 VDEC_VC1ProfileMain = 0x2,
 | 
			
		||||
 VDEC_VC1ProfileAdvanced = 0x4
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
enum vdec_vc1_level {
 | 
			
		||||
 VDEC_VC1_LEVEL_S_Low = 0x1,
 | 
			
		||||
 VDEC_VC1_LEVEL_S_Medium = 0x2,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_VC1_LEVEL_M_Low = 0x4,
 | 
			
		||||
 VDEC_VC1_LEVEL_M_Medium = 0x8,
 | 
			
		||||
 VDEC_VC1_LEVEL_M_High = 0x10,
 | 
			
		||||
 VDEC_VC1_LEVEL_A_L0 = 0x20,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_VC1_LEVEL_A_L1 = 0x40,
 | 
			
		||||
 VDEC_VC1_LEVEL_A_L2 = 0x80,
 | 
			
		||||
 VDEC_VC1_LEVEL_A_L3 = 0x100,
 | 
			
		||||
 VDEC_VC1_LEVEL_A_L4 = 0x200
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct vdec_profile_level {
 | 
			
		||||
 uint32_t profiles;
 | 
			
		||||
 uint32_t levels;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
enum vdec_interlaced_format {
 | 
			
		||||
 VDEC_InterlaceFrameProgressive = 0x1,
 | 
			
		||||
 VDEC_InterlaceInterleaveFrameTopFieldFirst = 0x2,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_InterlaceInterleaveFrameBottomFieldFirst = 0x4
 | 
			
		||||
};
 | 
			
		||||
enum vdec_output_fromat {
 | 
			
		||||
 VDEC_YUV_FORMAT_NV12 = 0x1,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_YUV_FORMAT_TILE_4x2 = 0x2
 | 
			
		||||
};
 | 
			
		||||
enum vdec_output_order {
 | 
			
		||||
 VDEC_ORDER_DISPLAY = 0x1,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_ORDER_DECODE = 0x2
 | 
			
		||||
};
 | 
			
		||||
struct vdec_picsize {
 | 
			
		||||
 uint32_t frame_width;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t frame_height;
 | 
			
		||||
 uint32_t stride;
 | 
			
		||||
 uint32_t scan_lines;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct vdec_seqheader {
 | 
			
		||||
 void __user *ptr_seqheader;
 | 
			
		||||
 size_t seq_header_len;
 | 
			
		||||
 int pmem_fd;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 size_t pmem_offset;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_mberror {
 | 
			
		||||
 void __user *ptr_errormap;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 size_t err_mapsize;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_input_frameinfo {
 | 
			
		||||
 void __user *bufferaddr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 size_t offset;
 | 
			
		||||
 size_t datalen;
 | 
			
		||||
 uint32_t flags;
 | 
			
		||||
 int64_t timestamp;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 void *client_data;
 | 
			
		||||
 int pmem_fd;
 | 
			
		||||
 size_t pmem_offset;
 | 
			
		||||
 void __user *desc_addr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t desc_size;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_framesize {
 | 
			
		||||
 uint32_t left;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t top;
 | 
			
		||||
 uint32_t right;
 | 
			
		||||
 uint32_t bottom;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct vdec_aspectratioinfo {
 | 
			
		||||
 uint32_t aspect_ratio;
 | 
			
		||||
 uint32_t par_width;
 | 
			
		||||
 uint32_t par_height;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct vdec_output_frameinfo {
 | 
			
		||||
 void __user *bufferaddr;
 | 
			
		||||
 size_t offset;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 size_t len;
 | 
			
		||||
 uint32_t flags;
 | 
			
		||||
 int64_t time_stamp;
 | 
			
		||||
 enum vdec_picture pic_type;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 void *client_data;
 | 
			
		||||
 void *input_frame_clientdata;
 | 
			
		||||
 struct vdec_framesize framesize;
 | 
			
		||||
 enum vdec_interlaced_format interlaced_format;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct vdec_aspectratioinfo aspect_ratio_info;
 | 
			
		||||
};
 | 
			
		||||
union vdec_msgdata {
 | 
			
		||||
 struct vdec_output_frameinfo output_frame;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 void *input_frame_clientdata;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_msginfo {
 | 
			
		||||
 uint32_t status_code;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t msgcode;
 | 
			
		||||
 union vdec_msgdata msgdata;
 | 
			
		||||
 size_t msgdatasize;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct vdec_framerate {
 | 
			
		||||
 unsigned long fps_denominator;
 | 
			
		||||
 unsigned long fps_numerator;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct vdec_h264_mv{
 | 
			
		||||
 size_t size;
 | 
			
		||||
 int count;
 | 
			
		||||
 int pmem_fd;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int offset;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_mv_buff_size{
 | 
			
		||||
 int width;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int height;
 | 
			
		||||
 int size;
 | 
			
		||||
 int alignment;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										429
									
								
								libc/kernel/common/linux/msm_vidc_enc.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										429
									
								
								libc/kernel/common/linux/msm_vidc_enc.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,429 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef _MSM_VIDC_ENC_H_
 | 
			
		||||
#define _MSM_VIDC_ENC_H_
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#include <linux/ioctl.h>
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_S_BASE 0x00000000
 | 
			
		||||
#define VEN_S_SUCCESS (VEN_S_BASE)
 | 
			
		||||
#define VEN_S_EFAIL (VEN_S_BASE+1)
 | 
			
		||||
#define VEN_S_EFATAL (VEN_S_BASE+2)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_S_EBADPARAM (VEN_S_BASE+3)
 | 
			
		||||
#define VEN_S_EINVALSTATE (VEN_S_BASE+4)
 | 
			
		||||
#define VEN_S_ENOSWRES (VEN_S_BASE+5)
 | 
			
		||||
#define VEN_S_ENOHWRES (VEN_S_BASE+6)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_S_EBUFFREQ (VEN_S_BASE+7)
 | 
			
		||||
#define VEN_S_EINVALCMD (VEN_S_BASE+8)
 | 
			
		||||
#define VEN_S_ETIMEOUT (VEN_S_BASE+9)
 | 
			
		||||
#define VEN_S_ENOREATMPT (VEN_S_BASE+10)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_S_ENOPREREQ (VEN_S_BASE+11)
 | 
			
		||||
#define VEN_S_ECMDQFULL (VEN_S_BASE+12)
 | 
			
		||||
#define VEN_S_ENOTSUPP (VEN_S_BASE+13)
 | 
			
		||||
#define VEN_S_ENOTIMPL (VEN_S_BASE+14)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_S_ENOTPMEM (VEN_S_BASE+15)
 | 
			
		||||
#define VEN_S_EFLUSHED (VEN_S_BASE+16)
 | 
			
		||||
#define VEN_S_EINSUFBUF (VEN_S_BASE+17)
 | 
			
		||||
#define VEN_S_ESAMESTATE (VEN_S_BASE+18)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_S_EINVALTRANS (VEN_S_BASE+19)
 | 
			
		||||
#define VEN_INTF_VER 1
 | 
			
		||||
#define VEN_MSG_INDICATION 0
 | 
			
		||||
#define VEN_MSG_INPUT_BUFFER_DONE 1
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_MSG_OUTPUT_BUFFER_DONE 2
 | 
			
		||||
#define VEN_MSG_NEED_OUTPUT_BUFFER 3
 | 
			
		||||
#define VEN_MSG_FLUSH_INPUT_DONE 4
 | 
			
		||||
#define VEN_MSG_FLUSH_OUPUT_DONE 5
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_MSG_START 6
 | 
			
		||||
#define VEN_MSG_STOP 7
 | 
			
		||||
#define VEN_MSG_PAUSE 8
 | 
			
		||||
#define VEN_MSG_RESUME 9
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_MSG_STOP_READING_MSG 10
 | 
			
		||||
#define VEN_BUFFLAG_EOS 0x00000001
 | 
			
		||||
#define VEN_BUFFLAG_ENDOFFRAME 0x00000010
 | 
			
		||||
#define VEN_BUFFLAG_SYNCFRAME 0x00000020
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_BUFFLAG_EXTRADATA 0x00000040
 | 
			
		||||
#define VEN_BUFFLAG_CODECCONFIG 0x00000080
 | 
			
		||||
#define VEN_EXTRADATA_NONE 0x001
 | 
			
		||||
#define VEN_EXTRADATA_QCOMFILLER 0x002
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_EXTRADATA_SLICEINFO 0x100
 | 
			
		||||
#define VEN_FRAME_TYPE_I 1
 | 
			
		||||
#define VEN_FRAME_TYPE_P 2
 | 
			
		||||
#define VEN_FRAME_TYPE_B 3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_CODEC_MPEG4 1
 | 
			
		||||
#define VEN_CODEC_H264 2
 | 
			
		||||
#define VEN_CODEC_H263 3
 | 
			
		||||
#define VEN_PROFILE_MPEG4_SP 1
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_PROFILE_MPEG4_ASP 2
 | 
			
		||||
#define VEN_PROFILE_H264_BASELINE 3
 | 
			
		||||
#define VEN_PROFILE_H264_MAIN 4
 | 
			
		||||
#define VEN_PROFILE_H264_HIGH 5
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_PROFILE_H263_BASELINE 6
 | 
			
		||||
#define VEN_LEVEL_MPEG4_0 0x1
 | 
			
		||||
#define VEN_LEVEL_MPEG4_1 0x2
 | 
			
		||||
#define VEN_LEVEL_MPEG4_2 0x3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_LEVEL_MPEG4_3 0x4
 | 
			
		||||
#define VEN_LEVEL_MPEG4_4 0x5
 | 
			
		||||
#define VEN_LEVEL_MPEG4_5 0x6
 | 
			
		||||
#define VEN_LEVEL_MPEG4_3b 0x7
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_LEVEL_MPEG4_6 0x8
 | 
			
		||||
#define VEN_LEVEL_H264_1 0x9
 | 
			
		||||
#define VEN_LEVEL_H264_1b 0xA
 | 
			
		||||
#define VEN_LEVEL_H264_1p1 0xB
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_LEVEL_H264_1p2 0xC
 | 
			
		||||
#define VEN_LEVEL_H264_1p3 0xD
 | 
			
		||||
#define VEN_LEVEL_H264_2 0xE
 | 
			
		||||
#define VEN_LEVEL_H264_2p1 0xF
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_LEVEL_H264_2p2 0x10
 | 
			
		||||
#define VEN_LEVEL_H264_3 0x11
 | 
			
		||||
#define VEN_LEVEL_H264_3p1 0x12
 | 
			
		||||
#define VEN_LEVEL_H264_3p2 0x13
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_LEVEL_H264_4 0x14
 | 
			
		||||
#define VEN_LEVEL_H263_10 0x15
 | 
			
		||||
#define VEN_LEVEL_H263_20 0x16
 | 
			
		||||
#define VEN_LEVEL_H263_30 0x17
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_LEVEL_H263_40 0x18
 | 
			
		||||
#define VEN_LEVEL_H263_45 0x19
 | 
			
		||||
#define VEN_LEVEL_H263_50 0x1A
 | 
			
		||||
#define VEN_LEVEL_H263_60 0x1B
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_LEVEL_H263_70 0x1C
 | 
			
		||||
#define VEN_ENTROPY_MODEL_CAVLC 1
 | 
			
		||||
#define VEN_ENTROPY_MODEL_CABAC 2
 | 
			
		||||
#define VEN_CABAC_MODEL_0 1
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_CABAC_MODEL_1 2
 | 
			
		||||
#define VEN_CABAC_MODEL_2 3
 | 
			
		||||
#define VEN_DB_DISABLE 1
 | 
			
		||||
#define VEN_DB_ALL_BLKG_BNDRY 2
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_DB_SKIP_SLICE_BNDRY 3
 | 
			
		||||
#define VEN_MSLICE_OFF 1
 | 
			
		||||
#define VEN_MSLICE_CNT_MB 2
 | 
			
		||||
#define VEN_MSLICE_CNT_BYTE 3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_MSLICE_GOB 4
 | 
			
		||||
#define VEN_RC_OFF 1
 | 
			
		||||
#define VEN_RC_VBR_VFR 2
 | 
			
		||||
#define VEN_RC_VBR_CFR 3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_RC_CBR_VFR 4
 | 
			
		||||
#define VEN_RC_CBR_CFR 5
 | 
			
		||||
#define VEN_FLUSH_INPUT 1
 | 
			
		||||
#define VEN_FLUSH_OUTPUT 2
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_FLUSH_ALL 3
 | 
			
		||||
#define VEN_INPUTFMT_NV12 1
 | 
			
		||||
#define VEN_INPUTFMT_NV21 2
 | 
			
		||||
#define VEN_INPUTFMT_NV12_16M2KA 3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_ROTATION_0 1
 | 
			
		||||
#define VEN_ROTATION_90 2
 | 
			
		||||
#define VEN_ROTATION_180 3
 | 
			
		||||
#define VEN_ROTATION_270 4
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_TIMEOUT_INFINITE 0xffffffff
 | 
			
		||||
#define VEN_IR_OFF 1
 | 
			
		||||
#define VEN_IR_CYCLIC 2
 | 
			
		||||
#define VEN_IR_RANDOM 3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTLBASE_NENC 0x800
 | 
			
		||||
#define VEN_IOCTLBASE_ENC 0x850
 | 
			
		||||
struct venc_ioctl_msg{
 | 
			
		||||
 void __user *in;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 void __user *out;
 | 
			
		||||
};
 | 
			
		||||
#define VEN_IOCTL_SET_INTF_VERSION   _IOW(VEN_IOCTLBASE_NENC, 0, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_CMD_READ_NEXT_MSG   _IOWR(VEN_IOCTLBASE_NENC, 1, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_CMD_STOP_READ_MSG _IO(VEN_IOCTLBASE_NENC, 2)
 | 
			
		||||
#define VEN_IOCTL_SET_INPUT_BUFFER_REQ   _IOW(VEN_IOCTLBASE_NENC, 3, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_INPUT_BUFFER_REQ   _IOR(VEN_IOCTLBASE_NENC, 4, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_CMD_ALLOC_INPUT_BUFFER   _IOW(VEN_IOCTLBASE_NENC, 5, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_SET_INPUT_BUFFER   _IOW(VEN_IOCTLBASE_NENC, 6, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_CMD_FREE_INPUT_BUFFER   _IOW(VEN_IOCTLBASE_NENC, 7, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_OUTPUT_BUFFER_REQ   _IOW(VEN_IOCTLBASE_NENC, 8, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_OUTPUT_BUFFER_REQ   _IOR(VEN_IOCTLBASE_NENC, 9, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_CMD_ALLOC_OUTPUT_BUFFER   _IOW(VEN_IOCTLBASE_NENC, 10, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_OUTPUT_BUFFER   _IOW(VEN_IOCTLBASE_NENC, 11, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_CMD_FREE_OUTPUT_BUFFER   _IOW(VEN_IOCTLBASE_NENC, 12, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_CMD_START _IO(VEN_IOCTLBASE_NENC, 13)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_CMD_ENCODE_FRAME   _IOW(VEN_IOCTLBASE_NENC, 14, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_CMD_FILL_OUTPUT_BUFFER   _IOW(VEN_IOCTLBASE_NENC, 15, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_CMD_FLUSH   _IOW(VEN_IOCTLBASE_NENC, 16, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_CMD_PAUSE _IO(VEN_IOCTLBASE_NENC, 17)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_CMD_RESUME _IO(VEN_IOCTLBASE_NENC, 18)
 | 
			
		||||
#define VEN_IOCTL_CMD_STOP _IO(VEN_IOCTLBASE_NENC, 19)
 | 
			
		||||
#define VEN_IOCTL_SET_RECON_BUFFER   _IOW(VEN_IOCTLBASE_NENC, 20, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_FREE_RECON_BUFFER   _IOW(VEN_IOCTLBASE_NENC, 21, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_GET_RECON_BUFFER_SIZE   _IOW(VEN_IOCTLBASE_NENC, 22, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_BASE_CFG   _IOW(VEN_IOCTLBASE_ENC, 1, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_BASE_CFG   _IOR(VEN_IOCTLBASE_ENC, 2, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_LIVE_MODE   _IOW(VEN_IOCTLBASE_ENC, 3, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_GET_LIVE_MODE   _IOR(VEN_IOCTLBASE_ENC, 4, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_CODEC_PROFILE   _IOW(VEN_IOCTLBASE_ENC, 5, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_CODEC_PROFILE   _IOR(VEN_IOCTLBASE_ENC, 6, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_PROFILE_LEVEL   _IOW(VEN_IOCTLBASE_ENC, 7, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_GET_PROFILE_LEVEL   _IOR(VEN_IOCTLBASE_ENC, 8, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_SHORT_HDR   _IOW(VEN_IOCTLBASE_ENC, 9, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_SHORT_HDR   _IOR(VEN_IOCTLBASE_ENC, 10, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_SESSION_QP   _IOW(VEN_IOCTLBASE_ENC, 11, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_GET_SESSION_QP   _IOR(VEN_IOCTLBASE_ENC, 12, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_INTRA_PERIOD   _IOW(VEN_IOCTLBASE_ENC, 13, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_INTRA_PERIOD   _IOR(VEN_IOCTLBASE_ENC, 14, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_CMD_REQUEST_IFRAME _IO(VEN_IOCTLBASE_ENC, 15)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_GET_CAPABILITY   _IOR(VEN_IOCTLBASE_ENC, 16, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_SEQUENCE_HDR   _IOR(VEN_IOCTLBASE_ENC, 17, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_ENTROPY_CFG   _IOW(VEN_IOCTLBASE_ENC, 18, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_ENTROPY_CFG   _IOR(VEN_IOCTLBASE_ENC, 19, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_SET_DEBLOCKING_CFG   _IOW(VEN_IOCTLBASE_ENC, 20, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_DEBLOCKING_CFG   _IOR(VEN_IOCTLBASE_ENC, 21, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_INTRA_REFRESH   _IOW(VEN_IOCTLBASE_ENC, 22, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_INTRA_REFRESH   _IOR(VEN_IOCTLBASE_ENC, 23, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_SET_MULTI_SLICE_CFG   _IOW(VEN_IOCTLBASE_ENC, 24, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_MULTI_SLICE_CFG   _IOR(VEN_IOCTLBASE_ENC, 25, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_RATE_CTRL_CFG   _IOW(VEN_IOCTLBASE_ENC, 26, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_RATE_CTRL_CFG   _IOR(VEN_IOCTLBASE_ENC, 27, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_SET_VOP_TIMING_CFG   _IOW(VEN_IOCTLBASE_ENC, 28, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_VOP_TIMING_CFG   _IOR(VEN_IOCTLBASE_ENC, 29, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_FRAME_RATE   _IOW(VEN_IOCTLBASE_ENC, 30, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_FRAME_RATE   _IOR(VEN_IOCTLBASE_ENC, 31, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_SET_TARGET_BITRATE   _IOW(VEN_IOCTLBASE_ENC, 32, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_TARGET_BITRATE   _IOR(VEN_IOCTLBASE_ENC, 33, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_ROTATION   _IOW(VEN_IOCTLBASE_ENC, 34, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_ROTATION   _IOR(VEN_IOCTLBASE_ENC, 35, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_SET_HEC   _IOW(VEN_IOCTLBASE_ENC, 36, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_HEC   _IOR(VEN_IOCTLBASE_ENC, 37, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_DATA_PARTITION   _IOW(VEN_IOCTLBASE_ENC, 38, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_DATA_PARTITION   _IOR(VEN_IOCTLBASE_ENC, 39, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_SET_RVLC   _IOW(VEN_IOCTLBASE_ENC, 40, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_RVLC   _IOR(VEN_IOCTLBASE_ENC, 41, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_AC_PREDICTION   _IOW(VEN_IOCTLBASE_ENC, 42, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_AC_PREDICTION   _IOR(VEN_IOCTLBASE_ENC, 43, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_SET_QP_RANGE   _IOW(VEN_IOCTLBASE_ENC, 44, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_QP_RANGE   _IOR(VEN_IOCTLBASE_ENC, 45, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_NUMBER_INSTANCES   _IOR(VEN_IOCTLBASE_ENC, 46, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_METABUFFER_MODE   _IOW(VEN_IOCTLBASE_ENC, 47, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_SET_EXTRADATA   _IOW(VEN_IOCTLBASE_ENC, 48, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_EXTRADATA   _IOR(VEN_IOCTLBASE_ENC, 49, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_SLICE_DELIVERY_MODE   _IO(VEN_IOCTLBASE_ENC, 50)
 | 
			
		||||
#define VEN_IOCTL_SET_SPS_PPS_FOR_IDR   _IOW(VEN_IOCTLBASE_ENC, 51, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_switch{
 | 
			
		||||
 unsigned char status;
 | 
			
		||||
};
 | 
			
		||||
struct venc_allocatorproperty{
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long mincount;
 | 
			
		||||
 unsigned long maxcount;
 | 
			
		||||
 unsigned long actualcount;
 | 
			
		||||
 unsigned long datasize;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long suffixsize;
 | 
			
		||||
 unsigned long alignment;
 | 
			
		||||
 unsigned long bufpoolid;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_bufferpayload{
 | 
			
		||||
 unsigned char *pbuffer;
 | 
			
		||||
 size_t sz;
 | 
			
		||||
 int fd;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int offset;
 | 
			
		||||
 unsigned int maped_size;
 | 
			
		||||
 unsigned long filled_len;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_buffer{
 | 
			
		||||
 unsigned char *ptrbuffer;
 | 
			
		||||
 unsigned long sz;
 | 
			
		||||
 unsigned long len;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long offset;
 | 
			
		||||
 long long timestamp;
 | 
			
		||||
 unsigned long flags;
 | 
			
		||||
 void *clientdata;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct venc_basecfg{
 | 
			
		||||
 unsigned long input_width;
 | 
			
		||||
 unsigned long input_height;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long dvs_width;
 | 
			
		||||
 unsigned long dvs_height;
 | 
			
		||||
 unsigned long codectype;
 | 
			
		||||
 unsigned long fps_num;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long fps_den;
 | 
			
		||||
 unsigned long targetbitrate;
 | 
			
		||||
 unsigned long inputformat;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_profile{
 | 
			
		||||
 unsigned long profile;
 | 
			
		||||
};
 | 
			
		||||
struct ven_profilelevel{
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long level;
 | 
			
		||||
};
 | 
			
		||||
struct venc_sessionqp{
 | 
			
		||||
 unsigned long iframeqp;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long pframqp;
 | 
			
		||||
};
 | 
			
		||||
struct venc_qprange{
 | 
			
		||||
 unsigned long maxqp;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long minqp;
 | 
			
		||||
};
 | 
			
		||||
struct venc_intraperiod{
 | 
			
		||||
 unsigned long num_pframes;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long num_bframes;
 | 
			
		||||
};
 | 
			
		||||
struct venc_seqheader{
 | 
			
		||||
 unsigned char *hdrbufptr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long bufsize;
 | 
			
		||||
 unsigned long hdrlen;
 | 
			
		||||
};
 | 
			
		||||
struct venc_capability{
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long codec_types;
 | 
			
		||||
 unsigned long maxframe_width;
 | 
			
		||||
 unsigned long maxframe_height;
 | 
			
		||||
 unsigned long maxtarget_bitrate;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long maxframe_rate;
 | 
			
		||||
 unsigned long input_formats;
 | 
			
		||||
 unsigned char dvs;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_entropycfg{
 | 
			
		||||
 unsigned longentropysel;
 | 
			
		||||
 unsigned long cabacmodel;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_dbcfg{
 | 
			
		||||
 unsigned long db_mode;
 | 
			
		||||
 unsigned long slicealpha_offset;
 | 
			
		||||
 unsigned long slicebeta_offset;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct venc_intrarefresh{
 | 
			
		||||
 unsigned long irmode;
 | 
			
		||||
 unsigned long mbcount;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct venc_multiclicecfg{
 | 
			
		||||
 unsigned long mslice_mode;
 | 
			
		||||
 unsigned long mslice_size;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct venc_bufferflush{
 | 
			
		||||
 unsigned long flush_mode;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_ratectrlcfg{
 | 
			
		||||
 unsigned long rcmode;
 | 
			
		||||
};
 | 
			
		||||
struct venc_voptimingcfg{
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long voptime_resolution;
 | 
			
		||||
};
 | 
			
		||||
struct venc_framerate{
 | 
			
		||||
 unsigned long fps_denominator;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long fps_numerator;
 | 
			
		||||
};
 | 
			
		||||
struct venc_targetbitrate{
 | 
			
		||||
 unsigned long target_bitrate;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct venc_rotation{
 | 
			
		||||
 unsigned long rotation;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_timeout{
 | 
			
		||||
 unsigned long millisec;
 | 
			
		||||
};
 | 
			
		||||
struct venc_headerextension{
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long header_extension;
 | 
			
		||||
};
 | 
			
		||||
struct venc_msg{
 | 
			
		||||
 unsigned long statuscode;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long msgcode;
 | 
			
		||||
 struct venc_buffer buf;
 | 
			
		||||
 unsigned long msgdata_size;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_recon_addr{
 | 
			
		||||
 unsigned char *pbuffer;
 | 
			
		||||
 unsigned long buffer_size;
 | 
			
		||||
 unsigned long pmem_fd;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long offset;
 | 
			
		||||
};
 | 
			
		||||
struct venc_recon_buff_size{
 | 
			
		||||
 int width;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int height;
 | 
			
		||||
 int size;
 | 
			
		||||
 int alignment;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#endif
 | 
			
		||||
@@ -23,7 +23,7 @@
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#include <linux/netfilter/x_tables.h>
 | 
			
		||||
#define IPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
 | 
			
		||||
#define IPT_TABLE_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
 | 
			
		||||
#define IPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
 | 
			
		||||
#define ipt_match xt_match
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ipt_target xt_target
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1870
									
								
								libc/kernel/common/media/msm_camera.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1870
									
								
								libc/kernel/common/media/msm_camera.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										100
									
								
								libc/kernel/common/media/msm_gemini.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										100
									
								
								libc/kernel/common/media/msm_gemini.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,100 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __LINUX_MSM_GEMINI_H
 | 
			
		||||
#define __LINUX_MSM_GEMINI_H
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#include <linux/ioctl.h>
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_GMN_IOCTL_MAGIC 'g'
 | 
			
		||||
#define MSM_GMN_IOCTL_GET_HW_VERSION   _IOW(MSM_GMN_IOCTL_MAGIC, 1, struct msm_gemini_hw_cmd *)
 | 
			
		||||
#define MSM_GMN_IOCTL_RESET   _IOW(MSM_GMN_IOCTL_MAGIC, 2, struct msm_gemini_ctrl_cmd *)
 | 
			
		||||
#define MSM_GMN_IOCTL_STOP   _IOW(MSM_GMN_IOCTL_MAGIC, 3, struct msm_gemini_hw_cmds *)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_GMN_IOCTL_START   _IOW(MSM_GMN_IOCTL_MAGIC, 4, struct msm_gemini_hw_cmds *)
 | 
			
		||||
#define MSM_GMN_IOCTL_INPUT_BUF_ENQUEUE   _IOW(MSM_GMN_IOCTL_MAGIC, 5, struct msm_gemini_buf *)
 | 
			
		||||
#define MSM_GMN_IOCTL_INPUT_GET   _IOW(MSM_GMN_IOCTL_MAGIC, 6, struct msm_gemini_buf *)
 | 
			
		||||
#define MSM_GMN_IOCTL_INPUT_GET_UNBLOCK   _IOW(MSM_GMN_IOCTL_MAGIC, 7, int)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_GMN_IOCTL_OUTPUT_BUF_ENQUEUE   _IOW(MSM_GMN_IOCTL_MAGIC, 8, struct msm_gemini_buf *)
 | 
			
		||||
#define MSM_GMN_IOCTL_OUTPUT_GET   _IOW(MSM_GMN_IOCTL_MAGIC, 9, struct msm_gemini_buf *)
 | 
			
		||||
#define MSM_GMN_IOCTL_OUTPUT_GET_UNBLOCK   _IOW(MSM_GMN_IOCTL_MAGIC, 10, int)
 | 
			
		||||
#define MSM_GMN_IOCTL_EVT_GET   _IOW(MSM_GMN_IOCTL_MAGIC, 11, struct msm_gemini_ctrl_cmd *)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_GMN_IOCTL_EVT_GET_UNBLOCK   _IOW(MSM_GMN_IOCTL_MAGIC, 12, int)
 | 
			
		||||
#define MSM_GMN_IOCTL_HW_CMD   _IOW(MSM_GMN_IOCTL_MAGIC, 13, struct msm_gemini_hw_cmd *)
 | 
			
		||||
#define MSM_GMN_IOCTL_HW_CMDS   _IOW(MSM_GMN_IOCTL_MAGIC, 14, struct msm_gemini_hw_cmds *)
 | 
			
		||||
#define MSM_GMN_IOCTL_TEST_DUMP_REGION   _IOW(MSM_GMN_IOCTL_MAGIC, 15, unsigned long)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_GEMINI_MODE_REALTIME_ENCODE 0
 | 
			
		||||
#define MSM_GEMINI_MODE_OFFLINE_ENCODE 1
 | 
			
		||||
#define MSM_GEMINI_MODE_REALTIME_ROTATION 2
 | 
			
		||||
#define MSM_GEMINI_MODE_OFFLINE_ROTATION 3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_gemini_ctrl_cmd {
 | 
			
		||||
 uint32_t type;
 | 
			
		||||
 uint32_t len;
 | 
			
		||||
 void *value;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#define MSM_GEMINI_EVT_RESET 0
 | 
			
		||||
#define MSM_GEMINI_EVT_FRAMEDONE 1
 | 
			
		||||
#define MSM_GEMINI_EVT_ERR 2
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_gemini_buf {
 | 
			
		||||
 uint32_t type;
 | 
			
		||||
 int fd;
 | 
			
		||||
 void *vaddr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t y_off;
 | 
			
		||||
 uint32_t y_len;
 | 
			
		||||
 uint32_t framedone_len;
 | 
			
		||||
 uint32_t cbcr_off;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t cbcr_len;
 | 
			
		||||
 uint32_t num_of_mcu_rows;
 | 
			
		||||
 uint32_t offset;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_GEMINI_HW_CMD_TYPE_READ 0
 | 
			
		||||
#define MSM_GEMINI_HW_CMD_TYPE_WRITE 1
 | 
			
		||||
#define MSM_GEMINI_HW_CMD_TYPE_WRITE_OR 2
 | 
			
		||||
#define MSM_GEMINI_HW_CMD_TYPE_UWAIT 3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_GEMINI_HW_CMD_TYPE_MWAIT 4
 | 
			
		||||
#define MSM_GEMINI_HW_CMD_TYPE_MDELAY 5
 | 
			
		||||
#define MSM_GEMINI_HW_CMD_TYPE_UDELAY 6
 | 
			
		||||
struct msm_gemini_hw_cmd {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t type:4;
 | 
			
		||||
 uint32_t n:12;
 | 
			
		||||
 uint32_t offset:16;
 | 
			
		||||
 uint32_t mask;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 union {
 | 
			
		||||
 uint32_t data;
 | 
			
		||||
 uint32_t *pdata;
 | 
			
		||||
 };
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct msm_gemini_hw_cmds {
 | 
			
		||||
 uint32_t m;
 | 
			
		||||
 struct msm_gemini_hw_cmd hw_cmd[1];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										61
									
								
								libc/kernel/common/media/msm_gestures.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								libc/kernel/common/media/msm_gestures.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,61 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __LINUX_MSM_GESTURES_H
 | 
			
		||||
#define __LINUX_MSM_GESTURES_H
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#include <linux/ioctl.h>
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#include <media/msm_camera.h>
 | 
			
		||||
#define MSM_GES_IOCTL_CTRL_COMMAND   _IOW('V', BASE_VIDIOC_PRIVATE + 20, struct v4l2_control)
 | 
			
		||||
#define VIDIOC_MSM_GESTURE_EVT   _IOWR('V', BASE_VIDIOC_PRIVATE + 21, struct v4l2_event)
 | 
			
		||||
#define MSM_GES_GET_EVT_PAYLOAD   _IOW('V', BASE_VIDIOC_PRIVATE + 22, struct msm_ges_evt)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VIDIOC_MSM_GESTURE_CAM_EVT   _IOWR('V', BASE_VIDIOC_PRIVATE + 23, int)
 | 
			
		||||
#define MSM_GES_RESP_V4L2 MSM_CAM_RESP_MAX
 | 
			
		||||
#define MSM_GES_RESP_MAX (MSM_GES_RESP_V4L2 + 1)
 | 
			
		||||
#define MSM_SVR_RESP_MAX MSM_GES_RESP_MAX
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_V4L2_GES_BASE 100
 | 
			
		||||
#define MSM_V4L2_GES_OPEN (MSM_V4L2_GES_BASE + 0)
 | 
			
		||||
#define MSM_V4L2_GES_CLOSE (MSM_V4L2_GES_BASE + 1)
 | 
			
		||||
#define MSM_V4L2_GES_CAM_OPEN (MSM_V4L2_GES_BASE + 2)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_V4L2_GES_CAM_CLOSE (MSM_V4L2_GES_BASE + 3)
 | 
			
		||||
#define MSM_GES_APP_EVT_MIN (V4L2_EVENT_PRIVATE_START + 0x14)
 | 
			
		||||
#define MSM_GES_APP_NOTIFY_EVENT (MSM_GES_APP_EVT_MIN + 0)
 | 
			
		||||
#define MSM_GES_APP_NOTIFY_ERROR_EVENT (MSM_GES_APP_EVT_MIN + 1)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_GES_APP_EVT_MAX (MSM_GES_APP_EVT_MIN + 2)
 | 
			
		||||
#define MSM_GESTURE_CID_CTRL_CMD V4L2_CID_BRIGHTNESS
 | 
			
		||||
#define MAX_GES_EVENTS 25
 | 
			
		||||
struct msm_ges_ctrl_cmd {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int type;
 | 
			
		||||
 void *value;
 | 
			
		||||
 int len;
 | 
			
		||||
 int fd;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t cookie;
 | 
			
		||||
};
 | 
			
		||||
struct msm_ges_evt {
 | 
			
		||||
 void *evt_data;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int evt_len;
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										429
									
								
								libc/kernel/common/media/msm_isp.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										429
									
								
								libc/kernel/common/media/msm_isp.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,429 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __MSM_ISP_H__
 | 
			
		||||
#define __MSM_ISP_H__
 | 
			
		||||
#define BIT(nr) (1UL << (nr))
 | 
			
		||||
#define MSG_ID_RESET_ACK 0
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_START_ACK 1
 | 
			
		||||
#define MSG_ID_STOP_ACK 2
 | 
			
		||||
#define MSG_ID_UPDATE_ACK 3
 | 
			
		||||
#define MSG_ID_OUTPUT_P 4
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_OUTPUT_T 5
 | 
			
		||||
#define MSG_ID_OUTPUT_S 6
 | 
			
		||||
#define MSG_ID_OUTPUT_V 7
 | 
			
		||||
#define MSG_ID_SNAPSHOT_DONE 8
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_STATS_AEC 9
 | 
			
		||||
#define MSG_ID_STATS_AF 10
 | 
			
		||||
#define MSG_ID_STATS_AWB 11
 | 
			
		||||
#define MSG_ID_STATS_RS 12
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_STATS_CS 13
 | 
			
		||||
#define MSG_ID_STATS_IHIST 14
 | 
			
		||||
#define MSG_ID_STATS_SKIN 15
 | 
			
		||||
#define MSG_ID_EPOCH1 16
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_EPOCH2 17
 | 
			
		||||
#define MSG_ID_SYNC_TIMER0_DONE 18
 | 
			
		||||
#define MSG_ID_SYNC_TIMER1_DONE 19
 | 
			
		||||
#define MSG_ID_SYNC_TIMER2_DONE 20
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_ASYNC_TIMER0_DONE 21
 | 
			
		||||
#define MSG_ID_ASYNC_TIMER1_DONE 22
 | 
			
		||||
#define MSG_ID_ASYNC_TIMER2_DONE 23
 | 
			
		||||
#define MSG_ID_ASYNC_TIMER3_DONE 24
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_AE_OVERFLOW 25
 | 
			
		||||
#define MSG_ID_AF_OVERFLOW 26
 | 
			
		||||
#define MSG_ID_AWB_OVERFLOW 27
 | 
			
		||||
#define MSG_ID_RS_OVERFLOW 28
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_CS_OVERFLOW 29
 | 
			
		||||
#define MSG_ID_IHIST_OVERFLOW 30
 | 
			
		||||
#define MSG_ID_SKIN_OVERFLOW 31
 | 
			
		||||
#define MSG_ID_AXI_ERROR 32
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_CAMIF_OVERFLOW 33
 | 
			
		||||
#define MSG_ID_VIOLATION 34
 | 
			
		||||
#define MSG_ID_CAMIF_ERROR 35
 | 
			
		||||
#define MSG_ID_BUS_OVERFLOW 36
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_SOF_ACK 37
 | 
			
		||||
#define MSG_ID_STOP_REC_ACK 38
 | 
			
		||||
#define MSG_ID_STATS_AWB_AEC 39
 | 
			
		||||
#define MSG_ID_OUTPUT_PRIMARY 40
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_OUTPUT_SECONDARY 41
 | 
			
		||||
#define MSG_ID_STATS_COMPOSITE 42
 | 
			
		||||
#define MSG_ID_OUTPUT_TERTIARY1 43
 | 
			
		||||
#define MSG_ID_STOP_LS_ACK 44
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_OUTPUT_TERTIARY2 45
 | 
			
		||||
#define MSG_ID_STATS_BG 46
 | 
			
		||||
#define MSG_ID_STATS_BF 47
 | 
			
		||||
#define MSG_ID_STATS_BHIST 48
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_RDI0_UPDATE_ACK 49
 | 
			
		||||
#define MSG_ID_RDI1_UPDATE_ACK 50
 | 
			
		||||
#define MSG_ID_RDI2_UPDATE_ACK 51
 | 
			
		||||
#define VFE_CMD_DUMMY_0 0
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_SET_CLK 1
 | 
			
		||||
#define VFE_CMD_RESET 2
 | 
			
		||||
#define VFE_CMD_START 3
 | 
			
		||||
#define VFE_CMD_TEST_GEN_START 4
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_OPERATION_CFG 5
 | 
			
		||||
#define VFE_CMD_AXI_OUT_CFG 6
 | 
			
		||||
#define VFE_CMD_CAMIF_CFG 7
 | 
			
		||||
#define VFE_CMD_AXI_INPUT_CFG 8
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_BLACK_LEVEL_CFG 9
 | 
			
		||||
#define VFE_CMD_MESH_ROLL_OFF_CFG 10
 | 
			
		||||
#define VFE_CMD_DEMUX_CFG 11
 | 
			
		||||
#define VFE_CMD_FOV_CFG 12
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_MAIN_SCALER_CFG 13
 | 
			
		||||
#define VFE_CMD_WB_CFG 14
 | 
			
		||||
#define VFE_CMD_COLOR_COR_CFG 15
 | 
			
		||||
#define VFE_CMD_RGB_G_CFG 16
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_LA_CFG 17
 | 
			
		||||
#define VFE_CMD_CHROMA_EN_CFG 18
 | 
			
		||||
#define VFE_CMD_CHROMA_SUP_CFG 19
 | 
			
		||||
#define VFE_CMD_MCE_CFG 20
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_SK_ENHAN_CFG 21
 | 
			
		||||
#define VFE_CMD_ASF_CFG 22
 | 
			
		||||
#define VFE_CMD_S2Y_CFG 23
 | 
			
		||||
#define VFE_CMD_S2CbCr_CFG 24
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_CHROMA_SUBS_CFG 25
 | 
			
		||||
#define VFE_CMD_OUT_CLAMP_CFG 26
 | 
			
		||||
#define VFE_CMD_FRAME_SKIP_CFG 27
 | 
			
		||||
#define VFE_CMD_DUMMY_1 28
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_DUMMY_2 29
 | 
			
		||||
#define VFE_CMD_DUMMY_3 30
 | 
			
		||||
#define VFE_CMD_UPDATE 31
 | 
			
		||||
#define VFE_CMD_BL_LVL_UPDATE 32
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_DEMUX_UPDATE 33
 | 
			
		||||
#define VFE_CMD_FOV_UPDATE 34
 | 
			
		||||
#define VFE_CMD_MAIN_SCALER_UPDATE 35
 | 
			
		||||
#define VFE_CMD_WB_UPDATE 36
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_COLOR_COR_UPDATE 37
 | 
			
		||||
#define VFE_CMD_RGB_G_UPDATE 38
 | 
			
		||||
#define VFE_CMD_LA_UPDATE 39
 | 
			
		||||
#define VFE_CMD_CHROMA_EN_UPDATE 40
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_CHROMA_SUP_UPDATE 41
 | 
			
		||||
#define VFE_CMD_MCE_UPDATE 42
 | 
			
		||||
#define VFE_CMD_SK_ENHAN_UPDATE 43
 | 
			
		||||
#define VFE_CMD_S2CbCr_UPDATE 44
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_S2Y_UPDATE 45
 | 
			
		||||
#define VFE_CMD_ASF_UPDATE 46
 | 
			
		||||
#define VFE_CMD_FRAME_SKIP_UPDATE 47
 | 
			
		||||
#define VFE_CMD_CAMIF_FRAME_UPDATE 48
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_STATS_AF_UPDATE 49
 | 
			
		||||
#define VFE_CMD_STATS_AE_UPDATE 50
 | 
			
		||||
#define VFE_CMD_STATS_AWB_UPDATE 51
 | 
			
		||||
#define VFE_CMD_STATS_RS_UPDATE 52
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_STATS_CS_UPDATE 53
 | 
			
		||||
#define VFE_CMD_STATS_SKIN_UPDATE 54
 | 
			
		||||
#define VFE_CMD_STATS_IHIST_UPDATE 55
 | 
			
		||||
#define VFE_CMD_DUMMY_4 56
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_EPOCH1_ACK 57
 | 
			
		||||
#define VFE_CMD_EPOCH2_ACK 58
 | 
			
		||||
#define VFE_CMD_START_RECORDING 59
 | 
			
		||||
#define VFE_CMD_STOP_RECORDING 60
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_DUMMY_5 61
 | 
			
		||||
#define VFE_CMD_DUMMY_6 62
 | 
			
		||||
#define VFE_CMD_CAPTURE 63
 | 
			
		||||
#define VFE_CMD_DUMMY_7 64
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_STOP 65
 | 
			
		||||
#define VFE_CMD_GET_HW_VERSION 66
 | 
			
		||||
#define VFE_CMD_GET_FRAME_SKIP_COUNTS 67
 | 
			
		||||
#define VFE_CMD_OUTPUT1_BUFFER_ENQ 68
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_OUTPUT2_BUFFER_ENQ 69
 | 
			
		||||
#define VFE_CMD_OUTPUT3_BUFFER_ENQ 70
 | 
			
		||||
#define VFE_CMD_JPEG_OUT_BUF_ENQ 71
 | 
			
		||||
#define VFE_CMD_RAW_OUT_BUF_ENQ 72
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_RAW_IN_BUF_ENQ 73
 | 
			
		||||
#define VFE_CMD_STATS_AF_ENQ 74
 | 
			
		||||
#define VFE_CMD_STATS_AE_ENQ 75
 | 
			
		||||
#define VFE_CMD_STATS_AWB_ENQ 76
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_STATS_RS_ENQ 77
 | 
			
		||||
#define VFE_CMD_STATS_CS_ENQ 78
 | 
			
		||||
#define VFE_CMD_STATS_SKIN_ENQ 79
 | 
			
		||||
#define VFE_CMD_STATS_IHIST_ENQ 80
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_DUMMY_8 81
 | 
			
		||||
#define VFE_CMD_JPEG_ENC_CFG 82
 | 
			
		||||
#define VFE_CMD_DUMMY_9 83
 | 
			
		||||
#define VFE_CMD_STATS_AF_START 84
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_STATS_AF_STOP 85
 | 
			
		||||
#define VFE_CMD_STATS_AE_START 86
 | 
			
		||||
#define VFE_CMD_STATS_AE_STOP 87
 | 
			
		||||
#define VFE_CMD_STATS_AWB_START 88
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_STATS_AWB_STOP 89
 | 
			
		||||
#define VFE_CMD_STATS_RS_START 90
 | 
			
		||||
#define VFE_CMD_STATS_RS_STOP 91
 | 
			
		||||
#define VFE_CMD_STATS_CS_START 92
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_STATS_CS_STOP 93
 | 
			
		||||
#define VFE_CMD_STATS_SKIN_START 94
 | 
			
		||||
#define VFE_CMD_STATS_SKIN_STOP 95
 | 
			
		||||
#define VFE_CMD_STATS_IHIST_START 96
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_STATS_IHIST_STOP 97
 | 
			
		||||
#define VFE_CMD_DUMMY_10 98
 | 
			
		||||
#define VFE_CMD_SYNC_TIMER_SETTING 99
 | 
			
		||||
#define VFE_CMD_ASYNC_TIMER_SETTING 100
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_LIVESHOT 101
 | 
			
		||||
#define VFE_CMD_LA_SETUP 102
 | 
			
		||||
#define VFE_CMD_LINEARIZATION_CFG 103
 | 
			
		||||
#define VFE_CMD_DEMOSAICV3 104
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_DEMOSAICV3_ABCC_CFG 105
 | 
			
		||||
#define VFE_CMD_DEMOSAICV3_DBCC_CFG 106
 | 
			
		||||
#define VFE_CMD_DEMOSAICV3_DBPC_CFG 107
 | 
			
		||||
#define VFE_CMD_DEMOSAICV3_ABF_CFG 108
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_DEMOSAICV3_ABCC_UPDATE 109
 | 
			
		||||
#define VFE_CMD_DEMOSAICV3_DBCC_UPDATE 110
 | 
			
		||||
#define VFE_CMD_DEMOSAICV3_DBPC_UPDATE 111
 | 
			
		||||
#define VFE_CMD_XBAR_CFG 112
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_MODULE_CFG 113
 | 
			
		||||
#define VFE_CMD_ZSL 114
 | 
			
		||||
#define VFE_CMD_LINEARIZATION_UPDATE 115
 | 
			
		||||
#define VFE_CMD_DEMOSAICV3_ABF_UPDATE 116
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_CLF_CFG 117
 | 
			
		||||
#define VFE_CMD_CLF_LUMA_UPDATE 118
 | 
			
		||||
#define VFE_CMD_CLF_CHROMA_UPDATE 119
 | 
			
		||||
#define VFE_CMD_PCA_ROLL_OFF_CFG 120
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_PCA_ROLL_OFF_UPDATE 121
 | 
			
		||||
#define VFE_CMD_GET_REG_DUMP 122
 | 
			
		||||
#define VFE_CMD_GET_LINEARIZATON_TABLE 123
 | 
			
		||||
#define VFE_CMD_GET_MESH_ROLLOFF_TABLE 124
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_GET_PCA_ROLLOFF_TABLE 125
 | 
			
		||||
#define VFE_CMD_GET_RGB_G_TABLE 126
 | 
			
		||||
#define VFE_CMD_GET_LA_TABLE 127
 | 
			
		||||
#define VFE_CMD_DEMOSAICV3_UPDATE 128
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_ACTIVE_REGION_CFG 129
 | 
			
		||||
#define VFE_CMD_COLOR_PROCESSING_CONFIG 130
 | 
			
		||||
#define VFE_CMD_STATS_WB_AEC_CONFIG 131
 | 
			
		||||
#define VFE_CMD_STATS_WB_AEC_UPDATE 132
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_Y_GAMMA_CONFIG 133
 | 
			
		||||
#define VFE_CMD_SCALE_OUTPUT1_CONFIG 134
 | 
			
		||||
#define VFE_CMD_SCALE_OUTPUT2_CONFIG 135
 | 
			
		||||
#define VFE_CMD_CAPTURE_RAW 136
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_STOP_LIVESHOT 137
 | 
			
		||||
#define VFE_CMD_RECONFIG_VFE 138
 | 
			
		||||
#define VFE_CMD_STATS_REQBUF 139
 | 
			
		||||
#define VFE_CMD_STATS_ENQUEUEBUF 140
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_STATS_FLUSH_BUFQ 141
 | 
			
		||||
#define VFE_CMD_STATS_UNREGBUF 142
 | 
			
		||||
#define VFE_CMD_STATS_BG_START 143
 | 
			
		||||
#define VFE_CMD_STATS_BG_STOP 144
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_STATS_BF_START 145
 | 
			
		||||
#define VFE_CMD_STATS_BF_STOP 146
 | 
			
		||||
#define VFE_CMD_STATS_BHIST_START 147
 | 
			
		||||
#define VFE_CMD_STATS_BHIST_STOP 148
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_RESET_2 149
 | 
			
		||||
#define VFE_CMD_FOV_ENC_CFG 150
 | 
			
		||||
#define VFE_CMD_FOV_VIEW_CFG 151
 | 
			
		||||
#define VFE_CMD_FOV_ENC_UPDATE 152
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_FOV_VIEW_UPDATE 153
 | 
			
		||||
#define VFE_CMD_SCALER_ENC_CFG 154
 | 
			
		||||
#define VFE_CMD_SCALER_VIEW_CFG 155
 | 
			
		||||
#define VFE_CMD_SCALER_ENC_UPDATE 156
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_SCALER_VIEW_UPDATE 157
 | 
			
		||||
#define VFE_CMD_COLORXFORM_ENC_CFG 158
 | 
			
		||||
#define VFE_CMD_COLORXFORM_VIEW_CFG 159
 | 
			
		||||
#define VFE_CMD_COLORXFORM_ENC_UPDATE 160
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_COLORXFORM_VIEW_UPDATE 161
 | 
			
		||||
#define VFE_CMD_TEST_GEN_CFG 162
 | 
			
		||||
struct msm_isp_cmd {
 | 
			
		||||
 int32_t id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint16_t length;
 | 
			
		||||
 void *value;
 | 
			
		||||
};
 | 
			
		||||
#define VPE_CMD_DUMMY_0 0
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VPE_CMD_INIT 1
 | 
			
		||||
#define VPE_CMD_DEINIT 2
 | 
			
		||||
#define VPE_CMD_ENABLE 3
 | 
			
		||||
#define VPE_CMD_DISABLE 4
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VPE_CMD_RESET 5
 | 
			
		||||
#define VPE_CMD_FLUSH 6
 | 
			
		||||
#define VPE_CMD_OPERATION_MODE_CFG 7
 | 
			
		||||
#define VPE_CMD_INPUT_PLANE_CFG 8
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VPE_CMD_OUTPUT_PLANE_CFG 9
 | 
			
		||||
#define VPE_CMD_INPUT_PLANE_UPDATE 10
 | 
			
		||||
#define VPE_CMD_SCALE_CFG_TYPE 11
 | 
			
		||||
#define VPE_CMD_ZOOM 13
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VPE_CMD_MAX 14
 | 
			
		||||
#define MSM_PP_CMD_TYPE_NOT_USED 0
 | 
			
		||||
#define MSM_PP_CMD_TYPE_VPE 1
 | 
			
		||||
#define MSM_PP_CMD_TYPE_MCTL 2
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MCTL_CMD_DUMMY_0 0
 | 
			
		||||
#define MCTL_CMD_GET_FRAME_BUFFER 1
 | 
			
		||||
#define MCTL_CMD_PUT_FRAME_BUFFER 2
 | 
			
		||||
#define MCTL_CMD_DIVERT_FRAME_PP_PATH 3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MCTL_PP_EVENT_NOTUSED 0
 | 
			
		||||
#define MCTL_PP_EVENT_CMD_ACK 1
 | 
			
		||||
#define VPE_OPERATION_MODE_CFG_LEN 4
 | 
			
		||||
#define VPE_INPUT_PLANE_CFG_LEN 24
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VPE_OUTPUT_PLANE_CFG_LEN 20
 | 
			
		||||
#define VPE_INPUT_PLANE_UPDATE_LEN 12
 | 
			
		||||
#define VPE_SCALER_CONFIG_LEN 260
 | 
			
		||||
#define VPE_DIS_OFFSET_CFG_LEN 12
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define CAPTURE_WIDTH 1280
 | 
			
		||||
#define IMEM_Y_SIZE (CAPTURE_WIDTH*16)
 | 
			
		||||
#define IMEM_CBCR_SIZE (CAPTURE_WIDTH*8)
 | 
			
		||||
#define IMEM_Y_PING_OFFSET 0x2E000000
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define IMEM_CBCR_PING_OFFSET (IMEM_Y_PING_OFFSET + IMEM_Y_SIZE)
 | 
			
		||||
#define IMEM_Y_PONG_OFFSET (IMEM_CBCR_PING_OFFSET + IMEM_CBCR_SIZE)
 | 
			
		||||
#define IMEM_CBCR_PONG_OFFSET (IMEM_Y_PONG_OFFSET + IMEM_Y_SIZE)
 | 
			
		||||
struct msm_vpe_op_mode_cfg {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint8_t op_mode_cfg[VPE_OPERATION_MODE_CFG_LEN];
 | 
			
		||||
};
 | 
			
		||||
struct msm_vpe_input_plane_cfg {
 | 
			
		||||
 uint8_t input_plane_cfg[VPE_INPUT_PLANE_CFG_LEN];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct msm_vpe_output_plane_cfg {
 | 
			
		||||
 uint8_t output_plane_cfg[VPE_OUTPUT_PLANE_CFG_LEN];
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_vpe_input_plane_update_cfg {
 | 
			
		||||
 uint8_t input_plane_update_cfg[VPE_INPUT_PLANE_UPDATE_LEN];
 | 
			
		||||
};
 | 
			
		||||
struct msm_vpe_scaler_cfg {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint8_t scaler_cfg[VPE_SCALER_CONFIG_LEN];
 | 
			
		||||
};
 | 
			
		||||
struct msm_vpe_flush_frame_buffer {
 | 
			
		||||
 uint32_t src_buf_handle;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t dest_buf_handle;
 | 
			
		||||
 int path;
 | 
			
		||||
};
 | 
			
		||||
struct msm_mctl_pp_frame_buffer {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t buf_handle;
 | 
			
		||||
 int path;
 | 
			
		||||
};
 | 
			
		||||
struct msm_mctl_pp_divert_pp {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int path;
 | 
			
		||||
 int enable;
 | 
			
		||||
};
 | 
			
		||||
struct msm_vpe_clock_rate {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t rate;
 | 
			
		||||
};
 | 
			
		||||
struct msm_pp_crop {
 | 
			
		||||
 uint32_t src_x;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t src_y;
 | 
			
		||||
 uint32_t src_w;
 | 
			
		||||
 uint32_t src_h;
 | 
			
		||||
 uint32_t dst_x;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t dst_y;
 | 
			
		||||
 uint32_t dst_w;
 | 
			
		||||
 uint32_t dst_h;
 | 
			
		||||
 uint8_t update_flag;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#define MSM_MCTL_PP_VPE_FRAME_ACK (1<<0)
 | 
			
		||||
#define MSM_MCTL_PP_VPE_FRAME_TO_APP (1<<1)
 | 
			
		||||
struct msm_mctl_pp_frame_cmd {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t cookie;
 | 
			
		||||
 uint8_t vpe_output_action;
 | 
			
		||||
 uint32_t src_buf_handle;
 | 
			
		||||
 uint32_t dest_buf_handle;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct msm_pp_crop crop;
 | 
			
		||||
 int path;
 | 
			
		||||
};
 | 
			
		||||
#define VFE_OUTPUTS_MAIN_AND_PREVIEW BIT(0)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_OUTPUTS_MAIN_AND_VIDEO BIT(1)
 | 
			
		||||
#define VFE_OUTPUTS_MAIN_AND_THUMB BIT(2)
 | 
			
		||||
#define VFE_OUTPUTS_THUMB_AND_MAIN BIT(3)
 | 
			
		||||
#define VFE_OUTPUTS_PREVIEW_AND_VIDEO BIT(4)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_OUTPUTS_VIDEO_AND_PREVIEW BIT(5)
 | 
			
		||||
#define VFE_OUTPUTS_PREVIEW BIT(6)
 | 
			
		||||
#define VFE_OUTPUTS_VIDEO BIT(7)
 | 
			
		||||
#define VFE_OUTPUTS_RAW BIT(8)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_OUTPUTS_JPEG_AND_THUMB BIT(9)
 | 
			
		||||
#define VFE_OUTPUTS_THUMB_AND_JPEG BIT(10)
 | 
			
		||||
#define VFE_OUTPUTS_RDI0 BIT(11)
 | 
			
		||||
#define VFE_OUTPUTS_RDI1 BIT(12)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_frame_info {
 | 
			
		||||
 uint32_t inst_handle;
 | 
			
		||||
 uint32_t path;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										106
									
								
								libc/kernel/common/media/msm_mercury.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										106
									
								
								libc/kernel/common/media/msm_mercury.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,106 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __LINUX_MSM_MERCURY_H
 | 
			
		||||
#define __LINUX_MSM_MERCURY_H
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#include <linux/ioctl.h>
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_MERCURY_HW_VERSION_REG 0x0004
 | 
			
		||||
#define OUTPUT_H2V1 0
 | 
			
		||||
#define OUTPUT_H2V2 1
 | 
			
		||||
#define OUTPUT_BYTE 6
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_MERCURY_MODE_REALTIME_ENCODE 0
 | 
			
		||||
#define MSM_MERCURY_MODE_OFFLINE_ENCODE 1
 | 
			
		||||
#define MSM_MERCURY_MODE_REALTIME_ROTATION 2
 | 
			
		||||
#define MSM_MERCURY_MODE_OFFLINE_ROTATION 3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_MERCURY_EVT_RESET 1
 | 
			
		||||
#define MSM_MERCURY_EVT_FRAMEDONE 2
 | 
			
		||||
#define MSM_MERCURY_EVT_ERR 3
 | 
			
		||||
#define MSM_MERCURY_EVT_UNBLOCK 4
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_MERCURY_HW_CMD_TYPE_READ 0
 | 
			
		||||
#define MSM_MERCURY_HW_CMD_TYPE_WRITE 1
 | 
			
		||||
#define MSM_MERCURY_HW_CMD_TYPE_WRITE_OR 2
 | 
			
		||||
#define MSM_MERCURY_HW_CMD_TYPE_UWAIT 3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_MERCURY_HW_CMD_TYPE_MWAIT 4
 | 
			
		||||
#define MSM_MERCURY_HW_CMD_TYPE_MDELAY 5
 | 
			
		||||
#define MSM_MERCURY_HW_CMD_TYPE_UDELAY 6
 | 
			
		||||
#define MSM_MCR_IOCTL_MAGIC 'g'
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_MCR_IOCTL_GET_HW_VERSION   _IOW(MSM_MCR_IOCTL_MAGIC, 1, struct msm_mercury_hw_cmd *)
 | 
			
		||||
#define MSM_MCR_IOCTL_RESET   _IOW(MSM_MCR_IOCTL_MAGIC, 2, struct msm_mercury_ctrl_cmd *)
 | 
			
		||||
#define MSM_MCR_IOCTL_STOP   _IOW(MSM_MCR_IOCTL_MAGIC, 3, struct msm_mercury_hw_cmds *)
 | 
			
		||||
#define MSM_MCR_IOCTL_START   _IOW(MSM_MCR_IOCTL_MAGIC, 4, struct msm_mercury_hw_cmds *)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_MCR_IOCTL_INPUT_BUF_CFG   _IOW(MSM_MCR_IOCTL_MAGIC, 5, struct msm_mercury_buf *)
 | 
			
		||||
#define MSM_MCR_IOCTL_INPUT_GET   _IOW(MSM_MCR_IOCTL_MAGIC, 6, struct msm_mercury_buf *)
 | 
			
		||||
#define MSM_MCR_IOCTL_INPUT_GET_UNBLOCK   _IOW(MSM_MCR_IOCTL_MAGIC, 7, int)
 | 
			
		||||
#define MSM_MCR_IOCTL_OUTPUT_BUF_CFG   _IOW(MSM_MCR_IOCTL_MAGIC, 8, struct msm_mercury_buf *)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_MCR_IOCTL_OUTPUT_GET   _IOW(MSM_MCR_IOCTL_MAGIC, 9, struct msm_mercury_buf *)
 | 
			
		||||
#define MSM_MCR_IOCTL_OUTPUT_GET_UNBLOCK   _IOW(MSM_MCR_IOCTL_MAGIC, 10, int)
 | 
			
		||||
#define MSM_MCR_IOCTL_EVT_GET   _IOW(MSM_MCR_IOCTL_MAGIC, 11, struct msm_mercury_ctrl_cmd *)
 | 
			
		||||
#define MSM_MCR_IOCTL_EVT_GET_UNBLOCK   _IOW(MSM_MCR_IOCTL_MAGIC, 12, int)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_MCR_IOCTL_HW_CMD   _IOW(MSM_MCR_IOCTL_MAGIC, 13, struct msm_mercury_hw_cmd *)
 | 
			
		||||
#define MSM_MCR_IOCTL_HW_CMDS   _IOW(MSM_MCR_IOCTL_MAGIC, 14, struct msm_mercury_hw_cmds *)
 | 
			
		||||
#define MSM_MCR_IOCTL_TEST_DUMP_REGION   _IOW(MSM_MCR_IOCTL_MAGIC, 15, unsigned long)
 | 
			
		||||
struct msm_mercury_ctrl_cmd {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t type;
 | 
			
		||||
 uint32_t len;
 | 
			
		||||
 void *value;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_mercury_buf {
 | 
			
		||||
 uint32_t type;
 | 
			
		||||
 int fd;
 | 
			
		||||
 void *vaddr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t y_off;
 | 
			
		||||
 uint32_t y_len;
 | 
			
		||||
 uint32_t framedone_len;
 | 
			
		||||
 uint32_t cbcr_off;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t cbcr_len;
 | 
			
		||||
 uint32_t num_of_mcu_rows;
 | 
			
		||||
 uint32_t offset;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_mercury_hw_cmd {
 | 
			
		||||
 uint32_t type:4;
 | 
			
		||||
 uint32_t n:12;
 | 
			
		||||
 uint32_t offset:16;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t mask;
 | 
			
		||||
 union {
 | 
			
		||||
 uint32_t data;
 | 
			
		||||
 uint32_t *pdata;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 };
 | 
			
		||||
};
 | 
			
		||||
struct msm_mercury_hw_cmds {
 | 
			
		||||
 uint32_t m;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct msm_mercury_hw_cmd hw_cmd[1];
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,115 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __COMPRESS_OFFLOAD_H
 | 
			
		||||
#define __COMPRESS_OFFLOAD_H
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#include <sound/asound.h>
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#include <sound/compress_params.h>
 | 
			
		||||
#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 1)
 | 
			
		||||
struct snd_compressed_buffer {
 | 
			
		||||
 __u32 fragment_size;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 fragments;
 | 
			
		||||
};
 | 
			
		||||
struct snd_compr_params {
 | 
			
		||||
 struct snd_compressed_buffer buffer;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct snd_codec codec;
 | 
			
		||||
 __u8 no_wake_mode;
 | 
			
		||||
};
 | 
			
		||||
struct snd_compr_tstamp {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 byte_offset;
 | 
			
		||||
 __u32 copied_total;
 | 
			
		||||
 snd_pcm_uframes_t pcm_frames;
 | 
			
		||||
 snd_pcm_uframes_t pcm_io_frames;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 sampling_rate;
 | 
			
		||||
 uint64_t timestamp;
 | 
			
		||||
};
 | 
			
		||||
struct snd_compr_avail {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u64 avail;
 | 
			
		||||
 struct snd_compr_tstamp tstamp;
 | 
			
		||||
};
 | 
			
		||||
enum snd_compr_direction {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 SND_COMPRESS_PLAYBACK = 0,
 | 
			
		||||
 SND_COMPRESS_CAPTURE
 | 
			
		||||
};
 | 
			
		||||
struct snd_compr_caps {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 num_codecs;
 | 
			
		||||
 __u32 direction;
 | 
			
		||||
 __u32 min_fragment_size;
 | 
			
		||||
 __u32 max_fragment_size;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 min_fragments;
 | 
			
		||||
 __u32 max_fragments;
 | 
			
		||||
 __u32 codecs[MAX_NUM_CODECS];
 | 
			
		||||
 __u32 reserved[11];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct snd_compr_codec_caps {
 | 
			
		||||
 __u32 codec;
 | 
			
		||||
 __u32 num_descriptors;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS];
 | 
			
		||||
};
 | 
			
		||||
enum {
 | 
			
		||||
 SNDRV_COMPRESS_ENCODER_PADDING = 1,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 SNDRV_COMPRESS_ENCODER_DELAY = 2,
 | 
			
		||||
};
 | 
			
		||||
struct snd_compr_metadata {
 | 
			
		||||
 __u32 key;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 value[8];
 | 
			
		||||
};
 | 
			
		||||
struct snd_compr_audio_info {
 | 
			
		||||
 uint32_t frame_size;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t reserved[15];
 | 
			
		||||
};
 | 
			
		||||
#define SNDRV_COMPRESS_IOCTL_VERSION _IOR('C', 0x00, int)
 | 
			
		||||
#define SNDRV_COMPRESS_GET_CAPS _IOWR('C', 0x10, struct snd_compr_caps)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SNDRV_COMPRESS_GET_CODEC_CAPS _IOWR('C', 0x11,  struct snd_compr_codec_caps)
 | 
			
		||||
#define SNDRV_COMPRESS_SET_PARAMS _IOW('C', 0x12, struct snd_compr_params)
 | 
			
		||||
#define SNDRV_COMPRESS_GET_PARAMS _IOR('C', 0x13, struct snd_codec)
 | 
			
		||||
#define SNDRV_COMPRESS_SET_METADATA _IOW('C', 0x14,  struct snd_compr_metadata)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SNDRV_COMPRESS_GET_METADATA _IOWR('C', 0x15,  struct snd_compr_metadata)
 | 
			
		||||
#define SNDRV_COMPRESS_TSTAMP _IOR('C', 0x20, struct snd_compr_tstamp)
 | 
			
		||||
#define SNDRV_COMPRESS_AVAIL _IOR('C', 0x21, struct snd_compr_avail)
 | 
			
		||||
#define SNDRV_COMPRESS_PAUSE _IO('C', 0x30)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SNDRV_COMPRESS_RESUME _IO('C', 0x31)
 | 
			
		||||
#define SNDRV_COMPRESS_START _IO('C', 0x32)
 | 
			
		||||
#define SNDRV_COMPRESS_STOP _IO('C', 0x33)
 | 
			
		||||
#define SNDRV_COMPRESS_DRAIN _IO('C', 0x34)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SNDRV_COMPRESS_NEXT_TRACK _IO('C', 0x35)
 | 
			
		||||
#define SNDRV_COMPRESS_PARTIAL_DRAIN _IO('C', 0x36)
 | 
			
		||||
#define SND_COMPR_TRIGGER_DRAIN 7
 | 
			
		||||
#define SND_COMPR_TRIGGER_NEXT_TRACK 8
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_COMPR_TRIGGER_PARTIAL_DRAIN 9
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,265 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __SND_COMPRESS_PARAMS_H
 | 
			
		||||
#define __SND_COMPRESS_PARAMS_H
 | 
			
		||||
#define MAX_NUM_CODECS 32
 | 
			
		||||
#define MAX_NUM_CODEC_DESCRIPTORS 32
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MAX_NUM_BITRATES 32
 | 
			
		||||
#define MAX_NUM_FRAMES_PER_BUFFER 1
 | 
			
		||||
#define COMPRESSED_META_DATA_MODE 0x10
 | 
			
		||||
#define META_DATA_LEN_BYTES 36
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define Q6_AC3_DECODER 0x00010BF6
 | 
			
		||||
#define Q6_EAC3_DECODER 0x00010C3C
 | 
			
		||||
#define Q6_DTS 0x00010D88
 | 
			
		||||
#define Q6_DTS_LBR 0x00010DBB
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOCODEC_PCM ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOCODEC_MP3 ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOCODEC_AMR ((__u32) 0x00000003)
 | 
			
		||||
#define SND_AUDIOCODEC_AMRWB ((__u32) 0x00000004)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOCODEC_AMRWBPLUS ((__u32) 0x00000005)
 | 
			
		||||
#define SND_AUDIOCODEC_AAC ((__u32) 0x00000006)
 | 
			
		||||
#define SND_AUDIOCODEC_WMA ((__u32) 0x00000007)
 | 
			
		||||
#define SND_AUDIOCODEC_REAL ((__u32) 0x00000008)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOCODEC_VORBIS ((__u32) 0x00000009)
 | 
			
		||||
#define SND_AUDIOCODEC_FLAC ((__u32) 0x0000000A)
 | 
			
		||||
#define SND_AUDIOCODEC_IEC61937 ((__u32) 0x0000000B)
 | 
			
		||||
#define SND_AUDIOCODEC_G723_1 ((__u32) 0x0000000C)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOCODEC_G729 ((__u32) 0x0000000D)
 | 
			
		||||
#define SND_AUDIOCODEC_AC3 ((__u32) 0x0000000E)
 | 
			
		||||
#define SND_AUDIOCODEC_DTS ((__u32) 0x0000000F)
 | 
			
		||||
#define SND_AUDIOCODEC_AC3_PASS_THROUGH ((__u32) 0x00000010)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOCODEC_WMA_PRO ((__u32) 0x00000011)
 | 
			
		||||
#define SND_AUDIOCODEC_DTS_PASS_THROUGH ((__u32) 0x00000012)
 | 
			
		||||
#define SND_AUDIOCODEC_DTS_LBR ((__u32) 0x00000013)
 | 
			
		||||
#define SND_AUDIOCODEC_DTS_TRANSCODE_LOOPBACK ((__u32) 0x00000014)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_DTS_TRANSCODE_LOOPBACK
 | 
			
		||||
#define SND_AUDIOPROFILE_PCM ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOCHANMODE_MP3_MONO ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOCHANMODE_MP3_STEREO ((__u32) 0x00000002)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOCHANMODE_MP3_JOINTSTEREO ((__u32) 0x00000004)
 | 
			
		||||
#define SND_AUDIOCHANMODE_MP3_DUAL ((__u32) 0x00000008)
 | 
			
		||||
#define SND_AUDIOPROFILE_AMR ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOMODE_AMR_DTX_OFF ((__u32) 0x00000001)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_AMR_VAD1 ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOMODE_AMR_VAD2 ((__u32) 0x00000004)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_UNDEFINED ((__u32) 0x00000000)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_CONFORMANCE ((__u32) 0x00000001)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_IF1 ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_IF2 ((__u32) 0x00000004)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_FSF ((__u32) 0x00000008)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_RTPPAYLOAD ((__u32) 0x00000010)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_ITU ((__u32) 0x00000020)
 | 
			
		||||
#define SND_AUDIOPROFILE_AMRWB ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOMODE_AMRWB_DTX_OFF ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOMODE_AMRWB_VAD1 ((__u32) 0x00000002)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_AMRWB_VAD2 ((__u32) 0x00000004)
 | 
			
		||||
#define SND_AUDIOPROFILE_AMRWBPLUS ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOPROFILE_AAC ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOMODE_AAC_MAIN ((__u32) 0x00000001)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_AAC_LC ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOMODE_AAC_SSR ((__u32) 0x00000004)
 | 
			
		||||
#define SND_AUDIOMODE_AAC_LTP ((__u32) 0x00000008)
 | 
			
		||||
#define SND_AUDIOMODE_AAC_HE ((__u32) 0x00000010)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_AAC_SCALABLE ((__u32) 0x00000020)
 | 
			
		||||
#define SND_AUDIOMODE_AAC_ERLC ((__u32) 0x00000040)
 | 
			
		||||
#define SND_AUDIOMODE_AAC_LD ((__u32) 0x00000080)
 | 
			
		||||
#define SND_AUDIOMODE_AAC_HE_PS ((__u32) 0x00000100)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_AAC_HE_MPS ((__u32) 0x00000200)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_MP2ADTS ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_MP4ADTS ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_MP4LOAS ((__u32) 0x00000004)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_MP4LATM ((__u32) 0x00000008)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_ADIF ((__u32) 0x00000010)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_MP4FF ((__u32) 0x00000020)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_RAW ((__u32) 0x00000040)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOPROFILE_WMA7 ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOPROFILE_WMA8 ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOPROFILE_WMA9 ((__u32) 0x00000004)
 | 
			
		||||
#define SND_AUDIOPROFILE_WMA10 ((__u32) 0x00000008)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_WMA_LEVEL1 ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOMODE_WMA_LEVEL2 ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOMODE_WMA_LEVEL3 ((__u32) 0x00000004)
 | 
			
		||||
#define SND_AUDIOMODE_WMA_LEVEL4 ((__u32) 0x00000008)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_WMAPRO_LEVELM0 ((__u32) 0x00000010)
 | 
			
		||||
#define SND_AUDIOMODE_WMAPRO_LEVELM1 ((__u32) 0x00000020)
 | 
			
		||||
#define SND_AUDIOMODE_WMAPRO_LEVELM2 ((__u32) 0x00000040)
 | 
			
		||||
#define SND_AUDIOMODE_WMAPRO_LEVELM3 ((__u32) 0x00000080)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_WMA_ASF ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_WMA_NOASF_HDR ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOPROFILE_REALAUDIO ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOMODE_REALAUDIO_G2 ((__u32) 0x00000001)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_REALAUDIO_8 ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOMODE_REALAUDIO_10 ((__u32) 0x00000004)
 | 
			
		||||
#define SND_AUDIOMODE_REALAUDIO_SURROUND ((__u32) 0x00000008)
 | 
			
		||||
#define SND_AUDIOPROFILE_VORBIS ((__u32) 0x00000001)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_VORBIS ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOPROFILE_FLAC ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOMODE_FLAC_LEVEL0 ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOMODE_FLAC_LEVEL1 ((__u32) 0x00000002)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_FLAC_LEVEL2 ((__u32) 0x00000004)
 | 
			
		||||
#define SND_AUDIOMODE_FLAC_LEVEL3 ((__u32) 0x00000008)
 | 
			
		||||
#define SND_AUDIOMODE_FLAC_LEVEL4 ((__u32) 0x00000010)
 | 
			
		||||
#define SND_AUDIOMODE_FLAC_LEVEL5 ((__u32) 0x00000020)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_FLAC_LEVEL6 ((__u32) 0x00000040)
 | 
			
		||||
#define SND_AUDIOMODE_FLAC_LEVEL7 ((__u32) 0x00000080)
 | 
			
		||||
#define SND_AUDIOMODE_FLAC_LEVEL8 ((__u32) 0x00000100)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_FLAC ((__u32) 0x00000001)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_FLAC_OGG ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOPROFILE_IEC61937 ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOPROFILE_IEC61937_SPDIF ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_REF_STREAM_HEADER ((__u32) 0x00000000)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_IEC_LPCM ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_AC3 ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_MPEG1 ((__u32) 0x00000004)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_MP3 ((__u32) 0x00000008)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_IEC_MPEG2 ((__u32) 0x00000010)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_AACLC ((__u32) 0x00000020)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_DTS ((__u32) 0x00000040)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_ATRAC ((__u32) 0x00000080)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_IEC_SACD ((__u32) 0x00000100)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_EAC3 ((__u32) 0x00000200)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_DTS_HD ((__u32) 0x00000400)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_MLP ((__u32) 0x00000800)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_IEC_DST ((__u32) 0x00001000)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_WMAPRO ((__u32) 0x00002000)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_REF_CXT ((__u32) 0x00004000)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_HE_AAC ((__u32) 0x00008000)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_IEC_HE_AAC2 ((__u32) 0x00010000)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_MPEG_SURROUND ((__u32) 0x00020000)
 | 
			
		||||
#define SND_AUDIOPROFILE_G723_1 ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOMODE_G723_1_ANNEX_A ((__u32) 0x00000001)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_G723_1_ANNEX_B ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOMODE_G723_1_ANNEX_C ((__u32) 0x00000004)
 | 
			
		||||
#define SND_AUDIOPROFILE_G729 ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOMODE_G729_ANNEX_A ((__u32) 0x00000001)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_G729_ANNEX_B ((__u32) 0x00000002)
 | 
			
		||||
#define SND_RATECONTROLMODE_CONSTANTBITRATE ((__u32) 0x00000001)
 | 
			
		||||
#define SND_RATECONTROLMODE_VARIABLEBITRATE ((__u32) 0x00000002)
 | 
			
		||||
struct snd_enc_wma {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 super_block_align;
 | 
			
		||||
 __u32 bits_per_sample;
 | 
			
		||||
 __u32 channelmask;
 | 
			
		||||
 __u32 encodeopt;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 encodeopt1;
 | 
			
		||||
 __u32 encodeopt2;
 | 
			
		||||
};
 | 
			
		||||
struct snd_enc_vorbis {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __s32 quality;
 | 
			
		||||
 __u32 managed;
 | 
			
		||||
 __u32 max_bit_rate;
 | 
			
		||||
 __u32 min_bit_rate;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 downmix;
 | 
			
		||||
};
 | 
			
		||||
struct snd_enc_real {
 | 
			
		||||
 __u32 quant_bits;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 start_region;
 | 
			
		||||
 __u32 num_regions;
 | 
			
		||||
};
 | 
			
		||||
struct snd_enc_flac {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 num;
 | 
			
		||||
 __u32 gain;
 | 
			
		||||
};
 | 
			
		||||
struct snd_enc_generic {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 bw;
 | 
			
		||||
 __s32 reserved[15];
 | 
			
		||||
};
 | 
			
		||||
union snd_codec_options {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct snd_enc_wma wma;
 | 
			
		||||
 struct snd_enc_vorbis vorbis;
 | 
			
		||||
 struct snd_enc_real real;
 | 
			
		||||
 struct snd_enc_flac flac;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct snd_enc_generic generic;
 | 
			
		||||
};
 | 
			
		||||
struct snd_codec_desc {
 | 
			
		||||
 __u32 max_ch;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 sample_rates;
 | 
			
		||||
 __u32 bit_rate[MAX_NUM_BITRATES];
 | 
			
		||||
 __u32 num_bitrates;
 | 
			
		||||
 __u32 rate_control;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 profiles;
 | 
			
		||||
 __u32 modes;
 | 
			
		||||
 __u32 formats;
 | 
			
		||||
 __u32 min_buffer;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 reserved[15];
 | 
			
		||||
};
 | 
			
		||||
struct snd_codec {
 | 
			
		||||
 __u32 id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 ch_in;
 | 
			
		||||
 __u32 ch_out;
 | 
			
		||||
 __u32 sample_rate;
 | 
			
		||||
 __u32 bit_rate;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 rate_control;
 | 
			
		||||
 __u32 profile;
 | 
			
		||||
 __u32 level;
 | 
			
		||||
 __u32 ch_mode;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 format;
 | 
			
		||||
 __u32 align;
 | 
			
		||||
 union snd_codec_options options;
 | 
			
		||||
 __u32 reserved[3];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
@@ -56,7 +56,6 @@
 | 
			
		||||
 | 
			
		||||
#include <sys/param.h>
 | 
			
		||||
#include <sys/socket.h>
 | 
			
		||||
#include <sys/un.h>
 | 
			
		||||
#include <netinet/in.h>
 | 
			
		||||
#include <arpa/inet.h>
 | 
			
		||||
#include "arpa_nameser.h"
 | 
			
		||||
@@ -70,7 +69,6 @@
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <strings.h>
 | 
			
		||||
#include <syslog.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
 | 
			
		||||
#ifndef LOG_AUTH
 | 
			
		||||
# define LOG_AUTH 0
 | 
			
		||||
@@ -82,9 +80,6 @@
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
// This should be synchronized to ResponseCode.h
 | 
			
		||||
static const int DnsProxyQueryResult = 222;
 | 
			
		||||
 | 
			
		||||
static const char const AskedForGot[] =
 | 
			
		||||
			  "gethostby*.getanswer: asked for \"%s\", got \"%s\"";
 | 
			
		||||
 | 
			
		||||
@@ -126,7 +121,7 @@ static struct hostent *_gethtbyname2(const char *, int);
 | 
			
		||||
static int _dns_gethtbyaddr(void *, void *, va_list);
 | 
			
		||||
static int _dns_gethtbyname(void *, void *, va_list);
 | 
			
		||||
 | 
			
		||||
static struct hostent *gethostbyname_internal(const char *, int, res_state, const char *);
 | 
			
		||||
static struct hostent *gethostbyname_internal(const char *, int, res_state);
 | 
			
		||||
 | 
			
		||||
static const ns_src default_dns_files[] = {
 | 
			
		||||
	{ NSSRC_FILES, 	NS_SUCCESS },
 | 
			
		||||
@@ -495,136 +490,40 @@ gethostbyname(const char *name)
 | 
			
		||||
 | 
			
		||||
	assert(name != NULL);
 | 
			
		||||
 | 
			
		||||
	/* try IPv6 first - if that fails do IPv4 */
 | 
			
		||||
	if (res->options & RES_USE_INET6) {
 | 
			
		||||
		hp = gethostbyname_internal(name, AF_INET6, res, NULL);
 | 
			
		||||
		hp = gethostbyname_internal(name, AF_INET6, res);
 | 
			
		||||
		if (hp) {
 | 
			
		||||
			__res_put_state(res);
 | 
			
		||||
			return hp;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	hp = gethostbyname_internal(name, AF_INET, res, NULL);
 | 
			
		||||
	hp = gethostbyname_internal(name, AF_INET, res);
 | 
			
		||||
	__res_put_state(res);
 | 
			
		||||
	return hp;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct hostent *
 | 
			
		||||
gethostbyname2(const char *name, int af)
 | 
			
		||||
{
 | 
			
		||||
	return android_gethostbynameforiface(name, af, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct hostent *
 | 
			
		||||
android_gethostbynameforiface(const char *name, int af, const char *iface)
 | 
			
		||||
{
 | 
			
		||||
	struct hostent *hp;
 | 
			
		||||
	res_state res = __res_get_state();
 | 
			
		||||
 | 
			
		||||
	if (res == NULL)
 | 
			
		||||
		return NULL;
 | 
			
		||||
	hp = gethostbyname_internal(name, af, res, iface);
 | 
			
		||||
	hp = gethostbyname_internal(name, af, res);
 | 
			
		||||
	__res_put_state(res);
 | 
			
		||||
	return hp;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static FILE* android_open_proxy()
 | 
			
		||||
{
 | 
			
		||||
	int sock;
 | 
			
		||||
	const int one = 1;
 | 
			
		||||
	struct sockaddr_un proxy_addr;
 | 
			
		||||
 | 
			
		||||
	sock = socket(AF_UNIX, SOCK_STREAM, 0);
 | 
			
		||||
	if (sock < 0) {
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
 | 
			
		||||
	memset(&proxy_addr, 0, sizeof(proxy_addr));
 | 
			
		||||
	proxy_addr.sun_family = AF_UNIX;
 | 
			
		||||
	strlcpy(proxy_addr.sun_path, "/dev/socket/dnsproxyd", sizeof(proxy_addr.sun_path));
 | 
			
		||||
	if (TEMP_FAILURE_RETRY(connect(sock,
 | 
			
		||||
			(const struct sockaddr*) &proxy_addr,
 | 
			
		||||
			sizeof(proxy_addr))) != 0) {
 | 
			
		||||
		close(sock);
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return fdopen(sock, "r+");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static struct hostent *
 | 
			
		||||
android_read_hostent(FILE* proxy)
 | 
			
		||||
{
 | 
			
		||||
	uint32_t size;
 | 
			
		||||
	char buf[4];
 | 
			
		||||
	if (fread(buf, 1, sizeof(buf), proxy) != sizeof(buf)) return NULL;
 | 
			
		||||
 | 
			
		||||
	/* This is reading serialized data from system/netd/DnsProxyListener.cpp
 | 
			
		||||
	 * and changes here need to be matched there */
 | 
			
		||||
	int result_code = strtol(buf, NULL, 10);
 | 
			
		||||
	if (result_code != DnsProxyQueryResult) {
 | 
			
		||||
		fread(&size, 1, sizeof(size), proxy);
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (fread(&size, 1, sizeof(size), proxy) != sizeof(size)) return NULL;
 | 
			
		||||
	size = ntohl(size);
 | 
			
		||||
	res_static rs = __res_get_static();
 | 
			
		||||
	memset(&rs->host, 0, sizeof(rs->host));
 | 
			
		||||
	char *ptr = rs->hostbuf;
 | 
			
		||||
 | 
			
		||||
	if (fread(ptr, 1, size, proxy) != size) return NULL;
 | 
			
		||||
	ptr += size;
 | 
			
		||||
	rs->host.h_name = rs->hostbuf;
 | 
			
		||||
 | 
			
		||||
	char **aliases = rs->host_aliases;
 | 
			
		||||
	rs->host.h_aliases = rs->host_aliases;
 | 
			
		||||
	while (1) {
 | 
			
		||||
		if (fread(&size, 1, sizeof(size), proxy) != sizeof(size)) return NULL;
 | 
			
		||||
		size = ntohl(size);
 | 
			
		||||
 | 
			
		||||
		if (size == 0) {
 | 
			
		||||
			*aliases = NULL;
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		if (fread(ptr, 1, size, proxy) != size) return NULL;
 | 
			
		||||
		*aliases++ = ptr;
 | 
			
		||||
		ptr += size;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (fread(&size, 1, sizeof(size), proxy) != sizeof(size)) return NULL;
 | 
			
		||||
	rs->host.h_addrtype = ntohl(size);
 | 
			
		||||
 | 
			
		||||
	if (fread(&size, 1, sizeof(size), proxy) != sizeof(size)) return NULL;
 | 
			
		||||
	rs->host.h_length = ntohl(size);
 | 
			
		||||
 | 
			
		||||
	char **addrs = rs->h_addr_ptrs;
 | 
			
		||||
	rs->host.h_addr_list = rs->h_addr_ptrs;
 | 
			
		||||
	while (1) {
 | 
			
		||||
		if (fread(&size, 1, sizeof(size), proxy) != sizeof(size)) return NULL;
 | 
			
		||||
		size = ntohl(size);
 | 
			
		||||
		if (size == 0) {
 | 
			
		||||
			*addrs = NULL;
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		if (fread(ptr, 1, size, proxy) != size) return NULL;
 | 
			
		||||
		*addrs++ = ptr;
 | 
			
		||||
		ptr += size;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return &rs->host;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static struct hostent *
 | 
			
		||||
gethostbyname_internal_real(const char *name, int af, res_state res)
 | 
			
		||||
gethostbyname_internal(const char *name, int af, res_state res)
 | 
			
		||||
{
 | 
			
		||||
	const char *cp;
 | 
			
		||||
	char *bp, *ep;
 | 
			
		||||
	int size;
 | 
			
		||||
	struct hostent *hp;
 | 
			
		||||
	res_static rs = __res_get_static();
 | 
			
		||||
        struct resolv_cache*  cache;
 | 
			
		||||
        res_static  rs = __res_get_static();
 | 
			
		||||
 | 
			
		||||
	static const ns_dtab dtab[] = {
 | 
			
		||||
		NS_FILES_CB(_gethtbyname, NULL)
 | 
			
		||||
@@ -733,84 +632,14 @@ gethostbyname_internal_real(const char *name, int af, res_state res)
 | 
			
		||||
	if (nsdispatch(&hp, dtab, NSDB_HOSTS, "gethostbyname",
 | 
			
		||||
	    default_dns_files, name, strlen(name), af) != NS_SUCCESS) {
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
        }
 | 
			
		||||
	h_errno = NETDB_SUCCESS;
 | 
			
		||||
	return hp;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// very similar in proxy-ness to android_getaddrinfo_proxy
 | 
			
		||||
static struct hostent *
 | 
			
		||||
gethostbyname_internal(const char *name, int af, res_state res, const char *iface)
 | 
			
		||||
{
 | 
			
		||||
	const char *cache_mode = getenv("ANDROID_DNS_MODE");
 | 
			
		||||
	FILE* proxy = NULL;
 | 
			
		||||
	struct hostent *result = NULL;
 | 
			
		||||
 | 
			
		||||
	if (cache_mode != NULL && strcmp(cache_mode, "local") == 0) {
 | 
			
		||||
		res_setiface(res, iface);
 | 
			
		||||
		return gethostbyname_internal_real(name, af, res);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	proxy = android_open_proxy();
 | 
			
		||||
	if (proxy == NULL) goto exit;
 | 
			
		||||
 | 
			
		||||
	/* This is writing to system/netd/DnsProxyListener.cpp and changes
 | 
			
		||||
	 * here need to be matched there */
 | 
			
		||||
	if (fprintf(proxy, "gethostbyname %s %s %d",
 | 
			
		||||
			iface == NULL ? "^" : iface,
 | 
			
		||||
			name == NULL ? "^" : name,
 | 
			
		||||
			af) < 0) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (fputc(0, proxy) == EOF || fflush(proxy) != 0) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result = android_read_hostent(proxy);
 | 
			
		||||
 | 
			
		||||
exit:
 | 
			
		||||
	if (proxy != NULL) {
 | 
			
		||||
		fclose(proxy);
 | 
			
		||||
	}
 | 
			
		||||
	return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
struct hostent *
 | 
			
		||||
android_gethostbyaddrforiface_proxy(const void *addr,
 | 
			
		||||
    socklen_t len, int af, const char* iface)
 | 
			
		||||
{
 | 
			
		||||
	struct hostent *result = NULL;
 | 
			
		||||
	FILE* proxy = android_open_proxy();
 | 
			
		||||
 | 
			
		||||
	if (proxy == NULL) goto exit;
 | 
			
		||||
 | 
			
		||||
	char buf[INET6_ADDRSTRLEN];  //big enough for IPv4 and IPv6
 | 
			
		||||
	const char * addrStr = inet_ntop(af, addr, buf, sizeof(buf));
 | 
			
		||||
	if (addrStr == NULL) goto exit;
 | 
			
		||||
 | 
			
		||||
	if (fprintf(proxy, "gethostbyaddr %s %d %d %s",
 | 
			
		||||
			addrStr, len, af, iface == NULL ? "^" : iface) < 0) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (fputc(0, proxy) == EOF || fflush(proxy) != 0) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result = android_read_hostent(proxy);
 | 
			
		||||
exit:
 | 
			
		||||
	if (proxy != NULL) {
 | 
			
		||||
		fclose(proxy);
 | 
			
		||||
	}
 | 
			
		||||
	return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct hostent *
 | 
			
		||||
android_gethostbyaddrforiface_real(const void *addr,
 | 
			
		||||
    socklen_t len, int af, const char* iface)
 | 
			
		||||
gethostbyaddr(const void *addr,
 | 
			
		||||
    socklen_t len, int af)
 | 
			
		||||
{
 | 
			
		||||
	const u_char *uaddr = (const u_char *)addr;
 | 
			
		||||
	socklen_t size;
 | 
			
		||||
@@ -858,31 +687,12 @@ android_gethostbyaddrforiface_real(const void *addr,
 | 
			
		||||
	hp = NULL;
 | 
			
		||||
	h_errno = NETDB_INTERNAL;
 | 
			
		||||
	if (nsdispatch(&hp, dtab, NSDB_HOSTS, "gethostbyaddr",
 | 
			
		||||
	    default_dns_files, uaddr, len, af, iface) != NS_SUCCESS)
 | 
			
		||||
	    default_dns_files, uaddr, len, af) != NS_SUCCESS)
 | 
			
		||||
		return NULL;
 | 
			
		||||
	h_errno = NETDB_SUCCESS;
 | 
			
		||||
	return hp;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct hostent *
 | 
			
		||||
android_gethostbyaddrforiface(const void *addr, socklen_t len, int af, const char* iface)
 | 
			
		||||
{
 | 
			
		||||
	const char *cache_mode = getenv("ANDROID_DNS_MODE");
 | 
			
		||||
 | 
			
		||||
	if (cache_mode == NULL || strcmp(cache_mode, "local") != 0) {
 | 
			
		||||
		return android_gethostbyaddrforiface_proxy(addr, len, af, iface);
 | 
			
		||||
	} else {
 | 
			
		||||
		return android_gethostbyaddrforiface_real(addr,len, af,iface);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct hostent *
 | 
			
		||||
gethostbyaddr(const void *addr, socklen_t len, int af)
 | 
			
		||||
{
 | 
			
		||||
	return android_gethostbyaddrforiface(addr, len, af, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
_sethtent(int f)
 | 
			
		||||
{
 | 
			
		||||
@@ -1314,7 +1124,6 @@ _dns_gethtbyaddr(void *rv, void	*cb_data, va_list ap)
 | 
			
		||||
	const unsigned char *uaddr;
 | 
			
		||||
	int len, af, advance;
 | 
			
		||||
	res_state res;
 | 
			
		||||
	const char* iface;
 | 
			
		||||
	res_static rs = __res_get_static();
 | 
			
		||||
 | 
			
		||||
	assert(rv != NULL);
 | 
			
		||||
@@ -1322,7 +1131,6 @@ _dns_gethtbyaddr(void *rv, void	*cb_data, va_list ap)
 | 
			
		||||
	uaddr = va_arg(ap, unsigned char *);
 | 
			
		||||
	len = va_arg(ap, int);
 | 
			
		||||
	af = va_arg(ap, int);
 | 
			
		||||
	iface = va_arg(ap, char *);
 | 
			
		||||
 | 
			
		||||
	switch (af) {
 | 
			
		||||
	case AF_INET:
 | 
			
		||||
@@ -1364,7 +1172,6 @@ _dns_gethtbyaddr(void *rv, void	*cb_data, va_list ap)
 | 
			
		||||
		free(buf);
 | 
			
		||||
		return NS_NOTFOUND;
 | 
			
		||||
	}
 | 
			
		||||
	res_setiface(res, iface);
 | 
			
		||||
	n = res_nquery(res, qbuf, C_IN, T_PTR, buf->buf, sizeof(buf->buf));
 | 
			
		||||
	if (n < 0) {
 | 
			
		||||
		free(buf);
 | 
			
		||||
 
 | 
			
		||||
@@ -214,7 +214,7 @@ struct res_target {
 | 
			
		||||
 | 
			
		||||
static int str2number(const char *);
 | 
			
		||||
static int explore_fqdn(const struct addrinfo *, const char *,
 | 
			
		||||
	const char *, struct addrinfo **, const char *iface);
 | 
			
		||||
	const char *, struct addrinfo **);
 | 
			
		||||
static int explore_null(const struct addrinfo *,
 | 
			
		||||
	const char *, struct addrinfo **);
 | 
			
		||||
static int explore_numeric(const struct addrinfo *, const char *,
 | 
			
		||||
@@ -402,15 +402,17 @@ _have_ipv4() {
 | 
			
		||||
        return _test_connect(PF_INET, &addr.generic, sizeof(addr.in));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Returns 0 on success, else returns on error.
 | 
			
		||||
// Returns 0 on success, else returns non-zero on error (in which case
 | 
			
		||||
// getaddrinfo should continue as normal)
 | 
			
		||||
static int
 | 
			
		||||
android_getaddrinfo_proxy(
 | 
			
		||||
    const char *hostname, const char *servname,
 | 
			
		||||
    const struct addrinfo *hints, struct addrinfo **res, const char *iface)
 | 
			
		||||
    const struct addrinfo *hints, struct addrinfo **res)
 | 
			
		||||
{
 | 
			
		||||
	int sock;
 | 
			
		||||
	const int one = 1;
 | 
			
		||||
	struct sockaddr_un proxy_addr;
 | 
			
		||||
	const char* cache_mode = getenv("ANDROID_DNS_MODE");
 | 
			
		||||
	FILE* proxy = NULL;
 | 
			
		||||
	int success = 0;
 | 
			
		||||
 | 
			
		||||
@@ -419,17 +421,33 @@ android_getaddrinfo_proxy(
 | 
			
		||||
	// allocated in the process (before failing).
 | 
			
		||||
	*res = NULL;
 | 
			
		||||
 | 
			
		||||
	// Bogus things we can't serialize.  Don't use the proxy.  These will fail - let them.
 | 
			
		||||
	if (cache_mode != NULL && strcmp(cache_mode, "local") == 0) {
 | 
			
		||||
		// Don't use the proxy in local mode.  This is used by the
 | 
			
		||||
		// proxy itself.
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Temporary cautious hack to disable the DNS proxy for processes
 | 
			
		||||
	// requesting special treatment.  Ideally the DNS proxy should
 | 
			
		||||
	// accomodate these apps, though.
 | 
			
		||||
	char propname[PROP_NAME_MAX];
 | 
			
		||||
	char propvalue[PROP_VALUE_MAX];
 | 
			
		||||
	snprintf(propname, sizeof(propname), "net.dns1.%d", getpid());
 | 
			
		||||
	if (__system_property_get(propname, propvalue) > 0) {
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Bogus things we can't serialize.  Don't use the proxy.
 | 
			
		||||
	if ((hostname != NULL &&
 | 
			
		||||
	     strcspn(hostname, " \n\r\t^'\"") != strlen(hostname)) ||
 | 
			
		||||
	    (servname != NULL &&
 | 
			
		||||
	     strcspn(servname, " \n\r\t^'\"") != strlen(servname))) {
 | 
			
		||||
		return EAI_NODATA;
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	sock = socket(AF_UNIX, SOCK_STREAM, 0);
 | 
			
		||||
	if (sock < 0) {
 | 
			
		||||
		return EAI_NODATA;
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
 | 
			
		||||
@@ -441,19 +459,18 @@ android_getaddrinfo_proxy(
 | 
			
		||||
				       (const struct sockaddr*) &proxy_addr,
 | 
			
		||||
				       sizeof(proxy_addr))) != 0) {
 | 
			
		||||
		close(sock);
 | 
			
		||||
		return EAI_NODATA;
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Send the request.
 | 
			
		||||
	proxy = fdopen(sock, "r+");
 | 
			
		||||
	if (fprintf(proxy, "getaddrinfo %s %s %d %d %d %d %s",
 | 
			
		||||
	if (fprintf(proxy, "getaddrinfo %s %s %d %d %d %d",
 | 
			
		||||
		    hostname == NULL ? "^" : hostname,
 | 
			
		||||
		    servname == NULL ? "^" : servname,
 | 
			
		||||
		    hints == NULL ? -1 : hints->ai_flags,
 | 
			
		||||
		    hints == NULL ? -1 : hints->ai_family,
 | 
			
		||||
		    hints == NULL ? -1 : hints->ai_socktype,
 | 
			
		||||
		    hints == NULL ? -1 : hints->ai_protocol,
 | 
			
		||||
		    iface == NULL ? "^" : iface) < 0) {
 | 
			
		||||
		    hints == NULL ? -1 : hints->ai_protocol) < 0) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
	// literal NULL byte at end, required by FrameworkListener
 | 
			
		||||
@@ -471,7 +488,6 @@ android_getaddrinfo_proxy(
 | 
			
		||||
	int result_code = (int)strtol(buf, NULL, 10);
 | 
			
		||||
	// verify the code itself
 | 
			
		||||
	if (result_code != DnsProxyQueryResult ) {
 | 
			
		||||
		fread(buf, 1, sizeof(buf), proxy);
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -564,25 +580,19 @@ exit:
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Proxy failed;
 | 
			
		||||
	// clean up memory we might've allocated.
 | 
			
		||||
	// Proxy failed; fall through to local
 | 
			
		||||
	// resolver case.  But first clean up any
 | 
			
		||||
	// memory we might've allocated.
 | 
			
		||||
	if (*res) {
 | 
			
		||||
		freeaddrinfo(*res);
 | 
			
		||||
		*res = NULL;
 | 
			
		||||
	}
 | 
			
		||||
	return EAI_NODATA;
 | 
			
		||||
	return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
getaddrinfo(const char *hostname, const char *servname,
 | 
			
		||||
    const struct addrinfo *hints, struct addrinfo **res)
 | 
			
		||||
{
 | 
			
		||||
	return android_getaddrinfoforiface(hostname, servname, hints, NULL, res);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
android_getaddrinfoforiface(const char *hostname, const char *servname,
 | 
			
		||||
    const struct addrinfo *hints, const char *iface, struct addrinfo **res)
 | 
			
		||||
{
 | 
			
		||||
	struct addrinfo sentinel;
 | 
			
		||||
	struct addrinfo *cur;
 | 
			
		||||
@@ -591,12 +601,12 @@ android_getaddrinfoforiface(const char *hostname, const char *servname,
 | 
			
		||||
	struct addrinfo ai0;
 | 
			
		||||
	struct addrinfo *pai;
 | 
			
		||||
	const struct explore *ex;
 | 
			
		||||
	const char* cache_mode = getenv("ANDROID_DNS_MODE");
 | 
			
		||||
 | 
			
		||||
	/* hostname is allowed to be NULL */
 | 
			
		||||
	/* servname is allowed to be NULL */
 | 
			
		||||
	/* hints is allowed to be NULL */
 | 
			
		||||
	assert(res != NULL);
 | 
			
		||||
 | 
			
		||||
	memset(&sentinel, 0, sizeof(sentinel));
 | 
			
		||||
	cur = &sentinel;
 | 
			
		||||
	pai = &ai;
 | 
			
		||||
@@ -729,10 +739,9 @@ android_getaddrinfoforiface(const char *hostname, const char *servname,
 | 
			
		||||
        /*
 | 
			
		||||
         * BEGIN ANDROID CHANGES; proxying to the cache
 | 
			
		||||
         */
 | 
			
		||||
	if (cache_mode == NULL || strcmp(cache_mode, "local") != 0) {
 | 
			
		||||
		// we're not the proxy - pass the request to them
 | 
			
		||||
		return android_getaddrinfo_proxy(hostname, servname, hints, res, iface);
 | 
			
		||||
	}
 | 
			
		||||
        if (android_getaddrinfo_proxy(hostname, servname, hints, res) == 0) {
 | 
			
		||||
            return 0;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * hostname as alphabetical name.
 | 
			
		||||
@@ -761,7 +770,7 @@ android_getaddrinfoforiface(const char *hostname, const char *servname,
 | 
			
		||||
			pai->ai_protocol = ex->e_protocol;
 | 
			
		||||
 | 
			
		||||
		error = explore_fqdn(pai, hostname, servname,
 | 
			
		||||
			&cur->ai_next, iface);
 | 
			
		||||
			&cur->ai_next);
 | 
			
		||||
 | 
			
		||||
		while (cur && cur->ai_next)
 | 
			
		||||
			cur = cur->ai_next;
 | 
			
		||||
@@ -794,7 +803,7 @@ android_getaddrinfoforiface(const char *hostname, const char *servname,
 | 
			
		||||
 */
 | 
			
		||||
static int
 | 
			
		||||
explore_fqdn(const struct addrinfo *pai, const char *hostname,
 | 
			
		||||
    const char *servname, struct addrinfo **res, const char *iface)
 | 
			
		||||
    const char *servname, struct addrinfo **res)
 | 
			
		||||
{
 | 
			
		||||
	struct addrinfo *result;
 | 
			
		||||
	struct addrinfo *cur;
 | 
			
		||||
@@ -820,7 +829,7 @@ explore_fqdn(const struct addrinfo *pai, const char *hostname,
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	switch (nsdispatch(&result, dtab, NSDB_HOSTS, "getaddrinfo",
 | 
			
		||||
			default_dns_files, hostname, pai, iface)) {
 | 
			
		||||
			default_dns_files, hostname, pai)) {
 | 
			
		||||
	case NS_TRYAGAIN:
 | 
			
		||||
		error = EAI_AGAIN;
 | 
			
		||||
		goto free;
 | 
			
		||||
@@ -1888,11 +1897,9 @@ _dns_getaddrinfo(void *rv, void	*cb_data, va_list ap)
 | 
			
		||||
	struct addrinfo sentinel, *cur;
 | 
			
		||||
	struct res_target q, q2;
 | 
			
		||||
	res_state res;
 | 
			
		||||
	const char* iface;
 | 
			
		||||
 | 
			
		||||
	name = va_arg(ap, char *);
 | 
			
		||||
	pai = va_arg(ap, const struct addrinfo *);
 | 
			
		||||
	iface = va_arg(ap, char *);
 | 
			
		||||
	//fprintf(stderr, "_dns_getaddrinfo() name = '%s'\n", name);
 | 
			
		||||
 | 
			
		||||
	memset(&q, 0, sizeof(q));
 | 
			
		||||
@@ -1974,12 +1981,6 @@ _dns_getaddrinfo(void *rv, void	*cb_data, va_list ap)
 | 
			
		||||
		return NS_NOTFOUND;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* this just sets our iface val in the thread private data so we don't have to
 | 
			
		||||
	 * modify the api's all the way down to res_send.c's res_nsend.  We could
 | 
			
		||||
	 * fully populate the thread private data here, but if we get down there
 | 
			
		||||
	 * and have a cache hit that would be wasted, so we do the rest there on miss
 | 
			
		||||
	 */
 | 
			
		||||
	res_setiface(res, iface);
 | 
			
		||||
	if (res_searchN(name, &q, res) < 0) {
 | 
			
		||||
		__res_put_state(res);
 | 
			
		||||
		free(buf);
 | 
			
		||||
 
 | 
			
		||||
@@ -61,6 +61,7 @@ __RCSID("$NetBSD: getnameinfo.c,v 1.53 2012/09/26 23:13:00 christos Exp $");
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
#include <limits.h>
 | 
			
		||||
#include <netdb.h>
 | 
			
		||||
#ifdef ANDROID_CHANGES
 | 
			
		||||
#include "arpa_nameser.h"
 | 
			
		||||
#include "resolv_private.h"
 | 
			
		||||
#include <sys/system_properties.h>
 | 
			
		||||
@@ -68,6 +69,9 @@ __RCSID("$NetBSD: getnameinfo.c,v 1.53 2012/09/26 23:13:00 christos Exp $");
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#define MIN(x,y) ((x) < (y) ? (x) : (y))
 | 
			
		||||
#else
 | 
			
		||||
#include <resolv.h>
 | 
			
		||||
#endif
 | 
			
		||||
#include <stddef.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
@@ -93,7 +97,7 @@ struct sockinet {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static int getnameinfo_inet(const struct sockaddr *, socklen_t, char *,
 | 
			
		||||
    socklen_t, char *, socklen_t, int, const char*);
 | 
			
		||||
    socklen_t, char *, socklen_t, int);
 | 
			
		||||
#ifdef INET6
 | 
			
		||||
static int ip6_parsenumeric(const struct sockaddr *, const char *, char *,
 | 
			
		||||
				 socklen_t, int);
 | 
			
		||||
@@ -107,17 +111,12 @@ static int getnameinfo_local(const struct sockaddr *, socklen_t, char *,
 | 
			
		||||
 * appropriate function to call.
 | 
			
		||||
 */
 | 
			
		||||
int getnameinfo(const struct sockaddr* sa, socklen_t salen, char* host, size_t hostlen, char* serv, size_t servlen, int flags)
 | 
			
		||||
{
 | 
			
		||||
	return android_getnameinfoforiface(sa, salen, host, hostlen, serv, servlen, flags, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int android_getnameinfoforiface(const struct sockaddr* sa, socklen_t salen, char* host, size_t hostlen, char* serv, size_t servlen, int flags, const char* iface)
 | 
			
		||||
{
 | 
			
		||||
	switch (sa->sa_family) {
 | 
			
		||||
	case AF_INET:
 | 
			
		||||
	case AF_INET6:
 | 
			
		||||
		return getnameinfo_inet(sa, salen, host, hostlen,
 | 
			
		||||
				serv, servlen, flags, iface);
 | 
			
		||||
		    serv, servlen, flags);
 | 
			
		||||
	case AF_LOCAL:
 | 
			
		||||
		return getnameinfo_local(sa, salen, host, hostlen,
 | 
			
		||||
		    serv, servlen, flags);
 | 
			
		||||
@@ -153,23 +152,112 @@ getnameinfo_local(const struct sockaddr *sa, socklen_t salen,
 | 
			
		||||
       return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef ANDROID_CHANGES
 | 
			
		||||
/* On success length of the host name is returned. A return
 | 
			
		||||
 * value of 0 means there's no host name associated with
 | 
			
		||||
 * the address. On failure -1 is returned in which case
 | 
			
		||||
 * normal execution flow shall continue. */
 | 
			
		||||
static int
 | 
			
		||||
android_gethostbyaddr_proxy(char* nameBuf, size_t nameBufLen, const void *addr, socklen_t addrLen, int addrFamily, const char* iface)
 | 
			
		||||
{
 | 
			
		||||
	struct hostent *hostResult =
 | 
			
		||||
			android_gethostbyaddrforiface_proxy(addr, addrLen, addrFamily, iface);
 | 
			
		||||
android_gethostbyaddr_proxy(char* nameBuf, size_t nameBufLen, const void *addr, socklen_t addrLen, int addrFamily) {
 | 
			
		||||
 | 
			
		||||
	if (hostResult == NULL) return 0;
 | 
			
		||||
	int sock;
 | 
			
		||||
	const int one = 1;
 | 
			
		||||
	struct sockaddr_un proxy_addr;
 | 
			
		||||
	const char* cache_mode = getenv("ANDROID_DNS_MODE");
 | 
			
		||||
	FILE* proxy = NULL;
 | 
			
		||||
	int result = -1;
 | 
			
		||||
 | 
			
		||||
	int lengthResult = strlen(hostResult->h_name);
 | 
			
		||||
	if (cache_mode != NULL && strcmp(cache_mode, "local") == 0) {
 | 
			
		||||
		// Don't use the proxy in local mode.  This is used by the
 | 
			
		||||
		// proxy itself.
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (nameBuf) strncpy(nameBuf, hostResult->h_name, nameBufLen);
 | 
			
		||||
	return lengthResult;
 | 
			
		||||
	// Temporary cautious hack to disable the DNS proxy for processes
 | 
			
		||||
	// requesting special treatment.  Ideally the DNS proxy should
 | 
			
		||||
	// accomodate these apps, though.
 | 
			
		||||
	char propname[PROP_NAME_MAX];
 | 
			
		||||
	char propvalue[PROP_VALUE_MAX];
 | 
			
		||||
	snprintf(propname, sizeof(propname), "net.dns1.%d", getpid());
 | 
			
		||||
	if (__system_property_get(propname, propvalue) > 0) {
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
	// create socket
 | 
			
		||||
	sock = socket(AF_UNIX, SOCK_STREAM, 0);
 | 
			
		||||
	if (sock < 0) {
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
 | 
			
		||||
	memset(&proxy_addr, 0, sizeof(proxy_addr));
 | 
			
		||||
	proxy_addr.sun_family = AF_UNIX;
 | 
			
		||||
	strlcpy(proxy_addr.sun_path, "/dev/socket/dnsproxyd",
 | 
			
		||||
			sizeof(proxy_addr.sun_path));
 | 
			
		||||
	if (TEMP_FAILURE_RETRY(connect(sock, (const struct sockaddr*) (void*) &proxy_addr,
 | 
			
		||||
							sizeof(proxy_addr))) != 0) {
 | 
			
		||||
		close(sock);
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// send request to DnsProxyListener
 | 
			
		||||
	proxy = fdopen(sock,"r+");
 | 
			
		||||
	if (proxy == NULL) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	char buf[INET6_ADDRSTRLEN]; // big enough for IPv4 and IPv6
 | 
			
		||||
	const char* addrStr = inet_ntop(addrFamily, addr, buf, sizeof(buf));
 | 
			
		||||
	if (addrStr == NULL) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
	if (fprintf(proxy, "gethostbyaddr %s %d %d", addrStr, addrLen, addrFamily) < 0) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// literal NULL byte at end, required by FrameworkListener
 | 
			
		||||
	if (fputc(0, proxy) == EOF || fflush(proxy) != 0) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result = 0;
 | 
			
		||||
	char msg_buf[4];
 | 
			
		||||
	// read result code for gethostbyaddr
 | 
			
		||||
	if (fread(msg_buf, 1, sizeof(msg_buf), proxy) != sizeof(msg_buf)) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	int result_code = (int)strtol(msg_buf, NULL, 10);
 | 
			
		||||
	// verify the code itself
 | 
			
		||||
        // This should be synchronized to ResponseCode.h
 | 
			
		||||
        static const int DnsProxyQueryResult = 222;
 | 
			
		||||
	if (result_code != DnsProxyQueryResult) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	uint32_t name_len;
 | 
			
		||||
	if (fread(&name_len, sizeof(name_len), 1, proxy) != 1) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	name_len = ntohl(name_len);
 | 
			
		||||
	if (name_len <= 0 || name_len >= nameBufLen) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (fread(nameBuf, name_len, 1, proxy) != 1) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result = name_len;
 | 
			
		||||
 | 
			
		||||
 exit:
 | 
			
		||||
	if (proxy != NULL) {
 | 
			
		||||
		fclose(proxy);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return result;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * getnameinfo_inet():
 | 
			
		||||
@@ -179,7 +267,7 @@ static int
 | 
			
		||||
getnameinfo_inet(const struct sockaddr* sa, socklen_t salen,
 | 
			
		||||
       char *host, socklen_t hostlen,
 | 
			
		||||
       char *serv, socklen_t servlen,
 | 
			
		||||
       int flags, const char* iface)
 | 
			
		||||
       int flags)
 | 
			
		||||
{
 | 
			
		||||
	const struct afd *afd;
 | 
			
		||||
	struct servent *sp;
 | 
			
		||||
@@ -317,19 +405,23 @@ getnameinfo_inet(const struct sockaddr* sa, socklen_t salen,
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
#ifdef ANDROID_CHANGES
 | 
			
		||||
		struct hostent android_proxy_hostent;
 | 
			
		||||
		char android_proxy_buf[MAXDNAME];
 | 
			
		||||
 | 
			
		||||
		int hostnamelen = android_gethostbyaddr_proxy(android_proxy_buf,
 | 
			
		||||
				MAXDNAME, addr, afd->a_addrlen, afd->a_af, iface);
 | 
			
		||||
				MAXDNAME, addr, afd->a_addrlen, afd->a_af);
 | 
			
		||||
		if (hostnamelen > 0) {
 | 
			
		||||
			hp = &android_proxy_hostent;
 | 
			
		||||
			hp->h_name = android_proxy_buf;
 | 
			
		||||
		} else if (!hostnamelen) {
 | 
			
		||||
			hp = NULL;
 | 
			
		||||
		} else {
 | 
			
		||||
			hp = android_gethostbyaddrforiface(addr, afd->a_addrlen, afd->a_af, iface);
 | 
			
		||||
			hp = gethostbyaddr(addr, afd->a_addrlen, afd->a_af);
 | 
			
		||||
		}
 | 
			
		||||
#else
 | 
			
		||||
		hp = gethostbyaddr(addr, afd->a_addrlen, afd->a_af);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		if (hp) {
 | 
			
		||||
#if 0
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,6 @@
 | 
			
		||||
#include <arpa/inet.h>
 | 
			
		||||
#include "resolv_private.h"
 | 
			
		||||
#include "resolv_iface.h"
 | 
			
		||||
#include "res_private.h"
 | 
			
		||||
 | 
			
		||||
/* This code implements a small and *simple* DNS resolver cache.
 | 
			
		||||
 *
 | 
			
		||||
@@ -572,6 +571,8 @@ _dnsPacket_checkQName( DnsPacket*  packet )
 | 
			
		||||
static int
 | 
			
		||||
_dnsPacket_checkQR( DnsPacket*  packet )
 | 
			
		||||
{
 | 
			
		||||
    int  len;
 | 
			
		||||
 | 
			
		||||
    if (!_dnsPacket_checkQName(packet))
 | 
			
		||||
        return 0;
 | 
			
		||||
 | 
			
		||||
@@ -830,6 +831,8 @@ _dnsPacket_hashQName( DnsPacket*  packet, unsigned  hash )
 | 
			
		||||
static unsigned
 | 
			
		||||
_dnsPacket_hashQR( DnsPacket*  packet, unsigned  hash )
 | 
			
		||||
{
 | 
			
		||||
    int   len;
 | 
			
		||||
 | 
			
		||||
    hash = _dnsPacket_hashQName(packet, hash);
 | 
			
		||||
    hash = _dnsPacket_hashBytes(packet, 4, hash); /* TYPE and CLASS */
 | 
			
		||||
    return hash;
 | 
			
		||||
@@ -1016,58 +1019,8 @@ typedef struct Entry {
 | 
			
		||||
} Entry;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Find the TTL for a negative DNS result.  This is defined as the minimum
 | 
			
		||||
 * of the SOA records TTL and the MINIMUM-TTL field (RFC-2308).
 | 
			
		||||
 *
 | 
			
		||||
 * Return 0 if not found.
 | 
			
		||||
 */
 | 
			
		||||
static u_long
 | 
			
		||||
answer_getNegativeTTL(ns_msg handle) {
 | 
			
		||||
    int n, nscount;
 | 
			
		||||
    u_long result = 0;
 | 
			
		||||
    ns_rr rr;
 | 
			
		||||
 | 
			
		||||
    nscount = ns_msg_count(handle, ns_s_ns);
 | 
			
		||||
    for (n = 0; n < nscount; n++) {
 | 
			
		||||
        if ((ns_parserr(&handle, ns_s_ns, n, &rr) == 0) && (ns_rr_type(rr) == ns_t_soa)) {
 | 
			
		||||
            const u_char *rdata = ns_rr_rdata(rr); // find the data
 | 
			
		||||
            const u_char *edata = rdata + ns_rr_rdlen(rr); // add the len to find the end
 | 
			
		||||
            int len;
 | 
			
		||||
            u_long ttl, rec_result = ns_rr_ttl(rr);
 | 
			
		||||
 | 
			
		||||
            // find the MINIMUM-TTL field from the blob of binary data for this record
 | 
			
		||||
            // skip the server name
 | 
			
		||||
            len = dn_skipname(rdata, edata);
 | 
			
		||||
            if (len == -1) continue; // error skipping
 | 
			
		||||
            rdata += len;
 | 
			
		||||
 | 
			
		||||
            // skip the admin name
 | 
			
		||||
            len = dn_skipname(rdata, edata);
 | 
			
		||||
            if (len == -1) continue; // error skipping
 | 
			
		||||
            rdata += len;
 | 
			
		||||
 | 
			
		||||
            if (edata - rdata != 5*NS_INT32SZ) continue;
 | 
			
		||||
            // skip: serial number + refresh interval + retry interval + expiry
 | 
			
		||||
            rdata += NS_INT32SZ * 4;
 | 
			
		||||
            // finally read the MINIMUM TTL
 | 
			
		||||
            ttl = ns_get32(rdata);
 | 
			
		||||
            if (ttl < rec_result) {
 | 
			
		||||
                rec_result = ttl;
 | 
			
		||||
            }
 | 
			
		||||
            // Now that the record is read successfully, apply the new min TTL
 | 
			
		||||
            if (n == 0 || rec_result < result) {
 | 
			
		||||
                result = rec_result;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Parse the answer records and find the appropriate
 | 
			
		||||
 * smallest TTL among the records.  This might be from
 | 
			
		||||
 * the answer records if found or from the SOA record
 | 
			
		||||
 * if it's a negative result.
 | 
			
		||||
 * Parse the answer records and find the smallest
 | 
			
		||||
 * TTL among the answer records.
 | 
			
		||||
 *
 | 
			
		||||
 * The returned TTL is the number of seconds to
 | 
			
		||||
 * keep the answer in the cache.
 | 
			
		||||
@@ -1087,20 +1040,14 @@ answer_getTTL(const void* answer, int answerlen)
 | 
			
		||||
    if (ns_initparse(answer, answerlen, &handle) >= 0) {
 | 
			
		||||
        // get number of answer records
 | 
			
		||||
        ancount = ns_msg_count(handle, ns_s_an);
 | 
			
		||||
 | 
			
		||||
        if (ancount == 0) {
 | 
			
		||||
            // a response with no answers?  Cache this negative result.
 | 
			
		||||
            result = answer_getNegativeTTL(handle);
 | 
			
		||||
        } else {
 | 
			
		||||
            for (n = 0; n < ancount; n++) {
 | 
			
		||||
                if (ns_parserr(&handle, ns_s_an, n, &rr) == 0) {
 | 
			
		||||
                    ttl = ns_rr_ttl(rr);
 | 
			
		||||
                    if (n == 0 || ttl < result) {
 | 
			
		||||
                        result = ttl;
 | 
			
		||||
                    }
 | 
			
		||||
                } else {
 | 
			
		||||
                    XLOG("ns_parserr failed ancount no = %d. errno = %s\n", n, strerror(errno));
 | 
			
		||||
        for (n = 0; n < ancount; n++) {
 | 
			
		||||
            if (ns_parserr(&handle, ns_s_an, n, &rr) == 0) {
 | 
			
		||||
                ttl = ns_rr_ttl(rr);
 | 
			
		||||
                if (n == 0 || ttl < result) {
 | 
			
		||||
                    result = ttl;
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                XLOG("ns_parserr failed ancount no = %d. errno = %s\n", n, strerror(errno));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
@@ -1249,16 +1196,8 @@ typedef struct resolv_cache_info {
 | 
			
		||||
    struct resolv_cache_info*   next;
 | 
			
		||||
    char*                       nameservers[MAXNS +1];
 | 
			
		||||
    struct addrinfo*            nsaddrinfo[MAXNS + 1];
 | 
			
		||||
    char                        defdname[256];
 | 
			
		||||
    int                         dnsrch_offset[MAXDNSRCH+1];  // offsets into defdname
 | 
			
		||||
} CacheInfo;
 | 
			
		||||
 | 
			
		||||
typedef struct resolv_pidiface_info {
 | 
			
		||||
    int                             pid;
 | 
			
		||||
    char                            ifname[IF_NAMESIZE + 1];
 | 
			
		||||
    struct resolv_pidiface_info*    next;
 | 
			
		||||
} PidIfaceInfo;
 | 
			
		||||
 | 
			
		||||
#define  HTABLE_VALID(x)  ((x) != NULL && (x) != HTABLE_DELETED)
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
@@ -1311,9 +1250,8 @@ _cache_check_pending_request_locked( struct resolv_cache* cache, Entry* key )
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            struct timespec ts = {0,0};
 | 
			
		||||
            XLOG("Waiting for previous request");
 | 
			
		||||
            ts.tv_sec = _time_now() + PENDING_REQUEST_TIMEOUT;
 | 
			
		||||
            pthread_cond_timedwait(&ri->cond, &cache->lock, &ts);
 | 
			
		||||
            int rv = pthread_cond_timedwait(&ri->cond, &cache->lock, &ts);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -1367,6 +1305,7 @@ static void
 | 
			
		||||
_cache_flush_locked( Cache*  cache )
 | 
			
		||||
{
 | 
			
		||||
    int     nn;
 | 
			
		||||
    time_t  now = _time_now();
 | 
			
		||||
 | 
			
		||||
    for (nn = 0; nn < cache->max_entries; nn++)
 | 
			
		||||
    {
 | 
			
		||||
@@ -1407,8 +1346,9 @@ _res_cache_get_max_entries( void )
 | 
			
		||||
    if (cache_mode == NULL || strcmp(cache_mode, "local") != 0) {
 | 
			
		||||
        // Don't use the cache in local mode.  This is used by the
 | 
			
		||||
        // proxy itself.
 | 
			
		||||
        XLOG("setup cache for non-cache process. size=0, %s", cache_mode);
 | 
			
		||||
        return 0;
 | 
			
		||||
        // TODO - change this to 0 when all dns stuff uses proxy (5918973)
 | 
			
		||||
        XLOG("setup cache for non-cache process. size=1");
 | 
			
		||||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (__system_property_get(DNS_CACHE_SIZE_PROP_NAME, cache_size) > 0) {
 | 
			
		||||
@@ -1501,7 +1441,6 @@ _dump_answer(const void* answer, int answerlen)
 | 
			
		||||
        remove("/data/reslog.txt");
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        errno = 0; // else debug is introducing error signals
 | 
			
		||||
        XLOG("_dump_answer: can't open file\n");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1637,7 +1576,9 @@ _resolv_cache_lookup( struct resolv_cache*  cache,
 | 
			
		||||
                      int                   answersize,
 | 
			
		||||
                      int                  *answerlen )
 | 
			
		||||
{
 | 
			
		||||
    DnsPacket  pack[1];
 | 
			
		||||
    Entry      key[1];
 | 
			
		||||
    int        index;
 | 
			
		||||
    Entry**    lookup;
 | 
			
		||||
    Entry*     e;
 | 
			
		||||
    time_t     now;
 | 
			
		||||
@@ -1788,28 +1729,20 @@ Exit:
 | 
			
		||||
/****************************************************************************/
 | 
			
		||||
/****************************************************************************/
 | 
			
		||||
 | 
			
		||||
static pthread_once_t        _res_cache_once = PTHREAD_ONCE_INIT;
 | 
			
		||||
static pthread_once_t        _res_cache_once;
 | 
			
		||||
 | 
			
		||||
// Head of the list of caches.  Protected by _res_cache_list_lock.
 | 
			
		||||
static struct resolv_cache_info _res_cache_list;
 | 
			
		||||
 | 
			
		||||
// List of pid iface pairs
 | 
			
		||||
static struct resolv_pidiface_info _res_pidiface_list;
 | 
			
		||||
 | 
			
		||||
// name of the current default inteface
 | 
			
		||||
static char            _res_default_ifname[IF_NAMESIZE + 1];
 | 
			
		||||
 | 
			
		||||
// lock protecting everything in the _resolve_cache_info structs (next ptr, etc)
 | 
			
		||||
static pthread_mutex_t _res_cache_list_lock;
 | 
			
		||||
 | 
			
		||||
// lock protecting the _res_pid_iface_list
 | 
			
		||||
static pthread_mutex_t _res_pidiface_list_lock;
 | 
			
		||||
 | 
			
		||||
/* lookup the default interface name */
 | 
			
		||||
static char *_get_default_iface_locked();
 | 
			
		||||
/* find the first cache that has an associated interface and return the name of the interface */
 | 
			
		||||
static char* _find_any_iface_name_locked( void );
 | 
			
		||||
 | 
			
		||||
/* insert resolv_cache_info into the list of resolv_cache_infos */
 | 
			
		||||
static void _insert_cache_info_locked(struct resolv_cache_info* cache_info);
 | 
			
		||||
/* creates a resolv_cache_info */
 | 
			
		||||
@@ -1818,6 +1751,8 @@ static struct resolv_cache_info* _create_cache_info( void );
 | 
			
		||||
static struct resolv_cache* _find_named_cache_locked(const char* ifname);
 | 
			
		||||
/* gets a resolv_cache_info associated with an interface name, or NULL if not found */
 | 
			
		||||
static struct resolv_cache_info* _find_cache_info_locked(const char* ifname);
 | 
			
		||||
/* free dns name server list of a resolv_cache_info structure */
 | 
			
		||||
static void _free_nameservers(struct resolv_cache_info* cache_info);
 | 
			
		||||
/* look up the named cache, and creates one if needed */
 | 
			
		||||
static struct resolv_cache* _get_res_cache_for_iface_locked(const char* ifname);
 | 
			
		||||
/* empty the named cache */
 | 
			
		||||
@@ -1830,14 +1765,8 @@ static int _get_nameserver_locked(const char* ifname, int n, char* addr, int add
 | 
			
		||||
static struct addrinfo* _get_nameserver_addr_locked(const char* ifname, int n);
 | 
			
		||||
/* lookup the inteface's address */
 | 
			
		||||
static struct in_addr* _get_addr_locked(const char * ifname);
 | 
			
		||||
/* return 1 if the provided list of name servers differs from the list of name servers
 | 
			
		||||
 * currently attached to the provided cache_info */
 | 
			
		||||
static int _resolv_is_nameservers_equal_locked(struct resolv_cache_info* cache_info,
 | 
			
		||||
        char** servers, int numservers);
 | 
			
		||||
/* remove a resolv_pidiface_info structure from _res_pidiface_list */
 | 
			
		||||
static void _remove_pidiface_info_locked(int pid);
 | 
			
		||||
/* get a resolv_pidiface_info structure from _res_pidiface_list with a certain pid */
 | 
			
		||||
static struct resolv_pidiface_info* _get_pid_iface_info_locked(int pid);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
_res_cache_init(void)
 | 
			
		||||
@@ -1851,36 +1780,37 @@ _res_cache_init(void)
 | 
			
		||||
 | 
			
		||||
    memset(&_res_default_ifname, 0, sizeof(_res_default_ifname));
 | 
			
		||||
    memset(&_res_cache_list, 0, sizeof(_res_cache_list));
 | 
			
		||||
    memset(&_res_pidiface_list, 0, sizeof(_res_pidiface_list));
 | 
			
		||||
    pthread_mutex_init(&_res_cache_list_lock, NULL);
 | 
			
		||||
    pthread_mutex_init(&_res_pidiface_list_lock, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct resolv_cache*
 | 
			
		||||
__get_res_cache(const char* ifname)
 | 
			
		||||
__get_res_cache(void)
 | 
			
		||||
{
 | 
			
		||||
    struct resolv_cache *cache;
 | 
			
		||||
 | 
			
		||||
    pthread_once(&_res_cache_once, _res_cache_init);
 | 
			
		||||
 | 
			
		||||
    pthread_mutex_lock(&_res_cache_list_lock);
 | 
			
		||||
 | 
			
		||||
    char* iface;
 | 
			
		||||
    if (ifname == NULL || ifname[0] == '\0') {
 | 
			
		||||
        iface = _get_default_iface_locked();
 | 
			
		||||
        if (iface[0] == '\0') {
 | 
			
		||||
            char* tmp = _find_any_iface_name_locked();
 | 
			
		||||
            if (tmp) {
 | 
			
		||||
                iface = tmp;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        iface = (char *) ifname;
 | 
			
		||||
    }
 | 
			
		||||
    char* ifname = _get_default_iface_locked();
 | 
			
		||||
 | 
			
		||||
    cache = _get_res_cache_for_iface_locked(iface);
 | 
			
		||||
    // if default interface not set then use the first cache
 | 
			
		||||
    // associated with an interface as the default one.
 | 
			
		||||
    if (ifname[0] == '\0') {
 | 
			
		||||
        struct resolv_cache_info* cache_info = _res_cache_list.next;
 | 
			
		||||
        while (cache_info) {
 | 
			
		||||
            if (cache_info->ifname[0] != '\0') {
 | 
			
		||||
                ifname = cache_info->ifname;
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            cache_info = cache_info->next;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    cache = _get_res_cache_for_iface_locked(ifname);
 | 
			
		||||
 | 
			
		||||
    pthread_mutex_unlock(&_res_cache_list_lock);
 | 
			
		||||
    XLOG("_get_res_cache: iface = %s, cache=%p\n", iface, cache);
 | 
			
		||||
    XLOG("_get_res_cache. default_ifname = %s\n", ifname);
 | 
			
		||||
    return cache;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -2036,29 +1966,11 @@ _find_cache_info_locked(const char* ifname)
 | 
			
		||||
static char*
 | 
			
		||||
_get_default_iface_locked(void)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    char* iface = _res_default_ifname;
 | 
			
		||||
 | 
			
		||||
    return iface;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static char*
 | 
			
		||||
_find_any_iface_name_locked( void ) {
 | 
			
		||||
    char* ifname = NULL;
 | 
			
		||||
 | 
			
		||||
    struct resolv_cache_info* cache_info = _res_cache_list.next;
 | 
			
		||||
    while (cache_info) {
 | 
			
		||||
        if (cache_info->ifname[0] != '\0') {
 | 
			
		||||
            ifname = cache_info->ifname;
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        cache_info = cache_info->next;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return ifname;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
_resolv_set_default_iface(const char* ifname)
 | 
			
		||||
{
 | 
			
		||||
@@ -2076,25 +1988,21 @@ _resolv_set_default_iface(const char* ifname)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
_resolv_set_nameservers_for_iface(const char* ifname, char** servers, int numservers,
 | 
			
		||||
        const char *domains)
 | 
			
		||||
_resolv_set_nameservers_for_iface(const char* ifname, char** servers, int numservers)
 | 
			
		||||
{
 | 
			
		||||
    int i, rt, index;
 | 
			
		||||
    struct addrinfo hints;
 | 
			
		||||
    char sbuf[NI_MAXSERV];
 | 
			
		||||
    register char *cp;
 | 
			
		||||
    int *offset;
 | 
			
		||||
 | 
			
		||||
    pthread_once(&_res_cache_once, _res_cache_init);
 | 
			
		||||
    pthread_mutex_lock(&_res_cache_list_lock);
 | 
			
		||||
 | 
			
		||||
    pthread_mutex_lock(&_res_cache_list_lock);
 | 
			
		||||
    // creates the cache if not created
 | 
			
		||||
    _get_res_cache_for_iface_locked(ifname);
 | 
			
		||||
 | 
			
		||||
    struct resolv_cache_info* cache_info = _find_cache_info_locked(ifname);
 | 
			
		||||
 | 
			
		||||
    if (cache_info != NULL &&
 | 
			
		||||
            !_resolv_is_nameservers_equal_locked(cache_info, servers, numservers)) {
 | 
			
		||||
    if (cache_info != NULL) {
 | 
			
		||||
        // free current before adding new
 | 
			
		||||
        _free_nameservers_locked(cache_info);
 | 
			
		||||
 | 
			
		||||
@@ -2110,68 +2018,14 @@ _resolv_set_nameservers_for_iface(const char* ifname, char** servers, int numser
 | 
			
		||||
            if (rt == 0) {
 | 
			
		||||
                cache_info->nameservers[index] = strdup(servers[i]);
 | 
			
		||||
                index++;
 | 
			
		||||
                XLOG("_resolv_set_nameservers_for_iface: iface = %s, addr = %s\n",
 | 
			
		||||
                        ifname, servers[i]);
 | 
			
		||||
            } else {
 | 
			
		||||
                cache_info->nsaddrinfo[index] = NULL;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // code moved from res_init.c, load_domain_search_list
 | 
			
		||||
        strlcpy(cache_info->defdname, domains, sizeof(cache_info->defdname));
 | 
			
		||||
        if ((cp = strchr(cache_info->defdname, '\n')) != NULL)
 | 
			
		||||
            *cp = '\0';
 | 
			
		||||
        cp = cache_info->defdname;
 | 
			
		||||
        offset = cache_info->dnsrch_offset;
 | 
			
		||||
        while (offset < cache_info->dnsrch_offset + MAXDNSRCH) {
 | 
			
		||||
            while (*cp == ' ' || *cp == '\t') /* skip leading white space */
 | 
			
		||||
                cp++;
 | 
			
		||||
            if (*cp == '\0') /* stop if nothing more to do */
 | 
			
		||||
                break;
 | 
			
		||||
            *offset++ = cp - cache_info->defdname; /* record this search domain */
 | 
			
		||||
            while (*cp) { /* zero-terminate it */
 | 
			
		||||
                if (*cp == ' '|| *cp == '\t') {
 | 
			
		||||
                    *cp++ = '\0';
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
                cp++;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        *offset = -1; /* cache_info->dnsrch_offset has MAXDNSRCH+1 items */
 | 
			
		||||
 | 
			
		||||
        // flush cache since new settings
 | 
			
		||||
        _flush_cache_for_iface_locked(ifname);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pthread_mutex_unlock(&_res_cache_list_lock);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
_resolv_is_nameservers_equal_locked(struct resolv_cache_info* cache_info,
 | 
			
		||||
        char** servers, int numservers)
 | 
			
		||||
{
 | 
			
		||||
    int i;
 | 
			
		||||
    char** ns;
 | 
			
		||||
    int equal = 1;
 | 
			
		||||
 | 
			
		||||
    // compare each name server against current name servers
 | 
			
		||||
    if (numservers > MAXNS) numservers = MAXNS;
 | 
			
		||||
    for (i = 0; i < numservers && equal; i++) {
 | 
			
		||||
        ns = cache_info->nameservers;
 | 
			
		||||
        equal = 0;
 | 
			
		||||
        while(*ns) {
 | 
			
		||||
            if (strcmp(*ns, servers[i]) == 0) {
 | 
			
		||||
                equal = 1;
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
            ns++;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return equal;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
_free_nameservers_locked(struct resolv_cache_info* cache_info)
 | 
			
		||||
{
 | 
			
		||||
@@ -2314,196 +2168,3 @@ _get_addr_locked(const char * ifname)
 | 
			
		||||
    }
 | 
			
		||||
    return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
_remove_pidiface_info_locked(int pid) {
 | 
			
		||||
    struct resolv_pidiface_info* result = &_res_pidiface_list;
 | 
			
		||||
    struct resolv_pidiface_info* prev = NULL;
 | 
			
		||||
 | 
			
		||||
    while (result != NULL && result->pid != pid) {
 | 
			
		||||
        prev = result;
 | 
			
		||||
        result = result->next;
 | 
			
		||||
    }
 | 
			
		||||
    if (prev != NULL && result != NULL) {
 | 
			
		||||
        prev->next = result->next;
 | 
			
		||||
        free(result);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static struct resolv_pidiface_info*
 | 
			
		||||
_get_pid_iface_info_locked(int pid)
 | 
			
		||||
{
 | 
			
		||||
    struct resolv_pidiface_info* result = &_res_pidiface_list;
 | 
			
		||||
    while (result != NULL && result->pid != pid) {
 | 
			
		||||
        result = result->next;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
_resolv_set_iface_for_pid(const char* ifname, int pid)
 | 
			
		||||
{
 | 
			
		||||
    // make sure the pid iface list is created
 | 
			
		||||
    pthread_once(&_res_cache_once, _res_cache_init);
 | 
			
		||||
    pthread_mutex_lock(&_res_pidiface_list_lock);
 | 
			
		||||
 | 
			
		||||
    struct resolv_pidiface_info* pidiface_info = _get_pid_iface_info_locked(pid);
 | 
			
		||||
    if (!pidiface_info) {
 | 
			
		||||
        pidiface_info = calloc(sizeof(*pidiface_info), 1);
 | 
			
		||||
        if (pidiface_info) {
 | 
			
		||||
            pidiface_info->pid = pid;
 | 
			
		||||
            int len = sizeof(pidiface_info->ifname);
 | 
			
		||||
            strncpy(pidiface_info->ifname, ifname, len - 1);
 | 
			
		||||
            pidiface_info->ifname[len - 1] = '\0';
 | 
			
		||||
 | 
			
		||||
            pidiface_info->next = _res_pidiface_list.next;
 | 
			
		||||
            _res_pidiface_list.next = pidiface_info;
 | 
			
		||||
 | 
			
		||||
            XLOG("_resolv_set_iface_for_pid: pid %d , iface %s\n", pid, ifname);
 | 
			
		||||
        } else {
 | 
			
		||||
            XLOG("_resolv_set_iface_for_pid failing calloc");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pthread_mutex_unlock(&_res_pidiface_list_lock);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
_resolv_clear_iface_for_pid(int pid)
 | 
			
		||||
{
 | 
			
		||||
    pthread_once(&_res_cache_once, _res_cache_init);
 | 
			
		||||
    pthread_mutex_lock(&_res_pidiface_list_lock);
 | 
			
		||||
 | 
			
		||||
    _remove_pidiface_info_locked(pid);
 | 
			
		||||
 | 
			
		||||
    XLOG("_resolv_clear_iface_for_pid: pid %d\n", pid);
 | 
			
		||||
 | 
			
		||||
    pthread_mutex_unlock(&_res_pidiface_list_lock);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
_resolv_get_pids_associated_interface(int pid, char* buff, int buffLen)
 | 
			
		||||
{
 | 
			
		||||
    int len = 0;
 | 
			
		||||
 | 
			
		||||
    if (!buff) {
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pthread_once(&_res_cache_once, _res_cache_init);
 | 
			
		||||
    pthread_mutex_lock(&_res_pidiface_list_lock);
 | 
			
		||||
 | 
			
		||||
    struct resolv_pidiface_info* pidiface_info = _get_pid_iface_info_locked(pid);
 | 
			
		||||
    buff[0] = '\0';
 | 
			
		||||
    if (pidiface_info) {
 | 
			
		||||
        len = strlen(pidiface_info->ifname);
 | 
			
		||||
        if (len < buffLen) {
 | 
			
		||||
            strncpy(buff, pidiface_info->ifname, len);
 | 
			
		||||
            buff[len] = '\0';
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    XLOG("_resolv_get_pids_associated_interface buff: %s\n", buff);
 | 
			
		||||
 | 
			
		||||
    pthread_mutex_unlock(&_res_pidiface_list_lock);
 | 
			
		||||
 | 
			
		||||
    return len;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
_resolv_get_default_iface(char* buff, int buffLen)
 | 
			
		||||
{
 | 
			
		||||
    char* ifname;
 | 
			
		||||
    int len = 0;
 | 
			
		||||
 | 
			
		||||
    if (!buff || buffLen == 0) {
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pthread_once(&_res_cache_once, _res_cache_init);
 | 
			
		||||
    pthread_mutex_lock(&_res_cache_list_lock);
 | 
			
		||||
 | 
			
		||||
    ifname = _get_default_iface_locked(); // never null, but may be empty
 | 
			
		||||
 | 
			
		||||
    // if default interface not set. Get first cache with an interface
 | 
			
		||||
    if (ifname[0] == '\0') {
 | 
			
		||||
        ifname = _find_any_iface_name_locked(); // may be null
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // if we got the default iface or if (no-default) the find_any call gave an answer
 | 
			
		||||
    if (ifname) {
 | 
			
		||||
        len = strlen(ifname);
 | 
			
		||||
        if (len < buffLen) {
 | 
			
		||||
            strncpy(buff, ifname, len);
 | 
			
		||||
            buff[len] = '\0';
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        buff[0] = '\0';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pthread_mutex_unlock(&_res_cache_list_lock);
 | 
			
		||||
 | 
			
		||||
    return len;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
_resolv_populate_res_for_iface(res_state statp)
 | 
			
		||||
{
 | 
			
		||||
    int nserv;
 | 
			
		||||
    struct resolv_cache_info* info = NULL;
 | 
			
		||||
 | 
			
		||||
    if (statp) {
 | 
			
		||||
        struct addrinfo* ai;
 | 
			
		||||
 | 
			
		||||
        if (statp->iface[0] == '\0') { // no interface set assign default
 | 
			
		||||
            _resolv_get_default_iface(statp->iface, sizeof(statp->iface));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        pthread_once(&_res_cache_once, _res_cache_init);
 | 
			
		||||
        pthread_mutex_lock(&_res_cache_list_lock);
 | 
			
		||||
        info = _find_cache_info_locked(statp->iface);
 | 
			
		||||
 | 
			
		||||
        if (info == NULL) {
 | 
			
		||||
            pthread_mutex_unlock(&_res_cache_list_lock);
 | 
			
		||||
            return 0;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        XLOG("_resolv_populate_res_for_iface: %s\n", statp->iface);
 | 
			
		||||
        for (nserv = 0; nserv < MAXNS; nserv++) {
 | 
			
		||||
            ai = info->nsaddrinfo[nserv];
 | 
			
		||||
            if (ai == NULL) {
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if ((size_t) ai->ai_addrlen <= sizeof(statp->_u._ext.ext->nsaddrs[0])) {
 | 
			
		||||
                if (statp->_u._ext.ext != NULL) {
 | 
			
		||||
                    memcpy(&statp->_u._ext.ext->nsaddrs[nserv], ai->ai_addr, ai->ai_addrlen);
 | 
			
		||||
                    statp->nsaddr_list[nserv].sin_family = AF_UNSPEC;
 | 
			
		||||
                } else {
 | 
			
		||||
                    if ((size_t) ai->ai_addrlen
 | 
			
		||||
                            <= sizeof(statp->nsaddr_list[0])) {
 | 
			
		||||
                        memcpy(&statp->nsaddr_list[nserv], ai->ai_addr,
 | 
			
		||||
                                ai->ai_addrlen);
 | 
			
		||||
                    } else {
 | 
			
		||||
                        statp->nsaddr_list[nserv].sin_family = AF_UNSPEC;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                XLOG("_resolv_populate_res_for_iface found too long addrlen");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        statp->nscount = nserv;
 | 
			
		||||
        // now do search domains.  Note that we cache the offsets as this code runs alot
 | 
			
		||||
        // but the setting/offset-computer only runs when set/changed
 | 
			
		||||
        strlcpy(statp->defdname, info->defdname, sizeof(statp->defdname));
 | 
			
		||||
        register char **pp = statp->dnsrch;
 | 
			
		||||
        register int *p = info->dnsrch_offset;
 | 
			
		||||
        while (pp < statp->dnsrch + MAXDNSRCH && *p != -1) {
 | 
			
		||||
            *pp++ = &statp->defdname + *p++;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        pthread_mutex_unlock(&_res_cache_list_lock);
 | 
			
		||||
    }
 | 
			
		||||
    return nserv;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -82,7 +82,13 @@ extern struct __res_state _nres;
 | 
			
		||||
 | 
			
		||||
int  res_ourserver_p(const res_state, const struct sockaddr *);
 | 
			
		||||
 | 
			
		||||
#ifdef ANDROID_CHANGES
 | 
			
		||||
static int res_need_init() {
 | 
			
		||||
	return ((_nres.options & RES_INIT) == 0U) || res_get_dns_changed();
 | 
			
		||||
}
 | 
			
		||||
#else
 | 
			
		||||
#define res_need_init()   ((_nres.options & RES_INIT) == 0U)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
res_init(void) {
 | 
			
		||||
 
 | 
			
		||||
@@ -111,6 +111,13 @@ __RCSID("$NetBSD: res_init.c,v 1.8 2006/03/19 03:10:08 christos Exp $");
 | 
			
		||||
/* ensure that sockaddr_in6 and IN6ADDR_ANY_INIT are declared / defined */
 | 
			
		||||
#ifdef ANDROID_CHANGES
 | 
			
		||||
#include "resolv_private.h"
 | 
			
		||||
#define MAX_DNS_PROPERTIES 8
 | 
			
		||||
#define DNS_PROP_NAME_PREFIX "net.dns"
 | 
			
		||||
#define DNS_CHANGE_PROP_NAME "net.dnschange"
 | 
			
		||||
#define DNS_SEARCH_PROP_NAME "net.dns.search"
 | 
			
		||||
static const prop_info *dns_change_prop;
 | 
			
		||||
static int dns_last_change_counter;
 | 
			
		||||
static int _get_dns_change_count();
 | 
			
		||||
#else
 | 
			
		||||
#include <resolv.h>
 | 
			
		||||
#endif
 | 
			
		||||
@@ -164,6 +171,41 @@ res_ninit(res_state statp) {
 | 
			
		||||
	return (__res_vinit(statp, 0));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef ANDROID_CHANGES
 | 
			
		||||
static int load_domain_search_list(res_state statp) {
 | 
			
		||||
	char propvalue[PROP_VALUE_MAX];
 | 
			
		||||
	register char *cp, **pp;
 | 
			
		||||
 | 
			
		||||
	if(__system_property_get(DNS_SEARCH_PROP_NAME, propvalue) >= 1) {
 | 
			
		||||
		strlcpy(statp->defdname, propvalue, sizeof(statp->defdname));
 | 
			
		||||
		if ((cp = strchr(statp->defdname, '\n')) != NULL)
 | 
			
		||||
			*cp = '\0';
 | 
			
		||||
		cp = statp->defdname;
 | 
			
		||||
		pp = statp->dnsrch;
 | 
			
		||||
		while ( pp < statp->dnsrch + MAXDNSRCH ) {
 | 
			
		||||
			while (*cp == ' ' || *cp == '\t') /* skip leading white space */
 | 
			
		||||
				cp++;
 | 
			
		||||
			if (*cp == '\0')  /* stop if nothing more */
 | 
			
		||||
				break;
 | 
			
		||||
			*pp++ = cp;  /* record this search domain */
 | 
			
		||||
			while (*cp) { /* zero-terminate it */
 | 
			
		||||
				if (*cp == ' ' || *cp == '\t') {
 | 
			
		||||
					*cp++ = '\0';
 | 
			
		||||
					break;
 | 
			
		||||
				}
 | 
			
		||||
				cp++;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		*pp = NULL; /* statp->dnsrch has MAXDNSRCH+1 items */
 | 
			
		||||
		if (pp > statp->dnsrch)
 | 
			
		||||
			return 1;
 | 
			
		||||
	}
 | 
			
		||||
	statp->defdname[0] = '\0';  /* no default domain name on Android */
 | 
			
		||||
	statp->dnsrch[0] = NULL;
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* This function has to be reachable by res_data.c but not publicly. */
 | 
			
		||||
int
 | 
			
		||||
__res_vinit(res_state statp, int preinit) {
 | 
			
		||||
@@ -178,6 +220,12 @@ __res_vinit(res_state statp, int preinit) {
 | 
			
		||||
	char *net;
 | 
			
		||||
	int dots;
 | 
			
		||||
	union res_sockaddr_union u[2];
 | 
			
		||||
#ifdef ANDROID_CHANGES
 | 
			
		||||
        pid_t mypid = getpid();
 | 
			
		||||
        int use_proc_props = 0;
 | 
			
		||||
        int found_prop;
 | 
			
		||||
	char dnsProperty[PROP_VALUE_MAX];
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
        if ((statp->options & RES_INIT) != 0U)
 | 
			
		||||
                res_ndestroy(statp);
 | 
			
		||||
@@ -270,8 +318,74 @@ __res_vinit(res_state statp, int preinit) {
 | 
			
		||||
	if (nserv > 0)
 | 
			
		||||
		statp->nscount = nserv;
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef ANDROID_CHANGES /* READ FROM SYSTEM PROPERTIES */
 | 
			
		||||
	dns_last_change_counter = _get_dns_change_count();
 | 
			
		||||
 | 
			
		||||
#ifndef ANDROID_CHANGES /* !ANDROID_CHANGES - IGNORE resolv.conf in Android */
 | 
			
		||||
	nserv = 0;
 | 
			
		||||
	for(n = 1; n <= MAX_DNS_PROPERTIES && nserv < MAXNS; n++) {
 | 
			
		||||
		char propname[PROP_NAME_MAX];
 | 
			
		||||
		char propvalue[PROP_VALUE_MAX];
 | 
			
		||||
 | 
			
		||||
		struct addrinfo hints, *ai;
 | 
			
		||||
		char sbuf[NI_MAXSERV];
 | 
			
		||||
		const size_t minsiz = sizeof(statp->_u._ext.ext->nsaddrs[0]);
 | 
			
		||||
 | 
			
		||||
		/*
 | 
			
		||||
		 * Check first for process-specific properties, and if those don't
 | 
			
		||||
		 * exist, try the generic properties.
 | 
			
		||||
		 */
 | 
			
		||||
		found_prop = 0;
 | 
			
		||||
		if (n == 1 || use_proc_props) {
 | 
			
		||||
			snprintf(propname, sizeof(propname), "%s%d.%d", DNS_PROP_NAME_PREFIX, n, mypid);
 | 
			
		||||
			if(__system_property_get(propname, propvalue) < 1) {
 | 
			
		||||
				if (use_proc_props) {
 | 
			
		||||
					break;
 | 
			
		||||
				}
 | 
			
		||||
			} else {
 | 
			
		||||
				found_prop = 1;
 | 
			
		||||
				use_proc_props = 1;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if (!found_prop) {
 | 
			
		||||
			snprintf(propname, sizeof(propname), "%s%d", DNS_PROP_NAME_PREFIX, n);
 | 
			
		||||
			if(__system_property_get(propname, propvalue) < 1) {
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		cp = propvalue;
 | 
			
		||||
 | 
			
		||||
		while (*cp == ' ' || *cp == '\t')
 | 
			
		||||
			cp++;
 | 
			
		||||
		cp[strcspn(cp, ";# \t\n")] = '\0';
 | 
			
		||||
		if ((*cp != '\0') && (*cp != '\n')) {
 | 
			
		||||
			memset(&hints, 0, sizeof(hints));
 | 
			
		||||
			hints.ai_family = PF_UNSPEC;
 | 
			
		||||
			hints.ai_socktype = SOCK_DGRAM;	/*dummy*/
 | 
			
		||||
			hints.ai_flags = AI_NUMERICHOST;
 | 
			
		||||
			sprintf(sbuf, "%u", NAMESERVER_PORT);
 | 
			
		||||
			if (getaddrinfo(cp, sbuf, &hints, &ai) == 0 &&
 | 
			
		||||
			    (size_t)ai->ai_addrlen <= minsiz) {
 | 
			
		||||
				if (statp->_u._ext.ext != NULL) {
 | 
			
		||||
					memcpy(&statp->_u._ext.ext->nsaddrs[nserv],
 | 
			
		||||
					       ai->ai_addr, ai->ai_addrlen);
 | 
			
		||||
				}
 | 
			
		||||
				if ((size_t)ai->ai_addrlen <=
 | 
			
		||||
				    sizeof(statp->nsaddr_list[nserv])) {
 | 
			
		||||
					memcpy(&statp->nsaddr_list[nserv],
 | 
			
		||||
					       ai->ai_addr, ai->ai_addrlen);
 | 
			
		||||
				} else {
 | 
			
		||||
					statp->nsaddr_list[nserv].sin_family = 0;
 | 
			
		||||
				}
 | 
			
		||||
				freeaddrinfo(ai);
 | 
			
		||||
				nserv++;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Add the domain search list */
 | 
			
		||||
	havesearch = load_domain_search_list(statp);
 | 
			
		||||
#else /* !ANDROID_CHANGES - IGNORE resolv.conf in Android */
 | 
			
		||||
#define	MATCH(line, name) \
 | 
			
		||||
	(!strncmp(line, name, sizeof(name) - 1) && \
 | 
			
		||||
	(line[sizeof(name) - 1] == ' ' || \
 | 
			
		||||
@@ -793,17 +907,32 @@ res_getservers(res_state statp, union res_sockaddr_union *set, int cnt) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef ANDROID_CHANGES
 | 
			
		||||
void res_setiface(res_state statp, const char* iface)
 | 
			
		||||
static int _get_dns_change_count()
 | 
			
		||||
{
 | 
			
		||||
	if (statp != NULL) {
 | 
			
		||||
		// set interface
 | 
			
		||||
		if (iface && iface[0] != '\0') {
 | 
			
		||||
			int len = sizeof(statp->iface);
 | 
			
		||||
			strncpy(statp->iface, iface, len - 1);
 | 
			
		||||
			statp->iface[len - 1] = '\0';
 | 
			
		||||
		} else {
 | 
			
		||||
			statp->iface[0] = '\0';
 | 
			
		||||
	if (dns_change_prop == NULL) {
 | 
			
		||||
		dns_change_prop = __system_property_find(DNS_CHANGE_PROP_NAME);
 | 
			
		||||
	}
 | 
			
		||||
	if (dns_change_prop != NULL) {
 | 
			
		||||
		char propvalue[PROP_VALUE_MAX];
 | 
			
		||||
		if (__system_property_read(dns_change_prop, NULL, propvalue) >= 1) {
 | 
			
		||||
			return atoi(propvalue);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int res_get_dns_changed()
 | 
			
		||||
{
 | 
			
		||||
	int change_count;
 | 
			
		||||
 | 
			
		||||
	change_count = _get_dns_change_count();
 | 
			
		||||
	if (change_count != dns_last_change_counter) {
 | 
			
		||||
		if (change_count != -1) {
 | 
			
		||||
			dns_last_change_counter = change_count;
 | 
			
		||||
		}
 | 
			
		||||
		return 1;
 | 
			
		||||
	} else {
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
#endif /* ANDROID_CHANGES */
 | 
			
		||||
 
 | 
			
		||||
@@ -370,13 +370,10 @@ res_nsend(res_state statp,
 | 
			
		||||
        ResolvCacheStatus     cache_status = RESOLV_CACHE_UNSUPPORTED;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !USE_RESOLV_CACHE
 | 
			
		||||
	if (statp->nscount == 0) {
 | 
			
		||||
		errno = ESRCH;
 | 
			
		||||
		return (-1);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (anssiz < HFIXEDSZ) {
 | 
			
		||||
		errno = EINVAL;
 | 
			
		||||
		return (-1);
 | 
			
		||||
@@ -388,27 +385,17 @@ res_nsend(res_state statp,
 | 
			
		||||
	terrno = ETIMEDOUT;
 | 
			
		||||
 | 
			
		||||
#if USE_RESOLV_CACHE
 | 
			
		||||
	// get the cache associated with the interface
 | 
			
		||||
	cache = __get_res_cache(statp->iface);
 | 
			
		||||
	if (cache != NULL) {
 | 
			
		||||
		int  anslen = 0;
 | 
			
		||||
		cache_status = _resolv_cache_lookup(
 | 
			
		||||
				cache, buf, buflen,
 | 
			
		||||
				ans, anssiz, &anslen);
 | 
			
		||||
        cache = __get_res_cache();
 | 
			
		||||
        if (cache != NULL) {
 | 
			
		||||
            int  anslen = 0;
 | 
			
		||||
            cache_status = _resolv_cache_lookup(
 | 
			
		||||
                                cache, buf, buflen,
 | 
			
		||||
                                ans, anssiz, &anslen);
 | 
			
		||||
 | 
			
		||||
		if (cache_status == RESOLV_CACHE_FOUND) {
 | 
			
		||||
			return anslen;
 | 
			
		||||
		} else {
 | 
			
		||||
			// had a cache miss for a known interface, so populate the thread private
 | 
			
		||||
			// data so the normal resolve path can do its thing
 | 
			
		||||
			_resolv_populate_res_for_iface(statp);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (statp->nscount == 0) {
 | 
			
		||||
		errno = ESRCH;
 | 
			
		||||
		return (-1);
 | 
			
		||||
	}
 | 
			
		||||
            if (cache_status == RESOLV_CACHE_FOUND) {
 | 
			
		||||
                return anslen;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
 
 | 
			
		||||
@@ -50,7 +50,7 @@
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static pthread_key_t   _res_key;
 | 
			
		||||
static pthread_once_t  _res_once = PTHREAD_ONCE_INIT;
 | 
			
		||||
static pthread_once_t  _res_once;
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    int                  _h_errno;
 | 
			
		||||
 
 | 
			
		||||
@@ -28,65 +28,47 @@
 | 
			
		||||
#ifndef _RESOLV_CACHE_H_
 | 
			
		||||
#define _RESOLV_CACHE_H_
 | 
			
		||||
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
 | 
			
		||||
struct __res_state;
 | 
			
		||||
struct resolv_cache;  /* forward */
 | 
			
		||||
 | 
			
		||||
/* gets the cache for an interface. Set ifname argument to NULL or
 | 
			
		||||
 * empty buffer ('\0') to get cache for default interface.
 | 
			
		||||
 * returned cache might be NULL*/
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern struct resolv_cache*  __get_res_cache(const char* ifname);
 | 
			
		||||
/* gets the cache for the default interface. Might be NULL*/
 | 
			
		||||
extern struct resolv_cache*  __get_res_cache(void);
 | 
			
		||||
 | 
			
		||||
/* get the cache for a specified interface. Can be NULL*/
 | 
			
		||||
extern struct resolv_cache* __get_res_cache_for_iface(const char* ifname);
 | 
			
		||||
 | 
			
		||||
/* this gets called everytime we detect some changes in the DNS configuration
 | 
			
		||||
 * and will flush the cache */
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern void  _resolv_cache_reset( unsigned  generation );
 | 
			
		||||
 | 
			
		||||
/* Gets the address of the n:th name server for the default interface
 | 
			
		||||
 * Return length of address on success else 0.
 | 
			
		||||
 * Note: The first name server is at n = 1 */
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern int _resolv_cache_get_nameserver(int n, char* addr, int addrLen);
 | 
			
		||||
 | 
			
		||||
/* Gets the address of the n:th name server for a certain interface
 | 
			
		||||
 * Return length of address on success else 0.
 | 
			
		||||
 * Note: The first name server is at n = 1 */
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern int _resolv_cache_get_nameserver_for_iface(const char* ifname, int n,
 | 
			
		||||
        char* addr, int addrLen);
 | 
			
		||||
 | 
			
		||||
/* Gets addrinfo of the n:th name server associated with an interface.
 | 
			
		||||
 * NULL is returned if no address if found.
 | 
			
		||||
 * Note: The first name server is at n = 1. */
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern struct addrinfo* _resolv_cache_get_nameserver_addr_for_iface(const char* ifname, int n);
 | 
			
		||||
 | 
			
		||||
/* Gets addrinfo of the n:th name server associated with the default interface
 | 
			
		||||
 * NULL is returned if no address if found.
 | 
			
		||||
 * Note: The first name server is at n = 1. */
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern struct addrinfo* _resolv_cache_get_nameserver_addr(int n);
 | 
			
		||||
 | 
			
		||||
/* gets the address associated with the default interface */
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern struct in_addr* _resolv_get_addr_of_default_iface();
 | 
			
		||||
 | 
			
		||||
/* gets the address associated with the specified interface */
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern struct in_addr* _resolv_get_addr_of_iface(const char* ifname);
 | 
			
		||||
 | 
			
		||||
/* Copy the name of the default interface to provided buffer.
 | 
			
		||||
 * Return length of buffer on success on failure -1 is returned */
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern int _resolv_get_default_iface(char* buff, int buffLen);
 | 
			
		||||
 | 
			
		||||
/* sets the name server addresses to the provided res_state structure. The
 | 
			
		||||
 * name servers are retrieved from the cache which is associated
 | 
			
		||||
 * with the interface to which the res_state structure is associated */
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern int _resolv_populate_res_for_iface(struct __res_state* statp);
 | 
			
		||||
/* Get name of default interface */
 | 
			
		||||
extern char* _resolv_get_default_iface();
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
    RESOLV_CACHE_UNSUPPORTED,  /* the cache can't handle that kind of queries */
 | 
			
		||||
@@ -95,7 +77,6 @@ typedef enum {
 | 
			
		||||
    RESOLV_CACHE_FOUND         /* the cache found the answer */
 | 
			
		||||
} ResolvCacheStatus;
 | 
			
		||||
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern ResolvCacheStatus
 | 
			
		||||
_resolv_cache_lookup( struct resolv_cache*  cache,
 | 
			
		||||
                      const void*           query,
 | 
			
		||||
@@ -107,7 +88,6 @@ _resolv_cache_lookup( struct resolv_cache*  cache,
 | 
			
		||||
/* add a (query,answer) to the cache, only call if _resolv_cache_lookup
 | 
			
		||||
 * did return RESOLV_CACHE_NOTFOUND
 | 
			
		||||
 */
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern void
 | 
			
		||||
_resolv_cache_add( struct resolv_cache*  cache,
 | 
			
		||||
                   const void*           query,
 | 
			
		||||
@@ -116,7 +96,6 @@ _resolv_cache_add( struct resolv_cache*  cache,
 | 
			
		||||
                   int                   answerlen );
 | 
			
		||||
 | 
			
		||||
/* Notify the cache a request failed */
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern void
 | 
			
		||||
_resolv_cache_query_failed( struct resolv_cache* cache,
 | 
			
		||||
                   const void* query,
 | 
			
		||||
 
 | 
			
		||||
@@ -48,8 +48,7 @@ __BEGIN_DECLS
 | 
			
		||||
extern void _resolv_set_default_iface(const char* ifname);
 | 
			
		||||
 | 
			
		||||
/* set name servers for an interface */
 | 
			
		||||
extern void _resolv_set_nameservers_for_iface(const char* ifname, char** servers, int numservers,
 | 
			
		||||
        const char *domains);
 | 
			
		||||
extern void _resolv_set_nameservers_for_iface(const char* ifname, char** servers, int numservers);
 | 
			
		||||
 | 
			
		||||
/* tell resolver of the address of an interface */
 | 
			
		||||
extern void _resolv_set_addr_of_iface(const char* ifname, struct in_addr* addr);
 | 
			
		||||
@@ -60,21 +59,6 @@ extern void _resolv_flush_cache_for_default_iface();
 | 
			
		||||
/* flush the cache associated with a certain interface */
 | 
			
		||||
extern void _resolv_flush_cache_for_iface(const char* ifname);
 | 
			
		||||
 | 
			
		||||
/* set a pid to use the name servers of the specified interface */
 | 
			
		||||
extern void _resolv_set_iface_for_pid(const char* ifname, int pid);
 | 
			
		||||
 | 
			
		||||
/* clear pid from being associated with an interface */
 | 
			
		||||
extern void _resolv_clear_iface_for_pid(int pid);
 | 
			
		||||
 | 
			
		||||
/** Gets the name of the interface to which the pid is attached.
 | 
			
		||||
 *  On error, -1 is returned.
 | 
			
		||||
 *  If no interface is found, 0 is returned and buff is set to empty ('\0').
 | 
			
		||||
 *  If an interface is found, the name is copied to buff and the length of the name is returned.
 | 
			
		||||
 *  Arguments:   pid The pid to find an interface for
 | 
			
		||||
 *               buff A buffer to copy the result to
 | 
			
		||||
 *               buffLen Length of buff. An interface is at most IF_NAMESIZE in length */
 | 
			
		||||
extern int _resolv_get_pids_associated_interface(int pid, char* buff, int buffLen);
 | 
			
		||||
 | 
			
		||||
#endif /* _BIONIC_RESOLV_IFACE_FUNCTIONS_DECLARED */
 | 
			
		||||
 | 
			
		||||
__END_DECLS
 | 
			
		||||
 
 | 
			
		||||
@@ -56,7 +56,6 @@
 | 
			
		||||
 | 
			
		||||
#include <resolv.h>
 | 
			
		||||
#include "resolv_static.h"
 | 
			
		||||
#include <net/if.h>
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Revision information.  This is the release date in YYYYMMDD format.
 | 
			
		||||
@@ -140,7 +139,6 @@ struct res_sym {
 | 
			
		||||
struct __res_state_ext;
 | 
			
		||||
 | 
			
		||||
struct __res_state {
 | 
			
		||||
	char	iface[IF_NAMESIZE+1];
 | 
			
		||||
	int	retrans;	 	/* retransmission time interval */
 | 
			
		||||
	int	retry;			/* number of times to retransmit */
 | 
			
		||||
#ifdef sun
 | 
			
		||||
@@ -493,7 +491,7 @@ void		res_setservers(res_state,
 | 
			
		||||
int		res_getservers(res_state,
 | 
			
		||||
				    union res_sockaddr_union *, int);
 | 
			
		||||
 | 
			
		||||
void res_setiface();
 | 
			
		||||
int res_get_dns_changed();
 | 
			
		||||
u_int  res_randomid(void);
 | 
			
		||||
 | 
			
		||||
__END_DECLS
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@
 | 
			
		||||
"""Updates the tzdata file."""
 | 
			
		||||
 | 
			
		||||
import ftplib
 | 
			
		||||
import httplib
 | 
			
		||||
import os
 | 
			
		||||
import re
 | 
			
		||||
import subprocess
 | 
			
		||||
@@ -58,27 +59,57 @@ def WriteSetupFile():
 | 
			
		||||
  setup.close()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def Retrieve(ftp, filename):
 | 
			
		||||
  ftp.retrbinary('RETR %s' % filename, open(filename, 'wb').write)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def UpgradeTo(ftp, data_filename):
 | 
			
		||||
  """Downloads and repackages the given data from the given FTP server."""
 | 
			
		||||
 | 
			
		||||
  new_version = re.search('(tzdata.+)\\.tar\\.gz', data_filename).group(1)
 | 
			
		||||
 | 
			
		||||
  # Switch to a temporary directory.
 | 
			
		||||
def SwitchToNewTemporaryDirectory():
 | 
			
		||||
  tmp_dir = tempfile.mkdtemp('-tzdata')
 | 
			
		||||
  os.chdir(tmp_dir)
 | 
			
		||||
  print 'Created temporary directory "%s"...' % tmp_dir
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def FtpRetrieve(ftp, filename):
 | 
			
		||||
  ftp.retrbinary('RETR %s' % filename, open(filename, 'wb').write)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def FtpUpgrade(ftp, data_filename):
 | 
			
		||||
  """Downloads and repackages the given data from the given FTP server."""
 | 
			
		||||
  SwitchToNewTemporaryDirectory()
 | 
			
		||||
 | 
			
		||||
  print 'Downloading data...'
 | 
			
		||||
  Retrieve(ftp, data_filename)
 | 
			
		||||
  FtpRetrieve(ftp, data_filename)
 | 
			
		||||
 | 
			
		||||
  print 'Downloading signature...'
 | 
			
		||||
  signature_filename = '%s.asc' % data_filename
 | 
			
		||||
  Retrieve(ftp, signature_filename)
 | 
			
		||||
  FtpRetrieve(ftp, signature_filename)
 | 
			
		||||
 | 
			
		||||
  ExtractAndCompile(data_filename)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def HttpRetrieve(http, path, output_filename):
 | 
			
		||||
  http.request("GET", path)
 | 
			
		||||
  f = open(output_filename, 'wb')
 | 
			
		||||
  f.write(http.getresponse().read())
 | 
			
		||||
  f.close()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def HttpUpgrade(http, data_filename):
 | 
			
		||||
  """Downloads and repackages the given data from the given HTTP server."""
 | 
			
		||||
  SwitchToNewTemporaryDirectory()
 | 
			
		||||
 | 
			
		||||
  path = "/time-zones/repository/releases/%s" % data_filename
 | 
			
		||||
 | 
			
		||||
  print 'Downloading data...'
 | 
			
		||||
  HttpRetrieve(http, path, data_filename)
 | 
			
		||||
 | 
			
		||||
  print 'Downloading signature...'
 | 
			
		||||
  signature_filename = '%s.asc' % data_filename
 | 
			
		||||
  HttpRetrieve(http, "%s.asc" % path, signature_filename)
 | 
			
		||||
 | 
			
		||||
  ExtractAndCompile(data_filename)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def ExtractAndCompile(data_filename):
 | 
			
		||||
  new_version = re.search('(tzdata.+)\\.tar\\.gz', data_filename).group(1)
 | 
			
		||||
 | 
			
		||||
  signature_filename = '%s.asc' % data_filename
 | 
			
		||||
  print 'Verifying signature...'
 | 
			
		||||
  # If this fails for you, you probably need to import Paul Eggert's public key:
 | 
			
		||||
  # gpg --recv-keys ED97E90E62AA7E34
 | 
			
		||||
@@ -113,14 +144,29 @@ def UpgradeTo(ftp, data_filename):
 | 
			
		||||
# See http://www.iana.org/time-zones/ for more about the source of this data.
 | 
			
		||||
def main():
 | 
			
		||||
  print 'Looking for new tzdata...'
 | 
			
		||||
  ftp = ftplib.FTP('ftp.iana.org')
 | 
			
		||||
  ftp.login()
 | 
			
		||||
  ftp.cwd('tz/releases')
 | 
			
		||||
 | 
			
		||||
  tzdata_filenames = []
 | 
			
		||||
  for filename in ftp.nlst():
 | 
			
		||||
    if filename.startswith('tzdata20') and filename.endswith('.tar.gz'):
 | 
			
		||||
      tzdata_filenames.append(filename)
 | 
			
		||||
  tzdata_filenames.sort()
 | 
			
		||||
 | 
			
		||||
  # The FTP server lets you download intermediate releases, and also lets you
 | 
			
		||||
  # download the signatures for verification, so it's your best choice.
 | 
			
		||||
  use_ftp = True
 | 
			
		||||
 | 
			
		||||
  if use_ftp:
 | 
			
		||||
    ftp = ftplib.FTP('ftp.iana.org')
 | 
			
		||||
    ftp.login()
 | 
			
		||||
    ftp.cwd('tz/releases')
 | 
			
		||||
    for filename in ftp.nlst():
 | 
			
		||||
      if filename.startswith('tzdata20') and filename.endswith('.tar.gz'):
 | 
			
		||||
        tzdata_filenames.append(filename)
 | 
			
		||||
    tzdata_filenames.sort()
 | 
			
		||||
  else:
 | 
			
		||||
    http = httplib.HTTPConnection('www.iana.org')
 | 
			
		||||
    http.request("GET", "/time-zones")
 | 
			
		||||
    index_lines = http.getresponse().read().split('\n')
 | 
			
		||||
    for line in index_lines:
 | 
			
		||||
      m = re.compile('.*href="/time-zones/repository/releases/(tzdata20\d\d\c\.tar\.gz)".*').match(line)
 | 
			
		||||
      if m:
 | 
			
		||||
        tzdata_filenames.append(m.group(1))
 | 
			
		||||
 | 
			
		||||
  # If you're several releases behind, we'll walk you through the upgrades
 | 
			
		||||
  # one by one.
 | 
			
		||||
@@ -129,7 +175,10 @@ def main():
 | 
			
		||||
  for filename in tzdata_filenames:
 | 
			
		||||
    if filename > current_filename:
 | 
			
		||||
      print 'Found new tzdata: %s' % filename
 | 
			
		||||
      UpgradeTo(ftp, filename)
 | 
			
		||||
      if use_ftp:
 | 
			
		||||
        FtpUpgrade(ftp, filename)
 | 
			
		||||
      else:
 | 
			
		||||
        HttpUpgrade(http, filename)
 | 
			
		||||
      sys.exit(0)
 | 
			
		||||
 | 
			
		||||
  print 'You already have the latest tzdata (%s)!' % current_version
 | 
			
		||||
@@ -2276,14 +2276,18 @@ static int __bionic_open_tzdata_path(const char* path, const char* olson_id, int
 | 
			
		||||
    int32_t data_offset;
 | 
			
		||||
    int32_t zonetab_offset;
 | 
			
		||||
  } header;
 | 
			
		||||
  if (TEMP_FAILURE_RETRY(read(fd, &header, sizeof(header))) != sizeof(header)) {
 | 
			
		||||
    fprintf(stderr, "%s: could not read header: %s\n", __FUNCTION__, strerror(errno));
 | 
			
		||||
  memset(&header, 0, sizeof(header));
 | 
			
		||||
  ssize_t bytes_read = TEMP_FAILURE_RETRY(read(fd, &header, sizeof(header)));
 | 
			
		||||
  if (bytes_read != sizeof(header)) {
 | 
			
		||||
    fprintf(stderr, "%s: could not read header of \"%s\": %s\n",
 | 
			
		||||
            __FUNCTION__, path, (bytes_read == -1) ? strerror(errno) : "short read");
 | 
			
		||||
    close(fd);
 | 
			
		||||
    return -1;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (strncmp(header.tzdata_version, "tzdata", 6) != 0 || header.tzdata_version[11] != 0) {
 | 
			
		||||
    fprintf(stderr, "%s: bad magic: %s\n", __FUNCTION__, header.tzdata_version);
 | 
			
		||||
    fprintf(stderr, "%s: bad magic in \"%s\": \"%.6s\"\n",
 | 
			
		||||
            __FUNCTION__, path, header.tzdata_version);
 | 
			
		||||
    close(fd);
 | 
			
		||||
    return -1;
 | 
			
		||||
  }
 | 
			
		||||
@@ -2296,7 +2300,8 @@ static int __bionic_open_tzdata_path(const char* path, const char* olson_id, int
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  if (TEMP_FAILURE_RETRY(lseek(fd, ntohl(header.index_offset), SEEK_SET)) == -1) {
 | 
			
		||||
    fprintf(stderr, "%s: couldn't seek to index: %s\n", __FUNCTION__, strerror(errno));
 | 
			
		||||
    fprintf(stderr, "%s: couldn't seek to index in \"%s\": %s\n",
 | 
			
		||||
            __FUNCTION__, path, strerror(errno));
 | 
			
		||||
    close(fd);
 | 
			
		||||
    return -1;
 | 
			
		||||
  }
 | 
			
		||||
@@ -2330,11 +2335,14 @@ static int __bionic_open_tzdata_path(const char* path, const char* olson_id, int
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (TEMP_FAILURE_RETRY(lseek(fd, specific_zone_offset, SEEK_SET)) == -1) {
 | 
			
		||||
    fprintf(stderr, "%s: could not seek to %ld: %s\n", __FUNCTION__, specific_zone_offset, strerror(errno));
 | 
			
		||||
    fprintf(stderr, "%s: could not seek to %ld in \"%s\": %s\n",
 | 
			
		||||
            __FUNCTION__, specific_zone_offset, path, strerror(errno));
 | 
			
		||||
    close(fd);
 | 
			
		||||
    return -1;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // TODO: check that there's TZ_MAGIC at this offset, so we can fall back to the other file if not.
 | 
			
		||||
 | 
			
		||||
  return fd;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -17,4 +17,12 @@
 | 
			
		||||
#ifndef _BIONIC_FREEBSD_COMPAT_H_included
 | 
			
		||||
#define _BIONIC_FREEBSD_COMPAT_H_included
 | 
			
		||||
 | 
			
		||||
#define __USE_BSD
 | 
			
		||||
 | 
			
		||||
#define _close close
 | 
			
		||||
#define _fcntl fcntl
 | 
			
		||||
#define _open open
 | 
			
		||||
 | 
			
		||||
#define _sseek __sseek /* Needed as long as we have a mix of OpenBSD and FreeBSD stdio. */
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: clrerr.c,v 1.6 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,14 +30,32 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)clrerr.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include "namespace.h"
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include "local.h"
 | 
			
		||||
#undef	clearerr
 | 
			
		||||
#include "un-namespace.h"
 | 
			
		||||
#include "libc_private.h"
 | 
			
		||||
 | 
			
		||||
#undef clearerr
 | 
			
		||||
#undef clearerr_unlocked
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
clearerr(FILE *fp)
 | 
			
		||||
clearerr(fp)
 | 
			
		||||
	FILE *fp;
 | 
			
		||||
{
 | 
			
		||||
	FLOCKFILE(fp);
 | 
			
		||||
	__sclearerr(fp);
 | 
			
		||||
	FUNLOCKFILE(fp);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
clearerr_unlocked(FILE *fp)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	__sclearerr(fp);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: fclose.c,v 1.6 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,9 +30,19 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)fclose.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include "namespace.h"
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include "un-namespace.h"
 | 
			
		||||
#include <spinlock.h>
 | 
			
		||||
#include "libc_private.h"
 | 
			
		||||
#include "local.h"
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
@@ -46,7 +55,6 @@ fclose(FILE *fp)
 | 
			
		||||
		return (EOF);
 | 
			
		||||
	}
 | 
			
		||||
	FLOCKFILE(fp);
 | 
			
		||||
	WCIO_FREE(fp);
 | 
			
		||||
	r = fp->_flags & __SWR ? __sflush(fp) : 0;
 | 
			
		||||
	if (fp->_close != NULL && (*fp->_close)(fp->_cookie) < 0)
 | 
			
		||||
		r = EOF;
 | 
			
		||||
@@ -56,8 +64,22 @@ fclose(FILE *fp)
 | 
			
		||||
		FREEUB(fp);
 | 
			
		||||
	if (HASLB(fp))
 | 
			
		||||
		FREELB(fp);
 | 
			
		||||
	fp->_file = -1;
 | 
			
		||||
	fp->_r = fp->_w = 0;	/* Mess up if reaccessed. */
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Lock the spinlock used to protect __sglue list walk in
 | 
			
		||||
	 * __sfp().  The __sfp() uses fp->_flags == 0 test as an
 | 
			
		||||
	 * indication of the unused FILE.
 | 
			
		||||
	 *
 | 
			
		||||
	 * Taking the lock prevents possible compiler or processor
 | 
			
		||||
	 * reordering of the writes performed before the final _flags
 | 
			
		||||
	 * cleanup, making sure that we are done with the FILE before
 | 
			
		||||
	 * it is considered available.
 | 
			
		||||
	 */
 | 
			
		||||
	STDIO_THREAD_LOCK();
 | 
			
		||||
	fp->_flags = 0;		/* Release this FILE for reuse. */
 | 
			
		||||
	STDIO_THREAD_UNLOCK();
 | 
			
		||||
	FUNLOCKFILE(fp);
 | 
			
		||||
	return (r);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: fdopen.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,24 +30,47 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)fdopen.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include "namespace.h"
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <limits.h>
 | 
			
		||||
#include "un-namespace.h"
 | 
			
		||||
#include "local.h"
 | 
			
		||||
 | 
			
		||||
FILE *
 | 
			
		||||
fdopen(int fd, const char *mode)
 | 
			
		||||
fdopen(fd, mode)
 | 
			
		||||
	int fd;
 | 
			
		||||
	const char *mode;
 | 
			
		||||
{
 | 
			
		||||
	FILE *fp;
 | 
			
		||||
	int flags, oflags, fdflags, tmp;
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * File descriptors are a full int, but _file is only a short.
 | 
			
		||||
	 * If we get a valid file descriptor that is greater than
 | 
			
		||||
	 * SHRT_MAX, then the fd will get sign-extended into an
 | 
			
		||||
	 * invalid file descriptor.  Handle this case by failing the
 | 
			
		||||
	 * open.
 | 
			
		||||
	 */
 | 
			
		||||
	if (fd > SHRT_MAX) {
 | 
			
		||||
		errno = EMFILE;
 | 
			
		||||
		return (NULL);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if ((flags = __sflags(mode, &oflags)) == 0)
 | 
			
		||||
		return (NULL);
 | 
			
		||||
 | 
			
		||||
	/* Make sure the mode the user wants is a subset of the actual mode. */
 | 
			
		||||
	if ((fdflags = fcntl(fd, F_GETFL, 0)) < 0)
 | 
			
		||||
	if ((fdflags = _fcntl(fd, F_GETFL, 0)) < 0)
 | 
			
		||||
		return (NULL);
 | 
			
		||||
	tmp = fdflags & O_ACCMODE;
 | 
			
		||||
	if (tmp != O_RDWR && (tmp != (oflags & O_ACCMODE))) {
 | 
			
		||||
@@ -58,11 +80,17 @@ fdopen(int fd, const char *mode)
 | 
			
		||||
 | 
			
		||||
	if ((fp = __sfp()) == NULL)
 | 
			
		||||
		return (NULL);
 | 
			
		||||
 | 
			
		||||
	if ((oflags & O_CLOEXEC) && _fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) {
 | 
			
		||||
		fp->_flags = 0;
 | 
			
		||||
		return (NULL);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fp->_flags = flags;
 | 
			
		||||
	/*
 | 
			
		||||
	 * If opened for appending, but underlying descriptor does not have
 | 
			
		||||
	 * O_APPEND bit set, assert __SAPP so that __swrite() will lseek to
 | 
			
		||||
	 * end before each write.
 | 
			
		||||
	 * O_APPEND bit set, assert __SAPP so that __swrite() caller
 | 
			
		||||
	 * will _sseek() to the end before write.
 | 
			
		||||
	 */
 | 
			
		||||
	if ((oflags & O_APPEND) && !(fdflags & O_APPEND))
 | 
			
		||||
		fp->_flags |= __SAPP;
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: feof.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,21 +30,34 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include "local.h"
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)feof.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include "namespace.h"
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include "un-namespace.h"
 | 
			
		||||
#include "libc_private.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * A subroutine version of the macro feof.
 | 
			
		||||
 */
 | 
			
		||||
#undef feof
 | 
			
		||||
#undef feof_unlocked
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
feof(FILE *fp)
 | 
			
		||||
{
 | 
			
		||||
	int ret;
 | 
			
		||||
	int	ret;
 | 
			
		||||
 | 
			
		||||
	FLOCKFILE(fp);
 | 
			
		||||
	ret = __sfeof(fp);
 | 
			
		||||
	ret= __sfeof(fp);
 | 
			
		||||
	FUNLOCKFILE(fp);
 | 
			
		||||
	return (ret);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
feof_unlocked(FILE *fp)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	return (__sfeof(fp));
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: ferror.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,15 +30,34 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)ferror.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include "namespace.h"
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include "un-namespace.h"
 | 
			
		||||
#include "libc_private.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * A subroutine version of the macro ferror.
 | 
			
		||||
 */
 | 
			
		||||
#undef ferror
 | 
			
		||||
#undef ferror_unlocked
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
ferror(FILE *fp)
 | 
			
		||||
{
 | 
			
		||||
	int	ret;
 | 
			
		||||
 | 
			
		||||
	FLOCKFILE(fp);
 | 
			
		||||
	ret = __sferror(fp);
 | 
			
		||||
	FUNLOCKFILE(fp);
 | 
			
		||||
	return (ret);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
ferror_unlocked(FILE *fp)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	return (__sferror(fp));
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: fgetln.c,v 1.7 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,9 +30,18 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)fgetln.c	8.2 (Berkeley) 1/2/94";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include "namespace.h"
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include "un-namespace.h"
 | 
			
		||||
#include "libc_private.h"
 | 
			
		||||
#include "local.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
@@ -43,7 +51,7 @@
 | 
			
		||||
 * so we add 1 here.
 | 
			
		||||
#endif
 | 
			
		||||
 */
 | 
			
		||||
static int
 | 
			
		||||
int
 | 
			
		||||
__slbexpand(FILE *fp, size_t newsize)
 | 
			
		||||
{
 | 
			
		||||
	void *p;
 | 
			
		||||
@@ -51,7 +59,7 @@ __slbexpand(FILE *fp, size_t newsize)
 | 
			
		||||
#ifdef notdef
 | 
			
		||||
	++newsize;
 | 
			
		||||
#endif
 | 
			
		||||
	if ((size_t)fp->_lb._size >= newsize)
 | 
			
		||||
	if (fp->_lb._size >= newsize)
 | 
			
		||||
		return (0);
 | 
			
		||||
	if ((p = realloc(fp->_lb._base, newsize)) == NULL)
 | 
			
		||||
		return (-1);
 | 
			
		||||
@@ -62,7 +70,7 @@ __slbexpand(FILE *fp, size_t newsize)
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Get an input line.  The returned pointer often (but not always)
 | 
			
		||||
 * points into a stdio buffer.  Fgetline does not alter the text of
 | 
			
		||||
 * points into a stdio buffer.  Fgetln does not alter the text of
 | 
			
		||||
 * the returned line (which is thus not a C string because it will
 | 
			
		||||
 * not necessarily end with '\0'), but does allow callers to modify
 | 
			
		||||
 * it if they wish.  Thus, we set __SMOD in case the caller does.
 | 
			
		||||
@@ -71,18 +79,22 @@ char *
 | 
			
		||||
fgetln(FILE *fp, size_t *lenp)
 | 
			
		||||
{
 | 
			
		||||
	unsigned char *p;
 | 
			
		||||
	char *ret;
 | 
			
		||||
	size_t len;
 | 
			
		||||
	size_t off;
 | 
			
		||||
 | 
			
		||||
	FLOCKFILE(fp);
 | 
			
		||||
 | 
			
		||||
	ORIENT(fp, -1);
 | 
			
		||||
	/* make sure there is input */
 | 
			
		||||
	if (fp->_r <= 0 && __srefill(fp))
 | 
			
		||||
		goto error;
 | 
			
		||||
	if (fp->_r <= 0 && __srefill(fp)) {
 | 
			
		||||
		*lenp = 0;
 | 
			
		||||
		FUNLOCKFILE(fp);
 | 
			
		||||
		return (NULL);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* look for a newline in the input */
 | 
			
		||||
	if ((p = memchr((void *)fp->_p, '\n', fp->_r)) != NULL) {
 | 
			
		||||
	if ((p = memchr((void *)fp->_p, '\n', (size_t)fp->_r)) != NULL) {
 | 
			
		||||
		char *ret;
 | 
			
		||||
 | 
			
		||||
		/*
 | 
			
		||||
		 * Found one.  Flag buffer as modified to keep fseek from
 | 
			
		||||
		 * `optimising' a backward seek, in case the user stomps on
 | 
			
		||||
@@ -103,7 +115,7 @@ fgetln(FILE *fp, size_t *lenp)
 | 
			
		||||
	 * As a bonus, though, we can leave off the __SMOD.
 | 
			
		||||
	 *
 | 
			
		||||
	 * OPTIMISTIC is length that we (optimistically) expect will
 | 
			
		||||
	 * accommodate the `rest' of the string, on each trip through the
 | 
			
		||||
	 * accomodate the `rest' of the string, on each trip through the
 | 
			
		||||
	 * loop below.
 | 
			
		||||
	 */
 | 
			
		||||
#define OPTIMISTIC 80
 | 
			
		||||
@@ -123,7 +135,7 @@ fgetln(FILE *fp, size_t *lenp)
 | 
			
		||||
		off = len;
 | 
			
		||||
		if (__srefill(fp))
 | 
			
		||||
			break;	/* EOF or error: return partial line */
 | 
			
		||||
		if ((p = memchr((void *)fp->_p, '\n', fp->_r)) == NULL)
 | 
			
		||||
		if ((p = memchr((void *)fp->_p, '\n', (size_t)fp->_r)) == NULL)
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		/* got it: finish up the line (like code above) */
 | 
			
		||||
@@ -139,12 +151,11 @@ fgetln(FILE *fp, size_t *lenp)
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
	*lenp = len;
 | 
			
		||||
	ret = (char *)fp->_lb._base;
 | 
			
		||||
#ifdef notdef
 | 
			
		||||
	ret[len] = '\0';
 | 
			
		||||
	fp->_lb._base[len] = 0;
 | 
			
		||||
#endif
 | 
			
		||||
	FUNLOCKFILE(fp);
 | 
			
		||||
	return (ret);
 | 
			
		||||
	return ((char *)fp->_lb._base);
 | 
			
		||||
 | 
			
		||||
error:
 | 
			
		||||
	*lenp = 0;		/* ??? */
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: fgetpos.c,v 1.6 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,13 +30,22 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)fgetpos.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * fgetpos: like ftello.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
fgetpos(FILE *fp, fpos_t *pos)
 | 
			
		||||
fgetpos(FILE * __restrict fp, fpos_t * __restrict pos)
 | 
			
		||||
{
 | 
			
		||||
	return((*pos = ftello(fp)) == (fpos_t)-1);
 | 
			
		||||
	/*
 | 
			
		||||
	 * ftello is thread-safe; no need to lock fp.
 | 
			
		||||
	 */
 | 
			
		||||
	if ((*pos = ftello(fp)) == (fpos_t)-1)
 | 
			
		||||
		return (-1);
 | 
			
		||||
	else
 | 
			
		||||
		return (0);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: fgets.c,v 1.10 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,18 +30,29 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)fgets.c	8.2 (Berkeley) 12/22/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include "namespace.h"
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include "un-namespace.h"
 | 
			
		||||
#include "local.h"
 | 
			
		||||
#include "libc_private.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Read at most n-1 characters from the given file.
 | 
			
		||||
 * Stop when a newline has been read, or the count runs out.
 | 
			
		||||
 * Return first argument, or NULL if no characters were read.
 | 
			
		||||
 * Do not return NULL if n == 1.
 | 
			
		||||
 */
 | 
			
		||||
char *
 | 
			
		||||
fgets(char *buf, int n, FILE *fp)
 | 
			
		||||
fgets(buf, n, fp)
 | 
			
		||||
	char *buf;
 | 
			
		||||
	int n;
 | 
			
		||||
	FILE *fp;
 | 
			
		||||
{
 | 
			
		||||
	size_t len;
 | 
			
		||||
	char *s;
 | 
			
		||||
@@ -52,24 +62,24 @@ fgets(char *buf, int n, FILE *fp)
 | 
			
		||||
		return (NULL);
 | 
			
		||||
 | 
			
		||||
	FLOCKFILE(fp);
 | 
			
		||||
	_SET_ORIENTATION(fp, -1);
 | 
			
		||||
	ORIENT(fp, -1);
 | 
			
		||||
	s = buf;
 | 
			
		||||
	n--;			/* leave space for NUL */
 | 
			
		||||
	while (n != 0) {
 | 
			
		||||
		/*
 | 
			
		||||
		 * If the buffer is empty, refill it.
 | 
			
		||||
		 */
 | 
			
		||||
		if (fp->_r <= 0) {
 | 
			
		||||
		if ((len = fp->_r) <= 0) {
 | 
			
		||||
			if (__srefill(fp)) {
 | 
			
		||||
				/* EOF/error: stop with partial or no line */
 | 
			
		||||
				if (s == buf) {
 | 
			
		||||
					FUNLOCKFILE(fp);
 | 
			
		||||
					return (NULL);
 | 
			
		||||
                                }
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
			len = fp->_r;
 | 
			
		||||
		}
 | 
			
		||||
		len = fp->_r;
 | 
			
		||||
		p = fp->_p;
 | 
			
		||||
 | 
			
		||||
		/*
 | 
			
		||||
@@ -78,7 +88,7 @@ fgets(char *buf, int n, FILE *fp)
 | 
			
		||||
		 * newline, and stop.  Otherwise, copy entire chunk
 | 
			
		||||
		 * and loop.
 | 
			
		||||
		 */
 | 
			
		||||
		if ((int)len > n)
 | 
			
		||||
		if (len > n)
 | 
			
		||||
			len = n;
 | 
			
		||||
		t = memchr((void *)p, '\n', len);
 | 
			
		||||
		if (t != NULL) {
 | 
			
		||||
@@ -86,7 +96,7 @@ fgets(char *buf, int n, FILE *fp)
 | 
			
		||||
			fp->_r -= len;
 | 
			
		||||
			fp->_p = t;
 | 
			
		||||
			(void)memcpy((void *)s, (void *)p, len);
 | 
			
		||||
			s[len] = '\0';
 | 
			
		||||
			s[len] = 0;
 | 
			
		||||
			FUNLOCKFILE(fp);
 | 
			
		||||
			return (buf);
 | 
			
		||||
		}
 | 
			
		||||
@@ -96,7 +106,7 @@ fgets(char *buf, int n, FILE *fp)
 | 
			
		||||
		s += len;
 | 
			
		||||
		n -= len;
 | 
			
		||||
	}
 | 
			
		||||
	*s = '\0';
 | 
			
		||||
	*s = 0;
 | 
			
		||||
	FUNLOCKFILE(fp);
 | 
			
		||||
	return (buf);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: fileno.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,21 +30,35 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include "local.h"
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)fileno.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include "namespace.h"
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include "un-namespace.h"
 | 
			
		||||
#include "libc_private.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * A subroutine version of the macro fileno.
 | 
			
		||||
 */
 | 
			
		||||
#undef fileno
 | 
			
		||||
#undef fileno_unlocked
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
fileno(FILE *fp)
 | 
			
		||||
{
 | 
			
		||||
	int ret;
 | 
			
		||||
	int fd;
 | 
			
		||||
 | 
			
		||||
	FLOCKFILE(fp);
 | 
			
		||||
	ret = __sfileno(fp);
 | 
			
		||||
	fd = __sfileno(fp);
 | 
			
		||||
	FUNLOCKFILE(fp);
 | 
			
		||||
	return (ret);
 | 
			
		||||
 | 
			
		||||
	return (fd);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
fileno_unlocked(FILE *fp)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	return (__sfileno(fp));
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: flags.c,v 1.6 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,19 +30,28 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)flags.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <sys/file.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
 | 
			
		||||
#include "local.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Return the (stdio) flags for a given mode.  Store the flags
 | 
			
		||||
 * to be passed to an open() syscall through *optr.
 | 
			
		||||
 * to be passed to an _open() syscall through *optr.
 | 
			
		||||
 * Return 0 on error.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
__sflags(const char *mode, int *optr)
 | 
			
		||||
__sflags(mode, optr)
 | 
			
		||||
	const char *mode;
 | 
			
		||||
	int *optr;
 | 
			
		||||
{
 | 
			
		||||
	int ret, m, o;
 | 
			
		||||
 | 
			
		||||
@@ -72,11 +80,35 @@ __sflags(const char *mode, int *optr)
 | 
			
		||||
		return (0);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* [rwa]\+ or [rwa]b\+ means read and write */
 | 
			
		||||
	if (*mode == '+' || (*mode == 'b' && mode[1] == '+')) {
 | 
			
		||||
	/* 'b' (binary) is ignored */
 | 
			
		||||
	if (*mode == 'b')
 | 
			
		||||
		mode++;
 | 
			
		||||
 | 
			
		||||
	/* [rwa][b]\+ means read and write */
 | 
			
		||||
	if (*mode == '+') {
 | 
			
		||||
		mode++;
 | 
			
		||||
		ret = __SRW;
 | 
			
		||||
		m = O_RDWR;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* 'b' (binary) can appear here, too -- and is ignored again */
 | 
			
		||||
	if (*mode == 'b')
 | 
			
		||||
		mode++;
 | 
			
		||||
 | 
			
		||||
	/* 'x' means exclusive (fail if the file exists) */
 | 
			
		||||
	if (*mode == 'x') {
 | 
			
		||||
		mode++;
 | 
			
		||||
		if (m == O_RDONLY) {
 | 
			
		||||
			errno = EINVAL;
 | 
			
		||||
			return (0);
 | 
			
		||||
		}
 | 
			
		||||
		o |= O_EXCL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* set close-on-exec */
 | 
			
		||||
	if (*mode == 'e')
 | 
			
		||||
		o |= O_CLOEXEC;
 | 
			
		||||
 | 
			
		||||
	*optr = m | o;
 | 
			
		||||
	return (ret);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: fopen.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,18 +30,28 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define __USE_BSD
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)fopen.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include "namespace.h"
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <sys/stat.h>
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <limits.h>
 | 
			
		||||
#include "un-namespace.h"
 | 
			
		||||
 | 
			
		||||
#include "local.h"
 | 
			
		||||
#include <linux/stat.h>
 | 
			
		||||
 | 
			
		||||
FILE *
 | 
			
		||||
fopen(const char *file, const char *mode)
 | 
			
		||||
fopen(file, mode)
 | 
			
		||||
	const char * __restrict file;
 | 
			
		||||
	const char * __restrict mode;
 | 
			
		||||
{
 | 
			
		||||
	FILE *fp;
 | 
			
		||||
	int f;
 | 
			
		||||
@@ -52,10 +61,23 @@ fopen(const char *file, const char *mode)
 | 
			
		||||
		return (NULL);
 | 
			
		||||
	if ((fp = __sfp()) == NULL)
 | 
			
		||||
		return (NULL);
 | 
			
		||||
	if ((f = open(file, oflags, DEFFILEMODE)) < 0) {
 | 
			
		||||
	if ((f = _open(file, oflags, DEFFILEMODE)) < 0) {
 | 
			
		||||
		fp->_flags = 0;			/* release */
 | 
			
		||||
		return (NULL);
 | 
			
		||||
	}
 | 
			
		||||
	/*
 | 
			
		||||
	 * File descriptors are a full int, but _file is only a short.
 | 
			
		||||
	 * If we get a valid file descriptor that is greater than
 | 
			
		||||
	 * SHRT_MAX, then the fd will get sign-extended into an
 | 
			
		||||
	 * invalid file descriptor.  Handle this case by failing the
 | 
			
		||||
	 * open.
 | 
			
		||||
	 */
 | 
			
		||||
	if (f > SHRT_MAX) {
 | 
			
		||||
		fp->_flags = 0;			/* release */
 | 
			
		||||
		_close(f);
 | 
			
		||||
		errno = EMFILE;
 | 
			
		||||
		return (NULL);
 | 
			
		||||
	}
 | 
			
		||||
	fp->_file = f;
 | 
			
		||||
	fp->_flags = flags;
 | 
			
		||||
	fp->_cookie = fp;
 | 
			
		||||
@@ -63,7 +85,6 @@ fopen(const char *file, const char *mode)
 | 
			
		||||
	fp->_write = __swrite;
 | 
			
		||||
	fp->_seek = __sseek;
 | 
			
		||||
	fp->_close = __sclose;
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * When opening in append mode, even though we use O_APPEND,
 | 
			
		||||
	 * we need to seek to the end so that ftell() gets the right
 | 
			
		||||
@@ -73,6 +94,6 @@ fopen(const char *file, const char *mode)
 | 
			
		||||
	 * fseek and ftell.)
 | 
			
		||||
	 */
 | 
			
		||||
	if (oflags & O_APPEND)
 | 
			
		||||
		(void) __sseek((void *)fp, (fpos_t)0, SEEK_END);
 | 
			
		||||
		(void)_sseek(fp, (fpos_t)0, SEEK_END);
 | 
			
		||||
	return (fp);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: fpurge.c,v 1.6 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,31 +30,41 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)fpurge.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include "namespace.h"
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include "un-namespace.h"
 | 
			
		||||
#include "local.h"
 | 
			
		||||
#include "libc_private.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * fpurge: like fflush, but without writing anything: leave the
 | 
			
		||||
 * given FILE's buffer empty.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
fpurge(FILE *fp)
 | 
			
		||||
fpurge(fp)
 | 
			
		||||
	FILE *fp;
 | 
			
		||||
{
 | 
			
		||||
	int retval;
 | 
			
		||||
	FLOCKFILE(fp);
 | 
			
		||||
	if (!fp->_flags) {
 | 
			
		||||
		FUNLOCKFILE(fp);
 | 
			
		||||
		errno = EBADF;
 | 
			
		||||
		return(EOF);
 | 
			
		||||
		retval = EOF;
 | 
			
		||||
	} else {
 | 
			
		||||
		if (HASUB(fp))
 | 
			
		||||
			FREEUB(fp);
 | 
			
		||||
		fp->_p = fp->_bf._base;
 | 
			
		||||
		fp->_r = 0;
 | 
			
		||||
		fp->_w = fp->_flags & (__SLBF|__SNBF|__SRD) ? 0 : fp->_bf._size;
 | 
			
		||||
		retval = 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (HASUB(fp))
 | 
			
		||||
		FREEUB(fp);
 | 
			
		||||
	WCIO_FREE(fp);
 | 
			
		||||
	fp->_p = fp->_bf._base;
 | 
			
		||||
	fp->_r = 0;
 | 
			
		||||
	fp->_w = fp->_flags & (__SLBF|__SNBF) ? 0 : fp->_bf._size;
 | 
			
		||||
	FUNLOCKFILE(fp);
 | 
			
		||||
	return (0);
 | 
			
		||||
	return (retval);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: fputs.c,v 1.7 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,28 +30,39 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)fputs.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include "namespace.h"
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include "local.h"
 | 
			
		||||
#include "un-namespace.h"
 | 
			
		||||
#include "fvwrite.h"
 | 
			
		||||
#include "libc_private.h"
 | 
			
		||||
#include "local.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Write the given string to the given file.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
fputs(const char *s, FILE *fp)
 | 
			
		||||
fputs(s, fp)
 | 
			
		||||
	const char * __restrict s;
 | 
			
		||||
	FILE * __restrict fp;
 | 
			
		||||
{
 | 
			
		||||
	int retval;
 | 
			
		||||
	struct __suio uio;
 | 
			
		||||
	struct __siov iov;
 | 
			
		||||
	int ret;
 | 
			
		||||
 | 
			
		||||
	iov.iov_base = (void *)s;
 | 
			
		||||
	iov.iov_len = uio.uio_resid = strlen(s);
 | 
			
		||||
	uio.uio_iov = &iov;
 | 
			
		||||
	uio.uio_iovcnt = 1;
 | 
			
		||||
	FLOCKFILE(fp);
 | 
			
		||||
	_SET_ORIENTATION(fp, -1);
 | 
			
		||||
	ret = __sfvwrite(fp, &uio);
 | 
			
		||||
	ORIENT(fp, -1);
 | 
			
		||||
	retval = __sfvwrite(fp, &uio);
 | 
			
		||||
	FUNLOCKFILE(fp);
 | 
			
		||||
	return (ret);
 | 
			
		||||
	return (retval);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: fsetpos.c,v 1.6 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,13 +30,22 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)fsetpos.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * fsetpos: like fseeko.
 | 
			
		||||
 * fsetpos: like fseek.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
fsetpos(FILE *iop, const fpos_t *pos)
 | 
			
		||||
fsetpos(iop, pos)
 | 
			
		||||
	FILE *iop;
 | 
			
		||||
	const fpos_t *pos;
 | 
			
		||||
{
 | 
			
		||||
	return (fseeko(iop, (off_t)*pos, SEEK_SET));
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: funopen.c,v 1.8 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,14 +30,23 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)funopen.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
 | 
			
		||||
#include "local.h"
 | 
			
		||||
 | 
			
		||||
FILE *
 | 
			
		||||
funopen(const void *cookie, int (*readfn)(void *, char *, int),
 | 
			
		||||
funopen(const void *cookie,
 | 
			
		||||
	int (*readfn)(void *, char *, int),
 | 
			
		||||
	int (*writefn)(void *, const char *, int),
 | 
			
		||||
	fpos_t (*seekfn)(void *, fpos_t, int), int (*closefn)(void *))
 | 
			
		||||
	fpos_t (*seekfn)(void *, fpos_t, int),
 | 
			
		||||
	int (*closefn)(void *))
 | 
			
		||||
{
 | 
			
		||||
	FILE *fp;
 | 
			
		||||
	int flags;
 | 
			
		||||
@@ -59,7 +67,7 @@ funopen(const void *cookie, int (*readfn)(void *, char *, int),
 | 
			
		||||
		return (NULL);
 | 
			
		||||
	fp->_flags = flags;
 | 
			
		||||
	fp->_file = -1;
 | 
			
		||||
	fp->_cookie = (void *)cookie;		/* SAFE: cookie not modified */
 | 
			
		||||
	fp->_cookie = (void *)cookie;
 | 
			
		||||
	fp->_read = readfn;
 | 
			
		||||
	fp->_write = writefn;
 | 
			
		||||
	fp->_seek = seekfn;
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: fwalk.c,v 1.7 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,23 +30,37 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)fwalk.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include "local.h"
 | 
			
		||||
#include "glue.h"
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
_fwalk(int (*function)(FILE *))
 | 
			
		||||
_fwalk(function)
 | 
			
		||||
	int (*function)(FILE *);
 | 
			
		||||
{
 | 
			
		||||
	FILE *fp;
 | 
			
		||||
	int n, ret;
 | 
			
		||||
	struct glue *g;
 | 
			
		||||
 | 
			
		||||
	ret = 0;
 | 
			
		||||
	/*
 | 
			
		||||
	 * It should be safe to walk the list without locking it;
 | 
			
		||||
	 * new nodes are only added to the end and none are ever
 | 
			
		||||
	 * removed.
 | 
			
		||||
	 *
 | 
			
		||||
	 * Avoid locking this list while walking it or else you will
 | 
			
		||||
	 * introduce a potential deadlock in [at least] refill.c.
 | 
			
		||||
	 */
 | 
			
		||||
	for (g = &__sglue; g != NULL; g = g->next)
 | 
			
		||||
		for (fp = g->iobs, n = g->niobs; --n >= 0; fp++) {
 | 
			
		||||
		for (fp = g->iobs, n = g->niobs; --n >= 0; fp++)
 | 
			
		||||
			if ((fp->_flags != 0) && ((fp->_flags & __SIGN) == 0))
 | 
			
		||||
				ret |= (*function)(fp);
 | 
			
		||||
		}
 | 
			
		||||
	return (ret);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: fwrite.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,36 +30,70 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)fwrite.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include "namespace.h"
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include "un-namespace.h"
 | 
			
		||||
#include "local.h"
 | 
			
		||||
#include "fvwrite.h"
 | 
			
		||||
#include "libc_private.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Write `count' objects (each size `size') from memory to the given file.
 | 
			
		||||
 * Return the number of whole objects written.
 | 
			
		||||
 */
 | 
			
		||||
size_t
 | 
			
		||||
fwrite(const void *buf, size_t size, size_t count, FILE *fp)
 | 
			
		||||
fwrite(buf, size, count, fp)
 | 
			
		||||
	const void * __restrict buf;
 | 
			
		||||
	size_t size, count;
 | 
			
		||||
	FILE * __restrict fp;
 | 
			
		||||
{
 | 
			
		||||
	size_t n;
 | 
			
		||||
	struct __suio uio;
 | 
			
		||||
	struct __siov iov;
 | 
			
		||||
	int ret;
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * ANSI and SUSv2 require a return value of 0 if size or count are 0.
 | 
			
		||||
	 */
 | 
			
		||||
	if ((count == 0) || (size == 0))
 | 
			
		||||
		return (0);
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Check for integer overflow.  As an optimization, first check that
 | 
			
		||||
	 * at least one of {count, size} is at least 2^16, since if both
 | 
			
		||||
	 * values are less than that, their product can't possible overflow
 | 
			
		||||
	 * (size_t is always at least 32 bits on FreeBSD).
 | 
			
		||||
	 */
 | 
			
		||||
	if (((count | size) > 0xFFFF) &&
 | 
			
		||||
	    (count > SIZE_MAX / size)) {
 | 
			
		||||
		errno = EINVAL;
 | 
			
		||||
		fp->_flags |= __SERR;
 | 
			
		||||
		return (0);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	n = count * size;
 | 
			
		||||
 | 
			
		||||
	iov.iov_base = (void *)buf;
 | 
			
		||||
	uio.uio_resid = iov.iov_len = n = count * size;
 | 
			
		||||
	uio.uio_resid = iov.iov_len = n;
 | 
			
		||||
	uio.uio_iov = &iov;
 | 
			
		||||
	uio.uio_iovcnt = 1;
 | 
			
		||||
 | 
			
		||||
	FLOCKFILE(fp);
 | 
			
		||||
	ORIENT(fp, -1);
 | 
			
		||||
	/*
 | 
			
		||||
	 * The usual case is success (__sfvwrite returns 0);
 | 
			
		||||
	 * skip the divide if this happens, since divides are
 | 
			
		||||
	 * generally slow and since this occurs whenever size==0.
 | 
			
		||||
	 */
 | 
			
		||||
	FLOCKFILE(fp);
 | 
			
		||||
	ret = __sfvwrite(fp, &uio);
 | 
			
		||||
	if (__sfvwrite(fp, &uio) != 0)
 | 
			
		||||
	    count = (n - uio.uio_resid) / size;
 | 
			
		||||
	FUNLOCKFILE(fp);
 | 
			
		||||
	if (ret == 0)
 | 
			
		||||
		return (count);
 | 
			
		||||
	return ((n - uio.uio_resid) / size);
 | 
			
		||||
	return (count);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: getc.c,v 1.6 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,32 +30,36 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)getc.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include "namespace.h"
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include "un-namespace.h"
 | 
			
		||||
#include "libc_private.h"
 | 
			
		||||
#include "local.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * A subroutine version of the macro getc_unlocked.
 | 
			
		||||
 */
 | 
			
		||||
#undef getc_unlocked
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
getc_unlocked(FILE *fp)
 | 
			
		||||
{
 | 
			
		||||
	return (__sgetc(fp));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * A subroutine version of the macro getc.
 | 
			
		||||
 */
 | 
			
		||||
#undef getc
 | 
			
		||||
#undef getc_unlocked
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
getc(FILE *fp)
 | 
			
		||||
{
 | 
			
		||||
	int c;
 | 
			
		||||
 | 
			
		||||
	int retval;
 | 
			
		||||
	FLOCKFILE(fp);
 | 
			
		||||
	c = __sgetc(fp);
 | 
			
		||||
	/* Orientation set by __sgetc() when buffer is empty. */
 | 
			
		||||
	/* ORIENT(fp, -1); */
 | 
			
		||||
	retval = __sgetc(fp);
 | 
			
		||||
	FUNLOCKFILE(fp);
 | 
			
		||||
	return (c);
 | 
			
		||||
	return (retval);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
getc_unlocked(FILE *fp)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	return (__sgetc(fp));
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: getchar.c,v 1.7 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,28 +30,39 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * A subroutine version of the macro getchar_unlocked.
 | 
			
		||||
 */
 | 
			
		||||
#undef getchar_unlocked
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
getchar_unlocked(void)
 | 
			
		||||
{
 | 
			
		||||
	return (getc_unlocked(stdin));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)getchar.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * A subroutine version of the macro getchar.
 | 
			
		||||
 */
 | 
			
		||||
#include "namespace.h"
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include "un-namespace.h"
 | 
			
		||||
#include "local.h"
 | 
			
		||||
#include "libc_private.h"
 | 
			
		||||
 | 
			
		||||
#undef getchar
 | 
			
		||||
#undef getchar_unlocked
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
getchar(void)
 | 
			
		||||
getchar()
 | 
			
		||||
{
 | 
			
		||||
	return (getc(stdin));
 | 
			
		||||
	int retval;
 | 
			
		||||
	FLOCKFILE(stdin);
 | 
			
		||||
	/* Orientation set by __sgetc() when buffer is empty. */
 | 
			
		||||
	/* ORIENT(stdin, -1); */
 | 
			
		||||
	retval = __sgetc(stdin);
 | 
			
		||||
	FUNLOCKFILE(stdin);
 | 
			
		||||
	return (retval);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
getchar_unlocked(void)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	return (__sgetc(stdin));
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: putc.c,v 1.7 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,37 +30,38 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include "local.h"
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)putc.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * A subroutine version of the macro putc_unlocked.
 | 
			
		||||
 */
 | 
			
		||||
#include "namespace.h"
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include "un-namespace.h"
 | 
			
		||||
#include "local.h"
 | 
			
		||||
#include "libc_private.h"
 | 
			
		||||
 | 
			
		||||
#undef putc
 | 
			
		||||
#undef putc_unlocked
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
putc_unlocked(int c, FILE *fp)
 | 
			
		||||
putc(c, fp)
 | 
			
		||||
	int c;
 | 
			
		||||
	FILE *fp;
 | 
			
		||||
{
 | 
			
		||||
	if (cantwrite(fp)) {
 | 
			
		||||
		errno = EBADF;
 | 
			
		||||
		return (EOF);
 | 
			
		||||
	}
 | 
			
		||||
	return (__sputc(c, fp));
 | 
			
		||||
	int retval;
 | 
			
		||||
	FLOCKFILE(fp);
 | 
			
		||||
	/* Orientation set by __sputc() when buffer is full. */
 | 
			
		||||
	/* ORIENT(fp, -1); */
 | 
			
		||||
	retval = __sputc(c, fp);
 | 
			
		||||
	FUNLOCKFILE(fp);
 | 
			
		||||
	return (retval);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * A subroutine version of the macro putc.
 | 
			
		||||
 */
 | 
			
		||||
#undef putc
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
putc(int c, FILE *fp)
 | 
			
		||||
putc_unlocked(int ch, FILE *fp)
 | 
			
		||||
{
 | 
			
		||||
	int ret;
 | 
			
		||||
 | 
			
		||||
	FLOCKFILE(fp);
 | 
			
		||||
	ret = putc_unlocked(c, fp);
 | 
			
		||||
	FUNLOCKFILE(fp);
 | 
			
		||||
	return (ret);
 | 
			
		||||
	return (__sputc(ch, fp));
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: putchar.c,v 1.7 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,29 +30,42 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)putchar.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include "namespace.h"
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
#undef putchar_unlocked
 | 
			
		||||
/*
 | 
			
		||||
 * A subrouting version of the macro putchar_unlocked
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
putchar_unlocked(int c)
 | 
			
		||||
{
 | 
			
		||||
	FILE *so = stdout;
 | 
			
		||||
 | 
			
		||||
	return (putc_unlocked(c, so));
 | 
			
		||||
}
 | 
			
		||||
#include "un-namespace.h"
 | 
			
		||||
#include "local.h"
 | 
			
		||||
#include "libc_private.h"
 | 
			
		||||
 | 
			
		||||
#undef putchar
 | 
			
		||||
#undef putchar_unlocked
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * A subroutine version of the macro putchar
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
putchar(int c)
 | 
			
		||||
putchar(c)
 | 
			
		||||
	int c;
 | 
			
		||||
{
 | 
			
		||||
	int retval;
 | 
			
		||||
	FILE *so = stdout;
 | 
			
		||||
 | 
			
		||||
	return (putc(c, so));
 | 
			
		||||
	FLOCKFILE(so);
 | 
			
		||||
	/* Orientation set by __sputc() when buffer is full. */
 | 
			
		||||
	/* ORIENT(so, -1); */
 | 
			
		||||
	retval = __sputc(c, so);
 | 
			
		||||
	FUNLOCKFILE(so);
 | 
			
		||||
	return (retval);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
putchar_unlocked(int ch)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	return (__sputc(ch, stdout));
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: puts.c,v 1.7 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,21 +30,31 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)puts.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include "namespace.h"
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include "local.h"
 | 
			
		||||
#include "un-namespace.h"
 | 
			
		||||
#include "fvwrite.h"
 | 
			
		||||
#include "libc_private.h"
 | 
			
		||||
#include "local.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Write the given string to stdout, appending a newline.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
puts(const char *s)
 | 
			
		||||
puts(s)
 | 
			
		||||
	char const *s;
 | 
			
		||||
{
 | 
			
		||||
	int retval;
 | 
			
		||||
	size_t c = strlen(s);
 | 
			
		||||
	struct __suio uio;
 | 
			
		||||
	struct __siov iov[2];
 | 
			
		||||
	int ret;
 | 
			
		||||
 | 
			
		||||
	iov[0].iov_base = (void *)s;
 | 
			
		||||
	iov[0].iov_len = c;
 | 
			
		||||
@@ -55,7 +64,8 @@ puts(const char *s)
 | 
			
		||||
	uio.uio_iov = &iov[0];
 | 
			
		||||
	uio.uio_iovcnt = 2;
 | 
			
		||||
	FLOCKFILE(stdout);
 | 
			
		||||
	ret = __sfvwrite(stdout, &uio);
 | 
			
		||||
	ORIENT(stdout, -1);
 | 
			
		||||
	retval = __sfvwrite(stdout, &uio) ? EOF : '\n';
 | 
			
		||||
	FUNLOCKFILE(stdout);
 | 
			
		||||
	return (ret ? EOF : '\n');
 | 
			
		||||
	return (retval);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: putw.c,v 1.6 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,12 +30,24 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)putw.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include "namespace.h"
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include "un-namespace.h"
 | 
			
		||||
#include "fvwrite.h"
 | 
			
		||||
#include "libc_private.h"
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
putw(int w, FILE *fp)
 | 
			
		||||
putw(w, fp)
 | 
			
		||||
	int w;
 | 
			
		||||
	FILE *fp;
 | 
			
		||||
{
 | 
			
		||||
	int retval;
 | 
			
		||||
	struct __suio uio;
 | 
			
		||||
	struct __siov iov;
 | 
			
		||||
 | 
			
		||||
@@ -44,5 +55,8 @@ putw(int w, FILE *fp)
 | 
			
		||||
	iov.iov_len = uio.uio_resid = sizeof(w);
 | 
			
		||||
	uio.uio_iov = &iov;
 | 
			
		||||
	uio.uio_iovcnt = 1;
 | 
			
		||||
	return (__sfvwrite(fp, &uio));
 | 
			
		||||
	FLOCKFILE(fp);
 | 
			
		||||
	retval = __sfvwrite(fp, &uio);
 | 
			
		||||
	FUNLOCKFILE(fp);
 | 
			
		||||
	return (retval);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,5 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: remove.c,v 1.7 2005/08/08 08:05:36 espie Exp $	*/
 | 
			
		||||
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -15,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -32,18 +30,26 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)remove.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <sys/stat.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
remove(const char *file)
 | 
			
		||||
remove(file)
 | 
			
		||||
	const char *file;
 | 
			
		||||
{
 | 
			
		||||
	struct stat st;
 | 
			
		||||
	struct stat sb;
 | 
			
		||||
 | 
			
		||||
	if (lstat(file, &st) < 0)
 | 
			
		||||
	if (lstat(file, &sb) < 0)
 | 
			
		||||
		return (-1);
 | 
			
		||||
	if (S_ISDIR(st.st_mode))
 | 
			
		||||
	if (S_ISDIR(sb.st_mode))
 | 
			
		||||
		return (rmdir(file));
 | 
			
		||||
	return (unlink(file));
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: rget.c,v 1.7 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,6 +30,12 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)rget.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include "local.h"
 | 
			
		||||
 | 
			
		||||
@@ -42,7 +47,6 @@
 | 
			
		||||
int
 | 
			
		||||
__srget(FILE *fp)
 | 
			
		||||
{
 | 
			
		||||
	_SET_ORIENTATION(fp, -1);
 | 
			
		||||
	if (__srefill(fp) == 0) {
 | 
			
		||||
		fp->_r--;
 | 
			
		||||
		return (*fp->_p++);
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: setbuf.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,11 +30,17 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)setbuf.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include "local.h"
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
setbuf(FILE *fp, char *buf)
 | 
			
		||||
setbuf(FILE * __restrict fp, char * __restrict buf)
 | 
			
		||||
{
 | 
			
		||||
	(void) setvbuf(fp, buf, buf ? _IOFBF : _IONBF, BUFSIZ);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: setbuffer.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,20 +30,30 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)setbuffer.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
setbuffer(FILE *fp, char *buf, int size)
 | 
			
		||||
setbuffer(fp, buf, size)
 | 
			
		||||
	FILE *fp;
 | 
			
		||||
	char *buf;
 | 
			
		||||
	int size;
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	(void)setvbuf(fp, buf, buf ? _IOFBF : _IONBF, size);
 | 
			
		||||
	(void)setvbuf(fp, buf, buf ? _IOFBF : _IONBF, (size_t)size);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * set line buffering
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
setlinebuf(FILE *fp)
 | 
			
		||||
setlinebuf(fp)
 | 
			
		||||
	FILE *fp;
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	return (setvbuf(fp, (char *)NULL, _IOLBF, (size_t)0));
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: tempnam.c,v 1.14 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 1988, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -11,7 +10,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -28,6 +27,12 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)tempnam.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include <sys/param.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
@@ -42,7 +47,8 @@ __warn_references(tempnam,
 | 
			
		||||
extern char *_mktemp(char *);
 | 
			
		||||
 | 
			
		||||
char *
 | 
			
		||||
tempnam(const char *dir, const char *pfx)
 | 
			
		||||
tempnam(dir, pfx)
 | 
			
		||||
	const char *dir, *pfx;
 | 
			
		||||
{
 | 
			
		||||
	int sverrno;
 | 
			
		||||
	char *f, *name;
 | 
			
		||||
@@ -54,26 +60,26 @@ tempnam(const char *dir, const char *pfx)
 | 
			
		||||
		pfx = "tmp.";
 | 
			
		||||
 | 
			
		||||
	if (issetugid() == 0 && (f = getenv("TMPDIR"))) {
 | 
			
		||||
		(void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXXXXXX", f,
 | 
			
		||||
		(void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXX", f,
 | 
			
		||||
		    *(f + strlen(f) - 1) == '/'? "": "/", pfx);
 | 
			
		||||
		if ((f = _mktemp(name)))
 | 
			
		||||
			return(f);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if ((f = (char *)dir)) {
 | 
			
		||||
		(void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXXXXXX", f,
 | 
			
		||||
		(void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXX", f,
 | 
			
		||||
		    *(f + strlen(f) - 1) == '/'? "": "/", pfx);
 | 
			
		||||
		if ((f = _mktemp(name)))
 | 
			
		||||
			return(f);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	f = P_tmpdir;
 | 
			
		||||
	(void)snprintf(name, MAXPATHLEN, "%s%sXXXXXXXXX", f, pfx);
 | 
			
		||||
	(void)snprintf(name, MAXPATHLEN, "%s%sXXXXXX", f, pfx);
 | 
			
		||||
	if ((f = _mktemp(name)))
 | 
			
		||||
		return(f);
 | 
			
		||||
 | 
			
		||||
	f = _PATH_TMP;
 | 
			
		||||
	(void)snprintf(name, MAXPATHLEN, "%s%sXXXXXXXXX", f, pfx);
 | 
			
		||||
	(void)snprintf(name, MAXPATHLEN, "%s%sXXXXXX", f, pfx);
 | 
			
		||||
	if ((f = _mktemp(name)))
 | 
			
		||||
		return(f);
 | 
			
		||||
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: tmpnam.c,v 1.10 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993, 1994
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,6 +30,12 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)tmpnam.c	8.3 (Berkeley) 3/28/94";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
@@ -42,14 +47,15 @@ __warn_references(tmpnam,
 | 
			
		||||
extern char *_mktemp(char *);
 | 
			
		||||
 | 
			
		||||
char *
 | 
			
		||||
tmpnam(char *s)
 | 
			
		||||
tmpnam(s)
 | 
			
		||||
	char *s;
 | 
			
		||||
{
 | 
			
		||||
	static u_long tmpcount;
 | 
			
		||||
	static char buf[L_tmpnam];
 | 
			
		||||
 | 
			
		||||
	if (s == NULL)
 | 
			
		||||
		s = buf;
 | 
			
		||||
	(void)snprintf(s, L_tmpnam, "%stmp.%lu.XXXXXXXXX", P_tmpdir, tmpcount);
 | 
			
		||||
	(void)snprintf(s, L_tmpnam, "%stmp.%lu.XXXXXX", P_tmpdir, tmpcount);
 | 
			
		||||
	++tmpcount;
 | 
			
		||||
	return (_mktemp(s));
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: wsetup.c,v 1.7 2005/08/08 08:05:36 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -14,7 +13,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -31,6 +30,13 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)wsetup.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include "local.h"
 | 
			
		||||
@@ -38,10 +44,11 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Various output routines call wsetup to be sure it is safe to write,
 | 
			
		||||
 * because either _flags does not include __SWR, or _buf is NULL.
 | 
			
		||||
 * _wsetup returns 0 if OK to write, nonzero otherwise.
 | 
			
		||||
 * _wsetup returns 0 if OK to write; otherwise, it returns EOF and sets errno.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
__swsetup(FILE *fp)
 | 
			
		||||
__swsetup(fp)
 | 
			
		||||
	FILE *fp;
 | 
			
		||||
{
 | 
			
		||||
	/* make sure stdio is set up */
 | 
			
		||||
	if (!__sdidinit)
 | 
			
		||||
@@ -51,8 +58,11 @@ __swsetup(FILE *fp)
 | 
			
		||||
	 * If we are not writing, we had better be reading and writing.
 | 
			
		||||
	 */
 | 
			
		||||
	if ((fp->_flags & __SWR) == 0) {
 | 
			
		||||
		if ((fp->_flags & __SRW) == 0)
 | 
			
		||||
		if ((fp->_flags & __SRW) == 0) {
 | 
			
		||||
			errno = EBADF;
 | 
			
		||||
			fp->_flags |= __SERR;
 | 
			
		||||
			return (EOF);
 | 
			
		||||
		}
 | 
			
		||||
		if (fp->_flags & __SRD) {
 | 
			
		||||
			/* clobber any ungetc data */
 | 
			
		||||
			if (HASUB(fp))
 | 
			
		||||
@@ -67,11 +77,8 @@ __swsetup(FILE *fp)
 | 
			
		||||
	/*
 | 
			
		||||
	 * Make a buffer if necessary, then set _w.
 | 
			
		||||
	 */
 | 
			
		||||
	if (fp->_bf._base == NULL) {
 | 
			
		||||
		if ((fp->_flags & (__SSTR | __SALC)) == __SSTR)
 | 
			
		||||
			return (EOF);
 | 
			
		||||
	if (fp->_bf._base == NULL)
 | 
			
		||||
		__smakebuf(fp);
 | 
			
		||||
	}
 | 
			
		||||
	if (fp->_flags & __SLBF) {
 | 
			
		||||
		/*
 | 
			
		||||
		 * It is line buffered, so make _lbfsize be -_bufsize
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/*	$OpenBSD: qsort.c,v 1.10 2005/08/08 08:05:37 espie Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1992, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
@@ -11,7 +10,7 @@
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 * 4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
@@ -28,23 +27,33 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
static char sccsid[] = "@(#)qsort.c	8.1 (Berkeley) 6/4/93";
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
static __inline char	*med3(char *, char *, char *, int (*)(const void *, const void *));
 | 
			
		||||
static __inline void	 swapfunc(char *, char *, int, int);
 | 
			
		||||
#ifdef I_AM_QSORT_R
 | 
			
		||||
typedef int		 cmp_t(void *, const void *, const void *);
 | 
			
		||||
#else
 | 
			
		||||
typedef int		 cmp_t(const void *, const void *);
 | 
			
		||||
#endif
 | 
			
		||||
static inline char	*med3(char *, char *, char *, cmp_t *, void *);
 | 
			
		||||
static inline void	 swapfunc(char *, char *, int, int);
 | 
			
		||||
 | 
			
		||||
#define min(a, b)	(a) < (b) ? a : b
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
 | 
			
		||||
 */
 | 
			
		||||
#define swapcode(TYPE, parmi, parmj, n) {		\
 | 
			
		||||
	long i = (n) / sizeof (TYPE);			\
 | 
			
		||||
	TYPE *pi = (TYPE *) (parmi);			\
 | 
			
		||||
	TYPE *pj = (TYPE *) (parmj);			\
 | 
			
		||||
	do {						\
 | 
			
		||||
		TYPE	t = *pi;			\
 | 
			
		||||
#define swapcode(TYPE, parmi, parmj, n) { 		\
 | 
			
		||||
	long i = (n) / sizeof (TYPE); 			\
 | 
			
		||||
	TYPE *pi = (TYPE *) (parmi); 		\
 | 
			
		||||
	TYPE *pj = (TYPE *) (parmj); 		\
 | 
			
		||||
	do { 						\
 | 
			
		||||
		TYPE	t = *pi;		\
 | 
			
		||||
		*pi++ = *pj;				\
 | 
			
		||||
		*pj++ = t;				\
 | 
			
		||||
        } while (--i > 0);				\
 | 
			
		||||
@@ -53,10 +62,12 @@ static __inline void	 swapfunc(char *, char *, int, int);
 | 
			
		||||
#define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \
 | 
			
		||||
	es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1;
 | 
			
		||||
 | 
			
		||||
static __inline void
 | 
			
		||||
swapfunc(char *a, char *b, int n, int swaptype)
 | 
			
		||||
static inline void
 | 
			
		||||
swapfunc(a, b, n, swaptype)
 | 
			
		||||
	char *a, *b;
 | 
			
		||||
	int n, swaptype;
 | 
			
		||||
{
 | 
			
		||||
	if (swaptype <= 1)
 | 
			
		||||
	if(swaptype <= 1)
 | 
			
		||||
		swapcode(long, a, b, n)
 | 
			
		||||
	else
 | 
			
		||||
		swapcode(char, a, b, n)
 | 
			
		||||
@@ -70,59 +81,77 @@ swapfunc(char *a, char *b, int n, int swaptype)
 | 
			
		||||
	} else						\
 | 
			
		||||
		swapfunc(a, b, es, swaptype)
 | 
			
		||||
 | 
			
		||||
#define vecswap(a, b, n)	if ((n) > 0) swapfunc(a, b, n, swaptype)
 | 
			
		||||
#define vecswap(a, b, n) 	if ((n) > 0) swapfunc(a, b, n, swaptype)
 | 
			
		||||
 | 
			
		||||
static __inline char *
 | 
			
		||||
med3(char *a, char *b, char *c, int (*cmp)(const void *, const void *))
 | 
			
		||||
#ifdef I_AM_QSORT_R
 | 
			
		||||
#define	CMP(t, x, y) (cmp((t), (x), (y)))
 | 
			
		||||
#else
 | 
			
		||||
#define	CMP(t, x, y) (cmp((x), (y)))
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static inline char *
 | 
			
		||||
med3(char *a, char *b, char *c, cmp_t *cmp, void *thunk
 | 
			
		||||
#ifndef I_AM_QSORT_R
 | 
			
		||||
__unused
 | 
			
		||||
#endif
 | 
			
		||||
)
 | 
			
		||||
{
 | 
			
		||||
	return cmp(a, b) < 0 ?
 | 
			
		||||
	       (cmp(b, c) < 0 ? b : (cmp(a, c) < 0 ? c : a ))
 | 
			
		||||
              :(cmp(b, c) > 0 ? b : (cmp(a, c) < 0 ? a : c ));
 | 
			
		||||
	return CMP(thunk, a, b) < 0 ?
 | 
			
		||||
	       (CMP(thunk, b, c) < 0 ? b : (CMP(thunk, a, c) < 0 ? c : a ))
 | 
			
		||||
              :(CMP(thunk, b, c) > 0 ? b : (CMP(thunk, a, c) < 0 ? a : c ));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef I_AM_QSORT_R
 | 
			
		||||
void
 | 
			
		||||
qsort(void *aa, size_t n, size_t es, int (*cmp)(const void *, const void *))
 | 
			
		||||
qsort_r(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp)
 | 
			
		||||
#else
 | 
			
		||||
#define thunk NULL
 | 
			
		||||
void
 | 
			
		||||
qsort(void *a, size_t n, size_t es, cmp_t *cmp)
 | 
			
		||||
#endif
 | 
			
		||||
{
 | 
			
		||||
	char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
 | 
			
		||||
	int d, r, swaptype, swap_cnt;
 | 
			
		||||
	char *a = aa;
 | 
			
		||||
	size_t d, r;
 | 
			
		||||
	int cmp_result;
 | 
			
		||||
	int swaptype, swap_cnt;
 | 
			
		||||
 | 
			
		||||
loop:	SWAPINIT(a, es);
 | 
			
		||||
	swap_cnt = 0;
 | 
			
		||||
	if (n < 7) {
 | 
			
		||||
		for (pm = (char *)a + es; pm < (char *) a + n * es; pm += es)
 | 
			
		||||
			for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
 | 
			
		||||
		for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
 | 
			
		||||
			for (pl = pm; 
 | 
			
		||||
			     pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
 | 
			
		||||
			     pl -= es)
 | 
			
		||||
				swap(pl, pl - es);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	pm = (char *)a + (n / 2) * es;
 | 
			
		||||
	if (n > 7) {
 | 
			
		||||
		pl = (char *)a;
 | 
			
		||||
		pl = a;
 | 
			
		||||
		pn = (char *)a + (n - 1) * es;
 | 
			
		||||
		if (n > 40) {
 | 
			
		||||
			d = (n / 8) * es;
 | 
			
		||||
			pl = med3(pl, pl + d, pl + 2 * d, cmp);
 | 
			
		||||
			pm = med3(pm - d, pm, pm + d, cmp);
 | 
			
		||||
			pn = med3(pn - 2 * d, pn - d, pn, cmp);
 | 
			
		||||
			pl = med3(pl, pl + d, pl + 2 * d, cmp, thunk);
 | 
			
		||||
			pm = med3(pm - d, pm, pm + d, cmp, thunk);
 | 
			
		||||
			pn = med3(pn - 2 * d, pn - d, pn, cmp, thunk);
 | 
			
		||||
		}
 | 
			
		||||
		pm = med3(pl, pm, pn, cmp);
 | 
			
		||||
		pm = med3(pl, pm, pn, cmp, thunk);
 | 
			
		||||
	}
 | 
			
		||||
	swap(a, pm);
 | 
			
		||||
	pa = pb = (char *)a + es;
 | 
			
		||||
 | 
			
		||||
	pc = pd = (char *)a + (n - 1) * es;
 | 
			
		||||
	for (;;) {
 | 
			
		||||
		while (pb <= pc && (r = cmp(pb, a)) <= 0) {
 | 
			
		||||
			if (r == 0) {
 | 
			
		||||
		while (pb <= pc && (cmp_result = CMP(thunk, pb, a)) <= 0) {
 | 
			
		||||
			if (cmp_result == 0) {
 | 
			
		||||
				swap_cnt = 1;
 | 
			
		||||
				swap(pa, pb);
 | 
			
		||||
				pa += es;
 | 
			
		||||
			}
 | 
			
		||||
			pb += es;
 | 
			
		||||
		}
 | 
			
		||||
		while (pb <= pc && (r = cmp(pc, a)) >= 0) {
 | 
			
		||||
			if (r == 0) {
 | 
			
		||||
		while (pb <= pc && (cmp_result = CMP(thunk, pc, a)) >= 0) {
 | 
			
		||||
			if (cmp_result == 0) {
 | 
			
		||||
				swap_cnt = 1;
 | 
			
		||||
				swap(pc, pd);
 | 
			
		||||
				pd -= es;
 | 
			
		||||
@@ -137,8 +166,9 @@ loop:	SWAPINIT(a, es);
 | 
			
		||||
		pc -= es;
 | 
			
		||||
	}
 | 
			
		||||
	if (swap_cnt == 0) {  /* Switch to insertion sort */
 | 
			
		||||
		for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es)
 | 
			
		||||
			for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
 | 
			
		||||
		for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
 | 
			
		||||
			for (pl = pm; 
 | 
			
		||||
			     pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
 | 
			
		||||
			     pl -= es)
 | 
			
		||||
				swap(pl, pl - es);
 | 
			
		||||
		return;
 | 
			
		||||
@@ -147,15 +177,19 @@ loop:	SWAPINIT(a, es);
 | 
			
		||||
	pn = (char *)a + n * es;
 | 
			
		||||
	r = min(pa - (char *)a, pb - pa);
 | 
			
		||||
	vecswap(a, pb - r, r);
 | 
			
		||||
	r = min(pd - pc, pn - pd - (int)es);
 | 
			
		||||
	r = min(pd - pc, pn - pd - es);
 | 
			
		||||
	vecswap(pb, pn - r, r);
 | 
			
		||||
	if ((r = pb - pa) > (int)es)
 | 
			
		||||
	if ((r = pb - pa) > es)
 | 
			
		||||
#ifdef I_AM_QSORT_R
 | 
			
		||||
		qsort_r(a, r / es, es, thunk, cmp);
 | 
			
		||||
#else
 | 
			
		||||
		qsort(a, r / es, es, cmp);
 | 
			
		||||
	if ((r = pd - pc) > (int)es) {
 | 
			
		||||
#endif
 | 
			
		||||
	if ((r = pd - pc) > es) {
 | 
			
		||||
		/* Iterate rather than recurse to save stack space */
 | 
			
		||||
		a = pn - r;
 | 
			
		||||
		n = r / es;
 | 
			
		||||
		goto loop;
 | 
			
		||||
	}
 | 
			
		||||
	/* qsort(pn - r, r / es, es, cmp); */
 | 
			
		||||
/*		qsort(pn - r, r / es, es, cmp);*/
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										28
									
								
								libc/upstream-freebsd/libc_private.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								libc/upstream-freebsd/libc_private.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2013 The Android Open Source Project
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef _BIONIC_FREEBSD_LIBC_PRIVATE_H_included
 | 
			
		||||
#define _BIONIC_FREEBSD_LIBC_PRIVATE_H_included
 | 
			
		||||
 | 
			
		||||
#define FLOCKFILE(fp)   do { if (__isthreaded) flockfile(fp); } while (0)
 | 
			
		||||
#define FUNLOCKFILE(fp) do { if (__isthreaded) funlockfile(fp); } while (0)
 | 
			
		||||
 | 
			
		||||
#define STDIO_THREAD_LOCK()   /* TODO: until we have the FreeBSD findfp.c, this is useless. */
 | 
			
		||||
#define STDIO_THREAD_UNLOCK() /* TODO: until we have the FreeBSD findfp.c, this is useless. */
 | 
			
		||||
 | 
			
		||||
#define ORIENT(fp, o) /* Only needed for wide-character stream support. */
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										22
									
								
								libc/upstream-freebsd/spinlock.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								libc/upstream-freebsd/spinlock.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2013 The Android Open Source Project
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef _BIONIC_FREEBSD_SPINLOCK_H_included
 | 
			
		||||
#define _BIONIC_FREEBSD_SPINLOCK_H_included
 | 
			
		||||
 | 
			
		||||
/* TODO: until we have the FreeBSD findfp.c, this is useless. */
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
@@ -60,9 +60,6 @@ LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX)
 | 
			
		||||
# just for this module
 | 
			
		||||
LOCAL_NO_CRT := true
 | 
			
		||||
 | 
			
		||||
# TODO: split out the asflags.
 | 
			
		||||
LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
 | 
			
		||||
 | 
			
		||||
include $(BUILD_SYSTEM)/dynamic_binary.mk
 | 
			
		||||
 | 
			
		||||
# See build/core/executable.mk
 | 
			
		||||
 
 | 
			
		||||
@@ -801,8 +801,14 @@ static int soinfo_unload(soinfo* si) {
 | 
			
		||||
    for (Elf32_Dyn* d = si->dynamic; d->d_tag != DT_NULL; ++d) {
 | 
			
		||||
      if (d->d_tag == DT_NEEDED) {
 | 
			
		||||
        const char* library_name = si->strtab + d->d_un.d_val;
 | 
			
		||||
        TRACE("%s needs to unload %s", si->name, library_name);
 | 
			
		||||
        soinfo_unload(find_loaded_library(library_name));
 | 
			
		||||
        soinfo* lsi = find_loaded_library(library_name);
 | 
			
		||||
        if (lsi != NULL) {
 | 
			
		||||
          TRACE("%s needs to unload %s", si->name, lsi->name);
 | 
			
		||||
          soinfo_unload(lsi);
 | 
			
		||||
        } else {
 | 
			
		||||
          // TODO: should we return -1 in this case?
 | 
			
		||||
          DL_ERR("\"%s\": could not unload dependent library", si->name);
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -1155,6 +1161,21 @@ static int mips_relocate_got(soinfo* si, soinfo* needed[]) {
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* Please read the "Initialization and Termination functions" functions.
 | 
			
		||||
 * of the linker design note in bionic/linker/README.TXT to understand
 | 
			
		||||
 * what the following code is doing.
 | 
			
		||||
 *
 | 
			
		||||
 * The important things to remember are:
 | 
			
		||||
 *
 | 
			
		||||
 *   DT_PREINIT_ARRAY must be called first for executables, and should
 | 
			
		||||
 *   not appear in shared libraries.
 | 
			
		||||
 *
 | 
			
		||||
 *   DT_INIT should be called before DT_INIT_ARRAY if both are present
 | 
			
		||||
 *
 | 
			
		||||
 *   DT_FINI should be called after DT_FINI_ARRAY if both are present
 | 
			
		||||
 *
 | 
			
		||||
 *   DT_FINI_ARRAY must be parsed in reverse order.
 | 
			
		||||
 */
 | 
			
		||||
void soinfo::CallArray(const char* array_name UNUSED, linker_function_t* functions, size_t count, bool reverse) {
 | 
			
		||||
  if (functions == NULL) {
 | 
			
		||||
    return;
 | 
			
		||||
@@ -1189,8 +1210,6 @@ void soinfo::CallFunction(const char* function_name UNUSED, linker_function_t fu
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void soinfo::CallPreInitConstructors() {
 | 
			
		||||
  // DT_PREINIT_ARRAY functions are called before any other constructors for executables,
 | 
			
		||||
  // but ignored in a shared library.
 | 
			
		||||
  CallArray("DT_PREINIT_ARRAY", preinit_array, preinit_array_count, false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1211,36 +1230,31 @@ void soinfo::CallConstructors() {
 | 
			
		||||
  //    out above, the libc constructor will be called again (recursively!).
 | 
			
		||||
  constructors_called = true;
 | 
			
		||||
 | 
			
		||||
  if ((flags & FLAG_EXE) == 0 && preinit_array != NULL) {
 | 
			
		||||
    // The GNU dynamic linker silently ignores these, but we warn the developer.
 | 
			
		||||
    PRINT("\"%s\": ignoring %d-entry DT_PREINIT_ARRAY in shared library!",
 | 
			
		||||
          name, preinit_array_count);
 | 
			
		||||
  if (!(flags & FLAG_EXE) && preinit_array) {
 | 
			
		||||
    DL_ERR("shared library \"%s\" has a preinit_array table @ %p", name, preinit_array);
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (dynamic != NULL) {
 | 
			
		||||
    for (Elf32_Dyn* d = dynamic; d->d_tag != DT_NULL; ++d) {
 | 
			
		||||
      if (d->d_tag == DT_NEEDED) {
 | 
			
		||||
        const char* library_name = strtab + d->d_un.d_val;
 | 
			
		||||
        TRACE("\"%s\": calling constructors in DT_NEEDED \"%s\"", name, library_name);
 | 
			
		||||
        find_loaded_library(library_name)->CallConstructors();
 | 
			
		||||
        soinfo* lsi = find_loaded_library(library_name);
 | 
			
		||||
        if (lsi == NULL) {
 | 
			
		||||
          DL_ERR("\"%s\": could not initialize dependent library", name);
 | 
			
		||||
        } else {
 | 
			
		||||
          lsi->CallConstructors();
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  TRACE("\"%s\": calling constructors", name);
 | 
			
		||||
 | 
			
		||||
  // DT_INIT should be called before DT_INIT_ARRAY if both are present.
 | 
			
		||||
  CallFunction("DT_INIT", init_func);
 | 
			
		||||
  CallArray("DT_INIT_ARRAY", init_array, init_array_count, false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void soinfo::CallDestructors() {
 | 
			
		||||
  TRACE("\"%s\": calling destructors", name);
 | 
			
		||||
 | 
			
		||||
  // DT_FINI_ARRAY must be parsed in reverse order.
 | 
			
		||||
  CallArray("DT_FINI_ARRAY", fini_array, fini_array_count, true);
 | 
			
		||||
 | 
			
		||||
  // DT_FINI should be called after DT_FINI_ARRAY if both are present.
 | 
			
		||||
  CallFunction("DT_FINI", fini_func);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1339,7 +1353,7 @@ static bool soinfo_link_image(soinfo* si) {
 | 
			
		||||
                                    &si->ARM_exidx, &si->ARM_exidx_count);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    // Extract useful information from dynamic section.
 | 
			
		||||
    /* extract useful information from dynamic section */
 | 
			
		||||
    uint32_t needed_count = 0;
 | 
			
		||||
    for (Elf32_Dyn* d = si->dynamic; d->d_tag != DT_NULL; ++d) {
 | 
			
		||||
        DEBUG("d = %p, d[0](tag) = 0x%08x d[1](val) = 0x%08x", d, d->d_tag, d->d_un.d_val);
 | 
			
		||||
@@ -1390,29 +1404,29 @@ static bool soinfo_link_image(soinfo* si) {
 | 
			
		||||
            return false;
 | 
			
		||||
        case DT_INIT:
 | 
			
		||||
            si->init_func = reinterpret_cast<linker_function_t>(base + d->d_un.d_ptr);
 | 
			
		||||
            DEBUG("%s constructors (DT_INIT) found at %p", si->name, si->init_func);
 | 
			
		||||
            DEBUG("%s constructors (init func) found at %p", si->name, si->init_func);
 | 
			
		||||
            break;
 | 
			
		||||
        case DT_FINI:
 | 
			
		||||
            si->fini_func = reinterpret_cast<linker_function_t>(base + d->d_un.d_ptr);
 | 
			
		||||
            DEBUG("%s destructors (DT_FINI) found at %p", si->name, si->fini_func);
 | 
			
		||||
            DEBUG("%s destructors (fini func) found at %p", si->name, si->fini_func);
 | 
			
		||||
            break;
 | 
			
		||||
        case DT_INIT_ARRAY:
 | 
			
		||||
            si->init_array = reinterpret_cast<linker_function_t*>(base + d->d_un.d_ptr);
 | 
			
		||||
            DEBUG("%s constructors (DT_INIT_ARRAY) found at %p", si->name, si->init_array);
 | 
			
		||||
            DEBUG("%s constructors (init_array) found at %p", si->name, si->init_array);
 | 
			
		||||
            break;
 | 
			
		||||
        case DT_INIT_ARRAYSZ:
 | 
			
		||||
            si->init_array_count = ((unsigned)d->d_un.d_val) / sizeof(Elf32_Addr);
 | 
			
		||||
            break;
 | 
			
		||||
        case DT_FINI_ARRAY:
 | 
			
		||||
            si->fini_array = reinterpret_cast<linker_function_t*>(base + d->d_un.d_ptr);
 | 
			
		||||
            DEBUG("%s destructors (DT_FINI_ARRAY) found at %p", si->name, si->fini_array);
 | 
			
		||||
            DEBUG("%s destructors (fini_array) found at %p", si->name, si->fini_array);
 | 
			
		||||
            break;
 | 
			
		||||
        case DT_FINI_ARRAYSZ:
 | 
			
		||||
            si->fini_array_count = ((unsigned)d->d_un.d_val) / sizeof(Elf32_Addr);
 | 
			
		||||
            break;
 | 
			
		||||
        case DT_PREINIT_ARRAY:
 | 
			
		||||
            si->preinit_array = reinterpret_cast<linker_function_t*>(base + d->d_un.d_ptr);
 | 
			
		||||
            DEBUG("%s constructors (DT_PREINIT_ARRAY) found at %p", si->name, si->preinit_array);
 | 
			
		||||
            DEBUG("%s constructors (preinit_array) found at %p", si->name, si->preinit_array);
 | 
			
		||||
            break;
 | 
			
		||||
        case DT_PREINIT_ARRAYSZ:
 | 
			
		||||
            si->preinit_array_count = ((unsigned)d->d_un.d_val) / sizeof(Elf32_Addr);
 | 
			
		||||
@@ -1581,11 +1595,6 @@ static bool soinfo_link_image(soinfo* si) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // If this is a setuid/setgid program, close the security hole described in
 | 
			
		||||
    // ftp://ftp.freebsd.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-02:23.stdio.asc
 | 
			
		||||
    if (get_AT_SECURE()) {
 | 
			
		||||
        nullify_closed_stdio();
 | 
			
		||||
    }
 | 
			
		||||
    notify_gdb_of_load(si);
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
@@ -1614,6 +1623,12 @@ static Elf32_Addr __linker_init_post_relocation(KernelArgumentBlock& args, Elf32
 | 
			
		||||
    // Initialize environment functions, and get to the ELF aux vectors table.
 | 
			
		||||
    linker_env_init(args);
 | 
			
		||||
 | 
			
		||||
    // If this is a setuid/setgid program, close the security hole described in
 | 
			
		||||
    // ftp://ftp.freebsd.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-02:23.stdio.asc
 | 
			
		||||
    if (get_AT_SECURE()) {
 | 
			
		||||
        nullify_closed_stdio();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    debuggerd_init();
 | 
			
		||||
 | 
			
		||||
    // Get a few environment variables.
 | 
			
		||||
 
 | 
			
		||||
@@ -60,6 +60,8 @@ test_src_files = \
 | 
			
		||||
    dirent_test.cpp \
 | 
			
		||||
    eventfd_test.cpp \
 | 
			
		||||
    fenv_test.cpp \
 | 
			
		||||
    fortify1_test.cpp \
 | 
			
		||||
    fortify2_test.cpp \
 | 
			
		||||
    getauxval_test.cpp \
 | 
			
		||||
    getcwd_test.cpp \
 | 
			
		||||
    libc_logging_test.cpp \
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user