|
Packit Service |
310c69 |
/*
|
|
Packit Service |
310c69 |
* Copyright (c) 2020 Red Hat, Inc.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* This program is free software; you can redistribute it and/or
|
|
Packit Service |
310c69 |
* modify it under the terms of the GNU General Public License
|
|
Packit Service |
310c69 |
* as published by the Free Software Foundation; either version 2
|
|
Packit Service |
310c69 |
* of the License, or (at your option) any later version.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* This program is distributed in the hope that it will be useful,
|
|
Packit Service |
310c69 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
310c69 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
310c69 |
* GNU General Public License for more details.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* You should have received a copy of the GNU General Public License
|
|
Packit Service |
310c69 |
* along with this program; if not, write to the Free Software
|
|
Packit Service |
310c69 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
Packit Service |
310c69 |
* 02110-1301, USA.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* $Id: //eng/vdo-releases/aluminum/src/c++/vdo/base/referenceOperation.c#1 $
|
|
Packit Service |
310c69 |
*/
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
#include "referenceOperation.h"
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
#include "physicalZone.h"
|
|
Packit Service |
310c69 |
#include "types.h"
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**********************************************************************/
|
|
Packit Service |
310c69 |
static PBNLock *returnPBNLock(ReferenceOperation operation)
|
|
Packit Service |
310c69 |
{
|
|
Packit Service |
310c69 |
return (PBNLock *) operation.context;
|
|
Packit Service |
310c69 |
}
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**********************************************************************/
|
|
Packit Service |
310c69 |
void setUpReferenceOperationWithLock(JournalOperation type,
|
|
Packit Service |
310c69 |
PhysicalBlockNumber pbn,
|
|
Packit Service |
310c69 |
BlockMappingState state,
|
|
Packit Service |
310c69 |
PBNLock *lock,
|
|
Packit Service |
310c69 |
ReferenceOperation *operation)
|
|
Packit Service |
310c69 |
{
|
|
Packit Service |
310c69 |
*operation = (ReferenceOperation) {
|
|
Packit Service |
310c69 |
.type = type,
|
|
Packit Service |
310c69 |
.pbn = pbn,
|
|
Packit Service |
310c69 |
.state = state,
|
|
Packit Service |
310c69 |
.lockGetter = returnPBNLock,
|
|
Packit Service |
310c69 |
.context = lock,
|
|
Packit Service |
310c69 |
};
|
|
Packit Service |
310c69 |
}
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**********************************************************************/
|
|
Packit Service |
310c69 |
static PBNLock *lookUpPBNLock(ReferenceOperation operation)
|
|
Packit Service |
310c69 |
{
|
|
Packit Service |
310c69 |
return ((operation.context == NULL)
|
|
Packit Service |
310c69 |
? NULL : getPBNLock(operation.context, operation.pbn));
|
|
Packit Service |
310c69 |
}
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**********************************************************************/
|
|
Packit Service |
310c69 |
void setUpReferenceOperationWithZone(JournalOperation type,
|
|
Packit Service |
310c69 |
PhysicalBlockNumber pbn,
|
|
Packit Service |
310c69 |
BlockMappingState state,
|
|
Packit Service |
310c69 |
PhysicalZone *zone,
|
|
Packit Service |
310c69 |
ReferenceOperation *operation)
|
|
Packit Service |
310c69 |
{
|
|
Packit Service |
310c69 |
*operation = (ReferenceOperation) {
|
|
Packit Service |
310c69 |
.type = type,
|
|
Packit Service |
310c69 |
.pbn = pbn,
|
|
Packit Service |
310c69 |
.state = state,
|
|
Packit Service |
310c69 |
.lockGetter = lookUpPBNLock,
|
|
Packit Service |
310c69 |
.context = zone,
|
|
Packit Service |
310c69 |
};
|
|
Packit Service |
310c69 |
}
|