diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-01-09 17:50:54 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-01-09 17:50:54 -0800 |
commit | 6d6c82c7a0a6b9a89f61b61c66f9b90d9c7177dc (patch) | |
tree | 8de86895228b63728c3a134c8b1fcab003db467d /libc/kernel | |
parent | 4e468ed2eb86a2406e14f1eca82072ee501d05fd (diff) | |
download | bionic-6d6c82c7a0a6b9a89f61b61c66f9b90d9c7177dc.zip bionic-6d6c82c7a0a6b9a89f61b61c66f9b90d9c7177dc.tar.gz bionic-6d6c82c7a0a6b9a89f61b61c66f9b90d9c7177dc.tar.bz2 |
auto import from //branches/cupcake/...@125939
Diffstat (limited to 'libc/kernel')
-rw-r--r-- | libc/kernel/arch-arm/asm/param.h | 1 | ||||
-rw-r--r-- | libc/kernel/arch-x86/asm/param.h | 1 | ||||
-rw-r--r-- | libc/kernel/common/linux/dm-ioctl.h | 146 | ||||
-rw-r--r-- | libc/kernel/common/linux/keychord.h | 30 | ||||
-rw-r--r-- | libc/kernel/common/linux/msm_audio.h | 81 | ||||
-rwxr-xr-x | libc/kernel/tools/clean_header.py | 1 | ||||
-rw-r--r-- | libc/kernel/tools/cpp.py | 21 | ||||
-rw-r--r-- | libc/kernel/tools/defaults.py | 11 |
8 files changed, 290 insertions, 2 deletions
diff --git a/libc/kernel/arch-arm/asm/param.h b/libc/kernel/arch-arm/asm/param.h index 23d45c7..6814fe3 100644 --- a/libc/kernel/arch-arm/asm/param.h +++ b/libc/kernel/arch-arm/asm/param.h @@ -20,7 +20,6 @@ #define NOGROUP (-1) #endif -#define MAXHOSTNAMELEN 64 #endif diff --git a/libc/kernel/arch-x86/asm/param.h b/libc/kernel/arch-x86/asm/param.h index 0825173..3fafd55 100644 --- a/libc/kernel/arch-x86/asm/param.h +++ b/libc/kernel/arch-x86/asm/param.h @@ -22,6 +22,5 @@ #define NOGROUP (-1) #endif -#define MAXHOSTNAMELEN 64 #endif diff --git a/libc/kernel/common/linux/dm-ioctl.h b/libc/kernel/common/linux/dm-ioctl.h new file mode 100644 index 0000000..ead7744 --- /dev/null +++ b/libc/kernel/common/linux/dm-ioctl.h @@ -0,0 +1,146 @@ +/**************************************************************************** + **************************************************************************** + *** + *** 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. + *** + **************************************************************************** + ****************************************************************************/ +#ifndef _LINUX_DM_IOCTL_V4_H +#define _LINUX_DM_IOCTL_V4_H + +#include <linux/types.h> + +#define DM_DIR "mapper" +#define DM_MAX_TYPE_NAME 16 +#define DM_NAME_LEN 128 +#define DM_UUID_LEN 129 + +struct dm_ioctl { + + uint32_t version[3]; + uint32_t data_size; + + uint32_t data_start; + + uint32_t target_count; + int32_t open_count; + uint32_t flags; + uint32_t event_nr; + uint32_t padding; + + uint64_t dev; + + char name[DM_NAME_LEN]; + char uuid[DM_UUID_LEN]; + char data[7]; +}; + +struct dm_target_spec { + uint64_t sector_start; + uint64_t length; + int32_t status; + + uint32_t next; + + char target_type[DM_MAX_TYPE_NAME]; + +}; + +struct dm_target_deps { + uint32_t count; + uint32_t padding; + uint64_t dev[0]; +}; + +struct dm_name_list { + uint64_t dev; + uint32_t next; + char name[0]; +}; + +struct dm_target_versions { + uint32_t next; + uint32_t version[3]; + + char name[0]; +}; + +struct dm_target_msg { + uint64_t sector; + + char message[0]; +}; + +enum { + + DM_VERSION_CMD = 0, + DM_REMOVE_ALL_CMD, + DM_LIST_DEVICES_CMD, + + DM_DEV_CREATE_CMD, + DM_DEV_REMOVE_CMD, + DM_DEV_RENAME_CMD, + DM_DEV_SUSPEND_CMD, + DM_DEV_STATUS_CMD, + DM_DEV_WAIT_CMD, + + DM_TABLE_LOAD_CMD, + DM_TABLE_CLEAR_CMD, + DM_TABLE_DEPS_CMD, + DM_TABLE_STATUS_CMD, + + DM_LIST_VERSIONS_CMD, + DM_TARGET_MSG_CMD, + DM_DEV_SET_GEOMETRY_CMD +}; + +#define DM_IOCTL 0xfd + +#define DM_VERSION _IOWR(DM_IOCTL, DM_VERSION_CMD, struct dm_ioctl) +#define DM_REMOVE_ALL _IOWR(DM_IOCTL, DM_REMOVE_ALL_CMD, struct dm_ioctl) +#define DM_LIST_DEVICES _IOWR(DM_IOCTL, DM_LIST_DEVICES_CMD, struct dm_ioctl) + +#define DM_DEV_CREATE _IOWR(DM_IOCTL, DM_DEV_CREATE_CMD, struct dm_ioctl) +#define DM_DEV_REMOVE _IOWR(DM_IOCTL, DM_DEV_REMOVE_CMD, struct dm_ioctl) +#define DM_DEV_RENAME _IOWR(DM_IOCTL, DM_DEV_RENAME_CMD, struct dm_ioctl) +#define DM_DEV_SUSPEND _IOWR(DM_IOCTL, DM_DEV_SUSPEND_CMD, struct dm_ioctl) +#define DM_DEV_STATUS _IOWR(DM_IOCTL, DM_DEV_STATUS_CMD, struct dm_ioctl) +#define DM_DEV_WAIT _IOWR(DM_IOCTL, DM_DEV_WAIT_CMD, struct dm_ioctl) + +#define DM_TABLE_LOAD _IOWR(DM_IOCTL, DM_TABLE_LOAD_CMD, struct dm_ioctl) +#define DM_TABLE_CLEAR _IOWR(DM_IOCTL, DM_TABLE_CLEAR_CMD, struct dm_ioctl) +#define DM_TABLE_DEPS _IOWR(DM_IOCTL, DM_TABLE_DEPS_CMD, struct dm_ioctl) +#define DM_TABLE_STATUS _IOWR(DM_IOCTL, DM_TABLE_STATUS_CMD, struct dm_ioctl) + +#define DM_LIST_VERSIONS _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, struct dm_ioctl) + +#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl) +#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) + +#define DM_VERSION_MAJOR 4 +#define DM_VERSION_MINOR 14 +#define DM_VERSION_PATCHLEVEL 0 +#define DM_VERSION_EXTRA "-ioctl (2008-04-23)" + +#define DM_READONLY_FLAG (1 << 0) +#define DM_SUSPEND_FLAG (1 << 1) +#define DM_PERSISTENT_DEV_FLAG (1 << 3) + +#define DM_STATUS_TABLE_FLAG (1 << 4) + +#define DM_ACTIVE_PRESENT_FLAG (1 << 5) +#define DM_INACTIVE_PRESENT_FLAG (1 << 6) + +#define DM_BUFFER_FULL_FLAG (1 << 8) + +#define DM_SKIP_BDGET_FLAG (1 << 9) + +#define DM_SKIP_LOCKFS_FLAG (1 << 10) + +#define DM_NOFLUSH_FLAG (1 << 11) + +#endif diff --git a/libc/kernel/common/linux/keychord.h b/libc/kernel/common/linux/keychord.h new file mode 100644 index 0000000..9148431 --- /dev/null +++ b/libc/kernel/common/linux/keychord.h @@ -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. + *** + **************************************************************************** + ****************************************************************************/ +#ifndef __LINUX_KEYCHORD_H_ +#define __LINUX_KEYCHORD_H_ + +#include <linux/input.h> + +#define KEYCHORD_VERSION 1 + +struct input_keychord { + + __u16 version; + + __u16 id; + + __u16 count; + + __u16 keycodes[]; +}; + +#endif diff --git a/libc/kernel/common/linux/msm_audio.h b/libc/kernel/common/linux/msm_audio.h new file mode 100644 index 0000000..58dc6f3 --- /dev/null +++ b/libc/kernel/common/linux/msm_audio.h @@ -0,0 +1,81 @@ +/**************************************************************************** + **************************************************************************** + *** + *** 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. + *** + **************************************************************************** + ****************************************************************************/ +#ifndef __LINUX_MSM_AUDIO_H +#define __LINUX_MSM_AUDIO_H + +#include <linux/types.h> +#include <linux/ioctl.h> +#include <asm/sizes.h> + +#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) +#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) +#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) + +struct msm_audio_config { + uint32_t buffer_size; + uint32_t buffer_count; + uint32_t channel_count; + uint32_t sample_rate; + uint32_t type; + uint32_t unused[3]; +}; + +struct msm_audio_stats { + uint32_t byte_count; + uint32_t sample_count; + uint32_t unused[2]; +}; + +#define SND_IOCTL_MAGIC 's' + +#define SND_MUTE_UNMUTED 0 +#define SND_MUTE_MUTED 1 + +struct msm_snd_device_config { + uint32_t device; + uint32_t ear_mute; + uint32_t mic_mute; +}; + +#define SND_SET_DEVICE _IOW(SND_IOCTL_MAGIC, 2, struct msm_device_config *) + +#define SND_METHOD_VOICE 0 + +struct msm_snd_volume_config { + uint32_t device; + uint32_t method; + 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 *) + +struct msm_snd_endpoint { + int id; + char name[64]; +}; + +#define SND_GET_ENDPOINT _IOWR(SND_IOCTL_MAGIC, 5, struct msm_snd_endpoint *) + +#endif + diff --git a/libc/kernel/tools/clean_header.py b/libc/kernel/tools/clean_header.py index bed9926..de4bf85 100755 --- a/libc/kernel/tools/clean_header.py +++ b/libc/kernel/tools/clean_header.py @@ -69,6 +69,7 @@ def cleanupFile( path ): list.removeVarsAndFuncs( statics ) list.removeComments() list.removeEmptyLines() + list.removeMacroDefines( kernel_ignored_macros ) list.insertDisclaimer( kernel.kernel_disclaimer ) out = StringOutput() diff --git a/libc/kernel/tools/cpp.py b/libc/kernel/tools/cpp.py index 54ebaf4..4b4bd38 100644 --- a/libc/kernel/tools/cpp.py +++ b/libc/kernel/tools/cpp.py @@ -1571,6 +1571,13 @@ class Block: """returns True iff this is a conditional directive block""" return self.directive in ["if","ifdef","ifndef","else","elif","endif"] + def isDefine(self): + """returns the macro name in a #define directive, or None otherwise""" + if self.directive != "define": + return None + + return self.tokens[0].value + def isIf(self): """returns True iff this is an #if-like directive block""" return self.directive in ["if","ifdef","ifndef","elif"] @@ -1678,6 +1685,10 @@ class BlockList: if b.isIf(): b.expr.optimize(macros) + def removeMacroDefines(self,macros): + """remove known macro definitions from a BlockList""" + self.blocks = remove_macro_defines(self.blocks,macros) + def removePrefixed(self,prefix,names): for b in self.blocks: if b.isIf(): @@ -1994,6 +2005,16 @@ def test_BlockParser(): ##################################################################################### ##################################################################################### +def remove_macro_defines( blocks, excludedMacros=set() ): + """remove macro definitions like #define <macroName> ....""" + result = [] + for b in blocks: + macroName = b.isDefine() + if macroName == None or not macroName in excludedMacros: + result.append(b) + + return result + def find_matching_endif( blocks, i ): n = len(blocks) depth = 1 diff --git a/libc/kernel/tools/defaults.py b/libc/kernel/tools/defaults.py index da78b87..aad0092 100644 --- a/libc/kernel/tools/defaults.py +++ b/libc/kernel/tools/defaults.py @@ -73,6 +73,17 @@ kernel_known_statics = { "x86" : kernel_known_x86_statics } +# this is a list of macros which we want to specifically exclude from +# the generated files. +# +kernel_ignored_macros = set( + [ "MAXHOSTNAMELEN", # for some reason, Linux defines it to 64 + # while most of the BSD code expects this to be 256 + # so ignore the kernel-provided definition and + # define it in the Bionic headers instead + ] + ) + # this is the standard disclaimer # kernel_disclaimer = """\ |