|
Packit Service |
b3514a |
/*
|
|
Packit Service |
b3514a |
* Copyright (c) 2020 Red Hat, Inc.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* This program is free software; you can redistribute it and/or
|
|
Packit Service |
b3514a |
* modify it under the terms of the GNU General Public License
|
|
Packit Service |
b3514a |
* as published by the Free Software Foundation; either version 2
|
|
Packit Service |
b3514a |
* of the License, or (at your option) any later version.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* This program is distributed in the hope that it will be useful,
|
|
Packit Service |
b3514a |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
b3514a |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
b3514a |
* GNU General Public License for more details.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* You should have received a copy of the GNU General Public License
|
|
Packit Service |
b3514a |
* along with this program; if not, write to the Free Software
|
|
Packit Service |
b3514a |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
Packit Service |
b3514a |
* 02110-1301, USA.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* $Id: //eng/vdo-releases/aluminum/src/c++/vdo/base/vdoLoad.h#3 $
|
|
Packit Service |
b3514a |
*/
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
#ifndef VDO_LOAD_H
|
|
Packit Service |
b3514a |
#define VDO_LOAD_H
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
#include "volumeGeometry.h"
|
|
Packit Service |
b3514a |
#include "types.h"
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* A function which decodes a VDO from a super block.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param vdo The VDO to be decoded (its super block must already
|
|
Packit Service |
b3514a |
* be loaded)
|
|
Packit Service |
b3514a |
* @param validateConfig If true , the VDO's configuration will
|
|
Packit Service |
b3514a |
* be validated before the decode is attempted
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @return VDO_SUCCESS or an error
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
typedef int VDODecoder(VDO *vdo, bool validateConfig);
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Load a VDO for normal operation. This method must not be called from a base
|
|
Packit Service |
b3514a |
* thread.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param vdo The VDO to load
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @return VDO_SUCCESS or an error
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
int performVDOLoad(VDO *vdo)
|
|
Packit Service |
b3514a |
__attribute__((warn_unused_result));
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Perpare a VDO for loading by reading structures off disk. This method does
|
|
Packit Service |
b3514a |
* not alter the on-disk state. It should be called from the VDO constructor,
|
|
Packit Service |
b3514a |
* whereas performVDOLoad() will be called during pre-resume if the VDO has
|
|
Packit Service |
b3514a |
* not been resumed before.
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
int prepareToLoadVDO(VDO *vdo, const VDOLoadConfig *loadConfig)
|
|
Packit Service |
b3514a |
__attribute__((warn_unused_result));
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Synchronously load a VDO from a specified super block location for use by
|
|
Packit Service |
b3514a |
* user-space tools.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param [in] layer The physical layer the VDO sits on
|
|
Packit Service |
b3514a |
* @param [in] geometry A pointer to the geometry for the volume
|
|
Packit Service |
b3514a |
* @param [in] validateConfig Whether to validate the VDO against the layer
|
|
Packit Service |
b3514a |
* @param [in] decoder The VDO decoder to use, if NULL, the default
|
|
Packit Service |
b3514a |
* decoder will be used
|
|
Packit Service |
b3514a |
* @param [out] vdoPtr A pointer to hold the decoded VDO
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @return VDO_SUCCESS or an error
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
int loadVDOSuperblock(PhysicalLayer *layer,
|
|
Packit Service |
b3514a |
VolumeGeometry *geometry,
|
|
Packit Service |
b3514a |
bool validateConfig,
|
|
Packit Service |
b3514a |
VDODecoder *decoder,
|
|
Packit Service |
b3514a |
VDO **vdoPtr)
|
|
Packit Service |
b3514a |
__attribute__((warn_unused_result));
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Synchronously load a VDO volume for use by user-space tools.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param [in] layer The physical layer the VDO sits on
|
|
Packit Service |
b3514a |
* @param [in] validateConfig Whether to validate the VDO against the layer
|
|
Packit Service |
b3514a |
* @param [in] decoder The VDO decoder to use, if NULL, the default
|
|
Packit Service |
b3514a |
* decoder will be used
|
|
Packit Service |
b3514a |
* @param [out] vdoPtr A pointer to hold the decoded VDO
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @return VDO_SUCCESS or an error
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
int loadVDO(PhysicalLayer *layer,
|
|
Packit Service |
b3514a |
bool validateConfig,
|
|
Packit Service |
b3514a |
VDODecoder *decoder,
|
|
Packit Service |
b3514a |
VDO **vdoPtr)
|
|
Packit Service |
b3514a |
__attribute__((warn_unused_result));
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
#endif /* VDO_LOAD_H */
|