b92247368a
This mostly 1:1 replaces manual ioctls to device-mapper with calls to libdm. There were two exceptions: (1) There is a very old table-load-retry loop to workaround issues with umount (b/7220345). This loop has been preserved, however, it now includes DM_DEV_CREATE as well as DM_TABLE_LOAD. (2) There was some ancient code to set DM_DEV_GEOMETRY for obb dm-devices. This never did anything since geometry must be set after loading a table. When setting it before (as vold was doing), the subsequent DM_TABLE_LOAD will clear it. Bug: 132206403 Test: FBE device boots FBE device w/ metadata encryption boots FDE device boots atest StorageManagerIntegrationTest Change-Id: Ib6db6b47329f093ac7084edaf604eddace8b9ac6
31 lines
977 B
C++
31 lines
977 B
C++
/*
|
|
* Copyright (C) 2008 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.
|
|
*/
|
|
|
|
#ifndef _DEVMAPPER_H
|
|
#define _DEVMAPPER_H
|
|
|
|
#include <linux/dm-ioctl.h>
|
|
#include <unistd.h>
|
|
|
|
class Devmapper {
|
|
public:
|
|
static int create(const char* name, const char* loopFile, const char* key,
|
|
unsigned long numSectors, char* buffer, size_t len);
|
|
static int destroy(const char* name);
|
|
static int destroyAll();
|
|
};
|
|
|
|
#endif
|