Switch kernel header parsing to python libclang

Replace the tokenizer in cpp.py with libclang.

Bug: 18937958
Change-Id: I27630904c6d2849418cd5ca3d3c612ec3078686d
This commit is contained in:
Tao Bao
2015-01-28 10:07:51 -08:00
parent 11829be3e1
commit d7db594b8d
670 changed files with 32589 additions and 32507 deletions

View File

@@ -19,20 +19,28 @@
#ifndef _LINUX_BCACHE_H
#define _LINUX_BCACHE_H
#include <asm/types.h>
#define BITMASK(name, type, field, offset, size) static inline __u64 name(const type *k) { return (k->field >> offset) & ~(~0ULL << size); } static inline void SET_##name(type *k, __u64 v) { k->field &= ~(~(~0ULL << size) << offset); k->field |= (v & ~(~0ULL << size)) << offset; }
#define BITMASK(name,type,field,offset,size) static inline __u64 name(const type * k) \
{ return(k->field >> offset) & ~(~0ULL << size); } static inline void SET_ ##name(type * k, __u64 v) \
{ k->field &= ~(~(~0ULL << size) << offset); k->field |= (v & ~(~0ULL << size)) << offset; \
}
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct bkey {
__u64 high;
__u64 low;
__u64 ptr[];
__u64 high;
__u64 low;
__u64 ptr[];
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
#define KEY_FIELD(name, field, offset, size) BITMASK(name, struct bkey, field, offset, size)
#define PTR_FIELD(name, offset, size) static inline __u64 name(const struct bkey *k, unsigned i) { return (k->ptr[i] >> offset) & ~(~0ULL << size); } static inline void SET_##name(struct bkey *k, unsigned i, __u64 v) { k->ptr[i] &= ~(~(~0ULL << size) << offset); k->ptr[i] |= (v & ~(~0ULL << size)) << offset; }
#define KEY_FIELD(name,field,offset,size) BITMASK(name, struct bkey, field, offset, size)
#define PTR_FIELD(name,offset,size) static inline __u64 name(const struct bkey * k, unsigned i) \
{ return(k->ptr[i] >> offset) & ~(~0ULL << size); } static inline void SET_ ##name(struct bkey * k, unsigned i, __u64 v) \
{ k->ptr[i] &= ~(~(~0ULL << size) << offset); k->ptr[i] |= (v & ~(~0ULL << size)) << offset; \
}
#define KEY_SIZE_BITS 16
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define KEY_MAX_U64S 8
#define KEY(inode, offset, size) ((struct bkey) { .high = (1ULL << 63) | ((__u64) (size) << 20) | (inode), .low = (offset) })
#define KEY(inode,offset,size) \
((struct bkey) {.high = (1ULL << 63) | ((__u64) (size) << 20) | (inode),.low = (offset) \
})
#define ZERO_KEY KEY(0, 0, 0)
#define MAX_KEY_INODE (~(~0 << 20))
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
@@ -43,11 +51,11 @@ struct bkey {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define PTR_DEV_BITS 12
#define PTR_CHECK_DEV ((1 << PTR_DEV_BITS) - 1)
#define PTR(gen, offset, dev) ((((__u64) dev) << 51) | ((__u64) offset) << 8 | gen)
#define bkey_copy(_dest, _src) memcpy(_dest, _src, bkey_bytes(_src))
#define PTR(gen,offset,dev) ((((__u64) dev) << 51) | ((__u64) offset) << 8 | gen)
#define bkey_copy(_dest,_src) memcpy(_dest, _src, bkey_bytes(_src))
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define BKEY_PAD 8
#define BKEY_PADDED(key) union { struct bkey key; __u64 key ## _pad[BKEY_PAD]; }
#define BKEY_PADDED(key) union { struct bkey key; __u64 key ##_pad[BKEY_PAD]; }
#define BCACHE_SB_VERSION_CDEV 0
#define BCACHE_SB_VERSION_BDEV 1
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
@@ -63,46 +71,46 @@ struct bkey {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define BDEV_DATA_START_DEFAULT 16
struct cache_sb {
__u64 csum;
__u64 offset;
__u64 csum;
__u64 offset;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u64 version;
__u8 magic[16];
__u8 uuid[16];
union {
__u64 version;
__u8 magic[16];
__u8 uuid[16];
union {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u8 set_uuid[16];
__u64 set_magic;
};
__u8 label[SB_LABEL_SIZE];
__u8 set_uuid[16];
__u64 set_magic;
};
__u8 label[SB_LABEL_SIZE];
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u64 flags;
__u64 seq;
__u64 pad[8];
union {
__u64 flags;
__u64 seq;
__u64 pad[8];
union {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct {
__u64 nbuckets;
__u16 block_size;
__u16 bucket_size;
struct {
__u64 nbuckets;
__u16 block_size;
__u16 bucket_size;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u16 nr_in_set;
__u16 nr_this_dev;
};
struct {
__u16 nr_in_set;
__u16 nr_this_dev;
};
struct {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u64 data_offset;
};
};
__u32 last_mount;
__u64 data_offset;
};
};
__u32 last_mount;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u16 first_bucket;
union {
__u16 njournal_buckets;
__u16 keys;
__u16 first_bucket;
union {
__u16 njournal_buckets;
__u16 keys;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
__u64 d[SB_JOURNAL_BUCKETS];
};
__u64 d[SB_JOURNAL_BUCKETS];
};
#define CACHE_REPLACEMENT_LRU 0U
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
@@ -127,83 +135,83 @@ struct cache_sb {
#define BCACHE_JSET_VERSION 1
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct jset {
__u64 csum;
__u64 magic;
__u64 seq;
__u64 csum;
__u64 magic;
__u64 seq;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 version;
__u32 keys;
__u64 last_seq;
BKEY_PADDED(uuid_bucket);
__u32 version;
__u32 keys;
__u64 last_seq;
BKEY_PADDED(uuid_bucket);
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
BKEY_PADDED(btree_root);
__u16 btree_level;
__u16 pad[3];
__u64 prio_bucket[MAX_CACHES_PER_SET];
BKEY_PADDED(btree_root);
__u16 btree_level;
__u16 pad[3];
__u64 prio_bucket[MAX_CACHES_PER_SET];
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
union {
struct bkey start[0];
__u64 d[0];
};
union {
struct bkey start[0];
__u64 d[0];
};
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
struct prio_set {
__u64 csum;
__u64 magic;
__u64 csum;
__u64 magic;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u64 seq;
__u32 version;
__u32 pad;
__u64 next_bucket;
__u64 seq;
__u32 version;
__u32 pad;
__u64 next_bucket;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct bucket_disk {
__u16 prio;
__u8 gen;
} __attribute((packed)) data[];
struct bucket_disk {
__u16 prio;
__u8 gen;
} __attribute((packed)) data[];
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
struct uuid_entry {
union {
struct {
union {
struct {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u8 uuid[16];
__u8 label[32];
__u32 first_reg;
__u32 last_reg;
__u8 uuid[16];
__u8 label[32];
__u32 first_reg;
__u32 last_reg;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 invalidated;
__u32 flags;
__u64 sectors;
};
__u32 invalidated;
__u32 flags;
__u64 sectors;
};
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u8 pad[128];
};
__u8 pad[128];
};
};
#define BCACHE_BSET_CSUM 1
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define BCACHE_BSET_VERSION 1
struct bset {
__u64 csum;
__u64 magic;
__u64 csum;
__u64 magic;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u64 seq;
__u32 version;
__u32 keys;
union {
__u64 seq;
__u32 version;
__u32 keys;
union {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct bkey start[0];
__u64 d[0];
};
struct bkey start[0];
__u64 d[0];
};
};
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct uuid_entry_v0 {
__u8 uuid[16];
__u8 label[32];
__u32 first_reg;
__u8 uuid[16];
__u8 label[32];
__u32 first_reg;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 last_reg;
__u32 invalidated;
__u32 pad;
__u32 last_reg;
__u32 invalidated;
__u32 pad;
};
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif