resolve merge conflicts of d38ce6ce to oc-dev-plus-aosp
Test: I solemnly swear I tested this conflict resolution.
Change-Id: I589f393be9d6ce0cf76afbd39d8e28d3fb6046d9
diff --git a/ext4_utils/Android.bp b/ext4_utils/Android.bp
index a2987aa..493fae5 100644
--- a/ext4_utils/Android.bp
+++ b/ext4_utils/Android.bp
@@ -41,11 +41,11 @@
android: {
srcs: [
- "key_control.cpp",
"ext4_crypt.cpp",
],
shared_libs: [
"libbase",
+ "libkeyutils",
"libselinux",
],
diff --git a/ext4_utils/ext4_crypt_init_extensions.cpp b/ext4_utils/ext4_crypt_init_extensions.cpp
index b900916..2bf8801 100644
--- a/ext4_utils/ext4_crypt_init_extensions.cpp
+++ b/ext4_utils/ext4_crypt_init_extensions.cpp
@@ -31,10 +31,10 @@
#include <android-base/strings.h>
#include <cutils/properties.h>
#include <cutils/sockets.h>
+#include <keyutils.h>
#include <logwrap/logwrap.h>
#include "ext4_utils/ext4_crypt.h"
-#include "ext4_utils/key_control.h"
#define TAG "ext4_utils"
diff --git a/ext4_utils/include/ext4_utils/key_control.h b/ext4_utils/include/ext4_utils/key_control.h
deleted file mode 100644
index 9b18413..0000000
--- a/ext4_utils/include/ext4_utils/key_control.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef _KEY_CONTROL_H_
-#define _KEY_CONTROL_H_
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-__BEGIN_DECLS
-
-// ext4enc:TODO - get these keyring standard definitions from proper system file
-// keyring serial number type
-typedef int32_t key_serial_t;
-
-// special process keyring shortcut IDs
-#define KEY_SPEC_THREAD_KEYRING (-1) // key ID for thread-specific keyring
-#define KEY_SPEC_PROCESS_KEYRING (-2) // key ID for process-specific keyring
-#define KEY_SPEC_SESSION_KEYRING (-3) // key ID for session-specific keyring
-#define KEY_SPEC_USER_KEYRING (-4) // key ID for UID-specific keyring
-#define KEY_SPEC_USER_SESSION_KEYRING (-5) // key ID for UID-session keyring
-#define KEY_SPEC_GROUP_KEYRING (-6) // key ID for GID-specific keyring
-
-key_serial_t add_key(const char *type,
- const char *description,
- const void *payload,
- size_t plen,
- key_serial_t ringid);
-
-long keyctl_unlink(key_serial_t key, key_serial_t keyring);
-
-long keyctl_setperm(key_serial_t id, int permissions);
-
-long keyctl_search(key_serial_t ringid, const char *type,
- const char *description, key_serial_t destringid);
-
-__END_DECLS
-
-#endif // _KEY_CONTROL_H_
diff --git a/ext4_utils/key_control.cpp b/ext4_utils/key_control.cpp
deleted file mode 100644
index e295cbe..0000000
--- a/ext4_utils/key_control.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-#include "ext4_utils/key_control.h"
-
-#include <stdarg.h>
-#include <unistd.h>
-#include <sys/syscall.h>
-#include <linux/keyctl.h>
-
-static long keyctl(int cmd, ...)
-{
- va_list va;
- unsigned long arg2, arg3, arg4, arg5;
-
- va_start(va, cmd);
- arg2 = va_arg(va, unsigned long);
- arg3 = va_arg(va, unsigned long);
- arg4 = va_arg(va, unsigned long);
- arg5 = va_arg(va, unsigned long);
- va_end(va);
- return syscall(__NR_keyctl, cmd, arg2, arg3, arg4, arg5);
-}
-
-key_serial_t add_key(const char *type,
- const char *description,
- const void *payload,
- size_t plen,
- key_serial_t ringid)
-{
- return syscall(__NR_add_key, type, description, payload, plen, ringid);
-}
-
-long keyctl_unlink(key_serial_t key, key_serial_t keyring)
-{
- return keyctl(KEYCTL_UNLINK, key, keyring);
-}
-
-long keyctl_setperm(key_serial_t id, int permissions)
-{
- return keyctl(KEYCTL_SETPERM, id, permissions);
-}
-
-long keyctl_search(key_serial_t ringid, const char *type,
- const char *description, key_serial_t destringid)
-{
- return keyctl(KEYCTL_SEARCH, ringid, type, description, destringid);
-}