|
Packit Service |
75d76b |
/*
|
|
Packit Service |
75d76b |
* Copyright (c) 2020 Red Hat, Inc.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* This program is free software; you can redistribute it and/or
|
|
Packit Service |
75d76b |
* modify it under the terms of the GNU General Public License
|
|
Packit Service |
75d76b |
* as published by the Free Software Foundation; either version 2
|
|
Packit Service |
75d76b |
* of the License, or (at your option) any later version.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* This program is distributed in the hope that it will be useful,
|
|
Packit Service |
75d76b |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
75d76b |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
75d76b |
* GNU General Public License for more details.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* You should have received a copy of the GNU General Public License
|
|
Packit Service |
75d76b |
* along with this program; if not, write to the Free Software
|
|
Packit Service |
75d76b |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
Packit Service |
75d76b |
* 02110-1301, USA.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* $Id: //eng/vdo-releases/aluminum/src/c++/vdo/kernel/threadDevice.h#1 $
|
|
Packit Service |
75d76b |
*/
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
#include "kernelLayer.h"
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Temporarily register the current thread as being associated with a
|
|
Packit Service |
75d76b |
* VDO device id number, for logging purposes.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* Any such registered thread must later be unregistered via
|
|
Packit Service |
75d76b |
* unregisterThreadDeviceID.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* The pointed-to ID number should be nonzero.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param newThread RegisteredThread structure to use for the current thread
|
|
Packit Service |
75d76b |
* @param idPtr Location where the ID number is stored
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
void registerThreadDeviceID(RegisteredThread *newThread, unsigned int *idPtr);
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Temporarily register the current thread as being associated with an
|
|
Packit Service |
75d76b |
* existing VDO device, for logging purposes.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* Any such registered thread must later be unregistered via
|
|
Packit Service |
75d76b |
* unregisterThreadDeviceID.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param newThread RegisteredThread structure to use for the current thread
|
|
Packit Service |
75d76b |
* @param layer The KernelLayer object for the VDO device
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
static inline void registerThreadDevice(RegisteredThread *newThread,
|
|
Packit Service |
75d76b |
KernelLayer *layer)
|
|
Packit Service |
75d76b |
{
|
|
Packit Service |
75d76b |
registerThreadDeviceID(newThread, &layer->instance);
|
|
Packit Service |
75d76b |
}
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Cancel registration of the current thread as being associated with
|
|
Packit Service |
75d76b |
* a VDO device or device ID number.
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
void unregisterThreadDeviceID(void);
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Get the VDO device ID number temporarily associated with the
|
|
Packit Service |
75d76b |
* current thread, if any.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @return the device ID number, if any, or -1
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
int getThreadDeviceID(void);
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Initialize the thread device-ID registry.
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
void initializeThreadDeviceRegistry(void);
|