From 4129f20aafe07431a5950271cf7b9014bee53550 Mon Sep 17 00:00:00 2001 From: Sandeep Patil Date: Wed, 15 Feb 2017 15:36:25 -0800 Subject: [PATCH] fs_mgr: make fs_mgr_setup_verity public API Consequently this removes the 'early' version of the exact same API. This is to be used by early mount code where we need to do 1. setup verity 2. create verity device 3. mount partition as separate steps since that happens during init first stage. b/27805372 Test: Boot sailfish successfully Change-Id: I01abecfdfa210d3e240a291ddcb3d2e9ed39ede6 Signed-off-by: Sandeep Patil --- fs_mgr/fs_mgr.cpp | 20 -------------------- fs_mgr/fs_mgr_priv_verity.h | 27 --------------------------- fs_mgr/fs_mgr_verity.cpp | 1 - fs_mgr/include/fs_mgr.h | 8 ++++---- 4 files changed, 4 insertions(+), 52 deletions(-) delete mode 100644 fs_mgr/fs_mgr_priv_verity.h diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp index 28d33973f..25c41b96e 100644 --- a/fs_mgr/fs_mgr.cpp +++ b/fs_mgr/fs_mgr.cpp @@ -48,7 +48,6 @@ #include "fs_mgr_priv.h" #include "fs_mgr_priv_avb.h" -#include "fs_mgr_priv_verity.h" #define KEY_LOC_PROP "ro.crypto.keyfile.userdata" #define KEY_IN_FOOTER "footer" @@ -1191,22 +1190,3 @@ int fs_mgr_get_crypt_info(struct fstab *fstab, char *key_loc, char *real_blk_dev return 0; } - -int fs_mgr_early_setup_verity(struct fstab_rec *fstab_rec) -{ - if ((fstab_rec->fs_mgr_flags & MF_VERIFY) && device_is_secure()) { - int rc = fs_mgr_setup_verity(fstab_rec, false); - if (__android_log_is_debuggable() && rc == FS_MGR_SETUP_VERITY_DISABLED) { - LINFO << "Verity disabled"; - return FS_MGR_EARLY_SETUP_VERITY_NO_VERITY; - } else if (rc == FS_MGR_SETUP_VERITY_SUCCESS) { - return FS_MGR_EARLY_SETUP_VERITY_SUCCESS; - } else { - return FS_MGR_EARLY_SETUP_VERITY_FAIL; - } - } else if (device_is_secure()) { - LERROR << "Verity must be enabled for early mounted partitions on secured devices"; - return FS_MGR_EARLY_SETUP_VERITY_FAIL; - } - return FS_MGR_EARLY_SETUP_VERITY_NO_VERITY; -} diff --git a/fs_mgr/fs_mgr_priv_verity.h b/fs_mgr/fs_mgr_priv_verity.h deleted file mode 100644 index 1a6d215cb..000000000 --- a/fs_mgr/fs_mgr_priv_verity.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#define FS_MGR_SETUP_VERITY_DISABLED (-2) -#define FS_MGR_SETUP_VERITY_FAIL (-1) -#define FS_MGR_SETUP_VERITY_SUCCESS 0 - -__BEGIN_DECLS - -int fs_mgr_setup_verity(struct fstab_rec *fstab, bool verify_dev); - -__END_DECLS diff --git a/fs_mgr/fs_mgr_verity.cpp b/fs_mgr/fs_mgr_verity.cpp index e82913999..d72ac73de 100644 --- a/fs_mgr/fs_mgr_verity.cpp +++ b/fs_mgr/fs_mgr_verity.cpp @@ -45,7 +45,6 @@ #include "fs_mgr.h" #include "fs_mgr_priv.h" #include "fs_mgr_priv_dm_ioctl.h" -#include "fs_mgr_priv_verity.h" #define FSTAB_PREFIX "/fstab." diff --git a/fs_mgr/include/fs_mgr.h b/fs_mgr/include/fs_mgr.h index d6d94896e..7b389cd1c 100644 --- a/fs_mgr/include/fs_mgr.h +++ b/fs_mgr/include/fs_mgr.h @@ -132,10 +132,10 @@ int fs_mgr_swapon_all(struct fstab *fstab); int fs_mgr_do_format(struct fstab_rec *fstab, bool reserve_footer); -#define FS_MGR_EARLY_SETUP_VERITY_NO_VERITY -2 -#define FS_MGR_EARLY_SETUP_VERITY_FAIL -1 -#define FS_MGR_EARLY_SETUP_VERITY_SUCCESS 0 -int fs_mgr_early_setup_verity(struct fstab_rec *fstab); +#define FS_MGR_SETUP_VERITY_DISABLED (-2) +#define FS_MGR_SETUP_VERITY_FAIL (-1) +#define FS_MGR_SETUP_VERITY_SUCCESS 0 +int fs_mgr_setup_verity(struct fstab_rec *fstab, bool wait_for_verity_dev); #ifdef __cplusplus }