No using inside header files

I thought it was OK to use "using" in a header file so long as it was
inside a "namespace" block, but it just imports symbols from one
namespace into another, so things that shouldn't work do.

Test: Treehugger
Change-Id: I4d43d35339636af7e95761cada7120b4db638c01
This commit is contained in:
Paul Crowley 2020-04-05 19:34:31 -07:00
parent 12e48a85fb
commit f4430387d2
3 changed files with 9 additions and 6 deletions

View file

@ -36,6 +36,9 @@
namespace android { namespace android {
namespace vold { namespace vold {
using android::fscrypt::EncryptionOptions;
using android::fscrypt::EncryptionPolicy;
const KeyGeneration neverGen() { const KeyGeneration neverGen() {
return KeyGeneration{0, false, false}; return KeyGeneration{0, false, false};
} }

View file

@ -28,8 +28,6 @@
namespace android { namespace android {
namespace vold { namespace vold {
using namespace android::fscrypt;
// Description of how to generate a key when needed. // Description of how to generate a key when needed.
struct KeyGeneration { struct KeyGeneration {
size_t keysize; size_t keysize;
@ -63,8 +61,8 @@ bool isFsKeyringSupported(void);
// //
// Returns %true on success, %false on failure. On success also sets *policy // Returns %true on success, %false on failure. On success also sets *policy
// to the EncryptionPolicy used to refer to this key. // to the EncryptionPolicy used to refer to this key.
bool installKey(const std::string& mountpoint, const EncryptionOptions& options, bool installKey(const std::string& mountpoint, const android::fscrypt::EncryptionOptions& options,
const KeyBuffer& key, EncryptionPolicy* policy); const KeyBuffer& key, android::fscrypt::EncryptionPolicy* policy);
// Evict a file-based encryption key from the kernel. // Evict a file-based encryption key from the kernel.
// //
@ -72,7 +70,7 @@ bool installKey(const std::string& mountpoint, const EncryptionOptions& options,
// //
// If the kernel doesn't support the filesystem-level keyring, the caller is // If the kernel doesn't support the filesystem-level keyring, the caller is
// responsible for dropping caches. // responsible for dropping caches.
bool evictKey(const std::string& mountpoint, const EncryptionPolicy& policy); bool evictKey(const std::string& mountpoint, const android::fscrypt::EncryptionPolicy& policy);
// Retrieves the key from the named directory, or generates it if it doesn't // Retrieves the key from the named directory, or generates it if it doesn't
// exist. // exist.
@ -82,7 +80,8 @@ bool retrieveOrGenerateKey(const std::string& key_path, const std::string& tmp_p
// Re-installs a file-based encryption key of fscrypt-provisioning type from the // Re-installs a file-based encryption key of fscrypt-provisioning type from the
// global session keyring back into fs keyring of the mountpoint. // global session keyring back into fs keyring of the mountpoint.
bool reloadKeyFromSessionKeyring(const std::string& mountpoint, const EncryptionPolicy& policy); bool reloadKeyFromSessionKeyring(const std::string& mountpoint,
const android::fscrypt::EncryptionPolicy& policy);
} // namespace vold } // namespace vold
} // namespace android } // namespace android

View file

@ -49,6 +49,7 @@ namespace vold {
using android::fs_mgr::FstabEntry; using android::fs_mgr::FstabEntry;
using android::fs_mgr::GetEntryForMountPoint; using android::fs_mgr::GetEntryForMountPoint;
using android::fscrypt::GetFirstApiLevel;
using android::vold::KeyBuffer; using android::vold::KeyBuffer;
using namespace android::dm; using namespace android::dm;