/* * Copyright (C) 2018 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. */ #pragma once #include namespace cuttlefish { // Keep the full disk size a multiple of 64k, for crosvm's virtio_blk driver constexpr int DISK_SIZE_SHIFT = 16; // Keep all partitions 4k aligned, for host performance reasons constexpr int PARTITION_SIZE_SHIFT = 12; // Returns the smallest multiple of 2^align_log greater than or equal to val. constexpr uint64_t AlignToPowerOf2(uint64_t val, uint8_t align_log) { uint64_t align = 1ULL << align_log; return ((val + (align - 1)) / align) * align; } } // namespace cuttlefish