summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2017-07-27 10:38:45 -0700
committerChristopher Ferris <cferris@google.com>2017-07-27 10:38:45 -0700
commitdbaa22a7e135432c2effcfc7b9b2f31be80b90ff (patch)
tree41ae6a6e351fd4f042fd30a8299a752354165a75
parentd4a35a67a35e8dd2d03818e0cafa6e0271879b87 (diff)
downloadnative-dbaa22a7e135432c2effcfc7b9b2f31be80b90ff.tar.gz
Changes to support new v4.12.3 headers.
Test: Built and booted angler. Change-Id: I82405b4e52d203d6cfd81aa7583dfc8b2ae86f9d
-rw-r--r--cmds/servicemanager/binder.c6
-rw-r--r--libs/binder/Parcel.cpp42
2 files changed, 24 insertions, 24 deletions
diff --git a/cmds/servicemanager/binder.c b/cmds/servicemanager/binder.c
index 753aeb5020..2a10003190 100644
--- a/cmds/servicemanager/binder.c
+++ b/cmds/servicemanager/binder.c
@@ -514,7 +514,7 @@ void bio_put_obj(struct binder_io *bio, void *ptr)
return;
obj->flags = 0x7f | FLAT_BINDER_FLAG_ACCEPTS_FDS;
- obj->type = BINDER_TYPE_BINDER;
+ obj->hdr.type = BINDER_TYPE_BINDER;
obj->binder = (uintptr_t)ptr;
obj->cookie = 0;
}
@@ -532,7 +532,7 @@ void bio_put_ref(struct binder_io *bio, uint32_t handle)
return;
obj->flags = 0x7f | FLAT_BINDER_FLAG_ACCEPTS_FDS;
- obj->type = BINDER_TYPE_HANDLE;
+ obj->hdr.type = BINDER_TYPE_HANDLE;
obj->handle = handle;
obj->cookie = 0;
}
@@ -649,7 +649,7 @@ uint32_t bio_get_ref(struct binder_io *bio)
if (!obj)
return 0;
- if (obj->type == BINDER_TYPE_HANDLE)
+ if (obj->hdr.type == BINDER_TYPE_HANDLE)
return obj->handle;
return 0;
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 1769bec795..78bf7d733f 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -103,7 +103,7 @@ enum {
void acquire_object(const sp<ProcessState>& proc,
const flat_binder_object& obj, const void* who, size_t* outAshmemSize)
{
- switch (obj.type) {
+ switch (obj.hdr.type) {
case BINDER_TYPE_BINDER:
if (obj.binder) {
LOG_REFS("Parcel %p acquiring reference on local %p", who, obj.cookie);
@@ -139,7 +139,7 @@ void acquire_object(const sp<ProcessState>& proc,
}
}
- ALOGD("Invalid object type 0x%08x", obj.type);
+ ALOGD("Invalid object type 0x%08x", obj.hdr.type);
}
void acquire_object(const sp<ProcessState>& proc,
@@ -151,7 +151,7 @@ void acquire_object(const sp<ProcessState>& proc,
static void release_object(const sp<ProcessState>& proc,
const flat_binder_object& obj, const void* who, size_t* outAshmemSize)
{
- switch (obj.type) {
+ switch (obj.hdr.type) {
case BINDER_TYPE_BINDER:
if (obj.binder) {
LOG_REFS("Parcel %p releasing reference on local %p", who, obj.cookie);
@@ -190,7 +190,7 @@ static void release_object(const sp<ProcessState>& proc,
}
}
- ALOGE("Invalid object type 0x%08x", obj.type);
+ ALOGE("Invalid object type 0x%08x", obj.hdr.type);
}
void release_object(const sp<ProcessState>& proc,
@@ -219,17 +219,17 @@ status_t flatten_binder(const sp<ProcessState>& /*proc*/,
ALOGE("null proxy");
}
const int32_t handle = proxy ? proxy->handle() : 0;
- obj.type = BINDER_TYPE_HANDLE;
+ obj.hdr.type = BINDER_TYPE_HANDLE;
obj.binder = 0; /* Don't pass uninitialized stack data to a remote process */
obj.handle = handle;
obj.cookie = 0;
} else {
- obj.type = BINDER_TYPE_BINDER;
+ obj.hdr.type = BINDER_TYPE_BINDER;
obj.binder = reinterpret_cast<uintptr_t>(local->getWeakRefs());
obj.cookie = reinterpret_cast<uintptr_t>(local);
}
} else {
- obj.type = BINDER_TYPE_BINDER;
+ obj.hdr.type = BINDER_TYPE_BINDER;
obj.binder = 0;
obj.cookie = 0;
}
@@ -253,12 +253,12 @@ status_t flatten_binder(const sp<ProcessState>& /*proc*/,
ALOGE("null proxy");
}
const int32_t handle = proxy ? proxy->handle() : 0;
- obj.type = BINDER_TYPE_WEAK_HANDLE;
+ obj.hdr.type = BINDER_TYPE_WEAK_HANDLE;
obj.binder = 0; /* Don't pass uninitialized stack data to a remote process */
obj.handle = handle;
obj.cookie = 0;
} else {
- obj.type = BINDER_TYPE_WEAK_BINDER;
+ obj.hdr.type = BINDER_TYPE_WEAK_BINDER;
obj.binder = reinterpret_cast<uintptr_t>(binder.get_refs());
obj.cookie = reinterpret_cast<uintptr_t>(binder.unsafe_get());
}
@@ -273,13 +273,13 @@ status_t flatten_binder(const sp<ProcessState>& /*proc*/,
// but we can't do that with the different reference counting
// implementation we are using.
ALOGE("Unable to unflatten Binder weak reference!");
- obj.type = BINDER_TYPE_BINDER;
+ obj.hdr.type = BINDER_TYPE_BINDER;
obj.binder = 0;
obj.cookie = 0;
return finish_flatten_binder(NULL, obj, out);
} else {
- obj.type = BINDER_TYPE_BINDER;
+ obj.hdr.type = BINDER_TYPE_BINDER;
obj.binder = 0;
obj.cookie = 0;
return finish_flatten_binder(NULL, obj, out);
@@ -299,7 +299,7 @@ status_t unflatten_binder(const sp<ProcessState>& proc,
const flat_binder_object* flat = in.readObject(false);
if (flat) {
- switch (flat->type) {
+ switch (flat->hdr.type) {
case BINDER_TYPE_BINDER:
*out = reinterpret_cast<IBinder*>(flat->cookie);
return finish_unflatten_binder(NULL, *flat, in);
@@ -318,7 +318,7 @@ status_t unflatten_binder(const sp<ProcessState>& proc,
const flat_binder_object* flat = in.readObject(false);
if (flat) {
- switch (flat->type) {
+ switch (flat->hdr.type) {
case BINDER_TYPE_BINDER:
*out = reinterpret_cast<IBinder*>(flat->cookie);
return finish_unflatten_binder(NULL, *flat, in);
@@ -535,7 +535,7 @@ status_t Parcel::appendFrom(const Parcel *parcel, size_t offset, size_t len)
= reinterpret_cast<flat_binder_object*>(mData + off);
acquire_object(proc, *flat, this, &mOpenAshmemSize);
- if (flat->type == BINDER_TYPE_FD) {
+ if (flat->hdr.type == BINDER_TYPE_FD) {
// If this is a file descriptor, we need to dup it so the
// new Parcel now owns its own fd, and can declare that we
// officially know we have fds.
@@ -1132,7 +1132,7 @@ status_t Parcel::writeNativeHandle(const native_handle* handle)
status_t Parcel::writeFileDescriptor(int fd, bool takeOwnership)
{
flat_binder_object obj;
- obj.type = BINDER_TYPE_FD;
+ obj.hdr.type = BINDER_TYPE_FD;
obj.flags = 0x7f | FLAT_BINDER_FLAG_ACCEPTS_FDS;
obj.binder = 0; /* Don't pass uninitialized stack data to a remote process */
obj.handle = fd;
@@ -1284,7 +1284,7 @@ restart_write:
*reinterpret_cast<flat_binder_object*>(mData+mDataPos) = val;
// remember if it's a file descriptor
- if (val.type == BINDER_TYPE_FD) {
+ if (val.hdr.type == BINDER_TYPE_FD) {
if (!mAllowFds) {
// fail before modifying our object index
return FDS_NOT_ALLOWED;
@@ -1989,7 +1989,7 @@ int Parcel::readFileDescriptor() const
{
const flat_binder_object* flat = readObject(true);
- if (flat && flat->type == BINDER_TYPE_FD) {
+ if (flat && flat->hdr.type == BINDER_TYPE_FD) {
return flat->handle;
}
@@ -2167,7 +2167,7 @@ void Parcel::closeFileDescriptors()
i--;
const flat_binder_object* flat
= reinterpret_cast<flat_binder_object*>(mData+mObjects[i]);
- if (flat->type == BINDER_TYPE_FD) {
+ if (flat->hdr.type == BINDER_TYPE_FD) {
//ALOGI("Closing fd: %ld", flat->handle);
close(flat->handle);
}
@@ -2239,7 +2239,7 @@ void Parcel::print(TextOutput& to, uint32_t /*flags*/) const
const flat_binder_object* flat
= reinterpret_cast<const flat_binder_object*>(DATA+OBJS[i]);
to << endl << "Object #" << i << " @ " << (void*)OBJS[i] << ": "
- << TypeCode(flat->type & 0x7f7f7f00)
+ << TypeCode(flat->hdr.type & 0x7f7f7f00)
<< " = " << flat->binder;
}
} else {
@@ -2460,7 +2460,7 @@ status_t Parcel::continueWrite(size_t desired)
for (size_t i=objectsSize; i<mObjectsSize; i++) {
const flat_binder_object* flat
= reinterpret_cast<flat_binder_object*>(mData+mObjects[i]);
- if (flat->type == BINDER_TYPE_FD) {
+ if (flat->hdr.type == BINDER_TYPE_FD) {
// will need to rescan because we may have lopped off the only FDs
mFdsKnown = false;
}
@@ -2570,7 +2570,7 @@ void Parcel::scanForFds() const
for (size_t i=0; i<mObjectsSize; i++) {
const flat_binder_object* flat
= reinterpret_cast<const flat_binder_object*>(mData + mObjects[i]);
- if (flat->type == BINDER_TYPE_FD) {
+ if (flat->hdr.type == BINDER_TYPE_FD) {
hasFds = true;
break;
}