📄 zfsshutdown.c
字号:
/*
* File : ZFSShutdown.c
* Description: This file contains the implementation of ZFSShutdown API
* Author : Mahadev K C
* Created on : 30-APR-2003
*
* Copyright 2004 ZiLOG Inc. ALL RIGHTS RESERVED.
*
* This file contains unpublished confidential and proprietary information
* of ZiLOG, Inc.
* NO PART OF THIS WORK MAY BE DUPLICATED, STORED, PUBLISHED OR DISCLOSED
* IN ANY FORM WITHOUT THE PRIOR WRITTEN CONSENT OF ZiLOG, INC.
* This is not a license and no use of any kind of this work is authorized
* in the absence of a written license granted by ZiLOG, Inc. in ZiLOG's
* sole discretion
*/
#include "ZSysgen.h"
#include "ZTypes.h"
#include "ZThread.h"
#include "ZSemaphore.h"
#include "glextern.h"
extern RZK_SEMAPHOREHANDLE_t hSem_FS;
//Function Name: ZFSShutdown
//Decription: This API shuts down the ZFS.
// the arguments
ZFS_STATUS_t ZFSShutdown( void )
{
UINT cnt = 0 ;
// if already shutdown, return error.
if( !IsZFSInited())
return ZFSERR_ALREADY_SHUTDOWN ;
// check whether any operation is taking place by checking the OR entry.
RZKAcquireSemaphore(hSem_FS,INFINITE_SUSPEND);
// preempt_status = DisablePreemption();
for(cnt = 0 ; cnt < g_max_or_entries; cnt++ )
{
if( g_zfs_or[cnt].status == ZFS_OR_MAGIC_NUM )
{
// some operation is taking place, just return an error.
RZKReleaseSemaphore(hSem_FS);
// EnablePreemption(preempt_status);
return ZFSERR_FS_BUSY ;
}
}
// close the drivers
for( cnt = 0 ; cnt < g_max_volumes ; cnt++ )
{
g_zfs_cfg[cnt].pfn_drv_close() ;
}
// now shutdown the file system.
g_zfs_init = ZFS_FALSE ;
//TBD - minor
// write the TB' blk header to write grace shutdown of the system for both internal as well external flash.
RZKReleaseSemaphore(hSem_FS);
// EnablePreemption(preempt_status);
return ZFSERR_SUCCESS ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -