Skip to content

Commit

Permalink
Merge "uapi headers: simplify the <linux/compiler.h> stuff."
Browse files Browse the repository at this point in the history
  • Loading branch information
enh-google authored and Gerrit Code Review committed Apr 3, 2023
2 parents 022a139 + 0f0c18f commit 97c6902
Show file tree
Hide file tree
Showing 78 changed files with 425 additions and 428 deletions.
12 changes: 6 additions & 6 deletions libc/kernel/android/scsi/scsi/sg.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#define _SCSI_GENERIC_H
#include <linux/compiler.h>
typedef struct sg_iovec {
void __user * iov_base;
void * iov_base;
size_t iov_len;
} sg_iovec_t;
typedef struct sg_io_hdr {
Expand All @@ -30,13 +30,13 @@ typedef struct sg_io_hdr {
unsigned char mx_sb_len;
unsigned short iovec_count;
unsigned int dxfer_len;
void __user * dxferp;
unsigned char __user * cmdp;
void __user * sbp;
void * dxferp;
unsigned char * cmdp;
void * sbp;
unsigned int timeout;
unsigned int flags;
int pack_id;
void __user * usr_ptr;
void * usr_ptr;
unsigned char status;
unsigned char masked_status;
unsigned char msg_status;
Expand Down Expand Up @@ -96,7 +96,7 @@ typedef struct sg_req_info {
char sg_io_owned;
char problem;
int pack_id;
void __user * usr_ptr;
void * usr_ptr;
unsigned int duration;
int unused;
} sg_req_info_t;
Expand Down
17 changes: 5 additions & 12 deletions libc/kernel/android/uapi/linux/compiler.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
#ifndef _UAPI_LINUX_COMPILER_H
#define _UAPI_LINUX_COMPILER_H
#pragma once

/*
* This file is not currently in the Linux kernel tree.
* Upstream uapi headers refer to <linux/compiler.h> but there is
* no such uapi file. We've sent this upstream, and are optimistically
* adding it to bionic in the meantime. This should be replaced by
* a scrubbed header from external/kernel-headers when possible.
* There is no `include/uapi/linux/compiler.h`, just `include/linux/compiler.h`.
*
* An alternative to this file is to check in a symbolic link to the
* non-uapi <linux/compiler.h>. That's fine for building bionic too.
* We don't need anything _in_ this file, but we do need this file.
* The two #defines are for backwards compatibility.
*/

#define __user
#define __force

#endif /* _UAPI_LINUX_COMPILER_H */
#define __user
10 changes: 8 additions & 2 deletions libc/kernel/android/uapi/linux/compiler_types.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#pragma once

/*
* The compiler.h file has been split into compiler.h and compiler_types.h.
* However, to compile bionic we only need the compiler.h.
* There is no `include/uapi/linux/compiler_types.h`, just
* `include/linux/compiler_types.h`.
*
* We don't need anything _in_ this file, but we do need this file.
* The #include is for backwards compatibility.
*/

#include <linux/compiler.h>
10 changes: 4 additions & 6 deletions libc/kernel/tools/defaults.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
# this module contains all the defaults used by the generation of cleaned-up headers
# for the Bionic C library
#

import time, os, sys
from utils import *
# All the defaults used to generate the cleaned-up uapi headers for bionic.

# the list of include directories that belong to the kernel
# tree. used when looking for sources...
Expand Down Expand Up @@ -98,6 +93,9 @@
# Replace __packed with __attribute__((__packed__)) to avoid depending
# on sys/cdefs.h
"__packed": "__attribute__((__packed__))",
# Remove unused macros (http://b/262917450).
"__force": "",
"__user": "",
}


Expand Down
2 changes: 1 addition & 1 deletion libc/kernel/uapi/asm-arm/asm/signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct sigaction {
#define sa_handler _u._sa_handler
#define sa_sigaction _u._sa_sigaction
typedef struct sigaltstack {
void __user * ss_sp;
void * ss_sp;
int ss_flags;
__kernel_size_t ss_size;
} stack_t;
Expand Down
2 changes: 1 addition & 1 deletion libc/kernel/uapi/asm-arm64/asm/kvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ struct kvm_vcpu_events {
struct kvm_arm_copy_mte_tags {
__u64 guest_ipa;
__u64 length;
void __user * addr;
void * addr;
__u64 flags;
__u64 reserved[2];
};
Expand Down
4 changes: 2 additions & 2 deletions libc/kernel/uapi/asm-generic/poll.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
#ifndef POLLRDHUP
#define POLLRDHUP 0x2000
#endif
#define POLLFREE (__force __poll_t) 0x4000
#define POLL_BUSY_LOOP (__force __poll_t) 0x8000
#define POLLFREE ( __poll_t) 0x4000
#define POLL_BUSY_LOOP ( __poll_t) 0x8000
struct pollfd {
int fd;
short events;
Expand Down
10 changes: 5 additions & 5 deletions libc/kernel/uapi/asm-generic/siginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <linux/types.h>
typedef union sigval {
int sival_int;
void __user * sival_ptr;
void * sival_ptr;
} sigval_t;
#define SI_MAX_SIZE 128
#ifndef __ARCH_SI_BAND_T
Expand Down Expand Up @@ -58,7 +58,7 @@ union __sifields {
__ARCH_SI_CLOCK_T _stime;
} _sigchld;
struct {
void __user * _addr;
void * _addr;
#ifdef __ia64__
int _imm;
unsigned int _flags;
Expand All @@ -70,8 +70,8 @@ union __sifields {
short _addr_lsb;
struct {
char _dummy_bnd[__ADDR_BND_PKEY_PAD];
void __user * _lower;
void __user * _upper;
void * _lower;
void * _upper;
} _addr_bnd;
struct {
char _dummy_pkey[__ADDR_BND_PKEY_PAD];
Expand All @@ -89,7 +89,7 @@ union __sifields {
int _fd;
} _sigpoll;
struct {
void __user * _call_addr;
void * _call_addr;
int _syscall;
unsigned int _arch;
} _sigsys;
Expand Down
10 changes: 5 additions & 5 deletions libc/kernel/uapi/asm-generic/signal-defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@
#endif
#ifndef __ASSEMBLY__
typedef void __signalfn_t(int);
typedef __signalfn_t __user * __sighandler_t;
typedef __signalfn_t * __sighandler_t;
typedef void __restorefn_t(void);
typedef __restorefn_t __user * __sigrestore_t;
#define SIG_DFL ((__force __sighandler_t) 0)
#define SIG_IGN ((__force __sighandler_t) 1)
#define SIG_ERR ((__force __sighandler_t) - 1)
typedef __restorefn_t * __sigrestore_t;
#define SIG_DFL (( __sighandler_t) 0)
#define SIG_IGN (( __sighandler_t) 1)
#define SIG_ERR (( __sighandler_t) - 1)
#endif
#endif
2 changes: 1 addition & 1 deletion libc/kernel/uapi/asm-generic/signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct sigaction {
sigset_t sa_mask;
};
typedef struct sigaltstack {
void __user * ss_sp;
void * ss_sp;
int ss_flags;
__kernel_size_t ss_size;
} stack_t;
Expand Down
4 changes: 2 additions & 2 deletions libc/kernel/uapi/asm-x86/asm/sigcontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ struct sigcontext {
__u32 eflags;
__u32 esp_at_signal;
__u16 ss, __ssh;
struct _fpstate __user * fpstate;
struct _fpstate * fpstate;
__u32 oldmask;
__u32 cr2;
};
Expand Down Expand Up @@ -215,7 +215,7 @@ struct sigcontext {
__u64 trapno;
__u64 oldmask;
__u64 cr2;
struct _fpstate __user * fpstate;
struct _fpstate * fpstate;
#ifdef __ILP32__
__u32 __fpstate_pad;
#endif
Expand Down
2 changes: 1 addition & 1 deletion libc/kernel/uapi/asm-x86/asm/signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ struct sigaction {
};
#endif
typedef struct sigaltstack {
void __user * ss_sp;
void * ss_sp;
int ss_flags;
__kernel_size_t ss_size;
} stack_t;
Expand Down
32 changes: 16 additions & 16 deletions libc/kernel/uapi/drm/drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,19 @@ struct drm_version {
int version_minor;
int version_patchlevel;
__kernel_size_t name_len;
char __user * name;
char * name;
__kernel_size_t date_len;
char __user * date;
char * date;
__kernel_size_t desc_len;
char __user * desc;
char * desc;
};
struct drm_unique {
__kernel_size_t unique_len;
char __user * unique;
char * unique;
};
struct drm_list {
int count;
struct drm_version __user * version;
struct drm_version * version;
};
struct drm_block {
int unused;
Expand Down Expand Up @@ -202,37 +202,37 @@ struct drm_buf_desc {
};
struct drm_buf_info {
int count;
struct drm_buf_desc __user * list;
struct drm_buf_desc * list;
};
struct drm_buf_free {
int count;
int __user * list;
int * list;
};
struct drm_buf_pub {
int idx;
int total;
int used;
void __user * address;
void * address;
};
struct drm_buf_map {
int count;
#ifdef __cplusplus
void __user * virt;
void * virt;
#else
void __user * __linux_virtual;
void * __linux_virtual;
#endif
struct drm_buf_pub __user * list;
struct drm_buf_pub * list;
};
struct drm_dma {
int context;
int send_count;
int __user * send_indices;
int __user * send_sizes;
int * send_indices;
int * send_sizes;
enum drm_dma_flags flags;
int request_count;
int request_size;
int __user * request_indices;
int __user * request_sizes;
int * request_indices;
int * request_sizes;
int granted_count;
};
enum drm_ctx_flags {
Expand All @@ -245,7 +245,7 @@ struct drm_ctx {
};
struct drm_ctx_res {
int count;
struct drm_ctx __user * contexts;
struct drm_ctx * contexts;
};
struct drm_draw {
drm_drawable_t handle;
Expand Down
12 changes: 6 additions & 6 deletions libc/kernel/uapi/drm/i915_drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,18 +287,18 @@ typedef struct drm_i915_batchbuffer {
int DR1;
int DR4;
int num_cliprects;
struct drm_clip_rect __user * cliprects;
struct drm_clip_rect * cliprects;
} drm_i915_batchbuffer_t;
typedef struct _drm_i915_cmdbuffer {
char __user * buf;
char * buf;
int sz;
int DR1;
int DR4;
int num_cliprects;
struct drm_clip_rect __user * cliprects;
struct drm_clip_rect * cliprects;
} drm_i915_cmdbuffer_t;
typedef struct drm_i915_irq_emit {
int __user * irq_seq;
int * irq_seq;
} drm_i915_irq_emit_t;
typedef struct drm_i915_irq_wait {
int irq_seq;
Expand Down Expand Up @@ -371,7 +371,7 @@ typedef struct drm_i915_irq_wait {
#define I915_PARAM_OA_TIMESTAMP_FREQUENCY 57
struct drm_i915_getparam {
__s32 param;
int __user * value;
int * value;
};
typedef struct drm_i915_getparam drm_i915_getparam_t;
#define I915_SETPARAM_USE_MI_BATCHBUFFER_START 1
Expand All @@ -387,7 +387,7 @@ typedef struct drm_i915_mem_alloc {
int region;
int alignment;
int size;
int __user * region_offset;
int * region_offset;
} drm_i915_mem_alloc_t;
typedef struct drm_i915_mem_free {
int region;
Expand Down
2 changes: 1 addition & 1 deletion libc/kernel/uapi/drm/mga_drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ typedef struct _drm_mga_blit {
#define MGA_PARAM_CARD_TYPE 2
typedef struct drm_mga_getparam {
int param;
void __user * value;
void * value;
} drm_mga_getparam_t;
#ifdef __cplusplus
}
Expand Down
12 changes: 6 additions & 6 deletions libc/kernel/uapi/drm/r128_drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,13 @@ typedef struct drm_r128_depth {
R128_READ_PIXELS = 0x04
} func;
int n;
int __user * x;
int __user * y;
unsigned int __user * buffer;
unsigned char __user * mask;
int * x;
int * y;
unsigned int * buffer;
unsigned char * mask;
} drm_r128_depth_t;
typedef struct drm_r128_stipple {
unsigned int __user * mask;
unsigned int * mask;
} drm_r128_stipple_t;
typedef struct drm_r128_indirect {
int idx;
Expand All @@ -227,7 +227,7 @@ typedef struct drm_r128_fullscreen {
#define R128_PARAM_IRQ_NR 1
typedef struct drm_r128_getparam {
int param;
void __user * value;
void * value;
} drm_r128_getparam_t;
#ifdef __cplusplus
}
Expand Down
Loading

0 comments on commit 97c6902

Please sign in to comment.