OSDN Git Service

DO NOT MERGE New faster file open kernel
authorPaul Lawrence <paullawrence@google.com>
Fri, 1 May 2015 12:24:04 +0000 (05:24 -0700)
committerPaul Lawrence <paullawrence@google.com>
Fri, 29 May 2015 21:19:21 +0000 (14:19 -0700)
(chery-picked from commit b01dc1c52ec0a4ec5e07a18ffb5b105a997cc329)

Bug: 18151196

Change-Id: Icdb3d9afa1db125102d01cd06f45dbc99ca78021

ext4_utils/ext4_crypt.cpp
ext4_utils/ext4_crypt_init_extensions.cpp

index 69358ba..886d17a 100644 (file)
@@ -31,6 +31,7 @@ struct ext4_encryption_policy {
     char version;
     char contents_encryption_mode;
     char filenames_encryption_mode;
+    char flags;
     char master_key_descriptor[EXT4_KEY_DESCRIPTOR_SIZE];
 } __attribute__((__packed__));
 
@@ -106,6 +107,7 @@ int do_policy_set(const char *directory, const char *policy, int policy_length)
     eep.version = 0;
     eep.contents_encryption_mode = EXT4_ENCRYPTION_MODE_AES_256_XTS;
     eep.filenames_encryption_mode = EXT4_ENCRYPTION_MODE_AES_256_CTS;
+    eep.flags = 0;
     memcpy(eep.master_key_descriptor, policy, EXT4_KEY_DESCRIPTOR_SIZE);
     ret = ioctl(fd, EXT4_IOC_SET_ENCRYPTION_POLICY, &eep);
     auto preserve_errno = errno;
@@ -117,7 +119,8 @@ int do_policy_set(const char *directory, const char *policy, int policy_length)
         return -EINVAL;
     }
 
-    KLOG_INFO(TAG, "Encryption policy for %s is set to %s\n", directory, policy);
+    KLOG_INFO(TAG, "Encryption policy for %s is set to %02x%02x%02x%02x\n",
+              directory, policy[0], policy[1], policy[2], policy[3]);
     return 0;
 }
 
index 92445e6..cae1f7f 100644 (file)
@@ -148,7 +148,7 @@ int e4crypt_set_directory_policy(const char* dir)
         return 0;
     }
 
-    KLOG_INFO(TAG, "Setting policy %s\n", policy.c_str());
+    KLOG_INFO(TAG, "Setting policy on %s\n", dir);
     int result = do_policy_set(dir, policy.c_str(), policy.size());
     if (result) {
         KLOG_ERROR(TAG, "Setting %s policy on %s failed!\n",