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