mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
Merge commit 'refs/changes/28/79228/1' of https://android.googlesource.com/kernel/common into linaro-fixes/android-3.10-binder-compat
Pull in Serban's syncing android-3.10 w/ upstream binder cleanups Signed-off-by: John Stultz <john.stultz@linaro.org>
This commit is contained in:
@@ -1249,7 +1249,7 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
|
||||
struct flat_binder_object *fp;
|
||||
if (*offp > buffer->data_size - sizeof(*fp) ||
|
||||
buffer->data_size < sizeof(*fp) ||
|
||||
!IS_ALIGNED(*offp, sizeof(void *))) {
|
||||
!IS_ALIGNED(*offp, sizeof(u32))) {
|
||||
pr_err("transaction release %d bad offset %zd, size %zd\n",
|
||||
debug_id, *offp, buffer->data_size);
|
||||
continue;
|
||||
@@ -1273,7 +1273,7 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
|
||||
case BINDER_TYPE_WEAK_HANDLE: {
|
||||
struct binder_ref *ref = binder_get_ref(proc, fp->handle);
|
||||
if (ref == NULL) {
|
||||
pr_err("transaction release %d bad handle %ld\n",
|
||||
pr_err("transaction release %d bad handle %d\n",
|
||||
debug_id, fp->handle);
|
||||
break;
|
||||
}
|
||||
@@ -1285,13 +1285,13 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
|
||||
|
||||
case BINDER_TYPE_FD:
|
||||
binder_debug(BINDER_DEBUG_TRANSACTION,
|
||||
" fd %ld\n", fp->handle);
|
||||
" fd %d\n", fp->handle);
|
||||
if (failed_at)
|
||||
task_close_fd(proc, fp->handle);
|
||||
break;
|
||||
|
||||
default:
|
||||
pr_err("transaction release %d bad object type %lx\n",
|
||||
pr_err("transaction release %d bad object type %x\n",
|
||||
debug_id, fp->type);
|
||||
break;
|
||||
}
|
||||
@@ -1502,7 +1502,7 @@ static void binder_transaction(struct binder_proc *proc,
|
||||
struct flat_binder_object *fp;
|
||||
if (*offp > t->buffer->data_size - sizeof(*fp) ||
|
||||
t->buffer->data_size < sizeof(*fp) ||
|
||||
!IS_ALIGNED(*offp, sizeof(void *))) {
|
||||
!IS_ALIGNED(*offp, sizeof(u32))) {
|
||||
binder_user_error("%d:%d got transaction with invalid offset, %zd\n",
|
||||
proc->pid, thread->pid, *offp);
|
||||
return_error = BR_FAILED_REPLY;
|
||||
@@ -1557,7 +1557,7 @@ static void binder_transaction(struct binder_proc *proc,
|
||||
case BINDER_TYPE_WEAK_HANDLE: {
|
||||
struct binder_ref *ref = binder_get_ref(proc, fp->handle);
|
||||
if (ref == NULL) {
|
||||
binder_user_error("%d:%d got transaction with invalid handle, %ld\n",
|
||||
binder_user_error("%d:%d got transaction with invalid handle, %d\n",
|
||||
proc->pid,
|
||||
thread->pid, fp->handle);
|
||||
return_error = BR_FAILED_REPLY;
|
||||
@@ -1604,13 +1604,13 @@ static void binder_transaction(struct binder_proc *proc,
|
||||
|
||||
if (reply) {
|
||||
if (!(in_reply_to->flags & TF_ACCEPT_FDS)) {
|
||||
binder_user_error("%d:%d got reply with fd, %ld, but target does not allow fds\n",
|
||||
binder_user_error("%d:%d got reply with fd, %d, but target does not allow fds\n",
|
||||
proc->pid, thread->pid, fp->handle);
|
||||
return_error = BR_FAILED_REPLY;
|
||||
goto err_fd_not_allowed;
|
||||
}
|
||||
} else if (!target_node->accept_fds) {
|
||||
binder_user_error("%d:%d got transaction with fd, %ld, but target does not allow fds\n",
|
||||
binder_user_error("%d:%d got transaction with fd, %d, but target does not allow fds\n",
|
||||
proc->pid, thread->pid, fp->handle);
|
||||
return_error = BR_FAILED_REPLY;
|
||||
goto err_fd_not_allowed;
|
||||
@@ -1618,7 +1618,7 @@ static void binder_transaction(struct binder_proc *proc,
|
||||
|
||||
file = fget(fp->handle);
|
||||
if (file == NULL) {
|
||||
binder_user_error("%d:%d got transaction with invalid fd, %ld\n",
|
||||
binder_user_error("%d:%d got transaction with invalid fd, %d\n",
|
||||
proc->pid, thread->pid, fp->handle);
|
||||
return_error = BR_FAILED_REPLY;
|
||||
goto err_fget_failed;
|
||||
@@ -1637,13 +1637,13 @@ static void binder_transaction(struct binder_proc *proc,
|
||||
task_fd_install(target_proc, target_fd, file);
|
||||
trace_binder_transaction_fd(t, fp->handle, target_fd);
|
||||
binder_debug(BINDER_DEBUG_TRANSACTION,
|
||||
" fd %ld -> %d\n", fp->handle, target_fd);
|
||||
" fd %d -> %d\n", fp->handle, target_fd);
|
||||
/* TODO: fput? */
|
||||
fp->handle = target_fd;
|
||||
} break;
|
||||
|
||||
default:
|
||||
binder_user_error("%d:%d got transaction with invalid object type, %lx\n",
|
||||
binder_user_error("%d:%d got transaction with invalid object type, %x\n",
|
||||
proc->pid, thread->pid, fp->type);
|
||||
return_error = BR_FAILED_REPLY;
|
||||
goto err_bad_object_type;
|
||||
@@ -1719,7 +1719,7 @@ err_no_context_mgr_node:
|
||||
}
|
||||
|
||||
int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
|
||||
void __user *buffer, int size, signed long *consumed)
|
||||
void __user *buffer, size_t size, size_t *consumed)
|
||||
{
|
||||
uint32_t cmd;
|
||||
void __user *ptr = buffer + *consumed;
|
||||
@@ -2099,8 +2099,8 @@ static int binder_has_thread_work(struct binder_thread *thread)
|
||||
|
||||
static int binder_thread_read(struct binder_proc *proc,
|
||||
struct binder_thread *thread,
|
||||
void __user *buffer, int size,
|
||||
signed long *consumed, int non_block)
|
||||
void __user *buffer, size_t size,
|
||||
size_t *consumed, int non_block)
|
||||
{
|
||||
void __user *ptr = buffer + *consumed;
|
||||
void __user *end = buffer + size;
|
||||
@@ -2597,7 +2597,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
goto err;
|
||||
}
|
||||
binder_debug(BINDER_DEBUG_READ_WRITE,
|
||||
"%d:%d write %ld at %08lx, read %ld at %08lx\n",
|
||||
"%d:%d write %zd at %016lx, read %zd at %016lx\n",
|
||||
proc->pid, thread->pid, bwr.write_size,
|
||||
bwr.write_buffer, bwr.read_size, bwr.read_buffer);
|
||||
|
||||
@@ -2623,7 +2623,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
}
|
||||
}
|
||||
binder_debug(BINDER_DEBUG_READ_WRITE,
|
||||
"%d:%d wrote %ld of %ld, read return %ld of %ld\n",
|
||||
"%d:%d wrote %zd of %zd, read return %zd of %zd\n",
|
||||
proc->pid, thread->pid, bwr.write_consumed, bwr.write_size,
|
||||
bwr.read_consumed, bwr.read_size);
|
||||
if (copy_to_user(ubuf, &bwr, sizeof(bwr))) {
|
||||
|
||||
@@ -48,13 +48,13 @@ enum {
|
||||
*/
|
||||
struct flat_binder_object {
|
||||
/* 8 bytes for large_flat_header. */
|
||||
unsigned long type;
|
||||
unsigned long flags;
|
||||
__u32 type;
|
||||
__u32 flags;
|
||||
|
||||
/* 8 bytes of data. */
|
||||
union {
|
||||
void __user *binder; /* local object */
|
||||
signed long handle; /* remote object */
|
||||
__u32 handle; /* remote object */
|
||||
};
|
||||
|
||||
/* extra data associated with local object */
|
||||
@@ -67,18 +67,18 @@ struct flat_binder_object {
|
||||
*/
|
||||
|
||||
struct binder_write_read {
|
||||
signed long write_size; /* bytes to write */
|
||||
signed long write_consumed; /* bytes consumed by driver */
|
||||
size_t write_size; /* bytes to write */
|
||||
size_t write_consumed; /* bytes consumed by driver */
|
||||
unsigned long write_buffer;
|
||||
signed long read_size; /* bytes to read */
|
||||
signed long read_consumed; /* bytes consumed by driver */
|
||||
size_t read_size; /* bytes to read */
|
||||
size_t read_consumed; /* bytes consumed by driver */
|
||||
unsigned long read_buffer;
|
||||
};
|
||||
|
||||
/* Use with BINDER_VERSION, driver fills in fields. */
|
||||
struct binder_version {
|
||||
/* driver protocol version -- increment with incompatible change */
|
||||
signed long protocol_version;
|
||||
__s32 protocol_version;
|
||||
};
|
||||
|
||||
/* This is the current protocol version. */
|
||||
@@ -86,7 +86,7 @@ struct binder_version {
|
||||
|
||||
#define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read)
|
||||
#define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64)
|
||||
#define BINDER_SET_MAX_THREADS _IOW('b', 5, size_t)
|
||||
#define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32)
|
||||
#define BINDER_SET_IDLE_PRIORITY _IOW('b', 6, __s32)
|
||||
#define BINDER_SET_CONTEXT_MGR _IOW('b', 7, __s32)
|
||||
#define BINDER_THREAD_EXIT _IOW('b', 8, __s32)
|
||||
@@ -119,14 +119,14 @@ struct binder_transaction_data {
|
||||
* identifying the target and contents of the transaction.
|
||||
*/
|
||||
union {
|
||||
size_t handle; /* target descriptor of command transaction */
|
||||
__u32 handle; /* target descriptor of command transaction */
|
||||
void *ptr; /* target descriptor of return transaction */
|
||||
} target;
|
||||
void *cookie; /* target object cookie */
|
||||
unsigned int code; /* transaction command */
|
||||
__u32 code; /* transaction command */
|
||||
|
||||
/* General information about the transaction. */
|
||||
unsigned int flags;
|
||||
__u32 flags;
|
||||
pid_t sender_pid;
|
||||
uid_t sender_euid;
|
||||
size_t data_size; /* number of bytes of data */
|
||||
@@ -143,7 +143,7 @@ struct binder_transaction_data {
|
||||
/* offsets from buffer to flat_binder_object structs */
|
||||
const void __user *offsets;
|
||||
} ptr;
|
||||
uint8_t buf[8];
|
||||
__u8 buf[8];
|
||||
} data;
|
||||
};
|
||||
|
||||
@@ -152,19 +152,24 @@ struct binder_ptr_cookie {
|
||||
void *cookie;
|
||||
};
|
||||
|
||||
struct binder_handle_cookie {
|
||||
__u32 handle;
|
||||
void *cookie;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct binder_pri_desc {
|
||||
int priority;
|
||||
int desc;
|
||||
__s32 priority;
|
||||
__u32 desc;
|
||||
};
|
||||
|
||||
struct binder_pri_ptr_cookie {
|
||||
int priority;
|
||||
__s32 priority;
|
||||
void *ptr;
|
||||
void *cookie;
|
||||
};
|
||||
|
||||
enum binder_driver_return_protocol {
|
||||
BR_ERROR = _IOR('r', 0, int),
|
||||
BR_ERROR = _IOR('r', 0, __s32),
|
||||
/*
|
||||
* int: error code
|
||||
*/
|
||||
@@ -178,7 +183,7 @@ enum binder_driver_return_protocol {
|
||||
* binder_transaction_data: the received command.
|
||||
*/
|
||||
|
||||
BR_ACQUIRE_RESULT = _IOR('r', 4, int),
|
||||
BR_ACQUIRE_RESULT = _IOR('r', 4, __s32),
|
||||
/*
|
||||
* not currently supported
|
||||
* int: 0 if the last bcATTEMPT_ACQUIRE was not successful.
|
||||
@@ -258,22 +263,22 @@ enum binder_driver_command_protocol {
|
||||
* binder_transaction_data: the sent command.
|
||||
*/
|
||||
|
||||
BC_ACQUIRE_RESULT = _IOW('c', 2, int),
|
||||
BC_ACQUIRE_RESULT = _IOW('c', 2, __s32),
|
||||
/*
|
||||
* not currently supported
|
||||
* int: 0 if the last BR_ATTEMPT_ACQUIRE was not successful.
|
||||
* Else you have acquired a primary reference on the object.
|
||||
*/
|
||||
|
||||
BC_FREE_BUFFER = _IOW('c', 3, int),
|
||||
BC_FREE_BUFFER = _IOW('c', 3, void *),
|
||||
/*
|
||||
* void *: ptr to transaction data received on a read
|
||||
*/
|
||||
|
||||
BC_INCREFS = _IOW('c', 4, int),
|
||||
BC_ACQUIRE = _IOW('c', 5, int),
|
||||
BC_RELEASE = _IOW('c', 6, int),
|
||||
BC_DECREFS = _IOW('c', 7, int),
|
||||
BC_INCREFS = _IOW('c', 4, __u32),
|
||||
BC_ACQUIRE = _IOW('c', 5, __u32),
|
||||
BC_RELEASE = _IOW('c', 6, __u32),
|
||||
BC_DECREFS = _IOW('c', 7, __u32),
|
||||
/*
|
||||
* int: descriptor
|
||||
*/
|
||||
@@ -308,15 +313,15 @@ enum binder_driver_command_protocol {
|
||||
* of looping threads it has available.
|
||||
*/
|
||||
|
||||
BC_REQUEST_DEATH_NOTIFICATION = _IOW('c', 14, struct binder_ptr_cookie),
|
||||
BC_REQUEST_DEATH_NOTIFICATION = _IOW('c', 14, struct binder_handle_cookie),
|
||||
/*
|
||||
* void *: ptr to binder
|
||||
* int: handle
|
||||
* void *: cookie
|
||||
*/
|
||||
|
||||
BC_CLEAR_DEATH_NOTIFICATION = _IOW('c', 15, struct binder_ptr_cookie),
|
||||
BC_CLEAR_DEATH_NOTIFICATION = _IOW('c', 15, struct binder_handle_cookie),
|
||||
/*
|
||||
* void *: ptr to binder
|
||||
* int: handle
|
||||
* void *: cookie
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user