📄 pc_locks.c
字号:
*
* OUTPUTS
*
* None.
*
*************************************************************************/
VOID pc_wait_lock(WAIT_HANDLE_TYPE wait_handle) /*__fn__*/
{
UNSIGNED current_events;
UNSIGNED events;
events =(UNSIGNED) ~0;
/* First release the File system semaphore */
fs_release();
/* Now block waiting for an evbent on the channel */
NU_Retrieve_Events(&NUFP_Events[wait_handle], events,
NU_OR_CONSUME, ¤t_events, NU_SUSPEND);
/* Now reclaim the file system semaphore */
fs_reclaim();
}
/************************************************************************
* FUNCTION
*
* pc_wake_lock
*
* DESCRIPTION
*
* Decrement the semaphore at lock_handle. If any callers to
* pc_wake_lock(handle, YES) are waiting on the semaphore they will
* wake up if the sem count drops to zero.
*
* AUTHOR
*
* Takahiro Takahashi
*
* INPUTS
*
* wait_handle Event group number
*
* OUTPUTS
*
* None.
*
*************************************************************************/
VOID pc_wake_lock(WAIT_HANDLE_TYPE wait_handle) /*__fn__*/
{
/* Signal tasks waiting in wait_lock */
NU_Set_Events(&NUFP_Events[wait_handle],
(UNSIGNED) ~0, NU_OR);
}
/* Fine grained multitasking control routines */
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!! These routines are portable !!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*/
extern _PC_BDEVSW pc_bdevsw[];
/************************************************************************
* FUNCTION
*
* pc_drive_enter
*
* DESCRIPTION
*
* The file manager is entering code which will touch the drive at
* driveno.If exclusive is true we must wait until the the drive is
* unused by any other process. If the drive is being used
* exclusively by another process we must wait for the other
* process to release it.
*
* AUTHOR
*
* Takahiro Takahashi
*
* INPUTS
*
* driveno Drive number
* exclusive If exclusive is YES wait for
* access and lock the drive.
*
* OUTPUTS
*
* None.
*
*************************************************************************/
VOID pc_drive_enter(INT16 driveno, INT exclusive) /*__fn__*/
{
extern LOCKOBJ drive_locks[];
pc_generic_enter(&drive_locks[driveno], exclusive);
}
/************************************************************************
* FUNCTION
*
* pc_drive_exit
*
* DESCRIPTION
*
* The file manager is leaving code which touched the drive at
* driveno. Makes sure any process waiting for drive is awake.
*
* AUTHOR
*
* Takahiro Takahashi
*
* INPUTS
*
* driveno Drive number
*
* OUTPUTS
*
* None.
*
*************************************************************************/
VOID pc_drive_exit(INT16 driveno) /*__fn__*/
{
extern LOCKOBJ drive_locks[];
pc_generic_exit(&drive_locks[driveno]);
}
/************************************************************************
* FUNCTION
*
* pc_inode_enter
*
* DESCRIPTION
*
* The file system will be touching the file or directory at pinode
* If exclusive is true the file or directory will modified and
* must be locked. Otherwise we wait until no-one else has
* exclusive access and increase the open count.
*
* AUTHOR
*
* Takahiro Takahashi
*
* INPUTS
*
* *pinode File directory entry
* exclusive If exclusive is YES lock the
* finode.
*
* OUTPUTS
*
* None.
*
*************************************************************************/
VOID pc_inode_enter(FINODE *pinode, INT exclusive) /*__fn__*/
{
pc_generic_enter(&pinode->lock_object, exclusive);
}
/************************************************************************
* FUNCTION
*
* pc_inode_exit
*
* DESCRIPTION
*
* The directory entry at pinode is not being used. Wake up anyone
* who might be waiting for it.
*
* AUTHOR
*
* Takahiro Takahashi
*
* INPUTS
*
* *pinode File directory entry
*
* OUTPUTS
*
* None.
*
*************************************************************************/
VOID pc_inode_exit(FINODE *pinode) /*__fn__*/
{
pc_generic_exit(&pinode->lock_object);
}
/************************************************************************
* FUNCTION
*
* pc_fat_enter
*
* DESCRIPTION
*
* The file manager is entering code which will touch the FAT at
* driveno. Wait until the the FAT is unused by any other process.
* And then claim it for the operation to be performed.
*
* AUTHOR
*
* Takahiro Takahashi
*
* INPUTS
*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -