⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dirnode.h

📁 zilog的实时操作系统RZK,可以移植到多种处理器上
💻 H
字号:
/*
 * File       : dirnode.h
 * Description: This file contains the implementation of replicating the directory structure
 *                 in RAM and other supportive functions
 * 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 
 */

#ifndef _DIRNODE_H_
#define _DIRNODE_H_

#include "zfstypes.h"
#include "zfsdef.h"


// macro definitions
#define FREE_DIR_NODE			(0x00)
#define ALLOC_DIR_NODE			(0x7A)

struct zfs_dir_list_t {
	INT8			dir_name[ ZFS_MAX_FILE_NAME_SIZE + 1 ] ;
	UINT8			status ;
	ZFS_SEC_ID_t	sec_num ;
	UINT8			fd_cnt ;		// file and directory count, 0xFE is the last valid number. > 0xFE open/mkdir should return error
	struct zfs_dir_list_t	*up_list ;	// up pointer will point to the parent directory (manager)
	struct zfs_dir_list_t	*down_list ;	// down pointer will point to the first sub-directory in the current directory (sub-ordinate)
	struct zfs_dir_list_t	*next_list ;	// next pointer will point to the next directory (next peer) 
	struct zfs_dir_list_t	*prev_list ;	// prev pointer will point to the previous directory (prev peer) 

	// These members hold the data when retrieving the files from a flash volume 
	void *tmp_fir_addr ;
	void *tmp_sec_id ;
} ;

typedef struct zfs_dir_list_t ZFS_DIR_LIST_t, * PZFS_DIR_LIST_t ;

// extern global function
//extern ZFS_DIR_LIST_CB_t   g_dir_list[ ] ;
//extern ZFS_DIR_LIST_t g_dir_list[ ] ;

// supportive functions

//Function Name: AddSubDirName
//Description:This function will add a subdirectory node to the parent node.
//
INT8 AddSubDirNode( IN PZFS_DIR_LIST_t parent_node, IN PZFS_DIR_LIST_t child_node ) ;

//Function Name: GetNodeForPath
//Description: This function will search for the directory path in the directory
// tree and returns the node of the directory if found.
PZFS_DIR_LIST_t GetNodeForPath( IN PZFS_DIR_LIST_t node, IN INT8 * path, IN UINT len ) ;

PZFS_DIR_LIST_t GetNodeForDir( IN PZFS_DIR_LIST_t node, IN INT8 * dir_name, IN UINT len ) ;

PZFS_DIR_LIST_t GetNodeFromCurrentDirNode( IN PZFS_DIR_LIST_t node, IN INT8 * dir_name, IN UINT len ) ;

//Function: RemoveDirNode
//Description: This function will remove the node and decrements the directory count in the parent node
// by 1
INT8 RemoveDirNode( IN PZFS_DIR_LIST_t node ) ;

//Function: AllocDirNode
//Description: This function will search through the static directory array for a free node. If
// free node is found, it allocates it and returns the address to it. 
PZFS_DIR_LIST_t AllocDirNode( void ) ;

//Function: IsDirPresentInPath
//Description: This function will search the node in the path. If found returns ZFS_TRUE or else returns ZFS_FALSE
INT8 IsDirPresentinPath( IN PZFS_DIR_LIST_t psrc_node, IN PZFS_DIR_LIST_t node_to_search ) ;

//Function: IsEmptyDir
//Description: This function will check whether the directory is empty or not. if empty, returns ZFS_TRUE
// else returns ZFS_FALSE
INT8 IsEmptyDir( IN PZFS_DIR_LIST_t pdir_node ) ;

//Function: GetLastFileDirNameOff
//Description: This function will get the index of the last valid file or dir name present in the path.
UINT GetLastFileDirNameOff( IN INT8 *dir_file_path ) ;


//Function: IsAbsPath
//Description: This function will check the path and returns the root node of the volume if found else
// returns NULL.
//UINT8 IsAbsPath( IN INT8 * path, OUT void * pvol, OUT UINT *off, OUT PZFS_DIR_LIST_t *dir_node ) ;
//UINT8 IsAbsPath( IN INT8 * path, OUT PZFS_VOL_INFO_t *pvol, OUT UINT *off, OUT PZFS_DIR_LIST_t *dir_node ) ;

#endif // _DIRNODE_H_




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -