Be even more C++. Switch on a warning.

Remove lots of "extern C" and "ifdef __cplusplus" which are no longer
needed now all of vold is C++. Also turn on the cert-err58-cpp warning
we once had to disable.

Bug: 67041047
Test: compiles, boots
Change-Id: I8c6f9dd486f2409e0deed7bb648d959677465b21
This commit is contained in:
Paul Crowley 2017-10-31 08:25:55 -07:00
parent 2048a2865c
commit b64933a502
5 changed files with 30 additions and 44 deletions

View file

@ -17,7 +17,6 @@ cc_defaults {
"-*",
"cert-*",
"clang-analyzer-security*",
"-cert-err58-cpp",
],
tidy_flags: [
"-warnings-as-errors=clang-analyzer-security*,cert-*",

View file

@ -599,11 +599,6 @@ int VolumeManager::unmountAll() {
return 0;
}
extern "C" int vold_unmountAll(void) {
VolumeManager *vm = VolumeManager::Instance();
return vm->unmountAll();
}
int VolumeManager::mkdirs(const std::string& path) {
// Only offer to create directories for paths managed by vold
if (android::base::StartsWith(path, "/storage/")) {

View file

@ -21,8 +21,6 @@
#include <fnmatch.h>
#include <stdlib.h>
#ifdef __cplusplus
#include <list>
#include <mutex>
#include <string>
@ -154,12 +152,4 @@ private:
int mNextObbId;
};
extern "C" {
#endif /* __cplusplus */
#define UNMOUNT_NOT_MOUNTED_ERR (-2)
int vold_unmountAll(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -2051,6 +2051,11 @@ static int cryptfs_enable_all_volumes(struct crypt_mnt_ftr *crypt_ftr, int how,
return rc;
}
static int vold_unmountAll(void) {
VolumeManager* vm = VolumeManager::Instance();
return vm->unmountAll();
}
int cryptfs_enable_internal(const char *howarg, int crypt_type, const char *passwd,
int no_ui)
{

View file

@ -14,6 +14,9 @@
* limitations under the License.
*/
#ifndef ANDROID_VOLD_CRYPTFS_H
#define ANDROID_VOLD_CRYPTFS_H
/* This structure starts 16,384 bytes before the end of a hardware
* partition that is encrypted, or in a separate partition. It's location
* is specified by a property set in init.<device>.rc.
@ -218,34 +221,28 @@ struct crypt_persist_data {
#define PERSIST_DEL_KEY_ERROR_OTHER (-1)
#define PERSIST_DEL_KEY_ERROR_NO_FIELD (-2)
#ifdef __cplusplus
extern "C" {
#endif
int match_multi_entry(const char* key, const char* field, unsigned index);
int wait_and_unmount(const char* mountpoint, bool kill);
int match_multi_entry(const char *key, const char *field, unsigned index);
int wait_and_unmount(const char *mountpoint, bool kill);
typedef int (*kdf_func)(const char* passwd, const unsigned char* salt, unsigned char* ikey,
void* params);
typedef int (*kdf_func)(const char *passwd, const unsigned char *salt,
unsigned char *ikey, void *params);
int cryptfs_crypto_complete(void);
int cryptfs_check_passwd(const char* pw);
int cryptfs_verify_passwd(const char* pw);
int cryptfs_restart(void);
int cryptfs_enable(const char* flag, int type, const char* passwd, int no_ui);
int cryptfs_changepw(int type, const char* newpw);
int cryptfs_enable_default(const char* flag, int no_ui);
int cryptfs_setup_ext_volume(const char* label, const char* real_blkdev, const unsigned char* key,
int keysize, char* out_crypto_blkdev);
int cryptfs_revert_ext_volume(const char* label);
int cryptfs_getfield(const char* fieldname, char* value, int len);
int cryptfs_setfield(const char* fieldname, const char* value);
int cryptfs_mount_default_encrypted(void);
int cryptfs_get_password_type(void);
const char* cryptfs_get_password(void);
void cryptfs_clear_password(void);
int cryptfs_isConvertibleToFBE(void);
int cryptfs_crypto_complete(void);
int cryptfs_check_passwd(const char *pw);
int cryptfs_verify_passwd(const char *pw);
int cryptfs_restart(void);
int cryptfs_enable(const char *flag, int type, const char *passwd, int no_ui);
int cryptfs_changepw(int type, const char *newpw);
int cryptfs_enable_default(const char *flag, int no_ui);
int cryptfs_setup_ext_volume(const char* label, const char* real_blkdev,
const unsigned char* key, int keysize, char* out_crypto_blkdev);
int cryptfs_revert_ext_volume(const char* label);
int cryptfs_getfield(const char *fieldname, char *value, int len);
int cryptfs_setfield(const char *fieldname, const char *value);
int cryptfs_mount_default_encrypted(void);
int cryptfs_get_password_type(void);
const char* cryptfs_get_password(void);
void cryptfs_clear_password(void);
int cryptfs_isConvertibleToFBE(void);
#ifdef __cplusplus
}
#endif
#endif /* ANDROID_VOLD_CRYPTFS_H */