lib: sw_services: Update copyright
This patch updates the copyright for the following libraries: xilffs xilflash xilisf xilmfs xilrsa xilskey Signed-off-by: Harini Katakam <harinik@xilinx.com> Acked-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
This commit is contained in:
parent
4a572e90ae
commit
c97a9104c7
14 changed files with 500 additions and 439 deletions
|
@ -1,6 +1,34 @@
|
|||
###########################################################
|
||||
# Copyright (c) 2004 Xilinx, Inc. All Rights Reserved.
|
||||
###########################################################
|
||||
###############################################################################
|
||||
#
|
||||
# Copyright (C) 2004 - 2014 Xilinx, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# Use of the Software is limited solely to applications:
|
||||
# (a) running on a Xilinx device, or
|
||||
# (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
# in advertising or otherwise to promote the sale, use or other dealings in
|
||||
# this Software without prior written authorization from Xilinx.
|
||||
#
|
||||
###############################################################################
|
||||
OPTION psf_version = 2.1.0 ;
|
||||
|
||||
BEGIN LIBRARY xilmfs
|
||||
|
|
|
@ -1,25 +1,34 @@
|
|||
###############################################################################
|
||||
#
|
||||
# Copyright (C) 2004 - 2014 Xilinx, Inc. All rights reserved.
|
||||
#
|
||||
# XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"
|
||||
# AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND
|
||||
# SOLUTIONS FOR XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE,
|
||||
# OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,
|
||||
# APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION
|
||||
# THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,
|
||||
# AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE
|
||||
# FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY
|
||||
# WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE
|
||||
# IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR
|
||||
# REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF
|
||||
# INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE.
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# (c) Copyright 2002 Xilinx Inc.
|
||||
# All rights reserved.
|
||||
|
||||
# $Id: xilmfs_v2_1_0.tcl,v 1.3.16.6 2005/11/15 23:41:09 salindac Exp $
|
||||
#
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# Use of the Software is limited solely to applications:
|
||||
# (a) running on a Xilinx device, or
|
||||
# (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
# in advertising or otherwise to promote the sale, use or other dealings in
|
||||
# this Software without prior written authorization from Xilinx.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
proc mfs_drc {lib_handle} {
|
||||
puts "MFS DRC ..."
|
||||
|
|
|
@ -1,28 +1,34 @@
|
|||
####################################/-*-Makefile-*-
|
||||
###############################################################################
|
||||
#
|
||||
# Copyright (c) 2002 Xilinx, Inc. All rights reserved.
|
||||
# Copyright (C) 2002 - 2014 Xilinx, Inc. All rights reserved.
|
||||
#
|
||||
# Xilinx, Inc.
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
|
||||
# COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
|
||||
# ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
|
||||
# STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
|
||||
# IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
|
||||
# FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
|
||||
# XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
|
||||
# THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
|
||||
# ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
|
||||
# FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
###########################
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# Makefile for libXilMFS
|
||||
# Use of the Software is limited solely to applications:
|
||||
# (a) running on a Xilinx device, or
|
||||
# (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
#
|
||||
# $Id: Makefile,v 1.6.16.7 2010/09/30 02:08:37 jece Exp $
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
##########################
|
||||
# Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
# in advertising or otherwise to promote the sale, use or other dealings in
|
||||
# this Software without prior written authorization from Xilinx.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
COMPILER=
|
||||
ARCHIVER=
|
||||
|
|
|
@ -1,40 +1,45 @@
|
|||
/////////////////////////////////////////////////////////////////////////-*-C-*-
|
||||
//
|
||||
// Copyright (c) 2002, 2003 Xilinx, Inc. All rights reserved.
|
||||
//
|
||||
// Xilinx, Inc.
|
||||
//
|
||||
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
|
||||
// COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
|
||||
// ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
|
||||
// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
|
||||
// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
|
||||
// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
|
||||
// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
|
||||
// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
|
||||
// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
|
||||
// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// File : mfs_filesys.c
|
||||
//
|
||||
// Description :
|
||||
// Memory File System for EDK
|
||||
//
|
||||
// $Id: mfs_filesys.c,v 1.9.8.8 2008/10/29 16:59:56 vasanth Exp $
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2002 - 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include "xilmfs.h"
|
||||
/** Global data for file system and open files
|
||||
* There can be only one MFS file system because of these globals
|
||||
* If you ever need multiple instances of the MFS file system
|
||||
* encapsulate these globals in a struct,
|
||||
* encapsulate these globals in a struct,
|
||||
* and replace all instances of these globals with members of the new struct
|
||||
* and pass a pointer to an instance of this struct to every function
|
||||
* that uses these globals
|
||||
*/
|
||||
*/
|
||||
/* file system data */
|
||||
struct mfs_file_block* mfs_file_system; /* file system blocks allocated or reserved before calling mfs_init */
|
||||
int mfs_max_file_blocks; /* max number of blocks available - parameter to mfs_init */
|
||||
|
@ -46,20 +51,20 @@ int mfs_current_dir; /* index of current directory block */
|
|||
|
||||
/**
|
||||
* initialize the file system;
|
||||
* this function must be called before any file system operations
|
||||
* this function must be called before any file system operations
|
||||
* use mfs_init_genimage instead of this function for initializing with
|
||||
* file images generated by mfsgen
|
||||
* @param numbytes is the number of bytes allocated or reserved for this file system
|
||||
* @param address is the starting address of the memory block
|
||||
* Note: address must be word aligned (4 byte boundary)
|
||||
* @param init_type is one of
|
||||
* @param init_type is one of
|
||||
* MFSINIT_NEW for creating empty read/write filesystem
|
||||
* MFSINIT_IMAGE for creating read/write filesystem with predefined data
|
||||
* MFSINIT_ROM_IMAGE for creating read-only filesystem with predefined data
|
||||
*/
|
||||
void mfs_init_fs(int numbytes, char *address, int init_type) {
|
||||
int i;
|
||||
mfs_max_file_blocks = numbytes/sizeof(struct mfs_file_block);
|
||||
mfs_max_file_blocks = numbytes/sizeof(struct mfs_file_block);
|
||||
mfs_file_system = (struct mfs_file_block *)address;
|
||||
if (init_type == MFSINIT_NEW) {
|
||||
/* set the zeroth block to be a dir_block with itself as its parent */
|
||||
|
@ -91,7 +96,7 @@ else if (init_type == MFSINIT_IMAGE) {
|
|||
i = 0;
|
||||
while (mfs_file_system[i].block_type != MFS_BLOCK_TYPE_EMPTY) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
/* initialize free block list to the first free index = 1 */
|
||||
mfs_free_block_list = i;
|
||||
}
|
||||
|
@ -110,22 +115,22 @@ else { // (init_type == MFSINIT_ROM_IMAGE)
|
|||
|
||||
/**
|
||||
* initialize the file system with a file image generated by mfsgen;
|
||||
* this function must be called before any file system operations
|
||||
* use mfs_init_fs instead of this function for other initialization
|
||||
* this function must be called before any file system operations
|
||||
* use mfs_init_fs instead of this function for other initialization
|
||||
* @param numbytes is the number of bytes allocated or reserved for this file system
|
||||
* @param address is the starting address of the memory block
|
||||
* Note: address must be word aligned (4 byte boundary)
|
||||
* @param init_type is one of
|
||||
* @param init_type is one of
|
||||
* MFSINIT_IMAGE for creating read/write filesystem with predefined data
|
||||
* MFSINIT_ROM_IMAGE for creating read-only filesystem with predefined data
|
||||
*/
|
||||
void mfs_init_genimage(int numbytes, char *address, int init_type) {
|
||||
/* mfsgen generates a file image that contains 4 bytes identifying
|
||||
* the file type as mfs2 or MFS2, followed by the file system blocks.
|
||||
* So the number of bytes is 4 more than the number of bytes in the
|
||||
* file system itself, and the start address of the file system blocks
|
||||
* is the given address plus 4.
|
||||
* Use these new values to call the mfs_init_fs function to do
|
||||
/* mfsgen generates a file image that contains 4 bytes identifying
|
||||
* the file type as mfs2 or MFS2, followed by the file system blocks.
|
||||
* So the number of bytes is 4 more than the number of bytes in the
|
||||
* file system itself, and the start address of the file system blocks
|
||||
* is the given address plus 4.
|
||||
* Use these new values to call the mfs_init_fs function to do
|
||||
* the actual work
|
||||
*/
|
||||
mfs_init_fs(numbytes-4, address+4, init_type);
|
||||
|
@ -135,7 +140,7 @@ void mfs_init_genimage(int numbytes, char *address, int init_type) {
|
|||
/**
|
||||
* Given a filename, get the directory block and the directory index within
|
||||
* that block that correspond to the entry for this filename
|
||||
* @param filename
|
||||
* @param filename
|
||||
* @param dir_block is a pointer to the block that is found
|
||||
* @param dir_index is a pointer to the index within the block that is found
|
||||
* @return 0 for failure and 1 for success
|
||||
|
@ -143,13 +148,13 @@ void mfs_init_genimage(int numbytes, char *address, int init_type) {
|
|||
* return dir_block = index of dir block (may not always be mfs_current_dir)
|
||||
* return dir_index = index within dir_block or undefined on failure
|
||||
* on failure:
|
||||
* return dir_block = index of dir block that has the first "free entry" or
|
||||
* return dir_block = index of dir block that has the first "free entry" or
|
||||
* index of last searched block which should have no free entries or
|
||||
* -1 to indicate error
|
||||
* return dir_index = index within dir_block of first free entry or
|
||||
* return dir_index = index within dir_block of first free entry or
|
||||
* MFS_MAX_LOCAL_ENT if last searched block has no free entry or
|
||||
* -1 to indicate error
|
||||
*
|
||||
*
|
||||
*/
|
||||
static int get_dir_ent_base(const char *filename, int *dir_block, int *dir_index, int *reuse_block, int *reuse_index) {
|
||||
/* *dir_index = 0; *dir_block = valid dir corresponding to filename prefixes processed so far, on entry to this proc */
|
||||
|
@ -158,9 +163,9 @@ static int get_dir_ent_base(const char *filename, int *dir_block, int *dir_inde
|
|||
int index = 0;
|
||||
int basename = 0;
|
||||
int looking_for_reuse = 0;
|
||||
|
||||
|
||||
while(*filename != '/' && *filename != '\0') {
|
||||
tmpfilename[index] = *filename;
|
||||
tmpfilename[index] = *filename;
|
||||
filename++;
|
||||
index++;
|
||||
}
|
||||
|
@ -175,7 +180,7 @@ static int get_dir_ent_base(const char *filename, int *dir_block, int *dir_inde
|
|||
*dir_block = mfs_file_system[*dir_block].next_block;
|
||||
}
|
||||
if (mfs_file_system[*dir_block].u.dir_data.dir_ent[*dir_index].deleted != 'y' &&
|
||||
!strcmp(mfs_file_system[*dir_block].u.dir_data.dir_ent[*dir_index].name,
|
||||
!strcmp(mfs_file_system[*dir_block].u.dir_data.dir_ent[*dir_index].name,
|
||||
tmpfilename)) { /* found the entry */
|
||||
/* *dir_index = index; */
|
||||
/* *dir_block = dir; */
|
||||
|
@ -187,7 +192,7 @@ static int get_dir_ent_base(const char *filename, int *dir_block, int *dir_inde
|
|||
filename++;
|
||||
return(get_dir_ent_base(filename, dir_block, dir_index, reuse_block, reuse_index));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if ((looking_for_reuse == 1) && (mfs_file_system[*dir_block].u.dir_data.dir_ent[*dir_index].deleted == 'y') && (basename == 1)) {
|
||||
/* found a possible reuse block */
|
||||
|
@ -208,7 +213,7 @@ static int get_dir_ent_base(const char *filename, int *dir_block, int *dir_inde
|
|||
}
|
||||
}
|
||||
/**
|
||||
* filename is an arbitrarily long '/' separated path name
|
||||
* filename is an arbitrarily long '/' separated path name
|
||||
* each component of the path name is never longer than MFS_MAX_FILENAME_LENGTH
|
||||
* if the first character is '/', search starting at the root directory
|
||||
* else search starting at the current directory
|
||||
|
@ -217,13 +222,13 @@ static int get_dir_ent_base(const char *filename, int *dir_block, int *dir_inde
|
|||
* return dir_block = index of dir block (may not always be mfs_current_dir)
|
||||
* return dir_index = index within dir_block or undefined on failure
|
||||
* on failure:
|
||||
* return dir_block = index of dir block that has the first "free entry" or
|
||||
* return dir_block = index of dir block that has the first "free entry" or
|
||||
* index of last searched block which should have no free entries or
|
||||
* -1 to indicate error
|
||||
* return dir_index = index within dir_block of first free entry or
|
||||
* return dir_index = index within dir_block of first free entry or
|
||||
* MFS_MAX_LOCAL_ENT if last searched block has no free entry or
|
||||
* -1 to indicate error
|
||||
*
|
||||
*
|
||||
*/
|
||||
static int get_dir_ent(const char *filename, int *dir_block, int *dir_index, int *reuse_block, int *reuse_index) {
|
||||
if (filename != NULL && *filename != '\0') {
|
||||
|
@ -256,8 +261,8 @@ static int get_dir_ent(const char *filename, int *dir_block, int *dir_index, in
|
|||
* return dir_block = index of dir block (may not always be mfs_current_dir)
|
||||
* return dir_index = index within dir_block or undefined on failure
|
||||
* on failure:
|
||||
* return dir_block = index of dir block that has the first "free entry" or
|
||||
* index of last searched block which should have no free entries
|
||||
* return dir_block = index of dir block that has the first "free entry" or
|
||||
* index of last searched block which should have no free entries
|
||||
* return dir_index = index within dir_block of first free entry or MFS_MAX_LOCAL_ENT if last searched block has no free entry
|
||||
*/
|
||||
static int get_dir_ent_by_index(int file_index, int *dir_block, int *dir_index) {
|
||||
|
@ -268,14 +273,14 @@ static int get_dir_ent_by_index(int file_index, int *dir_block, int *dir_index)
|
|||
numentriesleft = mfs_file_system[*dir_block].u.dir_data.num_entries;
|
||||
|
||||
*dir_index = 0;
|
||||
|
||||
|
||||
while (numentriesleft > 0) {
|
||||
|
||||
if (*dir_index == MFS_MAX_LOCAL_ENT) { /* move to the next dir block */
|
||||
*dir_index = 0;
|
||||
*dir_block = mfs_file_system[*dir_block].next_block;
|
||||
}
|
||||
|
||||
|
||||
if (mfs_file_system[*dir_block].u.dir_data.dir_ent[*dir_index].deleted != 'y' &&
|
||||
mfs_file_system[*dir_block].u.dir_data.dir_ent[*dir_index].index == file_index) { /* found the entry */
|
||||
/* *dir_index = index; */
|
||||
|
@ -289,7 +294,7 @@ static int get_dir_ent_by_index(int file_index, int *dir_block, int *dir_index)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* modify global mfs_current_dir to index of newdir if it exists
|
||||
* mfs_current_dir is not modified otherwise
|
||||
* @param newdir is the name of the new directory
|
||||
|
@ -335,8 +340,8 @@ static int get_next_free_block(int *new_entry_index) {
|
|||
}
|
||||
|
||||
/**
|
||||
* create a new directory block, and initialize it with info about . and ..
|
||||
* if this dir wants to know its name, it needs to ask its parent
|
||||
* create a new directory block, and initialize it with info about . and ..
|
||||
* if this dir wants to know its name, it needs to ask its parent
|
||||
* @param file_type is either MFS_BLOCK_TYPE_DIR or MFS_BLOCK_TYPE_FILE
|
||||
* @param new_entry_index is a pointer to the index of the newly allocated block for the new file
|
||||
* @param parent_dir_block is the index of the parent directory of the new file/dir
|
||||
|
@ -375,14 +380,14 @@ static int create_new_file(int file_type, int *new_entry_index, int parent_dir_b
|
|||
* @param filename is the input file name; this is not modified by the function
|
||||
* @return pointer to the base name portion of filename
|
||||
* return a pointer to the first char that follows the last '/' in filename
|
||||
* unless the last char in filename is a '/', in which case return a pointer
|
||||
* unless the last char in filename is a '/', in which case return a pointer
|
||||
* to the first char that follows the previous '/'
|
||||
* if there is no '/' in filename, return filename itself
|
||||
*/
|
||||
|
||||
static char *get_basename(const char *filename) {
|
||||
char *base_filename = (char*)filename;
|
||||
|
||||
|
||||
while(*filename != '\0') {
|
||||
if (*filename == '/') {
|
||||
filename++;
|
||||
|
@ -420,7 +425,7 @@ static int set_filename(char *to_name, char *from_name) {
|
|||
* get the first directory block corresponding to "this" directory block
|
||||
* the first directory block contains info about the number of files in the dir
|
||||
* @param dir_block is the index of "this" directory block
|
||||
* @return the index of the first directory block
|
||||
* @return the index of the first directory block
|
||||
*/
|
||||
static int get_first_dir_block(int dir_block) {
|
||||
while (mfs_file_system[dir_block].prev_block != 0) {
|
||||
|
@ -437,8 +442,8 @@ static int get_first_dir_block(int dir_block) {
|
|||
* Create a new file or dir named filename
|
||||
* If a dir or file of the same name exists, return 0
|
||||
* If there is no space on the file system to create file, return 0
|
||||
* else create the new file or dir, add entry in current dir table
|
||||
* and return index of first block of file or dir
|
||||
* else create the new file or dir, add entry in current dir table
|
||||
* and return index of first block of file or dir
|
||||
* @param filename is name of file to create
|
||||
* @param file_type is either MFS_BLOCK_TYPE_DIR (for directory) or MFS_BLOCK_TYPE_FILE (for a regular file)
|
||||
* @return 1 for success and 0 for failure
|
||||
|
@ -453,7 +458,7 @@ static int create_file(const char *filename, int file_type) {
|
|||
int reuse_index = -1;
|
||||
int reusing = 0;
|
||||
|
||||
if (get_dir_ent(filename, &new_dir_block, &new_dir_index, &reuse_block, &reuse_index)) {
|
||||
if (get_dir_ent(filename, &new_dir_block, &new_dir_index, &reuse_block, &reuse_index)) {
|
||||
/* file already exists */
|
||||
return 0 ; /* cannot create file if it already exists */
|
||||
}
|
||||
|
@ -470,10 +475,10 @@ static int create_file(const char *filename, int file_type) {
|
|||
reusing = 1;
|
||||
}
|
||||
else {
|
||||
/* check if the current dir block is full and
|
||||
/* check if the current dir block is full and
|
||||
allocate a new dir block if needed */
|
||||
|
||||
if (new_dir_index == MFS_MAX_LOCAL_ENT) {
|
||||
|
||||
if (new_dir_index == MFS_MAX_LOCAL_ENT) {
|
||||
/* create a new dir block linked from this one */
|
||||
if (get_next_free_block(&new_block)) { /* found a free block */
|
||||
mfs_file_system[new_block].prev_block = new_dir_block;
|
||||
|
@ -490,7 +495,7 @@ static int create_file(const char *filename, int file_type) {
|
|||
}
|
||||
}
|
||||
}
|
||||
/* at this point new_dir_index and new_dir_block both point to
|
||||
/* at this point new_dir_index and new_dir_block both point to
|
||||
the first free entry */
|
||||
first_dir_block = get_first_dir_block(new_dir_block);
|
||||
if (!create_new_file(file_type, &new_entry_index, first_dir_block)) { /* cannot create new file */
|
||||
|
@ -585,7 +590,7 @@ int mfs_delete_file (char *filename) {
|
|||
int reuse_block = -1;
|
||||
int reuse_index = -1;
|
||||
|
||||
if (!get_dir_ent(filename, &dir_block, &dir_index, &reuse_block, &reuse_index)) {
|
||||
if (!get_dir_ent(filename, &dir_block, &dir_index, &reuse_block, &reuse_index)) {
|
||||
/* file does not exist */
|
||||
return 0 ; /* cannot delete file if it does not exist */
|
||||
}
|
||||
|
@ -604,7 +609,7 @@ int mfs_delete_file (char *filename) {
|
|||
/**
|
||||
* create a new empty directory inside the current directory
|
||||
* @param newdir is the name of the directory
|
||||
* @return index of new directory in file system if success, 0 if failure
|
||||
* @return index of new directory in file system if success, 0 if failure
|
||||
*/
|
||||
int mfs_create_dir(char *newdir) {
|
||||
return create_file(newdir, MFS_BLOCK_TYPE_DIR);
|
||||
|
@ -669,7 +674,7 @@ int mfs_exists_file(char *filename) {
|
|||
}
|
||||
|
||||
/**
|
||||
* get the name of the current directory
|
||||
* get the name of the current directory
|
||||
* @param dirname = pre_allocated buffer of at least MFS_MAX_FILENAME_SIZE+1 chars
|
||||
* The directory name is copied to this buffer
|
||||
* @return 1 if success, 0 if failure
|
||||
|
@ -750,13 +755,13 @@ int mfs_dir_close(int fd) {
|
|||
* The last 3 parameters are output values
|
||||
* @param fd is the file descriptor for an open directory file
|
||||
* @param filename is a pointer to the filename within the MFS itself
|
||||
* @param filesize is the size in bytes for a regular file or
|
||||
* @param filesize is the size in bytes for a regular file or
|
||||
* the number of entries in a directory
|
||||
* @param filetype is MFS_BLOCK_TYPE_FILE or MFS_BLOCK_TYPE_DIR
|
||||
* @return 1 for success and 0 for failure or end of dir
|
||||
*/
|
||||
int mfs_dir_read(int fd, char **filename, int *filesize, int *filetype) {
|
||||
int numentriesleft =
|
||||
int numentriesleft =
|
||||
mfs_file_system[mfs_open_files[fd].first_block].u.dir_data.num_entries;
|
||||
int dir_block = mfs_open_files[fd].current_block;
|
||||
int dir_index = mfs_open_files[fd].offset;
|
||||
|
@ -773,20 +778,20 @@ int mfs_dir_read(int fd, char **filename, int *filesize, int *filetype) {
|
|||
dir_block = mfs_file_system[dir_block].next_block;
|
||||
mfs_open_files[fd].current_block = dir_block;
|
||||
}
|
||||
if (mfs_file_system[dir_block].u.dir_data.dir_ent[dir_index].deleted
|
||||
if (mfs_file_system[dir_block].u.dir_data.dir_ent[dir_index].deleted
|
||||
!= 'y' ) {
|
||||
/* found a valid entry */
|
||||
|
||||
*filename =
|
||||
*filename =
|
||||
mfs_file_system[dir_block].u.dir_data.dir_ent[dir_index].name;
|
||||
direntry_block =
|
||||
direntry_block =
|
||||
mfs_file_system[dir_block].u.dir_data.dir_ent[dir_index].index;
|
||||
*filetype = mfs_file_system[direntry_block].block_type;
|
||||
if (*filetype == MFS_BLOCK_TYPE_DIR) {
|
||||
*filesize =
|
||||
mfs_file_system[direntry_block].u.dir_data.num_entries
|
||||
*filesize =
|
||||
mfs_file_system[direntry_block].u.dir_data.num_entries
|
||||
- mfs_file_system[direntry_block].u.dir_data.num_deleted;
|
||||
}
|
||||
}
|
||||
else {
|
||||
*filesize = mfs_file_system[direntry_block].block_size;
|
||||
}
|
||||
|
@ -797,7 +802,7 @@ int mfs_dir_read(int fd, char **filename, int *filesize, int *filetype) {
|
|||
mfs_open_files[fd].offset += 1;
|
||||
numentriesleft--;
|
||||
}
|
||||
|
||||
|
||||
return 0; /* nothing left to read */
|
||||
}
|
||||
|
||||
|
@ -809,7 +814,7 @@ int mfs_dir_read(int fd, char **filename, int *filesize, int *filetype) {
|
|||
* no error checking (is this FILE and not DIR?) is done for MFS_MODE_READ
|
||||
* MFS_MODE_CREATE automatically creates a FILE and not a DIR
|
||||
* MFS_MODE_WRITE fails if the specified file is a DIR
|
||||
* @return index of file in array mfs_open_files or -1
|
||||
* @return index of file in array mfs_open_files or -1
|
||||
*/
|
||||
int mfs_file_open(const char *filename, int mode) {
|
||||
int dir_block;
|
||||
|
@ -892,7 +897,7 @@ int mfs_file_read(int fd, char *buf, int buflen) {
|
|||
mfs_open_files[fd].current_block = next_block;
|
||||
mfs_open_files[fd].offset = 0;
|
||||
}
|
||||
|
||||
|
||||
*buf = *from_ptr;
|
||||
buf++;
|
||||
from_ptr++;
|
||||
|
@ -913,7 +918,7 @@ int mfs_file_read(int fd, char *buf, int buflen) {
|
|||
* buf should be a pointer to a pre-allocated buffer of size buflen or more
|
||||
* buflen chars are read from buf and written to 1 or more blocks of the file
|
||||
* @return 1 for success or 0 for error=unable to write to file
|
||||
*/
|
||||
*/
|
||||
int mfs_file_write (int fd, const char *buf, int buflen) {
|
||||
char *to_ptr = (char *) &(mfs_file_system[mfs_open_files[fd].current_block].u.block_data[mfs_open_files[fd].offset]);
|
||||
int num_left = MFS_BLOCK_DATA_SIZE - mfs_open_files[fd].offset;
|
||||
|
@ -934,7 +939,7 @@ int mfs_file_write (int fd, const char *buf, int buflen) {
|
|||
else { /* no space for new block - return failure */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
to_ptr = (char *) &(mfs_file_system[new_block].u.block_data[0]);
|
||||
num_left = MFS_BLOCK_DATA_SIZE;
|
||||
}
|
||||
|
@ -1017,7 +1022,7 @@ long mfs_file_lseek(int fd, long offset, int whence) {
|
|||
offset += mfs_file_system[mfs_open_files[fd].first_block].block_size;
|
||||
}
|
||||
}
|
||||
/* at this point offset is a positive value, guaranteed to be within the file
|
||||
/* at this point offset is a positive value, guaranteed to be within the file
|
||||
*/
|
||||
local_offset = offset;
|
||||
local_block = mfs_open_files[fd].first_block;
|
||||
|
|
|
@ -1,42 +1,47 @@
|
|||
/////////////////////////////////////////////////////////////////////////-*-C-*-
|
||||
//
|
||||
// Copyright (c) 2002-2004 Xilinx, Inc. All rights reserved.
|
||||
//
|
||||
// Xilinx, Inc.
|
||||
//
|
||||
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
|
||||
// COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
|
||||
// ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
|
||||
// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
|
||||
// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
|
||||
// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
|
||||
// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
|
||||
// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
|
||||
// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
|
||||
// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// File : mfs_filesys_util.c
|
||||
//
|
||||
// Description :
|
||||
// Additional utilities for Memory File System
|
||||
//
|
||||
// $Id: mfs_filesys_util.c,v 1.7.8.8 2007/12/17 17:28:08 velusamy Exp $
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2002 - 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "xilmfs.h"
|
||||
|
||||
/* some redefinitions for host based testing */
|
||||
#ifdef TESTING_XILMFS
|
||||
#define putnum(x) printf("%d ", (x))
|
||||
#define putnum(x) printf("%d ", (x))
|
||||
#define print(x) printf("%s", (x))
|
||||
#define inbyte() fgetc(stdin)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* list contents of current directory
|
||||
* list contents of current directory
|
||||
* @return 1 on success and 0 on failure
|
||||
*/
|
||||
int mfs_ls() {
|
||||
|
@ -46,7 +51,7 @@ int mfs_ls() {
|
|||
/**
|
||||
* recursive directory listing
|
||||
* list the contents of current directory
|
||||
* if any of the entries in the current directory is itself a directory,
|
||||
* if any of the entries in the current directory is itself a directory,
|
||||
* immediately enter that directory and call mfs_ls_r() once again
|
||||
* @param recurse
|
||||
* If parameter recurse is non zero continue recursing
|
||||
|
@ -64,11 +69,11 @@ int mfs_ls_r(int recurse) {
|
|||
char *entry_name;
|
||||
while (mfs_dir_read(fd, &entry_name, &entry_size, &entry_type) != 0) {
|
||||
if (entry_type == MFS_BLOCK_TYPE_DIR) {
|
||||
|
||||
|
||||
if (!(entry_name[0] == '.' && entry_name[1] == '\0') &&
|
||||
!(entry_name[0] == '.' && entry_name[1] == '.' && entry_name[2] == '\0')) {
|
||||
print("Directory ");
|
||||
print(entry_name);
|
||||
print(entry_name);
|
||||
print(" ");
|
||||
putnum(entry_size);
|
||||
print("\r\n");
|
||||
|
@ -130,7 +135,7 @@ int mfs_cat(char *filename) {
|
|||
}
|
||||
|
||||
/* FIXME declare inbyte locally to avoid g++ compilation issues
|
||||
* this should come from a header file if inbyte is ever included in a header
|
||||
* this should come from a header file if inbyte is ever included in a header
|
||||
*/
|
||||
#if !defined(TESTING_XILMFS)
|
||||
char inbyte(void);
|
||||
|
|
|
@ -1,29 +1,34 @@
|
|||
/////////////////////////////////////////////////////////////////////////-*-C-*-
|
||||
//
|
||||
// Copyright (c) 2002, 2003 Xilinx, Inc. All rights reserved.
|
||||
//
|
||||
// Xilinx, Inc.
|
||||
//
|
||||
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
|
||||
// COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
|
||||
// ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
|
||||
// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
|
||||
// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
|
||||
// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
|
||||
// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
|
||||
// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
|
||||
// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
|
||||
// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// Description :
|
||||
// Test program to natively compile and test MFS on a host machine
|
||||
// This program has been compiled and tested using gcc under Cygwin and Solariste
|
||||
// gcc test_mfs_filesys.c mfs_filesys.c mfs_filesys_util.c -o test_mfs_filesys
|
||||
//
|
||||
// $Id: test_mfs_filesys.c,v 1.1.16.7 2010/10/01 18:53:25 jece Exp $
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2002 - 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "xilmfs.h"
|
||||
|
|
|
@ -1,28 +1,34 @@
|
|||
/////////////////////////////////////////////////////////////////////////-*-C-*-
|
||||
//
|
||||
// Copyright (c) 2002, 2003 Xilinx, Inc. All rights reserved.
|
||||
//
|
||||
// Xilinx, Inc.
|
||||
//
|
||||
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
|
||||
// COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
|
||||
// ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
|
||||
// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
|
||||
// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
|
||||
// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
|
||||
// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
|
||||
// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
|
||||
// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
|
||||
// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// Description :
|
||||
// Test program to create a new RAM based file system and use it on a host
|
||||
// gcc $OPTIONS testmfs.c mfs_filesys.c mfs_filesys_util.c -o testmfs
|
||||
//
|
||||
// $Id: testmfs.c,v 1.2.10.7 2010/10/01 18:53:25 jece Exp $
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2002 - 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -38,7 +44,7 @@ int main(int argc, char *argv[]) {
|
|||
char buffer[4];
|
||||
int fd;
|
||||
int i;
|
||||
|
||||
|
||||
numbytes = 1000 *sizeof(struct mfs_file_block);
|
||||
|
||||
fs = (char *)malloc(numbytes);
|
||||
|
@ -134,7 +140,7 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
}
|
||||
fd = mfs_file_open("file7", MFS_MODE_CREATE);
|
||||
for (i =0; i < 5000; i++)
|
||||
for (i =0; i < 5000; i++)
|
||||
mfs_file_write(fd, "e", 1);
|
||||
mfs_file_close(fd);
|
||||
mfs_change_dir("..");
|
||||
|
@ -174,7 +180,7 @@ int main(int argc, char *argv[]) {
|
|||
printf("c (-1) %d\n", c);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,30 +1,34 @@
|
|||
/////////////////////////////////////////////////////////////////////////-*-C-*-
|
||||
//
|
||||
// Copyright (c) 2002, 2003 Xilinx, Inc. All rights reserved.
|
||||
//
|
||||
// Xilinx, Inc.
|
||||
//
|
||||
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
|
||||
// COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
|
||||
// ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
|
||||
// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
|
||||
// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
|
||||
// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
|
||||
// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
|
||||
// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
|
||||
// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
|
||||
// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// Description :
|
||||
// Test program to init and access a read only file system that has
|
||||
// been preloaded into flash
|
||||
//
|
||||
// gcc testmfsflashrom.c mfs_filesys.c mfs_filesys_util.c -o testmfsflashrom
|
||||
//
|
||||
// $Id: testmfsflashrom.c,v 1.1.16.7 2010/10/01 18:53:25 jece Exp $
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2002 - 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include "xilmfs.h"
|
||||
|
||||
|
@ -35,15 +39,15 @@ char *fs = (char *)0x1f800000; /* base address of Flash */
|
|||
/* for big file system */
|
||||
/* #define NUMBLOCKS 200 */
|
||||
/* for small file system */
|
||||
#define NUMBLOCKS 10
|
||||
#define NUMBLOCKS 10
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
int numbytes;
|
||||
|
||||
|
||||
numbytes = NUMBLOCKS *sizeof(struct mfs_file_block);
|
||||
|
||||
mfs_init_fs(numbytes, fs, MFSINIT_ROM_IMAGE);
|
||||
|
||||
|
||||
mfs_ls_r(-1);
|
||||
/* for big file system */
|
||||
/* mfs_cat("xilmfs.h"); */
|
||||
|
@ -52,4 +56,4 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,30 +1,34 @@
|
|||
/////////////////////////////////////////////////////////////////////////-*-C-*-
|
||||
//
|
||||
// Copyright (c) 2002, 2003 Xilinx, Inc. All rights reserved.
|
||||
//
|
||||
// Xilinx, Inc.
|
||||
//
|
||||
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
|
||||
// COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
|
||||
// ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
|
||||
// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
|
||||
// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
|
||||
// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
|
||||
// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
|
||||
// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
|
||||
// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
|
||||
// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// Description :
|
||||
// Test program to init and access a read only file system that has
|
||||
// been preloaded into SRAM
|
||||
//
|
||||
// mb-gcc $OPTIONS testmfsrom.c mfs_filesys.c mfs_filesys_util.c -o testmfsrom
|
||||
//
|
||||
// $Id: testmfsrom.c,v 1.1.16.7 2010/10/01 18:53:25 jece Exp $
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2002 - 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include "xilmfs.h"
|
||||
|
||||
|
@ -38,11 +42,11 @@ char *fs = (char *)0xffe00000; /* base address of SRAM */
|
|||
int main(int argc, char *argv[]) {
|
||||
|
||||
int numbytes;
|
||||
|
||||
|
||||
numbytes = NUMBLOCKS *sizeof(struct mfs_file_block);
|
||||
|
||||
mfs_init_fs(numbytes, fs, MFSINIT_ROM_IMAGE);
|
||||
|
||||
|
||||
mfs_ls_r(-1);
|
||||
mfs_cat("xilmfs.h"); /* assuming there is a file called xilmfs.h in the pre-loaded file system */
|
||||
|
||||
|
@ -50,4 +54,4 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,30 +1,34 @@
|
|||
/////////////////////////////////////////////////////////////////////////-*-C-*-
|
||||
//
|
||||
// Copyright (c) 2002, 2003 Xilinx, Inc. All rights reserved.
|
||||
//
|
||||
// Xilinx, Inc.
|
||||
//
|
||||
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
|
||||
// COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
|
||||
// ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
|
||||
// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
|
||||
// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
|
||||
// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
|
||||
// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
|
||||
// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
|
||||
// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
|
||||
// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// File : xilmfs.h
|
||||
//
|
||||
// Description :
|
||||
//
|
||||
// Header file for inclusion in all the modules using Xil MFS.
|
||||
//
|
||||
// $Id: xilmfs.h,v 1.6.8.6 2005/11/15 23:41:09 salindac Exp $
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2002 - 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef MFS_FILESYS_H
|
||||
#define MFS_FILESYS_H
|
||||
|
@ -33,8 +37,8 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/* MFS_BLOCK_DATA_SIZE (= number of bytes of data in a file)
|
||||
* and MFS_MAX_LOCAL_ENT (= number of directory entries in
|
||||
* a directory block) are related.
|
||||
* and MFS_MAX_LOCAL_ENT (= number of directory entries in
|
||||
* a directory block) are related.
|
||||
* see block_data union */
|
||||
#define MFS_BLOCK_DATA_SIZE 512
|
||||
#define MFS_MAX_LOCAL_ENT 16
|
||||
|
@ -48,7 +52,7 @@ extern "C" {
|
|||
#define MFS_MAX_FILENAME_LENGTH 23
|
||||
|
||||
/**
|
||||
* dir entry contains file name and index of first file block
|
||||
* dir entry contains file name and index of first file block
|
||||
* mfs_dir_entry_blocks are contained in a mfs_dir_block
|
||||
* size of mfs_dir_ent_block determines size of mfs_dir_block - see below
|
||||
* Make the size a multiple of 4 bytes to ensure alignment at 4 byte boundaries
|
||||
|
@ -60,10 +64,10 @@ struct mfs_dir_ent_block {
|
|||
};
|
||||
|
||||
/**
|
||||
* a mfs_dir_block is contained within a mfs_file_block
|
||||
* each mfs_dir_block contains at least 1 entry (its parent dir)
|
||||
* a mfs_dir_block is contained within a mfs_file_block
|
||||
* each mfs_dir_block contains at least 1 entry (its parent dir)
|
||||
* each dir block can contain at most MFS_MAX_LOCAL_ENT physical entries
|
||||
* If num_entries > MFS_MAX_LOCAL_ENT, there must be some
|
||||
* If num_entries > MFS_MAX_LOCAL_ENT, there must be some
|
||||
* continuation blocks indexed by the next_block entry of the mfs_file_block
|
||||
* The size of this block is determined by the size of the dir_ent array
|
||||
* The size should be less than or equal to the size of block_data in
|
||||
|
@ -78,7 +82,7 @@ struct mfs_dir_block {
|
|||
|
||||
/**
|
||||
* mfs_file_block is the basic unit of the file system
|
||||
* each block has a type identifier to identify the block as
|
||||
* each block has a type identifier to identify the block as
|
||||
* being part of a file a directory or empty
|
||||
* each block has pointers to the next and prev blocks if any,
|
||||
* in the file/dir/free-list
|
||||
|
@ -112,7 +116,7 @@ struct mfs_open_file_struct {
|
|||
/* number of mfs_file_blocks that can fit in the memory reserved for the file system */
|
||||
extern int mfs_max_file_blocks;
|
||||
/* pointer to block of memory allocated or reserved for the file system */
|
||||
extern struct mfs_file_block* mfs_file_system;
|
||||
extern struct mfs_file_block* mfs_file_system;
|
||||
|
||||
/* index of first free block; the next_block value in this one continues the doubly linked free block list; the prev_block value of the first free block is 0 and the next_block value of the last free block is 0 */
|
||||
extern int mfs_free_block_list;
|
||||
|
@ -131,18 +135,18 @@ extern int mfs_num_open_files; /* the number of open_files */
|
|||
|
||||
/**
|
||||
* initialize the file system;
|
||||
* this function must be called before any file system operations
|
||||
* this function must be called before any file system operations
|
||||
* use mfs_init_genimage instead of this function for initializing with
|
||||
* file images generated by mfsgen
|
||||
* @param numbytes is the number of bytes allocated or reserved for this file system
|
||||
* @param address is the starting address of the memory block
|
||||
* Note: address must be word aligned (4 byte boundary)
|
||||
* @param init_type is one of
|
||||
* @param init_type is one of
|
||||
* MFSINIT_NEW for creating empty read/write filesystem
|
||||
* MFSINIT_IMAGE for creating read/write filesystem with predefined data
|
||||
* MFSINIT_ROM_IMAGE for creating read-only filesystem with predefined data
|
||||
*/
|
||||
void mfs_init_fs(int numbytes, char *address, int init_type) ;
|
||||
void mfs_init_fs(int numbytes, char *address, int init_type) ;
|
||||
|
||||
/**
|
||||
* initialize the file system with a file image generated by mfsgen;
|
||||
|
@ -158,7 +162,7 @@ stem
|
|||
*/
|
||||
void mfs_init_genimage(int numbytes, char *address, int init_type) ;
|
||||
|
||||
/**
|
||||
/**
|
||||
* modify global mfs_current_dir to index of newdir if it exists
|
||||
* mfs_current_dir is not modified otherwise
|
||||
* @param newdir is the name of the new directory
|
||||
|
@ -179,7 +183,7 @@ int mfs_delete_file (char *filename) ;
|
|||
/**
|
||||
* create a new empty directory inside the current directory
|
||||
* @param newdir is the name of the directory
|
||||
* @return index of new directory in file system if success, 0 if failure
|
||||
* @return index of new directory in file system if success, 0 if failure
|
||||
*/
|
||||
int mfs_create_dir(char *newdir);
|
||||
|
||||
|
@ -210,7 +214,7 @@ int mfs_rename_file(char *from_file, char *to_file);
|
|||
int mfs_exists_file(char *filename);
|
||||
|
||||
/**
|
||||
* get the name of the current directory
|
||||
* get the name of the current directory
|
||||
* @param dirname = pre_allocated buffer of at least MFS_MAX_FILENAME_SIZE+1 chars
|
||||
* The directory name is copied to this buffer
|
||||
* @return 1 if success, 0 if failure
|
||||
|
@ -246,7 +250,7 @@ int mfs_dir_close(int fd);
|
|||
* The last 3 parameters are output values
|
||||
* @param fd is the file descriptor for an open directory file
|
||||
* @param filename is a pointer to the filename within the MFS itself
|
||||
* @param filesize is the size in bytes for a regular file or
|
||||
* @param filesize is the size in bytes for a regular file or
|
||||
* the number of entries in a directory
|
||||
* @param filetype is MFS_BLOCK_TYPE_FILE or MFS_BLOCK_TYPE_DIR
|
||||
* @return 1 for success and 0 for failure or end of dir
|
||||
|
@ -261,7 +265,7 @@ int mfs_dir_read(int fd, char **filename, int *filesize, int *filetype);
|
|||
* no error checking (is this FILE and not DIR?) is done for MFS_MODE_READ
|
||||
* MFS_MODE_CREATE automatically creates a FILE and not a DIR
|
||||
* MFS_MODE_WRITE fails if the specified file is a DIR
|
||||
* @return index of file in array mfs_open_files or -1
|
||||
* @return index of file in array mfs_open_files or -1
|
||||
*/
|
||||
int mfs_file_open(const char *filename, int mode) ;
|
||||
|
||||
|
@ -288,7 +292,7 @@ int mfs_file_read(int fd, char *buf, int buflen) ;
|
|||
* buf should be a pointer to a pre-allocated buffer of size buflen or more
|
||||
* buflen chars are read from buf and written to 1 or more blocks of the file
|
||||
* @return 1 for success or 0 for error=unable to write to file
|
||||
*/
|
||||
*/
|
||||
int mfs_file_write (int fd, const char *buf, int buflen) ;
|
||||
|
||||
/**
|
||||
|
@ -322,7 +326,7 @@ long mfs_file_lseek(int fd, long offset, int whence);
|
|||
/*** Additional Utility Functions ***/
|
||||
|
||||
/**
|
||||
* list contents of current directory
|
||||
* list contents of current directory
|
||||
* @return 1 on success and 0 on failure
|
||||
*/
|
||||
int mfs_ls() ;
|
||||
|
@ -330,7 +334,7 @@ int mfs_ls() ;
|
|||
/**
|
||||
* recursive directory listing
|
||||
* list the contents of current directory
|
||||
* if any of the entries in the current directory is itself a directory,
|
||||
* if any of the entries in the current directory is itself a directory,
|
||||
* immediately enter that directory and call mfs_ls_r() once again
|
||||
* @param recurse
|
||||
* If parameter recurse is non zero continue recursing
|
||||
|
|
|
@ -1,43 +1,34 @@
|
|||
##############################################################################
|
||||
###############################################################################
|
||||
#
|
||||
# (c) Copyright 2014 Xilinx, Inc. All rights reserved.
|
||||
# Copyright (C) 2014 Xilinx, Inc. All rights reserved.
|
||||
#
|
||||
# This file contains confidential and proprietary information of Xilinx, Inc.
|
||||
# and is protected under U.S. and international copyright and other
|
||||
# intellectual property laws.
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# DISCLAIMER
|
||||
# This disclaimer is not a license and does not grant any rights to the
|
||||
# materials distributed herewith. Except as otherwise provided in a valid
|
||||
# license issued to you by Xilinx, and to the maximum extent permitted by
|
||||
# applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
||||
# FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
||||
# IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
||||
# MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
||||
# and (2) Xilinx shall not be liable (whether in contract or tort, including
|
||||
# negligence, or under any other theory of liability) for any loss or damage
|
||||
# of any kind or nature related to, arising under or in connection with these
|
||||
# materials, including for any direct, or any indirect, special, incidental,
|
||||
# or consequential loss or damage (including loss of data, profits, goodwill,
|
||||
# or any type of loss or damage suffered as a result of any action brought by
|
||||
# a third party) even if such damage or loss was reasonably foreseeable or
|
||||
# Xilinx had been advised of the possibility of the same.
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# CRITICAL APPLICATIONS
|
||||
# Xilinx products are not designed or intended to be fail-safe, or for use in
|
||||
# any application requiring fail-safe performance, such as life-support or
|
||||
# safety devices or systems, Class III medical devices, nuclear facilities,
|
||||
# applications related to the deployment of airbags, or any other applications
|
||||
# that could lead to death, personal injury, or severe property or
|
||||
# environmental damage (individually and collectively, "Critical
|
||||
# Applications"). Customer assumes the sole risk and liability of any use of
|
||||
# Xilinx products in Critical Applications, subject only to applicable laws
|
||||
# and regulations governing limitations on product liability.
|
||||
# Use of the Software is limited solely to applications:
|
||||
# (a) running on a Xilinx device, or
|
||||
# (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
#
|
||||
# THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
||||
# AT ALL TIMES.
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
##############################################################################
|
||||
# Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
# in advertising or otherwise to promote the sale, use or other dealings in
|
||||
# this Software without prior written authorization from Xilinx.
|
||||
#
|
||||
###############################################################################
|
||||
#
|
||||
# Modification History
|
||||
#
|
||||
|
|
|
@ -1,43 +1,34 @@
|
|||
##############################################################################
|
||||
###############################################################################
|
||||
#
|
||||
# (c) Copyright 2014 Xilinx, Inc. All rights reserved.
|
||||
# Copyright (C) 2014 Xilinx, Inc. All rights reserved.
|
||||
#
|
||||
# This file contains confidential and proprietary information of Xilinx, Inc.
|
||||
# and is protected under U.S. and international copyright and other
|
||||
# intellectual property laws.
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# DISCLAIMER
|
||||
# This disclaimer is not a license and does not grant any rights to the
|
||||
# materials distributed herewith. Except as otherwise provided in a valid
|
||||
# license issued to you by Xilinx, and to the maximum extent permitted by
|
||||
# applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
||||
# FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
||||
# IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
||||
# MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
||||
# and (2) Xilinx shall not be liable (whether in contract or tort, including
|
||||
# negligence, or under any other theory of liability) for any loss or damage
|
||||
# of any kind or nature related to, arising under or in connection with these
|
||||
# materials, including for any direct, or any indirect, special, incidental,
|
||||
# or consequential loss or damage (including loss of data, profits, goodwill,
|
||||
# or any type of loss or damage suffered as a result of any action brought by
|
||||
# a third party) even if such damage or loss was reasonably foreseeable or
|
||||
# Xilinx had been advised of the possibility of the same.
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# CRITICAL APPLICATIONS
|
||||
# Xilinx products are not designed or intended to be fail-safe, or for use in
|
||||
# any application requiring fail-safe performance, such as life-support or
|
||||
# safety devices or systems, Class III medical devices, nuclear facilities,
|
||||
# applications related to the deployment of airbags, or any other applications
|
||||
# that could lead to death, personal injury, or severe property or
|
||||
# environmental damage (individually and collectively, "Critical
|
||||
# Applications"). Customer assumes the sole risk and liability of any use of
|
||||
# Xilinx products in Critical Applications, subject only to applicable laws
|
||||
# and regulations governing limitations on product liability.
|
||||
# Use of the Software is limited solely to applications:
|
||||
# (a) running on a Xilinx device, or
|
||||
# (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
#
|
||||
# THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
||||
# AT ALL TIMES.
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
##############################################################################
|
||||
# Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
# in advertising or otherwise to promote the sale, use or other dealings in
|
||||
# this Software without prior written authorization from Xilinx.
|
||||
#
|
||||
###############################################################################
|
||||
#
|
||||
# Modification History
|
||||
#
|
||||
|
|
|
@ -1,22 +1,34 @@
|
|||
####################################/-*-Makefile-*-
|
||||
###############################################################################
|
||||
#
|
||||
# Copyright (c) 2014 Xilinx, Inc. All rights reserved.
|
||||
# Copyright (C) 2014 Xilinx, Inc. All rights reserved.
|
||||
#
|
||||
# Xilinx, Inc.
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
|
||||
# COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
|
||||
# ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
|
||||
# STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
|
||||
# IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
|
||||
# FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
|
||||
# XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
|
||||
# THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
|
||||
# ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
|
||||
# FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
######################################################
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# Use of the Software is limited solely to applications:
|
||||
# (a) running on a Xilinx device, or
|
||||
# (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
# in advertising or otherwise to promote the sale, use or other dealings in
|
||||
# this Software without prior written authorization from Xilinx.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
COMPILER=
|
||||
ARCHIVER=
|
||||
|
|
|
@ -1,43 +1,34 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* (c) Copyright 2014 Xilinx, Inc. All rights reserved.
|
||||
* Copyright (C) 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* This file contains confidential and proprietary information of Xilinx, Inc.
|
||||
* and is protected under U.S. and international copyright and other
|
||||
* intellectual property laws.
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* DISCLAIMER
|
||||
* This disclaimer is not a license and does not grant any rights to the
|
||||
* materials distributed herewith. Except as otherwise provided in a valid
|
||||
* license issued to you by Xilinx, and to the maximum extent permitted by
|
||||
* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
||||
* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
||||
* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
||||
* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
||||
* and (2) Xilinx shall not be liable (whether in contract or tort, including
|
||||
* negligence, or under any other theory of liability) for any loss or damage
|
||||
* of any kind or nature related to, arising under or in connection with these
|
||||
* materials, including for any direct, or any indirect, special, incidental,
|
||||
* or consequential loss or damage (including loss of data, profits, goodwill,
|
||||
* or any type of loss or damage suffered as a result of any action brought by
|
||||
* a third party) even if such damage or loss was reasonably foreseeable or
|
||||
* Xilinx had been advised of the possibility of the same.
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* CRITICAL APPLICATIONS
|
||||
* Xilinx products are not designed or intended to be fail-safe, or for use in
|
||||
* any application requiring fail-safe performance, such as life-support or
|
||||
* safety devices or systems, Class III medical devices, nuclear facilities,
|
||||
* applications related to the deployment of airbags, or any other applications
|
||||
* that could lead to death, personal injury, or severe property or
|
||||
* environmental damage (individually and collectively, "Critical
|
||||
* Applications"). Customer assumes the sole risk and liability of any use of
|
||||
* Xilinx products in Critical Applications, subject only to applicable laws
|
||||
* and regulations governing limitations on product liability.
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
||||
* AT ALL TIMES.
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*******************************************************************************/
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue