diff --git a/common/inc/fx_api.h b/common/inc/fx_api.h index 291f6dd..aac3683 100644 --- a/common/inc/fx_api.h +++ b/common/inc/fx_api.h @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -37,59 +38,6 @@ /* All service prototypes and data structure definitions are defined */ /* in this file. */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), and */ -/* updated product constants, */ -/* and added conditionals to */ -/* disable few declarations */ -/* for code size reduction, */ -/* resulting in version 6.1 */ -/* 11-09-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1.2 */ -/* 12-31-2020 William E. Lamie Modified comment(s), and */ -/* updated product constants, */ -/* resulting in version 6.1.3 */ -/* 03-02-2021 William E. Lamie Modified comment(s), and */ -/* added standalone support, */ -/* resulting in version 6.1.5 */ -/* 04-02-2021 William E. Lamie Modified comment(s), and */ -/* updated product constants, */ -/* resulting in version 6.1.6 */ -/* 06-02-2021 William E. Lamie Modified comment(s), and */ -/* updated product constants, */ -/* resulting in version 6.1.7 */ -/* 08-02-2021 William E. Lamie Modified comment(s), and */ -/* updated product constants, */ -/* resulting in version 6.1.8 */ -/* 01-31-2022 Bhupendra Naphade Modified comment(s), fixed */ -/* errors without cache, */ -/* resulting in version 6.1.10 */ -/* 04-25-2022 William E. Lamie Modified comment(s), and */ -/* updated product constants, */ -/* resulting in version 6.1.11 */ -/* 07-29-2022 William E. Lamie Modified comment(s), and */ -/* updated product constants, */ -/* resulting in version 6.1.12 */ -/* 10-31-2022 Xiuwen Cai Modified comment(s), and */ -/* updated product constants, */ -/* resulting in version 6.2.0 */ -/* 03-08-2023 Xiuwen Cai Modified comment(s), and */ -/* updated product constants, */ -/* resulting in version 6.2.1 */ -/* 10-31-2023 Xiuwen Cai Modified comment(s), and */ -/* updated product constants, */ -/* resulting in version 6.3.0 */ -/* 12-31-2023 Xiuwen Cai Modified comment(s), and */ -/* updated product constants, */ -/* resulting in version 6.4.0 */ -/* 03-01-2024 Tiejun Zhou Modified comment(s), */ -/* update version number, */ -/* resulting in version 6.4.1 */ -/* */ /**************************************************************************/ #ifndef FX_API_H @@ -137,9 +85,9 @@ extern "C" { #define AZURE_RTOS_FILEX #define FILEX_MAJOR_VERSION 6 -#define FILEX_MINOR_VERSION 4 -#define FILEX_PATCH_VERSION 5 -#define FILEX_BUILD_VERSION 202504 +#define FILEX_MINOR_VERSION 5 +#define FILEX_PATCH_VERSION 0 +#define FILEX_BUILD_VERSION 202601 #define FILEX_HOTFIX_VERSION ' ' /* Define the following symbols for backward compatibility */ diff --git a/common/inc/fx_directory.h b/common/inc/fx_directory.h index cd4902d..2070f1a 100644 --- a/common/inc/fx_directory.h +++ b/common/inc/fx_directory.h @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -36,14 +37,6 @@ /* definitions, and external references. It is assumed that fx_api.h */ /* (and fx_port.h) have already been included. */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ #ifndef FX_DIRECTORY_H diff --git a/common/inc/fx_fault_tolerant.h b/common/inc/fx_fault_tolerant.h index d77bf26..32da4d9 100644 --- a/common/inc/fx_fault_tolerant.h +++ b/common/inc/fx_fault_tolerant.h @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -36,14 +37,6 @@ /* data definitions, and external references. It is assumed that */ /* fx_api.h (and fx_port.h) have already been included. */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ #ifndef _FX_FAULT_TOLERANT_H_ diff --git a/common/inc/fx_file.h b/common/inc/fx_file.h index f94f6ec..fd1f9da 100644 --- a/common/inc/fx_file.h +++ b/common/inc/fx_file.h @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -36,16 +37,6 @@ /* definitions, and external references. It is assumed that fx_api.h */ /* (and fx_port.h) have already been included. */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), and */ -/* added conditional to */ -/* disable one line function, */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ #ifndef FX_FILE_H diff --git a/common/inc/fx_media.h b/common/inc/fx_media.h index c994443..804a83b 100644 --- a/common/inc/fx_media.h +++ b/common/inc/fx_media.h @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -36,14 +37,6 @@ /* definitions, and external references. It is assumed that fx_api.h */ /* (and fx_port.h) have already been included. */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ #ifndef FX_MEDIA_H diff --git a/common/inc/fx_system.h b/common/inc/fx_system.h index b99489d..1d8859b 100644 --- a/common/inc/fx_system.h +++ b/common/inc/fx_system.h @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -36,14 +37,6 @@ /* definitions, including external references. It is assumed that */ /* fx_api.h (and fx_port.h) have already been included. */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ #ifndef FX_SYSTEM_H diff --git a/common/inc/fx_unicode.h b/common/inc/fx_unicode.h index 96aa38f..a417e33 100644 --- a/common/inc/fx_unicode.h +++ b/common/inc/fx_unicode.h @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -36,14 +37,6 @@ /* definitions, and external references. It is assumed that fx_api.h */ /* (and fx_port.h) have already been included. */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ #ifndef FX_UNICODE_H diff --git a/common/inc/fx_user_sample.h b/common/inc/fx_user_sample.h index e96064b..0ea631e 100644 --- a/common/inc/fx_user_sample.h +++ b/common/inc/fx_user_sample.h @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -39,20 +40,6 @@ /* Note that all the defines in this file may also be made on the */ /* command line when building FileX library and application objects. */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), and */ -/* added product constants */ -/* to enable code */ -/* size optimization, */ -/* resulting in version 6.1 */ -/* 03-02-2021 William E. Lamie Modified comment(s), and */ -/* added standalone support, */ -/* resulting in version 6.1.5 */ -/* */ /**************************************************************************/ #ifndef FX_USER_H diff --git a/common/inc/fx_utility.h b/common/inc/fx_utility.h index 02f46ff..72dee83 100644 --- a/common/inc/fx_utility.h +++ b/common/inc/fx_utility.h @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -36,14 +37,6 @@ /* definitions, and external references. It is assumed that fx_api.h */ /* (and fx_port.h) have already been included. */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ #ifndef FX_UTILITY_H diff --git a/common/src/fx_directory_attributes_read.c b/common/src/fx_directory_attributes_read.c index 8f249cc..e5515ac 100644 --- a/common/src/fx_directory_attributes_read.c +++ b/common/src/fx_directory_attributes_read.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -68,14 +69,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_directory_attributes_read(FX_MEDIA *media_ptr, CHAR *directory_name, UINT *attributes_ptr) { diff --git a/common/src/fx_directory_attributes_set.c b/common/src/fx_directory_attributes_set.c index 72060c0..d2a597c 100644 --- a/common/src/fx_directory_attributes_set.c +++ b/common/src/fx_directory_attributes_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -76,14 +77,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_directory_attributes_set(FX_MEDIA *media_ptr, CHAR *directory_name, UINT attributes) { diff --git a/common/src/fx_directory_create.c b/common/src/fx_directory_create.c index eec3724..079c8a3 100644 --- a/common/src/fx_directory_create.c +++ b/common/src/fx_directory_create.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -85,14 +86,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_directory_create(FX_MEDIA *media_ptr, CHAR *directory_name) { diff --git a/common/src/fx_directory_default_get.c b/common/src/fx_directory_default_get.c index 8a77669..eae94e6 100644 --- a/common/src/fx_directory_default_get.c +++ b/common/src/fx_directory_default_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -61,14 +62,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_directory_default_get(FX_MEDIA *media_ptr, CHAR **return_path_name) { diff --git a/common/src/fx_directory_default_get_copy.c b/common/src/fx_directory_default_get_copy.c index f05c07d..6b64645 100644 --- a/common/src/fx_directory_default_get_copy.c +++ b/common/src/fx_directory_default_get_copy.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -62,18 +63,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), verified */ -/* memcpy usage, */ -/* resulting in version 6.1 */ -/* 04-02-2021 William E. Lamie Modified comment(s), verified */ -/* memcpy usage, */ -/* resulting in version 6.1.6 */ -/* */ /**************************************************************************/ UINT _fx_directory_default_get_copy(FX_MEDIA *media_ptr, CHAR *return_path_name_buffer, UINT return_path_name_buffer_size) { diff --git a/common/src/fx_directory_default_set.c b/common/src/fx_directory_default_set.c index 6e4074f..eb6cc82 100644 --- a/common/src/fx_directory_default_set.c +++ b/common/src/fx_directory_default_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -71,14 +72,6 @@ FX_LOCAL_PATH_SETUP /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_directory_default_set(FX_MEDIA *media_ptr, CHAR *new_path_name) { diff --git a/common/src/fx_directory_delete.c b/common/src/fx_directory_delete.c index e24a895..eead712 100644 --- a/common/src/fx_directory_delete.c +++ b/common/src/fx_directory_delete.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -82,14 +83,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_directory_delete(FX_MEDIA *media_ptr, CHAR *directory_name) { diff --git a/common/src/fx_directory_entry_read.c b/common/src/fx_directory_entry_read.c index 7af1834..5bfb93e 100644 --- a/common/src/fx_directory_entry_read.c +++ b/common/src/fx_directory_entry_read.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -70,14 +71,6 @@ /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_directory_entry_read(FX_MEDIA *media_ptr, FX_DIR_ENTRY *source_dir, ULONG *entry_ptr, FX_DIR_ENTRY *destination_ptr) diff --git a/common/src/fx_directory_entry_write.c b/common/src/fx_directory_entry_write.c index 02e5fc0..ee2ceec 100644 --- a/common/src/fx_directory_entry_write.c +++ b/common/src/fx_directory_entry_write.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -70,16 +71,6 @@ /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* 03-02-2021 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1.5 */ -/* */ /**************************************************************************/ UINT _fx_directory_entry_write(FX_MEDIA *media_ptr, FX_DIR_ENTRY *entry_ptr) { diff --git a/common/src/fx_directory_first_entry_find.c b/common/src/fx_directory_first_entry_find.c index 7219728..881d9da 100644 --- a/common/src/fx_directory_first_entry_find.c +++ b/common/src/fx_directory_first_entry_find.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -67,14 +68,6 @@ FX_LOCAL_PATH_SETUP /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_directory_first_entry_find(FX_MEDIA *media_ptr, CHAR *directory_name) { diff --git a/common/src/fx_directory_first_full_entry_find.c b/common/src/fx_directory_first_full_entry_find.c index e70a08e..cbe81b5 100644 --- a/common/src/fx_directory_first_full_entry_find.c +++ b/common/src/fx_directory_first_full_entry_find.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -74,14 +75,6 @@ FX_LOCAL_PATH_SETUP /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_directory_first_full_entry_find(FX_MEDIA *media_ptr, CHAR *directory_name, UINT *attributes, ULONG *size, diff --git a/common/src/fx_directory_free_search.c b/common/src/fx_directory_free_search.c index 84504ce..55397c6 100644 --- a/common/src/fx_directory_free_search.c +++ b/common/src/fx_directory_free_search.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -71,18 +72,6 @@ /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* 07-29-2022 Bhupendra Naphade Modified comment(s), */ -/* updated available cluster */ -/* check for sub directory, */ -/* resulting in version 6.1.12 */ -/* */ /**************************************************************************/ UINT _fx_directory_free_search(FX_MEDIA *media_ptr, FX_DIR_ENTRY *directory_ptr, FX_DIR_ENTRY *entry_ptr) { diff --git a/common/src/fx_directory_information_get.c b/common/src/fx_directory_information_get.c index 18d1670..6d876fd 100644 --- a/common/src/fx_directory_information_get.c +++ b/common/src/fx_directory_information_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -74,15 +75,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), verified */ -/* memcpy usage, */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_directory_information_get(FX_MEDIA *media_ptr, CHAR *directory_name, UINT *attributes, ULONG *size, diff --git a/common/src/fx_directory_local_path_clear.c b/common/src/fx_directory_local_path_clear.c index ab9ebe0..fcef6ce 100644 --- a/common/src/fx_directory_local_path_clear.c +++ b/common/src/fx_directory_local_path_clear.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -67,14 +68,6 @@ FX_LOCAL_PATH_SETUP /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_directory_local_path_clear(FX_MEDIA *media_ptr) { diff --git a/common/src/fx_directory_local_path_get.c b/common/src/fx_directory_local_path_get.c index 79f1524..896a063 100644 --- a/common/src/fx_directory_local_path_get.c +++ b/common/src/fx_directory_local_path_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -66,16 +67,6 @@ FX_LOCAL_PATH_SETUP /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* 03-02-2021 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1.5 */ -/* */ /**************************************************************************/ UINT _fx_directory_local_path_get(FX_MEDIA *media_ptr, CHAR **return_path_name) { diff --git a/common/src/fx_directory_local_path_get_copy.c b/common/src/fx_directory_local_path_get_copy.c index 1badbba..13d3017 100644 --- a/common/src/fx_directory_local_path_get_copy.c +++ b/common/src/fx_directory_local_path_get_copy.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -64,15 +65,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), verified */ -/* memcpy usage, */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_directory_local_path_get_copy(FX_MEDIA *media_ptr, CHAR *return_path_name_buffer, UINT return_path_name_buffer_size) { diff --git a/common/src/fx_directory_local_path_restore.c b/common/src/fx_directory_local_path_restore.c index 516e675..9c8f70f 100644 --- a/common/src/fx_directory_local_path_restore.c +++ b/common/src/fx_directory_local_path_restore.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -66,16 +67,6 @@ FX_LOCAL_PATH_SETUP /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* 03-02-2021 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1.5 */ -/* */ /**************************************************************************/ UINT _fx_directory_local_path_restore(FX_MEDIA *media_ptr, FX_LOCAL_PATH *local_path_ptr) { diff --git a/common/src/fx_directory_local_path_set.c b/common/src/fx_directory_local_path_set.c index ea7e49e..eff215a 100644 --- a/common/src/fx_directory_local_path_set.c +++ b/common/src/fx_directory_local_path_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -70,16 +71,6 @@ FX_LOCAL_PATH_SETUP /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* 03-02-2021 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1.5 */ -/* */ /**************************************************************************/ UINT _fx_directory_local_path_set(FX_MEDIA *media_ptr, FX_LOCAL_PATH *local_path_ptr, CHAR *new_path_name) { diff --git a/common/src/fx_directory_long_name_get.c b/common/src/fx_directory_long_name_get.c index 741285c..d7b397d 100644 --- a/common/src/fx_directory_long_name_get.c +++ b/common/src/fx_directory_long_name_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -66,14 +67,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_directory_long_name_get(FX_MEDIA *media_ptr, CHAR *short_file_name, CHAR *long_file_name) { diff --git a/common/src/fx_directory_long_name_get_extended.c b/common/src/fx_directory_long_name_get_extended.c index 5afdca6..e9521b2 100644 --- a/common/src/fx_directory_long_name_get_extended.c +++ b/common/src/fx_directory_long_name_get_extended.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -63,14 +64,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_directory_long_name_get_extended(FX_MEDIA *media_ptr, CHAR *short_file_name, CHAR *long_file_name, UINT long_file_name_buffer_length) { diff --git a/common/src/fx_directory_name_extract.c b/common/src/fx_directory_name_extract.c index b18410f..2983be0 100644 --- a/common/src/fx_directory_name_extract.c +++ b/common/src/fx_directory_name_extract.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -64,14 +65,6 @@ /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ CHAR *_fx_directory_name_extract(CHAR *source_ptr, CHAR *dest_ptr) { diff --git a/common/src/fx_directory_name_test.c b/common/src/fx_directory_name_test.c index a252e7a..facf36f 100644 --- a/common/src/fx_directory_name_test.c +++ b/common/src/fx_directory_name_test.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -66,14 +67,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_directory_name_test(FX_MEDIA *media_ptr, CHAR *directory_name) { diff --git a/common/src/fx_directory_next_entry_find.c b/common/src/fx_directory_next_entry_find.c index 50c4411..e86a16e 100644 --- a/common/src/fx_directory_next_entry_find.c +++ b/common/src/fx_directory_next_entry_find.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -71,14 +72,6 @@ FX_LOCAL_PATH_SETUP /* Application Code and */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_directory_next_entry_find(FX_MEDIA *media_ptr, CHAR *directory_name) { diff --git a/common/src/fx_directory_next_full_entry_find.c b/common/src/fx_directory_next_full_entry_find.c index 1b1aa09..a464ba7 100644 --- a/common/src/fx_directory_next_full_entry_find.c +++ b/common/src/fx_directory_next_full_entry_find.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -79,14 +80,6 @@ FX_LOCAL_PATH_SETUP /* Application Code and */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_directory_next_full_entry_find(FX_MEDIA *media_ptr, CHAR *directory_name, UINT *attributes, ULONG *size, diff --git a/common/src/fx_directory_rename.c b/common/src/fx_directory_rename.c index 8102662..48b6784 100644 --- a/common/src/fx_directory_rename.c +++ b/common/src/fx_directory_rename.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -79,14 +80,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_directory_rename(FX_MEDIA *media_ptr, CHAR *old_directory_name, CHAR *new_directory_name) { diff --git a/common/src/fx_directory_search.c b/common/src/fx_directory_search.c index 54368bb..8891b47 100644 --- a/common/src/fx_directory_search.c +++ b/common/src/fx_directory_search.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -76,23 +77,6 @@ FX_LOCAL_PATH_SETUP /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), and */ -/* added conditional to */ -/* disable media search cache, */ -/* resulting in version 6.1 */ -/* 06-02-2021 Bhupendra Naphade Modified comment(s), and */ -/* added check for */ -/* volume label, */ -/* resulting in version 6.1.7 */ -/* 01-31-2022 William E. Lamie Modified comment(s), and */ -/* fixed path compare, */ -/* resulting in version 6.1.10 */ -/* */ /**************************************************************************/ UINT _fx_directory_search(FX_MEDIA *media_ptr, CHAR *name_ptr, FX_DIR_ENTRY *entry_ptr, FX_DIR_ENTRY *last_dir_ptr, CHAR **last_name_ptr) diff --git a/common/src/fx_directory_short_name_get.c b/common/src/fx_directory_short_name_get.c index 3ae0bc9..a5ec217 100644 --- a/common/src/fx_directory_short_name_get.c +++ b/common/src/fx_directory_short_name_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -66,14 +67,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_directory_short_name_get(FX_MEDIA *media_ptr, CHAR *long_file_name, CHAR *short_file_name) { diff --git a/common/src/fx_directory_short_name_get_extended.c b/common/src/fx_directory_short_name_get_extended.c index cc61f41..4fdead4 100644 --- a/common/src/fx_directory_short_name_get_extended.c +++ b/common/src/fx_directory_short_name_get_extended.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -63,14 +64,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_directory_short_name_get_extended(FX_MEDIA *media_ptr, CHAR *long_file_name, CHAR *short_file_name, UINT short_file_name_length) { diff --git a/common/src/fx_fault_tolerant_add_FAT_log.c b/common/src/fx_fault_tolerant_add_FAT_log.c index f2ddf4c..f8f0125 100644 --- a/common/src/fx_fault_tolerant_add_FAT_log.c +++ b/common/src/fx_fault_tolerant_add_FAT_log.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -61,14 +62,6 @@ /* */ /* _fx_utility_FAT_entry_write */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_fault_tolerant_add_FAT_log(FX_MEDIA *media_ptr, ULONG cluster, ULONG value) { diff --git a/common/src/fx_fault_tolerant_add_bitmap_log.c b/common/src/fx_fault_tolerant_add_bitmap_log.c index 4ec0be6..fd4cbe7 100644 --- a/common/src/fx_fault_tolerant_add_bitmap_log.c +++ b/common/src/fx_fault_tolerant_add_bitmap_log.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ diff --git a/common/src/fx_fault_tolerant_add_checksum_log.c b/common/src/fx_fault_tolerant_add_checksum_log.c index 4ec0be6..fd4cbe7 100644 --- a/common/src/fx_fault_tolerant_add_checksum_log.c +++ b/common/src/fx_fault_tolerant_add_checksum_log.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ diff --git a/common/src/fx_fault_tolerant_add_dir_log.c b/common/src/fx_fault_tolerant_add_dir_log.c index fb76cb0..8cb7287 100644 --- a/common/src/fx_fault_tolerant_add_dir_log.c +++ b/common/src/fx_fault_tolerant_add_dir_log.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -65,15 +66,6 @@ /* */ /* _fx_directory_entry_write */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), verified */ -/* memcpy usage, */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_fault_tolerant_add_dir_log(FX_MEDIA *media_ptr, ULONG64 logical_sector, ULONG offset, UCHAR *data, ULONG data_size) diff --git a/common/src/fx_fault_tolerant_apply_logs.c b/common/src/fx_fault_tolerant_apply_logs.c index 71eff73..75fb578 100644 --- a/common/src/fx_fault_tolerant_apply_logs.c +++ b/common/src/fx_fault_tolerant_apply_logs.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -70,18 +71,6 @@ /* _fx_fault_tolerant_enable */ /* _fx_fault_tolerant_transaction_end */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), verified */ -/* memcpy usage, */ -/* resulting in version 6.1 */ -/* 10-31-2022 Tiejun Zhou Modified comment(s), fixed */ -/* overflow in log size check, */ -/* resulting in version 6.2.0 */ -/* */ /**************************************************************************/ UINT _fx_fault_tolerant_apply_logs(FX_MEDIA *media_ptr) { diff --git a/common/src/fx_fault_tolerant_calculate_checksum.c b/common/src/fx_fault_tolerant_calculate_checksum.c index 93a7585..bb937a7 100644 --- a/common/src/fx_fault_tolerant_calculate_checksum.c +++ b/common/src/fx_fault_tolerant_calculate_checksum.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -64,14 +65,6 @@ /* _fx_fault_tolerant_set_FAT_chain */ /* _fx_fault_tolerant_transaction_end */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ USHORT _fx_fault_tolerant_calculate_checksum(UCHAR *data, UINT len) { diff --git a/common/src/fx_fault_tolerant_cleanup_FAT_chain.c b/common/src/fx_fault_tolerant_cleanup_FAT_chain.c index 9929ae9..565ffa3 100644 --- a/common/src/fx_fault_tolerant_cleanup_FAT_chain.c +++ b/common/src/fx_fault_tolerant_cleanup_FAT_chain.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -62,12 +63,6 @@ /* */ /* _fx_fault_tolerant_cleanup_FAT_chain */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 10-31-2022 Tiejun Zhou Initial Version 6.2.0 */ -/* */ /**************************************************************************/ static UINT _fx_utility_FAT_entry_multiple_sectors_check(FX_MEDIA *media_ptr, ULONG cluster) { @@ -158,18 +153,6 @@ ULONG FAT_sector; /* _fx_fault_tolerant_apply_logs */ /* _fx_fault_tolerant_recover */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* 10-31-2022 Tiejun Zhou Modified comment(s), */ -/* fixed FAT entry span two */ -/* sectors for FAT12, */ -/* resulting in version 6.2.0 */ -/* */ /**************************************************************************/ UINT _fx_fault_tolerant_cleanup_FAT_chain(FX_MEDIA *media_ptr, UINT operation) { @@ -207,7 +190,7 @@ ULONG last_FAT_sector; /* At this point, the head_cluster points to the cluster chain that is to be removed. */ - /* Tail cluster points to the back of the origianal FAT chain where the new chain is attached to. + /* Tail cluster points to the back of the original FAT chain where the new chain is attached to. The remove process terminates once this cluster is encountered. */ tail_cluster = _fx_utility_32_unsigned_read((UCHAR *)&FAT_chain -> fx_fault_tolerant_FAT_chain_insertion_back); @@ -262,7 +245,11 @@ ULONG last_FAT_sector; { if (head_cluster == next_session || next_session == FX_FREE_CLUSTER) { - next_session = next_cluster; + /* Do not start another session if this is the end of the chain. */ + if (next_cluster != tail_cluster) + { + next_session = next_cluster; + } } break; } @@ -277,7 +264,11 @@ ULONG last_FAT_sector; /* Get next session. */ if (cache_count == cache_max) { - next_session = next_cluster; + /* Do not start another session if this is the end of the chain. */ + if (next_cluster != tail_cluster) + { + next_session = next_cluster; + } } /* Update head cluster and next session into log file. */ diff --git a/common/src/fx_fault_tolerant_create_log_file.c b/common/src/fx_fault_tolerant_create_log_file.c index 05a28bd..9d06b8b 100644 --- a/common/src/fx_fault_tolerant_create_log_file.c +++ b/common/src/fx_fault_tolerant_create_log_file.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -63,19 +64,6 @@ /* */ /* _fx_fault_tolerant_enable */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* 01-31-2022 Bhupendra Naphade Modified comment(s), replaced */ -/* sector size constant, */ -/* resulting in version 6.1.10 */ -/* 04-25-2022 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1.11 */ -/* */ /**************************************************************************/ UINT _fx_fault_tolerant_create_log_file(FX_MEDIA *media_ptr) { diff --git a/common/src/fx_fault_tolerant_enable.c b/common/src/fx_fault_tolerant_enable.c index 74facb2..21b4d1e 100644 --- a/common/src/fx_fault_tolerant_enable.c +++ b/common/src/fx_fault_tolerant_enable.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -77,18 +78,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* 10-31-2022 Tiejun Zhou Modified comment(s), */ -/* fixed memory buffer when */ -/* cache is disabled, */ -/* resulting in version 6.2.0 */ -/* */ /**************************************************************************/ UINT _fx_fault_tolerant_enable(FX_MEDIA *media_ptr, VOID *memory_buffer, UINT memory_size) { diff --git a/common/src/fx_fault_tolerant_read_FAT.c b/common/src/fx_fault_tolerant_read_FAT.c index 7f9811c..1406d1f 100644 --- a/common/src/fx_fault_tolerant_read_FAT.c +++ b/common/src/fx_fault_tolerant_read_FAT.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -66,14 +67,6 @@ /* */ /* _fx_utility_FAT_entry_read */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_fault_tolerant_read_FAT(FX_MEDIA *media_ptr, ULONG cluster, ULONG *value, ULONG log_type) { diff --git a/common/src/fx_fault_tolerant_read_directory_sector.c b/common/src/fx_fault_tolerant_read_directory_sector.c index 7893a6c..77051bd 100644 --- a/common/src/fx_fault_tolerant_read_directory_sector.c +++ b/common/src/fx_fault_tolerant_read_directory_sector.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -66,15 +67,6 @@ /* */ /* _fx_utility_logical_sector_read */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), verified */ -/* memcpy usage, */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_fault_tolerant_read_directory_sector(FX_MEDIA *media_ptr, ULONG64 logical_sector, VOID *buffer_ptr, ULONG64 sectors) diff --git a/common/src/fx_fault_tolerant_read_log_file.c b/common/src/fx_fault_tolerant_read_log_file.c index 4e5bf51..bcffa40 100644 --- a/common/src/fx_fault_tolerant_read_log_file.c +++ b/common/src/fx_fault_tolerant_read_log_file.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -58,14 +59,6 @@ /* */ /* _fx_fault_tolerant_enable */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_fault_tolerant_read_log_file(FX_MEDIA *media_ptr) { diff --git a/common/src/fx_fault_tolerant_recover.c b/common/src/fx_fault_tolerant_recover.c index 9f94051..1b02d35 100644 --- a/common/src/fx_fault_tolerant_recover.c +++ b/common/src/fx_fault_tolerant_recover.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -80,14 +81,6 @@ /* _fx_unicode_file_create */ /* _fx_fault_tolerant_enable */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_fault_tolerant_recover(FX_MEDIA *media_ptr) { diff --git a/common/src/fx_fault_tolerant_reset_log_file.c b/common/src/fx_fault_tolerant_reset_log_file.c index b5317de..d177e49 100644 --- a/common/src/fx_fault_tolerant_reset_log_file.c +++ b/common/src/fx_fault_tolerant_reset_log_file.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -78,14 +79,6 @@ /* _fx_fault_tolerant_enable */ /* _fx_fault_tolerant_transaction_end */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_fault_tolerant_reset_log_file(FX_MEDIA *media_ptr) diff --git a/common/src/fx_fault_tolerant_set_FAT_chain.c b/common/src/fx_fault_tolerant_set_FAT_chain.c index 4ce083e..78aad69 100644 --- a/common/src/fx_fault_tolerant_set_FAT_chain.c +++ b/common/src/fx_fault_tolerant_set_FAT_chain.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -71,14 +72,6 @@ /* _fx_file_truncate_release */ /* _fx_file_write */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_fault_tolerant_set_FAT_chain(FX_MEDIA *media_ptr, UINT use_bitmap, ULONG insertion_front, ULONG new_head_cluster, ULONG original_head_cluster, diff --git a/common/src/fx_fault_tolerant_transaction_end.c b/common/src/fx_fault_tolerant_transaction_end.c index 332cfcd..0e47485 100644 --- a/common/src/fx_fault_tolerant_transaction_end.c +++ b/common/src/fx_fault_tolerant_transaction_end.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -83,14 +84,6 @@ /* _fx_unicode_directory_create */ /* _fx_unicode_file_create */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_fault_tolerant_transaction_end(FX_MEDIA *media_ptr) { diff --git a/common/src/fx_fault_tolerant_transaction_fail.c b/common/src/fx_fault_tolerant_transaction_fail.c index 99878c4..14c80cb 100644 --- a/common/src/fx_fault_tolerant_transaction_fail.c +++ b/common/src/fx_fault_tolerant_transaction_fail.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -70,14 +71,6 @@ /* _fx_unicode_directory_create */ /* _fx_unicode_file_create */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_fault_tolerant_transaction_fail(FX_MEDIA *media_ptr) { diff --git a/common/src/fx_fault_tolerant_transaction_start.c b/common/src/fx_fault_tolerant_transaction_start.c index 4dfec2d..0681f3b 100644 --- a/common/src/fx_fault_tolerant_transaction_start.c +++ b/common/src/fx_fault_tolerant_transaction_start.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -72,14 +73,6 @@ /* _fx_unicode_directory_create */ /* _fx_unicode_file_create */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_fault_tolerant_transaction_start(FX_MEDIA *media_ptr) { diff --git a/common/src/fx_fault_tolerant_write_log_file.c b/common/src/fx_fault_tolerant_write_log_file.c index 2092dd8..d4979ea 100644 --- a/common/src/fx_fault_tolerant_write_log_file.c +++ b/common/src/fx_fault_tolerant_write_log_file.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -65,14 +66,6 @@ /* _fx_fault_tolerant_set_FAT_chain */ /* _fx_fault_tolerant_transaction_end */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_fault_tolerant_write_log_file(FX_MEDIA *media_ptr, ULONG relative_sector) { diff --git a/common/src/fx_file_allocate.c b/common/src/fx_file_allocate.c index b2b2498..6de919d 100644 --- a/common/src/fx_file_allocate.c +++ b/common/src/fx_file_allocate.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -63,16 +64,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), and */ -/* Added conditional to */ -/* disable one line function, */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ #ifndef FX_DISABLE_ONE_LINE_FUNCTION UINT _fx_file_allocate(FX_FILE *file_ptr, ULONG size) diff --git a/common/src/fx_file_attributes_read.c b/common/src/fx_file_attributes_read.c index 4d67539..6372a2c 100644 --- a/common/src/fx_file_attributes_read.c +++ b/common/src/fx_file_attributes_read.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -67,14 +68,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_file_attributes_read(FX_MEDIA *media_ptr, CHAR *file_name, UINT *attributes_ptr) { diff --git a/common/src/fx_file_attributes_set.c b/common/src/fx_file_attributes_set.c index 0b0736b..153fa45 100644 --- a/common/src/fx_file_attributes_set.c +++ b/common/src/fx_file_attributes_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -76,14 +77,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_file_attributes_set(FX_MEDIA *media_ptr, CHAR *file_name, UINT attributes) { diff --git a/common/src/fx_file_best_effort_allocate.c b/common/src/fx_file_best_effort_allocate.c index cd7d48b..048746b 100644 --- a/common/src/fx_file_best_effort_allocate.c +++ b/common/src/fx_file_best_effort_allocate.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -66,14 +67,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_file_best_effort_allocate(FX_FILE *file_ptr, ULONG size, ULONG *actual_size_allocated) { diff --git a/common/src/fx_file_close.c b/common/src/fx_file_close.c index ce5af08..a3fdba1 100644 --- a/common/src/fx_file_close.c +++ b/common/src/fx_file_close.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -63,14 +64,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_file_close(FX_FILE *file_ptr) { diff --git a/common/src/fx_file_create.c b/common/src/fx_file_create.c index 66fe976..22af9d5 100644 --- a/common/src/fx_file_create.c +++ b/common/src/fx_file_create.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -80,14 +81,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_file_create(FX_MEDIA *media_ptr, CHAR *file_name) { diff --git a/common/src/fx_file_date_time_set.c b/common/src/fx_file_date_time_set.c index 2157fb4..34263e3 100644 --- a/common/src/fx_file_date_time_set.c +++ b/common/src/fx_file_date_time_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -69,14 +70,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_file_date_time_set(FX_MEDIA *media_ptr, CHAR *file_name, UINT year, UINT month, UINT day, UINT hour, UINT minute, UINT second) diff --git a/common/src/fx_file_delete.c b/common/src/fx_file_delete.c index f8e65e2..9210947 100644 --- a/common/src/fx_file_delete.c +++ b/common/src/fx_file_delete.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -80,14 +81,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_file_delete(FX_MEDIA *media_ptr, CHAR *file_name) { diff --git a/common/src/fx_file_extended_allocate.c b/common/src/fx_file_extended_allocate.c index b269907..36020eb 100644 --- a/common/src/fx_file_extended_allocate.c +++ b/common/src/fx_file_extended_allocate.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -79,14 +80,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_file_extended_allocate(FX_FILE *file_ptr, ULONG64 size) { diff --git a/common/src/fx_file_extended_best_effort_allocate.c b/common/src/fx_file_extended_best_effort_allocate.c index b5dad61..a9a4b3f 100644 --- a/common/src/fx_file_extended_best_effort_allocate.c +++ b/common/src/fx_file_extended_best_effort_allocate.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -80,14 +81,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_file_extended_best_effort_allocate(FX_FILE *file_ptr, ULONG64 size, ULONG64 *actual_size_allocated) { diff --git a/common/src/fx_file_extended_relative_seek.c b/common/src/fx_file_extended_relative_seek.c index 6c70ca2..b085242 100644 --- a/common/src/fx_file_extended_relative_seek.c +++ b/common/src/fx_file_extended_relative_seek.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -71,14 +72,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_file_extended_relative_seek(FX_FILE *file_ptr, ULONG64 byte_offset, UINT seek_from) { diff --git a/common/src/fx_file_extended_seek.c b/common/src/fx_file_extended_seek.c index 6484069..a4e4a6a 100644 --- a/common/src/fx_file_extended_seek.c +++ b/common/src/fx_file_extended_seek.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -65,17 +66,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* 06-02-2021 Bhupendra Naphade Modified comment(s), fixed */ -/* relative cluster logic, */ -/* resulting in version 6.1.7 */ -/* */ /**************************************************************************/ UINT _fx_file_extended_seek(FX_FILE *file_ptr, ULONG64 byte_offset) { diff --git a/common/src/fx_file_extended_truncate.c b/common/src/fx_file_extended_truncate.c index 1bc898a..939515f 100644 --- a/common/src/fx_file_extended_truncate.c +++ b/common/src/fx_file_extended_truncate.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -73,14 +74,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_file_extended_truncate(FX_FILE *file_ptr, ULONG64 size) { diff --git a/common/src/fx_file_extended_truncate_release.c b/common/src/fx_file_extended_truncate_release.c index 8bd5471..92cddb4 100644 --- a/common/src/fx_file_extended_truncate_release.c +++ b/common/src/fx_file_extended_truncate_release.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -78,17 +79,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* 12-31-2020 William E. Lamie Modified comment(s), fixed */ -/* available cluster issue, */ -/* resulting in version 6.1.3 */ -/* */ /**************************************************************************/ UINT _fx_file_extended_truncate_release(FX_FILE *file_ptr, ULONG64 size) { diff --git a/common/src/fx_file_open.c b/common/src/fx_file_open.c index 97b299a..3ab9bd8 100644 --- a/common/src/fx_file_open.c +++ b/common/src/fx_file_open.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -69,17 +70,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), and */ -/* added conditional to */ -/* disable fast open and */ -/* consecutive detect, */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_file_open(FX_MEDIA *media_ptr, FX_FILE *file_ptr, CHAR *file_name, UINT open_type) { diff --git a/common/src/fx_file_read.c b/common/src/fx_file_read.c index 1b5d037..950badd 100644 --- a/common/src/fx_file_read.c +++ b/common/src/fx_file_read.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -70,15 +71,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), verified */ -/* memcpy usage, */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_file_read(FX_FILE *file_ptr, VOID *buffer_ptr, ULONG request_size, ULONG *actual_size) { diff --git a/common/src/fx_file_relative_seek.c b/common/src/fx_file_relative_seek.c index 88cb896..bcce8cb 100644 --- a/common/src/fx_file_relative_seek.c +++ b/common/src/fx_file_relative_seek.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -68,16 +69,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), and */ -/* Added conditional to */ -/* disable one line function, */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ #ifndef FX_DISABLE_ONE_LINE_FUNCTION UINT _fx_file_relative_seek(FX_FILE *file_ptr, ULONG byte_offset, UINT seek_from) diff --git a/common/src/fx_file_rename.c b/common/src/fx_file_rename.c index bf9520d..6c2b111 100644 --- a/common/src/fx_file_rename.c +++ b/common/src/fx_file_rename.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -78,14 +79,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_file_rename(FX_MEDIA *media_ptr, CHAR *old_file_name, CHAR *new_file_name) { diff --git a/common/src/fx_file_seek.c b/common/src/fx_file_seek.c index e98bb28..92604a6 100644 --- a/common/src/fx_file_seek.c +++ b/common/src/fx_file_seek.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -62,16 +63,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), and */ -/* Added conditional to */ -/* disable one line function, */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ #ifndef FX_DISABLE_ONE_LINE_FUNCTION UINT _fx_file_seek(FX_FILE *file_ptr, ULONG byte_offset) diff --git a/common/src/fx_file_truncate.c b/common/src/fx_file_truncate.c index 747e180..f3231b5 100644 --- a/common/src/fx_file_truncate.c +++ b/common/src/fx_file_truncate.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -62,16 +63,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), and */ -/* Added conditional to */ -/* disable one line function, */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ #ifndef FX_DISABLE_ONE_LINE_FUNCTION UINT _fx_file_truncate(FX_FILE *file_ptr, ULONG size) diff --git a/common/src/fx_file_truncate_release.c b/common/src/fx_file_truncate_release.c index 99ba076..066e7f9 100644 --- a/common/src/fx_file_truncate_release.c +++ b/common/src/fx_file_truncate_release.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -64,16 +65,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), and */ -/* Added conditional to */ -/* disable one line function, */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ #ifndef FX_DISABLE_ONE_LINE_FUNCTION UINT _fx_file_truncate_release(FX_FILE *file_ptr, ULONG size) diff --git a/common/src/fx_file_write.c b/common/src/fx_file_write.c index 19c0a84..2133b13 100644 --- a/common/src/fx_file_write.c +++ b/common/src/fx_file_write.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -81,15 +82,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), verified */ -/* memcpy usage, */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_file_write(FX_FILE *file_ptr, VOID *buffer_ptr, ULONG size) { diff --git a/common/src/fx_file_write_notify_set.c b/common/src/fx_file_write_notify_set.c index 199c8a2..3a48256 100644 --- a/common/src/fx_file_write_notify_set.c +++ b/common/src/fx_file_write_notify_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -61,14 +62,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_file_write_notify_set(FX_FILE *file_ptr, VOID (*file_write_notify)(FX_FILE *file)) { diff --git a/common/src/fx_media_abort.c b/common/src/fx_media_abort.c index a5d82b8..e90e74c 100644 --- a/common/src/fx_media_abort.c +++ b/common/src/fx_media_abort.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -63,14 +64,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_media_abort(FX_MEDIA *media_ptr) { diff --git a/common/src/fx_media_boot_info_extract.c b/common/src/fx_media_boot_info_extract.c index 2124fb5..c4e65c9 100644 --- a/common/src/fx_media_boot_info_extract.c +++ b/common/src/fx_media_boot_info_extract.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -102,17 +103,6 @@ /* */ /* _fx_media_open Media open function */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* 01-31-2022 Bhupendra Naphade Modified comment(s), added */ -/* check for bimap cache size, */ -/* resulting in version 6.1.10 */ -/* */ /**************************************************************************/ UINT _fx_media_boot_info_extract(FX_MEDIA *media_ptr) { diff --git a/common/src/fx_media_cache_invalidate.c b/common/src/fx_media_cache_invalidate.c index 23f80d3..e528a24 100644 --- a/common/src/fx_media_cache_invalidate.c +++ b/common/src/fx_media_cache_invalidate.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -63,14 +64,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_media_cache_invalidate(FX_MEDIA *media_ptr) { diff --git a/common/src/fx_media_check.c b/common/src/fx_media_check.c index 4ced68d..f1e8625 100644 --- a/common/src/fx_media_check.c +++ b/common/src/fx_media_check.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -154,14 +155,6 @@ typedef struct CURRENT_DIRECTORY_ENTRY_STRUCT /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_media_check(FX_MEDIA *media_ptr, UCHAR *scratch_memory_ptr, ULONG scratch_memory_size, ULONG error_correction_option, ULONG *errors_detected) { diff --git a/common/src/fx_media_check_FAT_chain_check.c b/common/src/fx_media_check_FAT_chain_check.c index fd8ffdd..17791d0 100644 --- a/common/src/fx_media_check_FAT_chain_check.c +++ b/common/src/fx_media_check_FAT_chain_check.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -67,14 +68,6 @@ /* */ /* _fx_check_media Check media function */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ ULONG _fx_media_check_FAT_chain_check(FX_MEDIA *media_ptr, ULONG starting_cluster, ULONG *last_valid_cluster, ULONG *total_valid_clusters, UCHAR *logical_fat) { diff --git a/common/src/fx_media_check_lost_cluster_check.c b/common/src/fx_media_check_lost_cluster_check.c index 40a7e79..fb6dc32 100644 --- a/common/src/fx_media_check_lost_cluster_check.c +++ b/common/src/fx_media_check_lost_cluster_check.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -68,14 +69,6 @@ /* */ /* _fx_check_media Check media function */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ ULONG _fx_media_check_lost_cluster_check(FX_MEDIA *media_ptr, UCHAR *logical_fat, ULONG total_clusters, ULONG error_correction_option) { diff --git a/common/src/fx_media_close.c b/common/src/fx_media_close.c index 5beff0f..00780c4 100644 --- a/common/src/fx_media_close.c +++ b/common/src/fx_media_close.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -77,17 +78,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), and */ -/* added conditional to */ -/* disable file close */ -/* and cache, */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_media_close(FX_MEDIA *media_ptr) { diff --git a/common/src/fx_media_close_notify_set.c b/common/src/fx_media_close_notify_set.c index 1f6a3b7..2e79f0e 100644 --- a/common/src/fx_media_close_notify_set.c +++ b/common/src/fx_media_close_notify_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -60,14 +61,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_media_close_notify_set(FX_MEDIA *media_ptr, VOID (*media_close_notify)(FX_MEDIA *media)) { diff --git a/common/src/fx_media_extended_space_available.c b/common/src/fx_media_extended_space_available.c index 6f8e093..c9babcf 100644 --- a/common/src/fx_media_extended_space_available.c +++ b/common/src/fx_media_extended_space_available.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -62,14 +63,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_media_extended_space_available(FX_MEDIA *media_ptr, ULONG64 *available_bytes_ptr) { diff --git a/common/src/fx_media_flush.c b/common/src/fx_media_flush.c index 5d75a49..2d9e4c3 100644 --- a/common/src/fx_media_flush.c +++ b/common/src/fx_media_flush.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -72,16 +73,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), and */ -/* added conditional to */ -/* disable cache, */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_media_flush(FX_MEDIA *media_ptr) { diff --git a/common/src/fx_media_format.c b/common/src/fx_media_format.c index 884076e..a1863e0 100644 --- a/common/src/fx_media_format.c +++ b/common/src/fx_media_format.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -105,25 +106,6 @@ ULONG _fx_media_format_volume_id = 1; /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), and */ -/* added conditional to */ -/* disable force memset, */ -/* resulting in version 6.1 */ -/* 03-02-2021 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1.5 */ -/* 08-02-2021 Bhupendra Naphade Modified comment(s), and */ -/* updated boot write logic, */ -/* resulting in version 6.1.8 */ -/* 04-25-2022 Bhupendra Naphade Modified comment(s), and */ -/* updated reserved FAT entry */ -/* value, */ -/* resulting in version 6.1.11 */ -/* */ /**************************************************************************/ UINT _fx_media_format(FX_MEDIA *media_ptr, VOID (*driver)(FX_MEDIA *media), VOID *driver_info_ptr, UCHAR *memory_ptr, UINT memory_size, CHAR *volume_name, UINT number_of_fats, UINT directory_entries, UINT hidden_sectors, diff --git a/common/src/fx_media_format_oem_name_set.c b/common/src/fx_media_format_oem_name_set.c index 10c6d17..9d257db 100644 --- a/common/src/fx_media_format_oem_name_set.c +++ b/common/src/fx_media_format_oem_name_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -65,16 +66,6 @@ UINT fx_media_format_oem_name_set(UCHAR new_oem_name[8]); /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* 03-02-2021 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1.5 */ -/* */ /**************************************************************************/ UINT fx_media_format_oem_name_set(UCHAR new_oem_name[8]) { diff --git a/common/src/fx_media_format_type_set.c b/common/src/fx_media_format_type_set.c index e73a5a8..e8541da 100644 --- a/common/src/fx_media_format_type_set.c +++ b/common/src/fx_media_format_type_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -64,16 +65,6 @@ UINT fx_media_format_type_set(UCHAR new_media_type); /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* 03-02-2021 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1.5 */ -/* */ /**************************************************************************/ UINT fx_media_format_type_set(UCHAR new_media_type) { diff --git a/common/src/fx_media_format_volume_id_set.c b/common/src/fx_media_format_volume_id_set.c index 5add908..c03db6f 100644 --- a/common/src/fx_media_format_volume_id_set.c +++ b/common/src/fx_media_format_volume_id_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -65,16 +66,6 @@ UINT fx_media_format_volume_id_set(ULONG new_volume_id); /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* 03-02-2021 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1.5 */ -/* */ /**************************************************************************/ UINT fx_media_format_volume_id_set(ULONG new_volume_id) { diff --git a/common/src/fx_media_open.c b/common/src/fx_media_open.c index 3fa7f91..23eba72 100644 --- a/common/src/fx_media_open.c +++ b/common/src/fx_media_open.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -117,24 +118,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), and */ -/* added conditional to */ -/* disable force memset, */ -/* build options and cache, */ -/* resulting in version 6.1 */ -/* 01-31-2022 William E. Lamie Modified comment(s), fixed */ -/* errors without cache, */ -/* resulting in version 6.1.10 */ -/* 10-31-2022 Tiejun Zhou Modified comment(s), */ -/* fixed memory buffer when */ -/* cache is disabled, */ -/* resulting in version 6.2.0 */ -/* */ /**************************************************************************/ UINT _fx_media_open(FX_MEDIA *media_ptr, CHAR *media_name, VOID (*media_driver)(FX_MEDIA *), VOID *driver_info_ptr, diff --git a/common/src/fx_media_open_notify_set.c b/common/src/fx_media_open_notify_set.c index f193543..4b34b32 100644 --- a/common/src/fx_media_open_notify_set.c +++ b/common/src/fx_media_open_notify_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -60,14 +61,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_media_open_notify_set(FX_MEDIA *media_ptr, VOID (*media_open_notify)(FX_MEDIA *media)) { diff --git a/common/src/fx_media_read.c b/common/src/fx_media_read.c index 713771d..7bb0a84 100644 --- a/common/src/fx_media_read.c +++ b/common/src/fx_media_read.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -63,14 +64,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_media_read(FX_MEDIA *media_ptr, ULONG logical_sector, VOID *buffer_ptr) { diff --git a/common/src/fx_media_space_available.c b/common/src/fx_media_space_available.c index dac5fd6..6e88d64 100644 --- a/common/src/fx_media_space_available.c +++ b/common/src/fx_media_space_available.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -64,14 +65,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_media_space_available(FX_MEDIA *media_ptr, ULONG *available_bytes_ptr) { diff --git a/common/src/fx_media_volume_get.c b/common/src/fx_media_volume_get.c index 41db8c1..8a9de71 100644 --- a/common/src/fx_media_volume_get.c +++ b/common/src/fx_media_volume_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -70,14 +71,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_media_volume_get(FX_MEDIA *media_ptr, CHAR *volume_name, UINT volume_source) { diff --git a/common/src/fx_media_volume_get_extended.c b/common/src/fx_media_volume_get_extended.c index d23c47d..54e6575 100644 --- a/common/src/fx_media_volume_get_extended.c +++ b/common/src/fx_media_volume_get_extended.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -68,18 +69,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* 04-25-2022 Bhupendra Naphade Modified comment(s), and */ -/* updated check for */ -/* volume name, */ -/* resulting in version 6.1.11 */ -/* */ /**************************************************************************/ UINT _fx_media_volume_get_extended(FX_MEDIA *media_ptr, CHAR *volume_name, UINT volume_name_buffer_length, UINT volume_source) { diff --git a/common/src/fx_media_volume_set.c b/common/src/fx_media_volume_set.c index 5fc035f..6d905ad 100644 --- a/common/src/fx_media_volume_set.c +++ b/common/src/fx_media_volume_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -65,14 +66,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_media_volume_set(FX_MEDIA *media_ptr, CHAR *volume_name) { diff --git a/common/src/fx_media_write.c b/common/src/fx_media_write.c index 49b5cc0..d78f7de 100644 --- a/common/src/fx_media_write.c +++ b/common/src/fx_media_write.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -63,14 +64,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_media_write(FX_MEDIA *media_ptr, ULONG logical_sector, VOID *buffer_ptr) { diff --git a/common/src/fx_partition_offset_calculate.c b/common/src/fx_partition_offset_calculate.c index c0d3c09..34b5771 100644 --- a/common/src/fx_partition_offset_calculate.c +++ b/common/src/fx_partition_offset_calculate.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -112,18 +113,6 @@ UINT _fx_partition_offset_calculate_extended(FX_MEDIA *media_ptr, void *part /* */ /* Application Driver */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* 04-02-2021 William E. Lamie Modified comment(s), */ -/* ignored signature check for */ -/* no partition situation, */ -/* resulting in version 6.1.6 */ -/* */ /**************************************************************************/ UINT _fx_partition_offset_calculate(void *partition_sector, UINT partition, ULONG *partition_start, ULONG *partition_size) @@ -265,16 +254,6 @@ UCHAR *partition_sector_ptr; /* */ /* _fx_partition_offset_calculate Calculate partition offset */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* 04-02-2021 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1.6 */ -/* */ /**************************************************************************/ UINT _fx_utility_partition_get(FX_MEDIA_PARTITION *partition_table, UINT *count, ULONG sector, UCHAR *sector_buffer) @@ -373,12 +352,6 @@ ULONG base_sector, value; /* */ /* Application Driver */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 10-31-2022 Xiuwen Cai Initial Version 6.2.0 */ -/* */ /**************************************************************************/ UINT _fx_partition_offset_calculate_extended(FX_MEDIA *media_ptr, void *partition_sector, UINT partition, ULONG *partition_start, ULONG *partition_size) diff --git a/common/src/fx_ram_driver.c b/common/src/fx_ram_driver.c index c51e0fe..e6ad6ec 100644 --- a/common/src/fx_ram_driver.c +++ b/common/src/fx_ram_driver.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -98,16 +99,6 @@ VOID _fx_ram_driver(FX_MEDIA *media_ptr); /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* 03-02-2021 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1.5 */ -/* */ /**************************************************************************/ VOID _fx_ram_driver(FX_MEDIA *media_ptr) { diff --git a/common/src/fx_system_date_get.c b/common/src/fx_system_date_get.c index 78a2588..3bea9f4 100644 --- a/common/src/fx_system_date_get.c +++ b/common/src/fx_system_date_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -61,17 +62,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* 06-02-2021 William E. Lamie Modified comment(s), */ -/* checked null pointer, */ -/* resulting in version 6.1.7 */ -/* */ /**************************************************************************/ UINT _fx_system_date_get(UINT *year, UINT *month, UINT *day) { diff --git a/common/src/fx_system_date_set.c b/common/src/fx_system_date_set.c index d7458a2..5fab425 100644 --- a/common/src/fx_system_date_set.c +++ b/common/src/fx_system_date_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -61,14 +62,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_system_date_set(UINT year, UINT month, UINT day) { diff --git a/common/src/fx_system_initialize.c b/common/src/fx_system_initialize.c index a3041e0..15377ee 100644 --- a/common/src/fx_system_initialize.c +++ b/common/src/fx_system_initialize.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -64,16 +65,6 @@ /* */ /* Application Initialization */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), and */ -/* added conditional to */ -/* disable build options, */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ VOID _fx_system_initialize(VOID) { diff --git a/common/src/fx_system_time_get.c b/common/src/fx_system_time_get.c index e9b724d..a7ee225 100644 --- a/common/src/fx_system_time_get.c +++ b/common/src/fx_system_time_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -61,17 +62,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* 06-02-2021 William E. Lamie Modified comment(s), */ -/* checked null pointer, */ -/* resulting in version 6.1.7 */ -/* */ /**************************************************************************/ UINT _fx_system_time_get(UINT *hour, UINT *minute, UINT *second) { diff --git a/common/src/fx_system_time_set.c b/common/src/fx_system_time_set.c index eb06ab6..0dbdeec 100644 --- a/common/src/fx_system_time_set.c +++ b/common/src/fx_system_time_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -61,14 +62,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_system_time_set(UINT hour, UINT minute, UINT second) { diff --git a/common/src/fx_system_timer_entry.c b/common/src/fx_system_timer_entry.c index cdb15bc..81c71b0 100644 --- a/common/src/fx_system_timer_entry.c +++ b/common/src/fx_system_timer_entry.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -60,14 +61,6 @@ /* */ /* Application Initialization */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ VOID _fx_system_timer_entry(ULONG id) { diff --git a/common/src/fx_trace_event_insert.c b/common/src/fx_trace_event_insert.c index 085bc42..c9b3b90 100644 --- a/common/src/fx_trace_event_insert.c +++ b/common/src/fx_trace_event_insert.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -72,14 +73,6 @@ /* */ /* Internal FileX Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ VOID _fx_trace_event_insert(ULONG event_id, ULONG info_field_1, ULONG info_field_2, ULONG info_field_3, ULONG info_field_4, ULONG filter, TX_TRACE_BUFFER_ENTRY **current_event, ULONG *current_timestamp) { diff --git a/common/src/fx_trace_event_update.c b/common/src/fx_trace_event_update.c index f800c34..64f3241 100644 --- a/common/src/fx_trace_event_update.c +++ b/common/src/fx_trace_event_update.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -68,14 +69,6 @@ /* */ /* Internal FileX Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ VOID _fx_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, ULONG event_id, ULONG info_field_1, ULONG info_field_2, ULONG info_field_3, ULONG info_field_4) { diff --git a/common/src/fx_trace_object_register.c b/common/src/fx_trace_object_register.c index 4e4fcd4..e706a6b 100644 --- a/common/src/fx_trace_object_register.c +++ b/common/src/fx_trace_object_register.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -70,14 +71,6 @@ /* */ /* Application Initialization */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ VOID _fx_trace_object_register(UCHAR object_type, VOID *object_ptr, CHAR *object_name, ULONG parameter_1, ULONG parameter_2) { diff --git a/common/src/fx_trace_object_unregister.c b/common/src/fx_trace_object_unregister.c index 7db5b8b..81e52d4 100644 --- a/common/src/fx_trace_object_unregister.c +++ b/common/src/fx_trace_object_unregister.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -68,14 +69,6 @@ /* */ /* FileX delete functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ VOID _fx_trace_object_unregister(VOID *object_ptr) { diff --git a/common/src/fx_unicode_directory_create.c b/common/src/fx_unicode_directory_create.c index abee264..04a8be1 100644 --- a/common/src/fx_unicode_directory_create.c +++ b/common/src/fx_unicode_directory_create.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -74,14 +75,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_unicode_directory_create(FX_MEDIA *media_ptr, UCHAR *source_unicode_name, ULONG source_unicode_length, CHAR *short_name) { diff --git a/common/src/fx_unicode_directory_entry_change.c b/common/src/fx_unicode_directory_entry_change.c index b3eab3d..503dc49 100644 --- a/common/src/fx_unicode_directory_entry_change.c +++ b/common/src/fx_unicode_directory_entry_change.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -68,14 +69,6 @@ /* */ /* Unicode Utilities */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_unicode_directory_entry_change(FX_MEDIA *media_ptr, FX_DIR_ENTRY *entry_ptr, UCHAR *unicode_name, ULONG unicode_name_length) { diff --git a/common/src/fx_unicode_directory_entry_read.c b/common/src/fx_unicode_directory_entry_read.c index 91d0b8a..f263b42 100644 --- a/common/src/fx_unicode_directory_entry_read.c +++ b/common/src/fx_unicode_directory_entry_read.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -67,14 +68,6 @@ /* */ /* Unicode Utilities */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_unicode_directory_entry_read(FX_MEDIA *media_ptr, FX_DIR_ENTRY *source_dir, ULONG *entry_ptr, FX_DIR_ENTRY *destination_ptr, diff --git a/common/src/fx_unicode_directory_rename.c b/common/src/fx_unicode_directory_rename.c index c3c3885..af68c86 100644 --- a/common/src/fx_unicode_directory_rename.c +++ b/common/src/fx_unicode_directory_rename.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -76,14 +77,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_unicode_directory_rename(FX_MEDIA *media_ptr, UCHAR *old_unicode_name, ULONG old_unicode_length, UCHAR *new_unicode_name, ULONG new_unicode_length, CHAR *new_short_name) diff --git a/common/src/fx_unicode_directory_search.c b/common/src/fx_unicode_directory_search.c index bd1caa0..6878998 100644 --- a/common/src/fx_unicode_directory_search.c +++ b/common/src/fx_unicode_directory_search.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -92,14 +93,6 @@ UCHAR _fx_unicode_search_name[FX_MAX_LONG_NAME_LEN * 2]; /* */ /* Unicode Utilities */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_unicode_directory_search(FX_MEDIA *media_ptr, FX_DIR_ENTRY *entry_ptr, UCHAR *short_name, ULONG short_name_buffer_length, diff --git a/common/src/fx_unicode_file_create.c b/common/src/fx_unicode_file_create.c index 57bb58b..5befae9 100644 --- a/common/src/fx_unicode_file_create.c +++ b/common/src/fx_unicode_file_create.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -75,14 +76,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_unicode_file_create(FX_MEDIA *media_ptr, UCHAR *source_unicode_name, ULONG source_unicode_length, CHAR *short_name) { diff --git a/common/src/fx_unicode_file_rename.c b/common/src/fx_unicode_file_rename.c index e3ee0a9..798ae03 100644 --- a/common/src/fx_unicode_file_rename.c +++ b/common/src/fx_unicode_file_rename.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -79,14 +80,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_unicode_file_rename(FX_MEDIA *media_ptr, UCHAR *old_unicode_name, ULONG old_unicode_length, UCHAR *new_unicode_name, ULONG new_unicode_length, CHAR *new_short_name) diff --git a/common/src/fx_unicode_length_get.c b/common/src/fx_unicode_length_get.c index c393146..35ee544 100644 --- a/common/src/fx_unicode_length_get.c +++ b/common/src/fx_unicode_length_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -62,14 +63,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ ULONG _fx_unicode_length_get(UCHAR *unicode_name) { diff --git a/common/src/fx_unicode_length_get_extended.c b/common/src/fx_unicode_length_get_extended.c index f9f2238..d2cf259 100644 --- a/common/src/fx_unicode_length_get_extended.c +++ b/common/src/fx_unicode_length_get_extended.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -59,14 +60,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ ULONG _fx_unicode_length_get_extended(UCHAR *unicode_name, UINT buffer_length) { diff --git a/common/src/fx_unicode_name_get.c b/common/src/fx_unicode_name_get.c index 3376767..50435af 100644 --- a/common/src/fx_unicode_name_get.c +++ b/common/src/fx_unicode_name_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -67,14 +68,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_unicode_name_get(FX_MEDIA *media_ptr, CHAR *source_short_name, UCHAR *destination_unicode_name, ULONG *destination_unicode_length) diff --git a/common/src/fx_unicode_name_get_extended.c b/common/src/fx_unicode_name_get_extended.c index 5c27913..60a342f 100644 --- a/common/src/fx_unicode_name_get_extended.c +++ b/common/src/fx_unicode_name_get_extended.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -63,14 +64,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_unicode_name_get_extended(FX_MEDIA *media_ptr, CHAR *source_short_name, UCHAR *destination_unicode_name, ULONG *destination_unicode_length, ULONG unicode_name_buffer_length) diff --git a/common/src/fx_unicode_short_name_get.c b/common/src/fx_unicode_short_name_get.c index c329763..b0a6fa3 100644 --- a/common/src/fx_unicode_short_name_get.c +++ b/common/src/fx_unicode_short_name_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -67,14 +68,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_unicode_short_name_get(FX_MEDIA *media_ptr, UCHAR *source_unicode_name, ULONG source_unicode_length, CHAR *destination_short_name) diff --git a/common/src/fx_unicode_short_name_get_extended.c b/common/src/fx_unicode_short_name_get_extended.c index 8547d73..d9a3003 100644 --- a/common/src/fx_unicode_short_name_get_extended.c +++ b/common/src/fx_unicode_short_name_get_extended.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -63,14 +64,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_unicode_short_name_get_extended(FX_MEDIA *media_ptr, UCHAR *source_unicode_name, ULONG source_unicode_length, CHAR *destination_short_name, ULONG short_name_buffer_length) diff --git a/common/src/fx_utility_16_unsigned_read.c b/common/src/fx_utility_16_unsigned_read.c index ed7dae9..31928cb 100644 --- a/common/src/fx_utility_16_unsigned_read.c +++ b/common/src/fx_utility_16_unsigned_read.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -60,14 +61,6 @@ /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_utility_16_unsigned_read(UCHAR *source_ptr) { diff --git a/common/src/fx_utility_16_unsigned_write.c b/common/src/fx_utility_16_unsigned_write.c index c022167..75a1f23 100644 --- a/common/src/fx_utility_16_unsigned_write.c +++ b/common/src/fx_utility_16_unsigned_write.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -61,14 +62,6 @@ /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ VOID _fx_utility_16_unsigned_write(UCHAR *dest_ptr, UINT value) { diff --git a/common/src/fx_utility_32_unsigned_read.c b/common/src/fx_utility_32_unsigned_read.c index 3f90f7b..331bae4 100644 --- a/common/src/fx_utility_32_unsigned_read.c +++ b/common/src/fx_utility_32_unsigned_read.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -60,14 +61,6 @@ /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ ULONG _fx_utility_32_unsigned_read(UCHAR *source_ptr) { diff --git a/common/src/fx_utility_32_unsigned_write.c b/common/src/fx_utility_32_unsigned_write.c index aac6eb4..6a04e4f 100644 --- a/common/src/fx_utility_32_unsigned_write.c +++ b/common/src/fx_utility_32_unsigned_write.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -61,14 +62,6 @@ /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ VOID _fx_utility_32_unsigned_write(UCHAR *dest_ptr, ULONG value) { diff --git a/common/src/fx_utility_64_unsigned_read.c b/common/src/fx_utility_64_unsigned_read.c index 687bb72..0ec7836 100644 --- a/common/src/fx_utility_64_unsigned_read.c +++ b/common/src/fx_utility_64_unsigned_read.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -60,14 +61,6 @@ /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ ULONG64 _fx_utility_64_unsigned_read(UCHAR *source_ptr) { diff --git a/common/src/fx_utility_64_unsigned_write.c b/common/src/fx_utility_64_unsigned_write.c index 3445477..dbd0711 100644 --- a/common/src/fx_utility_64_unsigned_write.c +++ b/common/src/fx_utility_64_unsigned_write.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -61,14 +62,6 @@ /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ VOID _fx_utility_64_unsigned_write(UCHAR *dest_ptr, ULONG64 value) { diff --git a/common/src/fx_utility_FAT_entry_read.c b/common/src/fx_utility_FAT_entry_read.c index a9d0391..c221f72 100644 --- a/common/src/fx_utility_FAT_entry_read.c +++ b/common/src/fx_utility_FAT_entry_read.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -70,19 +71,6 @@ /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), and */ -/* added conditional to */ -/* disable fat entry refresh, */ -/* resulting in version 6.1 */ -/* 10-31-2022 Tiejun Zhou Modified comment(s), and */ -/* fixed compiler warning, */ -/* resulting in version 6.2.0 */ -/* */ /**************************************************************************/ UINT _fx_utility_FAT_entry_read(FX_MEDIA *media_ptr, ULONG cluster, ULONG *entry_ptr) { diff --git a/common/src/fx_utility_FAT_entry_write.c b/common/src/fx_utility_FAT_entry_write.c index a6b03e8..aae0e56 100644 --- a/common/src/fx_utility_FAT_entry_write.c +++ b/common/src/fx_utility_FAT_entry_write.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -67,14 +68,6 @@ /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_utility_FAT_entry_write(FX_MEDIA *media_ptr, ULONG cluster, ULONG next_cluster) { diff --git a/common/src/fx_utility_FAT_flush.c b/common/src/fx_utility_FAT_flush.c index 99876c2..2d6b890 100644 --- a/common/src/fx_utility_FAT_flush.c +++ b/common/src/fx_utility_FAT_flush.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -64,18 +65,6 @@ /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* 11-09-2020 William E. Lamie Modified comment(s), */ -/* updated logic for */ -/* FAT secondary update map, */ -/* resulting in version 6.1.2 */ -/* */ /**************************************************************************/ UINT _fx_utility_FAT_flush(FX_MEDIA *media_ptr) { diff --git a/common/src/fx_utility_FAT_map_flush.c b/common/src/fx_utility_FAT_map_flush.c index 1ff6644..a92cb61 100644 --- a/common/src/fx_utility_FAT_map_flush.c +++ b/common/src/fx_utility_FAT_map_flush.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -61,14 +62,6 @@ /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_utility_FAT_map_flush(FX_MEDIA *media_ptr) { diff --git a/common/src/fx_utility_FAT_sector_get.c b/common/src/fx_utility_FAT_sector_get.c index 491120c..dcadf27 100644 --- a/common/src/fx_utility_FAT_sector_get.c +++ b/common/src/fx_utility_FAT_sector_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -58,14 +59,6 @@ /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ ULONG _fx_utility_FAT_sector_get(FX_MEDIA *media_ptr, ULONG cluster) { diff --git a/common/src/fx_utility_absolute_path_get.c b/common/src/fx_utility_absolute_path_get.c index 113146c..08b1220 100644 --- a/common/src/fx_utility_absolute_path_get.c +++ b/common/src/fx_utility_absolute_path_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ diff --git a/common/src/fx_utility_logical_sector_cache_entry_read.c b/common/src/fx_utility_logical_sector_cache_entry_read.c index 7aaa676..af2aff9 100644 --- a/common/src/fx_utility_logical_sector_cache_entry_read.c +++ b/common/src/fx_utility_logical_sector_cache_entry_read.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -65,19 +66,6 @@ /* */ /* _fx_utility_logical_sector_read Logical sector read function */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), and */ -/* added conditional to */ -/* disable cache, */ -/* resulting in version 6.1 */ -/* 01-31-2022 William E. Lamie Modified comment(s), fixed */ -/* errors without cache, */ -/* resulting in version 6.1.10 */ -/* */ /**************************************************************************/ FX_CACHED_SECTOR *_fx_utility_logical_sector_cache_entry_read(FX_MEDIA *media_ptr, ULONG64 logical_sector, FX_CACHED_SECTOR **previous_cache_entry) diff --git a/common/src/fx_utility_logical_sector_flush.c b/common/src/fx_utility_logical_sector_flush.c index 6522140..579e99b 100644 --- a/common/src/fx_utility_logical_sector_flush.c +++ b/common/src/fx_utility_logical_sector_flush.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -66,19 +67,6 @@ /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), and */ -/* added conditional to */ -/* disable cache, */ -/* resulting in version 6.1 */ -/* 01-31-2022 William E. Lamie Modified comment(s), fixed */ -/* errors without cache, */ -/* resulting in version 6.1.10 */ -/* */ /**************************************************************************/ UINT _fx_utility_logical_sector_flush(FX_MEDIA *media_ptr, ULONG64 starting_sector, ULONG64 sectors, UINT invalidate) { diff --git a/common/src/fx_utility_logical_sector_read.c b/common/src/fx_utility_logical_sector_read.c index ddf65c2..8dc8c0f 100644 --- a/common/src/fx_utility_logical_sector_read.c +++ b/common/src/fx_utility_logical_sector_read.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -81,25 +82,6 @@ /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* verified memcpy usage, and */ -/* added conditional to */ -/* disable cache, */ -/* resulting in version 6.1 */ -/* 04-02-2021 Bhupendra Naphade Modified comment(s), */ -/* updated check for logical */ -/* sector value, */ -/* resulting in version 6.1.6 */ -/* 10-31-2022 Tiejun Zhou Modified comment(s), */ -/* fixed memory buffer when */ -/* cache is disabled, */ -/* resulting in version 6.2.0 */ -/* */ /**************************************************************************/ UINT _fx_utility_logical_sector_read(FX_MEDIA *media_ptr, ULONG64 logical_sector, VOID *buffer_ptr, ULONG sectors, UCHAR sector_type) diff --git a/common/src/fx_utility_logical_sector_write.c b/common/src/fx_utility_logical_sector_write.c index b0436c0..9da0ffc 100644 --- a/common/src/fx_utility_logical_sector_write.c +++ b/common/src/fx_utility_logical_sector_write.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -77,20 +78,6 @@ /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), and */ -/* added conditional to */ -/* disable cache, */ -/* resulting in version 6.1 */ -/* 04-02-2021 Bhupendra Naphade Modified comment(s), */ -/* updated check for logical */ -/* sector value, */ -/* resulting in version 6.1.6 */ -/* */ /**************************************************************************/ UINT _fx_utility_logical_sector_write(FX_MEDIA *media_ptr, ULONG64 logical_sector, VOID *buffer_ptr, ULONG sectors, UCHAR sector_type) diff --git a/common/src/fx_utility_memory_copy.c b/common/src/fx_utility_memory_copy.c index 5ef8307..304a10a 100644 --- a/common/src/fx_utility_memory_copy.c +++ b/common/src/fx_utility_memory_copy.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -69,15 +70,6 @@ /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), verified */ -/* memcpy usage, */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ VOID _fx_utility_memory_copy(UCHAR *source_ptr, UCHAR *dest_ptr, ULONG size) { diff --git a/common/src/fx_utility_memory_set.c b/common/src/fx_utility_memory_set.c index a32db97..a399a07 100644 --- a/common/src/fx_utility_memory_set.c +++ b/common/src/fx_utility_memory_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -69,14 +70,6 @@ /* */ /* FileX System Functions */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ VOID _fx_utility_memory_set(UCHAR *dest_ptr, UCHAR value, ULONG size) { diff --git a/common/src/fx_utility_string_length_get.c b/common/src/fx_utility_string_length_get.c index a31c7d5..cebc801 100644 --- a/common/src/fx_utility_string_length_get.c +++ b/common/src/fx_utility_string_length_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -60,14 +61,6 @@ /* */ /* _fx_utility_absolute_path_get Get absolute path */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fx_utility_string_length_get(CHAR *string, UINT max_length) { diff --git a/common/src/fx_utility_token_length_get.c b/common/src/fx_utility_token_length_get.c index 36fcc6b..3517b01 100644 --- a/common/src/fx_utility_token_length_get.c +++ b/common/src/fx_utility_token_length_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ diff --git a/common/src/fxe_directory_attributes_read.c b/common/src/fxe_directory_attributes_read.c index fd5cc94..5da3930 100644 --- a/common/src/fxe_directory_attributes_read.c +++ b/common/src/fxe_directory_attributes_read.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -63,14 +64,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_attributes_read(FX_MEDIA *media_ptr, CHAR *directory_name, UINT *attributes_ptr) { diff --git a/common/src/fxe_directory_attributes_set.c b/common/src/fxe_directory_attributes_set.c index dd62746..7649bd1 100644 --- a/common/src/fxe_directory_attributes_set.c +++ b/common/src/fxe_directory_attributes_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -64,14 +65,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_attributes_set(FX_MEDIA *media_ptr, CHAR *directory_name, UINT attributes) { diff --git a/common/src/fxe_directory_create.c b/common/src/fxe_directory_create.c index 07e5874..0caf7b5 100644 --- a/common/src/fxe_directory_create.c +++ b/common/src/fxe_directory_create.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -61,14 +62,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_create(FX_MEDIA *media_ptr, CHAR *directory_name) { diff --git a/common/src/fxe_directory_default_get.c b/common/src/fxe_directory_default_get.c index 4b8e8fc..31cb03a 100644 --- a/common/src/fxe_directory_default_get.c +++ b/common/src/fxe_directory_default_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -63,14 +64,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_default_get(FX_MEDIA *media_ptr, CHAR **return_path_name) { diff --git a/common/src/fxe_directory_default_get_copy.c b/common/src/fxe_directory_default_get_copy.c index 09078fa..50521df 100644 --- a/common/src/fxe_directory_default_get_copy.c +++ b/common/src/fxe_directory_default_get_copy.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -64,14 +65,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_default_get_copy(FX_MEDIA *media_ptr, CHAR *return_path_name_buffer, UINT return_path_name_buffer_size) { diff --git a/common/src/fxe_directory_default_set.c b/common/src/fxe_directory_default_set.c index 7938f9d..9cb7a57 100644 --- a/common/src/fxe_directory_default_set.c +++ b/common/src/fxe_directory_default_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -63,14 +64,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_default_set(FX_MEDIA *media_ptr, CHAR *new_path_name) { diff --git a/common/src/fxe_directory_delete.c b/common/src/fxe_directory_delete.c index 257f101..0f03da1 100644 --- a/common/src/fxe_directory_delete.c +++ b/common/src/fxe_directory_delete.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -60,14 +61,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_delete(FX_MEDIA *media_ptr, CHAR *directory_name) { diff --git a/common/src/fxe_directory_first_entry_find.c b/common/src/fxe_directory_first_entry_find.c index b022d63..f9df319 100644 --- a/common/src/fxe_directory_first_entry_find.c +++ b/common/src/fxe_directory_first_entry_find.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -62,14 +63,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_first_entry_find(FX_MEDIA *media_ptr, CHAR *directory_name) { diff --git a/common/src/fxe_directory_first_full_entry_find.c b/common/src/fxe_directory_first_full_entry_find.c index 3f059a1..80d8b5d 100644 --- a/common/src/fxe_directory_first_full_entry_find.c +++ b/common/src/fxe_directory_first_full_entry_find.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -71,14 +72,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_first_full_entry_find(FX_MEDIA *media_ptr, CHAR *directory_name, UINT *attributes, ULONG *size, diff --git a/common/src/fxe_directory_information_get.c b/common/src/fxe_directory_information_get.c index 98e3412..b22fad4 100644 --- a/common/src/fxe_directory_information_get.c +++ b/common/src/fxe_directory_information_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -71,14 +72,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_information_get(FX_MEDIA *media_ptr, CHAR *directory_name, UINT *attributes, ULONG *size, diff --git a/common/src/fxe_directory_local_path_clear.c b/common/src/fxe_directory_local_path_clear.c index 441f7ec..03a5e44 100644 --- a/common/src/fxe_directory_local_path_clear.c +++ b/common/src/fxe_directory_local_path_clear.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -61,14 +62,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_local_path_clear(FX_MEDIA *media_ptr) { diff --git a/common/src/fxe_directory_local_path_get.c b/common/src/fxe_directory_local_path_get.c index 9381813..79a606a 100644 --- a/common/src/fxe_directory_local_path_get.c +++ b/common/src/fxe_directory_local_path_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -62,14 +63,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_local_path_get(FX_MEDIA *media_ptr, CHAR **return_path_name) { diff --git a/common/src/fxe_directory_local_path_get_copy.c b/common/src/fxe_directory_local_path_get_copy.c index 5dfeff5..0d77266 100644 --- a/common/src/fxe_directory_local_path_get_copy.c +++ b/common/src/fxe_directory_local_path_get_copy.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -62,14 +63,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_local_path_get_copy(FX_MEDIA *media_ptr, CHAR *return_path_name_buffer, UINT return_path_name_buffer_size) { diff --git a/common/src/fxe_directory_local_path_restore.c b/common/src/fxe_directory_local_path_restore.c index c3555d6..6b761b3 100644 --- a/common/src/fxe_directory_local_path_restore.c +++ b/common/src/fxe_directory_local_path_restore.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -62,14 +63,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_local_path_restore(FX_MEDIA *media_ptr, FX_LOCAL_PATH *local_path_ptr) { diff --git a/common/src/fxe_directory_local_path_set.c b/common/src/fxe_directory_local_path_set.c index 7a2226c..21dfda7 100644 --- a/common/src/fxe_directory_local_path_set.c +++ b/common/src/fxe_directory_local_path_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -66,14 +67,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_local_path_set(FX_MEDIA *media_ptr, FX_LOCAL_PATH *local_path_ptr, CHAR *new_path_name, UINT local_path_control_block_size) { diff --git a/common/src/fxe_directory_long_name_get.c b/common/src/fxe_directory_long_name_get.c index 3aed3ac..dabc240 100644 --- a/common/src/fxe_directory_long_name_get.c +++ b/common/src/fxe_directory_long_name_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -63,14 +64,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_long_name_get(FX_MEDIA *media_ptr, CHAR *short_file_name, CHAR *long_file_name) { diff --git a/common/src/fxe_directory_long_name_get_extended.c b/common/src/fxe_directory_long_name_get_extended.c index d01af1b..ec93ec9 100644 --- a/common/src/fxe_directory_long_name_get_extended.c +++ b/common/src/fxe_directory_long_name_get_extended.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -64,14 +65,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_long_name_get_extended(FX_MEDIA *media_ptr, CHAR *short_file_name, CHAR *long_file_name, UINT long_file_name_buffer_length) { diff --git a/common/src/fxe_directory_name_test.c b/common/src/fxe_directory_name_test.c index 56bdec1..47c55a2 100644 --- a/common/src/fxe_directory_name_test.c +++ b/common/src/fxe_directory_name_test.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -62,14 +63,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_name_test(FX_MEDIA *media_ptr, CHAR *directory_name) { diff --git a/common/src/fxe_directory_next_entry_find.c b/common/src/fxe_directory_next_entry_find.c index df052e5..ea4d2f4 100644 --- a/common/src/fxe_directory_next_entry_find.c +++ b/common/src/fxe_directory_next_entry_find.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -62,14 +63,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_next_entry_find(FX_MEDIA *media_ptr, CHAR *directory_name) { diff --git a/common/src/fxe_directory_next_full_entry_find.c b/common/src/fxe_directory_next_full_entry_find.c index 74711f7..2e5254a 100644 --- a/common/src/fxe_directory_next_full_entry_find.c +++ b/common/src/fxe_directory_next_full_entry_find.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -71,14 +72,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_next_full_entry_find(FX_MEDIA *media_ptr, CHAR *directory_name, UINT *attributes, ULONG *size, diff --git a/common/src/fxe_directory_rename.c b/common/src/fxe_directory_rename.c index 59d056a..c6a9e69 100644 --- a/common/src/fxe_directory_rename.c +++ b/common/src/fxe_directory_rename.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -62,14 +63,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_rename(FX_MEDIA *media_ptr, CHAR *old_directory_name, CHAR *new_directory_name) { diff --git a/common/src/fxe_directory_short_name_get.c b/common/src/fxe_directory_short_name_get.c index 6e7c407..45d8a0b 100644 --- a/common/src/fxe_directory_short_name_get.c +++ b/common/src/fxe_directory_short_name_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -63,14 +64,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_short_name_get(FX_MEDIA *media_ptr, CHAR *long_file_name, CHAR *short_file_name) { diff --git a/common/src/fxe_directory_short_name_get_extended.c b/common/src/fxe_directory_short_name_get_extended.c index 22c0571..4b9c75d 100644 --- a/common/src/fxe_directory_short_name_get_extended.c +++ b/common/src/fxe_directory_short_name_get_extended.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -64,14 +65,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_directory_short_name_get_extended(FX_MEDIA *media_ptr, CHAR *long_file_name, CHAR *short_file_name, UINT short_file_name_length) { diff --git a/common/src/fxe_fault_tolerant_enable.c b/common/src/fxe_fault_tolerant_enable.c index 898d87e..3aa7b2d 100644 --- a/common/src/fxe_fault_tolerant_enable.c +++ b/common/src/fxe_fault_tolerant_enable.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -64,14 +65,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_fault_tolerant_enable(FX_MEDIA *media_ptr, VOID *memory_buffer, UINT memory_size) { diff --git a/common/src/fxe_file_allocate.c b/common/src/fxe_file_allocate.c index 0285527..9865be5 100644 --- a/common/src/fxe_file_allocate.c +++ b/common/src/fxe_file_allocate.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -61,14 +62,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_allocate(FX_FILE *file_ptr, ULONG size) { diff --git a/common/src/fxe_file_attributes_read.c b/common/src/fxe_file_attributes_read.c index 8c7f5dc..1db2d00 100644 --- a/common/src/fxe_file_attributes_read.c +++ b/common/src/fxe_file_attributes_read.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -63,14 +64,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_attributes_read(FX_MEDIA *media_ptr, CHAR *file_name, UINT *attributes_ptr) { diff --git a/common/src/fxe_file_attributes_set.c b/common/src/fxe_file_attributes_set.c index a731289..507014a 100644 --- a/common/src/fxe_file_attributes_set.c +++ b/common/src/fxe_file_attributes_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -63,14 +64,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_attributes_set(FX_MEDIA *media_ptr, CHAR *file_name, UINT attributes) { diff --git a/common/src/fxe_file_best_effort_allocate.c b/common/src/fxe_file_best_effort_allocate.c index a736a13..df1ec06 100644 --- a/common/src/fxe_file_best_effort_allocate.c +++ b/common/src/fxe_file_best_effort_allocate.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -64,14 +65,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_best_effort_allocate(FX_FILE *file_ptr, ULONG size, ULONG *actual_size_allocated) { diff --git a/common/src/fxe_file_close.c b/common/src/fxe_file_close.c index dedd01b..d62cf4b 100644 --- a/common/src/fxe_file_close.c +++ b/common/src/fxe_file_close.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -60,14 +61,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_close(FX_FILE *file_ptr) { diff --git a/common/src/fxe_file_create.c b/common/src/fxe_file_create.c index a730fc4..397834f 100644 --- a/common/src/fxe_file_create.c +++ b/common/src/fxe_file_create.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -61,14 +62,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_create(FX_MEDIA *media_ptr, CHAR *file_name) { diff --git a/common/src/fxe_file_date_time_set.c b/common/src/fxe_file_date_time_set.c index fd9803d..91b34ec 100644 --- a/common/src/fxe_file_date_time_set.c +++ b/common/src/fxe_file_date_time_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -69,14 +70,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_date_time_set(FX_MEDIA *media_ptr, CHAR *file_name, UINT year, UINT month, UINT day, UINT hour, UINT minute, UINT second) diff --git a/common/src/fxe_file_delete.c b/common/src/fxe_file_delete.c index 9ca3aec..960cfb4 100644 --- a/common/src/fxe_file_delete.c +++ b/common/src/fxe_file_delete.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -60,14 +61,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_delete(FX_MEDIA *media_ptr, CHAR *file_name) { diff --git a/common/src/fxe_file_extended_allocate.c b/common/src/fxe_file_extended_allocate.c index 828c529..09d13cd 100644 --- a/common/src/fxe_file_extended_allocate.c +++ b/common/src/fxe_file_extended_allocate.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -61,14 +62,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_extended_allocate(FX_FILE *file_ptr, ULONG64 size) { diff --git a/common/src/fxe_file_extended_best_effort_allocate.c b/common/src/fxe_file_extended_best_effort_allocate.c index 329fda9..8e8ee1b 100644 --- a/common/src/fxe_file_extended_best_effort_allocate.c +++ b/common/src/fxe_file_extended_best_effort_allocate.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -64,14 +65,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_extended_best_effort_allocate(FX_FILE *file_ptr, ULONG64 size, ULONG64 *actual_size_allocated) { diff --git a/common/src/fxe_file_extended_relative_seek.c b/common/src/fxe_file_extended_relative_seek.c index 5b99469..595ed9d 100644 --- a/common/src/fxe_file_extended_relative_seek.c +++ b/common/src/fxe_file_extended_relative_seek.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -69,14 +70,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_extended_relative_seek(FX_FILE *file_ptr, ULONG64 byte_offset, UINT seek_from) { diff --git a/common/src/fxe_file_extended_seek.c b/common/src/fxe_file_extended_seek.c index bc11570..9ff51fe 100644 --- a/common/src/fxe_file_extended_seek.c +++ b/common/src/fxe_file_extended_seek.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -61,14 +62,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_extended_seek(FX_FILE *file_ptr, ULONG64 byte_offset) { diff --git a/common/src/fxe_file_extended_truncate.c b/common/src/fxe_file_extended_truncate.c index d5b8cca..3fe6777 100644 --- a/common/src/fxe_file_extended_truncate.c +++ b/common/src/fxe_file_extended_truncate.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -61,14 +62,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_extended_truncate(FX_FILE *file_ptr, ULONG64 size) { diff --git a/common/src/fxe_file_extended_truncate_release.c b/common/src/fxe_file_extended_truncate_release.c index 58c5292..a73154f 100644 --- a/common/src/fxe_file_extended_truncate_release.c +++ b/common/src/fxe_file_extended_truncate_release.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -62,14 +63,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_extended_truncate_release(FX_FILE *file_ptr, ULONG64 size) { diff --git a/common/src/fxe_file_open.c b/common/src/fxe_file_open.c index 2145c9b..f84c38e 100644 --- a/common/src/fxe_file_open.c +++ b/common/src/fxe_file_open.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -65,14 +66,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_open(FX_MEDIA *media_ptr, FX_FILE *file_ptr, CHAR *file_name, UINT open_type, UINT file_control_block_size) { diff --git a/common/src/fxe_file_read.c b/common/src/fxe_file_read.c index e99cd0b..5f3638c 100644 --- a/common/src/fxe_file_read.c +++ b/common/src/fxe_file_read.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -64,14 +65,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_read(FX_FILE *file_ptr, VOID *buffer_ptr, ULONG request_size, ULONG *actual_size) { diff --git a/common/src/fxe_file_relative_seek.c b/common/src/fxe_file_relative_seek.c index 98e8297..7636bbb 100644 --- a/common/src/fxe_file_relative_seek.c +++ b/common/src/fxe_file_relative_seek.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -69,14 +70,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_relative_seek(FX_FILE *file_ptr, ULONG byte_offset, UINT seek_from) { diff --git a/common/src/fxe_file_rename.c b/common/src/fxe_file_rename.c index becbb40..345c1d8 100644 --- a/common/src/fxe_file_rename.c +++ b/common/src/fxe_file_rename.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -62,14 +63,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_rename(FX_MEDIA *media_ptr, CHAR *old_file_name, CHAR *new_file_name) { diff --git a/common/src/fxe_file_seek.c b/common/src/fxe_file_seek.c index d348d0a..d632da7 100644 --- a/common/src/fxe_file_seek.c +++ b/common/src/fxe_file_seek.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -61,14 +62,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_seek(FX_FILE *file_ptr, ULONG byte_offset) { diff --git a/common/src/fxe_file_truncate.c b/common/src/fxe_file_truncate.c index d3b22b1..c8cc705 100644 --- a/common/src/fxe_file_truncate.c +++ b/common/src/fxe_file_truncate.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -61,14 +62,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_truncate(FX_FILE *file_ptr, ULONG size) { diff --git a/common/src/fxe_file_truncate_release.c b/common/src/fxe_file_truncate_release.c index 96e4d79..b55af14 100644 --- a/common/src/fxe_file_truncate_release.c +++ b/common/src/fxe_file_truncate_release.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -62,14 +63,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_truncate_release(FX_FILE *file_ptr, ULONG size) { diff --git a/common/src/fxe_file_write.c b/common/src/fxe_file_write.c index a3dbc26..b4c2702 100644 --- a/common/src/fxe_file_write.c +++ b/common/src/fxe_file_write.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -62,14 +63,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_write(FX_FILE *file_ptr, VOID *buffer_ptr, ULONG size) { diff --git a/common/src/fxe_file_write_notify_set.c b/common/src/fxe_file_write_notify_set.c index 10ffbc4..9432c1d 100644 --- a/common/src/fxe_file_write_notify_set.c +++ b/common/src/fxe_file_write_notify_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -64,14 +65,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_file_write_notify_set(FX_FILE *file_ptr, VOID (*file_write_notify)(FX_FILE *file)) { diff --git a/common/src/fxe_media_abort.c b/common/src/fxe_media_abort.c index cc90cbd..b0b68ee 100644 --- a/common/src/fxe_media_abort.c +++ b/common/src/fxe_media_abort.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -60,14 +61,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_media_abort(FX_MEDIA *media_ptr) { diff --git a/common/src/fxe_media_cache_invalidate.c b/common/src/fxe_media_cache_invalidate.c index 46d83b1..b10b2eb 100644 --- a/common/src/fxe_media_cache_invalidate.c +++ b/common/src/fxe_media_cache_invalidate.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -62,14 +63,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_media_cache_invalidate(FX_MEDIA *media_ptr) { diff --git a/common/src/fxe_media_check.c b/common/src/fxe_media_check.c index cc303fc..0b4e653 100644 --- a/common/src/fxe_media_check.c +++ b/common/src/fxe_media_check.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -102,14 +103,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_media_check(FX_MEDIA *media_ptr, UCHAR *scratch_memory_ptr, ULONG scratch_memory_size, ULONG error_correction_option, ULONG *errors_detected) { diff --git a/common/src/fxe_media_close.c b/common/src/fxe_media_close.c index 1d763fd..bb3f651 100644 --- a/common/src/fxe_media_close.c +++ b/common/src/fxe_media_close.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -60,14 +61,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_media_close(FX_MEDIA *media_ptr) { diff --git a/common/src/fxe_media_close_notify_set.c b/common/src/fxe_media_close_notify_set.c index 4f75c86..614cd4e 100644 --- a/common/src/fxe_media_close_notify_set.c +++ b/common/src/fxe_media_close_notify_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -64,14 +65,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_media_close_notify_set(FX_MEDIA *media_ptr, VOID (*media_close_notify)(FX_MEDIA *media)) { diff --git a/common/src/fxe_media_extended_space_available.c b/common/src/fxe_media_extended_space_available.c index 93ff109..5a2a34e 100644 --- a/common/src/fxe_media_extended_space_available.c +++ b/common/src/fxe_media_extended_space_available.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -62,14 +63,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_media_extended_space_available(FX_MEDIA *media_ptr, ULONG64 *available_bytes_ptr) { diff --git a/common/src/fxe_media_flush.c b/common/src/fxe_media_flush.c index 6a826ff..3936d26 100644 --- a/common/src/fxe_media_flush.c +++ b/common/src/fxe_media_flush.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -62,14 +63,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_media_flush(FX_MEDIA *media_ptr) { diff --git a/common/src/fxe_media_format.c b/common/src/fxe_media_format.c index aad6e15..f13f7ab 100644 --- a/common/src/fxe_media_format.c +++ b/common/src/fxe_media_format.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -80,16 +81,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* 03-02-2021 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1.5 */ -/* */ /**************************************************************************/ UINT _fxe_media_format(FX_MEDIA *media_ptr, VOID (*driver)(FX_MEDIA *media), VOID *driver_info_ptr, UCHAR *memory_ptr, UINT memory_size, CHAR *volume_name, UINT number_of_fats, UINT directory_entries, UINT hidden_sectors, diff --git a/common/src/fxe_media_open.c b/common/src/fxe_media_open.c index ee55b56..b9819b9 100644 --- a/common/src/fxe_media_open.c +++ b/common/src/fxe_media_open.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -76,14 +77,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_media_open(FX_MEDIA *media_ptr, CHAR *media_name, VOID (*media_driver)(FX_MEDIA *), VOID *driver_info_ptr, diff --git a/common/src/fxe_media_open_notify_set.c b/common/src/fxe_media_open_notify_set.c index d0be45b..125df45 100644 --- a/common/src/fxe_media_open_notify_set.c +++ b/common/src/fxe_media_open_notify_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -64,14 +65,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_media_open_notify_set(FX_MEDIA *media_ptr, VOID (*media_open_notify)(FX_MEDIA *media)) { diff --git a/common/src/fxe_media_read.c b/common/src/fxe_media_read.c index a242646..11c219c 100644 --- a/common/src/fxe_media_read.c +++ b/common/src/fxe_media_read.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -62,14 +63,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_media_read(FX_MEDIA *media_ptr, ULONG logical_sector, VOID *buffer_ptr) { diff --git a/common/src/fxe_media_space_available.c b/common/src/fxe_media_space_available.c index 490b1f5..4c41edb 100644 --- a/common/src/fxe_media_space_available.c +++ b/common/src/fxe_media_space_available.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -62,14 +63,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_media_space_available(FX_MEDIA *media_ptr, ULONG *available_bytes_ptr) { diff --git a/common/src/fxe_media_volume_get.c b/common/src/fxe_media_volume_get.c index d4f3fab..3370fd3 100644 --- a/common/src/fxe_media_volume_get.c +++ b/common/src/fxe_media_volume_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -66,14 +67,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_media_volume_get(FX_MEDIA *media_ptr, CHAR *volume_name, UINT volume_source) { diff --git a/common/src/fxe_media_volume_get_extended.c b/common/src/fxe_media_volume_get_extended.c index 5ce8483..912114e 100644 --- a/common/src/fxe_media_volume_get_extended.c +++ b/common/src/fxe_media_volume_get_extended.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -67,14 +68,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_media_volume_get_extended(FX_MEDIA *media_ptr, CHAR *volume_name, UINT volume_name_buffer_length, UINT volume_source) { diff --git a/common/src/fxe_media_volume_set.c b/common/src/fxe_media_volume_set.c index 3f8bcf9..64c39dd 100644 --- a/common/src/fxe_media_volume_set.c +++ b/common/src/fxe_media_volume_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -63,14 +64,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_media_volume_set(FX_MEDIA *media_ptr, CHAR *volume_name) { diff --git a/common/src/fxe_media_write.c b/common/src/fxe_media_write.c index efb80e2..cb97b43 100644 --- a/common/src/fxe_media_write.c +++ b/common/src/fxe_media_write.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -63,14 +64,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_media_write(FX_MEDIA *media_ptr, ULONG logical_sector, VOID *buffer_ptr) { diff --git a/common/src/fxe_system_date_get.c b/common/src/fxe_system_date_get.c index 07fef3e..f9c9a1d 100644 --- a/common/src/fxe_system_date_get.c +++ b/common/src/fxe_system_date_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -61,14 +62,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_system_date_get(UINT *year, UINT *month, UINT *day) { diff --git a/common/src/fxe_system_date_set.c b/common/src/fxe_system_date_set.c index 3aa1405..9f0533b 100644 --- a/common/src/fxe_system_date_set.c +++ b/common/src/fxe_system_date_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -63,14 +64,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_system_date_set(UINT year, UINT month, UINT day) { diff --git a/common/src/fxe_system_time_get.c b/common/src/fxe_system_time_get.c index 20bca05..ff13e85 100644 --- a/common/src/fxe_system_time_get.c +++ b/common/src/fxe_system_time_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -61,14 +62,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_system_time_get(UINT *hour, UINT *minute, UINT *second) { diff --git a/common/src/fxe_system_time_set.c b/common/src/fxe_system_time_set.c index 26c9185..112f3ce 100644 --- a/common/src/fxe_system_time_set.c +++ b/common/src/fxe_system_time_set.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -63,14 +64,6 @@ /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_system_time_set(UINT hour, UINT minute, UINT second) { diff --git a/common/src/fxe_unicode_directory_create.c b/common/src/fxe_unicode_directory_create.c index 7ac0e0f..74cfd7a 100644 --- a/common/src/fxe_unicode_directory_create.c +++ b/common/src/fxe_unicode_directory_create.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -66,14 +67,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_unicode_directory_create(FX_MEDIA *media_ptr, UCHAR *source_unicode_name, ULONG source_unicode_length, CHAR *short_name) { diff --git a/common/src/fxe_unicode_directory_rename.c b/common/src/fxe_unicode_directory_rename.c index 19c4223..7336d81 100644 --- a/common/src/fxe_unicode_directory_rename.c +++ b/common/src/fxe_unicode_directory_rename.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -68,14 +69,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_unicode_directory_rename(FX_MEDIA *media_ptr, UCHAR *old_unicode_name, ULONG old_unicode_length, UCHAR *new_unicode_name, ULONG new_unicode_length, CHAR *new_short_name) diff --git a/common/src/fxe_unicode_file_create.c b/common/src/fxe_unicode_file_create.c index 1e94911..6eb6f22 100644 --- a/common/src/fxe_unicode_file_create.c +++ b/common/src/fxe_unicode_file_create.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -65,14 +66,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_unicode_file_create(FX_MEDIA *media_ptr, UCHAR *source_unicode_name, ULONG source_unicode_length, CHAR *short_name) { diff --git a/common/src/fxe_unicode_file_rename.c b/common/src/fxe_unicode_file_rename.c index 6eb5620..8608d03 100644 --- a/common/src/fxe_unicode_file_rename.c +++ b/common/src/fxe_unicode_file_rename.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -67,14 +68,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_unicode_file_rename(FX_MEDIA *media_ptr, UCHAR *old_unicode_name, ULONG old_unicode_length, UCHAR *new_unicode_name, ULONG new_unicode_length, CHAR *new_short_name) diff --git a/common/src/fxe_unicode_name_get.c b/common/src/fxe_unicode_name_get.c index 7208537..a1d7cd7 100644 --- a/common/src/fxe_unicode_name_get.c +++ b/common/src/fxe_unicode_name_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -65,14 +66,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_unicode_name_get(FX_MEDIA *media_ptr, CHAR *source_short_name, UCHAR *destination_unicode_name, ULONG *destination_unicode_length) diff --git a/common/src/fxe_unicode_name_get_extended.c b/common/src/fxe_unicode_name_get_extended.c index cf4138f..9c49134 100644 --- a/common/src/fxe_unicode_name_get_extended.c +++ b/common/src/fxe_unicode_name_get_extended.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -67,14 +68,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_unicode_name_get_extended(FX_MEDIA *media_ptr, CHAR *source_short_name, UCHAR *destination_unicode_name, ULONG *destination_unicode_length, ULONG unicode_name_buffer_length) diff --git a/common/src/fxe_unicode_short_name_get.c b/common/src/fxe_unicode_short_name_get.c index 5612857..9d54b12 100644 --- a/common/src/fxe_unicode_short_name_get.c +++ b/common/src/fxe_unicode_short_name_get.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -65,14 +66,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_unicode_short_name_get(FX_MEDIA *media_ptr, UCHAR *source_unicode_name, ULONG source_unicode_length, CHAR *destination_short_name) diff --git a/common/src/fxe_unicode_short_name_get_extended.c b/common/src/fxe_unicode_short_name_get_extended.c index ecb8542..e41e551 100644 --- a/common/src/fxe_unicode_short_name_get_extended.c +++ b/common/src/fxe_unicode_short_name_get_extended.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -66,14 +67,6 @@ FX_CALLER_CHECKING_EXTERNS /* */ /* Application Code */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 William E. Lamie Initial Version 6.0 */ -/* 09-30-2020 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ /**************************************************************************/ UINT _fxe_unicode_short_name_get_extended(FX_MEDIA *media_ptr, UCHAR *source_unicode_name, ULONG source_unicode_length, CHAR *destination_short_name, ULONG short_name_buffer_length) diff --git a/ports/cortex_m0/gnu/inc/fx_port.h b/ports/cortex_m0/gnu/inc/fx_port.h index 0e3ff87..d46e6c7 100644 --- a/ports/cortex_m0/gnu/inc/fx_port.h +++ b/ports/cortex_m0/gnu/inc/fx_port.h @@ -1,17 +1,18 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ -/** */ +/** */ /** FileX Component */ /** */ /** Port Specific */ diff --git a/ports/cortex_m3/gnu/inc/fx_port.h b/ports/cortex_m3/gnu/inc/fx_port.h index 0e3ff87..d46e6c7 100644 --- a/ports/cortex_m3/gnu/inc/fx_port.h +++ b/ports/cortex_m3/gnu/inc/fx_port.h @@ -1,17 +1,18 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ -/** */ +/** */ /** FileX Component */ /** */ /** Port Specific */ diff --git a/ports/cortex_m33/gnu/inc/fx_port.h b/ports/cortex_m33/gnu/inc/fx_port.h index 32e7a0a..9fb55c5 100644 --- a/ports/cortex_m33/gnu/inc/fx_port.h +++ b/ports/cortex_m33/gnu/inc/fx_port.h @@ -1,5 +1,6 @@ /*************************************************************************** * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at diff --git a/ports/cortex_m4/gnu/inc/fx_port.h b/ports/cortex_m4/gnu/inc/fx_port.h index 0e3ff87..d46e6c7 100644 --- a/ports/cortex_m4/gnu/inc/fx_port.h +++ b/ports/cortex_m4/gnu/inc/fx_port.h @@ -1,17 +1,18 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ -/** */ +/** */ /** FileX Component */ /** */ /** Port Specific */ diff --git a/ports/cortex_m7/gnu/inc/fx_port.h b/ports/cortex_m7/gnu/inc/fx_port.h index 0e3ff87..d46e6c7 100644 --- a/ports/cortex_m7/gnu/inc/fx_port.h +++ b/ports/cortex_m7/gnu/inc/fx_port.h @@ -1,17 +1,18 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ -/** */ +/** */ /** FileX Component */ /** */ /** Port Specific */ diff --git a/ports/generic/inc/fx_port.h b/ports/generic/inc/fx_port.h index 1335d7b..30653e6 100644 --- a/ports/generic/inc/fx_port.h +++ b/ports/generic/inc/fx_port.h @@ -1,17 +1,18 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ -/** */ +/** */ /** FileX Component */ /** */ /** Port Specific */ @@ -20,36 +21,24 @@ /**************************************************************************/ -/**************************************************************************/ -/* */ -/* PORT SPECIFIC C INFORMATION RELEASE */ -/* */ -/* fx_port.h Generic */ +/**************************************************************************/ +/* */ +/* PORT SPECIFIC C INFORMATION RELEASE */ +/* */ +/* fx_port.h Generic */ /* 6.3.0 */ /* */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ -/* DESCRIPTION */ -/* */ -/* This file contains data type definitions that make the FileX FAT */ -/* compatible file system function identically on a variety of */ -/* different processor architectures. For example, the byte offset of */ -/* various entries in the boot record, and directory entries are */ -/* defined in this file. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ +/* DESCRIPTION */ /* */ -/* 11-09-2020 William E. Lamie Initial Version 6.1.2 */ -/* 03-02-2021 William E. Lamie Modified comment(s), and */ -/* added standalone support, */ -/* resulting in version 6.1.5 */ -/* 10-31-2023 Xiuwen Cai Modified comment(s), */ -/* added basic types guards, */ -/* resulting in version 6.3.0 */ +/* This file contains data type definitions that make the FileX FAT */ +/* compatible file system function identically on a variety of */ +/* different processor architectures. For example, the byte offset of */ +/* various entries in the boot record, and directory entries are */ +/* defined in this file. */ /* */ /**************************************************************************/ @@ -62,7 +51,7 @@ #ifdef FX_INCLUDE_USER_DEFINE_FILE -/* Yes, include the user defines in fx_user.h. The defines in this file may +/* Yes, include the user defines in fx_user.h. The defines in this file may alternately be defined on the command line. */ #include "fx_user.h" @@ -119,11 +108,11 @@ typedef unsigned long long ULONG64; /* Define FileX internal protection macros. If FX_SINGLE_THREAD is defined, these protection macros are effectively disabled. However, for multi-thread - uses, the macros are setup to utilize a ThreadX mutex for multiple thread + uses, the macros are setup to utilize a ThreadX mutex for multiple thread access control into an open media. */ #if defined(FX_SINGLE_THREAD) || defined(FX_STANDALONE_ENABLE) -#define FX_PROTECT +#define FX_PROTECT #define FX_UNPROTECT #else #define FX_PROTECT if (media_ptr -> fx_media_id != FX_MEDIA_ID) return(FX_MEDIA_NOT_OPEN); \ @@ -156,8 +145,8 @@ typedef unsigned long long ULONG64; #define FX_RESTORE_INTS #endif -/* Define the error checking logic to determine if there is a caller error in the FileX API. - The default definitions assume ThreadX is being used. This code can be completely turned +/* Define the error checking logic to determine if there is a caller error in the FileX API. + The default definitions assume ThreadX is being used. This code can be completely turned off by just defining these macros to white space. */ #ifndef FX_STANDALONE_ENABLE @@ -199,16 +188,16 @@ typedef unsigned long long ULONG64; #endif -/* Defines the number of ThreadX timer ticks required to achieve the update rate specified by - FX_UPDATE_RATE_IN_SECONDS defined previously. By default, the ThreadX timer tick is 10ms, +/* Defines the number of ThreadX timer ticks required to achieve the update rate specified by + FX_UPDATE_RATE_IN_SECONDS defined previously. By default, the ThreadX timer tick is 10ms, so the default value for this constant is 1000. If TX_TIMER_TICKS_PER_SECOND is defined, this value is derived from TX_TIMER_TICKS_PER_SECOND. */ - + #ifndef FX_UPDATE_RATE_IN_TICKS #if (defined(TX_TIMER_TICKS_PER_SECOND) && (!defined(FX_STANDALONE_ENABLE))) #define FX_UPDATE_RATE_IN_TICKS (TX_TIMER_TICKS_PER_SECOND * FX_UPDATE_RATE_IN_SECONDS) #else -#define FX_UPDATE_RATE_IN_TICKS 1000 +#define FX_UPDATE_RATE_IN_TICKS 1000 #endif #endif @@ -216,8 +205,8 @@ typedef unsigned long long ULONG64; /* Define the version ID of FileX. This may be utilized by the application. */ #ifdef FX_SYSTEM_INIT -CHAR _fx_version_id[] = - "Copyright (c) 2024 Microsoft Corporation. * FileX Generic Version 6.4.1 *"; +CHAR _fx_version_id[] = + "(c) 2024 Microsoft Corp. (c) 2026-present Eclipse ThreadX contributors. * FileX Generic Version 6.5.0.202601 *"; #else extern CHAR _fx_version_id[]; #endif diff --git a/ports/linux/gnu/inc/fx_port.h b/ports/linux/gnu/inc/fx_port.h index 9f2ad73..3d2844d 100644 --- a/ports/linux/gnu/inc/fx_port.h +++ b/ports/linux/gnu/inc/fx_port.h @@ -1,17 +1,18 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ -/** */ +/** */ /** FileX Component */ /** */ /** Port Specific */ @@ -20,11 +21,11 @@ /**************************************************************************/ -/**************************************************************************/ -/* */ -/* PORT SPECIFIC C INFORMATION RELEASE */ -/* */ -/* fx_port.h Linux/GCC */ +/**************************************************************************/ +/* */ +/* PORT SPECIFIC C INFORMATION RELEASE */ +/* */ +/* fx_port.h Linux/GCC */ /* 6.3.0 */ /* */ /* AUTHOR */ @@ -32,26 +33,12 @@ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This file contains data type definitions that make the FileX FAT */ -/* compatible file system function identically on a variety of */ -/* different processor architectures. For example, the byte offset of */ -/* various entries in the boot record, and directory entries are */ -/* defined in this file. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ -/* 03-02-2021 William E. Lamie Modified comment(s), and */ -/* added standalone support, */ -/* resulting in version 6.1.5 */ -/* 08-02-2021 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1.8 */ -/* 10-31-2023 Xiuwen Cai Modified comment(s), */ -/* added basic types guards, */ -/* resulting in version 6.3.0 */ +/* This file contains data type definitions that make the FileX FAT */ +/* compatible file system function identically on a variety of */ +/* different processor architectures. For example, the byte offset of */ +/* various entries in the boot record, and directory entries are */ +/* defined in this file. */ /* */ /**************************************************************************/ @@ -64,7 +51,7 @@ #ifdef FX_INCLUDE_USER_DEFINE_FILE -/* Yes, include the user defines in fx_user.h. The defines in this file may +/* Yes, include the user defines in fx_user.h. The defines in this file may alternately be defined on the command line. */ #include "fx_user.h" @@ -145,10 +132,10 @@ extern ULONG _fx_utility_logical_sector_read_1_error_request; #ifdef FX_ENABLE_FAULT_TOLERANT struct FX_MEDIA_STRUCT; -extern VOID fault_tolerant_enable_callback(struct FX_MEDIA_STRUCT *media_ptr, +extern VOID fault_tolerant_enable_callback(struct FX_MEDIA_STRUCT *media_ptr, UCHAR *fault_tolerant_memory_buffer, ULONG log_size); -extern VOID fault_tolerant_apply_log_callback(struct FX_MEDIA_STRUCT *media_ptr, +extern VOID fault_tolerant_apply_log_callback(struct FX_MEDIA_STRUCT *media_ptr, UCHAR *fault_tolerant_memory_buffer, ULONG log_size); #endif /* FX_ENABLE_FAULT_TOLERANT */ @@ -266,13 +253,13 @@ extern VOID fault_tolerant_apply_log_callback(struct FX_MEDIA_STRUCT *media_ptr, /* Define FileX internal protection macros. If FX_SINGLE_THREAD is defined, these protection macros are effectively disabled. However, for multi-thread - uses, the macros are setup to utilize a ThreadX mutex for multiple thread + uses, the macros are setup to utilize a ThreadX mutex for multiple thread access control into an open media. */ /* Reduce the mutex error checking for testing purpose. */ #if defined(FX_SINGLE_THREAD) || defined(FX_STANDALONE_ENABLE) -#define FX_PROTECT +#define FX_PROTECT #define FX_UNPROTECT #else #define FX_PROTECT tx_mutex_get(&(media_ptr -> fx_media_protect), TX_WAIT_FOREVER); @@ -297,8 +284,8 @@ extern VOID fault_tolerant_apply_log_callback(struct FX_MEDIA_STRUCT *media_ptr, #define FX_RESTORE_INTS #endif -/* Define the error checking logic to determine if there is a caller error in the FileX API. - The default definitions assume ThreadX is being used. This code can be completely turned +/* Define the error checking logic to determine if there is a caller error in the FileX API. + The default definitions assume ThreadX is being used. This code can be completely turned off by just defining these macros to white space. */ #ifndef FX_STANDALONE_ENABLE @@ -343,8 +330,8 @@ extern VOID fault_tolerant_apply_log_callback(struct FX_MEDIA_STRUCT *media_ptr, /* Define the version ID of FileX. This may be utilized by the application. */ #ifdef FX_SYSTEM_INIT -CHAR _fx_version_id[] = - "Copyright (c) 2024 Microsoft Corporation. * FileX Linux/GCC Version 6.4.1 *"; +CHAR _fx_version_id[] = + "(c) 2024 Microsoft Corp. (c) 2026-present Eclipse ThreadX contributors. * FileX Linux/GCC Version 6.5.0.202601 *"; #else extern CHAR _fx_version_id[]; #endif diff --git a/ports/mips/gnu/inc/fx_port.h b/ports/mips/gnu/inc/fx_port.h index 0e3ff87..d46e6c7 100644 --- a/ports/mips/gnu/inc/fx_port.h +++ b/ports/mips/gnu/inc/fx_port.h @@ -1,17 +1,18 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ -/** */ +/** */ /** FileX Component */ /** */ /** Port Specific */ diff --git a/ports/rxv1/gnu/CMakeLists.txt b/ports/rxv1/gnu/CMakeLists.txt new file mode 100644 index 0000000..62111b3 --- /dev/null +++ b/ports/rxv1/gnu/CMakeLists.txt @@ -0,0 +1,9 @@ +target_sources(${PROJECT_NAME} PRIVATE + # {{BEGIN_TARGET_SOURCES}} + + # {{END_TARGET_SOURCES}} +) + +target_include_directories(${PROJECT_NAME} PUBLIC + ${CMAKE_CURRENT_LIST_DIR}/inc +) \ No newline at end of file diff --git a/ports/rxv1/gnu/inc/fx_port.h b/ports/rxv1/gnu/inc/fx_port.h new file mode 100644 index 0000000..d46e6c7 --- /dev/null +++ b/ports/rxv1/gnu/inc/fx_port.h @@ -0,0 +1,25 @@ +/*************************************************************************** + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * + * This program and the accompanying materials are made available under the + * terms of the MIT License which is available at + * https://opensource.org/licenses/MIT. + * + * SPDX-License-Identifier: MIT + **************************************************************************/ + + +/**************************************************************************/ +/**************************************************************************/ +/** */ +/** FileX Component */ +/** */ +/** Port Specific */ +/** */ +/**************************************************************************/ +/**************************************************************************/ + +/* Include the generic version of fx_port.h. */ +#include "../../../generic/inc/fx_port.h" + diff --git a/ports/rxv2/gnu/CMakeLists.txt b/ports/rxv2/gnu/CMakeLists.txt new file mode 100644 index 0000000..62111b3 --- /dev/null +++ b/ports/rxv2/gnu/CMakeLists.txt @@ -0,0 +1,9 @@ +target_sources(${PROJECT_NAME} PRIVATE + # {{BEGIN_TARGET_SOURCES}} + + # {{END_TARGET_SOURCES}} +) + +target_include_directories(${PROJECT_NAME} PUBLIC + ${CMAKE_CURRENT_LIST_DIR}/inc +) \ No newline at end of file diff --git a/ports/rxv2/gnu/inc/fx_port.h b/ports/rxv2/gnu/inc/fx_port.h new file mode 100644 index 0000000..d46e6c7 --- /dev/null +++ b/ports/rxv2/gnu/inc/fx_port.h @@ -0,0 +1,25 @@ +/*************************************************************************** + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * + * This program and the accompanying materials are made available under the + * terms of the MIT License which is available at + * https://opensource.org/licenses/MIT. + * + * SPDX-License-Identifier: MIT + **************************************************************************/ + + +/**************************************************************************/ +/**************************************************************************/ +/** */ +/** FileX Component */ +/** */ +/** Port Specific */ +/** */ +/**************************************************************************/ +/**************************************************************************/ + +/* Include the generic version of fx_port.h. */ +#include "../../../generic/inc/fx_port.h" + diff --git a/ports/rxv3/gnu/CMakeLists.txt b/ports/rxv3/gnu/CMakeLists.txt new file mode 100644 index 0000000..62111b3 --- /dev/null +++ b/ports/rxv3/gnu/CMakeLists.txt @@ -0,0 +1,9 @@ +target_sources(${PROJECT_NAME} PRIVATE + # {{BEGIN_TARGET_SOURCES}} + + # {{END_TARGET_SOURCES}} +) + +target_include_directories(${PROJECT_NAME} PUBLIC + ${CMAKE_CURRENT_LIST_DIR}/inc +) \ No newline at end of file diff --git a/ports/rxv3/gnu/inc/fx_port.h b/ports/rxv3/gnu/inc/fx_port.h new file mode 100644 index 0000000..d46e6c7 --- /dev/null +++ b/ports/rxv3/gnu/inc/fx_port.h @@ -0,0 +1,25 @@ +/*************************************************************************** + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * + * This program and the accompanying materials are made available under the + * terms of the MIT License which is available at + * https://opensource.org/licenses/MIT. + * + * SPDX-License-Identifier: MIT + **************************************************************************/ + + +/**************************************************************************/ +/**************************************************************************/ +/** */ +/** FileX Component */ +/** */ +/** Port Specific */ +/** */ +/**************************************************************************/ +/**************************************************************************/ + +/* Include the generic version of fx_port.h. */ +#include "../../../generic/inc/fx_port.h" + diff --git a/ports/win32/vs_2019/inc/fx_port.h b/ports/win32/vs_2019/inc/fx_port.h index 3943616..3807532 100644 --- a/ports/win32/vs_2019/inc/fx_port.h +++ b/ports/win32/vs_2019/inc/fx_port.h @@ -1,17 +1,18 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ -/** */ +/** */ /** FileX Component */ /** */ /** Port Specific */ @@ -20,38 +21,24 @@ /**************************************************************************/ -/**************************************************************************/ -/* */ -/* PORT SPECIFIC C INFORMATION RELEASE */ -/* */ -/* fx_port.h Win32/Visual */ +/**************************************************************************/ +/* */ +/* PORT SPECIFIC C INFORMATION RELEASE */ +/* */ +/* fx_port.h Win32/Visual */ /* 6.3.0 */ /* */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ -/* DESCRIPTION */ -/* */ -/* This file contains data type definitions that make the FileX FAT */ -/* compatible file system function identically on a variety of */ -/* different processor architectures. For example, the byte offset of */ -/* various entries in the boot record, and directory entries are */ -/* defined in this file. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ +/* DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ -/* 03-02-2021 William E. Lamie Modified comment(s), and */ -/* added standalone support, */ -/* resulting in version 6.1.5 */ -/* 08-02-2021 William E. Lamie Modified comment(s), */ -/* resulting in version 6.1.8 */ -/* 10-31-2023 Xiuwen Cai Modified comment(s), */ -/* added basic types guards, */ -/* resulting in version 6.3.0 */ +/* This file contains data type definitions that make the FileX FAT */ +/* compatible file system function identically on a variety of */ +/* different processor architectures. For example, the byte offset of */ +/* various entries in the boot record, and directory entries are */ +/* defined in this file. */ /* */ /**************************************************************************/ @@ -64,7 +51,7 @@ #ifdef FX_INCLUDE_USER_DEFINE_FILE -/* Yes, include the user defines in fx_user.h. The defines in this file may +/* Yes, include the user defines in fx_user.h. The defines in this file may alternately be defined on the command line. */ #include "fx_user.h" @@ -123,11 +110,11 @@ typedef unsigned long long ULONG64; /* Define FileX internal protection macros. If FX_SINGLE_THREAD is defined, these protection macros are effectively disabled. However, for multi-thread - uses, the macros are setup to utilize a ThreadX mutex for multiple thread + uses, the macros are setup to utilize a ThreadX mutex for multiple thread access control into an open media. */ #if defined(FX_SINGLE_THREAD) || defined(FX_STANDALONE_ENABLE) -#define FX_PROTECT +#define FX_PROTECT #define FX_UNPROTECT #else #define FX_PROTECT if (media_ptr -> fx_media_id != FX_MEDIA_ID) return(FX_MEDIA_NOT_OPEN); \ @@ -149,8 +136,8 @@ typedef unsigned long long ULONG64; #define FX_RESTORE_INTS #endif -/* Define the error checking logic to determine if there is a caller error in the FileX API. - The default definitions assume ThreadX is being used. This code can be completely turned +/* Define the error checking logic to determine if there is a caller error in the FileX API. + The default definitions assume ThreadX is being used. This code can be completely turned off by just defining these macros to white space. */ #ifndef FX_STANDALONE_ENABLE @@ -191,16 +178,16 @@ typedef unsigned long long ULONG64; #endif -/* Defines the number of ThreadX timer ticks required to achieve the update rate specified by - FX_UPDATE_RATE_IN_SECONDS defined previously. By default, the ThreadX timer tick is 10ms, +/* Defines the number of ThreadX timer ticks required to achieve the update rate specified by + FX_UPDATE_RATE_IN_SECONDS defined previously. By default, the ThreadX timer tick is 10ms, so the default value for this constant is 1000. If TX_TIMER_TICKS_PER_SECOND is defined, this value is derived from TX_TIMER_TICKS_PER_SECOND. */ - + #ifndef FX_UPDATE_RATE_IN_TICKS #if (defined(TX_TIMER_TICKS_PER_SECOND) && (!defined(FX_STANDALONE_ENABLE))) #define FX_UPDATE_RATE_IN_TICKS (TX_TIMER_TICKS_PER_SECOND * FX_UPDATE_RATE_IN_SECONDS) #else -#define FX_UPDATE_RATE_IN_TICKS 1000 +#define FX_UPDATE_RATE_IN_TICKS 1000 #endif #endif @@ -208,8 +195,9 @@ typedef unsigned long long ULONG64; /* Define the version ID of FileX. This may be utilized by the application. */ #ifdef FX_SYSTEM_INIT -CHAR _fx_version_id[] = +CHAR _fx_version_id[] = "Copyright (c) 2024 Microsoft Corporation. * FileX Win32/Version 6.4.1 *"; + * Copyright (c) 2026-present Eclipse ThreadX contributors #else extern CHAR _fx_version_id[]; #endif diff --git a/samples/demo_filex.c b/samples/demo_filex.c index 8046429..8359b94 100644 --- a/samples/demo_filex.c +++ b/samples/demo_filex.c @@ -1,11 +1,11 @@ /*************************************************************************** * Copyright (c) 2024 Microsoft Corporation - * Copyright (c) 2025 Eclipse ThreadX contributors - * + * Copyright (c) 2025 Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -64,11 +64,11 @@ ULONG thread_0_counter; void main(void) { -#ifdef FX_STANDALONE_ENABLE +#ifdef FX_STANDALONE_ENABLE /* Initialize FileX. */ fx_system_initialize(); - + thread_0_entry(0); #else /* Enter the ThreadX kernel. */ @@ -116,10 +116,10 @@ CHAR local_buffer[30]; /* Format the RAM disk - the memory for the RAM disk was setup in - tx_application_define above. + tx_application_define above. Important Note: The user must ensure there is enough RAM for the format - specified. Otherwise, memory corruption can occur. + specified. Otherwise, memory corruption can occur. */ status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry @@ -141,7 +141,7 @@ CHAR local_buffer[30]; { /* Error formatting the RAM disk. */ printf("HTTPS RAM disk format failed, error: %x\n", status); - return; + return; } /* Loop to repeat the demo over and over! */ @@ -155,9 +155,9 @@ CHAR local_buffer[30]; { /* Error opening the RAM disk. */ printf("RAM disk open failed, error: %x\n", status); - return; + return; } - + #ifdef FX_ENABLE_FAULT_TOLERANT status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_memory, sizeof(fault_tolerant_memory)); diff --git a/test/regression_test/filex_directory_attributes_read_set_test.c b/test/regression_test/filex_directory_attributes_read_set_test.c index 0eb4ebb..af9362a 100644 --- a/test/regression_test/filex_directory_attributes_read_set_test.c +++ b/test/regression_test/filex_directory_attributes_read_set_test.c @@ -52,13 +52,13 @@ void filex_directory_attributes_read_set_application_define(void *first_unuse #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -92,20 +92,20 @@ UINT attributes; printf("FileX Test: Directory attributes read/set test....................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -114,10 +114,10 @@ UINT attributes; printf("ERROR!\n"); test_control_return(2); } - + /* test error checking */ #ifndef FX_DISABLE_ERROR_CHECKING - + /* check directory attributes read null pointer error */ status = fx_directory_attributes_read(FX_NULL, "TEST_DIR", &attributes); if (status != FX_PTR_ERROR) @@ -125,7 +125,7 @@ UINT attributes; printf("ERROR!\n"); test_control_return(99); } - + /* check directory attributes set null pointer error */ status = fx_directory_attributes_set(FX_NULL, "TEST_DIR", attributes); if (status != FX_PTR_ERROR) @@ -133,7 +133,7 @@ UINT attributes; printf("ERROR!\n"); test_control_return(99); } - + /* check directory attributes set null pointer error */ status = fx_directory_attributes_set(&ram_disk, "TEST_DIR", 0x1111); if (status != FX_INVALID_ATTR) @@ -141,9 +141,9 @@ UINT attributes; printf("ERROR!\n"); test_control_return(99); } - + #endif - + /* check directory attributes read to make sure it throws an error when the media hasnt been opened */ status = fx_directory_attributes_read(&ram_disk, "TEST_DIR", &attributes); if (status != FX_MEDIA_NOT_OPEN) @@ -151,7 +151,7 @@ UINT attributes; printf("ERROR!\n"); test_control_return(99); } - + /* check directory attributes set to make sure it throws an error when the media hasnt been opened */ status = fx_directory_attributes_set(&ram_disk, "TEST_DIR", 0x0000); if (status != FX_MEDIA_NOT_OPEN) @@ -207,7 +207,7 @@ UINT attributes; printf("ERROR!\n"); test_control_return(5); } - + /* check directory attributes set to make sure it throws an error when the directory is write protected */ ram_disk.fx_media_driver_write_protect = FX_TRUE; status = fx_directory_attributes_set(&ram_disk, "TEST_DIR", attributes); @@ -217,7 +217,7 @@ UINT attributes; test_control_return(99); } ram_disk.fx_media_driver_write_protect = FX_FALSE; - + /* check directory attributes read to make sure it throws an error when it isnt a directory */ status = fx_directory_attributes_read(&ram_disk, "NOT_A_DIR", &attributes); if (status != FX_NOT_DIRECTORY) @@ -225,7 +225,7 @@ UINT attributes; printf("ERROR!\n"); test_control_return(99); } - + /* check directory attributes read to make sure it throws an error when the directory isnt found */ status = fx_directory_attributes_read(&ram_disk, "DOES_NOT_EXIST", &attributes); if (status == FX_SUCCESS) @@ -233,7 +233,7 @@ UINT attributes; printf("ERROR!\n"); test_control_return(99); } - + /* check directory attributes set to make sure it throws an error when it isnt a directory */ status = fx_directory_attributes_set(&ram_disk, "NOT_A_DIR", attributes); if (status != FX_NOT_DIRECTORY) @@ -241,7 +241,7 @@ UINT attributes; printf("ERROR!\n"); test_control_return(99); } - + /* check directory attributes set to make sure it throws an error when the directory isnt found */ status = fx_directory_attributes_set(&ram_disk, "DOES_NOT_EXIST", attributes); if (status == FX_SUCCESS) @@ -257,7 +257,7 @@ UINT attributes; status = fx_directory_attributes_set(&ram_disk, "TEST_DIR", attributes | FX_ARCHIVE | FX_SYSTEM | FX_READ_ONLY | FX_HIDDEN); /* Check the attributes set status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -279,7 +279,7 @@ UINT attributes; } /* Close the media. */ - status = fx_media_close(&ram_disk); + status = fx_media_close(&ram_disk); /* Determine if the test was successful. */ if (status != FX_SUCCESS) diff --git a/test/regression_test/filex_directory_create_delete_test.c b/test/regression_test/filex_directory_create_delete_test.c index 32eca61..0fe6ac1 100644 --- a/test/regression_test/filex_directory_create_delete_test.c +++ b/test/regression_test/filex_directory_create_delete_test.c @@ -97,10 +97,10 @@ static UCHAR my_unicode_name1[] = #ifndef FX_STANDALONE_ENABLE static UCHAR *ram_disk_memory; static UCHAR *cache_buffer; -static UCHAR *fault_tolerant_buffer; +static UCHAR *fault_tolerant_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; -static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; +static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; #endif @@ -130,13 +130,13 @@ void filex_directory_create_delete_application_define(void *first_unused_memo #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -168,7 +168,7 @@ UINT status; ULONG temp; UINT attributes; UINT i; -#ifdef EXTENDED_NAME_MANGLE_TEST +#ifdef EXTENDED_NAME_MANGLE_TEST UINT j, k, l; #endif CHAR *name_ptr; @@ -181,35 +181,35 @@ FX_DIR_ENTRY search_directory; printf("FileX Test: Directory create/delete test..........................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors -/* We need a larger disk to test the feature of fault tolerant. */ +/* We need a larger disk to test the feature of fault tolerant. */ #ifdef FX_ENABLE_FAULT_TOLERANT - 512 * 8, // Total sectors + 512 * 8, // Total sectors 256, // Sector size 8, // Sectors per cluster #else - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster #endif 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Attempt to create a directory before the media is opened to generate an error */ status = fx_directory_create(&ram_disk, "/A0"); return_if_fail( status == FX_MEDIA_NOT_OPEN); - + /* Attempt to delete a directory before the media is opened to generate an error */ status = fx_directory_delete(&ram_disk, "/A0"); return_if_fail( status == FX_MEDIA_NOT_OPEN); @@ -217,8 +217,8 @@ FX_DIR_ENTRY search_directory; /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); - -/* We need a larger disk to test the feature of fault tolerant. */ + +/* We need a larger disk to test the feature of fault tolerant. */ #ifdef FX_ENABLE_FAULT_TOLERANT /* Enable fault tolerant if FX_ENABLE_FAULT_TOLERANT is defined. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); @@ -231,31 +231,31 @@ FX_DIR_ENTRY search_directory; /* send null pointer to directory create to generate an error */ status = fx_directory_create(FX_NULL, "/A0"); return_if_fail( status == FX_PTR_ERROR); - + /* directory delete */ status = fx_directory_delete(FX_NULL, "/A0"); return_if_fail( status == FX_PTR_ERROR); #endif /* FX_DISABLE_ERROR_CHECKING */ - + /* Attempt to create a directory with an invalid name to generate an error */ status = fx_directory_create(&ram_disk, ""); return_if_fail( status == FX_INVALID_NAME); - + /* Attempt to create a directory with an invalid name to generate an error */ status = fx_directory_create(&ram_disk, "/A0/error\\error"); return_if_fail( status == FX_INVALID_PATH); - + /* Attempt to create a directory while the media is write protected to generate an error */ ram_disk.fx_media_driver_write_protect = FX_TRUE; status = fx_directory_create(&ram_disk, "/A0"); return_if_fail( status == FX_WRITE_PROTECT); - + /* try to create a directory while the media is write protected to generate an error */ status = fx_directory_delete(&ram_disk, "/A0"); return_if_fail( status == FX_WRITE_PROTECT); ram_disk.fx_media_driver_write_protect = FX_FALSE; - + /* Attempt to create a directory when there is no space to generate an error */ temp = ram_disk.fx_media_available_clusters; ram_disk.fx_media_available_clusters = 0; @@ -286,13 +286,13 @@ FX_DIR_ENTRY search_directory; status += fx_directory_create(&ram_disk, "/A0/A3"); status += fx_directory_create(&ram_disk, "/A0/A4"); status += fx_directory_create(&ram_disk, "/A0/A5"); - + status += fx_directory_create(&ram_disk, "/B0/B1"); status += fx_directory_create(&ram_disk, "/B0/B2"); status += fx_directory_create(&ram_disk, "/B0/B3"); status += fx_directory_create(&ram_disk, "/B0/B4"); status += fx_directory_create(&ram_disk, "/B0/B5"); - + status += fx_directory_create(&ram_disk, "/C0/C1"); status += fx_directory_create(&ram_disk, "/C0/C2"); status += fx_directory_create(&ram_disk, "/C0/C3"); @@ -316,7 +316,7 @@ FX_DIR_ENTRY search_directory; status += fx_directory_create(&ram_disk, "/F0/F3"); status += fx_directory_create(&ram_disk, "/F0/F4"); status += fx_directory_create(&ram_disk, "/F0/F5"); - + status += fx_directory_create(&ram_disk, "/G0/G1"); status += fx_directory_create(&ram_disk, "/G0/G2"); status += fx_directory_create(&ram_disk, "/G0/G3"); @@ -335,7 +335,7 @@ FX_DIR_ENTRY search_directory; status += fx_directory_create(&ram_disk, "/I0/I4"); status += fx_directory_create(&ram_disk, "/I0/I5"); return_if_fail( status == FX_SUCCESS); - + /* Now create the third level of sub-directories... */ status = fx_directory_create(&ram_disk, "/A0/A1/A00"); status += fx_directory_create(&ram_disk, "/B0/B2/B00"); @@ -347,15 +347,15 @@ FX_DIR_ENTRY search_directory; status += fx_directory_create(&ram_disk, "/H0/H2/H00"); status += fx_directory_create(&ram_disk, "/I0/I3/I00"); return_if_fail( status == FX_SUCCESS); - + /* Attempt to delete something that is not a directory */ status = fx_directory_delete(&ram_disk, "not_a_dir"); return_if_fail( status == FX_NOT_DIRECTORY); - + /* Attempt to delete a directory that is not empty */ status = fx_directory_delete(&ram_disk, "/A0"); return_if_fail( status == FX_DIR_NOT_EMPTY); - + /* Attempt to delete a directory that is read only */ status = fx_directory_attributes_read(&ram_disk, "/A0/A1/A00", &attributes); status += fx_directory_attributes_set(&ram_disk, "/A0/A1/A00", FX_READ_ONLY); @@ -381,13 +381,13 @@ FX_DIR_ENTRY search_directory; status += fx_directory_delete(&ram_disk, "/A0/A3"); status += fx_directory_delete(&ram_disk, "/A0/A4"); status += fx_directory_delete(&ram_disk, "/A0/A5"); - + status += fx_directory_delete(&ram_disk, "/B0/B1"); status += fx_directory_delete(&ram_disk, "/B0/B2"); status += fx_directory_delete(&ram_disk, "/B0/B3"); status += fx_directory_delete(&ram_disk, "/B0/B4"); status += fx_directory_delete(&ram_disk, "/B0/B5"); - + status += fx_directory_delete(&ram_disk, "/C0/C1"); status += fx_directory_delete(&ram_disk, "/C0/C2"); status += fx_directory_delete(&ram_disk, "/C0/C3"); @@ -411,7 +411,7 @@ FX_DIR_ENTRY search_directory; status += fx_directory_delete(&ram_disk, "/F0/F3"); status += fx_directory_delete(&ram_disk, "/F0/F4"); status += fx_directory_delete(&ram_disk, "/F0/F5"); - + status += fx_directory_delete(&ram_disk, "/G0/G1"); status += fx_directory_delete(&ram_disk, "/G0/G2"); status += fx_directory_delete(&ram_disk, "/G0/G3"); @@ -452,20 +452,20 @@ FX_DIR_ENTRY search_directory; return_if_fail( status == FX_SUCCESS); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4096, // Total sectors - 128, // Sector size + 4096, // Total sectors + 128, // Sector size 2, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); /* Open the ram_disk. */ @@ -475,7 +475,7 @@ FX_DIR_ENTRY search_directory; /* Create a directory name that is too large. */ for (i = 0; i < FX_MAX_LONG_NAME_LEN+1; i++) { - + name[i] = 'a'; } name[FX_MAX_LONG_NAME_LEN + 1] = 0; @@ -483,14 +483,14 @@ FX_DIR_ENTRY search_directory; /* Attempt to create a directory with too long of a name. */ status = fx_directory_create(&ram_disk, name); return_if_fail( status == FX_INVALID_NAME); - + /* Attempt to create a directory with no more clusters. */ temp = ram_disk.fx_media_total_clusters; ram_disk.fx_media_total_clusters = 0; status = fx_directory_create(&ram_disk, "sub1"); ram_disk.fx_media_total_clusters = temp; return_if_fail( status == FX_NO_MORE_SPACE); - + /* Attempt to create a directory with a FAT read error. */ _fx_utility_fat_entry_read_error_request = 1; status = fx_directory_create(&ram_disk, "sub1"); @@ -553,28 +553,28 @@ FX_DIR_ENTRY search_directory; /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4096, // Total sectors - 128, // Sector size + 4096, // Total sectors + 128, // Sector size 2, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); return_if_fail( status == FX_SUCCESS); - + /* Create a series of sub-directories... in preparation for our directory delete checking. */ status = fx_directory_create(&ram_disk, "SUB1"); status += fx_directory_create(&ram_disk, "SUB2"); @@ -591,32 +591,32 @@ FX_DIR_ENTRY search_directory; status = fx_directory_delete(&ram_disk, "SUB8"); _fx_utility_fat_entry_read_error_request = 0; return_if_fail( status == FX_IO_ERROR); - + /* Delete a directory but with a cluster error - bad small value. */ _fx_utility_fat_entry_read_error_request = 10001; status = fx_directory_delete(&ram_disk, "SUB8"); _fx_utility_fat_entry_read_error_request = 0; return_if_fail( status == FX_FAT_READ_ERROR); - + /* Delete a directory but with a cluster error - bad total clusters. */ temp = ram_disk.fx_media_total_clusters; ram_disk.fx_media_total_clusters = 0; status = fx_directory_delete(&ram_disk, "SUB8"); ram_disk.fx_media_total_clusters = temp; return_if_fail( status == FX_FAT_READ_ERROR); - + /* Delete a directory but with a cluster error - same value. */ _fx_utility_fat_entry_read_error_request = 30001; status = fx_directory_delete(&ram_disk, "SUB8"); _fx_utility_fat_entry_read_error_request = 0; return_if_fail( status == FX_FAT_READ_ERROR); - + /* Delete a directory but with a directory entry read error. */ _fx_directory_entry_read_error_request = 1; status = fx_directory_delete(&ram_disk, "SUB8"); _fx_directory_entry_read_error_request = 0; return_if_fail( status == FX_IO_ERROR); - + /* Delete a directory but with a directory entry write error. */ _fx_directory_entry_write_error_request = 1; status = fx_directory_delete(&ram_disk, "SUB8"); @@ -642,20 +642,20 @@ FX_DIR_ENTRY search_directory; status = fx_directory_delete(&ram_disk, "SUB6"); _fx_utility_fat_entry_read_error_request = 0; return_if_fail( status == FX_FAT_READ_ERROR); - + /* Delete a directory but with a cluster error in releasing cluster - bad total clusters. */ temp = ram_disk.fx_media_total_clusters; _fx_utility_fat_entry_read_error_request = 40002; status = fx_directory_delete(&ram_disk, "SUB5"); ram_disk.fx_media_total_clusters = temp; return_if_fail( status == FX_FAT_READ_ERROR); - + /* Delete a directory but with a cluster error in releasing cluster - same value. */ _fx_utility_fat_entry_read_error_request = 30002; status = fx_directory_delete(&ram_disk, "SUB4"); _fx_utility_fat_entry_read_error_request = 0; return_if_fail( status == FX_FAT_READ_ERROR); - + /* Delete a directory but with a FAT write error in releasing cluster. */ _fx_utility_fat_entry_write_error_request = 1; status = fx_directory_delete(&ram_disk, "SUB3"); @@ -667,20 +667,20 @@ FX_DIR_ENTRY search_directory; return_if_fail( status == FX_SUCCESS); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 14000, // Total sectors - 128, // Sector size + 14000, // Total sectors + 128, // Sector size 2, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); /* Open the ram_disk. */ @@ -689,7 +689,7 @@ FX_DIR_ENTRY search_directory; /* Create a sub-directory to work from. */ status = fx_directory_create(&ram_disk, "SUB1"); - + /* Set the default path here. */ status += fx_directory_default_set(&ram_disk, "SUB1"); @@ -708,16 +708,16 @@ FX_DIR_ENTRY search_directory; name[7] = '`'; name[8] = (CHAR) 128; name[9] = 0; - + status = fx_file_create(&ram_disk, name); status += fx_file_open(&ram_disk, &file_1, name, FX_OPEN_FOR_WRITE); return_if_fail( status == FX_SUCCESS); - + /* Create a name with a bunch of special characters. */ status = fx_file_create(&ram_disk, "name-a_b}{()'!#$&@^%+,;=[]"); status += fx_file_open(&ram_disk, &file_2, "name-a_b}{()'!#$&@^%+,;=[]", FX_OPEN_FOR_WRITE); return_if_fail( status == FX_SUCCESS); - + /* Create a name with an invalid character. */ name[0] = 'n'; name[1] = 'a'; @@ -726,7 +726,7 @@ FX_DIR_ENTRY search_directory; name[4] = (CHAR) 5; name[5] = '\''; name[6] = 0; - + status = fx_file_create(&ram_disk, name); return_if_fail( status == FX_INVALID_NAME); @@ -736,7 +736,7 @@ FX_DIR_ENTRY search_directory; status += fx_file_open(&ram_disk, &file_3, "MYLONGERN.AM", FX_OPEN_FOR_WRITE); status += fx_file_open(&ram_disk, &file_4, "MY.TXT", FX_OPEN_FOR_WRITE); return_if_fail( status == FX_SUCCESS); - + /* Create a set of very short long file name. */ status = fx_file_create(&ram_disk, "n"); status += fx_file_create(&ram_disk, "nW"); @@ -854,7 +854,7 @@ FX_DIR_ENTRY search_directory; _fx_utility_fat_entry_read_error_request = 40064; ram_disk.fx_media_cluster_search_start = ram_disk.fx_media_total_clusters + (FX_FAT_ENTRY_START-1); status = fx_file_create(&ram_disk, name); - _fx_utility_fat_entry_read_error_request = 0; + _fx_utility_fat_entry_read_error_request = 0; ram_disk.fx_media_total_clusters = temp; return_if_fail( status == FX_NO_MORE_SPACE); @@ -1042,7 +1042,7 @@ FX_DIR_ENTRY search_directory; /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); - + /* Set the flag to copy the default format to get NT file name, orphan long file name, and super long file names. */ _fx_ram_driver_copy_default_format = 1; @@ -1059,14 +1059,14 @@ FX_DIR_ENTRY search_directory; status += fx_directory_next_entry_find(&ram_disk, name); status += fx_file_open(&ram_disk, &file_2, name, FX_OPEN_FOR_WRITE); status += fx_directory_next_entry_find(&ram_disk, name); - + /* Write to both files, write to them and close them! */ status += fx_file_write(&file_1, "abcd", 4); status += fx_file_write(&file_2, "abcd", 4); status += fx_file_close(&file_1); status += fx_file_close(&file_2); return_if_fail( status == FX_SUCCESS); - + /* Now look move to the first sub-directory. */ status = fx_directory_default_set(&ram_disk, name); status += fx_directory_first_entry_find(&ram_disk, name); /* . */ @@ -1085,17 +1085,17 @@ FX_DIR_ENTRY search_directory; status += fx_media_volume_get(&ram_disk, volume_name, FX_DIRECTORY_SECTOR); status += fx_directory_first_entry_find(&ram_disk, name); /* ntfile */ status += fx_directory_next_entry_find(&ram_disk, name); /* nt-file~.txt */ - status += fx_directory_next_entry_find(&ram_disk, name); - status += fx_directory_next_entry_find(&ram_disk, name); - status += fx_directory_next_entry_find(&ram_disk, name); - status += fx_directory_next_entry_find(&ram_disk, name); - status += fx_directory_next_entry_find(&ram_disk, name); - status += fx_directory_next_entry_find(&ram_disk, name); + status += fx_directory_next_entry_find(&ram_disk, name); + status += fx_directory_next_entry_find(&ram_disk, name); + status += fx_directory_next_entry_find(&ram_disk, name); + status += fx_directory_next_entry_find(&ram_disk, name); + status += fx_directory_next_entry_find(&ram_disk, name); + status += fx_directory_next_entry_find(&ram_disk, name); /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); - + /* Set the flag to copy the default format to get NT file name, orphan long file name, and super long file names. */ _fx_ram_driver_copy_default_format = 1; @@ -1110,7 +1110,7 @@ FX_DIR_ENTRY search_directory; status += fx_directory_next_entry_find(&ram_disk, name); status += fx_directory_next_entry_find(&ram_disk, name); status += fx_file_open(&ram_disk, &file_2, name, FX_OPEN_FOR_WRITE); - + /* Write to the shorted file. */ status += fx_file_write(&file_2, "abcd", 4); @@ -1119,7 +1119,7 @@ FX_DIR_ENTRY search_directory; status += fx_file_close(&file_2); _fx_utility_logical_sector_write_error_request = 0; return_if_fail( status == FX_IO_ERROR); - + /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); @@ -1138,7 +1138,7 @@ FX_DIR_ENTRY search_directory; status += fx_directory_next_entry_find(&ram_disk, name); status += fx_directory_next_entry_find(&ram_disk, name); status += fx_file_open(&ram_disk, &file_2, name, FX_OPEN_FOR_WRITE); - + /* Write to the shorted file. */ status += fx_file_write(&file_2, "abcd", 4); @@ -1148,7 +1148,7 @@ FX_DIR_ENTRY search_directory; status += fx_file_close(&file_2); ram_disk.fx_media_data_sector_start = temp; return_if_fail( status == FX_FILE_CORRUPT); - + /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); @@ -1177,7 +1177,7 @@ FX_DIR_ENTRY search_directory; status += fx_file_close(&file_2); _fx_utility_logical_sector_read_error_request = 0; return_if_fail( status == FX_IO_ERROR); - + /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); @@ -1208,7 +1208,7 @@ FX_DIR_ENTRY search_directory; /* Now close the file, which will write the shorted file entry out.... not that the shorted flag is not in the actual directory entry. */ status += fx_file_close(&file_2); return_if_fail( status == FX_SUCCESS); - + /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); @@ -1251,7 +1251,7 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(97); } - + /* Close the media. */ status = fx_media_close(&ram_disk); @@ -1261,7 +1261,7 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(98); - } + } /* Set the flag to copy the default format to get NT file name, orphan long file name, and super long file names. */ @@ -1310,7 +1310,7 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(100); } - + /* Close the media. */ status = fx_media_close(&ram_disk); @@ -1320,7 +1320,7 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(101); - } + } /* Set the flag to copy the default format to get NT file name, orphan long file name, and super long file names. */ _fx_ram_driver_copy_default_format = 1; @@ -1368,7 +1368,7 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(103); } - + /* Close the media. */ status = fx_media_close(&ram_disk); @@ -1378,24 +1378,24 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(104); - } + } + - /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 14000, // Total sectors - 128, // Sector size + 14000, // Total sectors + 128, // Sector size 2, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -1403,8 +1403,8 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(105); - } - + } + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -1420,41 +1420,41 @@ FX_DIR_ENTRY search_directory; /* Build a sub-directory structure to further test diretory entry read. */ status = fx_directory_create(&ram_disk, "SUB1"); status += fx_directory_default_set(&ram_disk, "SUB1"); - status += fx_file_create(&ram_disk, "S1_FL1.TXT"); - status += fx_file_create(&ram_disk, "S1_FL2.TXT"); - status += fx_file_create(&ram_disk, "S1_FL3.TXT"); - status += fx_file_create(&ram_disk, "S1_FL4.TXT"); - status += fx_file_create(&ram_disk, "S1_FL5.TXT"); - status += fx_file_create(&ram_disk, "S1_FL6.TXT"); - status += fx_file_create(&ram_disk, "S1_FL7.TXT"); - status += fx_file_create(&ram_disk, "S1_FL8.TXT"); - status += fx_file_create(&ram_disk, "S1_FL9.TXT"); - status += fx_file_create(&ram_disk, "S1_FL10.TXT"); - status += fx_file_create(&ram_disk, "S1_FL11.TXT"); - status += fx_file_create(&ram_disk, "S1_FL12.TXT"); - status += fx_file_create(&ram_disk, "S1_FL13.TXT"); - status += fx_file_create(&ram_disk, "S1_FL14.TXT"); - status += fx_file_create(&ram_disk, "S1_FL15.TXT"); - status += fx_file_create(&ram_disk, "S1_FL16.TXT"); - status += fx_file_create(&ram_disk, "S1_FL17.TXT"); - status += fx_file_create(&ram_disk, "S1_FL18.TXT"); - status += fx_file_create(&ram_disk, "S1_FL19.TXT"); - status += fx_file_create(&ram_disk, "S1_FL20.TXT"); - status += fx_file_create(&ram_disk, "S1_FL21.TXT"); - status += fx_file_create(&ram_disk, "S1_FL22.TXT"); - status += fx_file_create(&ram_disk, "S1_FL23.TXT"); - status += fx_file_create(&ram_disk, "S1_FL24.TXT"); - status += fx_file_create(&ram_disk, "S1_FL25.TXT"); - status += fx_file_create(&ram_disk, "S1_FL26.TXT"); - status += fx_file_create(&ram_disk, "S1_FL27.TXT"); - status += fx_file_create(&ram_disk, "S1_FL28.TXT"); - status += fx_file_create(&ram_disk, "S1_FL29.TXT"); - status += fx_file_create(&ram_disk, "S1_FL30.TXT"); - status += fx_file_create(&ram_disk, "S1_FL31.TXT"); - status += fx_file_create(&ram_disk, "S1_FL32.TXT"); - + status += fx_file_create(&ram_disk, "S1_FL1.TXT"); + status += fx_file_create(&ram_disk, "S1_FL2.TXT"); + status += fx_file_create(&ram_disk, "S1_FL3.TXT"); + status += fx_file_create(&ram_disk, "S1_FL4.TXT"); + status += fx_file_create(&ram_disk, "S1_FL5.TXT"); + status += fx_file_create(&ram_disk, "S1_FL6.TXT"); + status += fx_file_create(&ram_disk, "S1_FL7.TXT"); + status += fx_file_create(&ram_disk, "S1_FL8.TXT"); + status += fx_file_create(&ram_disk, "S1_FL9.TXT"); + status += fx_file_create(&ram_disk, "S1_FL10.TXT"); + status += fx_file_create(&ram_disk, "S1_FL11.TXT"); + status += fx_file_create(&ram_disk, "S1_FL12.TXT"); + status += fx_file_create(&ram_disk, "S1_FL13.TXT"); + status += fx_file_create(&ram_disk, "S1_FL14.TXT"); + status += fx_file_create(&ram_disk, "S1_FL15.TXT"); + status += fx_file_create(&ram_disk, "S1_FL16.TXT"); + status += fx_file_create(&ram_disk, "S1_FL17.TXT"); + status += fx_file_create(&ram_disk, "S1_FL18.TXT"); + status += fx_file_create(&ram_disk, "S1_FL19.TXT"); + status += fx_file_create(&ram_disk, "S1_FL20.TXT"); + status += fx_file_create(&ram_disk, "S1_FL21.TXT"); + status += fx_file_create(&ram_disk, "S1_FL22.TXT"); + status += fx_file_create(&ram_disk, "S1_FL23.TXT"); + status += fx_file_create(&ram_disk, "S1_FL24.TXT"); + status += fx_file_create(&ram_disk, "S1_FL25.TXT"); + status += fx_file_create(&ram_disk, "S1_FL26.TXT"); + status += fx_file_create(&ram_disk, "S1_FL27.TXT"); + status += fx_file_create(&ram_disk, "S1_FL28.TXT"); + status += fx_file_create(&ram_disk, "S1_FL29.TXT"); + status += fx_file_create(&ram_disk, "S1_FL30.TXT"); + status += fx_file_create(&ram_disk, "S1_FL31.TXT"); + status += fx_file_create(&ram_disk, "S1_FL32.TXT"); + /* Now taverse the directory tree and open files. */ - status += fx_directory_first_entry_find(&ram_disk, name); + status += fx_directory_first_entry_find(&ram_disk, name); status += fx_directory_next_entry_find(&ram_disk, name); status += fx_directory_next_entry_find(&ram_disk, name); status += fx_directory_next_entry_find(&ram_disk, name); @@ -1496,10 +1496,10 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(107); - } + } /* Now go back to the beginning of the directory. */ - status += fx_directory_first_entry_find(&ram_disk, name); + status += fx_directory_first_entry_find(&ram_disk, name); status += fx_directory_next_entry_find(&ram_disk, name); status += fx_directory_next_entry_find(&ram_disk, name); status += fx_directory_next_entry_find(&ram_disk, name); @@ -1520,48 +1520,48 @@ FX_DIR_ENTRY search_directory; status += fx_directory_next_entry_find(&ram_disk, name); status += fx_directory_next_entry_find(&ram_disk, name); status += fx_directory_next_entry_find(&ram_disk, name); - + /* Search with I/O read error. */ ram_disk.fx_media_default_path.fx_path_directory.fx_dir_entry_last_search_cluster = 0; /* Cause cluster traversal. */ _fx_utility_fat_entry_read_error_request = 1; status += fx_directory_next_entry_find(&ram_disk, name); _fx_utility_fat_entry_read_error_request = 0; - + /* Determine if the expected I/O error is present. */ if (status != FX_IO_ERROR) { printf("ERROR!\n"); test_control_return(108); - } - + } + /* Search with bad FAT error - too small. */ ram_disk.fx_media_default_path.fx_path_directory.fx_dir_entry_last_search_cluster = 0; /* Cause cluster traversal. */ _fx_utility_fat_entry_read_error_request = 10001; status = fx_directory_next_entry_find(&ram_disk, name); _fx_utility_fat_entry_read_error_request = 0; - + /* Determine if the expected I/O error is present. */ if (status != FX_FILE_CORRUPT) { printf("ERROR!\n"); test_control_return(109); - } - + } + /* Search with bad FAT error - too small. */ ram_disk.fx_media_default_path.fx_path_directory.fx_dir_entry_last_search_cluster = 0; /* Cause cluster traversal. */ _fx_utility_fat_entry_read_error_request = 20001; status = fx_directory_next_entry_find(&ram_disk, name); _fx_utility_fat_entry_read_error_request = 0; - + /* Determine if the expected I/O error is present. */ if (status != FX_FILE_CORRUPT) { printf("ERROR!\n"); test_control_return(110); - } + } /* Corrupt the media to test zero divisor checking. */ ram_disk.fx_media_bytes_per_sector = 0; @@ -1588,7 +1588,7 @@ FX_DIR_ENTRY search_directory; status += fx_unicode_file_create(&ram_disk, my_unicode_name, 15, (CHAR *)buffer); status += fx_unicode_file_create(&ram_disk, my_unicode_name1, 15, (CHAR *)buffer); status += fx_file_create(&ram_disk, name); - + /* Set the search to the beginning of the root directory. */ status += fx_directory_first_entry_find(&ram_disk, name); status += fx_directory_next_entry_find(&ram_disk, name); @@ -1600,34 +1600,34 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(111); - } - + } + /* Now generate an error on the root directory size. */ temp = ram_disk.fx_media_root_sectors; ram_disk.fx_media_root_sectors = 1; status = fx_directory_next_entry_find(&ram_disk, name); ram_disk.fx_media_root_sectors = temp; - + /* Determine if the expected I/O error is present. */ if (status != FX_FILE_CORRUPT) { printf("ERROR!\n"); test_control_return(112); - } + } /* Now generate an error with a logical sector read error. */ _fx_utility_logical_sector_read_error_request = 5; status = fx_directory_next_entry_find(&ram_disk, name); _fx_utility_logical_sector_read_error_request = 0; - + /* Determine if the expected I/O error is present. */ if (status != FX_IO_ERROR) { printf("ERROR!\n"); test_control_return(113); - } + } /* Close the media. */ status = fx_media_close(&ram_disk); @@ -1638,23 +1638,23 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(114); - } - + } + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 14000, // Total sectors - 128, // Sector size + 14000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -1662,8 +1662,8 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(115); - } - + } + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -1689,7 +1689,7 @@ FX_DIR_ENTRY search_directory; status += fx_file_create(&ram_disk, name); status += fx_directory_first_entry_find(&ram_disk, (CHAR *)buffer); status += fx_directory_next_entry_find(&ram_disk, (CHAR *)buffer); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -1698,45 +1698,45 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(117); } - + /* Read the first entry, but with a FAT entry error. */ _fx_utility_fat_entry_read_error_request = 1; status = fx_directory_next_entry_find(&ram_disk, (CHAR *)buffer); _fx_utility_fat_entry_read_error_request = 0; - + /* Determine if the expected I/O error is present. */ if (status != FX_IO_ERROR) { printf("ERROR!\n"); test_control_return(118); - } + } /* Read the first entry, but with a FAT entry error - too small. */ _fx_utility_fat_entry_read_error_request = 10001; status = fx_directory_next_entry_find(&ram_disk, (CHAR *)buffer); _fx_utility_fat_entry_read_error_request = 0; - + /* Determine if the expected I/O error is present. */ if (status != FX_FILE_CORRUPT) { printf("ERROR!\n"); test_control_return(119); - } - + } + /* Read the first entry, but with a FAT entry error - too big. */ _fx_utility_fat_entry_read_error_request = 20001; status = fx_directory_next_entry_find(&ram_disk, (CHAR *)buffer); _fx_utility_fat_entry_read_error_request = 0; - + /* Determine if the expected I/O error is present. */ if (status != FX_FILE_CORRUPT) { printf("ERROR!\n"); test_control_return(120); - } + } /* Close the media. */ status = fx_media_close(&ram_disk); @@ -1747,23 +1747,23 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(121); - } + } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 512, // Directory Entries 0, // Hidden sectors - 14000, // Total sectors - 128, // Sector size + 14000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -1771,8 +1771,8 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(122); - } - + } + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -1796,17 +1796,17 @@ FX_DIR_ENTRY search_directory; _fx_utility_logical_sector_write_error_request = 22; status = fx_file_create(&ram_disk, name); _fx_utility_logical_sector_write_error_request = 0; - + /* Setup an I/O error on the first logical sectory write of the directory entry. */ status += fx_media_flush(&ram_disk); - + /* Determine if have the expected I/O error. */ if (status != FX_IO_ERROR) { printf("ERROR!\n"); test_control_return(124); - } + } /* Close the media. */ status = fx_media_close(&ram_disk); @@ -1817,24 +1817,24 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(125); - } + } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 512, // Directory Entries 0, // Hidden sectors - 14000, // Total sectors - 128, // Sector size + 14000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -1842,8 +1842,8 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(126); - } - + } + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -1867,17 +1867,17 @@ FX_DIR_ENTRY search_directory; _fx_utility_logical_sector_read_error_request = 45; status = fx_file_create(&ram_disk, name); _fx_utility_logical_sector_read_error_request = 0; - + /* Setup an I/O error on the first logical sectory write of the directory entry. */ status += fx_media_flush(&ram_disk); - + /* Determine if have the expected I/O error. */ if (status != FX_IO_ERROR) { printf("ERROR!\n"); test_control_return(128); - } + } /* Close the media. */ status = fx_media_close(&ram_disk); @@ -1888,23 +1888,23 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(129); - } + } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 512, // Directory Entries 0, // Hidden sectors - 14000, // Total sectors - 128, // Sector size + 14000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -1912,8 +1912,8 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(130); - } - + } + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -1938,17 +1938,17 @@ FX_DIR_ENTRY search_directory; ram_disk.fx_media_data_sector_start = ram_disk.fx_media_root_sector_start+1; status = fx_file_create(&ram_disk, name); ram_disk.fx_media_data_sector_start = temp; - + /* Setup an I/O error on the first logical sectory write of the directory entry. */ status += fx_media_flush(&ram_disk); - + /* Determine if have the expected error. */ if (status != FX_FILE_CORRUPT) { printf("ERROR!\n"); test_control_return(132); - } + } /* Close the media. */ status = fx_media_close(&ram_disk); @@ -1959,23 +1959,23 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(133); - } + } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 512, // Directory Entries 0, // Hidden sectors - 14000, // Total sectors - 128, // Sector size + 14000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -1983,8 +1983,8 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(134); - } - + } + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -2024,17 +2024,17 @@ FX_DIR_ENTRY search_directory; _fx_utility_fat_entry_read_error_request = 14; status = fx_file_create(&ram_disk, name); _fx_utility_fat_entry_read_error_request = 0; - + /* Setup an I/O error on the first logical sectory write of the directory entry. */ status += fx_media_flush(&ram_disk); - + /* Determine if have the expected error. */ if (status != FX_IO_ERROR) { printf("ERROR!\n"); test_control_return(137); - } + } /* Close the media. */ status = fx_media_close(&ram_disk); @@ -2045,23 +2045,23 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(138); - } + } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 512, // Directory Entries 0, // Hidden sectors - 14000, // Total sectors - 128, // Sector size + 14000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -2069,8 +2069,8 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(139); - } - + } + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -2110,17 +2110,17 @@ FX_DIR_ENTRY search_directory; _fx_utility_fat_entry_read_error_request = 10014; status = fx_file_create(&ram_disk, name); _fx_utility_fat_entry_read_error_request = 0; - + /* Setup an I/O error on the first logical sectory write of the directory entry. */ status += fx_media_flush(&ram_disk); - + /* Determine if have the expected error. */ if (status != FX_FILE_CORRUPT) { printf("ERROR!\n"); test_control_return(142); - } + } /* Close the media. */ status = fx_media_close(&ram_disk); @@ -2131,23 +2131,23 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(143); - } + } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 512, // Directory Entries 0, // Hidden sectors - 14000, // Total sectors - 128, // Sector size + 14000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -2155,8 +2155,8 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(144); - } - + } + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -2196,17 +2196,17 @@ FX_DIR_ENTRY search_directory; _fx_utility_fat_entry_read_error_request = 20014; status = fx_file_create(&ram_disk, name); _fx_utility_fat_entry_read_error_request = 0; - + /* Setup an I/O error on the first logical sectory write of the directory entry. */ status += fx_media_flush(&ram_disk); - + /* Determine if have the expected error. */ if (status != FX_FILE_CORRUPT) { printf("ERROR!\n"); test_control_return(147); - } + } /* Close the media. */ status = fx_media_close(&ram_disk); @@ -2217,23 +2217,23 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(148); - } + } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 10000, // Directory Entries 0, // Hidden sectors - 64000, // Total sectors - 128, // Sector size + 64000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -2241,8 +2241,8 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(149); - } - + } + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -2254,7 +2254,7 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(150); } - + /* Create a file name that execises the short name with a 0xE5 and a dot less than the eighth character. */ status = fx_file_create(&ram_disk, "a.a"); status += fx_media_flush(&ram_disk); @@ -2280,7 +2280,7 @@ FX_DIR_ENTRY search_directory; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(151); - } + } /* Create some files to test the logic in fx_directory_entry_read */ status = fx_file_create(&ram_disk, "a"); @@ -2324,7 +2324,7 @@ FX_DIR_ENTRY search_directory; status += fx_file_delete(&ram_disk, "aaaaaa."); status += fx_file_delete(&ram_disk, "aaaaaaa."); status += fx_file_delete(&ram_disk, "aaaaaaaa."); - + /* Create a name with an 0xe5 in the front. */ name[0] = (CHAR)0xE5; name[1] = 'a'; @@ -2346,7 +2346,7 @@ FX_DIR_ENTRY search_directory; status += fx_file_write(&file_1, "1", 1); status += fx_file_close(&file_1); -#if EXTENDED_NAME_MANGLE_TEST +#if EXTENDED_NAME_MANGLE_TEST name[0] = 'a'; name[1] = 'B'; name[2] = 'C'; @@ -2366,14 +2366,14 @@ FX_DIR_ENTRY search_directory; for (j = 0; j < 10; j++) { - + name[8] = '0' + j; - + for (k = 0; k < 10; k++) { name[9] = '0' + k; - + for (l = 0; l < 10; l++) { if (status) @@ -2408,26 +2408,26 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(153); - } - - + } + + /* Test corner cases on fx_directory_search. */ - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 256, // Directory Entries 0, // Hidden sectors - 14000, // Total sectors - 128, // Sector size + 14000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -2435,8 +2435,8 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(154); - } - + } + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -2448,7 +2448,7 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(155); } - + /* Build a long directory structure. */ status = fx_directory_create(&ram_disk, "/sub-directory_depth_00001"); status += fx_directory_create(&ram_disk, "sub-directory_depth_00001/sub-directory_depth_00002"); @@ -2473,8 +2473,8 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(156); - } - + } + status = fx_file_create(&ram_disk, "/sub-directory_depth_00001/sub-directory_depth_00002/sub-directory_depth_00003/sub-directory_depth_00004/sub-directory_depth_00005/sub-directory_depth_00006/sub-directory_depth_00007/sub-directory_depth_00008/sub-directory_depth_00009/sub-directory_depth_00010/sub-directory_depth_00011/file2.txt"); status += fx_file_open(&ram_disk, &file_2, "/sub-directory_depth_00001/sub-directory_depth_00002/sub-directory_depth_00003/sub-directory_depth_00004/sub-directory_depth_00005/sub-directory_depth_00006/sub-directory_depth_00007/sub-directory_depth_00008/sub-directory_depth_00009/sub-directory_depth_00010/sub-directory_depth_00011/file2.txt", FX_OPEN_FOR_WRITE); status += fx_directory_default_set(&ram_disk, "sub-directory_depth_00001/sub-directory_depth_00002/sub-directory_depth_00003/sub-directory_depth_00004/sub-directory_depth_00005/sub-directory_depth_00006/sub-directory_depth_00007/sub-directory_depth_00008/sub-directory_depth_00009/sub-directory_depth_00010/sub-directory_depth_00011"); @@ -2492,23 +2492,23 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(157); - } + } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 256, // Directory Entries 0, // Hidden sectors - 14000, // Total sectors - 128, // Sector size + 14000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -2516,8 +2516,8 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(158); - } - + } + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -2537,17 +2537,17 @@ FX_DIR_ENTRY search_directory; } name[0] = '/'; name[256] = 0; - + status = fx_directory_create(&ram_disk, name); - + name[256] = '/'; name[257] = 'f'; name[258] = 'i'; name[259] = 'l'; name[260] = 'e'; name[261] = 0; - - status += fx_file_create(&ram_disk, name); + + status += fx_file_create(&ram_disk, name); status += fx_file_open(&ram_disk, &file_1, name, FX_OPEN_FOR_WRITE); status += fx_directory_short_name_get(&ram_disk, name, (CHAR *)buffer); status += fx_directory_short_name_get(&ram_disk, name, (CHAR *)buffer); @@ -2561,7 +2561,7 @@ FX_DIR_ENTRY search_directory; status += fx_file_close(&file_1); status += fx_file_open(&ram_disk, &file_1, &name[1], FX_OPEN_FOR_WRITE); status += fx_file_close(&file_1); - status += fx_file_delete(&ram_disk, name); + status += fx_file_delete(&ram_disk, name); /* Build a perfect fit long sub-directory name and file name... This name will fit exactly into the fx_directory_search cache. */ for (i = 0; i < FX_MAX_LONG_NAME_LEN; i++) @@ -2570,17 +2570,17 @@ FX_DIR_ENTRY search_directory; } name[0] = '/'; name[250] = 0; - + status += fx_directory_create(&ram_disk, name); - + name[250] = '/'; name[251] = 'f'; name[252] = 'i'; name[253] = 'l'; name[254] = 'e'; name[255] = 0; - - status = fx_file_create(&ram_disk, name); + + status = fx_file_create(&ram_disk, name); status += fx_file_open(&ram_disk, &file_1, name, FX_OPEN_FOR_WRITE); status += fx_directory_short_name_get(&ram_disk, name, (CHAR *)buffer); status += fx_directory_short_name_get(&ram_disk, name, (CHAR *)buffer); @@ -2594,9 +2594,9 @@ FX_DIR_ENTRY search_directory; status += fx_file_close(&file_1); status += fx_file_open(&ram_disk, &file_1, &name[1], FX_OPEN_FOR_WRITE); status += fx_file_close(&file_1); - status = fx_file_delete(&ram_disk, name); + status = fx_file_delete(&ram_disk, name); + - /* Close the media. */ status = fx_media_close(&ram_disk); @@ -2606,24 +2606,24 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(160); - } + } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 256, // Directory Entries 0, // Hidden sectors - 14000, // Total sectors - 128, // Sector size + 14000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -2631,8 +2631,8 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(161); - } - + } + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -2654,17 +2654,17 @@ FX_DIR_ENTRY search_directory; name[0] = '/'; name[255] = 0; status += fx_directory_create(&ram_disk, name); - - + + name[253] = 0; - + status += fx_directory_create(&ram_disk, name); - + name[253] = '/'; name[254] = 'a'; name[255] = 0; - - status = fx_file_create(&ram_disk, name); + + status = fx_file_create(&ram_disk, name); status += fx_file_open(&ram_disk, &file_1, name, FX_OPEN_FOR_WRITE); status += fx_directory_short_name_get(&ram_disk, name, (CHAR *)buffer); status += fx_file_close(&file_1); @@ -2682,8 +2682,8 @@ FX_DIR_ENTRY search_directory; name[258] = 'a'; name[259] = 0; _fx_directory_search(&ram_disk, name, &dir_entry, &search_directory, &name_ptr); - - + + /* Set the name back to the original size. */ name[255] = 0; status += fx_file_open(&ram_disk, &file_1, name, FX_OPEN_FOR_WRITE); @@ -2692,26 +2692,26 @@ FX_DIR_ENTRY search_directory; /* Now make the name long again to test relative, no path. */ name[255] = 'a'; - + /* Now let's perform a maximum relative search. */ _fx_directory_search(&ram_disk, &name[1], &dir_entry, &search_directory, &name_ptr); - + /* Now lets set a path and test that out. */ name[253] = 0; status += fx_directory_default_set(&ram_disk, name); - + /* Now set the name back to the original size. */ name[253] = '/'; name[255] = 0; - + status += fx_file_open(&ram_disk, &file_1, name, FX_OPEN_FOR_WRITE); status += fx_directory_short_name_get(&ram_disk, name, (CHAR *)buffer); status += fx_file_close(&file_1); /* Now make the name long again to test relative, with path. */ name[255] = 'a'; - + /* Now let's perform a maximum relative search. */ _fx_directory_search(&ram_disk, &name[1], &dir_entry, &search_directory, &name_ptr); @@ -2720,11 +2720,11 @@ FX_DIR_ENTRY search_directory; name[254] = 'a'; name[255] = 0; status += fx_directory_default_set(&ram_disk, name); - + /* Now set the name back to the original size. */ name[253] = '/'; name[255] = 0; - + status += fx_file_open(&ram_disk, &file_1, name, FX_OPEN_FOR_WRITE); status += fx_directory_short_name_get(&ram_disk, name, (CHAR *)buffer); status += fx_file_close(&file_1); @@ -2736,11 +2736,11 @@ FX_DIR_ENTRY search_directory; } ram_disk.fx_media_last_found_name[0] = '/'; name[255] = 'a'; - name[256] = 0; + name[256] = 0; /* Now let's perform a maximum relative search. */ _fx_directory_search(&ram_disk, &name[1], &dir_entry, &search_directory, &name_ptr); - + /* Now let's setup a directory search with a NULL path, a maximum found file name, and alternate directory separators. */ ram_disk.fx_media_default_path.fx_path_name_buffer[0] = 0; strcpy(&ram_disk.fx_media_last_found_name[0], "\\abc\\def\\ghi\\abc"); @@ -2749,7 +2749,7 @@ FX_DIR_ENTRY search_directory; ram_disk.fx_media_last_found_file_name[i] = 'a'; ram_disk.fx_media_last_found_directory.fx_dir_entry_name[i] = 'a'; } - ram_disk.fx_media_last_found_file_name[255] = 0; + ram_disk.fx_media_last_found_file_name[255] = 0; ram_disk.fx_media_last_found_directory.fx_dir_entry_name[255] = 0; ram_disk.fx_media_last_found_directory_valid = FX_TRUE; _fx_directory_search(&ram_disk, "abc\\def\\ghi\\abc", &dir_entry, &search_directory, &name_ptr); @@ -2762,12 +2762,12 @@ FX_DIR_ENTRY search_directory; ram_disk.fx_media_last_found_file_name[i] = 'a'; ram_disk.fx_media_last_found_directory.fx_dir_entry_name[i] = 'a'; } - ram_disk.fx_media_last_found_file_name[255] = 0; + ram_disk.fx_media_last_found_file_name[255] = 0; ram_disk.fx_media_last_found_directory.fx_dir_entry_name[25] = 0; ram_disk.fx_media_last_found_directory_valid = FX_TRUE; _fx_directory_search(&ram_disk, "abc\\def\\ghi\\abc", &dir_entry, &search_directory, &name_ptr); - - + + /* Close the media. */ status = fx_media_close(&ram_disk); @@ -2777,24 +2777,24 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(163); - } + } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 256, // Directory Entries 0, // Hidden sectors - 14000, // Total sectors - 128, // Sector size + 14000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -2802,8 +2802,8 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(164); - } - + } + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -2821,20 +2821,20 @@ FX_DIR_ENTRY search_directory; status += fx_directory_create(&ram_disk, "/abc/def"); status += fx_directory_create(&ram_disk, "/abc/def/ghi"); status += fx_directory_create(&ram_disk, "/abc/def/ghi/jkl"); - status += fx_file_create(&ram_disk, "/abc/def/ghi/jkl/file.txt"); - status += fx_file_create(&ram_disk, "/abc/def/ghi/jkl/file2.txt"); - status += fx_file_create(&ram_disk, "/abc/def/ghi/jkl/file3.txt"); - status += fx_file_create(&ram_disk, "/abc/def/ghi/jkl/file4.txt"); - status += fx_file_create(&ram_disk, "/abc/def/ghi/jkl/file5.txt"); - status += fx_file_create(&ram_disk, "/abc/def/ghi/jkl/file6.txt"); - status += fx_file_create(&ram_disk, "/abc/def/ghi/jkl/file7.txt"); - status += fx_file_create(&ram_disk, "/abc/def/ghi/jkl/file8.txt"); - status += fx_file_create(&ram_disk, "/abc/def/ghi/jkl/file9.txt"); - status += fx_file_create(&ram_disk, "/abc/def/ghi/jkl/file10.txt"); - status += fx_file_create(&ram_disk, "/abc/def/ghi/jkl/file11.txt"); + status += fx_file_create(&ram_disk, "/abc/def/ghi/jkl/file.txt"); + status += fx_file_create(&ram_disk, "/abc/def/ghi/jkl/file2.txt"); + status += fx_file_create(&ram_disk, "/abc/def/ghi/jkl/file3.txt"); + status += fx_file_create(&ram_disk, "/abc/def/ghi/jkl/file4.txt"); + status += fx_file_create(&ram_disk, "/abc/def/ghi/jkl/file5.txt"); + status += fx_file_create(&ram_disk, "/abc/def/ghi/jkl/file6.txt"); + status += fx_file_create(&ram_disk, "/abc/def/ghi/jkl/file7.txt"); + status += fx_file_create(&ram_disk, "/abc/def/ghi/jkl/file8.txt"); + status += fx_file_create(&ram_disk, "/abc/def/ghi/jkl/file9.txt"); + status += fx_file_create(&ram_disk, "/abc/def/ghi/jkl/file10.txt"); + status += fx_file_create(&ram_disk, "/abc/def/ghi/jkl/file11.txt"); status += fx_directory_default_set(&ram_disk, "/abc"); status += fx_directory_first_entry_find(&ram_disk, name); - + /* Now open the file to get it into the search cache. */ status += fx_file_open(&ram_disk, &file_1, "/abc/def/ghi/jkl/file.txt", FX_OPEN_FOR_WRITE); status += fx_file_close(&file_1); @@ -2844,14 +2844,14 @@ FX_DIR_ENTRY search_directory; status += fx_file_close(&file_1); status += fx_directory_default_set(&ram_disk, "/"); status += fx_file_open(&ram_disk, &file_1, "abc/def/ghi/jkl/file.txt", FX_OPEN_FOR_WRITE); - status += fx_file_close(&file_1); + status += fx_file_close(&file_1); status += fx_directory_next_entry_find(&ram_disk, name); /* Now test for FAT read errors. */ _fx_utility_fat_entry_read_error_request = 1; status += fx_file_open(&ram_disk, &file_2, "abc/def/ghi/jkl/file2.txt", FX_OPEN_FOR_WRITE); _fx_utility_fat_entry_read_error_request = 0; - + /* Check the status... should be an I/O error at this point. */ if (status != FX_IO_ERROR) { @@ -2860,12 +2860,12 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(166); } - + /* Now test a FAT entry value that is too small. */ _fx_utility_fat_entry_read_error_request = 10001; status = fx_file_open(&ram_disk, &file_2, "abc/def/ghi/jkl/file2.txt", FX_OPEN_FOR_WRITE); _fx_utility_fat_entry_read_error_request = 0; - + /* Check the status... should be a FAT read error. */ if (status != FX_FAT_READ_ERROR) { @@ -2874,14 +2874,14 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(167); } - + /* Now test a FAT entry value that is too large. */ temp = ram_disk.fx_media_total_clusters; _fx_utility_fat_entry_read_error_request = 40001; status = fx_file_open(&ram_disk, &file_2, "abc/def/ghi/jkl/file2.txt", FX_OPEN_FOR_WRITE); _fx_utility_fat_entry_read_error_request = 0; ram_disk.fx_media_total_clusters = temp; - + /* Check the status... should be a FAT read error. */ if (status != FX_FAT_READ_ERROR) { @@ -2890,12 +2890,12 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(168); } - + /* Now test a FAT entry value that is the same as the cluster itself. */ _fx_utility_fat_entry_read_error_request = 30001; status = fx_file_open(&ram_disk, &file_2, "abc/def/ghi/jkl/file2.txt", FX_OPEN_FOR_WRITE); _fx_utility_fat_entry_read_error_request = 0; - + /* Check the status... should be a FAT read error. */ if (status != FX_FAT_READ_ERROR) { @@ -2904,11 +2904,11 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(169); } - + /* Now perform a good open. */ status = fx_file_open(&ram_disk, &file_2, "abc/def/ghi/jkl/file2.txt", FX_OPEN_FOR_WRITE); - status += fx_file_close(&file_2); - + status += fx_file_close(&file_2); + /* Check the status. */ if (status != FX_SUCCESS) { @@ -2917,7 +2917,7 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(166); } - + /* Setup info for direct call to directory search. */ dir_entry.fx_dir_entry_name = ram_disk.fx_media_name_buffer + FX_MAX_LONG_NAME_LEN; search_directory.fx_dir_entry_name = ram_disk.fx_media_name_buffer + FX_MAX_LONG_NAME_LEN * 2; @@ -2926,34 +2926,34 @@ FX_DIR_ENTRY search_directory; /* Lets perform a search that from the root directory. */ _fx_directory_search(&ram_disk, "/abc/..", &dir_entry, &search_directory, &name_ptr); - + /* Now setup a maximum default path. */ for (i = 0; i < FX_MAX_LAST_NAME_LEN; i++) { name[i] = 'a'; } name[255] = 0; - + /* Create a sub-directory of maximum lenght. */ status = fx_directory_create(&ram_disk, name); - + /* Set the default path to this name. */ status += fx_directory_default_set(&ram_disk, name); - + /* Create a file in the sub-directory path. */ status += fx_file_create(&ram_disk, "file1.txt"); - + /* Open the file to test the directory search cache name build. */ status += fx_file_open(&ram_disk, &file_1, "file1.txt", FX_OPEN_FOR_WRITE); - + /* Determine if the test was successful. */ if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(167); - } - + } + /* Close the media. */ status = fx_media_close(&ram_disk); @@ -2966,20 +2966,20 @@ FX_DIR_ENTRY search_directory; /* Test for https://github.com/azure-rtos/filex/issues/26 */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 4, // Directory Entries 0, // Hidden sectors - 128, // Total sectors - 128, // Sector size + 128, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); /* Open the ram_disk. */ @@ -2999,8 +2999,8 @@ FX_DIR_ENTRY search_directory; status += fx_directory_create(&ram_disk, "MYDIR/MYDIR1/MYDIR2"); status += fx_directory_create(&ram_disk, "MYDIR/MYDIR1/MYDIR2/MYDIR3"); return_if_fail( status == FX_SUCCESS); - - status = fx_file_create(&ram_disk, "MYDIR/MYDIR1/MYDIR2/MYDIR3/TEST.TXT"); + + status = fx_file_create(&ram_disk, "MYDIR/MYDIR1/MYDIR2/MYDIR3/TEST.TXT"); return_if_fail( status == FX_SUCCESS); available_clusters = ram_disk.fx_media_available_clusters; @@ -3045,7 +3045,7 @@ FX_DIR_ENTRY search_directory; printf("ERROR!\n"); test_control_return(169); - } + } else { diff --git a/test/regression_test/filex_directory_default_path_get_set_test.c b/test/regression_test/filex_directory_default_path_get_set_test.c index 485e8c7..571d166 100644 --- a/test/regression_test/filex_directory_default_path_get_set_test.c +++ b/test/regression_test/filex_directory_default_path_get_set_test.c @@ -54,13 +54,13 @@ void filex_directory_default_get_set_application_define(void *first_unused_me #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -101,20 +101,20 @@ UINT i; printf("FileX Test: Directory default get/set test........................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -123,7 +123,7 @@ UINT i; printf("ERROR!\n"); test_control_return(1); } - + /* Attempt to set the default directory before the media has been opened to generate an error */ status = fx_directory_default_set(&ram_disk, "/A0"); if (status != FX_MEDIA_NOT_OPEN) @@ -131,7 +131,7 @@ UINT i; printf("ERROR!\n"); test_control_return(2); } - + /* Attempt to get the default directory before the media has been opened to generate an error */ status = fx_directory_default_get(&ram_disk, &path_ptr); if (status != FX_MEDIA_NOT_OPEN) @@ -142,7 +142,7 @@ UINT i; /* Attempt to get copy of the default directory before the media has been opened to generate an error */ status = fx_directory_default_get_copy(&ram_disk, test_path_name_buffer, sizeof(test_path_name_buffer)); - + /* Determine if the test was successful. */ if (status != FX_MEDIA_NOT_OPEN) { @@ -154,7 +154,7 @@ UINT i; #ifndef FX_NO_LOCAL_PATH /* Attempt to get copy of the directory local path before the media has been opened to generate an error */ status = _fx_directory_local_path_get_copy(&ram_disk, test_path_name_buffer, sizeof(test_path_name_buffer)); - + /* Determine if the test was successful. */ if (status != FX_MEDIA_NOT_OPEN) { @@ -187,24 +187,24 @@ UINT i; printf("ERROR!\n"); test_control_return(5); } - + temp = ram_disk.fx_media_id; ram_disk.fx_media_id = 0; - + /* Give a media pointer with bad data to cause an error */ status = fx_directory_default_get(&ram_disk, &path_ptr); - + /* Check the status */ if (status != FX_MEDIA_NOT_OPEN) { - + /* Error opening the media */ printf("ERROR!\n"); test_control_return(6); } - + ram_disk.fx_media_id = temp; - + #ifndef FX_DISABLE_ERROR_CHECKING /* Give a bad ram pointer to cause an error */ status = fx_directory_default_get(NULL, &path_ptr); @@ -217,7 +217,7 @@ UINT i; printf("ERROR!\n"); test_control_return(7); } - + /* Give a bad path pointer to cause an error */ status = fx_directory_default_get(&ram_disk, NULL); @@ -251,7 +251,7 @@ UINT i; printf("ERROR!\n"); test_control_return(9); } - + /* Attempt to set the default directory to something that is not a directory to generate an error */ status = fx_directory_default_set(&ram_disk, "NOT_A_DIR"); if (status != FX_INVALID_PATH) @@ -277,7 +277,7 @@ UINT i; printf("ERROR!\n"); test_control_return(12); } - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING /* send null pointer to default directory set to generate an error */ @@ -298,7 +298,7 @@ UINT i; status += fx_directory_create(&ram_disk, "A5"); status += fx_directory_default_get(&ram_disk, &path_ptr); - + status += fx_directory_default_set(&ram_disk, "/B0"); status += fx_directory_create(&ram_disk, "B1"); status += fx_directory_create(&ram_disk, "B2"); @@ -306,7 +306,7 @@ UINT i; status += fx_directory_create(&ram_disk, "B4"); status += fx_directory_create(&ram_disk, "B5"); status += fx_directory_default_get(&ram_disk, &path_ptr); - + status += fx_directory_default_set(&ram_disk, "/C0"); status += fx_directory_create(&ram_disk, "C1"); status += fx_directory_create(&ram_disk, "C2"); @@ -338,7 +338,7 @@ UINT i; status += fx_directory_create(&ram_disk, "F4"); status += fx_directory_create(&ram_disk, "F5"); status += fx_directory_default_get(&ram_disk, &path_ptr); - + status += fx_directory_default_set(&ram_disk, "/G0"); status += fx_directory_create(&ram_disk, "G1"); status += fx_directory_create(&ram_disk, "G2"); @@ -372,7 +372,7 @@ UINT i; printf("ERROR!\n"); test_control_return(14); } - + if (strcmp(path_name_buffer, "/I0")) { printf("ERROR!\n"); @@ -391,7 +391,7 @@ UINT i; status += fx_directory_create(&ram_disk, "test"); status += fx_directory_delete(&ram_disk, "test"); status += fx_directory_local_path_clear(&ram_disk); - + /* Check for errors... */ if (status != FX_SUCCESS) { @@ -401,7 +401,7 @@ UINT i; test_control_return(15); } #endif - + /* create the rest as normal */ status = fx_directory_default_set(&ram_disk, "/A0/A1"); status += fx_directory_create(&ram_disk, "A00"); @@ -419,7 +419,7 @@ UINT i; status += fx_directory_create(&ram_disk, "H2/H00"); status += fx_directory_create(&ram_disk, "/I0/I3/I00"); status += fx_directory_default_get(&ram_disk, &path_ptr); - + /* Check for errors... */ if (status != FX_SUCCESS) { @@ -455,13 +455,13 @@ UINT i; status += fx_directory_delete(&ram_disk, "/A0/A3"); status += fx_directory_delete(&ram_disk, "/A0/A4"); status += fx_directory_delete(&ram_disk, "/A0/A5"); - + status += fx_directory_delete(&ram_disk, "/B0/B1"); status += fx_directory_delete(&ram_disk, "/B0/B2"); status += fx_directory_delete(&ram_disk, "/B0/B3"); status += fx_directory_delete(&ram_disk, "/B0/B4"); status += fx_directory_delete(&ram_disk, "/B0/B5"); - + status += fx_directory_delete(&ram_disk, "/C0/C1"); status += fx_directory_delete(&ram_disk, "/C0/C2"); status += fx_directory_delete(&ram_disk, "/C0/C3"); @@ -485,7 +485,7 @@ UINT i; status += fx_directory_delete(&ram_disk, "/F0/F3"); status += fx_directory_delete(&ram_disk, "/F0/F4"); status += fx_directory_delete(&ram_disk, "/F0/F5"); - + status += fx_directory_delete(&ram_disk, "/G0/G1"); status += fx_directory_delete(&ram_disk, "/G0/G2"); status += fx_directory_delete(&ram_disk, "/G0/G3"); @@ -503,7 +503,7 @@ UINT i; status += fx_directory_delete(&ram_disk, "/I0/I3"); status += fx_directory_delete(&ram_disk, "/I0/I4"); status += fx_directory_delete(&ram_disk, "/I0/I5"); - + /* Check for errors... */ if (status != FX_SUCCESS) { @@ -544,7 +544,7 @@ UINT i; printf("ERROR!\n"); test_control_return(20); } - + /* Close the media. */ status = fx_media_close(&ram_disk); @@ -555,23 +555,23 @@ UINT i; printf("ERROR!\n"); test_control_return(21); } - - + + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4096, // Total sectors - 128, // Sector size + 4096, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -580,7 +580,7 @@ UINT i; printf("ERROR!\n"); test_control_return(22); } - + /* Open the ram_disk - with one logical sector cache! */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -595,7 +595,7 @@ UINT i; /* Create a sub-directory. */ status = fx_directory_create(&ram_disk, "sub-directory-level_001"); - + /* Attempt to set a path with a NULL path name. */ status += _fx_directory_default_set(&ram_disk, FX_NULL); @@ -617,12 +617,12 @@ UINT i; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_cluster = 0; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_value = 0; } - + /* Try to set the current path but with an I/O error coming from the directory search. */ _fx_utility_logical_sector_read_error_request = 1; status = fx_directory_default_set(&ram_disk, "sub-directory-level_001"); _fx_utility_logical_sector_read_error_request = 0; - + /* Check the status - should be an I/O error! */ if (status != FX_INVALID_PATH) { @@ -634,7 +634,7 @@ UINT i; /* Try to set the current path to the first sub-directory. */ status = fx_directory_default_set(&ram_disk, "sub-directory-level_001"); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -643,10 +643,10 @@ UINT i; printf("ERROR!\n"); test_control_return(26); } - + /* Try to set the current path to the same relative sub-directory. */ status = fx_directory_default_set(&ram_disk, "."); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -658,7 +658,7 @@ UINT i; /* Try to set the current path back to root directory relative to the current directory. */ status = fx_directory_default_set(&ram_disk, ".."); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -670,33 +670,33 @@ UINT i; /* Create a set of sub-directories that exceeds the maximum path size. */ status = fx_directory_default_set(&ram_disk, "sub-directory-level_001"); - status += fx_directory_create(&ram_disk, "sub-directory-level_002"); + status += fx_directory_create(&ram_disk, "sub-directory-level_002"); status += fx_directory_default_set(&ram_disk, "sub-directory-level_002"); - status += fx_directory_create(&ram_disk, "sub-directory-level_003"); + status += fx_directory_create(&ram_disk, "sub-directory-level_003"); status += fx_directory_default_set(&ram_disk, "sub-directory-level_003"); - status += fx_directory_create(&ram_disk, "sub-directory-level_004"); + status += fx_directory_create(&ram_disk, "sub-directory-level_004"); status += fx_directory_default_set(&ram_disk, "sub-directory-level_004"); - status += fx_directory_create(&ram_disk, "sub-directory-level_005"); + status += fx_directory_create(&ram_disk, "sub-directory-level_005"); status += fx_directory_default_set(&ram_disk, "sub-directory-level_005"); - status += fx_directory_create(&ram_disk, "sub-directory-level_006"); + status += fx_directory_create(&ram_disk, "sub-directory-level_006"); status += fx_directory_default_set(&ram_disk, "sub-directory-level_006"); - status += fx_directory_create(&ram_disk, "sub-directory-level_007"); + status += fx_directory_create(&ram_disk, "sub-directory-level_007"); status += fx_directory_default_set(&ram_disk, "sub-directory-level_007"); - status += fx_directory_create(&ram_disk, "sub-directory-level_008"); + status += fx_directory_create(&ram_disk, "sub-directory-level_008"); status += fx_directory_default_set(&ram_disk, "sub-directory-level_008"); - status += fx_directory_create(&ram_disk, "sub-directory-level_009"); + status += fx_directory_create(&ram_disk, "sub-directory-level_009"); status += fx_directory_default_set(&ram_disk, "sub-directory-level_009"); - status += fx_directory_create(&ram_disk, "sub-directory-level_010"); + status += fx_directory_create(&ram_disk, "sub-directory-level_010"); status += fx_directory_default_set(&ram_disk, "sub-directory-level_010"); - status += fx_directory_create(&ram_disk, "sub-directory-level_011"); + status += fx_directory_create(&ram_disk, "sub-directory-level_011"); status += fx_directory_default_set(&ram_disk, "sub-directory-level_011"); - status += fx_directory_create(&ram_disk, "sub-directory-level_012"); + status += fx_directory_create(&ram_disk, "sub-directory-level_012"); status += fx_directory_default_set(&ram_disk, "sub-directory-level_012"); - status += fx_directory_create(&ram_disk, "sub-directory-level_013"); + status += fx_directory_create(&ram_disk, "sub-directory-level_013"); status += fx_directory_default_set(&ram_disk, "sub-directory-level_013"); - status += fx_directory_create(&ram_disk, "sub-directory-level_014"); + status += fx_directory_create(&ram_disk, "sub-directory-level_014"); status += fx_directory_default_set(&ram_disk, "sub-directory-level_014"); - status += fx_directory_create(&ram_disk, "sub-directory-level_015"); + status += fx_directory_create(&ram_disk, "sub-directory-level_015"); status += fx_directory_default_set(&ram_disk, "sub-directory-level_015"); /* Now backup to the root directory. */ @@ -745,7 +745,7 @@ UINT i; status += fx_directory_default_set(&ram_disk, ".."); status += fx_directory_default_set(&ram_disk, ".."); status += fx_directory_default_set(&ram_disk, ".."); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -774,7 +774,7 @@ UINT i; /* Now backup to the root directory - one sub-directory at a time. */ status += fx_directory_default_set(&ram_disk, "..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\.."); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -805,7 +805,7 @@ UINT i; status += fx_directory_first_entry_find(&ram_disk, name); status += fx_directory_first_entry_find(&ram_disk, name); status += fx_directory_first_entry_find(&ram_disk, name); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -814,7 +814,7 @@ UINT i; printf("ERROR!\n"); test_control_return(32); } - + /* Now try to have a new path relative back to the root directory, and then back to itself. */ status = fx_directory_default_set(&ram_disk, "sub-directory-level_001"); @@ -826,7 +826,7 @@ UINT i; ram_disk.fx_media_default_path.fx_path_string[0] = ' '; status += fx_directory_default_set(&ram_disk, "../sub-directory-level_001"); - status += fx_directory_default_set(&ram_disk, ".."); + status += fx_directory_default_set(&ram_disk, ".."); status += fx_directory_first_entry_find(&ram_disk, name); /* Check the status. */ @@ -840,7 +840,7 @@ UINT i; /* Test to return FX_BUFFER_ERROR from _fx_directory_default_get_copy() */ status = fx_directory_default_get_copy(&ram_disk, test_path_name_buffer, sizeof(test_path_name_buffer)); - + /* Determine if the test was successful. */ if (status != FX_BUFFER_ERROR) { @@ -848,7 +848,7 @@ UINT i; printf("ERROR!\n"); test_control_return(52); } - + /* Close the media. */ status = fx_media_close(&ram_disk); @@ -863,20 +863,20 @@ UINT i; /* Now perform the same corner case testing with the local path set. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4096, // Total sectors - 128, // Sector size + 4096, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -885,7 +885,7 @@ UINT i; printf("ERROR!\n"); test_control_return(22); } - + /* Open the ram_disk - with one logical sector cache! */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -900,9 +900,9 @@ UINT i; /* Create a sub-directory. */ status = fx_directory_create(&ram_disk, "sub-directory-level_001"); - + /* Skip local_path test */ -#ifndef FX_NO_LOCAL_PATH +#ifndef FX_NO_LOCAL_PATH /* Attempt to set a path with a NULL path name. */ status += _fx_directory_local_path_set(&ram_disk, &local_path, FX_NULL); @@ -924,12 +924,12 @@ UINT i; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_cluster = 0; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_value = 0; } - + /* Try to set the current path but with an I/O error coming from the directory search. */ _fx_utility_logical_sector_read_error_request = 1; status = fx_directory_local_path_set(&ram_disk, &local_path, "sub-directory-level_001"); _fx_utility_logical_sector_read_error_request = 0; - + /* Check the status - should be an I/O error! */ if (status != FX_INVALID_PATH) { @@ -941,7 +941,7 @@ UINT i; /* Try to set the current path to the first sub-directory. */ status = fx_directory_local_path_set(&ram_disk, &local_path, "sub-directory-level_001"); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -950,10 +950,10 @@ UINT i; printf("ERROR!\n"); test_control_return(38); } - + /* Try to set the current path to the same relative sub-directory. */ status = fx_directory_local_path_set(&ram_disk, &local_path, "."); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -965,7 +965,7 @@ UINT i; /* Try to set the current path back to root directory relative to the current directory. */ status = fx_directory_local_path_set(&ram_disk, &local_path, ".."); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -977,33 +977,33 @@ UINT i; /* Create a set of sub-directories that exceeds the maximum path size. */ status = fx_directory_local_path_set(&ram_disk, &local_path, "sub-directory-level_001"); - status += fx_directory_create(&ram_disk, "sub-directory-level_002"); + status += fx_directory_create(&ram_disk, "sub-directory-level_002"); status += fx_directory_local_path_set(&ram_disk, &local_path, "sub-directory-level_002"); - status += fx_directory_create(&ram_disk, "sub-directory-level_003"); + status += fx_directory_create(&ram_disk, "sub-directory-level_003"); status += fx_directory_local_path_set(&ram_disk, &local_path, "sub-directory-level_003"); - status += fx_directory_create(&ram_disk, "sub-directory-level_004"); + status += fx_directory_create(&ram_disk, "sub-directory-level_004"); status += fx_directory_local_path_set(&ram_disk, &local_path, "sub-directory-level_004"); - status += fx_directory_create(&ram_disk, "sub-directory-level_005"); + status += fx_directory_create(&ram_disk, "sub-directory-level_005"); status += fx_directory_local_path_set(&ram_disk, &local_path, "sub-directory-level_005"); - status += fx_directory_create(&ram_disk, "sub-directory-level_006"); + status += fx_directory_create(&ram_disk, "sub-directory-level_006"); status += fx_directory_local_path_set(&ram_disk, &local_path, "sub-directory-level_006"); - status += fx_directory_create(&ram_disk, "sub-directory-level_007"); + status += fx_directory_create(&ram_disk, "sub-directory-level_007"); status += fx_directory_local_path_set(&ram_disk, &local_path, "sub-directory-level_007"); - status += fx_directory_create(&ram_disk, "sub-directory-level_008"); + status += fx_directory_create(&ram_disk, "sub-directory-level_008"); status += fx_directory_local_path_set(&ram_disk, &local_path, "sub-directory-level_008"); - status += fx_directory_create(&ram_disk, "sub-directory-level_009"); + status += fx_directory_create(&ram_disk, "sub-directory-level_009"); status += fx_directory_local_path_set(&ram_disk, &local_path, "sub-directory-level_009"); - status += fx_directory_create(&ram_disk, "sub-directory-level_010"); + status += fx_directory_create(&ram_disk, "sub-directory-level_010"); status += fx_directory_local_path_set(&ram_disk, &local_path, "sub-directory-level_010"); - status += fx_directory_create(&ram_disk, "sub-directory-level_011"); + status += fx_directory_create(&ram_disk, "sub-directory-level_011"); status += fx_directory_local_path_set(&ram_disk, &local_path, "sub-directory-level_011"); - status += fx_directory_create(&ram_disk, "sub-directory-level_012"); + status += fx_directory_create(&ram_disk, "sub-directory-level_012"); status += fx_directory_local_path_set(&ram_disk, &local_path, "sub-directory-level_012"); - status += fx_directory_create(&ram_disk, "sub-directory-level_013"); + status += fx_directory_create(&ram_disk, "sub-directory-level_013"); status += fx_directory_local_path_set(&ram_disk, &local_path, "sub-directory-level_013"); - status += fx_directory_create(&ram_disk, "sub-directory-level_014"); + status += fx_directory_create(&ram_disk, "sub-directory-level_014"); status += fx_directory_local_path_set(&ram_disk, &local_path, "sub-directory-level_014"); - status += fx_directory_create(&ram_disk, "sub-directory-level_015"); + status += fx_directory_create(&ram_disk, "sub-directory-level_015"); status += fx_directory_local_path_set(&ram_disk, &local_path, "sub-directory-level_015"); /* Now backup to the root directory. */ @@ -1052,7 +1052,7 @@ UINT i; status += fx_directory_local_path_set(&ram_disk, &local_path, ".."); status += fx_directory_local_path_set(&ram_disk, &local_path, ".."); status += fx_directory_local_path_set(&ram_disk, &local_path, ".."); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -1081,7 +1081,7 @@ UINT i; /* Now backup to the root directory - one sub-directory at a time. */ status += fx_directory_local_path_set(&ram_disk, &local_path, "..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\.."); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -1112,7 +1112,7 @@ UINT i; status += fx_directory_first_entry_find(&ram_disk, name); status += fx_directory_first_entry_find(&ram_disk, name); status += fx_directory_first_entry_find(&ram_disk, name); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -1121,7 +1121,7 @@ UINT i; printf("ERROR!\n"); test_control_return(44); } - + /* Now try to have a new path relative back to the root directory, and then back to itself. */ status = fx_directory_local_path_set(&ram_disk, &local_path, "sub-directory-level_001"); @@ -1133,7 +1133,7 @@ UINT i; local_path.fx_path_string[0] = ' '; status += fx_directory_local_path_set(&ram_disk, &local_path, "../sub-directory-level_001"); - status += fx_directory_local_path_set(&ram_disk, &local_path, ".."); + status += fx_directory_local_path_set(&ram_disk, &local_path, ".."); status += fx_directory_first_entry_find(&ram_disk, name); /* Check the status. */ @@ -1147,7 +1147,7 @@ UINT i; /* Create a file at the root directory. */ status += fx_file_create(&ram_disk, "TEST.TXT"); - + /* Attempt to set the default to a file name. */ status += fx_directory_local_path_set(&ram_disk, &local_path, "TEST.TXT"); @@ -1160,7 +1160,7 @@ UINT i; test_control_return(46); } - /* Build a maximum local path. */ + /* Build a maximum local path. */ status = fx_directory_local_path_set(&ram_disk, &local_path, "sub-directory-level_001"); status += fx_directory_local_path_set(&ram_disk, &local_path, "sub-directory-level_002"); status += fx_directory_local_path_set(&ram_disk, &local_path, "sub-directory-level_003"); @@ -1179,11 +1179,11 @@ UINT i; /* Now set a new local path that will inherit this local path. */ status += fx_directory_local_path_set(&ram_disk, &local_path1, "..\\sub-directory-level_015"); - + /* Now set an absolute path. */ status += fx_directory_local_path_set(&ram_disk, &local_path1, "\\sub-directory-level_001"); status += fx_directory_local_path_set(&ram_disk, &local_path1, ".."); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -1192,10 +1192,10 @@ UINT i; printf("ERROR!\n"); test_control_return(47); } - + /* Clear the local path. */ status += fx_directory_local_path_clear(&ram_disk); - + /* Build a maximum path default (global) path. */ status = fx_directory_default_set(&ram_disk, "\\"); status += fx_directory_default_set(&ram_disk, "sub-directory-level_001"); @@ -1213,7 +1213,7 @@ UINT i; status += fx_directory_default_set(&ram_disk, "sub-directory-level_013"); status += fx_directory_default_set(&ram_disk, "sub-directory-level_014"); status += fx_directory_default_set(&ram_disk, "sub-directory-level_015"); - + /* Now set the local path again, which will inherit the global path. */ status += fx_directory_local_path_set(&ram_disk, &local_path, "../sub-directory-level_015"); @@ -1228,7 +1228,7 @@ UINT i; /* Test to return FX_BUFFER_ERROR from _fx_directory_local_path_get_copy() */ status = _fx_directory_local_path_get_copy(&ram_disk, test_path_name_buffer, sizeof(test_path_name_buffer)); - + /* Determine if the test was successful. */ if (status != FX_BUFFER_ERROR) { @@ -1236,13 +1236,13 @@ UINT i; printf("ERROR!\n"); test_control_return(49); } - + /* Test to each (return_path_name_buffer[0] = '\0') line in _fx_directory_local_path_get_copy() */ fx_directory_local_path_clear(&ram_disk); path_name_buffer[0] = 'A'; status = _fx_directory_local_path_get_copy(&ram_disk, path_name_buffer, sizeof(path_name_buffer)); status += strcmp(&path_name_buffer[0], "\0"); - + /* Determine if the test was successful. */ if (status != FX_SUCCESS) { diff --git a/test/regression_test/filex_directory_duplicate_entries_test.c b/test/regression_test/filex_directory_duplicate_entries_test.c index d022c32..9cdd61d 100644 --- a/test/regression_test/filex_directory_duplicate_entries_test.c +++ b/test/regression_test/filex_directory_duplicate_entries_test.c @@ -35,10 +35,10 @@ static CHAR name[256]; #ifndef FX_STANDALONE_ENABLE static UCHAR ram_disk_memory[1024 * 1024]; static UCHAR *cache_buffer; -static UCHAR *fault_tolerant_buffer; +static UCHAR *fault_tolerant_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; -static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; +static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; #endif extern ULONG _fx_ram_driver_copy_default_format; diff --git a/test/regression_test/filex_directory_first_next_find_test.c b/test/regression_test/filex_directory_first_next_find_test.c index 56f310f..baf9966 100644 --- a/test/regression_test/filex_directory_first_next_find_test.c +++ b/test/regression_test/filex_directory_first_next_find_test.c @@ -52,13 +52,13 @@ void filex_directory_first_next_find_application_define(void *first_unused_me #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -106,20 +106,20 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; printf("FileX Test: Directory first/next entry find test..................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -128,7 +128,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; printf("ERROR!\n"); test_control_return(1); } - + /* Attempt to get the next entry before the media is opened to generate an error */ status = fx_directory_next_entry_find(&ram_disk, "/A0"); if (status != FX_MEDIA_NOT_OPEN) @@ -136,16 +136,16 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; printf("ERROR!\n"); test_control_return(2); } - + /* Attempt to get the next full entry before the media is opened to generate an error */ - status = fx_directory_next_full_entry_find(&ram_disk, name, &attributes, + status = fx_directory_next_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (status != FX_MEDIA_NOT_OPEN) { printf("ERROR!\n"); test_control_return(3); } - + /* Attempt to get the first entry before the media is opened to generate an error */ status = fx_directory_first_entry_find(&ram_disk, "/A0"); if (status != FX_MEDIA_NOT_OPEN) @@ -153,9 +153,9 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; printf("ERROR!\n"); test_control_return(4); } - + /* Attempt to get the first full entry before the media is opened to generate an error */ - status = fx_directory_first_full_entry_find(&ram_disk, name, &attributes, + status = fx_directory_first_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (status != FX_MEDIA_NOT_OPEN) { @@ -174,7 +174,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; printf("ERROR!\n"); test_control_return(6); } - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING /* send null pointer to generate an error */ @@ -184,9 +184,9 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; printf("ERROR!\n"); test_control_return(6); } - + /* send null pointer to generate an error */ - status = fx_directory_first_full_entry_find(FX_NULL, name, &attributes, + status = fx_directory_first_full_entry_find(FX_NULL, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (status != FX_PTR_ERROR) { @@ -211,7 +211,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; status += fx_directory_create(&ram_disk, "RootDir13"); status += fx_directory_create(&ram_disk, "RootDir14"); status += fx_file_create(&ram_disk, "RootFile15"); - + /* Create the sub-directories for RootDir03. */ status += fx_directory_create(&ram_disk, "/RootDir03/RootDir03_SubDir01"); status += fx_file_create(&ram_disk, "/RootDir03/RootDir03_File02"); @@ -322,7 +322,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; status += fx_directory_create(&ram_disk, "/RootDir04/RootDir04_SubDir08/RootDir04_SubDir08_SubSubDir02"); status += fx_directory_create(&ram_disk, "/RootDir04/RootDir04_SubDir08/RootDir04_SubDir08_SubSubDir03"); status += fx_file_create(&ram_disk, "/RootDir04/RootDir04_SubDir05/RootDir04_SubDir08_SubSubFile04"); - + /* Create the sub-sub-sub directories under RootDir04. */ status += fx_directory_create(&ram_disk, "/RootDir04/RootDir04_SubDir04/RootDir04_SubDir04_SubSubDir01/RootDir04_SubDir04_SubSubDir01_SubSubSubDir01"); status += fx_directory_create(&ram_disk, "/RootDir04/RootDir04_SubDir04/RootDir04_SubDir04_SubSubDir01/RootDir04_SubDir04_SubSubDir01_SubSubSubDir02"); @@ -355,14 +355,14 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; status = fx_directory_default_set(&ram_disk, "/"); /* Check the status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { /* Error setting the path. Return to caller. */ printf("ERROR!\n"); test_control_return(9); } - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING /* send null pointer to generate an error */ @@ -441,11 +441,11 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; } /* Now test the full directory entry services. */ - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING /* send null pointer to generate an error */ - status = fx_directory_next_full_entry_find(FX_NULL, name, &attributes, + status = fx_directory_next_full_entry_find(FX_NULL, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (status != FX_PTR_ERROR) { @@ -455,63 +455,63 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; #endif /* FX_DISABLE_ERROR_CHECKING */ /* Pickup the first entry in the root directory. */ - status = fx_directory_first_full_entry_find(&ram_disk, name, &attributes, + status = fx_directory_first_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (strcmp(name, "RootFile01")) status++; - status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, + status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (strcmp(name, "RootFile02")) status++; - status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, + status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (strcmp(name, "RootDir03")) status++; - status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, + status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (strcmp(name, "RootDir04")) status++; - status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, + status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (strcmp(name, "RootDir05")) status++; - status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, + status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (strcmp(name, "RootDir06")) status++; - status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, + status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (strcmp(name, "RootDir07")) status++; - status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, + status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (strcmp(name, "RootDir08")) status++; - status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, + status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (strcmp(name, "RootFile09")) status++; - status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, + status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (strcmp(name, "RootFile10")) status++; - status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, + status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (strcmp(name, "RootDir11")) status++; - status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, + status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (strcmp(name, "RootDir12")) status++; - status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, + status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (strcmp(name, "RootDir13")) status++; - status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, + status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (strcmp(name, "RootDir14")) status++; - status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, + status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (strcmp(name, "RootFile15")) status++; @@ -525,7 +525,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; } /* Now read one past the number of entries in order to get an error condition. */ - status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, + status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); /* Determine if the test was successful. */ @@ -536,14 +536,14 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; test_control_return(15); } - /* Okay, now postion to the deepest sub-directory and ensure that the directory first/next + /* Okay, now postion to the deepest sub-directory and ensure that the directory first/next operations work properly there as well. */ /* Set the current path. This should be / or NULL. */ status = fx_directory_default_set(&ram_disk, "/RootDir04/RootDir04_SubDir04/RootDir04_SubDir04_SubSubDir02"); /* Check the status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { /* Error setting the path. Return to caller. */ @@ -591,49 +591,49 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; } /* Now do the same thing but with the full find first/next. */ - + /* pick up the first full entry with a local path defined to get to all of the code */ #ifndef FX_NO_LOCAL_PATH status = fx_directory_local_path_set(&ram_disk, &local_path, "/RootDir04/RootDir04_SubDir03"); - status += fx_directory_first_full_entry_find(&ram_disk, name, &attributes, + status += fx_directory_first_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (strcmp(name, ".")) status++; status += fx_directory_local_path_clear(&ram_disk); status += fx_directory_local_path_set(&ram_disk, &local_path, "/"); - status += fx_directory_first_full_entry_find(&ram_disk, name, &attributes, + status += fx_directory_first_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); status += fx_directory_local_path_clear(&ram_disk); - + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(19); } #endif - + /* Pickup the first entry in this sub-sub directory. */ - status = fx_directory_first_full_entry_find(&ram_disk, name, &attributes, + status = fx_directory_first_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (strcmp(name, ".")) status++; - status = fx_directory_next_full_entry_find(&ram_disk, name, &attributes, + status = fx_directory_next_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (strcmp(name, "..")) status++; - status = fx_directory_next_full_entry_find(&ram_disk, name, &attributes, + status = fx_directory_next_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (strcmp(name, "RootDir04_SubDir04_SubSubDir01_SubSubSubDir01")) status++; - status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, + status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (strcmp(name, "RootDir04_SubDir04_SubSubDir01_SubSubSubDir02")) status++; - status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, + status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (strcmp(name, "RootDir04_SubDir04_SubSubDir01_SubSubSubDir03")) status++; - status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, + status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (strcmp(name, "RootDir04_SubDir04_SubSubDir01_SubSubSubFile04")) status++; @@ -647,7 +647,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; } /* Now read one past the number of entries in order to get an error condition. */ - status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, + status += fx_directory_next_full_entry_find(&ram_disk, name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); /* Determine if the test was successful. */ @@ -657,7 +657,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; printf("ERROR!\n"); test_control_return(21); } - + /* Close the media. */ status = fx_media_close(&ram_disk); @@ -668,22 +668,22 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; printf("ERROR!\n"); test_control_return(22); } - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4096, // Total sectors - 128, // Sector size + 4096, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -692,7 +692,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; printf("ERROR!\n"); test_control_return(23); } - + /* Open the ram_disk - 1 sector cache. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -707,13 +707,13 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Call first entry find with nothing in the root directory. */ status = fx_directory_first_entry_find(&ram_disk, name); - + /* This should return no more entries. */ if (status != FX_NO_MORE_ENTRIES) { printf("ERROR!\n"); test_control_return(25); - } + } /* Create a directory structure that we can traverse. */ status = fx_directory_create(&ram_disk, "\\SUB1"); @@ -741,7 +741,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; name[i] = 'a'; } name[255] = 0; - + /* Create a max length named file in this sub-directory. */ status += fx_file_create(&ram_disk, name); @@ -756,50 +756,50 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; _fx_utility_fat_entry_read_error_request = 10001; status = fx_directory_first_entry_find(&ram_disk, name); _fx_utility_fat_entry_read_error_request = 0; - + /* This should return no more entries. */ if (status != FX_FAT_READ_ERROR) { printf("ERROR!\n"); test_control_return(27); - } - + } + /* Now get the first entry... with a cluster equal to itself first. Note this calls next entry find inside. */ _fx_utility_fat_entry_read_error_request = 30001; status = fx_directory_first_entry_find(&ram_disk, name); _fx_utility_fat_entry_read_error_request = 0; - + /* This should return no more entries. */ if (status != FX_FAT_READ_ERROR) { printf("ERROR!\n"); test_control_return(28); - } + } /* Now get the first entry... with an I/O error on the FAT read. Note this calls next entry find inside. */ _fx_utility_fat_entry_read_error_request = 1; status = fx_directory_first_entry_find(&ram_disk, name); _fx_utility_fat_entry_read_error_request = 0; - + /* This should return no more entries. */ if (status != FX_IO_ERROR) { printf("ERROR!\n"); test_control_return(29); - } + } /* Now get the first entry... with a smaller value of total clusters. Note this calls next entry find inside. */ temp = ram_disk.fx_media_total_clusters; ram_disk.fx_media_total_clusters = 1; status = fx_directory_first_entry_find(&ram_disk, name); ram_disk.fx_media_total_clusters = temp; - + /* This should return no more entries. */ if (status != FX_FAT_READ_ERROR) { printf("ERROR!\n"); test_control_return(30); - } + } /* Now get the first entry... successfully. Note this calls next entry find inside. */ status = fx_directory_first_entry_find(&ram_disk, name); /* TEST.TXT */ @@ -825,14 +825,14 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; _fx_utility_logical_sector_read_error_request = 1; status = fx_directory_next_entry_find(&ram_disk, name); _fx_utility_logical_sector_read_error_request = 0; - + /* This should return no more entries. */ if (status != FX_IO_ERROR) { printf("ERROR!\n"); test_control_return(32); - } - + } + /* Now get all the directory entires. */ status = fx_directory_next_entry_find(&ram_disk, name); /* . */ status = fx_directory_next_entry_find(&ram_disk, name); /* .. */ @@ -861,7 +861,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Now make another request to get the FX_NO_MORE_ENTRIES error. */ status = fx_directory_next_entry_find(&ram_disk, name); /* END of Directory! */ - + /* This should return no more entries. */ if (status != FX_NO_MORE_ENTRIES) { @@ -874,7 +874,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; ram_disk.fx_media_default_path.fx_path_current_entry = 100; status = fx_directory_next_entry_find(&ram_disk, name); /* END of Directory! */ ram_disk.fx_media_default_path.fx_path_current_entry = temp; - + /* This should return no more entries. */ if (status != FX_NO_MORE_ENTRIES) { @@ -950,7 +950,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; printf("ERROR!\n"); test_control_return(36); } - + /* Close the media. */ status = fx_media_close(&ram_disk); @@ -960,23 +960,23 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; printf("ERROR!\n"); test_control_return(37); - } + } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4096, // Total sectors - 128, // Sector size + 4096, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -985,7 +985,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; printf("ERROR!\n"); test_control_return(38); } - + /* Open the ram_disk - 1 sector cache. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -1000,13 +1000,13 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Call first entry find with nothing in the root directory. */ status = fx_directory_first_full_entry_find(&ram_disk, name, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, &second); - + /* This should return no more entries. */ if (status != FX_NO_MORE_ENTRIES) { printf("ERROR!\n"); test_control_return(40); - } + } /* Create a directory structure that we can traverse. */ status = fx_directory_create(&ram_disk, "\\SUB1"); @@ -1034,7 +1034,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; name[i] = 'a'; } name[255] = 0; - + /* Create a max length named file in this sub-directory. */ status += fx_file_create(&ram_disk, name); @@ -1049,50 +1049,50 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; _fx_utility_fat_entry_read_error_request = 10001; status = fx_directory_first_full_entry_find(&ram_disk, name, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, &minute, FX_NULL); _fx_utility_fat_entry_read_error_request = 0; - + /* This should return no more entries. */ if (status != FX_FAT_READ_ERROR) { printf("ERROR!\n"); test_control_return(42); - } - + } + /* Now get the first entry... with a cluster equal to itself first. Note this calls next entry find inside. */ _fx_utility_fat_entry_read_error_request = 30001; status = fx_directory_first_full_entry_find(&ram_disk, name, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, &second); _fx_utility_fat_entry_read_error_request = 0; - + /* This should return no more entries. */ if (status != FX_FAT_READ_ERROR) { printf("ERROR!\n"); test_control_return(43); - } + } /* Now get the first entry... with an I/O error on the FAT read. Note this calls next entry find inside. */ _fx_utility_fat_entry_read_error_request = 1; status = fx_directory_first_full_entry_find(&ram_disk, name, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, &second); _fx_utility_fat_entry_read_error_request = 0; - + /* This should return no more entries. */ if (status != FX_IO_ERROR) { printf("ERROR!\n"); test_control_return(44); - } + } /* Now get the first entry... with a smaller value of total clusters. Note this calls next entry find inside. */ temp = ram_disk.fx_media_total_clusters; ram_disk.fx_media_total_clusters = 1; status = fx_directory_first_full_entry_find(&ram_disk, name, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, &second); ram_disk.fx_media_total_clusters = temp; - + /* This should return no more entries. */ if (status != FX_FAT_READ_ERROR) { printf("ERROR!\n"); test_control_return(45); - } + } /* Now get the first entry... successfully. Note this calls next entry find inside. */ status = fx_directory_first_full_entry_find(&ram_disk, name, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, &second); /* TEST.TXT */ @@ -1118,14 +1118,14 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; _fx_utility_logical_sector_read_error_request = 1; status = fx_directory_next_full_entry_find(&ram_disk, name, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, &second); _fx_utility_logical_sector_read_error_request = 0; - + /* This should return no more entries. */ if (status != FX_IO_ERROR) { printf("ERROR!\n"); test_control_return(47); - } - + } + /* Now get all the directory entires. */ status = fx_directory_next_full_entry_find(&ram_disk, name, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, &second); /* . */ status = fx_directory_next_full_entry_find(&ram_disk, name, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, &minute, FX_NULL); /* .. */ @@ -1154,7 +1154,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Now make another request to get the FX_NO_MORE_ENTRIES error. */ status = fx_directory_next_full_entry_find(&ram_disk, name, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, &second); /* END of Directory! */ - + /* This should return no more entries. */ if (status != FX_NO_MORE_ENTRIES) { @@ -1167,7 +1167,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; ram_disk.fx_media_default_path.fx_path_current_entry = 100; status = fx_directory_next_full_entry_find(&ram_disk, name, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, &second); /* END of Directory! */ ram_disk.fx_media_default_path.fx_path_current_entry = temp; - + /* This should return no more entries. */ if (status != FX_NO_MORE_ENTRIES) { @@ -1247,7 +1247,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; printf("ERROR!\n"); test_control_return(51); } - + /* Close the media. */ status = fx_media_close(&ram_disk); @@ -1257,22 +1257,22 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; printf("ERROR!\n"); test_control_return(52); - } + } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4096, // Total sectors - 128, // Sector size + 4096, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Open the ram_disk. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); diff --git a/test/regression_test/filex_directory_local_path_test.c b/test/regression_test/filex_directory_local_path_test.c index ac98ea1..d3f73c6 100644 --- a/test/regression_test/filex_directory_local_path_test.c +++ b/test/regression_test/filex_directory_local_path_test.c @@ -301,13 +301,13 @@ void filex_directory_local_path_application_define(void *first_unused_memory) UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -340,20 +340,20 @@ CHAR path_name_buffer[32]; printf("FileX Test: Directory local path test.............................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -362,7 +362,7 @@ CHAR path_name_buffer[32]; printf("ERROR!\n"); test_control_return(1); } - + /* Attempt to clear the local path before the media has been opened to generate an error */ status = fx_directory_local_path_clear(&ram_disk); if (status != FX_MEDIA_NOT_OPEN) @@ -370,7 +370,7 @@ CHAR path_name_buffer[32]; printf("ERROR!\n"); test_control_return(2); } - + /* Attempt to restore the local path before the media has been opened to generate an error */ status = fx_directory_local_path_restore(&ram_disk, &local_path); if (status != FX_MEDIA_NOT_OPEN) @@ -378,7 +378,7 @@ CHAR path_name_buffer[32]; printf("ERROR!\n"); test_control_return(3); } - + /* Attempt to set the local path before the media has been opened to generate an error */ status = fx_directory_local_path_set(&ram_disk, &local_path, "/A0"); if (status != FX_MEDIA_NOT_OPEN) @@ -386,7 +386,7 @@ CHAR path_name_buffer[32]; printf("ERROR!\n"); test_control_return(4); } - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); @@ -399,7 +399,7 @@ CHAR path_name_buffer[32]; printf("ERROR!\n"); test_control_return(5); } - + /* Attempt to set the local path to somewhere that does not exist to generate an error */ status = fx_directory_local_path_set(&ram_disk, &local_path, "/DOES_NOT_EXIST"); if (status != FX_INVALID_PATH) @@ -424,7 +424,7 @@ CHAR path_name_buffer[32]; status += fx_directory_create(&ram_disk, "RootDir13"); status += fx_directory_create(&ram_disk, "RootDir14"); status += fx_file_create(&ram_disk, "RootFile15"); - + /* Create the sub-directories for RootDir03. */ status += fx_directory_create(&ram_disk, "/RootDir03/RootDir03_SubDir01"); status += fx_file_create(&ram_disk, "/RootDir03/RootDir03_File02"); @@ -538,7 +538,7 @@ CHAR path_name_buffer[32]; status += fx_directory_create(&ram_disk, "/RootDir04/RootDir04_SubDir08/RootDir04_SubDir08_SubSubDir02"); status += fx_directory_create(&ram_disk, "/RootDir04/RootDir04_SubDir08/RootDir04_SubDir08_SubSubDir03"); status += fx_file_create(&ram_disk, "/RootDir04/RootDir04_SubDir05/RootDir04_SubDir08_SubSubFile04"); - + /* Create the sub-sub-sub directories under RootDir04. */ status += fx_directory_create(&ram_disk, "/RootDir04/RootDir04_SubDir04/RootDir04_SubDir04_SubSubDir01/RootDir04_SubDir04_SubSubDir01_SubSubSubDir01"); status += fx_directory_create(&ram_disk, "/RootDir04/RootDir04_SubDir04/RootDir04_SubDir04_SubSubDir01/RootDir04_SubDir04_SubSubDir01_SubSubSubDir02"); @@ -571,12 +571,12 @@ CHAR path_name_buffer[32]; /* Determine if the traversal matched what was expected. */ if (error_counter) { - + /* Nope, error traversing the directory structure! */ printf("ERROR!\n"); test_control_return(8); } - + status = fx_directory_local_path_clear(&ram_disk); status += fx_directory_local_path_set(&ram_disk, &local_path, "RootDir04"); status += fx_directory_local_path_set(&ram_disk, &local_path, "../RootDir03"); @@ -585,7 +585,7 @@ CHAR path_name_buffer[32]; printf("ERROR!\n"); test_control_return(9); } - + fx_directory_local_path_get_copy(&ram_disk, path_name_buffer, sizeof(path_name_buffer)); if (strcmp(path_name_buffer, "/RootDir03")) { @@ -598,20 +598,20 @@ CHAR path_name_buffer[32]; return_if_fail(status == FX_SUCCESS); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail(status == FX_SUCCESS); /* Try getting directory local path before media open. */ @@ -674,7 +674,7 @@ UINT skip; /* Compare with what is expected. */ if (strcmp(name, expected_name[expected_index++])) error_counter++; - + /* Determine if this name is a directory or a file. */ status = fx_directory_name_test(&ram_disk, name); @@ -689,7 +689,7 @@ UINT skip; status = fx_file_close(&file); if (status != FX_SUCCESS) error_counter++; - + /* Pickup the next directory entry. */ status = fx_directory_next_entry_find(&ram_disk, name); } @@ -703,17 +703,17 @@ UINT skip; { /* Recursive call to traverse directory. */ traverse_directory(name); - + /* Restore path. */ - status = fx_directory_local_path_restore(&ram_disk, &local_path); + status = fx_directory_local_path_restore(&ram_disk, &local_path); } status = fx_directory_next_entry_find(&ram_disk, name); - } - } + } + } fx_directory_local_path_clear(&ram_disk); - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING /* send null pointer to generate an error */ @@ -723,7 +723,7 @@ UINT skip; printf("ERROR!\n"); test_control_return(11); } - + /* send null pointer to generate an error */ status = fx_directory_local_path_restore(FX_NULL, FX_NULL); if (status != FX_PTR_ERROR) @@ -731,7 +731,7 @@ UINT skip; printf("ERROR!\n"); test_control_return(12); } - + /* send null pointer to generate an error */ status = fx_directory_local_path_set(FX_NULL, FX_NULL, "\\"); if (status != FX_PTR_ERROR) @@ -739,7 +739,7 @@ UINT skip; printf("ERROR!\n"); test_control_return(13); } - + /* send null pointer to generate an error */ status = fx_directory_name_test(FX_NULL, name); if (status != FX_PTR_ERROR) diff --git a/test/regression_test/filex_directory_long_short_get_test.c b/test/regression_test/filex_directory_long_short_get_test.c index bc84a28..8c4d800 100644 --- a/test/regression_test/filex_directory_long_short_get_test.c +++ b/test/regression_test/filex_directory_long_short_get_test.c @@ -54,13 +54,13 @@ void filex_directory_long_short_get_application_define(void *first_unused_mem #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -95,20 +95,20 @@ UINT i; printf("FileX Test: Directory long/short name get test....................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 128, // Directory Entries 0, // Hidden sectors - 2048, // Total sectors - 128, // Sector size + 2048, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -129,7 +129,7 @@ UINT i; printf("ERROR!\n"); test_control_return(2); } - + /* Attempt to get a directory that does not exist */ status = fx_directory_short_name_get(&ram_disk, "does_not_exist", "does_not_exist"); if (status == FX_SUCCESS) @@ -144,7 +144,7 @@ UINT i; status += fx_file_create(&ram_disk, "longnametest"); status += fx_file_create(&ram_disk, "subdir/SNAME.TXT"); status += fx_file_create(&ram_disk, "subdir/longnametest"); - + /* Check the directory/file create status. */ if (status != FX_SUCCESS) { @@ -153,7 +153,7 @@ UINT i; printf("ERROR!\n"); test_control_return(4); } - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING /* send null pointer to generate an error */ @@ -171,7 +171,7 @@ UINT i; test_control_return(5); } #endif /* FX_DISABLE_ERROR_CHECKING */ - + /* attempt to get the long name of something that doesnt exist */ status = fx_directory_long_name_get(&ram_disk, "does_not_exist", "does_not_exist"); if (status == FX_SUCCESS) @@ -192,7 +192,7 @@ UINT i; printf("ERROR!\n"); test_control_return(7); } - + /* Set name to known state. */ memcpy(name, "ORIGINALSTRING", 15); @@ -290,7 +290,7 @@ UINT i; printf("ERROR!\n"); test_control_return(11); } - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING /* send null pointer to generate an error */ @@ -308,8 +308,8 @@ UINT i; test_control_return(12); } #endif /* FX_DISABLE_ERROR_CHECKING */ - - + + /* Create a maximum size short file name. */ status = fx_file_create(&ram_disk, "MAX_SIZE.TXT"); @@ -323,18 +323,18 @@ UINT i; /* Error getting long/short name. Return to caller. */ printf("ERROR!\n"); test_control_return(13); - } - + } + /* Build a maximum sized long file name. */ for (i = 0; i < (FX_MAX_LONG_NAME_LEN-1); i++) { - + /* Set a character in the file name. */ max_name[i] = 'a'; } max_name[i] = 0; max_name[i-4] = '.'; - + /* Create a maximum size long file name. */ status = fx_file_create(&ram_disk, max_name); @@ -348,7 +348,7 @@ UINT i; /* Error getting long/short name. Return to caller. */ printf("ERROR!\n"); test_control_return(14); - } + } /* Get the long name. */ status += fx_directory_long_name_get(&ram_disk, return_name, return_name); @@ -360,14 +360,14 @@ UINT i; /* Error getting long/short name. Return to caller. */ printf("ERROR!\n"); test_control_return(15); - } - - + } + + /* Close the media. */ status = fx_media_close(&ram_disk); /* Determine if the test was successful. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); diff --git a/test/regression_test/filex_directory_naming_test.c b/test/regression_test/filex_directory_naming_test.c index 7be04d7..ae93365 100644 --- a/test/regression_test/filex_directory_naming_test.c +++ b/test/regression_test/filex_directory_naming_test.c @@ -55,13 +55,13 @@ void filex_directory_naming_application_define(void *first_unused_memory) #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -98,20 +98,20 @@ UINT i; printf("FileX Test: Directory naming test.................................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -120,7 +120,7 @@ UINT i; printf("ERROR!\n"); test_control_return(1); } - + /* Try to rename a directory before the media is opened to generate an error */ status = fx_directory_rename(&ram_disk, "/A0", "/A1"); if (status != FX_MEDIA_NOT_OPEN) @@ -152,7 +152,7 @@ UINT i; printf("ERROR!\n"); test_control_return(4); } - + /* Test a directory name that does not exist to generate an error */ /* status = fx_directory_name_test(&ram_disk, "/A0"); if (status == FX_SUCCESS) @@ -161,7 +161,7 @@ UINT i; test_control_return(5); } */ - + /* test some directory names to test the directory search function */ /* status = fx_directory_create(&ram_disk, "\\TEST"); status += fx_directory_name_test(&ram_disk, "\\TEST"); @@ -172,7 +172,7 @@ UINT i; test_control_return(6); } */ - + /* Create a series of directories... */ status = fx_directory_create(&ram_disk, "/A0"); @@ -219,7 +219,7 @@ UINT i; /* Error creating special name. Return to caller. */ printf("ERROR!\n"); test_control_return(9); - } + } /* Create another special file name. */ special_name[0] = (CHAR)0xE5; @@ -240,7 +240,7 @@ UINT i; /* Error creating special name. Return to caller. */ printf("ERROR!\n"); test_control_return(10); - } + } /* Create the next level of sub-directories.... with the interesting names... */ status = fx_directory_default_set(&ram_disk, "/A0"); @@ -252,7 +252,7 @@ UINT i; status += fx_directory_create(&ram_disk, " c"); status += fx_directory_create(&ram_disk, " c/ e"); status += fx_directory_create(&ram_disk, " c/ e/ f"); - + /* Check for errors. */ if (status != FX_SUCCESS) { @@ -260,7 +260,7 @@ UINT i; /* Error creating interesting directory names. Return to caller. */ printf("ERROR!\n"); test_control_return(11); - } + } /* Now attempt to create a file in each of these sub-directories. */ status = fx_file_create(&ram_disk, "/A0/a/test.txt"); @@ -270,7 +270,7 @@ UINT i; fx_media_flush(&ram_disk); status += fx_file_create(&ram_disk, "/A0 / c/ e/ f/test.txt"); fx_media_flush(&ram_disk); - + /* Check for errors. */ if (status != FX_SUCCESS) { @@ -278,7 +278,7 @@ UINT i; /* Error creating test files in the interesting sub-directories. Return to caller. */ printf("ERROR!\n"); test_control_return(12); - } + } /* Now attempt to delete the file in each of these sub-directories. */ status = fx_file_delete(&ram_disk, "/A0/a/test.txt"); @@ -294,7 +294,7 @@ UINT i; /* Error deleting test files in the interesting sub-directories. Return to caller. */ printf("ERROR!\n"); test_control_return(13); - } + } /* Now attempt to delete the interesting sub-directories. */ status = fx_directory_delete(&ram_disk, "/A0/a"); @@ -312,7 +312,7 @@ UINT i; /* Error deleting the interesting sub-directories. Return to caller. */ printf("ERROR!\n"); test_control_return(14); - } + } /* Delete a series of directories... Use short name for b0 and d0! */ status = fx_directory_delete(&ram_disk, "/A0"); @@ -335,7 +335,7 @@ UINT i; /* Flush the media... should be empty at this point. */ status += fx_media_flush(&ram_disk); - /* Now fill the media's root directory until we get an error... We will use 8.3 names + /* Now fill the media's root directory until we get an error... We will use 8.3 names to attempt to create 32 names. */ status += fx_directory_create(&ram_disk, "A01"); status += fx_directory_create(&ram_disk, "A02"); @@ -429,7 +429,7 @@ fx_media_flush(&ram_disk); status += fx_directory_delete(&ram_disk, "A30"); status += fx_directory_delete(&ram_disk, "A31"); status += fx_directory_delete(&ram_disk, "A32"); - + /* Check for errors... */ if (status != FX_SUCCESS) { @@ -441,7 +441,7 @@ fx_media_flush(&ram_disk); /* Flush the media. */ status = fx_media_flush(&ram_disk); - + /* Now do the same thing, except with 2 entry long names. */ status += fx_directory_create(&ram_disk, "b01"); status += fx_directory_create(&ram_disk, "b02"); @@ -501,7 +501,7 @@ fx_media_flush(&ram_disk); status += fx_directory_delete(&ram_disk, "b14"); status += fx_directory_delete(&ram_disk, "b15"); status += fx_directory_delete(&ram_disk, "b16"); - + /* Check for errors... */ if (status != FX_SUCCESS) { @@ -510,7 +510,7 @@ fx_media_flush(&ram_disk); printf("ERROR!\n"); test_control_return(21); } - + #if 0 /* test the directory free search function for proper error handing with invalid names */ FX_DIR_ENTRY dir_entry; @@ -524,7 +524,7 @@ fx_media_flush(&ram_disk); printf("ERROR!\n"); test_control_return(22); } - + /* test the directory free search function for proper error handling of special characters */ /* This code is executing differently on local vs server. Disabled until cause is explored */ dir_entry.fx_dir_entry_name[0] = (char)128; @@ -536,7 +536,7 @@ fx_media_flush(&ram_disk); printf("ERROR!\n"); test_control_return(23); } - + /* test the directory free search function for proper error handling of special characters */ dir_entry.fx_dir_entry_name[0] = '%'; dir_entry.fx_dir_entry_name[1] = '%'; @@ -547,7 +547,7 @@ fx_media_flush(&ram_disk); printf("ERROR!\n"); test_control_return(24); } - + /* test the directory free search function for proper error handling of special characters */ dir_entry.fx_dir_entry_name[0] = ']'; dir_entry.fx_dir_entry_name[1] = ']'; @@ -559,7 +559,7 @@ fx_media_flush(&ram_disk); test_control_return(25); } #endif - + /* Create a directory. */ status = fx_directory_create(&ram_disk, "b16"); @@ -576,22 +576,22 @@ fx_media_flush(&ram_disk); _fx_utility_logical_sector_read_error_request = 1; status = fx_directory_name_test(&ram_disk, "b16"); _fx_utility_logical_sector_read_error_request = 0; - + /* Check for the I/O error. */ if (status != FX_IO_ERROR) { - + printf("ERROR!\n"); test_control_return(26); } /* Test the directory name. */ _fx_directory_name_extract("\\", return_name); - + /* Check for a good return name. */ if (return_name[0] != 0) { - + printf("ERROR!\n"); test_control_return(27); } @@ -608,11 +608,11 @@ fx_media_flush(&ram_disk); /* Was the name truncated? */ if (return_name[FX_MAX_LONG_NAME_LEN - 1] != 0) { - + printf("ERROR!\n"); test_control_return(28); } - + /* Close the media. */ status = fx_media_close(&ram_disk); diff --git a/test/regression_test/filex_directory_rename_test.c b/test/regression_test/filex_directory_rename_test.c index f51442a..fb0a730 100644 --- a/test/regression_test/filex_directory_rename_test.c +++ b/test/regression_test/filex_directory_rename_test.c @@ -33,10 +33,10 @@ static CHAR max_newname[FX_MAX_LONG_NAME_LEN + 1]; #ifndef FX_STANDALONE_ENABLE static UCHAR *ram_disk_memory; static UCHAR *cache_buffer; -static UCHAR *fault_tolerant_buffer; +static UCHAR *fault_tolerant_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; -static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; +static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; #endif @@ -62,13 +62,13 @@ void filex_directory_rename_application_define(void *first_unused_memory) #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -105,11 +105,11 @@ static void ftest_0_entry(ULONG thread_input) printf("FileX Test: Directory rename test.................................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 128, // Directory Entries @@ -117,23 +117,23 @@ static void ftest_0_entry(ULONG thread_input) /* We need a larger disk to test fault tolerant feature. */ #ifdef FX_ENABLE_FAULT_TOLERANT - 4096 * 8, // Total sectors - 256, // Sector size + 4096 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster #else - 4096, // Total sectors - 128, // Sector size + 4096, // Total sectors + 128, // Sector size 1, // Sectors per cluster #endif 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Test a directory name before the media is opened to generate an error */ status = fx_directory_name_test(&ram_disk, "/A0"); return_if_fail( status == FX_MEDIA_NOT_OPEN); - + /* Try to rename a directory to an invalid name */ status = fx_directory_rename(&ram_disk, "/A0", ""); return_if_fail( status == FX_INVALID_NAME); @@ -141,7 +141,7 @@ static void ftest_0_entry(ULONG thread_input) /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); - + #ifdef FX_ENABLE_FAULT_TOLERANT /* Enable fault tolerant if FX_ENABLE_FAULT_TOLERANT is defined. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); @@ -153,17 +153,17 @@ static void ftest_0_entry(ULONG thread_input) status = fx_directory_rename(&ram_disk, "/A0", "/A1"); ram_disk.fx_media_driver_write_protect = FX_FALSE; return_if_fail( status == FX_WRITE_PROTECT); - + /* Attempt to rename a directory that does not exist */ status = fx_directory_rename(&ram_disk, "/DOES_NOT_EXIST", "/VALID"); return_if_fail( status != FX_SUCCESS); - + /* Attempt to rename something that is not a directory */ status = fx_file_create(&ram_disk, "NOT_A_DIR"); status += fx_directory_rename(&ram_disk, "NOT_A_DIR", "/VALID"); status += fx_file_delete(&ram_disk, "NOT_A_DIR"); return_if_fail( status == FX_NOT_DIRECTORY); - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING @@ -184,37 +184,37 @@ static void ftest_0_entry(ULONG thread_input) status += fx_directory_rename(&ram_disk, "newnewdir", "OURTEST/newdir"); status += fx_directory_create(&ram_disk, "/OURTEST/newdir/finaltest"); return_if_fail( status == FX_SUCCESS); - + /* Attempt to rename a directory to a name that is taken */ status = fx_directory_rename(&ram_disk, "/OURTEST/newdir/finaltest", "/OURTEST/newdir"); return_if_fail( status == FX_ALREADY_CREATED); - + /* Attempt to rename a directory to a subdirectory with an invalid name */ status = fx_directory_rename(&ram_disk, "OURTEST/newdir/finaltest", "OURTEST/newdir/does_not_exist/this_wont_work"); return_if_fail( status == FX_INVALID_NAME); - + /* Rename a directory and make it hidden */ status = fx_directory_rename(&ram_disk, "OURTEST/newdir/finaltest", "/.hidden"); return_if_fail( status == FX_SUCCESS); - + /* Create a root directory so we can rename it. */ status = fx_directory_create(&ram_disk, "newroot"); - + /* Now try to rename the root directory, but with leading and trailing spaces. */ status += fx_directory_rename(&ram_disk, "newroot", " newnewroot "); return_if_fail( status == FX_SUCCESS); - + /* Now test the maximum size of the new directory name. */ for (i = 0; i < FX_MAX_LONG_NAME_LEN; i++) { max_name[i] = 'a'; } max_name[i] = 0; - + /* Now try to test the maximum new name length. */ status = fx_directory_rename(&ram_disk, "newnewroot", max_name); return_if_fail( status == FX_INVALID_NAME); - + max_name[i] = 'a'; max_name[i + 1] = 'a'; @@ -229,15 +229,15 @@ static void ftest_0_entry(ULONG thread_input) /* Rename the directory to a valid maximum name. */ status = fx_directory_rename(&ram_disk, "newnewroot", max_name); return_if_fail( status == FX_SUCCESS); - + /* Now build a new long file name with only one cap character different. */ for (i = 0; i < FX_MAX_LONG_NAME_LEN+1; i++) { max_newname[i] = max_name[i]; - } + } /* Change just the first character to upper case. */ max_newname[0] = 'A'; - + /* Rename the directory to a valid maximum name with just an upper case change. */ status = fx_directory_rename(&ram_disk, max_name, max_newname); @@ -265,7 +265,7 @@ static void ftest_0_entry(ULONG thread_input) status = fx_directory_rename(&ram_disk, max_newname, "newroot"); _fx_utility_logical_sector_read_error_request = 0; return_if_fail( status == FX_IO_ERROR); - + /* Now try to get an I/O error on the directory write call. */ _fx_utility_logical_sector_write_error_request = 1; status = fx_directory_rename(&ram_disk, max_newname, "newroot"); @@ -275,12 +275,12 @@ static void ftest_0_entry(ULONG thread_input) /* Now rename the direction with a root directory path. */ status = fx_directory_rename(&ram_disk, max_newname, "\\newroot"); return_if_fail( status == FX_SUCCESS); - + /* Fail to update old directory entry. */ _fx_directory_entry_write_error_request = 2; status = fx_directory_rename(&ram_disk, "\\newroot", "aaa"); return_if_fail( status == FX_IO_ERROR); - + /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); diff --git a/test/regression_test/filex_fault_tolerant_corrupted_log_file_test.c b/test/regression_test/filex_fault_tolerant_corrupted_log_file_test.c index b9d6740..1217221 100644 --- a/test/regression_test/filex_fault_tolerant_corrupted_log_file_test.c +++ b/test/regression_test/filex_fault_tolerant_corrupted_log_file_test.c @@ -35,14 +35,14 @@ with copy_offset set to 1 the result of sum of copy_size and copy_offset will be ``` #endif -#include "fx_api.h" +#include "fx_api.h" #include "fx_utility.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_corrupted_log_file_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) #define DEMO_STACK_SIZE 4096 @@ -86,20 +86,20 @@ void filex_fault_tolerant_corrupted_log_file_test_application_define(void *fi #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; - /* Setup memory for the RAM disk and the sector cache. */ + /* Setup memory for the RAM disk and the sector cache. */ cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; @@ -112,7 +112,7 @@ void filex_fault_tolerant_corrupted_log_file_test_application_define(void *fi ftest_0_entry(0); #endif } - + /* Define the test threads. */ @@ -128,72 +128,72 @@ FX_FAULT_TOLERANT_DIR_LOG *dir_log; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Corrupted Log File test................."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } return_if_fail( status == FX_SUCCESS); /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); return_if_fail(ram_disk.fx_media_fault_tolerant_enabled != FX_TRUE); - - /* Enable the Fault-tolerant feature. */ + + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail( status == FX_SUCCESS); @@ -222,12 +222,12 @@ FX_FAULT_TOLERANT_DIR_LOG *dir_log; return_if_fail( status == FX_SUCCESS); } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) diff --git a/test/regression_test/filex_fault_tolerant_delete_large_data_test.c b/test/regression_test/filex_fault_tolerant_delete_large_data_test.c index 212da25..a267b1c 100644 --- a/test/regression_test/filex_fault_tolerant_delete_large_data_test.c +++ b/test/regression_test/filex_fault_tolerant_delete_large_data_test.c @@ -1,15 +1,15 @@ /* This FileX test concentrates on the Fault-Tolerant delete large data test. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; -Check media full operation: -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create new file called "TEST.TXT"; -Step4: Get the media available bytes; +Check media full operation: +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create new file called "TEST.TXT"; +Step4: Get the media available bytes; Step5: Delete large file from the media; -Step6: Check the media available bytes. +Step6: Check the media available bytes. Step7: Loop to read and check the file data from the media; -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" #endif @@ -17,10 +17,10 @@ Step7: Loop to read and check the file data from the media; #include "fx_fault_tolerant.h" #include #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_delete_large_data_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) #define DEMO_STACK_SIZE 4096 @@ -31,29 +31,29 @@ void filex_fault_tolerant_delete_large_data_test_application_define(void *fir /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); +extern void test_control_return(UINT status); /* Define what the initial system looks like. */ @@ -66,20 +66,20 @@ void filex_fault_tolerant_delete_large_data_test_application_define(void *fir { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; - /* Setup memory for the RAM disk and the sector cache. */ + /* Setup memory for the RAM disk and the sector cache. */ cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; @@ -92,7 +92,7 @@ void filex_fault_tolerant_delete_large_data_test_application_define(void *fir ftest_0_entry(0); #endif } - + /* Define the test threads. */ @@ -129,57 +129,57 @@ ULONG data_value; if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4000 * 8, // Total sectors - 256, // Sector size + 4000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 60000 * 8, // Total sectors - 256, // Sector size + 60000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 400000 * 8, // Total sectors - 256, // Sector size + 400000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -207,11 +207,11 @@ ULONG data_value; /* Check status. */ if (status) { - + printf("ERROR!\n"); test_control_return(3); } - + /* Create a file called TEST.TXT in the root directory. */ status = fx_file_create(&ram_disk, "TEST.TXT"); @@ -268,7 +268,7 @@ ULONG data_value; } #ifndef FX_DISABLE_CACHE - /* At this point, we should invalidate the (which also flushes the cache) media to ensure that all + /* At this point, we should invalidate the (which also flushes the cache) media to ensure that all dirty sectors are written. */ status = fx_media_cache_invalidate(&ram_disk); @@ -314,8 +314,8 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(12); - } - + } + /* Close the test file. */ status = fx_file_close(&my_file); @@ -325,7 +325,7 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(13); - } + } /* Delete the data from the file. */ status = fx_file_delete(&ram_disk, "TEST.TXT"); @@ -336,7 +336,7 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(14); - } + } /* Close the media. */ status = fx_media_close(&ram_disk); @@ -347,15 +347,15 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(15); - } + } } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -363,11 +363,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_delete_large_data_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Delete Large Data Test..................N/A\n"); + printf("FileX Test: Fault Tolerant Delete Large Data Test..................N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_directory_attributes_set_directory_interrupt_test.c b/test/regression_test/filex_fault_tolerant_directory_attributes_set_directory_interrupt_test.c index 458bf71..607d3c8 100644 --- a/test/regression_test/filex_fault_tolerant_directory_attributes_set_directory_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_directory_attributes_set_directory_interrupt_test.c @@ -1,16 +1,16 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check directory interrupt for fx_directory_attributes_set(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create directory "TEST_DIR"; -Step4: Check the attributes for "TEST_DIR" directory; + +Check directory interrupt for fx_directory_attributes_set(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create directory "TEST_DIR"; +Step4: Check the attributes for "TEST_DIR" directory; Step5: Create a new thread to set the attributes as FX_DIRECTORY | FX_ARCHIVE | FX_SYSTEM | FX_READ_ONLY | FX_HIDDEN for "TEST_DIR" directory; -Step6: Terminate the new thread to simulate poweroff when update the directory after record the redo log. -Step7: Open the media; -Step8: Enable fault tolerant feature to recover the data(redo operation); +Step6: Terminate the new thread to simulate poweroff when update the directory after record the redo log. +Step7: Open the media; +Step8: Enable fault tolerant feature to recover the data(redo operation); Step9: Check the attributes for "TEST_DIR" directory. */ @@ -26,10 +26,10 @@ Step9: Check the attributes for "TEST_DIR" directory. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_directory_attributes_set_directory_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -40,16 +40,16 @@ void filex_fault_tolerant_directory_attributes_set_directory_interrupt_test_a /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -57,24 +57,24 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT directory_write_interrupt = FX_FALSE; - +static UINT directory_write_interrupt = FX_FALSE; + #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); -#endif +static void *ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -88,15 +88,15 @@ void filex_fault_tolerant_directory_attributes_set_directory_interrupt_test_a #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -131,7 +131,7 @@ UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Dir Attrib Set DIR Interrupt Test......."); + printf("FileX Test: Fault Tolerant Dir Attrib Set DIR Interrupt Test......."); /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) @@ -139,57 +139,57 @@ UINT i; if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } return_if_fail( status == FX_SUCCESS); @@ -197,7 +197,7 @@ UINT i; status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail( status == FX_SUCCESS); @@ -216,8 +216,8 @@ UINT i; /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -233,13 +233,13 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable( &ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail( status == FX_SUCCESS); @@ -264,12 +264,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -282,7 +282,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -290,9 +290,9 @@ static void ftest_1_entry(ULONG thread_input) /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Now write the attributes out for the directory. */ - fx_directory_attributes_set(&ram_disk, "TEST_DIR", FX_DIRECTORY | FX_ARCHIVE | FX_SYSTEM | FX_READ_ONLY | FX_HIDDEN); + fx_directory_attributes_set(&ram_disk, "TEST_DIR", FX_DIRECTORY | FX_ARCHIVE | FX_SYSTEM | FX_READ_ONLY | FX_HIDDEN); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) @@ -308,14 +308,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt = FX_TRUE; - + directory_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -327,10 +327,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -344,7 +344,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -352,11 +352,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_directory_attributes_set_directory_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Dir Attrib Set DIR Interrupt Test.......N/A\n"); + printf("FileX Test: Fault Tolerant Dir Attrib Set DIR Interrupt Test.......N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_directory_attributes_set_redo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_directory_attributes_set_redo_log_interrupt_test.c index c9a72d3..7698b4c 100644 --- a/test/regression_test/filex_fault_tolerant_directory_attributes_set_redo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_directory_attributes_set_redo_log_interrupt_test.c @@ -1,16 +1,16 @@ /* This FileX test concentrates on the Fault-Tolerant redo_log write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check redo log interrupt for fx_directory_attributes_set(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create directory "TEST_DIR"; -Step4: Check the attributes for "TEST_DIR" directory; + +Check redo log interrupt for fx_directory_attributes_set(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create directory "TEST_DIR"; +Step4: Check the attributes for "TEST_DIR" directory; Step5: Create new thread to set the attributes as FX_DIRECTORY | FX_ARCHIVE | FX_SYSTEM | FX_READ_ONLY | FX_HIDDEN for "TEST_DIR" directory; -Step6: Terminate the new thread to simulate poweroff when update the redo log. -Step7: Open the media; -Step8: Enable fault tolerant feature to recover the data(undo operation); +Step6: Terminate the new thread to simulate poweroff when update the redo log. +Step7: Open the media; +Step8: Enable fault tolerant feature to recover the data(undo operation); Step9: Check the attributes for "TEST_DIR" directory. */ @@ -26,10 +26,10 @@ Step9: Check the attributes for "TEST_DIR" directory. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_directory_attributes_set_redo_log_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -40,16 +40,16 @@ void filex_fault_tolerant_directory_attributes_set_redo_log_interrupt_test_ap /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -57,24 +57,24 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT log_write_interrupt = FX_FALSE; - +static UINT log_write_interrupt = FX_FALSE; + #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); +static void *ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); +extern void test_control_return(UINT status); extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -88,15 +88,15 @@ void filex_fault_tolerant_directory_attributes_set_redo_log_interrupt_test_ap #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -105,7 +105,7 @@ void filex_fault_tolerant_directory_attributes_set_redo_log_interrupt_test_ap cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -125,71 +125,71 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -UINT attributes; +UINT attributes; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Dir Attrib Set Redo LOG Interrupt Test.."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -211,7 +211,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -246,16 +246,16 @@ UINT i; printf("ERROR!\n"); test_control_return(5); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif /* directory_write_interrupt */ - log_write_interrupt = FX_FALSE; + log_write_interrupt = FX_FALSE; /* Let the other thread run. */ #ifndef FX_STANDALONE_ENABLE @@ -266,7 +266,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -278,9 +278,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(6); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -289,7 +289,7 @@ UINT i; printf("ERROR!\n"); test_control_return(7); - } + } /* Invalidate the media cache. */ fx_media_cache_invalidate(&ram_disk); @@ -314,7 +314,7 @@ UINT i; printf("ERROR!\n"); test_control_return(9); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -324,10 +324,10 @@ UINT i; #endif } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -340,7 +340,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -348,14 +348,14 @@ static void ftest_1_entry(ULONG thread_input) /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Now write the attributes out for the directory. */ - fx_directory_attributes_set(&ram_disk, "TEST_DIR", FX_DIRECTORY | FX_ARCHIVE | FX_SYSTEM | FX_READ_ONLY | FX_HIDDEN); + fx_directory_attributes_set(&ram_disk, "TEST_DIR", FX_DIRECTORY | FX_ARCHIVE | FX_SYSTEM | FX_READ_ONLY | FX_HIDDEN); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) -{ - +{ + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the redo log write operation. */ @@ -366,14 +366,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - log_write_interrupt = FX_TRUE; - + log_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -385,10 +385,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -402,7 +402,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -410,11 +410,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_directory_attributes_set_redo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Dir Attrib Set Redo LOG Interrupt Test..N/A\n"); + printf("FileX Test: Fault Tolerant Dir Attrib Set Redo LOG Interrupt Test..N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_directory_create_directory_interrupt_test.c b/test/regression_test/filex_fault_tolerant_directory_create_directory_interrupt_test.c index 15da3ac..91cd07d 100644 --- a/test/regression_test/filex_fault_tolerant_directory_create_directory_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_directory_create_directory_interrupt_test.c @@ -1,18 +1,18 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check directory interrupt for fx_directory_create(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create directories and sub-directories; -Step4: Traverse the directory; + +Check directory interrupt for fx_directory_create(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create directories and sub-directories; +Step4: Traverse the directory; Step5: Create new thread to create new directory "/D0/D5"; -Step6: Terminate the new thread to simulate poweroff when update the directory after record the redo log. -Step7: Open the media; -Step8: Enable fault tolerant feature to recover the data(redo operation); -Step9: Traverse the directory; -Step10: Recreate directory "/D0/D5"; +Step6: Terminate the new thread to simulate poweroff when update the directory after record the redo log. +Step7: Open the media; +Step8: Enable fault tolerant feature to recover the data(redo operation); +Step9: Traverse the directory; +Step10: Recreate directory "/D0/D5"; */ #ifndef FX_STANDALONE_ENABLE @@ -27,10 +27,10 @@ Step10: Recreate directory "/D0/D5"; #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_directory_create_directory_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -41,18 +41,18 @@ void filex_fault_tolerant_directory_create_directory_interrupt_test_applicati /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; -static UCHAR *pointer; +static UCHAR *pointer; #define TEST_COUNT 3 /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -60,78 +60,78 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_counter = 0; -static UINT directory_write_interrupt = FX_FALSE; +static UINT directory_write_interrupt = FX_FALSE; static UINT expected_index = 0; static CHAR * expected_name[] = { - + "A0", ".", - "..", - "A1", + "..", + "A1", ".", - "..", - "A00", + "..", + "A00", ".", - "..", - "A2", + "..", + "A2", ".", - "..", - "A3", + "..", + "A3", ".", - "..", + "..", "B0", ".", - "..", - "B1", + "..", + "B1", ".", - "..", - "B2", + "..", + "B2", ".", - "..", - "B00", + "..", + "B00", ".", - "..", - "B3", + "..", + "B3", ".", - "..", + "..", "C0", ".", - "..", - "C1", + "..", + "C1", ".", - "..", - "C2", + "..", + "C2", ".", - "..", - "C3", + "..", + "C3", ".", - "..", - "C00", + "..", + "C00", ".", - "..", + "..", "D0", ".", - "..", - "D1", + "..", + "D1", ".", - "..", - "D2", + "..", + "D2", ".", - "..", - "D3", + "..", + "D3", ".", - "..", - "D4", + "..", + "D4", ".", - "..", - "D00", + "..", + "D00", ".", - "..", - "D5", + "..", + "D5", ".", - "..", + "..", "END"}; /* Define thread prototypes. */ @@ -139,15 +139,15 @@ static CHAR * expected_name[] = { static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); -#else -static void * ftest_1_entry(void * thread_input); +#else +static void * ftest_1_entry(void * thread_input); #endif - + extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); +extern void test_control_return(UINT status); static void traverse_directory(CHAR *directory_name); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -161,22 +161,22 @@ void filex_fault_tolerant_directory_create_directory_interrupt_test_applicati #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; - + /* Create the main thread. */ - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -184,7 +184,7 @@ void filex_fault_tolerant_directory_create_directory_interrupt_test_applicati cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -203,71 +203,71 @@ void filex_fault_tolerant_directory_create_directory_interrupt_test_applicati static void ftest_0_entry(ULONG thread_input) { -UINT status; +UINT status; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Dir Create DIR Interrupt Test..........."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -275,7 +275,7 @@ UINT i; printf("ERROR!\n"); test_control_return(1); - } + } /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -289,7 +289,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -330,7 +330,7 @@ UINT i; status += fx_directory_create(&ram_disk, "/D0/D1"); status += fx_directory_create(&ram_disk, "/D0/D2"); - status += fx_directory_create(&ram_disk, "/D0/D3"); + status += fx_directory_create(&ram_disk, "/D0/D3"); status += fx_directory_create(&ram_disk, "/D0/D4"); /* Check for errors... */ @@ -355,18 +355,18 @@ UINT i; /* Error creating sub-sub-directories. Return to caller. */ printf("ERROR!\n"); test_control_return(6); - } + } /* Set the index as zero before traverse. */ expected_index = 0; - + /* Traverse the directory structure recursively. */ traverse_directory(FX_NULL); - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -379,10 +379,10 @@ UINT i; #else pthread_create(&ptid1, NULL, &ftest_1_entry, NULL); usleep(10); - pthread_join(ptid1,NULL); + pthread_join(ptid1,NULL); #endif - /* After interrupt, reread the files. */ + /* After interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -394,9 +394,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(7); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -409,7 +409,7 @@ UINT i; /* Set the index as zero before traverse. */ expected_index = 0; - + /* Traverse the directory structure recursively. */ traverse_directory(FX_NULL); @@ -434,7 +434,7 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -442,12 +442,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -456,17 +456,17 @@ static void ftest_1_entry(ULONG thread_input) #else void * ftest_1_entry(void * thread_input) #endif -{ +{ #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif FX_PARAMETER_NOT_USED(thread_input); /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Create the next level of sub-directories. */ fx_directory_create(&ram_disk, "/D0/D5"); } @@ -484,14 +484,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt = FX_TRUE; - + directory_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -503,10 +503,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -521,7 +521,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ return FX_SUCCESS; } -#ifndef FX_STANDALONE_ENABLE +#ifndef FX_STANDALONE_ENABLE /* Define the FAT12, 16 and 32 directory traversal routine for the local path test. */ static void traverse_directory(CHAR *directory_name) { @@ -570,7 +570,7 @@ UINT skip; status = fx_file_close(&file); if (status != FX_SUCCESS) error_counter++; - + /* Pickup the next directory entry. */ status = fx_directory_next_entry_find(&ram_disk, name); } @@ -584,17 +584,17 @@ UINT skip; { /* Recursive call to traverse directory. */ traverse_directory(name); - + /* Restore path. */ status = fx_directory_local_path_restore(&ram_disk, &local_path); } status = fx_directory_next_entry_find(&ram_disk, name); - } - } + } + } fx_directory_local_path_clear(&ram_disk); -} - +} + #else static void traverse_directory(CHAR *directory_name) @@ -626,14 +626,14 @@ CHAR name[300]; printf("ERROR!\n"); test_control_return(12); } - /* Okay, now postion to the deepest sub-directory and ensure that the directory first/next + /* Okay, now postion to the deepest sub-directory and ensure that the directory first/next operations work properly there as well. */ /* Set the current path */ status = fx_directory_default_set(&ram_disk, "/D0/D4"); /* Check the status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { /* Error setting the path. Return to caller. */ @@ -668,7 +668,7 @@ CHAR name[300]; } #endif -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -676,11 +676,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_directory_create_directory_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Dir Create DIR Interrupt Test...........N/A\n"); + printf("FileX Test: Fault Tolerant Dir Create DIR Interrupt Test...........N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_directory_create_redo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_directory_create_redo_log_interrupt_test.c index 25b5467..913debb 100644 --- a/test/regression_test/filex_fault_tolerant_directory_create_redo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_directory_create_redo_log_interrupt_test.c @@ -1,18 +1,18 @@ /* This FileX test concentrates on the Fault-Tolerant redo log write interrupt operation. */ /* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check redo log interrupt for fx_directory_create(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create directories and sub-directories; -Step4: Traverse the directory; + +Check redo log interrupt for fx_directory_create(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create directories and sub-directories; +Step4: Traverse the directory; Step5: Create new thread to create new directory "/D0/D5"; -Step6: Terminate the new thread to simulate poweroff when update the redo log. -Step7: Open the media; -Step8: Enable fault tolerant feature to recover the data(undo operation); -Step9: Traverse the directory; -Step10: Recreate directory "/D0/D5"; +Step6: Terminate the new thread to simulate poweroff when update the redo log. +Step7: Open the media; +Step8: Enable fault tolerant feature to recover the data(undo operation); +Step9: Traverse the directory; +Step10: Recreate directory "/D0/D5"; */ #ifndef FX_STANDALONE_ENABLE @@ -27,10 +27,10 @@ Step10: Recreate directory "/D0/D5"; #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_directory_create_redo_log_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -43,18 +43,18 @@ void filex_fault_tolerant_directory_create_redo_log_interrupt_test_applicatio /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; -static UCHAR *pointer; +static UCHAR *pointer; #define TEST_COUNT 3 /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -62,79 +62,79 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_counter = 0; static UINT redo_complete =0; -static UINT log_write_interrupt = FX_FALSE; +static UINT log_write_interrupt = FX_FALSE; static UINT expected_index = 0; static CHAR * expected_name[] = { - + "A0", ".", - "..", - "A1", + "..", + "A1", ".", - "..", - "A00", + "..", + "A00", ".", - "..", - "A2", + "..", + "A2", ".", - "..", - "A3", + "..", + "A3", ".", - "..", + "..", "B0", ".", - "..", - "B1", + "..", + "B1", ".", - "..", - "B2", + "..", + "B2", ".", - "..", - "B00", + "..", + "B00", ".", - "..", - "B3", + "..", + "B3", ".", - "..", + "..", "C0", ".", - "..", - "C1", + "..", + "C1", ".", - "..", - "C2", + "..", + "C2", ".", - "..", - "C3", + "..", + "C3", ".", - "..", - "C00", + "..", + "C00", ".", - "..", + "..", "D0", ".", - "..", - "D1", + "..", + "D1", ".", - "..", - "D2", + "..", + "D2", ".", - "..", - "D3", + "..", + "D3", ".", - "..", - "D4", + "..", + "D4", ".", - "..", - "D00", + "..", + "D00", ".", - "..", - "D5", + "..", + "D5", ".", - "..", + "..", "END"}; /* Define thread prototypes. */ @@ -143,13 +143,13 @@ static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); +static void * ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -static void traverse_directory(CHAR *directory_name); +extern void test_control_return(UINT status); +static void traverse_directory(CHAR *directory_name); extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -163,22 +163,22 @@ void filex_fault_tolerant_directory_create_redo_log_interrupt_test_applicatio #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; - + /* Create the main thread. */ - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -186,7 +186,7 @@ void filex_fault_tolerant_directory_create_redo_log_interrupt_test_applicatio cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -205,13 +205,13 @@ void filex_fault_tolerant_directory_create_redo_log_interrupt_test_applicatio static void ftest_0_entry(ULONG thread_input) { -UINT status; +UINT status; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Dir Create Redo LOG Interrupt Test......"); + printf("FileX Test: Fault Tolerant Dir Create Redo LOG Interrupt Test......"); /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { @@ -219,57 +219,57 @@ UINT i; if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -277,7 +277,7 @@ UINT i; printf("ERROR!\n"); test_control_return(1); - } + } /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -291,7 +291,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -332,7 +332,7 @@ UINT i; status += fx_directory_create(&ram_disk, "/D0/D1"); status += fx_directory_create(&ram_disk, "/D0/D2"); - status += fx_directory_create(&ram_disk, "/D0/D3"); + status += fx_directory_create(&ram_disk, "/D0/D3"); status += fx_directory_create(&ram_disk, "/D0/D4"); /* Check for errors... */ @@ -357,18 +357,18 @@ UINT i; /* Error creating sub-sub-directories. Return to caller. */ printf("ERROR!\n"); test_control_return(6); - } + } /* Set the index as zero before traverse. */ expected_index = 0; - + /* Traverse the directory structure recursively. */ traverse_directory(FX_NULL); - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -382,10 +382,10 @@ UINT i; pthread_create(&ptid1, NULL, &ftest_1_entry, NULL); usleep(10); pthread_join(ptid1,NULL); - + #endif - /* After interrupt, reread the files. */ + /* After interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -397,9 +397,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(7); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -412,7 +412,7 @@ UINT i; /* Set the index as zero before traverse. */ expected_index = 0; - + /* Traverse the directory structure recursively. */ traverse_directory(FX_NULL); @@ -426,11 +426,11 @@ UINT i; /* Error creating same directory twice. Return to caller. */ printf("ERROR!\n"); test_control_return(9); - } + } /* Set the index as zero before traverse. */ expected_index = 0; - + redo_complete = 1; /* Traverse the directory structure recursively. */ traverse_directory(FX_NULL); @@ -444,7 +444,7 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -452,12 +452,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -466,24 +466,24 @@ static void ftest_1_entry(ULONG thread_input) #else void * ftest_1_entry(void * thread_input) #endif -{ +{ #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif FX_PARAMETER_NOT_USED(thread_input); /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Create the next level of sub-directories. */ fx_directory_create(&ram_disk, "/D0/D5"); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) -{ - +{ + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the redo log write operation. */ if ((sector_type == FX_DATA_SECTOR) && (_filex_fault_tolerant_log_check(media_ptr) & FX_FAULT_TOLERANT_LOG_REDO_UPDATING)) @@ -493,14 +493,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - log_write_interrupt = FX_TRUE; - + log_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -512,10 +512,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -529,8 +529,8 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } - -#ifndef FX_STANDALONE_ENABLE + +#ifndef FX_STANDALONE_ENABLE /* Define the FAT12, 16 and 32 directory traversal routine for the local path test. */ static void traverse_directory(CHAR *directory_name) { @@ -579,7 +579,7 @@ UINT skip; status = fx_file_close(&file); if (status != FX_SUCCESS) error_counter++; - + /* Pickup the next directory entry. */ status = fx_directory_next_entry_find(&ram_disk, name); } @@ -593,17 +593,17 @@ UINT skip; { /* Recursive call to traverse directory. */ traverse_directory(name); - + /* Restore path. */ status = fx_directory_local_path_restore(&ram_disk, &local_path); } status = fx_directory_next_entry_find(&ram_disk, name); - } - } + } + } fx_directory_local_path_clear(&ram_disk); -} - +} + #else static void traverse_directory(CHAR *directory_name) @@ -625,14 +625,14 @@ CHAR name[300]; if (strcmp(name, "D0")) status++; - /* Okay, now postion to the deepest sub-directory and ensure that the directory first/next + /* Okay, now postion to the deepest sub-directory and ensure that the directory first/next operations work properly there as well. */ /* Set the current path */ status = fx_directory_default_set(&ram_disk, "/D0/D4"); /* Check the status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { /* Error setting the path. Return to caller. */ @@ -655,22 +655,22 @@ CHAR name[300]; /* Set the current path */ status = fx_directory_default_set(&ram_disk, "/D0"); - status += fx_directory_first_entry_find(&ram_disk, name); + status += fx_directory_first_entry_find(&ram_disk, name); if (strcmp(name, ".")) error_counter++; - status += fx_directory_next_entry_find(&ram_disk, name); + status += fx_directory_next_entry_find(&ram_disk, name); if (strcmp(name, "..")) error_counter++; - status += fx_directory_next_entry_find(&ram_disk, name); + status += fx_directory_next_entry_find(&ram_disk, name); if (strcmp(name, "D1")) error_counter++; - status += fx_directory_next_entry_find(&ram_disk, name); + status += fx_directory_next_entry_find(&ram_disk, name); if (strcmp(name, "D2")) error_counter++; - status += fx_directory_next_entry_find(&ram_disk, name); + status += fx_directory_next_entry_find(&ram_disk, name); if (strcmp(name, "D3")) error_counter++; - status += fx_directory_next_entry_find(&ram_disk, name); + status += fx_directory_next_entry_find(&ram_disk, name); if (strcmp(name, "D4")) error_counter++; if(redo_complete==1) @@ -678,12 +678,12 @@ CHAR name[300]; status += fx_directory_next_entry_find(&ram_disk, name); if (strcmp(name, "D5")) error_counter++; - } + } } #endif -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -691,7 +691,7 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_directory_create_redo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ diff --git a/test/regression_test/filex_fault_tolerant_directory_delete_directory_interrupt_test.c b/test/regression_test/filex_fault_tolerant_directory_delete_directory_interrupt_test.c index 100c407..fa02bfd 100644 --- a/test/regression_test/filex_fault_tolerant_directory_delete_directory_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_directory_delete_directory_interrupt_test.c @@ -1,19 +1,19 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check directory interrupt for fx_directory_delete(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create directories and sub-directories; -Step4: Traverse the directory; + +Check directory interrupt for fx_directory_delete(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create directories and sub-directories; +Step4: Traverse the directory; Step5: Create new thread to delete directory "/D0/D4/D00"; -Step6: Terminate the new thread to simulate poweroff when update the directory after record the redo log. -Step7: Open the media; -Step8: Enable fault tolerant feature to recover the data(redo operation); -Step9: Traverse the directory; -Step10: Recreate directory "/D0/D4/D00"; -Step11: Traverse the directory; +Step6: Terminate the new thread to simulate poweroff when update the directory after record the redo log. +Step7: Open the media; +Step8: Enable fault tolerant feature to recover the data(redo operation); +Step9: Traverse the directory; +Step10: Recreate directory "/D0/D4/D00"; +Step11: Traverse the directory; */ #ifndef FX_STANDALONE_ENABLE @@ -28,10 +28,10 @@ Step11: Traverse the directory; #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_directory_delete_directory_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -44,13 +44,13 @@ void filex_fault_tolerant_directory_delete_directory_interrupt_test_applicati /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; -static UCHAR *pointer; +static UCHAR *pointer; #define TEST_COUNT 3 @@ -62,79 +62,79 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_counter = 0; static UINT poweroff_flag=0; -static UINT directory_write_interrupt = FX_FALSE; +static UINT directory_write_interrupt = FX_FALSE; static UINT expected_index = 0; static CHAR * expected_name[] = { - + "A0", ".", - "..", - "A1", + "..", + "A1", ".", - "..", - "A00", + "..", + "A00", ".", - "..", - "A2", + "..", + "A2", ".", - "..", - "A3", + "..", + "A3", ".", - "..", + "..", "B0", ".", - "..", - "B1", + "..", + "B1", ".", - "..", - "B2", + "..", + "B2", ".", - "..", - "B00", + "..", + "B00", ".", - "..", - "B3", + "..", + "B3", ".", - "..", + "..", "C0", ".", - "..", - "C1", + "..", + "C1", ".", - "..", - "C2", + "..", + "C2", ".", - "..", - "C3", + "..", + "C3", ".", - "..", - "C00", + "..", + "C00", ".", - "..", + "..", "D0", ".", - "..", - "D1", + "..", + "D1", ".", - "..", - "D2", + "..", + "D2", ".", - "..", - "D3", + "..", + "D3", ".", - "..", - "D4", + "..", + "D4", ".", - "..", - "D00", + "..", + "D00", ".", - "..", - "D5", + "..", + "D5", ".", - "..", + "..", "END"}; /* Define thread prototypes. */ @@ -143,13 +143,13 @@ static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); -#endif +static void * ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); +extern void test_control_return(UINT status); static void traverse_directory(CHAR *directory_name); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -163,15 +163,15 @@ void filex_fault_tolerant_directory_delete_directory_interrupt_test_applicati #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -180,7 +180,7 @@ void filex_fault_tolerant_directory_delete_directory_interrupt_test_applicati cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -199,14 +199,14 @@ void filex_fault_tolerant_directory_delete_directory_interrupt_test_applicati static void ftest_0_entry(ULONG thread_input) { -UINT status; +UINT status; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Dir Delete DIR Interrupt Test..........."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { @@ -214,57 +214,57 @@ UINT i; if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -272,7 +272,7 @@ UINT i; printf("ERROR!\n"); test_control_return(1); - } + } /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -286,7 +286,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -327,7 +327,7 @@ UINT i; status += fx_directory_create(&ram_disk, "/D0/D1"); status += fx_directory_create(&ram_disk, "/D0/D2"); - status += fx_directory_create(&ram_disk, "/D0/D3"); + status += fx_directory_create(&ram_disk, "/D0/D3"); status += fx_directory_create(&ram_disk, "/D0/D4"); /* Check for errors... */ @@ -352,18 +352,18 @@ UINT i; /* Error creating sub-sub-directories. Return to caller. */ printf("ERROR!\n"); test_control_return(6); - } + } /* Set the index as zero before traverse. */ expected_index = 0; - + /* Traverse the directory structure recursively. */ traverse_directory(FX_NULL); - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -377,10 +377,10 @@ UINT i; pthread_create(&ptid1, NULL, &ftest_1_entry, NULL); usleep(10); pthread_join(ptid1,NULL); - + #endif - /* After interrupt, reread the files. */ + /* After interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -392,9 +392,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(7); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -407,7 +407,7 @@ UINT i; /* Set the index as zero before traverse. */ expected_index = 0; - poweroff_flag++; + poweroff_flag++; /* Traverse the directory structure recursively. */ traverse_directory(FX_NULL); @@ -425,8 +425,8 @@ UINT i; /* Set the index as zero before traverse. */ expected_index = 0; - poweroff_flag++; - + poweroff_flag++; + /* Traverse the directory structure recursively. */ traverse_directory(FX_NULL); @@ -439,7 +439,7 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -447,12 +447,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -461,11 +461,11 @@ static void ftest_1_entry(ULONG thread_input) #else void * ftest_1_entry(void * thread_input) #endif -{ +{ #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -473,7 +473,7 @@ static void ftest_1_entry(ULONG thread_input) /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Delete the next level of sub-directories. */ fx_directory_delete(&ram_disk, "/D0/D4/D00"); } @@ -491,14 +491,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt = FX_TRUE; - + directory_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -510,10 +510,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -527,8 +527,8 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } - -#ifndef FX_STANDALONE_ENABLE + +#ifndef FX_STANDALONE_ENABLE /* Define the FAT12, 16 and 32 directory traversal routine for the local path test. */ static void traverse_directory(CHAR *directory_name) { @@ -577,7 +577,7 @@ UINT skip; status = fx_file_close(&file); if (status != FX_SUCCESS) error_counter++; - + /* Pickup the next directory entry. */ status = fx_directory_next_entry_find(&ram_disk, name); } @@ -591,17 +591,17 @@ UINT skip; { /* Recursive call to traverse directory. */ traverse_directory(name); - + /* Restore path. */ status = fx_directory_local_path_restore(&ram_disk, &local_path); } status = fx_directory_next_entry_find(&ram_disk, name); - } - } + } + } fx_directory_local_path_clear(&ram_disk); -} - +} + #else static void traverse_directory(CHAR *directory_name) @@ -625,14 +625,14 @@ CHAR name[300]; if (strcmp(name, "D0")) error_counter++; - /* Okay, now postion to the deepest sub-directory and ensure that the directory first/next + /* Okay, now postion to the deepest sub-directory and ensure that the directory first/next operations work properly there as well. */ /* Set the current path */ status = fx_directory_default_set(&ram_disk, "/D0/D4"); /* Check the status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { /* Error setting the path. Return to caller. */ @@ -656,7 +656,7 @@ CHAR name[300]; } #endif -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -664,11 +664,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_directory_delete_directory_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Dir Delete DIR Interrupt Test...........N/A\n"); + printf("FileX Test: Fault Tolerant Dir Delete DIR Interrupt Test...........N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_directory_delete_redo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_directory_delete_redo_log_interrupt_test.c index 8a9fddb..7b89f83 100644 --- a/test/regression_test/filex_fault_tolerant_directory_delete_redo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_directory_delete_redo_log_interrupt_test.c @@ -1,19 +1,19 @@ /* This FileX test concentrates on the Fault-Tolerant redo log write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check redo interrupt for fx_directory_delete(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create directories and sub-directories; -Step4: Traverse the directory; + +Check redo interrupt for fx_directory_delete(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create directories and sub-directories; +Step4: Traverse the directory; Step5: Create new thread to delete directory "/D0/D4/D00"; -Step6: Terminate the new thread to simulate poweroff when update the redo log. -Step7: Open the media; -Step8: Enable fault tolerant feature to recover the data(undo operation); -Step9: Traverse the directory; -Step10: Recreate directory "/D0/D4/D00"; -Step11: Traverse the directory; +Step6: Terminate the new thread to simulate poweroff when update the redo log. +Step7: Open the media; +Step8: Enable fault tolerant feature to recover the data(undo operation); +Step9: Traverse the directory; +Step10: Recreate directory "/D0/D4/D00"; +Step11: Traverse the directory; */ #ifndef FX_STANDALONE_ENABLE @@ -28,10 +28,10 @@ Step11: Traverse the directory; #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_directory_delete_redo_log_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -44,18 +44,18 @@ void filex_fault_tolerant_directory_delete_redo_log_interrupt_test_applicatio /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; -static UCHAR *pointer; +static UCHAR *pointer; #define TEST_COUNT 3 /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -63,78 +63,78 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_counter = 0; -static UINT log_write_interrupt = FX_FALSE; +static UINT log_write_interrupt = FX_FALSE; static UINT expected_index = 0; static CHAR * expected_name[] = { - + "A0", ".", - "..", - "A1", + "..", + "A1", ".", - "..", - "A00", + "..", + "A00", ".", - "..", - "A2", + "..", + "A2", ".", - "..", - "A3", + "..", + "A3", ".", - "..", + "..", "B0", ".", - "..", - "B1", + "..", + "B1", ".", - "..", - "B2", + "..", + "B2", ".", - "..", - "B00", + "..", + "B00", ".", - "..", - "B3", + "..", + "B3", ".", - "..", + "..", "C0", ".", - "..", - "C1", + "..", + "C1", ".", - "..", - "C2", + "..", + "C2", ".", - "..", - "C3", + "..", + "C3", ".", - "..", - "C00", + "..", + "C00", ".", - "..", + "..", "D0", ".", - "..", - "D1", + "..", + "D1", ".", - "..", - "D2", + "..", + "D2", ".", - "..", - "D3", + "..", + "D3", ".", - "..", - "D4", + "..", + "D4", ".", - "..", - "D00", + "..", + "D00", ".", - "..", - "D5", + "..", + "D5", ".", - "..", + "..", "END"}; /* Define thread prototypes. */ @@ -143,14 +143,14 @@ static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); -#endif - +static void * ftest_1_entry(void * thread_input); +#endif + extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -static void traverse_directory(CHAR *directory_name); +extern void test_control_return(UINT status); +static void traverse_directory(CHAR *directory_name); extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -164,24 +164,24 @@ void filex_fault_tolerant_directory_delete_redo_log_interrupt_test_applicatio #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; - + /* Setup memory for the RAM disk and the sector cache. */ cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -200,71 +200,71 @@ void filex_fault_tolerant_directory_delete_redo_log_interrupt_test_applicatio static void ftest_0_entry(ULONG thread_input) { -UINT status; +UINT status; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Dir Delete Redo LOG Interrupt Test......"); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -272,7 +272,7 @@ UINT i; printf("ERROR!\n"); test_control_return(1); - } + } /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -286,7 +286,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -327,7 +327,7 @@ UINT i; status += fx_directory_create(&ram_disk, "/D0/D1"); status += fx_directory_create(&ram_disk, "/D0/D2"); - status += fx_directory_create(&ram_disk, "/D0/D3"); + status += fx_directory_create(&ram_disk, "/D0/D3"); status += fx_directory_create(&ram_disk, "/D0/D4"); /* Check for errors... */ @@ -352,18 +352,18 @@ UINT i; /* Error creating sub-sub-directories. Return to caller. */ printf("ERROR!\n"); test_control_return(6); - } + } /* Set the index as zero before traverse. */ expected_index = 0; - + /* Traverse the directory structure recursively. */ traverse_directory(FX_NULL); - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -377,10 +377,10 @@ UINT i; pthread_create(&ptid1, NULL, &ftest_1_entry, NULL); usleep(10); pthread_join(ptid1,NULL); - + #endif - /* After interrupt, reread the files. */ + /* After interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -392,9 +392,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(7); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -407,7 +407,7 @@ UINT i; /* Set the index as zero before traverse. */ expected_index = 0; - + /* Traverse the directory structure recursively. */ traverse_directory(FX_NULL); @@ -421,11 +421,11 @@ UINT i; /* Error creating same directory twice. Return to caller. */ printf("ERROR!\n"); test_control_return(9); - } + } /* Set the index as zero before traverse. */ expected_index = 0; - + /* Traverse the directory structure recursively. */ traverse_directory(FX_NULL); @@ -438,7 +438,7 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -446,12 +446,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -460,25 +460,25 @@ static void ftest_1_entry(ULONG thread_input) #else void * ftest_1_entry(void * thread_input) #endif -{ +{ #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif FX_PARAMETER_NOT_USED(thread_input); /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Delete the next level of sub-directories. */ fx_directory_delete(&ram_disk, "/D0/D4/D00"); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) -{ - +{ + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the redo log write operation. */ @@ -489,14 +489,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - log_write_interrupt = FX_TRUE; - + log_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -508,10 +508,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -525,8 +525,8 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } - -#ifndef FX_STANDALONE_ENABLE + +#ifndef FX_STANDALONE_ENABLE /* Define the FAT12, 16 and 32 directory traversal routine for the local path test. */ static void traverse_directory(CHAR *directory_name) { @@ -575,7 +575,7 @@ UINT skip; status = fx_file_close(&file); if (status != FX_SUCCESS) error_counter++; - + /* Pickup the next directory entry. */ status = fx_directory_next_entry_find(&ram_disk, name); } @@ -589,17 +589,17 @@ UINT skip; { /* Recursive call to traverse directory. */ traverse_directory(name); - + /* Restore path. */ status = fx_directory_local_path_restore(&ram_disk, &local_path); } status = fx_directory_next_entry_find(&ram_disk, name); - } - } + } + } fx_directory_local_path_clear(&ram_disk); -} - +} + #else static void traverse_directory(CHAR *directory_name) @@ -627,7 +627,7 @@ CHAR name[300]; status = fx_directory_default_set(&ram_disk, "/D0/D4"); /* Check the status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { /* Error setting the path. Return to caller. */ @@ -652,7 +652,7 @@ CHAR name[300]; #endif -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -660,11 +660,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_directory_delete_redo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Dir Delete Redo LOG Interrupt Test......N/A\n"); + printf("FileX Test: Fault Tolerant Dir Delete Redo LOG Interrupt Test......N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_directory_rename_directory_interrupt_test.c b/test/regression_test/filex_fault_tolerant_directory_rename_directory_interrupt_test.c index 9e000db..abfb04e 100644 --- a/test/regression_test/filex_fault_tolerant_directory_rename_directory_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_directory_rename_directory_interrupt_test.c @@ -1,18 +1,18 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check directory interrupt for fx_directory_rename(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create directories and sub-directories; -Step4: Traverse the directory; + +Check directory interrupt for fx_directory_rename(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create directories and sub-directories; +Step4: Traverse the directory; Step5: Create new thread to rename directory from "/D0/D4" to "/D0/D5"; -Step6: Terminate the new thread to simulate poweroff when update the directory after record the redo log. -Step7: Open the media; -Step8: Enable fault tolerant feature to recover the data(redo operation); -Step9: Create directory "/D0/D4"; -Step10: Create directory "/D0/D5"; +Step6: Terminate the new thread to simulate poweroff when update the directory after record the redo log. +Step7: Open the media; +Step8: Enable fault tolerant feature to recover the data(redo operation); +Step9: Create directory "/D0/D4"; +Step10: Create directory "/D0/D5"; */ #ifndef FX_STANDALONE_ENABLE @@ -27,10 +27,10 @@ Step10: Create directory "/D0/D5"; #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_directory_rename_directory_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -43,18 +43,18 @@ void filex_fault_tolerant_directory_rename_directory_interrupt_test_applicati /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; -#else -static pthread_t ptid1; +#else +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; -static UCHAR *pointer; +static UCHAR *pointer; #define TEST_COUNT 3 /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -62,76 +62,76 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_counter = 0; static UINT exit_flag = 0; -static UINT directory_write_interrupt = FX_FALSE; +static UINT directory_write_interrupt = FX_FALSE; static UINT expected_index = 0; static CHAR * expected_name[] = { - + "A0", ".", - "..", - "A1", + "..", + "A1", ".", - "..", - "A00", + "..", + "A00", ".", - "..", - "A2", + "..", + "A2", ".", - "..", - "A3", + "..", + "A3", ".", - "..", + "..", "B0", ".", - "..", - "B1", + "..", + "B1", ".", - "..", - "B2", + "..", + "B2", ".", - "..", - "B00", + "..", + "B00", ".", - "..", - "B3", + "..", + "B3", ".", - "..", + "..", "C0", ".", - "..", - "C1", + "..", + "C1", ".", - "..", - "C2", + "..", + "C2", ".", - "..", - "C3", + "..", + "C3", ".", - "..", - "C00", + "..", + "C00", ".", - "..", + "..", "D0", ".", - "..", - "D1", + "..", + "D1", ".", - "..", - "D2", + "..", + "D2", ".", - "..", - "D3", + "..", + "D3", ".", - "..", - "D4", + "..", + "D4", ".", - "..", - "D00", + "..", + "D00", ".", - "..", + "..", "END"}; /* Define thread prototypes. */ @@ -139,15 +139,15 @@ static CHAR * expected_name[] = { static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); -#else -static void * ftest_1_entry(void * thread_input); +#else +static void * ftest_1_entry(void * thread_input); #endif - + extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -static void traverse_directory(CHAR *directory_name); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +static void traverse_directory(CHAR *directory_name); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -161,15 +161,15 @@ void filex_fault_tolerant_directory_rename_directory_interrupt_test_applicati #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -178,7 +178,7 @@ void filex_fault_tolerant_directory_rename_directory_interrupt_test_applicati cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -197,81 +197,81 @@ void filex_fault_tolerant_directory_rename_directory_interrupt_test_applicati static void ftest_0_entry(ULONG thread_input) { -UINT status; +UINT status; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Dir Rename DIR Interrupt Test..........."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { - exit_flag = 0; - + exit_flag = 0; + if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track - } + } /* Determine if the format had an error. */ if (status) { printf("ERROR!\n"); test_control_return(1); - } + } /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -285,7 +285,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -326,7 +326,7 @@ UINT i; status += fx_directory_create(&ram_disk, "/D0/D1"); status += fx_directory_create(&ram_disk, "/D0/D2"); - status += fx_directory_create(&ram_disk, "/D0/D3"); + status += fx_directory_create(&ram_disk, "/D0/D3"); status += fx_directory_create(&ram_disk, "/D0/D4"); /* Check for errors... */ @@ -351,18 +351,18 @@ UINT i; /* Error creating sub-sub-directories. Return to caller. */ printf("ERROR!\n"); test_control_return(6); - } + } /* Set the index as zero before traverse. */ expected_index = 0; - + /* Traverse the directory structure recursively. */ traverse_directory(FX_NULL); - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -378,7 +378,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After interrupt, reread the files. */ + /* After interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -390,9 +390,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(7); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -436,20 +436,20 @@ UINT i; printf("ERROR!\n"); test_control_return(11); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE tx_thread_delete(&ftest_1); -#else +#else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -458,11 +458,11 @@ static void ftest_1_entry(ULONG thread_input) #else void * ftest_1_entry(void * thread_input) #endif -{ +{ #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -470,7 +470,7 @@ static void ftest_1_entry(ULONG thread_input) /* Set the callback function to simulate poweoff operation. */ driver_write_callback = my_driver_write; - + /* Rename the directory "/D0/D4" to "/D0/D5". */ fx_directory_rename(&ram_disk, "/D0/D4", "/D0/D5"); } @@ -488,14 +488,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt = FX_TRUE; - + directory_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -507,10 +507,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -525,7 +525,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ return FX_SUCCESS; } -#ifndef FX_STANDALONE_ENABLE +#ifndef FX_STANDALONE_ENABLE /* Define the FAT12, 16 and 32 directory traversal routine for the local path test. */ static void traverse_directory(CHAR *directory_name) { @@ -574,7 +574,7 @@ UINT skip; status = fx_file_close(&file); if (status != FX_SUCCESS) error_counter++; - + /* Pickup the next directory entry. */ status = fx_directory_next_entry_find(&ram_disk, name); } @@ -588,17 +588,17 @@ UINT skip; { /* Recursive call to traverse directory. */ traverse_directory(name); - + /* Restore path. */ status = fx_directory_local_path_restore(&ram_disk, &local_path); } status = fx_directory_next_entry_find(&ram_disk, name); - } - } + } + } fx_directory_local_path_clear(&ram_disk); -} - +} + #else static void traverse_directory(CHAR *directory_name) @@ -630,14 +630,14 @@ CHAR name[300]; printf("ERROR!\n"); test_control_return(12); } - /* Okay, now postion to the deepest sub-directory and ensure that the directory first/next + /* Okay, now postion to the deepest sub-directory and ensure that the directory first/next operations work properly there as well. */ /* Set the current path */ status = fx_directory_default_set(&ram_disk, "/D0/D4"); /* Check the status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { /* Error setting the path. Return to caller. */ @@ -672,7 +672,7 @@ CHAR name[300]; } #endif -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -680,11 +680,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_directory_rename_directory_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Dir Rename DIR Interrupt Test...........N/A\n"); + printf("FileX Test: Fault Tolerant Dir Rename DIR Interrupt Test...........N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_directory_rename_redo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_directory_rename_redo_log_interrupt_test.c index 38a593f..7a08250 100644 --- a/test/regression_test/filex_fault_tolerant_directory_rename_redo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_directory_rename_redo_log_interrupt_test.c @@ -1,19 +1,19 @@ /* This FileX test concentrates on the Fault-Tolerant redo log write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check redo log interrupt for fx_directory_rename(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create directories and sub-directories; -Step4: Traverse the directory; + +Check redo log interrupt for fx_directory_rename(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create directories and sub-directories; +Step4: Traverse the directory; Step5: Create new thread to rename directory from "/D0/D4" to "/D0/D5"; -Step6: Terminate the new thread to simulate poweroff when update the redo log. -Step7: Open the media; -Step8: Enable fault tolerant feature to recover the data(undo operation); -Step9: Create directory "/D0/D4"; -Step10: Create directory "/D0/D5"; -*/ +Step6: Terminate the new thread to simulate poweroff when update the redo log. +Step7: Open the media; +Step8: Enable fault tolerant feature to recover the data(undo operation); +Step9: Create directory "/D0/D4"; +Step10: Create directory "/D0/D5"; +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -27,10 +27,10 @@ Step10: Create directory "/D0/D5"; #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_directory_rename_redo_log_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -43,18 +43,18 @@ void filex_fault_tolerant_directory_rename_redo_log_interrupt_test_applicatio /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; -static UCHAR *pointer; +static UCHAR *pointer; #define TEST_COUNT 3 /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -62,76 +62,76 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_counter = 0; -static UINT log_write_interrupt = FX_FALSE; +static UINT log_write_interrupt = FX_FALSE; static UINT expected_index = 0; static CHAR * expected_name[] = { - + "A0", ".", - "..", - "A1", + "..", + "A1", ".", - "..", - "A00", + "..", + "A00", ".", - "..", - "A2", + "..", + "A2", ".", - "..", - "A3", + "..", + "A3", ".", - "..", + "..", "B0", ".", - "..", - "B1", + "..", + "B1", ".", - "..", - "B2", + "..", + "B2", ".", - "..", - "B00", + "..", + "B00", ".", - "..", - "B3", + "..", + "B3", ".", - "..", + "..", "C0", ".", - "..", - "C1", + "..", + "C1", ".", - "..", - "C2", + "..", + "C2", ".", - "..", - "C3", + "..", + "C3", ".", - "..", - "C00", + "..", + "C00", ".", - "..", + "..", "D0", ".", - "..", - "D1", + "..", + "D1", ".", - "..", - "D2", + "..", + "D2", ".", - "..", - "D3", + "..", + "D3", ".", - "..", - "D4", + "..", + "D4", ".", - "..", - "D00", + "..", + "D00", ".", - "..", - "END"}; + "..", + "END"}; /* Define thread prototypes. */ @@ -140,13 +140,13 @@ static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); +static void * ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -static void traverse_directory(CHAR *directory_name); +extern void test_control_return(UINT status); +static void traverse_directory(CHAR *directory_name); extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -160,15 +160,15 @@ void filex_fault_tolerant_directory_rename_redo_log_interrupt_test_applicatio #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -177,7 +177,7 @@ void filex_fault_tolerant_directory_rename_redo_log_interrupt_test_applicatio cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -203,64 +203,64 @@ UINT i; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Dir Rename Redo LOG Interrupt Test......"); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -268,7 +268,7 @@ UINT i; printf("ERROR!\n"); test_control_return(1); - } + } /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -282,7 +282,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -323,7 +323,7 @@ UINT i; status += fx_directory_create(&ram_disk, "/D0/D1"); status += fx_directory_create(&ram_disk, "/D0/D2"); - status += fx_directory_create(&ram_disk, "/D0/D3"); + status += fx_directory_create(&ram_disk, "/D0/D3"); status += fx_directory_create(&ram_disk, "/D0/D4"); /* Check for errors... */ @@ -348,18 +348,18 @@ UINT i; /* Error creating sub-sub-directories. Return to caller. */ printf("ERROR!\n"); test_control_return(6); - } + } /* Set the index as zero before traverse. */ expected_index = 0; - + /* Traverse the directory structure recursively. */ traverse_directory(FX_NULL); - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -375,7 +375,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After interrupt, reread the files. */ + /* After interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -387,9 +387,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(7); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -410,7 +410,7 @@ UINT i; /* Error creating same directory twice. Return to caller. */ printf("ERROR!\n"); test_control_return(9); - } + } /* Attempt to create the "/D0/D5". */ status = fx_directory_create(&ram_disk, "/D0/D5"); @@ -422,7 +422,7 @@ UINT i; /* Error creating same directory twice. Return to caller. */ printf("ERROR!\n"); test_control_return(10); - } + } /* Close the media. */ status = fx_media_close(&ram_disk); @@ -433,7 +433,7 @@ UINT i; printf("ERROR!\n"); test_control_return(11); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -441,12 +441,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -459,7 +459,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -467,14 +467,14 @@ static void ftest_1_entry(ULONG thread_input) /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Rename the directory "/D0/D4" to "/D0/D5". */ fx_directory_create(&ram_disk, "/D0/D5"); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) -{ - +{ + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the redo log write operation. */ @@ -485,14 +485,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - log_write_interrupt = FX_TRUE; - + log_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -504,10 +504,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -521,8 +521,8 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } - -#ifndef FX_STANDALONE_ENABLE + +#ifndef FX_STANDALONE_ENABLE /* Define the FAT12, 16 and 32 directory traversal routine for the local path test. */ static void traverse_directory(CHAR *directory_name) { @@ -571,7 +571,7 @@ UINT skip; status = fx_file_close(&file); if (status != FX_SUCCESS) error_counter++; - + /* Pickup the next directory entry. */ status = fx_directory_next_entry_find(&ram_disk, name); } @@ -585,17 +585,17 @@ UINT skip; { /* Recursive call to traverse directory. */ traverse_directory(name); - + /* Restore path. */ status = fx_directory_local_path_restore(&ram_disk, &local_path); } status = fx_directory_next_entry_find(&ram_disk, name); - } - } + } + } fx_directory_local_path_clear(&ram_disk); -} - +} + #else static void traverse_directory(CHAR *directory_name) @@ -627,14 +627,14 @@ CHAR name[300]; printf("ERROR!\n"); test_control_return(12); } - /* Okay, now postion to the deepest sub-directory and ensure that the directory first/next + /* Okay, now postion to the deepest sub-directory and ensure that the directory first/next operations work properly there as well. */ /* Set the current path */ status = fx_directory_default_set(&ram_disk, "/D0/D4"); /* Check the status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { /* Error setting the path. Return to caller. */ @@ -670,7 +670,7 @@ CHAR name[300]; #endif -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -678,11 +678,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_directory_rename_redo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Dir Rename Redo LOG Interrupt Test......N/A\n"); + printf("FileX Test: Fault Tolerant Dir Rename Redo LOG Interrupt Test......N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_enable_1_test.c b/test/regression_test/filex_fault_tolerant_enable_1_test.c index 02948eb..ecebbe4 100644 --- a/test/regression_test/filex_fault_tolerant_enable_1_test.c +++ b/test/regression_test/filex_fault_tolerant_enable_1_test.c @@ -1,6 +1,6 @@ /* In this test point: */ /* Send null pointer to generate an error in fxe_fault_tolerant_enable */ -/* Register an invalid cluster number for fault_tolerant log file and enable the Fault-tolerant feature. */ +/* Register an invalid cluster number for fault_tolerant log file and enable the Fault-tolerant feature. */ /* Register an invalid cluster number for fault_tolerant log file and enable the Fault-tolerant feature, but 0xffffffff this time. */ /* Enable fault tolerant and make an IO ERROR while reading the FAT entry log file. */ /* Enable fault tolerant and make an IO ERROR while reading log file. */ @@ -18,15 +18,15 @@ #include "tx_thread.h" #include "tx_timer.h" #endif -#include "fx_api.h" +#include "fx_api.h" #include "fx_utility.h" #include "fx_fault_tolerant.h" #include #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_enable_1_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) #define DEMO_STACK_SIZE 4096 @@ -56,9 +56,9 @@ static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); +extern void test_control_return(UINT status); /* Define what the initial system looks like. */ @@ -71,20 +71,20 @@ void filex_fault_tolerant_enable_1_test_application_define(void *first_unused { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; - /* Setup memory for the RAM disk and the sector cache. */ + /* Setup memory for the RAM disk and the sector cache. */ cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; @@ -97,7 +97,7 @@ void filex_fault_tolerant_enable_1_test_application_define(void *first_unused ftest_0_entry(0); #endif } - + /* Define the test threads. */ @@ -105,7 +105,7 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -UCHAR buffer[2048]; +UCHAR buffer[2048]; ULONG clusters; ULONG bytes_per_cluster; FX_FILE my_file; @@ -115,22 +115,22 @@ FX_LOCAL_PATH local_path; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Enable 1 Test..........................."); - + /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -147,7 +147,7 @@ FX_LOCAL_PATH local_path; #endif /* FX_DISABLE_ERROR_CHECKING */ - /* Register an invalid cluster number for fault_tolerant log file and enable the Fault-tolerant feature. */ + /* Register an invalid cluster number for fault_tolerant log file and enable the Fault-tolerant feature. */ _fx_utility_32_unsigned_write((UCHAR *)ram_disk.fx_media_driver_info + FX_FAULT_TOLERANT_BOOT_INDEX, (ULONG)1); status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail( status == FX_SUCCESS); @@ -156,20 +156,20 @@ FX_LOCAL_PATH local_path; return_if_fail( status == FX_SUCCESS); /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -182,20 +182,20 @@ FX_LOCAL_PATH local_path; return_if_fail( status == FX_SUCCESS); /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 12, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -209,20 +209,20 @@ FX_LOCAL_PATH local_path; return_if_fail( status == FX_SUCCESS); /* Format the media with FAT16 and enable fault tolerant. */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open( &ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); status += fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); status += fx_media_close( &ram_disk); @@ -251,20 +251,20 @@ FX_LOCAL_PATH local_path; return_if_fail( status == FX_SUCCESS); /* Format the media with FAT16 and enable fault tolerant. */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open( &ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); status += fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); status += fx_media_close( &ram_disk); @@ -303,20 +303,20 @@ FX_LOCAL_PATH local_path; return_if_fail( status == FX_SUCCESS); /* Format the media with FAT16 and enable fault tolerant. */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open( &ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -346,20 +346,20 @@ FX_LOCAL_PATH local_path; return_if_fail( status == FX_SUCCESS); /* Format the media with FAT16 and enable fault tolerant. */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open( &ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -397,20 +397,20 @@ FX_LOCAL_PATH local_path; return_if_fail( status == FX_SUCCESS); /* Format the media with FAT16 and enable fault tolerant. */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open( &ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -440,20 +440,20 @@ FX_LOCAL_PATH local_path; return_if_fail( status == FX_SUCCESS); /* Enable fault tolerant with buffer size larger than required. */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 4, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Create files in a subdir to fill user data area. */ status += fx_media_open( &ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -467,12 +467,12 @@ FX_LOCAL_PATH local_path; status = fx_media_close( &ram_disk); return_if_fail( status == FX_SUCCESS); - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -480,11 +480,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_enable_1_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Enable 1 Test...........................N/A\n"); + printf("FileX Test: Fault Tolerant Enable 1 Test...........................N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_enable_2_test.c b/test/regression_test/filex_fault_tolerant_enable_2_test.c index 5e0edf7..0d74959 100644 --- a/test/regression_test/filex_fault_tolerant_enable_2_test.c +++ b/test/regression_test/filex_fault_tolerant_enable_2_test.c @@ -3,16 +3,16 @@ #include "tx_thread.h" #include "tx_timer.h" #endif -#include "fx_api.h" +#include "fx_api.h" #include "fx_unicode.h" #include "fx_utility.h" #include "fx_fault_tolerant.h" #include #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_enable_2_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) #define DEMO_STACK_SIZE 4096 @@ -23,7 +23,7 @@ void filex_fault_tolerant_enable_2_test_application_define(void *first_unused /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; #endif static FX_MEDIA ram_disk; static UCHAR *pointer; @@ -37,15 +37,15 @@ static UCHAR *fault_tolerant_buffer; static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; #endif -static CHAR read_buffer[10240]; +static CHAR read_buffer[10240]; #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); +extern void test_control_return(UINT status); /* Define what the initial system looks like. */ @@ -57,20 +57,20 @@ void filex_fault_tolerant_enable_2_test_application_define(void *first_unused #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; - /* Setup memory for the RAM disk and the sector cache. */ + /* Setup memory for the RAM disk and the sector cache. */ cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; @@ -83,7 +83,7 @@ void filex_fault_tolerant_enable_2_test_application_define(void *first_unused ftest_0_entry(0); #endif } - + /* Define the test threads. */ @@ -95,7 +95,7 @@ ULONG uentry; ULONG unicode_size; UINT status, length; ULONG actual; -UCHAR buffer[2048]; +UCHAR buffer[2048]; CHAR destination_name[100]; UCHAR unicode_name_A[] = { 'A', 0, 0, 0}; UCHAR unicode_name_1[] = { 1, 0, 0, 0}; @@ -114,22 +114,22 @@ FX_FAULT_TOLERANT_FAT_CHAIN *FAT_chain; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Enable 2 Test..........................."); - + /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -164,20 +164,20 @@ FX_FAULT_TOLERANT_FAT_CHAIN *FAT_chain; return_if_fail( status == FX_SUCCESS); /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -382,7 +382,7 @@ FX_FAULT_TOLERANT_FAT_CHAIN *FAT_chain; status = _fx_unicode_directory_entry_read( &ram_disk, &dir_entry1, &uentry, &dir_entry2, unicode_name_A1, &unicode_size); return_if_fail( status == FX_FILE_CORRUPT); - + /* Modify fault tolerant FAT chain in buffer. */ FAT_chain = (FX_FAULT_TOLERANT_FAT_CHAIN *)(ram_disk.fx_media_fault_tolerant_memory_buffer + FX_FAULT_TOLERANT_FAT_CHAIN_OFFSET); _fx_utility_32_unsigned_write((UCHAR *)&FAT_chain -> fx_fault_tolerant_FAT_chain_head_new, 3); @@ -391,7 +391,7 @@ FX_FAULT_TOLERANT_FAT_CHAIN *FAT_chain; /* Get fx_fault_tolerant_FAT_chain_next_deletion while looping to cleanup FAT entries. */ status = _fx_fault_tolerant_cleanup_FAT_chain( &ram_disk, FX_FAULT_TOLERANT_FAT_CHAIN_RECOVER); return_if_fail( status == FX_SUCCESS); - + /* Modify fault tolerant FAT chain in buffer. */ FAT_chain = (FX_FAULT_TOLERANT_FAT_CHAIN *)(ram_disk.fx_media_fault_tolerant_memory_buffer + FX_FAULT_TOLERANT_FAT_CHAIN_OFFSET); _fx_utility_32_unsigned_write((UCHAR *)&FAT_chain -> fx_fault_tolerant_FAT_chain_head_new, 3); @@ -401,12 +401,12 @@ FX_FAULT_TOLERANT_FAT_CHAIN *FAT_chain; status = _fx_fault_tolerant_cleanup_FAT_chain( &ram_disk, FX_FAULT_TOLERANT_FAT_CHAIN_RECOVER); return_if_fail( status == FX_SUCCESS); - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -414,11 +414,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_enable_2_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Enable 2 Test...........................N/A\n"); + printf("FileX Test: Fault Tolerant Enable 2 Test...........................N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_enable_3_test.c b/test/regression_test/filex_fault_tolerant_enable_3_test.c index d53e5ad..790e596 100644 --- a/test/regression_test/filex_fault_tolerant_enable_3_test.c +++ b/test/regression_test/filex_fault_tolerant_enable_3_test.c @@ -3,16 +3,16 @@ #include "tx_thread.h" #include "tx_timer.h" #endif -#include "fx_api.h" -#include "fx_directory.h" +#include "fx_api.h" +#include "fx_directory.h" #include "fx_utility.h" #include "fx_fault_tolerant.h" #include #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_enable_3_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) #define DEMO_STACK_SIZE 4096 @@ -23,7 +23,7 @@ void filex_fault_tolerant_enable_3_test_application_define(void *first_unused /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; #endif static FX_MEDIA ram_disk; static UCHAR *pointer; @@ -44,9 +44,9 @@ static CHAR read_buffer[10240]; /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); +extern void test_control_return(UINT status); /* Define what the initial system looks like. */ @@ -59,20 +59,20 @@ void filex_fault_tolerant_enable_3_test_application_define(void *first_unused { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; - /* Setup memory for the RAM disk and the sector cache. */ + /* Setup memory for the RAM disk and the sector cache. */ cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; @@ -87,7 +87,7 @@ void filex_fault_tolerant_enable_3_test_application_define(void *first_unused ftest_0_entry(0); #endif } - + /* Define the test threads. */ @@ -98,7 +98,7 @@ ULONG64 actual_64; UINT status, length, new_length, old_length; ULONG actual; ULONG temp; -UCHAR buffer[2048]; +UCHAR buffer[2048]; CHAR destination_name[100]; UCHAR unicode_name_A[] = { 'A', 0, 0, 0}; UCHAR unicode_name_1[] = { 1, 0, 0, 0}; @@ -116,22 +116,22 @@ FX_DIR_ENTRY dir_entry; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Enable 3 Test..........................."); - + /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -167,20 +167,20 @@ FX_DIR_ENTRY dir_entry; return_if_fail( status == FX_SUCCESS); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70000, // Total sectors - FAT32 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); /* Open the ram_disk. */ @@ -189,10 +189,10 @@ FX_DIR_ENTRY dir_entry; /* Now create a series to sub-directories to expand the root directory FAT chain. */ status = fx_file_create(&ram_disk, "FILE1"); - + /* Open the file. */ - status += fx_file_open(&ram_disk, &my_file, "FILE1", FX_OPEN_FOR_WRITE); - + status += fx_file_open(&ram_disk, &my_file, "FILE1", FX_OPEN_FOR_WRITE); + /* Write to the file. */ status += fx_file_write(&my_file, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 26); status += fx_file_write(&my_file, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 26); @@ -208,22 +208,22 @@ FX_DIR_ENTRY dir_entry; status = fx_file_close( &my_file); status += fx_media_close( &ram_disk); return_if_fail( status == FX_SUCCESS); - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 4200 * 8, // Total sectors - FAT32 - 256, // Sector size + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -329,20 +329,20 @@ FX_DIR_ENTRY dir_entry; status += fx_media_close( &ram_disk); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 4200 * 8, // Total sectors - FAT32 - 256, // Sector size + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -363,20 +363,20 @@ FX_DIR_ENTRY dir_entry; return_if_fail( status == FX_SUCCESS); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 4200 * 8, // Total sectors - FAT32 - 256, // Sector size + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -501,20 +501,20 @@ FX_DIR_ENTRY dir_entry; return_if_fail( status == FX_SUCCESS); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 4200 * 8, // Total sectors - FAT32 - 256, // Sector size + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -533,7 +533,7 @@ FX_DIR_ENTRY dir_entry; _fx_utility_logical_sector_read_error_request = 14; status = fx_unicode_file_rename( &ram_disk, unicode_name_1, old_length, unicode_name_2, new_length, destination_name); return_if_fail( status == FX_IO_ERROR); - + length = fx_unicode_length_get( unicode_name_A); status = fx_unicode_directory_create( &ram_disk, unicode_name_A, length, destination_name); return_if_fail( status == FX_SUCCESS); @@ -550,20 +550,20 @@ FX_DIR_ENTRY dir_entry; return_if_fail( status == FX_SUCCESS); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 4200 * 8, // Total sectors - FAT32 - 256, // Sector size + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -732,20 +732,20 @@ FX_DIR_ENTRY dir_entry; return_if_fail( status == FX_SUCCESS); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 4200 * 8, // Total sectors - FAT32 - 256, // Sector size + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -782,27 +782,27 @@ FX_DIR_ENTRY dir_entry; return_if_fail( status == FX_SUCCESS); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 4200 * 8, // Total sectors - FAT32 - 256, // Sector size + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); /* Enable fault tolerant. */ status = fx_fault_tolerant_enable( &ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail( status == FX_SUCCESS); - + status = fx_file_create( &ram_disk, "src"); status += fx_file_open( &ram_disk, &my_file, "src", FX_OPEN_FOR_WRITE); status += fx_file_allocate( &my_file, 2048 * 2); @@ -838,27 +838,27 @@ FX_DIR_ENTRY dir_entry; return_if_fail( status == FX_SUCCESS); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 4200 * 8, // Total sectors - FAT32 - 256, // Sector size + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); /* Enable fault tolerant. */ status = fx_fault_tolerant_enable( &ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail( status == FX_SUCCESS); - + status = fx_file_create( &ram_disk, "test.txt"); status += fx_file_open( &ram_disk, &my_file, "test.txt", FX_OPEN_FOR_WRITE); status += fx_file_extended_best_effort_allocate( &my_file, 2048 * 4, &actual_64); @@ -871,7 +871,7 @@ FX_DIR_ENTRY dir_entry; status = fx_file_close( &my_file); return_if_fail( status == FX_SUCCESS); - + status = fx_file_create( &ram_disk, "test2.txt"); status += fx_file_open( &ram_disk, &my_file, "test2.txt", FX_OPEN_FOR_WRITE); status += fx_file_extended_best_effort_allocate( &my_file, 2048 * 4, &actual_64); @@ -892,25 +892,25 @@ FX_DIR_ENTRY dir_entry; dir_entry.fx_dir_entry_log_sector = ram_disk.fx_media_data_sector_start + 1; dir_entry.fx_dir_entry_long_name_shorted = 1; _fx_directory_entry_write( &ram_disk, &dir_entry); - + status += fx_media_close( &ram_disk); return_if_fail( status == FX_SUCCESS); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70000, // Total sectors - FAT32 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -928,22 +928,22 @@ FX_DIR_ENTRY dir_entry; status = fx_media_close( &ram_disk); status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_FAT_READ_ERROR); - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 4200 * 8, // Total sectors - 256, // Sector size + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -965,20 +965,20 @@ FX_DIR_ENTRY dir_entry; return_if_fail( status == FX_SUCCESS); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 4200 * 8, // Total sectors - 256, // Sector size + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -1006,20 +1006,20 @@ FX_DIR_ENTRY dir_entry; return_if_fail( status == FX_SUCCESS); /* Format a FAT32 disk with 512 bytes sector. */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70000 * 8, // Total sectors - 512, // Sector size + 512, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -1033,20 +1033,20 @@ FX_DIR_ENTRY dir_entry; return_if_fail( status == FX_SUCCESS); /* Format a FAT16 disk with 512 bytes sector. */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70000 * 8, // Total sectors - 512, // Sector size + 512, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -1061,9 +1061,9 @@ FX_DIR_ENTRY dir_entry; /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -1071,11 +1071,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_enable_3_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Enable 3 Test...........................N/A\n"); + printf("FileX Test: Fault Tolerant Enable 3 Test...........................N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_enable_4_test.c b/test/regression_test/filex_fault_tolerant_enable_4_test.c index 4ba3a5a..c1dc92f 100644 --- a/test/regression_test/filex_fault_tolerant_enable_4_test.c +++ b/test/regression_test/filex_fault_tolerant_enable_4_test.c @@ -11,10 +11,10 @@ #include "fx_utility.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_enable_4_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -25,17 +25,17 @@ void filex_fault_tolerant_enable_4_test_application_define(void *first_unused /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -43,24 +43,24 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif -static UINT directory_write_interrupt = FX_FALSE; -static CHAR write_buffer[2048]; -static UCHAR read_buffer[4096]; +#endif +static UINT directory_write_interrupt = FX_FALSE; +static CHAR write_buffer[2048]; +static UCHAR read_buffer[4096]; /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); -#endif - +static void *ftest_1_entry(void * thread_input); +#endif + extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -79,8 +79,8 @@ void filex_fault_tolerant_enable_4_test_application_define(void *first_unused /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -89,7 +89,7 @@ void filex_fault_tolerant_enable_4_test_application_define(void *first_unused cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -114,26 +114,26 @@ UINT status; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Enable 4 Test..........................."); - + /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail(status == FX_SUCCESS); - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail(status == FX_SUCCESS); @@ -142,11 +142,11 @@ UINT status; return_if_fail(status == FX_SUCCESS); #ifndef FX_STANDALONE_ENABLE /* Create the main thread. */ - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif - + /* directory_write_interrupt */ directory_write_interrupt = FX_FALSE; @@ -159,7 +159,7 @@ UINT status; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -170,7 +170,7 @@ UINT status; read_buffer[FX_FAULT_TOLERANT_LOG_CONTENT_OFFSET]++; _fx_utility_logical_sector_write( &ram_disk, 1 + ram_disk.fx_media_sectors_per_FAT + ram_disk.fx_media_root_sectors, read_buffer, 8, FX_DATA_SECTOR); - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail(status == FX_SUCCESS); @@ -180,10 +180,10 @@ UINT status; #else pthread_cancel(ptid1); #endif - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -196,7 +196,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -226,14 +226,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt = FX_TRUE; - + directory_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -245,10 +245,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -262,7 +262,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -270,11 +270,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_enable_4_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Enable 4................................N/A\n"); + printf("FileX Test: Fault Tolerant Enable 4................................N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_enable_test.c b/test/regression_test/filex_fault_tolerant_enable_test.c index ee383ad..f835e73 100644 --- a/test/regression_test/filex_fault_tolerant_enable_test.c +++ b/test/regression_test/filex_fault_tolerant_enable_test.c @@ -1,11 +1,11 @@ /* This FileX test concentrates on the Fault-Tolerant enable feature. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; -Check Fault tolerrant Log file: -Step1: Format and open the media; -Step2: Check the fault tolerant enable flag and boot index value; -Step3: Enable fault tolerant feature; -Step4: Check the fault tolerant enable flag, boot index value and fault tolerant header value; +Check Fault tolerrant Log file: +Step1: Format and open the media; +Step2: Check the fault tolerant enable flag and boot index value; +Step3: Enable fault tolerant feature; +Step4: Check the fault tolerant enable flag, boot index value and fault tolerant header value; */ #ifndef FX_STANDALONE_ENABLE @@ -13,14 +13,14 @@ Step4: Check the fault tolerant enable flag, boot index value and fault tolerant #include "tx_thread.h" #include "tx_timer.h" #endif -#include "fx_api.h" +#include "fx_api.h" #include "fx_utility.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_enable_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) #define DEMO_STACK_SIZE 4096 @@ -50,9 +50,9 @@ static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); +extern void test_control_return(UINT status); /* Define what the initial system looks like. */ @@ -64,20 +64,20 @@ void filex_fault_tolerant_enable_test_application_define(void *first_unused_m #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; - /* Setup memory for the RAM disk and the sector cache. */ + /* Setup memory for the RAM disk and the sector cache. */ cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; @@ -90,7 +90,7 @@ void filex_fault_tolerant_enable_test_application_define(void *first_unused_m ftest_0_entry(0); #endif } - + /* Define the test threads. */ @@ -98,13 +98,13 @@ static void ftest_0_entry(ULONG thread_input) { UINT status, temp1; -UINT i = 0, j; -ULONG start_cluster; +UINT i = 0, j; +ULONG start_cluster; ULONG clusters; ULONG bytes_per_cluster; ULONG value; ULONG start_sector, temp; -UCHAR buffer[2048]; +UCHAR buffer[2048]; UCHAR *source_buffer; ULONG checksum; UCHAR flag; @@ -114,64 +114,64 @@ UINT size; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Enable Test............................."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } return_if_fail( status == FX_SUCCESS); /* Open the ram_disk. */ @@ -183,19 +183,19 @@ UINT size; source_buffer = ((UCHAR *) ram_disk.fx_media_driver_info); /* Copy the RAM sector into the destination. */ - _fx_utility_memory_copy(source_buffer, buffer, ram_disk.fx_media_bytes_per_sector); + _fx_utility_memory_copy(source_buffer, buffer, ram_disk.fx_media_bytes_per_sector); /* Check whether the boot index is used. */ - start_cluster = _fx_utility_32_unsigned_read(buffer + FX_FAULT_TOLERANT_BOOT_INDEX); + start_cluster = _fx_utility_32_unsigned_read(buffer + FX_FAULT_TOLERANT_BOOT_INDEX); return_if_fail( start_cluster == 0); - + /* Atempt to call fx_fault_tolerant_enable with invalid parameters. */ temp = ram_disk.fx_media_sectors_per_cluster; ram_disk.fx_media_sectors_per_cluster = 0; status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); ram_disk.fx_media_sectors_per_cluster = temp; return_if_fail( status == FX_MEDIA_INVALID); - + status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, 0); return_if_fail( status == FX_NOT_ENOUGH_MEMORY); @@ -203,7 +203,7 @@ UINT size; _fx_ram_driver_io_error_request = 1; status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail( status == FX_BOOT_ERROR); - + /* What will happen if there is no space? */ temp = ram_disk.fx_media_available_clusters; ram_disk.fx_media_available_clusters = 0; @@ -224,8 +224,8 @@ UINT size; status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail( status == FX_IO_ERROR); } - - /* Enable the Fault-tolerant feature. */ + + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail( status == FX_SUCCESS); @@ -233,13 +233,13 @@ UINT size; return_if_fail( ram_disk.fx_media_fault_tolerant_enabled == FX_TRUE); /* Atempt to exceed the space limitation in _fx_fault_tolerant_add_FAT_log. */ - temp = ram_disk.fx_media_fault_tolerant_file_size; + temp = ram_disk.fx_media_fault_tolerant_file_size; temp1 = ram_disk.fx_media_fault_tolerant_state; ram_disk.fx_media_fault_tolerant_state |= FX_FAULT_TOLERANT_STATE_STARTED; ram_disk.fx_media_fault_tolerant_state &= (UCHAR)~FX_FAULT_TOLERANT_STATE_SET_FAT_CHAIN; ram_disk.fx_media_fault_tolerant_file_size = 0xffff0000; status = _fx_utility_FAT_entry_write( &ram_disk, 1, 2); - ram_disk.fx_media_fault_tolerant_file_size = temp; + ram_disk.fx_media_fault_tolerant_file_size = temp; ram_disk.fx_media_fault_tolerant_state = (UCHAR)temp1; return_if_fail( status == FX_NO_MORE_SPACE); @@ -247,10 +247,10 @@ UINT size; source_buffer = ((UCHAR *) ram_disk.fx_media_driver_info); /* Copy the RAM sector into the destination. */ - _fx_utility_memory_copy(source_buffer, buffer, ram_disk.fx_media_bytes_per_sector); + _fx_utility_memory_copy(source_buffer, buffer, ram_disk.fx_media_bytes_per_sector); /* Check whether the boot index is used. */ - start_cluster = _fx_utility_32_unsigned_read(buffer + FX_FAULT_TOLERANT_BOOT_INDEX); + start_cluster = _fx_utility_32_unsigned_read(buffer + FX_FAULT_TOLERANT_BOOT_INDEX); return_if_fail( start_cluster != 0); /* Get the FAT table address. */ @@ -258,7 +258,7 @@ UINT size; bytes_per_cluster = ram_disk.fx_media_bytes_per_sector * ram_disk.fx_media_sectors_per_cluster; clusters = (FX_FAULT_TOLERANT_MINIMAL_BUFFER_SIZE + bytes_per_cluster - 1) / bytes_per_cluster; - + for (j = 0; j < clusters; j++) { status = _fx_utility_FAT_entry_read(&ram_disk, start_cluster + j, &value); @@ -281,13 +281,13 @@ UINT size; source_buffer = ((UCHAR *) ram_disk.fx_media_driver_info) + ((start_sector + ram_disk.fx_media_hidden_sectors) * ram_disk.fx_media_bytes_per_sector); /* Copy the one cluster into the destination. */ - _fx_utility_memory_copy(source_buffer, buffer, 1 * ram_disk.fx_media_sectors_per_cluster * ram_disk.fx_media_bytes_per_sector); + _fx_utility_memory_copy(source_buffer, buffer, 1 * ram_disk.fx_media_sectors_per_cluster * ram_disk.fx_media_bytes_per_sector); /* Verify ID field. */ return_if_fail(_fx_utility_32_unsigned_read(buffer) == FX_FAULT_TOLERANT_ID); /* Get the header size. */ - size = _fx_utility_16_unsigned_read(buffer + 4); + size = _fx_utility_16_unsigned_read(buffer + 4); /* Verify Size field. */ return_if_fail( size == FX_FAULT_TOLERANT_LOG_HEADER_SIZE + FX_FAULT_TOLERANT_FAT_CHAIN_SIZE); @@ -299,9 +299,9 @@ UINT size; /* Verify checksum of undo logs. */ checksum = _fx_fault_tolerant_calculate_checksum(buffer + FX_FAULT_TOLERANT_FAT_CHAIN_OFFSET, FX_FAULT_TOLERANT_FAT_CHAIN_SIZE); return_if_fail( checksum == 0); - + /* Check undo log. */ - flag = *(buffer + FX_FAULT_TOLERANT_FAT_CHAIN_OFFSET + 2); + flag = *(buffer + FX_FAULT_TOLERANT_FAT_CHAIN_OFFSET + 2); return_if_fail( flag == 0); /* Close the media. */ @@ -309,12 +309,12 @@ UINT size; return_if_fail( status == FX_SUCCESS); } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -322,11 +322,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_enable_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Enable Test.............................N/A\n"); + printf("FileX Test: Fault Tolerant Enable Test.............................N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_allocate_directory_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_allocate_directory_interrupt_test.c index fae2aa2..f0747b7 100644 --- a/test/regression_test/filex_fault_tolerant_file_allocate_directory_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_allocate_directory_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant direcotry write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check directory interrupt for fx_file_allocate(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check directory interrupt for fx_file_allocate(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 24 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to allocate 1500 bytes for TEST1.TXT; -Step7: Terminate the new thread to simulate poweroff when update the directory after redo log generated. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(redo operation); +Step7: Terminate the new thread to simulate poweroff when update the directory after redo log generated. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(redo operation); Step10: Check the test files. */ @@ -27,10 +27,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_allocate_directory_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) && defined (FX_UPDATE_FILE_SIZE_ON_ALLOCATE) #define DEMO_STACK_SIZE 4096 @@ -43,17 +43,17 @@ void filex_fault_tolerant_file_allocate_directory_interrupt_test_application_ /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -61,27 +61,27 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT directory_write_interrupt = FX_FALSE; -static CHAR read_buffer[2048]; -static UINT read_buffer_size = 2048; +static UINT directory_write_interrupt = FX_FALSE; +static CHAR read_buffer[2048]; +static UINT read_buffer_size = 2048; #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); +static void *ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -95,15 +95,15 @@ void filex_fault_tolerant_file_allocate_directory_interrupt_test_application_ #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -112,7 +112,7 @@ void filex_fault_tolerant_file_allocate_directory_interrupt_test_application_ cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -132,71 +132,71 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Allocate DIR Interrupt Test........"); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -218,7 +218,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -238,13 +238,13 @@ UINT i; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -255,7 +255,7 @@ UINT i; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -266,7 +266,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -277,7 +277,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -288,7 +288,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -304,13 +304,13 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -321,7 +321,7 @@ UINT i; status = fx_file_write(&my_file, " 0123456789012345678901\n", 24); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -332,7 +332,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -343,7 +343,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 24)) + if ((status != FX_SUCCESS) || (actual != 24)) { printf("ERROR!\n"); @@ -354,7 +354,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -370,13 +370,13 @@ UINT i; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -387,7 +387,7 @@ UINT i; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -398,7 +398,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -409,7 +409,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -420,17 +420,17 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -446,7 +446,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -458,9 +458,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(22); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -475,40 +475,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -519,23 +519,23 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); @@ -546,13 +546,13 @@ UINT i; printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -563,40 +563,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -612,7 +612,7 @@ UINT i; printf("ERROR!\n"); test_control_return(36); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -620,12 +620,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -638,16 +638,16 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif -UINT status; +UINT status; FX_PARAMETER_NOT_USED(thread_input); /* Set the callback function to simulate poweoff operation when write FAT entry. */ - driver_write_callback = my_driver_write; + driver_write_callback = my_driver_write; /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); @@ -655,7 +655,7 @@ UINT status; /* Check the file open status. */ if (status != FX_SUCCESS) { - + error_couter ++; #ifndef FX_STANDALONE_ENABLE return; @@ -665,7 +665,7 @@ UINT status; } /* Allocate 1500 size... */ - fx_file_allocate(&my_file, 1500); + fx_file_allocate(&my_file, 1500); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) @@ -681,14 +681,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt = FX_TRUE; - + directory_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -700,10 +700,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -717,7 +717,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -725,11 +725,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_allocate_directory_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Allocate DIR Interrupt Test........N/A\n"); + printf("FileX Test: Fault Tolerant File Allocate DIR Interrupt Test........N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_allocate_fat_crossover_test.c b/test/regression_test/filex_fault_tolerant_file_allocate_fat_crossover_test.c index 6e812f5..f8ffb9d 100644 --- a/test/regression_test/filex_fault_tolerant_file_allocate_fat_crossover_test.c +++ b/test/regression_test/filex_fault_tolerant_file_allocate_fat_crossover_test.c @@ -4,12 +4,12 @@ * before it is flushed into media system. The design requires the FAT entries updated in reverse * order in FAT chain. Due to the FAT cache, the FAT entries may be updated in any order. * That will break the fault tolerant design. The expected issue is, the FAT chain could - * not be released completely.*/ + * not be released completely.*/ /* For FAT 32 one cluster size is 512 bytes and one sector per cluster; - -Step1: Format and open the media; -Step2: Enable fault tolerant feature; + +Step1: Format and open the media; +Step2: Enable fault tolerant feature; Step3: Create and allocate 118 clusters for A.TXT. Step6: Create a new thread and allocate cluster 127 and 128 for A.TXT. Step7: Terminate the new thread to simulate poweroff while writing the fat entry of cluster 127 @@ -17,7 +17,7 @@ Step7: Terminate the new thread to simulate poweroff while writing the fat entry Step8: Open the media. Step9: Enable fault tolerant feature to revert the FAT chain(revert operation). Step10: Perform media check. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -32,10 +32,10 @@ Step10: Perform media check. #include "fx_fault_tolerant.h" #include "fx_utility.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_allocate_fat_crossover_test_application_define(void *first_unused_memory); - + #ifdef FX_ENABLE_FAULT_TOLERANT #define DEMO_STACK_SIZE 4096 @@ -46,17 +46,17 @@ void filex_fault_tolerant_file_allocate_fat_crossover_test_application_define /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -64,7 +64,7 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT fat_write_interrupt = FX_FALSE; static UCHAR scratch_memory[16 * 1024]; static UINT interrupt_count_down; @@ -72,17 +72,17 @@ static UINT interrupt_count_down; /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); -#endif +static void * ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -94,15 +94,15 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_allocate_fat_crossover_test_application_define(void *first_unused_memory) #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -111,7 +111,7 @@ void filex_fault_tolerant_file_allocate_fat_crossover_test_application_define cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -139,20 +139,20 @@ ULONG errors_detected; printf("FileX Test: Fault Tolerant File Allocate Fat Crossover Test........"); /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 512, // Sector size + 70000, // Total sectors + 512, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); status += fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail(FX_SUCCESS == status); @@ -160,7 +160,7 @@ ULONG errors_detected; /* One cluster for A.TXT. */ status = fx_file_create(&ram_disk, "A.TXT"); status += fx_file_open(&ram_disk, &my_file, "A.TXT", FX_OPEN_FOR_WRITE); - status += fx_file_allocate(&my_file, 512 * 118); + status += fx_file_allocate(&my_file, 512 * 118); status += fx_file_close(&my_file); return_if_fail(FX_SUCCESS == status); @@ -170,8 +170,8 @@ ULONG errors_detected; /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -180,14 +180,14 @@ ULONG errors_detected; /* Let the other thread run. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_relinquish(); + tx_thread_relinquish(); #else pthread_create(&ptid1, NULL, &ftest_1_entry, NULL); usleep(10); pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ return_if_fail(FX_TRUE == fat_write_interrupt); status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -207,10 +207,10 @@ ULONG errors_detected; pthread_cancel(ptid1); #endif - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -223,7 +223,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -231,9 +231,9 @@ static void ftest_1_entry(ULONG thread_input) FX_PARAMETER_NOT_USED(thread_input); - /* Set the callback function to simulate poweoff operation when write FAT entry. */ + /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "A.TXT", FX_OPEN_FOR_WRITE); return_if_fail(FX_SUCCESS == status); @@ -264,14 +264,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - fat_write_interrupt = FX_TRUE; + fat_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -283,10 +283,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -301,7 +301,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -309,7 +309,7 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_allocate_fat_crossover_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ diff --git a/test/regression_test/filex_fault_tolerant_file_allocate_fat_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_allocate_fat_interrupt_test.c index 7a1d051..0c37ad4 100644 --- a/test/regression_test/filex_fault_tolerant_file_allocate_fat_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_allocate_fat_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant FAT write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check fat interrupt for fx_file_allocate(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check fat interrupt for fx_file_allocate(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 24 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to allocate 1500 bytes for TEST1.TXT; -Step7: Terminate the new thread to simulate poweroff when update the fat between undo log generated and redo log not generated. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(undo operation); +Step7: Terminate the new thread to simulate poweroff when update the fat between undo log generated and redo log not generated. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Check the test files. */ #ifndef FX_STANDALONE_ENABLE @@ -26,10 +26,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_allocate_fat_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) && defined (FX_UPDATE_FILE_SIZE_ON_ALLOCATE) #define DEMO_STACK_SIZE 4096 @@ -42,16 +42,16 @@ void filex_fault_tolerant_file_allocate_fat_interrupt_test_application_define /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *pointer; static UCHAR *cache_buffer; @@ -60,27 +60,27 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; static UINT exit_flag =0; static UINT fat_write_interrupt = FX_FALSE; -static CHAR read_buffer[2048]; -static UINT read_buffer_size = 2048; - +static CHAR read_buffer[2048]; +static UINT read_buffer_size = 2048; + #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); -#ifndef FX_STANDALONE_ENABLE +static void ftest_0_entry(ULONG thread_input); +#ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); -#else -static void * ftest_1_entry(void * thread_input); +#else +static void * ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -94,15 +94,15 @@ void filex_fault_tolerant_file_allocate_fat_interrupt_test_application_define #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -111,7 +111,7 @@ void filex_fault_tolerant_file_allocate_fat_interrupt_test_application_define cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -132,14 +132,14 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Allocate FAT Interrupt Test........"); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { @@ -147,57 +147,57 @@ UINT i; if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -219,7 +219,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -239,13 +239,13 @@ UINT i; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -256,7 +256,7 @@ UINT i; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -267,7 +267,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -278,7 +278,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -289,7 +289,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -305,13 +305,13 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -322,7 +322,7 @@ UINT i; status = fx_file_write(&my_file, " 0123456789012345678901\n", 24); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -333,7 +333,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -344,7 +344,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 24)) + if ((status != FX_SUCCESS) || (actual != 24)) { printf("ERROR!\n"); @@ -355,7 +355,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -371,13 +371,13 @@ UINT i; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -388,7 +388,7 @@ UINT i; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -399,7 +399,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -410,7 +410,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -421,17 +421,17 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); - } - + } + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -446,7 +446,7 @@ UINT i; usleep(10); pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -460,7 +460,7 @@ UINT i; test_control_return(22); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -475,40 +475,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -519,40 +519,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); - /* Check the file read status. */ + /* Check the file read status. */ if ((status != FX_SUCCESS) || (actual != 24)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -563,40 +563,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -612,7 +612,7 @@ UINT i; printf("ERROR!\n"); test_control_return(36); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -621,12 +621,12 @@ UINT i; exit_flag =1; pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -635,17 +635,17 @@ static void ftest_1_entry(ULONG thread_input) #else void * ftest_1_entry(void * thread_input) #endif -{ +{ UINT status; #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif FX_PARAMETER_NOT_USED(thread_input); /* Set the callback function to simulate poweoff operation when write FAT entry. */ - driver_write_callback = my_driver_write; + driver_write_callback = my_driver_write; /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); @@ -653,7 +653,7 @@ static void ftest_1_entry(ULONG thread_input) /* Check the file open status. */ if (status != FX_SUCCESS) { - + error_couter ++; #ifndef FX_STANDALONE_ENABLE return; @@ -663,13 +663,13 @@ static void ftest_1_entry(ULONG thread_input) } /* Allocate 1500 size... */ - status = fx_file_allocate(&my_file, 1500); + status = fx_file_allocate(&my_file, 1500); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) { - FX_PARAMETER_NOT_USED(block_ptr); + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the FAT write operation after record the undo log. */ if ((sector_type == FX_FAT_SECTOR) && (_filex_fault_tolerant_log_check(media_ptr) & FX_FAULT_TOLERANT_LOG_UNDO_DONE)) @@ -679,14 +679,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - fat_write_interrupt = FX_TRUE; + fat_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -698,10 +698,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -721,7 +721,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -729,11 +729,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_allocate_fat_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Allocate FAT Interrupt Test........N/A\n"); + printf("FileX Test: Fault Tolerant File Allocate FAT Interrupt Test........N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_allocate_redo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_allocate_redo_log_interrupt_test.c index cf0eefc..5320edc 100644 --- a/test/regression_test/filex_fault_tolerant_file_allocate_redo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_allocate_redo_log_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant redo LOG write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check redo log interrupt for fx_file_allocate(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check redo log interrupt for fx_file_allocate(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 24 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to allocate 1500 bytes for TEST1.TXT; -Step7: Terminate the new thread to simulate poweroff when update the redo log. -Step8: Open the media; -Step9: Enable fault tolerant feature to do undo operation; +Step7: Terminate the new thread to simulate poweroff when update the redo log. +Step8: Open the media; +Step9: Enable fault tolerant feature to do undo operation; Step10: Check the test files. */ @@ -27,7 +27,7 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_allocate_redo_log_interrupt_test_application_define(void *first_unused_memory); @@ -43,17 +43,17 @@ void filex_fault_tolerant_file_allocate_redo_log_interrupt_test_application_d /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -61,28 +61,28 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; static UINT log_write_interrupt = FX_FALSE; -static CHAR read_buffer[2048]; -static UINT read_buffer_size = 2048; +static CHAR read_buffer[2048]; +static UINT read_buffer_size = 2048; #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); +static void *ftest_1_entry(void * thread_input); #endif - + extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); +extern void test_control_return(UINT status); extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -96,15 +96,15 @@ void filex_fault_tolerant_file_allocate_redo_log_interrupt_test_application_d #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -113,7 +113,7 @@ void filex_fault_tolerant_file_allocate_redo_log_interrupt_test_application_d cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -133,71 +133,71 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Allocate Redo LOG Interrupt Test..."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -219,7 +219,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -239,13 +239,13 @@ UINT i; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -256,7 +256,7 @@ UINT i; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -267,7 +267,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -278,7 +278,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -289,7 +289,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -305,13 +305,13 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -322,7 +322,7 @@ UINT i; status = fx_file_write(&my_file, " 0123456789012345678901\n", 24); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -333,7 +333,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -344,7 +344,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 24)) + if ((status != FX_SUCCESS) || (actual != 24)) { printf("ERROR!\n"); @@ -355,7 +355,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -371,13 +371,13 @@ UINT i; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -388,7 +388,7 @@ UINT i; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -399,7 +399,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -410,7 +410,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -421,17 +421,17 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -447,7 +447,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -461,7 +461,7 @@ UINT i; test_control_return(22); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -476,40 +476,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -520,23 +520,23 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); @@ -547,13 +547,13 @@ UINT i; printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -564,40 +564,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -613,7 +613,7 @@ UINT i; printf("ERROR!\n"); test_control_return(36); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -621,12 +621,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -639,7 +639,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -654,7 +654,7 @@ UINT status; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { error_couter ++; #ifndef FX_STANDALONE_ENABLE @@ -662,15 +662,15 @@ UINT status; #else return NULL; #endif - } - + } + /* Allocate 1500 size... */ - fx_file_allocate(&my_file, 1500); + fx_file_allocate(&my_file, 1500); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) -{ - +{ + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the redo log write operation. */ @@ -681,14 +681,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - log_write_interrupt = FX_TRUE; + log_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -700,10 +700,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -717,7 +717,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -725,11 +725,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_allocate_redo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Allocate Redo LOG Interrupt Test...N/A\n"); + printf("FileX Test: Fault Tolerant File Allocate Redo LOG Interrupt Test...N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_allocate_test.c b/test/regression_test/filex_fault_tolerant_file_allocate_test.c index 4fa4554..fcc6b40 100644 --- a/test/regression_test/filex_fault_tolerant_file_allocate_test.c +++ b/test/regression_test/filex_fault_tolerant_file_allocate_test.c @@ -24,7 +24,7 @@ void filex_fault_tolerant_file_allocate_test_application_define(void *first_u /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #endif static FX_MEDIA ram_disk; @@ -40,7 +40,7 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; static UINT i; @@ -205,7 +205,7 @@ ULONG64 available_bytes_after_write; /* Get available bytes before write. */ fx_media_extended_space_available(&ram_disk, &available_bytes_after_write); if (available_bytes_before_write != (available_bytes_after_write + - ram_disk.fx_media_fault_tolerant_clusters * ram_disk.fx_media_bytes_per_sector * ram_disk.fx_media_sectors_per_cluster)) + ram_disk.fx_media_fault_tolerant_clusters * ram_disk.fx_media_bytes_per_sector * ram_disk.fx_media_sectors_per_cluster)) { printf("ERROR!\n"); diff --git a/test/regression_test/filex_fault_tolerant_file_allocate_undo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_allocate_undo_log_interrupt_test.c index 7ad5576..15bbdef 100644 --- a/test/regression_test/filex_fault_tolerant_file_allocate_undo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_allocate_undo_log_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant undo LOG write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check undo log interrupt for fx_file_allocate(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check undo log interrupt for fx_file_allocate(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 24 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to allocate 1500 bytes for TEST1.TXT; -Step7: Terminate the new thread to simulate poweroff when update the undo log. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(undo operation); +Step7: Terminate the new thread to simulate poweroff when update the undo log. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Check the test files. */ @@ -27,7 +27,7 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_allocate_undo_log_interrupt_test_application_define(void *first_unused_memory); @@ -43,17 +43,17 @@ void filex_fault_tolerant_file_allocate_undo_log_interrupt_test_application_d /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -61,28 +61,28 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; static UINT log_write_interrupt = FX_FALSE; -static CHAR read_buffer[2048]; -static UINT read_buffer_size = 2048; +static CHAR read_buffer[2048]; +static UINT read_buffer_size = 2048; #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); +static void *ftest_1_entry(void * thread_input); #endif - + extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); +extern void test_control_return(UINT status); extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -96,15 +96,15 @@ void filex_fault_tolerant_file_allocate_undo_log_interrupt_test_application_d #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -113,7 +113,7 @@ void filex_fault_tolerant_file_allocate_undo_log_interrupt_test_application_d cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -133,71 +133,71 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Allocate Undo LOG Interrupt Test..."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -219,7 +219,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -239,13 +239,13 @@ UINT i; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -256,7 +256,7 @@ UINT i; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -267,7 +267,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -278,7 +278,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -289,7 +289,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -305,13 +305,13 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -322,7 +322,7 @@ UINT i; status = fx_file_write(&my_file, " 0123456789012345678901\n", 24); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -333,7 +333,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -344,7 +344,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 24)) + if ((status != FX_SUCCESS) || (actual != 24)) { printf("ERROR!\n"); @@ -355,7 +355,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -371,13 +371,13 @@ UINT i; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -388,7 +388,7 @@ UINT i; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -399,7 +399,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -410,7 +410,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -421,17 +421,17 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -447,7 +447,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -461,7 +461,7 @@ UINT i; test_control_return(22); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -476,40 +476,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -520,23 +520,23 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); @@ -547,13 +547,13 @@ UINT i; printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -564,40 +564,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -613,7 +613,7 @@ UINT i; printf("ERROR!\n"); test_control_return(36); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -621,12 +621,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -639,7 +639,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -654,7 +654,7 @@ UINT status; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { error_couter ++; #ifndef FX_STANDALONE_ENABLE @@ -662,15 +662,15 @@ UINT status; #else return NULL; #endif - } - + } + /* Allocate 1500 size... */ - fx_file_allocate(&my_file, 1500); + fx_file_allocate(&my_file, 1500); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) -{ - +{ + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the undo log write operation. */ @@ -681,14 +681,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - log_write_interrupt = FX_TRUE; + log_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -700,10 +700,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -717,7 +717,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -725,11 +725,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_allocate_undo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Allocate Undo LOG Interrupt Test...N/A\n"); + printf("FileX Test: Fault Tolerant File Allocate Undo LOG Interrupt Test...N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_attributes_set_directory_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_attributes_set_directory_interrupt_test.c index 112d1d7..abcdf06 100644 --- a/test/regression_test/filex_fault_tolerant_file_attributes_set_directory_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_attributes_set_directory_interrupt_test.c @@ -1,16 +1,16 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check directory interrupt for fx_file_truncate_release(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create TEST.TXT file; -Step4: Check the attributes for TEST.TXT file; + +Check directory interrupt for fx_file_truncate_release(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create TEST.TXT file; +Step4: Check the attributes for TEST.TXT file; Step5: Create new thread to set the attributes as FX_ARCHIVE | FX_READ_ONLY for TEST.TXT; -Step6: Terminate the new thread to simulate poweroff when update the directory. -Step7: Open the media; -Step8: Enable fault tolerant feature to recover the data(redo operation); +Step6: Terminate the new thread to simulate poweroff when update the directory. +Step7: Open the media; +Step8: Enable fault tolerant feature to recover the data(redo operation); Step9: Check the atrrbutes for TEST.TXT file. */ @@ -26,10 +26,10 @@ Step9: Check the atrrbutes for TEST.TXT file. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_attributes_set_directory_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -42,16 +42,16 @@ void filex_fault_tolerant_file_attributes_set_directory_interrupt_test_applic /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -59,25 +59,25 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT directory_write_interrupt = FX_FALSE; +static UINT directory_write_interrupt = FX_FALSE; #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); +static void *ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -91,15 +91,15 @@ void filex_fault_tolerant_file_attributes_set_directory_interrupt_test_applic #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -108,7 +108,7 @@ void filex_fault_tolerant_file_attributes_set_directory_interrupt_test_applic cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -135,64 +135,64 @@ UINT i; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Attri Set DIR Interrupt Test......."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -214,7 +214,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -249,11 +249,11 @@ UINT i; printf("ERROR!\n"); test_control_return(5); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -269,7 +269,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -281,9 +281,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(6); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -292,7 +292,7 @@ UINT i; printf("ERROR!\n"); test_control_return(7); - } + } /* Invalidate the media cache. */ fx_media_cache_invalidate(&ram_disk); @@ -300,7 +300,7 @@ UINT i; /* Pickup the attributes of the file again. */ status = fx_file_attributes_read(&ram_disk, "TEST.TXT", &attributes); - /* Check the attributes read status. */ + /* Check the attributes read status. */ if ((status != FX_SUCCESS) || (attributes != (FX_ARCHIVE | FX_READ_ONLY))) { @@ -317,7 +317,7 @@ UINT i; printf("ERROR!\n"); test_control_return(9); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -325,12 +325,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -343,7 +343,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -351,9 +351,9 @@ static void ftest_1_entry(ULONG thread_input) /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Now write the attributes out for the file. */ - fx_file_attributes_set(&ram_disk, "TEST.TXT", FX_ARCHIVE | FX_READ_ONLY); + fx_file_attributes_set(&ram_disk, "TEST.TXT", FX_ARCHIVE | FX_READ_ONLY); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) @@ -369,14 +369,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt = FX_TRUE; - + directory_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -388,10 +388,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -405,7 +405,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -413,11 +413,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_attributes_set_directory_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Attri Set DIR Interrupt Test.......N/A\n"); + printf("FileX Test: Fault Tolerant File Attri Set DIR Interrupt Test.......N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_attributes_set_redo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_attributes_set_redo_log_interrupt_test.c index 3686b11..7826642 100644 --- a/test/regression_test/filex_fault_tolerant_file_attributes_set_redo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_attributes_set_redo_log_interrupt_test.c @@ -1,16 +1,16 @@ /* This FileX test concentrates on the Fault-Tolerant redo Log write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check redo log interrupt for fx_file_truncate_release(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create TEST.TXT file; -Step4: Check the attributes for TEST.TXT file; + +Check redo log interrupt for fx_file_truncate_release(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create TEST.TXT file; +Step4: Check the attributes for TEST.TXT file; Step5: Create new thread to set the attributes as FX_ARCHIVE | FX_READ_ONLY for TEST.TXT; -Step6: Terminate the new thread to simulate poweroff when update the redo log. -Step7: Open the media; -Step8: Enable fault tolerant feature to recover the data(undo operation); +Step6: Terminate the new thread to simulate poweroff when update the redo log. +Step7: Open the media; +Step8: Enable fault tolerant feature to recover the data(undo operation); Step9: Check the atrrbutes for TEST.TXT file. */ @@ -26,10 +26,10 @@ Step9: Check the atrrbutes for TEST.TXT file. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_attributes_set_redo_log_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -42,16 +42,16 @@ void filex_fault_tolerant_file_attributes_set_redo_log_interrupt_test_applica /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -59,25 +59,25 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT log_write_interrupt = FX_FALSE; +static UINT log_write_interrupt = FX_FALSE; #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); -#endif +static void * ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -91,15 +91,15 @@ void filex_fault_tolerant_file_attributes_set_redo_log_interrupt_test_applica #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -108,7 +108,7 @@ void filex_fault_tolerant_file_attributes_set_redo_log_interrupt_test_applica cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -128,71 +128,71 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -UINT attributes; +UINT attributes; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Attri Set Redo LOG Interrupt Test.."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -214,7 +214,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -249,11 +249,11 @@ UINT i; printf("ERROR!\n"); test_control_return(5); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -269,7 +269,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -281,9 +281,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(6); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -292,7 +292,7 @@ UINT i; printf("ERROR!\n"); test_control_return(7); - } + } /* Invalidate the media cache. */ fx_media_cache_invalidate(&ram_disk); @@ -300,7 +300,7 @@ UINT i; /* Pickup the attributes of the file again. */ status = fx_file_attributes_read(&ram_disk, "TEST.TXT", &attributes); - /* Check the attributes read status. */ + /* Check the attributes read status. */ if ((status != FX_SUCCESS) || (attributes != FX_ARCHIVE )) { @@ -317,7 +317,7 @@ UINT i; printf("ERROR!\n"); test_control_return(9); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -325,12 +325,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -343,7 +343,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -351,14 +351,14 @@ static void ftest_1_entry(ULONG thread_input) /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Now write the attributes out for the file. */ - fx_file_attributes_set(&ram_disk, "TEST.TXT", FX_ARCHIVE | FX_READ_ONLY); + fx_file_attributes_set(&ram_disk, "TEST.TXT", FX_ARCHIVE | FX_READ_ONLY); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) { - + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the redo log write operation. */ @@ -369,14 +369,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - log_write_interrupt = FX_TRUE; - + log_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -388,10 +388,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -405,7 +405,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -413,11 +413,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_attributes_set_redo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Attri Set Redo LOG Interrupt Test..N/A\n"); + printf("FileX Test: Fault Tolerant File Attri Set Redo LOG Interrupt Test..N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_best_allocate_directory_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_best_allocate_directory_interrupt_test.c index abf7ab0..40d674b 100644 --- a/test/regression_test/filex_fault_tolerant_file_best_allocate_directory_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_best_allocate_directory_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check directory interrupt for fx_file_best_effort_allocate(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check directory interrupt for fx_file_best_effort_allocate(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 24 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to allocate 1500 bytes for TEST1.TXT; -Step7: Terminate the new thread to simulate poweroff when update the directory after record the redo log. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(redo operation); +Step7: Terminate the new thread to simulate poweroff when update the directory after record the redo log. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(redo operation); Step10: Check the test files. */ @@ -27,10 +27,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_best_allocate_directory_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -43,17 +43,17 @@ void filex_fault_tolerant_file_best_allocate_directory_interrupt_test_applica /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -61,27 +61,27 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT directory_write_interrupt = FX_FALSE; -static CHAR read_buffer[2048]; -static UINT read_buffer_size = 2048; +static UINT directory_write_interrupt = FX_FALSE; +static CHAR read_buffer[2048]; +static UINT read_buffer_size = 2048; #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); -#endif +static void *ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -95,15 +95,15 @@ void filex_fault_tolerant_file_best_allocate_directory_interrupt_test_applica #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -112,7 +112,7 @@ void filex_fault_tolerant_file_best_allocate_directory_interrupt_test_applica cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -132,71 +132,71 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Best Allo DIR Interrupt Test......."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -218,7 +218,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -238,13 +238,13 @@ UINT i; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -255,7 +255,7 @@ UINT i; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -266,7 +266,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -277,7 +277,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -288,7 +288,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -304,13 +304,13 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -321,7 +321,7 @@ UINT i; status = fx_file_write(&my_file, " 0123456789012345678901\n", 24); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -332,7 +332,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -343,7 +343,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 24)) + if ((status != FX_SUCCESS) || (actual != 24)) { printf("ERROR!\n"); @@ -354,7 +354,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -370,13 +370,13 @@ UINT i; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -387,7 +387,7 @@ UINT i; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -398,7 +398,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -409,7 +409,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -420,17 +420,17 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -446,7 +446,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -458,9 +458,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(22); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -475,40 +475,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -519,23 +519,23 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); @@ -546,13 +546,13 @@ UINT i; printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -563,40 +563,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -612,7 +612,7 @@ UINT i; printf("ERROR!\n"); test_control_return(36); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -620,12 +620,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -638,16 +638,16 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif -UINT status; +UINT status; ULONG actual_size_allocated; FX_PARAMETER_NOT_USED(thread_input); /* Set the callback function to simulate poweoff operation when write FAT entry. */ - driver_write_callback = my_driver_write; + driver_write_callback = my_driver_write; /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); @@ -655,7 +655,7 @@ ULONG actual_size_allocated; /* Check the file open status. */ if (status != FX_SUCCESS) { - + error_couter ++; #ifndef FX_STANDALONE_ENABLE return; @@ -681,14 +681,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt = FX_TRUE; - + directory_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -700,10 +700,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -717,7 +717,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -725,11 +725,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_best_allocate_directory_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Best Allo DIR Interrupt Test.......N/A\n"); + printf("FileX Test: Fault Tolerant File Best Allo DIR Interrupt Test.......N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_best_allocate_fat_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_best_allocate_fat_interrupt_test.c index 9f6c860..01d65c8 100644 --- a/test/regression_test/filex_fault_tolerant_file_best_allocate_fat_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_best_allocate_fat_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant FAT write interrupt operation. */ /* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check fat interrupt for fx_file_best_effort_allocate(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check fat interrupt for fx_file_best_effort_allocate(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 24 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to allocate 1500 bytes for TEST1.TXT; -Step7: Terminate the new thread to simulate poweroff when update the fat between undo log generated and redo log not generated. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(undo operation); +Step7: Terminate the new thread to simulate poweroff when update the fat between undo log generated and redo log not generated. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Check the test files. */ @@ -27,10 +27,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_best_allocate_fat_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -43,17 +43,17 @@ void filex_fault_tolerant_file_best_allocate_fat_interrupt_test_application_d /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -61,27 +61,27 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; static UINT fat_write_interrupt = FX_FALSE; -static CHAR read_buffer[2048]; -static UINT read_buffer_size = 2048; +static CHAR read_buffer[2048]; +static UINT read_buffer_size = 2048; #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); -#ifndef FX_STANDALONE_ENABLE +static void ftest_0_entry(ULONG thread_input); +#ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); +static void * ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -95,15 +95,15 @@ void filex_fault_tolerant_file_best_allocate_fat_interrupt_test_application_d #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -112,7 +112,7 @@ void filex_fault_tolerant_file_best_allocate_fat_interrupt_test_application_d cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -132,71 +132,71 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Best Allo FAT Interrupt Test......."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -218,7 +218,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -238,13 +238,13 @@ UINT i; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -255,7 +255,7 @@ UINT i; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -266,7 +266,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -277,7 +277,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -288,7 +288,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -304,13 +304,13 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -321,7 +321,7 @@ UINT i; status = fx_file_write(&my_file, " 0123456789012345678901\n", 24); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -332,7 +332,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -343,7 +343,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 24)) + if ((status != FX_SUCCESS) || (actual != 24)) { printf("ERROR!\n"); @@ -354,7 +354,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -370,13 +370,13 @@ UINT i; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -387,7 +387,7 @@ UINT i; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -398,7 +398,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -409,7 +409,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -420,17 +420,17 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); - } - + } + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -444,10 +444,10 @@ UINT i; pthread_create(&ptid1, NULL, &ftest_1_entry, NULL); usleep(10); pthread_join(ptid1,NULL); - + #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -461,7 +461,7 @@ UINT i; test_control_return(22); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -476,40 +476,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -520,40 +520,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); - /* Check the file read status. */ + /* Check the file read status. */ if ((status != FX_SUCCESS) || (actual != 24)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -564,40 +564,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -613,7 +613,7 @@ UINT i; printf("ERROR!\n"); test_control_return(36); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -621,12 +621,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -636,18 +636,18 @@ static void ftest_1_entry(ULONG thread_input) void * ftest_1_entry(void * thread_input) #endif { - UINT status; + UINT status; ULONG actual_size_allocated; #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif FX_PARAMETER_NOT_USED(thread_input); /* Set the callback function to simulate poweoff operation when write FAT entry. */ - driver_write_callback = my_driver_write; + driver_write_callback = my_driver_write; /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); @@ -655,7 +655,7 @@ static void ftest_1_entry(ULONG thread_input) /* Check the file open status. */ if (status != FX_SUCCESS) { - + error_couter ++; #ifndef FX_STANDALONE_ENABLE return; @@ -663,7 +663,7 @@ static void ftest_1_entry(ULONG thread_input) return NULL; #endif } - + /* Allocate the size... */ fx_file_best_effort_allocate(&my_file, 1500, &actual_size_allocated); } @@ -681,14 +681,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - fat_write_interrupt = FX_TRUE; + fat_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -700,10 +700,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -717,7 +717,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -725,11 +725,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_best_allocate_fat_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Best Allo FAT Interrupt Test.......N/A\n"); + printf("FileX Test: Fault Tolerant File Best Allo FAT Interrupt Test.......N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_best_allocate_redo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_best_allocate_redo_log_interrupt_test.c index 69f62fb..79716f3 100644 --- a/test/regression_test/filex_fault_tolerant_file_best_allocate_redo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_best_allocate_redo_log_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant redo log write interrupt operation. */ /* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check redo log interrupt for fx_file_best_effort_allocate(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check redo log interrupt for fx_file_best_effort_allocate(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 24 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to allocate 1500 bytes for TEST1.TXT; -Step7: Terminate the new thread to simulate poweroff when update the redo log. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(undo operation); +Step7: Terminate the new thread to simulate poweroff when update the redo log. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Check the test files. */ @@ -27,7 +27,7 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_best_allocate_redo_log_interrupt_test_application_define(void *first_unused_memory); @@ -43,17 +43,17 @@ void filex_fault_tolerant_file_best_allocate_redo_log_interrupt_test_applicat /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -61,27 +61,27 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; static UINT log_write_interrupt = FX_FALSE; -static CHAR read_buffer[2048]; -static UINT read_buffer_size = 2048; +static CHAR read_buffer[2048]; +static UINT read_buffer_size = 2048; #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); -#endif +static void *ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); +extern void test_control_return(UINT status); extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -95,15 +95,15 @@ void filex_fault_tolerant_file_best_allocate_redo_log_interrupt_test_applicat #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -112,7 +112,7 @@ void filex_fault_tolerant_file_best_allocate_redo_log_interrupt_test_applicat cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -139,64 +139,64 @@ UINT i; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Best Allo Redo LOG Interrupt Test.."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -218,7 +218,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -238,13 +238,13 @@ UINT i; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -255,7 +255,7 @@ UINT i; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -266,7 +266,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -277,7 +277,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -288,7 +288,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -304,13 +304,13 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -321,7 +321,7 @@ UINT i; status = fx_file_write(&my_file, " 0123456789012345678901\n", 24); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -332,7 +332,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -343,7 +343,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 24)) + if ((status != FX_SUCCESS) || (actual != 24)) { printf("ERROR!\n"); @@ -354,7 +354,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -370,13 +370,13 @@ UINT i; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -387,7 +387,7 @@ UINT i; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -398,7 +398,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -409,7 +409,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -420,22 +420,22 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif /* directory_write_interrupt */ - log_write_interrupt = FX_FALSE; + log_write_interrupt = FX_FALSE; /* Let the other thread run. */ #ifndef FX_STANDALONE_ENABLE @@ -446,7 +446,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -460,7 +460,7 @@ UINT i; test_control_return(22); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -475,40 +475,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -519,23 +519,23 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); @@ -546,13 +546,13 @@ UINT i; printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -563,40 +563,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -612,7 +612,7 @@ UINT i; printf("ERROR!\n"); test_control_return(36); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -620,12 +620,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -638,16 +638,16 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif -UINT status; +UINT status; ULONG actual_size_allocated; - + FX_PARAMETER_NOT_USED(thread_input); /* Set the callback function to simulate poweoff operation when write FAT entry. */ - driver_write_callback = my_driver_write; + driver_write_callback = my_driver_write; /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); @@ -663,16 +663,16 @@ ULONG actual_size_allocated; return NULL; #endif } - + /* Allocate the size... */ fx_file_best_effort_allocate(&my_file, 1500, &actual_size_allocated); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) { - + FX_PARAMETER_NOT_USED(block_ptr); - + /* Interrupt the redo log write operation. */ if ((sector_type == FX_DATA_SECTOR) && (_filex_fault_tolerant_log_check(media_ptr) & FX_FAULT_TOLERANT_LOG_REDO_UPDATING)) { @@ -681,14 +681,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - log_write_interrupt = FX_TRUE; + log_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -700,10 +700,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -717,7 +717,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -725,11 +725,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_best_allocate_redo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Best Allo Redo LOG Interrupt Test..N/A\n"); + printf("FileX Test: Fault Tolerant File Best Allo Redo LOG Interrupt Test..N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_best_allocate_undo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_best_allocate_undo_log_interrupt_test.c index 8e13fc3..5666c42 100644 --- a/test/regression_test/filex_fault_tolerant_file_best_allocate_undo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_best_allocate_undo_log_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant undo log write interrupt operation. */ /* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check undo log interrupt for fx_file_best_effort_allocate(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check undo log interrupt for fx_file_best_effort_allocate(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 24 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to allocate 1500 bytes for TEST1.TXT; -Step7: Terminate the new thread to simulate poweroff when update the undo log. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(undo operation); +Step7: Terminate the new thread to simulate poweroff when update the undo log. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Check the test files. */ @@ -27,7 +27,7 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_best_allocate_undo_log_interrupt_test_application_define(void *first_unused_memory); @@ -53,7 +53,7 @@ static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -61,27 +61,27 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; static UINT log_write_interrupt = FX_FALSE; -static CHAR read_buffer[2048]; -static UINT read_buffer_size = 2048; +static CHAR read_buffer[2048]; +static UINT read_buffer_size = 2048; #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); -#endif +static void * ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); +extern void test_control_return(UINT status); extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -94,15 +94,15 @@ void filex_fault_tolerant_file_best_allocate_undo_log_interrupt_test_applicat #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -111,7 +111,7 @@ void filex_fault_tolerant_file_best_allocate_undo_log_interrupt_test_applicat cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -138,64 +138,64 @@ UINT i; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Best Allo Undo LOG Interrupt Test.."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -217,7 +217,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -237,13 +237,13 @@ UINT i; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -254,7 +254,7 @@ UINT i; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -265,7 +265,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -276,7 +276,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -287,7 +287,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -303,13 +303,13 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -320,7 +320,7 @@ UINT i; status = fx_file_write(&my_file, " 0123456789012345678901\n", 24); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -331,7 +331,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -342,7 +342,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 24)) + if ((status != FX_SUCCESS) || (actual != 24)) { printf("ERROR!\n"); @@ -353,7 +353,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -369,13 +369,13 @@ UINT i; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -386,7 +386,7 @@ UINT i; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -397,7 +397,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -408,7 +408,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -419,22 +419,22 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif /* directory_write_interrupt */ - log_write_interrupt = FX_FALSE; + log_write_interrupt = FX_FALSE; /* Let the other thread run. */ #ifndef FX_STANDALONE_ENABLE @@ -445,7 +445,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -459,7 +459,7 @@ UINT i; test_control_return(22); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -474,40 +474,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -518,23 +518,23 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); @@ -545,13 +545,13 @@ UINT i; printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -562,40 +562,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -611,7 +611,7 @@ UINT i; printf("ERROR!\n"); test_control_return(36); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -619,12 +619,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -636,17 +636,17 @@ static void ftest_1_entry(ULONG thread_input) { #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif - UINT status; + UINT status; ULONG actual_size_allocated; - + FX_PARAMETER_NOT_USED(thread_input); /* Set the callback function to simulate poweoff operation when write FAT entry. */ - driver_write_callback = my_driver_write; + driver_write_callback = my_driver_write; /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); @@ -661,14 +661,14 @@ static void ftest_1_entry(ULONG thread_input) return NULL; #endif } - + /* Allocate the size... */ fx_file_best_effort_allocate(&my_file, 1500, &actual_size_allocated); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) { - + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the undo log write operation. */ @@ -679,14 +679,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - log_write_interrupt = FX_TRUE; + log_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -698,10 +698,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -715,7 +715,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -723,11 +723,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_best_allocate_undo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Best Allo Undo LOG Interrupt Test..N/A\n"); + printf("FileX Test: Fault Tolerant File Best Allo Undo LOG Interrupt Test..N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_best_effort_allocate_fat_crossover_test.c b/test/regression_test/filex_fault_tolerant_file_best_effort_allocate_fat_crossover_test.c index 4b1972a..eedeee6 100644 --- a/test/regression_test/filex_fault_tolerant_file_best_effort_allocate_fat_crossover_test.c +++ b/test/regression_test/filex_fault_tolerant_file_best_effort_allocate_fat_crossover_test.c @@ -4,12 +4,12 @@ * before it is flushed into media system. The design requires the FAT entries updated in reverse * order in FAT chain. Due to the FAT cache, the FAT entries may be updated in any order. * That will break the fault tolerant design. The expected issue is, the FAT chain could - * not be released completely.*/ + * not be released completely.*/ /* For FAT 32 one cluster size is 512 bytes and one sector per cluster; - -Step1: Format and open the media; -Step2: Enable fault tolerant feature; + +Step1: Format and open the media; +Step2: Enable fault tolerant feature; Step3: Create and allocate 118 clusters for A.TXT. Step6: Create a new thread and allocate cluster 127 and 128 for A.TXT(by fx_file_best_effort_allocate). Step7: Terminate the new thread to simulate poweroff while writing the fat entry of cluster 127 @@ -17,7 +17,7 @@ Step7: Terminate the new thread to simulate poweroff while writing the fat entry Step8: Open the media. Step9: Enable fault tolerant feature to revert the FAT chain(revert operation). Step10: Perform media check. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -32,10 +32,10 @@ Step10: Perform media check. #include "fx_fault_tolerant.h" #include "fx_utility.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_best_effort_allocate_fat_crossover_test_application_define(void *first_unused_memory); - + #ifdef FX_ENABLE_FAULT_TOLERANT #define DEMO_STACK_SIZE 4096 @@ -46,17 +46,17 @@ void filex_fault_tolerant_file_best_effort_allocate_fat_crossover_test_applic /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -64,7 +64,7 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT fat_write_interrupt = FX_FALSE; static UCHAR scratch_memory[16 * 1024]; static UINT interrupt_count_down; @@ -72,17 +72,17 @@ static UINT interrupt_count_down; /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); +static void * ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -94,15 +94,15 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_best_effort_allocate_fat_crossover_test_application_define(void *first_unused_memory) #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -111,7 +111,7 @@ void filex_fault_tolerant_file_best_effort_allocate_fat_crossover_test_applic cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -139,20 +139,20 @@ ULONG errors_detected; printf("FileX Test: Fault Tolerant File Best Effort Allocate FAT Crossover Test."); /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 512, // Sector size + 70000, // Total sectors + 512, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); status += fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail(FX_SUCCESS == status); @@ -160,7 +160,7 @@ ULONG errors_detected; /* One cluster for A.TXT. */ status = fx_file_create(&ram_disk, "A.TXT"); status += fx_file_open(&ram_disk, &my_file, "A.TXT", FX_OPEN_FOR_WRITE); - status += fx_file_allocate(&my_file, 512 * 118); + status += fx_file_allocate(&my_file, 512 * 118); status += fx_file_close(&my_file); return_if_fail(FX_SUCCESS == status); @@ -170,8 +170,8 @@ ULONG errors_detected; /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -180,14 +180,14 @@ ULONG errors_detected; /* Let the other thread run. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_relinquish(); + tx_thread_relinquish(); #else pthread_create(&ptid1, NULL, &ftest_1_entry, NULL); usleep(10); pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ return_if_fail(FX_TRUE == fat_write_interrupt); status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -207,10 +207,10 @@ ULONG errors_detected; pthread_cancel(ptid1); #endif - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -223,7 +223,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -232,9 +232,9 @@ static void ftest_1_entry(ULONG thread_input) FX_PARAMETER_NOT_USED(thread_input); - /* Set the callback function to simulate poweoff operation when write FAT entry. */ + /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "A.TXT", FX_OPEN_FOR_WRITE); return_if_fail(FX_SUCCESS == status); @@ -265,14 +265,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - fat_write_interrupt = FX_TRUE; + fat_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -284,10 +284,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -302,7 +302,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -310,7 +310,7 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_best_effort_allocate_fat_crossover_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ diff --git a/test/regression_test/filex_fault_tolerant_file_corruption_test.c b/test/regression_test/filex_fault_tolerant_file_corruption_test.c index 1ff409f..e4aca2e 100644 --- a/test/regression_test/filex_fault_tolerant_file_corruption_test.c +++ b/test/regression_test/filex_fault_tolerant_file_corruption_test.c @@ -27,14 +27,14 @@ extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); -extern VOID (*driver_fault_tolerant_enable_callback)(FX_MEDIA *media_ptr, +extern VOID (*driver_fault_tolerant_enable_callback)(FX_MEDIA *media_ptr, UCHAR *fault_tolerant_memory_buffer, ULONG log_size); static UINT my_driver_write_callback(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); -static VOID my_fault_tolerant_enable_callback(FX_MEDIA *media_ptr, +static VOID my_fault_tolerant_enable_callback(FX_MEDIA *media_ptr, UCHAR *fault_tolerant_memory_buffer, ULONG log_size); static void ftest_0_entry(ULONG thread_input); @@ -344,7 +344,7 @@ static UINT my_driver_write_callback(FX_MEDIA *media_ptr, return(FX_SUCCESS); } -static VOID my_fault_tolerant_enable_callback(FX_MEDIA *media_ptr, +static VOID my_fault_tolerant_enable_callback(FX_MEDIA *media_ptr, UCHAR *fault_tolerant_memory_buffer, ULONG log_size) { diff --git a/test/regression_test/filex_fault_tolerant_file_create_directory_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_create_directory_interrupt_test.c index 8b937f6..9948863 100644 --- a/test/regression_test/filex_fault_tolerant_file_create_directory_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_create_directory_interrupt_test.c @@ -1,19 +1,19 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; -Check directory interrupt for fx_file_create() : -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; +Check directory interrupt for fx_file_create() : +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 26 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to create TEST3.TXT; -Step7: Terminate the new thread to simulate poweroff when update directory. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(redo operation); +Step7: Terminate the new thread to simulate poweroff when update directory. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(redo operation); Step10: Check the test files. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" #else @@ -26,10 +26,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_create_directory_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -42,17 +42,17 @@ void filex_fault_tolerant_file_create_directory_interrupt_test_application_de /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -60,27 +60,27 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT directory_write_interrupt = FX_FALSE; -static CHAR read_buffer[1024]; -static UINT read_buffer_size = 1024; +static UINT directory_write_interrupt = FX_FALSE; +static CHAR read_buffer[1024]; +static UINT read_buffer_size = 1024; #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); -#endif +static void *ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -94,15 +94,15 @@ void filex_fault_tolerant_file_create_directory_interrupt_test_application_de #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -111,7 +111,7 @@ void filex_fault_tolerant_file_create_directory_interrupt_test_application_de cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -131,71 +131,71 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Create DIR Interrupt Test.........."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -217,7 +217,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -237,13 +237,13 @@ UINT i; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -254,7 +254,7 @@ UINT i; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -265,7 +265,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -276,7 +276,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -287,7 +287,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -303,13 +303,13 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -320,7 +320,7 @@ UINT i; status = fx_file_write(&my_file, " 012345678901234567890123\n", 26); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -331,7 +331,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -342,7 +342,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); @@ -353,7 +353,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -369,13 +369,13 @@ UINT i; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -386,7 +386,7 @@ UINT i; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -397,7 +397,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -408,7 +408,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -419,18 +419,18 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -446,7 +446,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -458,9 +458,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(22); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -475,40 +475,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -519,40 +519,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -563,40 +563,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -607,40 +607,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST3.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(36); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(37); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_END_OF_FILE) || (actual != 0)) + if ((status != FX_END_OF_FILE) || (actual != 0)) { printf("ERROR!\n"); test_control_return(38); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -656,7 +656,7 @@ UINT i; printf("ERROR!\n"); test_control_return(40); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -664,12 +664,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -682,7 +682,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -690,7 +690,7 @@ static void ftest_1_entry(ULONG thread_input) /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Create a file called TEST3.TXT in the root directory. */ fx_file_create(&ram_disk, "TEST3.TXT"); } @@ -708,14 +708,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt = FX_TRUE; - + directory_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -727,10 +727,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -744,7 +744,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -752,11 +752,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_create_directory_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Create DIR Interrupt Test..........N/A\n"); + printf("FileX Test: Fault Tolerant File Create DIR Interrupt Test..........N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_create_redo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_create_redo_log_interrupt_test.c index 8da4eeb..f110410 100644 --- a/test/regression_test/filex_fault_tolerant_file_create_redo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_create_redo_log_interrupt_test.c @@ -1,19 +1,19 @@ /* This FileX test concentrates on the Fault-Tolerant redo LOG write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check redo log interrupt for fx_file_create() : -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check redo log interrupt for fx_file_create() : +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 26 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to create TEST3.TXT; -Step7: Terminate the new thread to simulate poweroff when update the redo log. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(undo operation); +Step7: Terminate the new thread to simulate poweroff when update the redo log. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Check the test files. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -27,10 +27,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_create_redo_log_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -43,17 +43,17 @@ void filex_fault_tolerant_file_create_redo_log_interrupt_test_application_def /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -61,26 +61,26 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT log_write_interrupt = FX_FALSE; -static CHAR read_buffer[1024]; -static UINT read_buffer_size = 1024; - +static UINT log_write_interrupt = FX_FALSE; +static CHAR read_buffer[1024]; +static UINT read_buffer_size = 1024; + #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); -#endif +static void *ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -94,15 +94,15 @@ void filex_fault_tolerant_file_create_redo_log_interrupt_test_application_def #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -111,7 +111,7 @@ void filex_fault_tolerant_file_create_redo_log_interrupt_test_application_def cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -131,71 +131,71 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Create Redo LOG Interrupt Test....."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -217,7 +217,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -237,13 +237,13 @@ UINT i; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -254,7 +254,7 @@ UINT i; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -265,7 +265,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -276,7 +276,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -287,7 +287,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -303,13 +303,13 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -320,7 +320,7 @@ UINT i; status = fx_file_write(&my_file, " 012345678901234567890123\n", 26); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -331,7 +331,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -342,7 +342,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); @@ -353,7 +353,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -369,13 +369,13 @@ UINT i; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -386,7 +386,7 @@ UINT i; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -397,7 +397,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -408,7 +408,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -419,17 +419,17 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -445,7 +445,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -457,9 +457,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(22); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -474,40 +474,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -518,40 +518,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -562,40 +562,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -606,12 +606,12 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST3.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status == FX_SUCCESS) + if (status == FX_SUCCESS) { printf("ERROR!\n"); test_control_return(36); - } + } /* Close the media. */ status = fx_media_close(&ram_disk); @@ -622,7 +622,7 @@ UINT i; printf("ERROR!\n"); test_control_return(37); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -630,12 +630,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -648,7 +648,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -656,14 +656,14 @@ static void ftest_1_entry(ULONG thread_input) /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Create a file called TEST3.TXT in the root directory. */ fx_file_create(&ram_disk, "TEST3.TXT"); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) { - + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the redo log write operation. */ @@ -674,14 +674,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - log_write_interrupt = FX_TRUE; - + log_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -693,10 +693,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -710,7 +710,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -718,11 +718,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_create_redo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Create Redo LOG Interrupt Test.....N/A\n"); + printf("FileX Test: Fault Tolerant File Create Redo LOG Interrupt Test.....N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_delete_directory_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_delete_directory_interrupt_test.c index d3798e9..7e3cf0e 100644 --- a/test/regression_test/filex_fault_tolerant_file_delete_directory_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_delete_directory_interrupt_test.c @@ -1,19 +1,19 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check directory interrupt for fx_file_delete(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check directory interrupt for fx_file_delete(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 26 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to delete TEST2.TXT; -Step7: Terminate the new thread to simulate poweroff when update the directory after record the redo log. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(redo operation); +Step7: Terminate the new thread to simulate poweroff when update the directory after record the redo log. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(redo operation); Step10: Check the test files. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" #else @@ -26,10 +26,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_delete_directory_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -42,17 +42,17 @@ void filex_fault_tolerant_file_delete_directory_interrupt_test_application_de /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -60,27 +60,27 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT directory_write_interrupt = FX_FALSE; -static CHAR read_buffer[1024]; -static UINT read_buffer_size = 1024; - +static UINT directory_write_interrupt = FX_FALSE; +static CHAR read_buffer[1024]; +static UINT read_buffer_size = 1024; + #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); -#endif - +static void *ftest_1_entry(void * thread_input); +#endif + extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -94,15 +94,15 @@ void filex_fault_tolerant_file_delete_directory_interrupt_test_application_de #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -111,7 +111,7 @@ void filex_fault_tolerant_file_delete_directory_interrupt_test_application_de cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -131,71 +131,71 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Delete DIR Interrupt Test.........."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -217,7 +217,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -237,13 +237,13 @@ UINT i; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -254,7 +254,7 @@ UINT i; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -265,7 +265,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -276,7 +276,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -287,7 +287,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -303,13 +303,13 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -320,7 +320,7 @@ UINT i; status = fx_file_write(&my_file, " 012345678901234567890123\n", 26); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -331,7 +331,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -342,7 +342,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); @@ -353,7 +353,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -369,13 +369,13 @@ UINT i; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -386,7 +386,7 @@ UINT i; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -397,7 +397,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -408,7 +408,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -419,17 +419,17 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -445,7 +445,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -457,9 +457,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(22); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -474,40 +474,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -518,40 +518,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -562,12 +562,12 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status == FX_SUCCESS) + if (status == FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Close the media. */ status = fx_media_close(&ram_disk); @@ -578,7 +578,7 @@ UINT i; printf("ERROR!\n"); test_control_return(33); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -586,12 +586,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -604,7 +604,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -612,7 +612,7 @@ static void ftest_1_entry(ULONG thread_input) /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Create a file called TEST2.TXT in the root directory. */ fx_file_delete(&ram_disk, "TEST2.TXT"); } @@ -630,14 +630,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt = FX_TRUE; - + directory_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -649,10 +649,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -666,7 +666,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -674,11 +674,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_delete_directory_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Delete DIR Interrupt Test..........N/A\n"); + printf("FileX Test: Fault Tolerant File Delete DIR Interrupt Test..........N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_delete_fat_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_delete_fat_interrupt_test.c index d49db3f..57bfdaf 100644 --- a/test/regression_test/filex_fault_tolerant_file_delete_fat_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_delete_fat_interrupt_test.c @@ -1,19 +1,19 @@ /* This FileX test concentrates on the Fault-Tolerant FAT write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check fat interrupt for fx_file_delete(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check fat interrupt for fx_file_delete(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 26 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to delete TEST2.TXT; -Step7: Terminate the new thread to simulate poweroff when update the fat after record the redo log. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(redo operation); +Step7: Terminate the new thread to simulate poweroff when update the fat after record the redo log. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(redo operation); Step10: Check the test files. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -27,10 +27,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_delete_fat_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -43,17 +43,17 @@ void filex_fault_tolerant_file_delete_fat_interrupt_test_application_define(v /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -61,27 +61,27 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT fat_write_interrupt = FX_FALSE; -static CHAR read_buffer[1024]; -static UINT read_buffer_size = 1024; - +static UINT fat_write_interrupt = FX_FALSE; +static CHAR read_buffer[1024]; +static UINT read_buffer_size = 1024; + #define TEST_COUNT 3 /* Define thread prototypes. */ - + static void ftest_0_entry(ULONG thread_input); -#ifndef FX_STANDALONE_ENABLE +#ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); +static void * ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -95,15 +95,15 @@ void filex_fault_tolerant_file_delete_fat_interrupt_test_application_define(v #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -112,7 +112,7 @@ void filex_fault_tolerant_file_delete_fat_interrupt_test_application_define(v cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -139,64 +139,64 @@ UINT i; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Delete FAT Interrupt Test.........."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -218,7 +218,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -238,13 +238,13 @@ UINT i; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -255,7 +255,7 @@ UINT i; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -266,7 +266,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -277,7 +277,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -288,7 +288,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -304,13 +304,13 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -321,7 +321,7 @@ UINT i; status = fx_file_write(&my_file, " 012345678901234567890123\n", 26); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -332,7 +332,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -343,7 +343,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); @@ -354,7 +354,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -370,13 +370,13 @@ UINT i; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -387,7 +387,7 @@ UINT i; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -398,7 +398,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -409,7 +409,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -420,17 +420,17 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -444,10 +444,10 @@ UINT i; pthread_create(&ptid1, NULL, &ftest_1_entry, NULL); usleep(10); pthread_join(ptid1,NULL); - + #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -459,9 +459,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(22); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -476,40 +476,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -520,40 +520,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -564,12 +564,12 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status == FX_SUCCESS) + if (status == FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Close the media. */ status = fx_media_close(&ram_disk); @@ -580,7 +580,7 @@ UINT i; printf("ERROR!\n"); test_control_return(33); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -588,13 +588,13 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ #ifndef FX_STANDALONE_ENABLE @@ -605,7 +605,7 @@ static void ftest_1_entry(ULONG thread_input) { #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -613,14 +613,14 @@ static void ftest_1_entry(ULONG thread_input) /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Create a file called TEST2.TXT in the root directory. */ fx_file_delete(&ram_disk, "TEST2.TXT"); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) { - + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the FAT write operation after record the redo log. */ @@ -631,14 +631,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - fat_write_interrupt = FX_TRUE; - + fat_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -650,10 +650,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -667,7 +667,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -675,11 +675,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_delete_fat_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Delete FAT Interrupt Test..........N/A\n"); + printf("FileX Test: Fault Tolerant File Delete FAT Interrupt Test..........N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_delete_fat_multiple_sectors_test.c b/test/regression_test/filex_fault_tolerant_file_delete_fat_multiple_sectors_test.c index c3207d5..c65062a 100644 --- a/test/regression_test/filex_fault_tolerant_file_delete_fat_multiple_sectors_test.c +++ b/test/regression_test/filex_fault_tolerant_file_delete_fat_multiple_sectors_test.c @@ -1,19 +1,19 @@ /* This FileX test concentrates on the Fault-Tolerant FAT write interrupt operation. */ -/* +/* For FAT 12, one cluster size is 1024 bytes; - -Check fat interrupt for fx_file_delete(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and allocate 330 clusters (8-337) for TEST.TXT; + +Check fat interrupt for fx_file_delete(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and allocate 330 clusters (8-337) for TEST.TXT; Step4: Create and allocate 10 clusters (338-347) for TEST2.TXT; -Step5: Adjust FAT chain of TEST2.TXT; +Step5: Adjust FAT chain of TEST2.TXT; Step6: Create new thread to delete TEST2.TXT; -Step7: Terminate the new thread to simulate poweroff when update the FAT entry 0x155 after record the redo log. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(redo operation); +Step7: Terminate the new thread to simulate poweroff when update the FAT entry 0x155 after record the redo log. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(redo operation); Step10: Check the TEST.TXT. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -28,10 +28,10 @@ Step10: Check the TEST.TXT. #include "fx_utility.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_delete_fat_multple_sectors_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -44,17 +44,17 @@ void filex_fault_tolerant_file_delete_fat_multple_sectors_test_application_de /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -62,25 +62,25 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT fat_write_interrupt = FX_FALSE; -static CHAR read_buffer[1024]; +static UINT fat_write_interrupt = FX_FALSE; +static CHAR read_buffer[1024]; static UINT read_buffer_size = 1024; /* Define thread prototypes. */ - + static void ftest_0_entry(ULONG thread_input); -#ifndef FX_STANDALONE_ENABLE +#ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); +static void * ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -94,15 +94,15 @@ void filex_fault_tolerant_file_delete_fat_interrupt_test_application_define(v #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -111,7 +111,7 @@ void filex_fault_tolerant_file_delete_fat_interrupt_test_application_define(v cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -138,23 +138,23 @@ UINT i; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Delete FAT Multiple Sectors Test..."); - + /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 512, // Sector size + 512, // Total sectors + 512, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -176,7 +176,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -202,7 +202,7 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -213,7 +213,7 @@ UINT i; status = fx_file_allocate(&my_file, 330 * 512); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -224,7 +224,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -246,7 +246,7 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -258,7 +258,7 @@ UINT i; status = fx_file_allocate(&my_file, 10 * 512); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -269,7 +269,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -282,11 +282,11 @@ UINT i; _fx_utility_FAT_entry_write(&ram_disk, 0x154, 0x156); _fx_utility_FAT_entry_write(&ram_disk, 0x156, 0x155); _fx_utility_FAT_entry_write(&ram_disk, 0x155, 0x157); - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -300,10 +300,10 @@ UINT i; pthread_create(&ptid1, NULL, &ftest_1_entry, NULL); usleep(10); pthread_join(ptid1,NULL); - + #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -316,12 +316,12 @@ UINT i; printf("ERROR!\n"); test_control_return(22); } - + /* Validate bug here. When the FAT entry spans two sectors and not flushed at the same time, the FAT chain will be like this: - 0x152->0x153->0x154->0x156->0x155(multiple sectors)->0x150(error)... + 0x152->0x153->0x154->0x156->0x155(multiple sectors)->0x150(error)... FAT entry 0x150 belongs to TEST.TXT thus the file is corrupted. */ - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -336,7 +336,7 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -347,7 +347,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -363,19 +363,19 @@ UINT i; printf("ERROR!\n"); test_control_return(33); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE tx_thread_delete(&ftest_1); #else pthread_cancel(ptid1); -#endif +#endif - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ #ifndef FX_STANDALONE_ENABLE @@ -386,7 +386,7 @@ static void ftest_1_entry(ULONG thread_input) { #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -394,7 +394,7 @@ static void ftest_1_entry(ULONG thread_input) /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Create a file called TEST.TXT in the root directory. */ fx_file_delete(&ram_disk, "TEST2.TXT"); } @@ -402,7 +402,7 @@ static void ftest_1_entry(ULONG thread_input) static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) { static UCHAR *last_block_ptr = FX_NULL; - + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the FAT write operation after record the redo log. */ @@ -425,14 +425,14 @@ static UCHAR *last_block_ptr = FX_NULL; *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - fat_write_interrupt = FX_TRUE; - + fat_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -444,10 +444,10 @@ static UCHAR *last_block_ptr = FX_NULL; /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -461,7 +461,7 @@ static UCHAR *last_block_ptr = FX_NULL; /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -469,11 +469,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_delete_fat_multple_sectors_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Delete FAT Multiple Sectors Test...N/A\n"); + printf("FileX Test: Fault Tolerant File Delete FAT Multiple Sectors Test...N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_delete_redo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_delete_redo_log_interrupt_test.c index 2e1dfc0..2b3890d 100644 --- a/test/regression_test/filex_fault_tolerant_file_delete_redo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_delete_redo_log_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant redo LOG write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check redo log interrupt for fx_file_delete(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check redo log interrupt for fx_file_delete(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 26 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to delete TEST2.TXT; -Step7: Terminate the new thread to simulate poweroff when update the redo log; -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(undo operation); +Step7: Terminate the new thread to simulate poweroff when update the redo log; +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Check the test files. */ #ifndef FX_STANDALONE_ENABLE @@ -26,10 +26,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_delete_redo_log_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -42,17 +42,17 @@ void filex_fault_tolerant_file_delete_redo_log_interrupt_test_application_def /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -60,26 +60,26 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT log_write_interrupt = FX_FALSE; -static CHAR read_buffer[1024]; -static UINT read_buffer_size = 1024; - +static UINT log_write_interrupt = FX_FALSE; +static CHAR read_buffer[1024]; +static UINT read_buffer_size = 1024; + #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); -#endif +static void *ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -93,15 +93,15 @@ void filex_fault_tolerant_file_delete_redo_log_interrupt_test_application_def #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -110,7 +110,7 @@ void filex_fault_tolerant_file_delete_redo_log_interrupt_test_application_def cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -130,71 +130,71 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Delete Redo LOG Interrupt Test....."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -216,7 +216,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -236,13 +236,13 @@ UINT i; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -253,7 +253,7 @@ UINT i; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -264,7 +264,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -275,7 +275,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -286,7 +286,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -302,13 +302,13 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -319,7 +319,7 @@ UINT i; status = fx_file_write(&my_file, " 012345678901234567890123\n", 26); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -330,7 +330,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -341,7 +341,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); @@ -352,7 +352,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -368,13 +368,13 @@ UINT i; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -385,7 +385,7 @@ UINT i; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -396,7 +396,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -407,7 +407,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -418,17 +418,17 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -444,7 +444,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -456,9 +456,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(22); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -473,40 +473,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -517,40 +517,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -561,18 +561,18 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -583,7 +583,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -594,12 +594,12 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(35); - } + } /* Close the media. */ status = fx_media_close(&ram_disk); @@ -610,7 +610,7 @@ UINT i; printf("ERROR!\n"); test_control_return(36); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -618,12 +618,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -636,7 +636,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -644,14 +644,14 @@ static void ftest_1_entry(ULONG thread_input) /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Create a file called TEST2.TXT in the root directory. */ fx_file_delete(&ram_disk, "TEST2.TXT"); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) { - + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the redo log write operation. */ @@ -662,14 +662,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - log_write_interrupt = FX_TRUE; - + log_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -681,10 +681,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -698,7 +698,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -706,11 +706,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_delete_redo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Delete Redo LOG Interrupt Test.....N/A\n"); + printf("FileX Test: Fault Tolerant File Delete Redo LOG Interrupt Test.....N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_delete_test.c b/test/regression_test/filex_fault_tolerant_file_delete_test.c index 9298bb3..0ea965f 100644 --- a/test/regression_test/filex_fault_tolerant_file_delete_test.c +++ b/test/regression_test/filex_fault_tolerant_file_delete_test.c @@ -14,7 +14,7 @@ #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_delete_test_application_define(void *first_unused_memory); @@ -33,7 +33,7 @@ void filex_fault_tolerant_file_delete_test_application_define(void *first_unuse static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; @@ -48,7 +48,7 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT fat_write_interrupt = FX_FALSE; static CHAR read_buffer[1024]; static UINT read_buffer_size = 1024; @@ -61,7 +61,7 @@ static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); +static void * ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); extern void test_control_return(UINT status); @@ -147,52 +147,52 @@ static void ftest_0_entry(ULONG thread_input) _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track } /* Determine if the format had an error. */ @@ -297,7 +297,7 @@ static void ftest_0_entry(ULONG thread_input) /* Create the main thread. */ tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, thread_buffer, DEMO_STACK_SIZE, - 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); + 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif /* directory_write_interrupt */ fat_write_interrupt = FX_FALSE; @@ -308,7 +308,7 @@ static void ftest_0_entry(ULONG thread_input) #else pthread_create(&ptid1, NULL, &ftest_1_entry, NULL); usleep(10); - pthread_join(ptid1,NULL); + pthread_join(ptid1,NULL); #endif /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -336,7 +336,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif UINT status; @@ -378,7 +378,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -407,7 +407,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) diff --git a/test/regression_test/filex_fault_tolerant_file_delete_undo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_delete_undo_log_interrupt_test.c index 0fe941a..049e0d1 100644 --- a/test/regression_test/filex_fault_tolerant_file_delete_undo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_delete_undo_log_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant undo LOG write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check undo log interrupt for fx_file_delete(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check undo log interrupt for fx_file_delete(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 26 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to delete TEST2.TXT; -Step7: Terminate the new thread to simulate poweroff when update the undo log; -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(undo operation); +Step7: Terminate the new thread to simulate poweroff when update the undo log; +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Check the test files. */ #ifndef FX_STANDALONE_ENABLE @@ -26,10 +26,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_delete_undo_log_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -40,17 +40,17 @@ void filex_fault_tolerant_file_delete_undo_log_interrupt_test_application_def /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -58,26 +58,26 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT log_write_interrupt = FX_FALSE; -static CHAR read_buffer[1024]; -static UINT read_buffer_size = 1024; - +static UINT log_write_interrupt = FX_FALSE; +static CHAR read_buffer[1024]; +static UINT read_buffer_size = 1024; + #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); -#endif +static void *ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -91,15 +91,15 @@ void filex_fault_tolerant_file_delete_undo_log_interrupt_test_application_def #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -108,7 +108,7 @@ void filex_fault_tolerant_file_delete_undo_log_interrupt_test_application_def cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -128,71 +128,71 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Delete Undo LOG Interrupt Test....."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -214,7 +214,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -234,13 +234,13 @@ UINT i; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -251,7 +251,7 @@ UINT i; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -262,7 +262,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -273,7 +273,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -284,7 +284,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -300,13 +300,13 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -317,7 +317,7 @@ UINT i; status = fx_file_write(&my_file, " 012345678901234567890123\n", 26); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -328,7 +328,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -339,7 +339,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); @@ -350,7 +350,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -366,13 +366,13 @@ UINT i; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -383,7 +383,7 @@ UINT i; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -394,7 +394,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -405,7 +405,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -416,17 +416,17 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -442,7 +442,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -454,9 +454,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(22); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -471,40 +471,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -515,40 +515,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -559,18 +559,18 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -581,7 +581,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -592,12 +592,12 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(35); - } + } /* Close the media. */ status = fx_media_close(&ram_disk); @@ -608,7 +608,7 @@ UINT i; printf("ERROR!\n"); test_control_return(36); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -616,12 +616,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -634,7 +634,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -642,14 +642,14 @@ static void ftest_1_entry(ULONG thread_input) /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Create a file called TEST2.TXT in the root directory. */ fx_file_delete(&ram_disk, "TEST2.TXT"); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) { - + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the undo log write operation. */ @@ -660,14 +660,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - log_write_interrupt = FX_TRUE; - + log_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -679,10 +679,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -696,7 +696,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -704,11 +704,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_delete_undo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Delete Undo LOG Interrupt Test.....N/A\n"); + printf("FileX Test: Fault Tolerant File Delete Undo LOG Interrupt Test.....N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_random_seek_test.c b/test/regression_test/filex_fault_tolerant_file_random_seek_test.c index d28bd37..6f7d8af 100644 --- a/test/regression_test/filex_fault_tolerant_file_random_seek_test.c +++ b/test/regression_test/filex_fault_tolerant_file_random_seek_test.c @@ -12,7 +12,7 @@ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" #else -#include +#include #endif #include "fx_api.h" #include "fx_system.h" diff --git a/test/regression_test/filex_fault_tolerant_file_rename_directory_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_rename_directory_interrupt_test.c index a389201..ad3fb5d 100644 --- a/test/regression_test/filex_fault_tolerant_file_rename_directory_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_rename_directory_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check directory interrupt for fx_file_rename(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check directory interrupt for fx_file_rename(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 26 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to rename TEST2.TXT to TEST21.TXT; -Step7: Terminate the new thread to simulate poweroff when update the directory after record the redo log. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(redo operation); +Step7: Terminate the new thread to simulate poweroff when update the directory after record the redo log. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(redo operation); Step10: Check the test files. */ @@ -27,10 +27,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_rename_directory_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -43,17 +43,17 @@ void filex_fault_tolerant_file_rename_directory_interrupt_test_application_de /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -61,27 +61,27 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; static UINT directory_write_interrupt = FX_FALSE; -static CHAR read_buffer[1024]; -static UINT read_buffer_size = 1024; - +static CHAR read_buffer[1024]; +static UINT read_buffer_size = 1024; + #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); -#endif +static void *ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -95,15 +95,15 @@ void filex_fault_tolerant_file_rename_directory_interrupt_test_application_de #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -112,7 +112,7 @@ void filex_fault_tolerant_file_rename_directory_interrupt_test_application_de cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -132,71 +132,71 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Rename DIR Interrupt Test.........."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -218,7 +218,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -238,13 +238,13 @@ UINT i; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -255,7 +255,7 @@ UINT i; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -266,7 +266,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -277,7 +277,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -288,7 +288,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -304,13 +304,13 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -321,7 +321,7 @@ UINT i; status = fx_file_write(&my_file, " 012345678901234567890123\n", 26); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -332,7 +332,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -343,7 +343,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); @@ -354,7 +354,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -370,13 +370,13 @@ UINT i; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -387,7 +387,7 @@ UINT i; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -398,7 +398,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -409,7 +409,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -420,17 +420,17 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); - } - + } + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -446,7 +446,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -460,7 +460,7 @@ UINT i; test_control_return(22); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -475,40 +475,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -519,40 +519,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -563,40 +563,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST21.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -612,7 +612,7 @@ UINT i; printf("ERROR!\n"); test_control_return(36); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -621,12 +621,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -639,7 +639,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -656,7 +656,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ { FX_PARAMETER_NOT_USED(block_ptr); - + /* Interrupt the directory write operation after record the redo log. */ if ((sector_type == FX_DIRECTORY_SECTOR) && (_filex_fault_tolerant_log_check(media_ptr) & FX_FAULT_TOLERANT_LOG_REDO_DONE)) { @@ -665,14 +665,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt = FX_TRUE; + directory_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -684,10 +684,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -701,7 +701,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -709,11 +709,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_rename_directory_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Rename DIR Interrupt Test..........N/A\n"); + printf("FileX Test: Fault Tolerant File Rename DIR Interrupt Test..........N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_rename_redo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_rename_redo_log_interrupt_test.c index 6f8909a..e32f2d1 100644 --- a/test/regression_test/filex_fault_tolerant_file_rename_redo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_rename_redo_log_interrupt_test.c @@ -1,16 +1,16 @@ /* This FileX test concentrates on the Fault-Tolerant redo LOG write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check redo log interrupt for fx_file_rename(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check redo log interrupt for fx_file_rename(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 26 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to rename TEST2.TXT to TEST21.TXT; -Step7: Terminate the new thread to simulate poweroff when update the redo log. -Step8: Open the media; +Step7: Terminate the new thread to simulate poweroff when update the redo log. +Step8: Open the media; Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Check the test files. */ @@ -27,10 +27,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_rename_redo_log_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -43,17 +43,17 @@ void filex_fault_tolerant_file_rename_redo_log_interrupt_test_application_def /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -61,27 +61,27 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; static UINT log_write_interrupt = FX_FALSE; -static CHAR read_buffer[1024]; -static UINT read_buffer_size = 1024; - +static CHAR read_buffer[1024]; +static UINT read_buffer_size = 1024; + #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); -#endif +static void *ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -95,15 +95,15 @@ void filex_fault_tolerant_file_rename_redo_log_interrupt_test_application_def #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -112,7 +112,7 @@ void filex_fault_tolerant_file_rename_redo_log_interrupt_test_application_def cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -132,71 +132,71 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Rename Redo LOG Interrupt Test....."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -218,7 +218,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -238,13 +238,13 @@ UINT i; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -255,7 +255,7 @@ UINT i; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -266,7 +266,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -277,7 +277,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -288,7 +288,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -304,13 +304,13 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -321,7 +321,7 @@ UINT i; status = fx_file_write(&my_file, " 012345678901234567890123\n", 26); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -332,7 +332,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -343,7 +343,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); @@ -354,7 +354,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -370,13 +370,13 @@ UINT i; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -387,7 +387,7 @@ UINT i; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -398,7 +398,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -409,7 +409,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -420,17 +420,17 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); - } - + } + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -446,7 +446,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -460,7 +460,7 @@ UINT i; test_control_return(22); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -475,40 +475,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -519,40 +519,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -563,40 +563,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -612,7 +612,7 @@ UINT i; printf("ERROR!\n"); test_control_return(36); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -620,12 +620,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -638,7 +638,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -653,7 +653,7 @@ static void ftest_1_entry(ULONG thread_input) static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) { - + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the redo log write operation. */ @@ -664,14 +664,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - log_write_interrupt = FX_TRUE; + log_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -683,10 +683,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -700,7 +700,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -708,11 +708,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_rename_redo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Rename Redo LOG Interrupt Test.....N/A\n"); + printf("FileX Test: Fault Tolerant File Rename Redo LOG Interrupt Test.....N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_seek_test.c b/test/regression_test/filex_fault_tolerant_file_seek_test.c index 385753d..7232250 100644 --- a/test/regression_test/filex_fault_tolerant_file_seek_test.c +++ b/test/regression_test/filex_fault_tolerant_file_seek_test.c @@ -1,21 +1,21 @@ /* This FileX test concentrates on the Fault-Tolerant file seek operation. */ /* -1. Format and open the media; -2. Enable fault tolerant feature; -3. Create and write 1024 bytes into TEST.TXT; +1. Format and open the media; +2. Enable fault tolerant feature; +3. Create and write 1024 bytes into TEST.TXT; 4. Seek to the beginning of the file; 5. Write 640 bytes into TEST.TXT; 6. Verify the data; -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" #endif -#include "fx_api.h" +#include "fx_api.h" #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_seek_test_application_define(void *first_unused_memory); @@ -33,27 +33,27 @@ void filex_fault_tolerant_file_seek_test_application_define(void *first_unuse /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - -static UCHAR cache_buffer[CACHE_SIZE]; -static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; + +static UCHAR cache_buffer[CACHE_SIZE]; +static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; static UCHAR *thread_buffer; -static CHAR write_buffer[2][TOTAL_SIZE]; -static CHAR read_buffer[TOTAL_SIZE]; - +static CHAR write_buffer[2][TOTAL_SIZE]; +static CHAR read_buffer[TOTAL_SIZE]; + #define TEST_COUNT 3 /* FAT12, 16, 32. */ /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); +extern void test_control_return(UINT status); @@ -65,15 +65,15 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_seek_test_application_define(void *first_unused_memory) #endif { - -#ifndef FX_STANDALONE_ENABLE + +#ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -98,7 +98,7 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; UINT j; @@ -106,7 +106,7 @@ UINT j; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Seek Test.........................."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { @@ -121,64 +121,64 @@ UINT j; if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 512, // Sector size + 256, // Total sectors + 512, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 512, // Sector size + 4200 * 8, // Total sectors + 512, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 512, // Sector size + 70000 * 8, // Total sectors + 512, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } return_if_fail(status == FX_SUCCESS); /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail(status == FX_SUCCESS); - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail(status == FX_SUCCESS); @@ -227,13 +227,13 @@ UINT j; /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail(status == FX_SUCCESS); - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} -#else +} +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -241,7 +241,7 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_seek_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ diff --git a/test/regression_test/filex_fault_tolerant_file_truncate_directory_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_truncate_directory_interrupt_test.c index 6af023a..391186b 100644 --- a/test/regression_test/filex_fault_tolerant_file_truncate_directory_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_truncate_directory_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check directory interrupt for fx_file_truncate(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check directory interrupt for fx_file_truncate(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 2048 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to truncate the TEST1.TXT file from 2048 to 26; -Step7: Terminate the new thread to simulate poweroff when update the directory. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(redo operation); +Step7: Terminate the new thread to simulate poweroff when update the directory. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(redo operation); Step10: Check the test files. */ @@ -27,10 +27,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_truncate_directory_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -43,17 +43,17 @@ void filex_fault_tolerant_file_truncate_directory_interrupt_test_application_ /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -61,29 +61,29 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT directory_write_interrupt = FX_FALSE; -static CHAR write_buffer[2048]; -static UINT write_buffer_size = 2048; -static CHAR read_buffer[2048]; -static UINT read_buffer_size = 2048; - +static UINT directory_write_interrupt = FX_FALSE; +static CHAR write_buffer[2048]; +static UINT write_buffer_size = 2048; +static CHAR read_buffer[2048]; +static UINT read_buffer_size = 2048; + #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); -#endif - +static void *ftest_1_entry(void * thread_input); +#endif + extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -97,15 +97,15 @@ void filex_fault_tolerant_file_truncate_directory_interrupt_test_application_ #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -114,7 +114,7 @@ void filex_fault_tolerant_file_truncate_directory_interrupt_test_application_ cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -141,64 +141,64 @@ UINT i; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Truncate DIR Interrupt Test........"); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -220,7 +220,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -240,13 +240,13 @@ UINT i; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -257,7 +257,7 @@ UINT i; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -268,7 +268,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -279,7 +279,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -290,7 +290,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -306,13 +306,13 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -323,7 +323,7 @@ UINT i; status = fx_file_write(&my_file, (void *) write_buffer, write_buffer_size); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -334,7 +334,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -345,7 +345,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != write_buffer_size)) + if ((status != FX_SUCCESS) || (actual != write_buffer_size)) { printf("ERROR!\n"); @@ -356,7 +356,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -372,13 +372,13 @@ UINT i; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -389,7 +389,7 @@ UINT i; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -400,7 +400,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -411,7 +411,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -422,17 +422,17 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -448,7 +448,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -460,9 +460,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(22); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -477,40 +477,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -521,40 +521,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -565,40 +565,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -614,7 +614,7 @@ UINT i; printf("ERROR!\n"); test_control_return(36); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -622,12 +622,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -640,7 +640,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif UINT status; @@ -654,7 +654,7 @@ UINT status; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { error_couter ++; #ifndef FX_STANDALONE_ENABLE @@ -662,7 +662,7 @@ UINT status; #else return NULL; #endif - } + } /* Truncate the "TEST1.TXT" file from 2048 to 26. */ fx_file_truncate(&my_file, 26); @@ -672,7 +672,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ { FX_PARAMETER_NOT_USED(block_ptr); - + /* Interrupt the Directory write operation after record the redo log. */ if ((sector_type == FX_DIRECTORY_SECTOR) && (_filex_fault_tolerant_log_check(media_ptr) & FX_FAULT_TOLERANT_LOG_REDO_DONE)) { @@ -681,14 +681,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt = FX_TRUE; - + directory_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -700,10 +700,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -717,7 +717,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -725,11 +725,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_truncate_directory_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Truncate DIR Interrupt Test........N/A\n"); + printf("FileX Test: Fault Tolerant File Truncate DIR Interrupt Test........N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_truncate_redo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_truncate_redo_log_interrupt_test.c index 5fa1ad5..e43ac16 100644 --- a/test/regression_test/filex_fault_tolerant_file_truncate_redo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_truncate_redo_log_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant redo log write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check redo log interrupt for fx_file_truncate(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check redo log interrupt for fx_file_truncate(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 2048 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to truncate the TEST1.TXT file from 2048 to 26; -Step7: Terminate the new thread to simulate poweroff when update the redo log. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(undo operation); +Step7: Terminate the new thread to simulate poweroff when update the redo log. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Check the test files. */ @@ -27,7 +27,7 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_truncate_redo_log_interrupt_test_application_define(void *first_unused_memory); @@ -43,17 +43,17 @@ void filex_fault_tolerant_file_truncate_redo_log_interrupt_test_application_d /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -61,29 +61,29 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_counter = 0; static UINT log_write_interrupt = FX_FALSE; -static CHAR write_buffer[2048]; -static UINT write_buffer_size = 2048; -static CHAR read_buffer[2048]; -static UINT read_buffer_size = 2048; - +static CHAR write_buffer[2048]; +static UINT write_buffer_size = 2048; +static CHAR read_buffer[2048]; +static UINT read_buffer_size = 2048; + #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); -#endif - +static void *ftest_1_entry(void * thread_input); +#endif + extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); +extern void test_control_return(UINT status); extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -97,15 +97,15 @@ void filex_fault_tolerant_file_truncate_redo_log_interrupt_test_application_d #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -114,7 +114,7 @@ void filex_fault_tolerant_file_truncate_redo_log_interrupt_test_application_d cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -134,78 +134,78 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Truncate Redo LOG Interrupt Test..."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } return_if_fail( status == FX_SUCCESS); /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Create a file called TEST.TXT in the root directory. */ @@ -267,11 +267,11 @@ UINT i; /* Close the test file. */ status = fx_file_close(&my_file); return_if_fail( status == FX_SUCCESS); - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -287,13 +287,13 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail( status == FX_SUCCESS); @@ -352,12 +352,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -370,7 +370,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif UINT status; @@ -384,7 +384,7 @@ UINT status; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { error_counter ++; #ifndef FX_STANDALONE_ENABLE @@ -392,8 +392,8 @@ UINT status; #else return NULL; #endif - } - + } + /* Truncate the "TEST1.TXT" file from 2048 to 26. */ fx_file_truncate_release(&my_file, 26); } @@ -402,7 +402,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ { FX_PARAMETER_NOT_USED(block_ptr); - + /* Interrupt the redo log write operation. */ if ((sector_type == FX_DATA_SECTOR) && (_filex_fault_tolerant_log_check(media_ptr) & FX_FAULT_TOLERANT_LOG_REDO_UPDATING)) { @@ -411,14 +411,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - log_write_interrupt = FX_TRUE; + log_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -430,10 +430,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -447,7 +447,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -455,11 +455,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_truncate_redo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Truncate Redo LOG Interrupt Test...N/A\n"); + printf("FileX Test: Fault Tolerant File Truncate Redo LOG Interrupt Test...N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_truncate_release_available_test.c b/test/regression_test/filex_fault_tolerant_file_truncate_release_available_test.c index 926e9f3..f626439 100644 --- a/test/regression_test/filex_fault_tolerant_file_truncate_release_available_test.c +++ b/test/regression_test/filex_fault_tolerant_file_truncate_release_available_test.c @@ -1,13 +1,13 @@ /* This FileX test concentrates on the Fault-Tolerant truncate release operation. */ /* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check directory interrupt for fx_file_truncate_release(): -1: Format and open the media; + +Check directory interrupt for fx_file_truncate_release(): +1: Format and open the media; 2. Create and write 4K bytes into TEST.TXT; 3. Close file and close media; 4. Open the media; -5. Enable fault tolerant feature; +5. Enable fault tolerant feature; 6. Check available bytes; 7. Truncate release to size 0 of TEST.TXT; 8. Write 4K into TEST.TXT; @@ -24,10 +24,10 @@ Check directory interrupt for fx_file_truncate_release(): #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_truncate_release_available_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -41,14 +41,14 @@ void filex_fault_tolerant_file_truncate_release_available_test_application_de /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -56,18 +56,18 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static CHAR write_buffer[FILE_SIZE]; #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); - +static void ftest_0_entry(ULONG thread_input); + extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); /* Define what the initial system looks like. */ @@ -79,15 +79,15 @@ void filex_fault_tolerant_file_truncate_release_available_test_application_de #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -96,7 +96,7 @@ void filex_fault_tolerant_file_truncate_release_available_test_application_de cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -123,64 +123,64 @@ ULONG available_bytes[3]; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Truncate Release Available Test...."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ return_if_fail(status == FX_SUCCESS); @@ -213,7 +213,7 @@ ULONG available_bytes[3]; status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail(status == FX_SUCCESS); - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail(status == FX_SUCCESS); @@ -252,7 +252,7 @@ ULONG available_bytes[3]; status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail(status == FX_SUCCESS); - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail(status == FX_SUCCESS); @@ -266,25 +266,25 @@ ULONG available_bytes[3]; /* Check available bytes. */ return_if_fail(available_bytes[0] == available_bytes[2]); - } + } /* for coverage */ /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); status += fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); status += fx_file_create(&ram_disk, "TEST.TXT"); @@ -305,20 +305,20 @@ ULONG available_bytes[3]; { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); status += fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); status += fx_file_create(&ram_disk, "TEST.TXT"); @@ -347,11 +347,11 @@ ULONG available_bytes[3]; } } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} -#else +} +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -359,7 +359,7 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_truncate_release_available_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ diff --git a/test/regression_test/filex_fault_tolerant_file_truncate_release_directory_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_truncate_release_directory_interrupt_test.c index 920b89f..40870a8 100644 --- a/test/regression_test/filex_fault_tolerant_file_truncate_release_directory_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_truncate_release_directory_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ /* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check directory interrupt for fx_file_truncate_release(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check directory interrupt for fx_file_truncate_release(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 2048 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to truncate the TEST1.TXT file from 2048 to 26; -Step7: Terminate the new thread to simulate poweroff when update the directory. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(redo operation); +Step7: Terminate the new thread to simulate poweroff when update the directory. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(redo operation); Step10: Check the test files. */ @@ -27,10 +27,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_truncate_release_directory_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -43,17 +43,17 @@ void filex_fault_tolerant_file_truncate_release_directory_interrupt_test_appl /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -61,29 +61,29 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT directory_write_interrupt = FX_FALSE; -static CHAR write_buffer[2048]; -static UINT write_buffer_size = 2048; -static CHAR read_buffer[2048]; -static UINT read_buffer_size = 2048; - +static UINT directory_write_interrupt = FX_FALSE; +static CHAR write_buffer[2048]; +static UINT write_buffer_size = 2048; +static CHAR read_buffer[2048]; +static UINT read_buffer_size = 2048; + #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); -#endif - +static void *ftest_1_entry(void * thread_input); +#endif + extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -97,15 +97,15 @@ void filex_fault_tolerant_file_truncate_release_directory_interrupt_test_appl #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -114,7 +114,7 @@ void filex_fault_tolerant_file_truncate_release_directory_interrupt_test_appl cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -134,71 +134,71 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Truncate R DIR Interrupt Test......"); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -220,7 +220,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -240,13 +240,13 @@ UINT i; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -257,7 +257,7 @@ UINT i; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -268,7 +268,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -279,7 +279,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -290,7 +290,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -306,13 +306,13 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -323,7 +323,7 @@ UINT i; status = fx_file_write(&my_file, (void *) write_buffer, write_buffer_size); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -334,7 +334,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -345,7 +345,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != write_buffer_size)) + if ((status != FX_SUCCESS) || (actual != write_buffer_size)) { printf("ERROR!\n"); @@ -356,7 +356,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -372,13 +372,13 @@ UINT i; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -389,7 +389,7 @@ UINT i; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -400,7 +400,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -411,7 +411,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -422,17 +422,17 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -448,7 +448,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -460,9 +460,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(22); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -477,40 +477,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -521,40 +521,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -565,40 +565,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -614,7 +614,7 @@ UINT i; printf("ERROR!\n"); test_control_return(36); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -622,12 +622,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -640,7 +640,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -655,7 +655,7 @@ UINT status; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { error_couter ++; #ifndef FX_STANDALONE_ENABLE @@ -663,7 +663,7 @@ UINT status; #else return NULL; #endif - } + } /* Truncate the "TEST1.TXT" file from 2048 to 26. */ fx_file_truncate_release(&my_file, 26); @@ -682,14 +682,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt = FX_TRUE; - + directory_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -701,10 +701,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -718,7 +718,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -726,7 +726,7 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_truncate_release_directory_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ diff --git a/test/regression_test/filex_fault_tolerant_file_truncate_release_fat_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_truncate_release_fat_interrupt_test.c index 020e1cc..7b60b68 100644 --- a/test/regression_test/filex_fault_tolerant_file_truncate_release_fat_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_truncate_release_fat_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant FAT write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check fat interrupt for fx_file_truncate_release(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check fat interrupt for fx_file_truncate_release(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 2048 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to truncate the TEST1.TXT file from 2048 to 26; -Step7: Terminate the new thread to simulate poweroff when update the FAT after record the redo log. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(redo operation); +Step7: Terminate the new thread to simulate poweroff when update the FAT after record the redo log. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(redo operation); Step10: Check the test files. */ @@ -27,10 +27,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_truncate_release_fat_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -43,17 +43,17 @@ void filex_fault_tolerant_file_truncate_release_fat_interrupt_test_applicatio /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -61,14 +61,14 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; static UINT fat_write_interrupt = FX_FALSE; -static CHAR write_buffer[4096]; -static UINT write_buffer_size = 4096; -static CHAR read_buffer[4096]; -static UINT read_buffer_size = 4096; - +static CHAR write_buffer[4096]; +static UINT write_buffer_size = 4096; +static CHAR read_buffer[4096]; +static UINT read_buffer_size = 4096; + #define TEST_COUNT 3 /* Define thread prototypes. */ @@ -77,13 +77,13 @@ static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); +static void * ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -97,15 +97,15 @@ void filex_fault_tolerant_file_truncate_release_fat_interrupt_test_applicatio #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -114,7 +114,7 @@ void filex_fault_tolerant_file_truncate_release_fat_interrupt_test_applicatio cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -134,71 +134,71 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Truncate R FAT Interrupt Test......"); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -220,7 +220,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -240,13 +240,13 @@ UINT i; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -257,7 +257,7 @@ UINT i; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -268,7 +268,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -279,7 +279,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -290,7 +290,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -306,13 +306,13 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -323,7 +323,7 @@ UINT i; status = fx_file_write(&my_file, (void *) write_buffer, write_buffer_size); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -334,7 +334,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -345,7 +345,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != write_buffer_size)) + if ((status != FX_SUCCESS) || (actual != write_buffer_size)) { printf("ERROR!\n"); @@ -356,7 +356,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -372,13 +372,13 @@ UINT i; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -389,7 +389,7 @@ UINT i; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -400,7 +400,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -411,7 +411,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -422,17 +422,17 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); - } - + } + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -448,7 +448,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -462,7 +462,7 @@ UINT i; test_control_return(22); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -477,40 +477,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -521,40 +521,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -565,40 +565,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -614,7 +614,7 @@ UINT i; printf("ERROR!\n"); test_control_return(36); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -622,12 +622,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -640,7 +640,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -650,12 +650,12 @@ static void ftest_1_entry(ULONG thread_input) /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { error_couter ++; #ifndef FX_STANDALONE_ENABLE @@ -663,8 +663,8 @@ static void ftest_1_entry(ULONG thread_input) #else return NULL; #endif - } - + } + /* Truncate the "TEST1.TXT" file from 1024 to 26. */ fx_file_truncate_release(&my_file, 26); } @@ -682,14 +682,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - fat_write_interrupt = FX_TRUE; + fat_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -701,10 +701,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -718,7 +718,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -726,11 +726,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_truncate_release_fat_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Truncate R FAT Interrupt Test......N/A\n"); + printf("FileX Test: Fault Tolerant File Truncate R FAT Interrupt Test......N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_truncate_release_redo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_truncate_release_redo_log_interrupt_test.c index cc874e7..8baa168 100644 --- a/test/regression_test/filex_fault_tolerant_file_truncate_release_redo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_truncate_release_redo_log_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant log write interrupt operation. */ /* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check redo log interrupt for fx_file_truncate_release(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check redo log interrupt for fx_file_truncate_release(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 2048 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to truncate TEST1.TXT file from 2048 to 26; -Step7: Terminate the new thread to simulate poweroff when update the undo log. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(undo operation); +Step7: Terminate the new thread to simulate poweroff when update the undo log. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Check the test files. */ @@ -27,7 +27,7 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_truncate_release_redo_log_interrupt_test_application_define(void *first_unused_memory); @@ -43,17 +43,17 @@ void filex_fault_tolerant_file_truncate_release_redo_log_interrupt_test_appli /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -61,29 +61,29 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; static UINT log_write_interrupt = FX_FALSE; -static CHAR write_buffer[2048]; -static UINT write_buffer_size = 2048; -static CHAR read_buffer[2048]; -static UINT read_buffer_size = 2048; - +static CHAR write_buffer[2048]; +static UINT write_buffer_size = 2048; +static CHAR read_buffer[2048]; +static UINT read_buffer_size = 2048; + #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); -#endif - +static void *ftest_1_entry(void * thread_input); +#endif + extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); +extern void test_control_return(UINT status); extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -97,15 +97,15 @@ void filex_fault_tolerant_file_truncate_release_redo_log_interrupt_test_appli #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -114,7 +114,7 @@ void filex_fault_tolerant_file_truncate_release_redo_log_interrupt_test_appli cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -134,71 +134,71 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Truncate R Redo LOG Interrupt Test."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -220,7 +220,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -240,13 +240,13 @@ UINT i; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -257,7 +257,7 @@ UINT i; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -268,7 +268,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -282,7 +282,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -293,7 +293,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -309,13 +309,13 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -326,7 +326,7 @@ UINT i; status = fx_file_write(&my_file, (void *) write_buffer, write_buffer_size); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -337,7 +337,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -351,7 +351,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != write_buffer_size)) + if ((status != FX_SUCCESS) || (actual != write_buffer_size)) { printf("ERROR!\n"); @@ -362,7 +362,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -378,13 +378,13 @@ UINT i; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -395,7 +395,7 @@ UINT i; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -406,7 +406,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -420,7 +420,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -431,17 +431,17 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -457,7 +457,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -471,7 +471,7 @@ UINT i; test_control_return(22); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -486,23 +486,23 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Clean the buffer. */ memset(read_buffer, 0, read_buffer_size); @@ -511,18 +511,18 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -533,23 +533,23 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Clean the buffer. */ memset(read_buffer, 0, read_buffer_size); @@ -558,18 +558,18 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != write_buffer_size)) + if ((status != FX_SUCCESS) || (actual != write_buffer_size)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -580,40 +580,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -629,7 +629,7 @@ UINT i; printf("ERROR!\n"); test_control_return(36); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -637,12 +637,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -655,14 +655,14 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif UINT status; FX_PARAMETER_NOT_USED(thread_input); - + /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; @@ -670,7 +670,7 @@ UINT status; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { error_couter ++; #ifndef FX_STANDALONE_ENABLE @@ -678,14 +678,14 @@ UINT status; #else return NULL; #endif - } - + } + /* Truncate the "TEST1.TXT" file from 2048 to 26. */ fx_file_truncate_release(&my_file, 26); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) -{ +{ FX_PARAMETER_NOT_USED(block_ptr); @@ -697,14 +697,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - log_write_interrupt = FX_TRUE; + log_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -716,10 +716,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -733,7 +733,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -741,11 +741,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_truncate_release_redo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Truncate R Redo LOG Interrupt Test.N/A\n"); + printf("FileX Test: Fault Tolerant File Truncate R Redo LOG Interrupt Test.N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_truncate_release_undo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_truncate_release_undo_log_interrupt_test.c index e12d13f..5243991 100644 --- a/test/regression_test/filex_fault_tolerant_file_truncate_release_undo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_truncate_release_undo_log_interrupt_test.c @@ -46,7 +46,7 @@ void filex_fault_tolerant_file_truncate_release_undo_log_interrupt_test_appli static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; @@ -61,7 +61,7 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; static UINT log_write_interrupt = FX_FALSE; static CHAR write_buffer[2048]; @@ -76,11 +76,11 @@ static ULONG64 sector_check_index; /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); +static void *ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); @@ -686,7 +686,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif diff --git a/test/regression_test/filex_fault_tolerant_file_write_available_test.c b/test/regression_test/filex_fault_tolerant_file_write_available_test.c index c86d323..33c0de4 100644 --- a/test/regression_test/filex_fault_tolerant_file_write_available_test.c +++ b/test/regression_test/filex_fault_tolerant_file_write_available_test.c @@ -47,7 +47,7 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; static UINT log_write_interrupt = FX_FALSE; static UINT write_index; @@ -64,11 +64,11 @@ static UINT read_buffer_size = 4096; /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); +static void *ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); extern void test_control_return(UINT status); @@ -226,7 +226,7 @@ ULONG64 available_bytes_after_write; /* Get available bytes before write. */ fx_media_extended_space_available(&ram_disk, &available_bytes_after_write); if (available_bytes_before_write != (available_bytes_after_write + - ram_disk.fx_media_fault_tolerant_clusters * ram_disk.fx_media_bytes_per_sector * ram_disk.fx_media_sectors_per_cluster)) + ram_disk.fx_media_fault_tolerant_clusters * ram_disk.fx_media_bytes_per_sector * ram_disk.fx_media_sectors_per_cluster)) { printf("ERROR!\n"); @@ -504,7 +504,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif diff --git a/test/regression_test/filex_fault_tolerant_file_write_data_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_write_data_interrupt_test.c index 9cf94bb..489361e 100644 --- a/test/regression_test/filex_fault_tolerant_file_write_data_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_write_data_interrupt_test.c @@ -13,24 +13,24 @@ For FAT 12, 16, 32, one cluster size is 1024 bytes; Test4 | | Test5 - -Check data interrupt for fx_file_write() : -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check data interrupt for fx_file_write() : +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 1500 bytes into TEST1.TXT, (two cluster); -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to continue to write 1024 data into TEST1.TXT: Test1: Seek to the file: index 0; - Test2: Seek to the file: index 1023; + Test2: Seek to the file: index 1023; Test3: Seek to the file: index 1024; - Test4: Seek to the file: index 1025; + Test4: Seek to the file: index 1025; Test5: Seek to the file: index 1500; -Step7: Terminate the new thread to simulate poweroff when write the data between undo log generated and redo log not generated. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(undo operation); +Step7: Terminate the new thread to simulate poweroff when write the data between undo log generated and redo log not generated. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Check the test files. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -40,11 +40,11 @@ Step10: Check the test files. #include #include #endif -#include "fx_api.h" +#include "fx_api.h" #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_write_data_interrupt_test_application_define(void *first_unused_memory); @@ -58,10 +58,10 @@ void filex_fault_tolerant_file_write_data_interrupt_test_application_define(v /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; @@ -75,19 +75,19 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT data_write_interrupt = FX_FALSE; -static UINT write_index; +static UINT data_write_interrupt = FX_FALSE; +static UINT write_index; static UINT data_size = 0; static UINT i; -static CHAR write_buffer[2048]; +static CHAR write_buffer[2048]; static UINT write_buffer_size = 2048; static CHAR read_buffer[4096]; -static UINT read_buffer_size = 4096; +static UINT read_buffer_size = 4096; static UCHAR data_buffer[4096]; -#define SEEK_COUNT 5 +#define SEEK_COUNT 5 #define FAT_COUNT 3 /* FAT12, 16, 32. */ #define TEST_COUNT FAT_COUNT * SEEK_COUNT @@ -97,12 +97,12 @@ static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); +static void * ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -115,16 +115,16 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_write_data_interrupt_test_application_define(void *first_unused_memory) #endif { - - + + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -133,7 +133,7 @@ void filex_fault_tolerant_file_write_data_interrupt_test_application_define(v cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -153,77 +153,77 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Write DATA Interrupt Test.........."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i < 5) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i < 10) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i < 15) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } return_if_fail( status == FX_SUCCESS); /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail( status == FX_SUCCESS); @@ -235,7 +235,7 @@ ULONG actual; return_if_fail( status == FX_SUCCESS); /* Read the bytes of the test file. */ - memset(read_buffer, 0, read_buffer_size); + memset(read_buffer, 0, read_buffer_size); status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); return_if_fail( (status == FX_SUCCESS) && (actual == 28)); @@ -256,7 +256,7 @@ ULONG actual; write_buffer[write_index] = (CHAR)rand(); /* Store the write data to compare the new data after Data write interrupt. */ - data_buffer[write_index] = (UCHAR)write_buffer[write_index]; + data_buffer[write_index] = (UCHAR)write_buffer[write_index]; data_size = 1500; } @@ -266,7 +266,7 @@ ULONG actual; return_if_fail( status == FX_SUCCESS); /* Read the bytes of the test file. */ - memset(read_buffer, 0, read_buffer_size); + memset(read_buffer, 0, read_buffer_size); status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); return_if_fail( (status == FX_SUCCESS) && (actual == data_size)); @@ -282,7 +282,7 @@ ULONG actual; return_if_fail( status == FX_SUCCESS); /* Read the bytes of the test file. */ - memset(read_buffer, 0, read_buffer_size); + memset(read_buffer, 0, read_buffer_size); status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); return_if_fail( (status == FX_SUCCESS) && (actual == 19)); @@ -292,8 +292,8 @@ ULONG actual; /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -309,13 +309,13 @@ ULONG actual; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail( status == FX_SUCCESS); @@ -325,7 +325,7 @@ ULONG actual; return_if_fail( status == FX_SUCCESS); /* Read the bytes of the test file. */ - memset(read_buffer, 0, read_buffer_size); + memset(read_buffer, 0, read_buffer_size); status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); return_if_fail((status == FX_SUCCESS) && (actual == 28) && !memcmp(read_buffer, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", actual)); @@ -339,7 +339,7 @@ ULONG actual; return_if_fail( status == FX_SUCCESS); /* Read the bytes of the test file. */ - memset(read_buffer, 0, read_buffer_size); + memset(read_buffer, 0, read_buffer_size); status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); return_if_fail((status == FX_SUCCESS) && (actual == data_size) && !memcmp(read_buffer, data_buffer, actual)); @@ -371,12 +371,12 @@ ULONG actual; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -388,7 +388,7 @@ static void ftest_1_entry(ULONG thread_input) { #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif UINT status; @@ -397,12 +397,12 @@ static void ftest_1_entry(ULONG thread_input) /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { error_couter ++; #ifndef FX_STANDALONE_ENABLE @@ -410,7 +410,7 @@ static void ftest_1_entry(ULONG thread_input) #else return NULL; #endif - } + } /* Seek to the file. FAT 12, 16, 32. */ if ((i % SEEK_COUNT) == 0) @@ -425,7 +425,7 @@ static void ftest_1_entry(ULONG thread_input) status = fx_file_seek(&my_file, 1500); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { error_couter ++; #ifndef FX_STANDALONE_ENABLE @@ -433,12 +433,12 @@ static void ftest_1_entry(ULONG thread_input) #else return NULL; #endif - } + } /* Random genearte the write data. */ for (write_index = 0; write_index < write_buffer_size; write_index ++) { - write_buffer[write_index] = (CHAR)rand(); + write_buffer[write_index] = (CHAR)rand(); } /* Write 1024 bytes to the file, then update the FAT table. (bytes should be greate than one cluster). */ @@ -458,14 +458,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - data_write_interrupt = FX_TRUE; - + data_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -477,10 +477,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -494,7 +494,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -502,11 +502,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_write_data_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Write DATA Interrupt Test..........N/A\n"); + printf("FileX Test: Fault Tolerant File Write DATA Interrupt Test..........N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_write_directory_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_write_directory_interrupt_test.c index 85e4127..3b36a5f 100644 --- a/test/regression_test/filex_fault_tolerant_file_write_directory_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_write_directory_interrupt_test.c @@ -1,4 +1,4 @@ -/* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ +/* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ /* For FAT 12, 16, 32, one cluster size is 1024 bytes; 1024 1024 1024 1024 1024 1024 @@ -13,24 +13,24 @@ For FAT 12, 16, 32, one cluster size is 1024 bytes; Test4 | | Test5 - -Check directory interrupt for fx_file_write() : -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check directory interrupt for fx_file_write() : +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 1500 bytes into TEST1.TXT, (two cluster); -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to continue to write 1024 data into TEST1.TXT: Test1: Seek to the file: index 0; - Test2: Seek to the file: index 1023; + Test2: Seek to the file: index 1023; Test3: Seek to the file: index 1024; - Test4: Seek to the file: index 1025; - Test5: Seek to the file: index 1500; -Step7: Terminate the new thread to simulate poweroff when update the directory after redo log generated. -Step8: Open the media; -Step9: Enable fault tolerant feature to cover the data(redo operation); + Test4: Seek to the file: index 1025; + Test5: Seek to the file: index 1500; +Step7: Terminate the new thread to simulate poweroff when update the directory after redo log generated. +Step8: Open the media; +Step9: Enable fault tolerant feature to cover the data(redo operation); Step10: Check the test files. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -44,10 +44,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_write_directory_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -58,17 +58,17 @@ void filex_fault_tolerant_file_write_directory_interrupt_test_application_def /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -76,35 +76,35 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT directory_write_interrupt = FX_FALSE; -static CHAR write_buffer[2048]; -static UINT write_buffer_size = 2048; -static UINT write_index; -static CHAR read_buffer[4096]; -static UINT read_buffer_size = 4096; +static UINT directory_write_interrupt = FX_FALSE; +static CHAR write_buffer[2048]; +static UINT write_buffer_size = 2048; +static UINT write_index; +static CHAR read_buffer[4096]; +static UINT read_buffer_size = 4096; static UCHAR data_buffer[4096]; static UINT data_size = 0; static UINT i; -#define SEEK_COUNT 5 +#define SEEK_COUNT 5 #define FAT_COUNT 3 /* FAT12, 16, 32. */ #define TEST_COUNT FAT_COUNT * SEEK_COUNT /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); -#endif - +static void *ftest_1_entry(void * thread_input); +#endif + extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -118,15 +118,15 @@ void filex_fault_tolerant_file_write_directory_interrupt_test_application_def #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -135,7 +135,7 @@ void filex_fault_tolerant_file_write_directory_interrupt_test_application_def cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -155,70 +155,70 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Write DIR Interrupt Test..........."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i < 5) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i < 10) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i < 15) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -240,7 +240,7 @@ ULONG actual; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -260,13 +260,13 @@ ULONG actual; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -277,7 +277,7 @@ ULONG actual; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -288,7 +288,7 @@ ULONG actual; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -299,7 +299,7 @@ ULONG actual; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -310,7 +310,7 @@ ULONG actual; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -326,19 +326,19 @@ ULONG actual; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(11); - } - + } + /* Write a string to the test file. */ /* Random genearte the write data. */ @@ -355,7 +355,7 @@ ULONG actual; status = fx_file_write(&my_file, (void *) write_buffer, data_size); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -366,18 +366,18 @@ ULONG actual; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(13); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); - - /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != data_size)) + + /* Check the file read status. */ + if ((status != FX_SUCCESS) || (actual != data_size)) { printf("ERROR!\n"); @@ -388,7 +388,7 @@ ULONG actual; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -404,13 +404,13 @@ ULONG actual; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -421,7 +421,7 @@ ULONG actual; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -432,7 +432,7 @@ ULONG actual; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -443,7 +443,7 @@ ULONG actual; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -454,7 +454,7 @@ ULONG actual; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -463,8 +463,8 @@ ULONG actual; /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -480,7 +480,7 @@ ULONG actual; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -492,9 +492,9 @@ ULONG actual; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(22); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -509,40 +509,40 @@ ULONG actual; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -553,40 +553,40 @@ ULONG actual; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ - status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); - + status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); + /* Check the file read status. FAT 12, 16, 32. */ - if ((status != FX_SUCCESS) || (actual != data_size) || memcmp(read_buffer, data_buffer, actual)) + if ((status != FX_SUCCESS) || (actual != data_size) || memcmp(read_buffer, data_buffer, actual)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -597,40 +597,40 @@ ULONG actual; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -646,7 +646,7 @@ ULONG actual; printf("ERROR!\n"); test_control_return(36); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -654,12 +654,12 @@ ULONG actual; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -672,11 +672,11 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif -UINT status; +UINT status; UINT index; FX_PARAMETER_NOT_USED(thread_input); @@ -688,7 +688,7 @@ UINT index; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { error_couter ++; #ifndef FX_STANDALONE_ENABLE @@ -696,8 +696,8 @@ UINT index; #else return NULL; #endif - } - + } + /* Seek to the file. FAT 12, 16, 32. */ if ((i % SEEK_COUNT) == 0) { @@ -706,7 +706,7 @@ UINT index; } else if ((i % SEEK_COUNT) == 1) { - status = fx_file_seek(&my_file, 1023); + status = fx_file_seek(&my_file, 1023); index = 1023; } else if ((i % SEEK_COUNT) == 2) @@ -716,17 +716,17 @@ UINT index; } else if ((i % SEEK_COUNT) == 3) { - status = fx_file_seek(&my_file, 1025); + status = fx_file_seek(&my_file, 1025); index = 1025; } else if ((i % SEEK_COUNT) == 4) { - status = fx_file_seek(&my_file, 1500); + status = fx_file_seek(&my_file, 1500); index = 1500; } /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { error_couter ++; #ifndef FX_STANDALONE_ENABLE @@ -735,11 +735,11 @@ UINT index; return NULL; #endif } - + /* Random genearte the write data. */ for (write_index = 0; write_index < write_buffer_size; write_index ++) { - write_buffer[write_index] = (CHAR)rand(); + write_buffer[write_index] = (CHAR)rand(); /* Store the write data to compare the new data after Data write interrupt. */ data_buffer[index + write_index] = (UCHAR)write_buffer[write_index]; @@ -763,14 +763,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt = FX_TRUE; - + directory_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -782,10 +782,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -799,7 +799,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -807,11 +807,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_write_directory_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Write DIR Interrupt Test...........N/A\n"); + printf("FileX Test: Fault Tolerant File Write DIR Interrupt Test...........N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_write_fat_crossover_2_test.c b/test/regression_test/filex_fault_tolerant_file_write_fat_crossover_2_test.c index 8914ad1..f80568e 100644 --- a/test/regression_test/filex_fault_tolerant_file_write_fat_crossover_2_test.c +++ b/test/regression_test/filex_fault_tolerant_file_write_fat_crossover_2_test.c @@ -4,12 +4,12 @@ * before it is flushed into media system. The design requires the FAT entries updated in reverse * order in FAT chain. Due to the FAT cache, the FAT entries may be updated in any order. * That will break the fault tolerant design. The expected issue is, the FAT chain could - * not be released completely.*/ + * not be released completely.*/ /* For FAT 32 one cluster size is 512 bytes and one sector per cluster; - -Step1: Format and open the media; -Step2: Enable fault tolerant feature; + +Step1: Format and open the media; +Step2: Enable fault tolerant feature; Step3: Create and allocate 118 clusters for A.TXT. Step6: Create a new thread and append data to A.TXT to occupy cluster 127 and 128. Step7: Terminate the new thread to simulate poweroff while writing the fat entry of cluster 127 @@ -17,7 +17,7 @@ Step7: Terminate the new thread to simulate poweroff while writing the fat entry Step8: Open the media. Step9: Enable fault tolerant feature to revert the FAT chain(revert operation). Step10: Perform media check. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -32,10 +32,10 @@ Step10: Perform media check. #include "fx_fault_tolerant.h" #include "fx_utility.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_write_fat_crossover_2_test_application_define(void *first_unused_memory); - + #ifdef FX_ENABLE_FAULT_TOLERANT #define DEMO_STACK_SIZE 4096 @@ -46,17 +46,17 @@ void filex_fault_tolerant_file_write_fat_crossover_2_test_application_define( /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -64,7 +64,7 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT fat_write_interrupt = FX_FALSE; static UCHAR scratch_memory[16 * 1024]; static UINT interrupt_count_down; @@ -72,17 +72,17 @@ static UINT interrupt_count_down; /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); -#endif +static void * ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -94,15 +94,15 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_write_fat_crossover_2_test_application_define(void *first_unused_memory) #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -111,7 +111,7 @@ void filex_fault_tolerant_file_write_fat_crossover_2_test_application_define( cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -139,20 +139,20 @@ ULONG errors_detected; printf("FileX Test: Fault Tolerant File Write Fat Crossover 2 Test........."); /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 512, // Sector size + 70000, // Total sectors + 512, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); status += fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail(FX_SUCCESS == status); @@ -160,7 +160,7 @@ ULONG errors_detected; /* One cluster for A.TXT. */ status = fx_file_create(&ram_disk, "A.TXT"); status += fx_file_open(&ram_disk, &my_file, "A.TXT", FX_OPEN_FOR_WRITE); - status += fx_file_allocate(&my_file, 512 * 118); + status += fx_file_allocate(&my_file, 512 * 118); status += fx_file_close(&my_file); return_if_fail(FX_SUCCESS == status); @@ -170,8 +170,8 @@ ULONG errors_detected; #ifndef FX_STANDALONE_ENABLE /* Create the main thread. */ - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif /* directory_write_interrupt */ @@ -179,14 +179,14 @@ ULONG errors_detected; /* Let the other thread run. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_relinquish(); + tx_thread_relinquish(); #else pthread_create(&ptid1, NULL, &ftest_1_entry, NULL); usleep(10); pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ return_if_fail(FX_TRUE == fat_write_interrupt); status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -205,10 +205,10 @@ ULONG errors_detected; #else pthread_cancel(ptid1); #endif - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -221,16 +221,16 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif UINT status; FX_PARAMETER_NOT_USED(thread_input); - /* Set the callback function to simulate poweoff operation when write FAT entry. */ + /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "A.TXT", FX_OPEN_FOR_WRITE); status += fx_file_seek(&my_file, 118 * 512); @@ -262,14 +262,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - fat_write_interrupt = FX_TRUE; + fat_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -281,10 +281,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -299,7 +299,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -307,7 +307,7 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_write_fat_crossover_2_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ diff --git a/test/regression_test/filex_fault_tolerant_file_write_fat_crossover_test.c b/test/regression_test/filex_fault_tolerant_file_write_fat_crossover_test.c index ce9450e..f8966de 100644 --- a/test/regression_test/filex_fault_tolerant_file_write_fat_crossover_test.c +++ b/test/regression_test/filex_fault_tolerant_file_write_fat_crossover_test.c @@ -4,19 +4,19 @@ * before it is flushed into media system. The design requires the FAT entries updated in reverse * order in FAT chain. Due to the FAT cache, the FAT entries may be updated in any order. * That will break the fault tolerant design. The expected issue is, the FAT chain could - * not be released completely.*/ + * not be released completely.*/ /* For FAT 32 one cluster size is 512 bytes and one sector per cluster; - -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 1M bytes into TEST.TXT; + +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 1M bytes into TEST.TXT; Step4: Create a new thread and seek to beginning of file and overwrite 64K bytes into TEST.TXT; -Step5: Terminate the new thread to simulate poweroff when write the fat after redo log generated, during FAT chain cleanup. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(undo operation); +Step5: Terminate the new thread to simulate poweroff when write the fat after redo log generated, during FAT chain cleanup. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Perform media check. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -31,10 +31,10 @@ Step10: Perform media check. #include "fx_fault_tolerant.h" #include "fx_utility.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_write_fat_crossover_test_application_define(void *first_unused_memory); - + #ifdef FX_ENABLE_FAULT_TOLERANT #define DEMO_STACK_SIZE 4096 @@ -45,17 +45,17 @@ void filex_fault_tolerant_file_write_fat_crossover_test_application_define(vo /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -63,7 +63,7 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; static UINT fat_write_interrupt = FX_FALSE; static UCHAR data_buffer[64 * 1024]; @@ -73,17 +73,17 @@ static UINT interrupt_count_down; /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); +static void * ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -97,15 +97,15 @@ void filex_fault_tolerant_file_write_fat_crossover_test_application_define(vo #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -114,7 +114,7 @@ void filex_fault_tolerant_file_write_fat_crossover_test_application_define(vo cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -142,20 +142,20 @@ ULONG errors_detected; printf("FileX Test: Fault Tolerant File Write FAT Crossover Test..........."); /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 512, // Sector size + 70000, // Total sectors + 512, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -177,7 +177,7 @@ ULONG errors_detected; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -197,13 +197,13 @@ ULONG errors_detected; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -214,7 +214,7 @@ ULONG errors_detected; status = fx_file_write(&my_file, data_buffer, sizeof(data_buffer)); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -240,11 +240,11 @@ ULONG errors_detected; printf("ERROR!\n"); test_control_return(7); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -253,13 +253,13 @@ ULONG errors_detected; /* Let the other thread run. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_relinquish(); + tx_thread_relinquish(); #else pthread_create(&ptid1, NULL, &ftest_1_entry, NULL); usleep(10); pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -273,7 +273,7 @@ ULONG errors_detected; test_control_return(22); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -303,7 +303,7 @@ ULONG errors_detected; printf("ERROR!\n"); test_control_return(36); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -312,10 +312,10 @@ ULONG errors_detected; pthread_cancel(ptid1); #endif - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -328,21 +328,21 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif UINT status; FX_PARAMETER_NOT_USED(thread_input); - /* Set the callback function to simulate poweoff operation when write FAT entry. */ + /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { error_couter ++; #ifndef FX_STANDALONE_ENABLE @@ -350,13 +350,13 @@ static void ftest_1_entry(ULONG thread_input) #else return NULL; #endif - } + } status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) - { + if (status != FX_SUCCESS) + { error_couter ++; #ifndef FX_STANDALONE_ENABLE return; @@ -368,7 +368,7 @@ static void ftest_1_entry(ULONG thread_input) interrupt_count_down = 2; /* Write 64K bytes to the file. */ - fx_file_write(&my_file, data_buffer, sizeof(data_buffer)); + fx_file_write(&my_file, data_buffer, sizeof(data_buffer)); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) @@ -388,14 +388,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - fat_write_interrupt = FX_TRUE; + fat_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -407,10 +407,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -425,7 +425,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -433,7 +433,7 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_write_fat_crossover_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ diff --git a/test/regression_test/filex_fault_tolerant_file_write_fat_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_write_fat_interrupt_test.c index da373f4..ed56b03 100644 --- a/test/regression_test/filex_fault_tolerant_file_write_fat_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_write_fat_interrupt_test.c @@ -1,4 +1,4 @@ -/* This FileX test concentrates on the Fault-Tolerant fat write interrupt operation. */ +/* This FileX test concentrates on the Fault-Tolerant fat write interrupt operation. */ /* For FAT 12, 16, 32, one cluster size is 1024 bytes; 1024 1024 1024 1024 1024 1024 @@ -13,24 +13,24 @@ For FAT 12, 16, 32, one cluster size is 1024 bytes; Test4 | | Test5 - -Check fat interrupt for fx_file_write() : -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check fat interrupt for fx_file_write() : +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 1500 bytes into TEST1.TXT, (two cluster); -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to continue to write 1024 data into TEST1.TXT: Test1: Seek to the file: index 0; - Test2: Seek to the file: index 1023; + Test2: Seek to the file: index 1023; Test3: Seek to the file: index 1024; - Test4: Seek to the file: index 1025; + Test4: Seek to the file: index 1025; Test5: Seek to the file: index 1500; -Step7: Terminate the new thread to simulate poweroff when write the fat between undo log generated and redo log not generated. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(undo operation); +Step7: Terminate the new thread to simulate poweroff when write the fat between undo log generated and redo log not generated. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Check the test files. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -44,10 +44,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_write_fat_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -61,14 +61,14 @@ void filex_fault_tolerant_file_write_fat_interrupt_test_application_define(vo static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -76,36 +76,36 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT fat_write_interrupt = FX_FALSE; -static UINT write_index; +static UINT fat_write_interrupt = FX_FALSE; +static UINT write_index; static UINT data_size = 0; static UINT i; -static CHAR write_buffer[2048]; +static CHAR write_buffer[2048]; static UINT write_buffer_size = 2048; static CHAR read_buffer[4096]; -static UINT read_buffer_size = 4096; +static UINT read_buffer_size = 4096; static UCHAR data_buffer[4096]; - -#define SEEK_COUNT 5 + +#define SEEK_COUNT 5 #define FAT_COUNT 3 /* FAT12, 16, 32. */ #define TEST_COUNT FAT_COUNT * SEEK_COUNT /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); -#ifndef FX_STANDALONE_ENABLE +static void ftest_0_entry(ULONG thread_input); +#ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); +static void * ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -119,15 +119,15 @@ void filex_fault_tolerant_file_write_fat_interrupt_test_application_define(vo #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -136,7 +136,7 @@ void filex_fault_tolerant_file_write_fat_interrupt_test_application_define(vo cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -156,70 +156,70 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Write FAT Interrupt Test..........."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i < 5) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i < 10) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i < 15) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -241,7 +241,7 @@ ULONG actual; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -261,13 +261,13 @@ ULONG actual; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -278,7 +278,7 @@ ULONG actual; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -289,7 +289,7 @@ ULONG actual; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -300,7 +300,7 @@ ULONG actual; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -311,7 +311,7 @@ ULONG actual; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -327,19 +327,19 @@ ULONG actual; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(11); } - + /* Write a string to the test file. */ /* Random genearte the write data. */ @@ -356,7 +356,7 @@ ULONG actual; status = fx_file_write(&my_file, (void *) write_buffer, data_size); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -367,18 +367,18 @@ ULONG actual; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(13); } - /* Read the bytes of the test file. */ + /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); - /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != data_size)) + /* Check the file read status. */ + if ((status != FX_SUCCESS) || (actual != data_size)) { printf("ERROR!\n"); @@ -389,7 +389,7 @@ ULONG actual; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -405,13 +405,13 @@ ULONG actual; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -422,7 +422,7 @@ ULONG actual; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -433,7 +433,7 @@ ULONG actual; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -444,7 +444,7 @@ ULONG actual; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -455,17 +455,17 @@ ULONG actual; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); - } - + } + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -481,7 +481,7 @@ ULONG actual; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -495,7 +495,7 @@ ULONG actual; test_control_return(22); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -510,40 +510,40 @@ ULONG actual; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -554,40 +554,40 @@ ULONG actual; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. FAT 12, 16, 32. */ - if ((status != FX_SUCCESS) || (actual != data_size) || memcmp(read_buffer, data_buffer, actual)) + if ((status != FX_SUCCESS) || (actual != data_size) || memcmp(read_buffer, data_buffer, actual)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -598,40 +598,40 @@ ULONG actual; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -647,7 +647,7 @@ ULONG actual; printf("ERROR!\n"); test_control_return(36); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -655,12 +655,12 @@ ULONG actual; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -669,11 +669,11 @@ static void ftest_1_entry(ULONG thread_input) #else void * ftest_1_entry(void * thread_input) #endif -{ +{ #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -681,15 +681,15 @@ static void ftest_1_entry(ULONG thread_input) FX_PARAMETER_NOT_USED(thread_input); - /* Set the callback function to simulate poweoff operation when write FAT entry. */ + /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { error_couter ++; #ifndef FX_STANDALONE_ENABLE @@ -697,8 +697,8 @@ static void ftest_1_entry(ULONG thread_input) #else return NULL; #endif - } - + } + /* Seek to the file. FAT 12, 16 and 32. */ if ((i % SEEK_COUNT) == 0) { @@ -706,7 +706,7 @@ static void ftest_1_entry(ULONG thread_input) } else if ((i % SEEK_COUNT) == 1) { - status = fx_file_seek(&my_file, 1023); + status = fx_file_seek(&my_file, 1023); } else if ((i % SEEK_COUNT) == 2) { @@ -714,16 +714,16 @@ static void ftest_1_entry(ULONG thread_input) } else if ((i % SEEK_COUNT) == 3) { - status = fx_file_seek(&my_file, 1025); + status = fx_file_seek(&my_file, 1025); } else if ((i % SEEK_COUNT) == 4) { - status = fx_file_seek(&my_file, 1500); + status = fx_file_seek(&my_file, 1500); } /* Check the file seek status. */ - if (status != FX_SUCCESS) - { + if (status != FX_SUCCESS) + { error_couter ++; #ifndef FX_STANDALONE_ENABLE return; @@ -731,15 +731,15 @@ static void ftest_1_entry(ULONG thread_input) return NULL; #endif } - + /* Random genearte the write data. */ for (write_index = 0; write_index < write_buffer_size; write_index ++) { - write_buffer[write_index] = (CHAR)rand(); + write_buffer[write_index] = (CHAR)rand(); } /* Write 1024 bytes to the file, then update the FAT table. (bytes should be greate than one cluster). */ - fx_file_write(&my_file, (void *) write_buffer, write_buffer_size); + fx_file_write(&my_file, (void *) write_buffer, write_buffer_size); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) @@ -755,14 +755,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - fat_write_interrupt = FX_TRUE; + fat_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -774,10 +774,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -791,7 +791,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -799,11 +799,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_write_fat_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Write FAT Interrupt Test...........N/A\n"); + printf("FileX Test: Fault Tolerant File Write FAT Interrupt Test...........N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_write_redo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_write_redo_log_interrupt_test.c index de499a2..62a1362 100644 --- a/test/regression_test/filex_fault_tolerant_file_write_redo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_write_redo_log_interrupt_test.c @@ -1,4 +1,4 @@ -/* This FileX test concentrates on the Fault-Tolerant redo log write interrupt operation. */ +/* This FileX test concentrates on the Fault-Tolerant redo log write interrupt operation. */ /* For FAT 12, 16, 32, one cluster size is 1024 bytes; 1024 1024 1024 1024 1024 1024 @@ -13,24 +13,24 @@ For FAT 12, 16, 32, one cluster size is 1024 bytes; Test4 | | Test5 - -Check redo interrupt for fx_file_write() : -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check redo interrupt for fx_file_write() : +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 1500 bytes into TEST1.TXT, (two cluster); -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to continue to write 1024 data into TEST1.TXT: Test1: Seek to the file: index 0; - Test2: Seek to the file: index 1023; + Test2: Seek to the file: index 1023; Test3: Seek to the file: index 1024; - Test4: Seek to the file: index 1025; + Test4: Seek to the file: index 1025; Test5: Seek to the file: index 1500; -Step7: Terminate the new thread to simulate poweroff when write redo log. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(undo operation); +Step7: Terminate the new thread to simulate poweroff when write redo log. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Check the test files. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -44,7 +44,7 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_write_redo_log_interrupt_test_application_define(void *first_unused_memory); @@ -60,17 +60,17 @@ void filex_fault_tolerant_file_write_redo_log_interrupt_test_application_defi /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -78,34 +78,34 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; static UINT log_write_interrupt = FX_FALSE; -static CHAR write_buffer[2048]; -static UINT write_buffer_size = 2048; -static UINT write_index; -static CHAR read_buffer[4096]; -static UINT read_buffer_size = 4096; +static CHAR write_buffer[2048]; +static UINT write_buffer_size = 2048; +static UINT write_index; +static CHAR read_buffer[4096]; +static UINT read_buffer_size = 4096; static UCHAR data_buffer[4096]; static UINT data_size = 0; static UINT i; - -#define SEEK_COUNT 5 + +#define SEEK_COUNT 5 #define FAT_COUNT 3 /* FAT12, 16, 32. */ #define TEST_COUNT FAT_COUNT * SEEK_COUNT /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); -#endif +static void *ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -119,15 +119,15 @@ void filex_fault_tolerant_file_write_redo_log_interrupt_test_application_defi #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -136,7 +136,7 @@ void filex_fault_tolerant_file_write_redo_log_interrupt_test_application_defi cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -156,70 +156,70 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Write Redo LOG Interrupt Test......"); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i < 5) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i < 10) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i < 15) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -241,7 +241,7 @@ ULONG actual; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -261,13 +261,13 @@ ULONG actual; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -278,7 +278,7 @@ ULONG actual; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -289,7 +289,7 @@ ULONG actual; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -300,7 +300,7 @@ ULONG actual; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -311,7 +311,7 @@ ULONG actual; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -327,19 +327,19 @@ ULONG actual; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(11); } - + /* Write a string to the test file. */ /* Random genearte the write data. */ @@ -356,7 +356,7 @@ ULONG actual; status = fx_file_write(&my_file, (void *) write_buffer, data_size); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -367,7 +367,7 @@ ULONG actual; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -376,9 +376,9 @@ ULONG actual; /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); - - /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != data_size)) + + /* Check the file read status. */ + if ((status != FX_SUCCESS) || (actual != data_size)) { printf("ERROR!\n"); @@ -389,7 +389,7 @@ ULONG actual; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -405,13 +405,13 @@ ULONG actual; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -422,7 +422,7 @@ ULONG actual; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -433,7 +433,7 @@ ULONG actual; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -444,7 +444,7 @@ ULONG actual; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -455,17 +455,17 @@ ULONG actual; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -481,7 +481,7 @@ ULONG actual; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -495,7 +495,7 @@ ULONG actual; test_control_return(22); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -510,40 +510,40 @@ ULONG actual; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -554,40 +554,40 @@ ULONG actual; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); - + /* Check the file read status. FAT 12, 16, 32. */ - if ((status != FX_SUCCESS) || (actual != data_size) || memcmp(read_buffer, data_buffer, actual)) + if ((status != FX_SUCCESS) || (actual != data_size) || memcmp(read_buffer, data_buffer, actual)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -598,40 +598,40 @@ ULONG actual; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -647,7 +647,7 @@ ULONG actual; printf("ERROR!\n"); test_control_return(36); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -655,9 +655,9 @@ ULONG actual; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); } @@ -673,7 +673,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -688,7 +688,7 @@ UINT status; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { error_couter ++; #ifndef FX_STANDALONE_ENABLE @@ -696,8 +696,8 @@ UINT status; #else return NULL; #endif - } - + } + /* Seek to the file. FAT 12, 16, 32. */ if ((i % SEEK_COUNT) == 0) status = fx_file_seek(&my_file, 0); @@ -711,7 +711,7 @@ UINT status; status = fx_file_seek(&my_file, 1500); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { error_couter ++; #ifndef FX_STANDALONE_ENABLE @@ -720,11 +720,11 @@ UINT status; return NULL; #endif } - + /* Random genearte the write data. */ for (write_index = 0; write_index < write_buffer_size; write_index ++) { - write_buffer[write_index] = (CHAR)rand(); + write_buffer[write_index] = (CHAR)rand(); } /* Write 1024 bytes to the file, then update the FAT table. (bytes should be greate than one cluster). */ @@ -733,7 +733,7 @@ UINT status; static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) { - + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the redo log write operation. */ @@ -744,14 +744,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - log_write_interrupt = FX_TRUE; + log_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -763,10 +763,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -780,7 +780,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -788,11 +788,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_write_redo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Write Redo LOG Interrupt Test......N/A\n"); + printf("FileX Test: Fault Tolerant File Write Redo LOG Interrupt Test......N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_file_write_undo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_file_write_undo_log_interrupt_test.c index 51b59b6..6230ab1 100644 --- a/test/regression_test/filex_fault_tolerant_file_write_undo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_file_write_undo_log_interrupt_test.c @@ -1,4 +1,4 @@ -/* This FileX test concentrates on the Fault-Tolerant undo log write interrupt operation. */ +/* This FileX test concentrates on the Fault-Tolerant undo log write interrupt operation. */ /* For FAT 12, 16, 32, one cluster size is 1024 bytes; 1024 1024 1024 1024 1024 1024 @@ -13,24 +13,24 @@ For FAT 12, 16, 32, one cluster size is 1024 bytes; Test4 | | Test5 - -Check undo interrupt for fx_file_write() : -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check undo interrupt for fx_file_write() : +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 1500 bytes into TEST1.TXT, (two cluster); -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to continue to write 1024 data into TEST1.TXT: Test1: Seek to the file: index 0; - Test2: Seek to the file: index 1023; + Test2: Seek to the file: index 1023; Test3: Seek to the file: index 1024; - Test4: Seek to the file: index 1025; + Test4: Seek to the file: index 1025; Test5: Seek to the file: index 1500; -Step7: Terminate the new thread to simulate poweroff when write undo log. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(undo operation); +Step7: Terminate the new thread to simulate poweroff when write undo log. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Check the test files. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -44,7 +44,7 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_file_write_undo_log_interrupt_test_application_define(void *first_unused_memory); @@ -60,7 +60,7 @@ void filex_fault_tolerant_file_write_undo_log_interrupt_test_application_defi /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else static pthread_t ptid1; @@ -70,7 +70,7 @@ static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -78,34 +78,34 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; static UINT log_write_interrupt = FX_FALSE; -static UINT write_index; -static CHAR write_buffer[2048]; +static UINT write_index; +static CHAR write_buffer[2048]; static UINT write_buffer_size = 2048; static CHAR read_buffer[4096]; -static UINT read_buffer_size = 4096; +static UINT read_buffer_size = 4096; static UCHAR data_buffer[4096]; static UINT data_size = 0; static UINT i; - -#define SEEK_COUNT 5 + +#define SEEK_COUNT 5 #define FAT_COUNT 3 /* FAT12, 16, 32. */ #define TEST_COUNT FAT_COUNT * SEEK_COUNT /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); -#endif +static void *ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -119,15 +119,15 @@ void filex_fault_tolerant_file_write_undo_log_interrupt_test_application_defi #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -136,7 +136,7 @@ void filex_fault_tolerant_file_write_undo_log_interrupt_test_application_defi cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -156,70 +156,70 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Write Undo LOG Interrupt Test......"); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i < 5) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i < 10) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i < 15) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -241,7 +241,7 @@ ULONG actual; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -261,13 +261,13 @@ ULONG actual; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -278,7 +278,7 @@ ULONG actual; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -289,7 +289,7 @@ ULONG actual; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -300,7 +300,7 @@ ULONG actual; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -311,7 +311,7 @@ ULONG actual; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -327,19 +327,19 @@ ULONG actual; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(11); } - + /* Write a string to the test file. */ /* Random genearte the write data. */ @@ -356,7 +356,7 @@ ULONG actual; status = fx_file_write(&my_file, (void *) write_buffer, data_size); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -367,7 +367,7 @@ ULONG actual; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -376,9 +376,9 @@ ULONG actual; /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); - - /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != data_size)) + + /* Check the file read status. */ + if ((status != FX_SUCCESS) || (actual != data_size)) { printf("ERROR!\n"); @@ -389,7 +389,7 @@ ULONG actual; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -405,13 +405,13 @@ ULONG actual; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -422,7 +422,7 @@ ULONG actual; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -433,7 +433,7 @@ ULONG actual; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -444,7 +444,7 @@ ULONG actual; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -455,17 +455,17 @@ ULONG actual; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -481,7 +481,7 @@ ULONG actual; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -495,7 +495,7 @@ ULONG actual; test_control_return(22); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -510,40 +510,40 @@ ULONG actual; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -554,40 +554,40 @@ ULONG actual; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); - + /* Check the file read status. FAT 12, 16, 32. */ - if ((status != FX_SUCCESS) || (actual != data_size) || memcmp(read_buffer, data_buffer, actual)) + if ((status != FX_SUCCESS) || (actual != data_size) || memcmp(read_buffer, data_buffer, actual)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -598,40 +598,40 @@ ULONG actual; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -647,7 +647,7 @@ ULONG actual; printf("ERROR!\n"); test_control_return(36); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -655,12 +655,12 @@ ULONG actual; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -673,7 +673,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -688,7 +688,7 @@ UINT status; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { error_couter ++; #ifndef FX_STANDALONE_ENABLE @@ -696,8 +696,8 @@ UINT status; #else return NULL; #endif - } - + } + /* Seek to the file. FAT 12, 16, 32. */ if ((i % SEEK_COUNT) == 0) status = fx_file_seek(&my_file, 0); @@ -711,7 +711,7 @@ UINT status; status = fx_file_seek(&my_file, 1500); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { error_couter ++; #ifndef FX_STANDALONE_ENABLE @@ -720,11 +720,11 @@ UINT status; return NULL; #endif } - + /* Random genearte the write data. */ for (write_index = 0; write_index < write_buffer_size; write_index ++) { - write_buffer[write_index] = (CHAR)rand(); + write_buffer[write_index] = (CHAR)rand(); } /* Write 1024 bytes to the file, then update the FAT table. (bytes should be greate than one cluster). */ @@ -733,7 +733,7 @@ UINT status; static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) { - + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the undo log write operation. */ @@ -744,14 +744,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - log_write_interrupt = FX_TRUE; + log_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -763,10 +763,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -780,7 +780,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -788,11 +788,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_file_write_undo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Write Undo LOG Interrupt Test......N/A\n"); + printf("FileX Test: Fault Tolerant File Write Undo LOG Interrupt Test......N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_log_full_test.c b/test/regression_test/filex_fault_tolerant_log_full_test.c index 962218e..cea3c45 100644 --- a/test/regression_test/filex_fault_tolerant_log_full_test.c +++ b/test/regression_test/filex_fault_tolerant_log_full_test.c @@ -40,7 +40,7 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static CHAR write_buffer[2048]; static UINT i; diff --git a/test/regression_test/filex_fault_tolerant_log_recover_directory_test.c b/test/regression_test/filex_fault_tolerant_log_recover_directory_test.c index aac38d7..8038a89 100644 --- a/test/regression_test/filex_fault_tolerant_log_recover_directory_test.c +++ b/test/regression_test/filex_fault_tolerant_log_recover_directory_test.c @@ -7,20 +7,20 @@ For FAT 12, 16, 32, one cluster size is 1024 bytes; | TEST.TXT | TEST1.TXT | TEST2.TXT | | | | |------------|------------|-----------|------------|------------|------------| 28 1000 19 - -Check recover directory operation: -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Write 28 bytes into TEST.TXT; + +Check recover directory operation: +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Write 28 bytes into TEST.TXT; Step4: Write 1000 bytes into TEST1.TXT; -Step5: Write 19 bytes into TEST2.TXT; +Step5: Write 19 bytes into TEST2.TXT; Step6: Create new thread to continue to write 2048 data into TEST1.TXT(greater than one cluster): Step7: Terminate the new thread to simulate poweroff when update the directory into media and the redo log has been generated. Step8: Create new thread and enable fault tolerant feature to recover the data(redo operation); Step9: Terminate the new thread to simulate poweroff when recover the directory; Step10: Open the media and enable fault tolerant feature to recover the data(redo operation); Step11: Check the test files. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -30,11 +30,11 @@ Step11: Check the test files. #include #include #endif -#include "fx_api.h" +#include "fx_api.h" #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_log_recover_directory_test_application_define(void *first_unused_memory); @@ -48,19 +48,19 @@ void filex_fault_tolerant_log_recover_directory_test_application_define(void /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; static TX_THREAD ftest_2; -#else -static pthread_t ptid1; -static pthread_t ptid2; -#endif +#else +static pthread_t ptid1; +static pthread_t ptid2; +#endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -71,32 +71,32 @@ static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; #endif static UINT error_couter = 0; -static UINT directory_write_interrupt_1 = FX_FALSE; -static UINT directory_write_interrupt_2 = FX_FALSE; -static CHAR write_buffer[4096]; +static UINT directory_write_interrupt_1 = FX_FALSE; +static UINT directory_write_interrupt_2 = FX_FALSE; +static CHAR write_buffer[4096]; static UINT write_buffer_size = 4096; -static UINT write_index; -static CHAR read_buffer[4096]; -static UINT read_buffer_size = 4096; +static UINT write_index; +static CHAR read_buffer[4096]; +static UINT read_buffer_size = 4096; static UINT i; - + #define TEST_COUNT 3 /* FAT12, 16, 32. */ /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); -#ifndef FX_STANDALONE_ENABLE -static void ftest_1_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); +#ifndef FX_STANDALONE_ENABLE +static void ftest_1_entry(ULONG thread_input); static void ftest_2_entry(ULONG thread_input); -#else -static void * ftest_1_entry(void * thread_input); -static void * ftest_2_entry(void * thread_input); -#endif +#else +static void * ftest_1_entry(void * thread_input); +static void * ftest_2_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); -static UINT my_driver_write_1(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +static UINT my_driver_write_1(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write_2(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -109,16 +109,16 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_log_recover_directory_test_application_define(void *first_unused_memory) #endif { - - + + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -127,7 +127,7 @@ void filex_fault_tolerant_log_recover_directory_test_application_define(void cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_1_buffer = pointer; pointer += DEMO_STACK_SIZE; thread_2_buffer = pointer; @@ -149,74 +149,74 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Log Recover DIR Test...................."); - + /* Random genearte the write data. */ for (write_index = 0; write_index < write_buffer_size; write_index ++) write_buffer[write_index] = (CHAR)rand(); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -238,7 +238,7 @@ ULONG actual; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -258,13 +258,13 @@ ULONG actual; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -275,7 +275,7 @@ ULONG actual; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -286,21 +286,21 @@ ULONG actual; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(7); - } + } /* Clean the buffer. */ - memset(read_buffer, 0, read_buffer_size); + memset(read_buffer, 0, read_buffer_size); /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -311,7 +311,7 @@ ULONG actual; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -327,13 +327,13 @@ ULONG actual; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -344,7 +344,7 @@ ULONG actual; status = fx_file_write(&my_file, (void *) write_buffer, 1000); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -355,21 +355,21 @@ ULONG actual; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(13); - } + } /* Clean the buffer. */ - memset(read_buffer, 0, read_buffer_size); + memset(read_buffer, 0, read_buffer_size); /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 1000)) + if ((status != FX_SUCCESS) || (actual != 1000)) { printf("ERROR!\n"); @@ -380,7 +380,7 @@ ULONG actual; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -396,13 +396,13 @@ ULONG actual; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -413,7 +413,7 @@ ULONG actual; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -424,21 +424,21 @@ ULONG actual; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(19); - } + } /* Clean the buffer. */ - memset(read_buffer, 0, read_buffer_size); + memset(read_buffer, 0, read_buffer_size); /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -449,7 +449,7 @@ ULONG actual; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -458,8 +458,8 @@ ULONG actual; /* Create the new thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_1_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_1_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif /* directory_write_interrupt */ @@ -472,7 +472,7 @@ ULONG actual; pthread_create(&ptid1, NULL, &ftest_1_entry, NULL); usleep(10); pthread_join(ptid1,NULL); - + #endif /* Delete the thread. */ @@ -480,14 +480,14 @@ ULONG actual; tx_thread_delete(&ftest_1); /* Create the new thread. */ - tx_thread_create(&ftest_2, "thread 2", ftest_2_entry, 0, - thread_2_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_2, "thread 2", ftest_2_entry, 0, + thread_2_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #else pthread_cancel(ptid1); #endif /* directory_write_interrupt */ - directory_write_interrupt_2 = FX_FALSE; + directory_write_interrupt_2 = FX_FALSE; /* Let the other thread run. */ #ifndef FX_STANDALONE_ENABLE @@ -496,7 +496,7 @@ ULONG actual; pthread_create(&ptid2, NULL, &ftest_2_entry, NULL); usleep(10); pthread_join(ptid2,NULL); - + #endif /* Recover the log again. */ @@ -513,7 +513,7 @@ ULONG actual; test_control_return(22); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -528,43 +528,43 @@ ULONG actual; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Clean the buffer. */ - memset(read_buffer, 0, read_buffer_size); + memset(read_buffer, 0, read_buffer_size); /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28) || memcmp(read_buffer, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", actual)) + if ((status != FX_SUCCESS) || (actual != 28) || memcmp(read_buffer, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", actual)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -575,43 +575,43 @@ ULONG actual; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Clean the buffer. */ - memset(read_buffer, 0, read_buffer_size); + memset(read_buffer, 0, read_buffer_size); /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); - /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 2048 + 1000) || memcmp(read_buffer, write_buffer, actual)) + /* Check the file read status. */ + if ((status != FX_SUCCESS) || (actual != 2048 + 1000) || memcmp(read_buffer, write_buffer, actual)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -622,23 +622,23 @@ ULONG actual; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Clean the buffer. */ memset(read_buffer, 0, read_buffer_size); @@ -647,18 +647,18 @@ ULONG actual; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19) || memcmp(read_buffer, " EXPRESSLOGIC_TEST\n", actual)) + if ((status != FX_SUCCESS) || (actual != 19) || memcmp(read_buffer, " EXPRESSLOGIC_TEST\n", actual)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -668,13 +668,13 @@ ULONG actual; /* Close the media. */ status = fx_media_close(&ram_disk); - /* Determine if the test was successful. */ + /* Determine if the test was successful. */ if ((status != FX_SUCCESS) || (directory_write_interrupt_1 != FX_TRUE) || (directory_write_interrupt_2 != FX_TRUE) || (error_couter)) { printf("ERROR!\n"); test_control_return(36); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -682,12 +682,12 @@ ULONG actual; #else pthread_cancel(ptid2); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -699,7 +699,7 @@ static void ftest_1_entry(ULONG thread_input) { #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif UINT status; @@ -708,12 +708,12 @@ static void ftest_1_entry(ULONG thread_input) /* Set the callback function to simulate poweoff operation when write directory. */ driver_write_callback = my_driver_write_1; - + /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { error_couter ++; #ifndef FX_STANDALONE_ENABLE @@ -721,11 +721,11 @@ static void ftest_1_entry(ULONG thread_input) #else return NULL; #endif - } + } /* Write 2048 bytes to the file, then update the directory. (bytes should be greate than one cluster). */ fx_file_write(&my_file, (void *) (write_buffer + 1000), 2048); -} +} #ifndef FX_STANDALONE_ENABLE static void ftest_2_entry(ULONG thread_input) @@ -735,11 +735,11 @@ static void * ftest_2_entry(void * thread_input) { #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif - UINT status; + UINT status; FX_PARAMETER_NOT_USED(thread_input); @@ -749,14 +749,14 @@ static void * ftest_2_entry(void * thread_input) /* Check the status. */ if (status != FX_SUCCESS) { - + error_couter ++; #ifndef FX_STANDALONE_ENABLE return; #else return NULL; #endif - } + } /* Set the callback function to simulate poweoff operation when recover the directory. */ driver_write_callback = my_driver_write_2; @@ -778,14 +778,14 @@ static UINT my_driver_write_1(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *bloc *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt_1 = FX_TRUE; - + directory_write_interrupt_1 = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -797,10 +797,10 @@ static UINT my_driver_write_1(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *bloc /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -813,7 +813,7 @@ static UINT my_driver_write_1(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *bloc /* Return. */ return FX_SUCCESS; -} +} static UINT my_driver_write_2(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) { @@ -828,14 +828,14 @@ static UINT my_driver_write_2(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *bloc *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt_2 = FX_TRUE; - + directory_write_interrupt_2 = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -847,10 +847,10 @@ static UINT my_driver_write_2(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *bloc /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -859,13 +859,13 @@ static UINT my_driver_write_2(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *bloc #else pthread_cancel(ptid2); #endif - } + } /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -873,11 +873,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_log_recover_directory_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Log Recover DIR Test....................N/A\n"); + printf("FileX Test: Fault Tolerant Log Recover DIR Test....................N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_log_recover_fat_test.c b/test/regression_test/filex_fault_tolerant_log_recover_fat_test.c index f6ce642..e55fdc7 100644 --- a/test/regression_test/filex_fault_tolerant_log_recover_fat_test.c +++ b/test/regression_test/filex_fault_tolerant_log_recover_fat_test.c @@ -7,20 +7,20 @@ For FAT 12, 16, 32, one cluster size is 1024 bytes; | TEST.TXT | TEST1.TXT | TEST2.TXT | | | | |------------|------------|-----------|------------|------------|------------| 28 1000 19 - + Check recover fat operation: -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Write 28 bytes into TEST.TXT; +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Write 28 bytes into TEST.TXT; Step4: Write 1000 bytes into TEST1.TXT; -Step5: Write 19 bytes into TEST2.TXT; -Step6: Create new thread to continue to write 2048 data into TEST1.TXT(greater than one cluster): -Step7: Terminate the new thread to simulate poweroff when write the data between undo log generated and redo log not generated. +Step5: Write 19 bytes into TEST2.TXT; +Step6: Create new thread to continue to write 2048 data into TEST1.TXT(greater than one cluster): +Step7: Terminate the new thread to simulate poweroff when write the data between undo log generated and redo log not generated. Step8: Create new thread and enable fault tolerant feature to recover the data(undo operation); Step9: Terminate the new thread to simulate poweroff when recover the FAT table; Step10: Open the media and enable fault tolerant feature to recover the data(undo operation); Step11: Check the test files. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -30,11 +30,11 @@ Step11: Check the test files. #include #include #endif -#include "fx_api.h" +#include "fx_api.h" #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_log_recover_fat_test_application_define(void *first_unused_memory); @@ -48,57 +48,57 @@ void filex_fault_tolerant_log_recover_fat_test_application_define(void *first /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; static TX_THREAD ftest_2; #else -static pthread_t ptid1; -static pthread_t ptid2; +static pthread_t ptid1; +static pthread_t ptid2; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE -static UCHAR *cache_buffer; -static UCHAR *fault_tolerant_buffer; -static UCHAR *thread_1_buffer; +static UCHAR *cache_buffer; +static UCHAR *fault_tolerant_buffer; +static UCHAR *thread_1_buffer; static UCHAR *thread_2_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; #endif static UINT error_couter = 0; -static UINT fat_write_interrupt_1 = FX_FALSE; +static UINT fat_write_interrupt_1 = FX_FALSE; static UINT fat_write_interrupt_2 = FX_FALSE; static UINT fat_updated_flag = FX_FALSE; -static UINT write_index; +static UINT write_index; static UINT i; -static CHAR write_buffer[2048]; +static CHAR write_buffer[2048]; static UINT write_buffer_size = 2048; static CHAR read_buffer[4096]; -static UINT read_buffer_size = 4096; +static UINT read_buffer_size = 4096; static UCHAR data_buffer[4096]; - + #define TEST_COUNT 3 /* FAT12, 16, 32. */ /* Define thread prototypes. */ static void ftest_0_entry(ULONG thread_input); -#ifndef FX_STANDALONE_ENABLE -static void ftest_1_entry(ULONG thread_input); +#ifndef FX_STANDALONE_ENABLE +static void ftest_1_entry(ULONG thread_input); static void ftest_2_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); -static void * ftest_2_entry(void * thread_input); -#endif +static void * ftest_1_entry(void * thread_input); +static void * ftest_2_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); -static UINT my_driver_write_1(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +static UINT my_driver_write_1(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write_2(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -111,16 +111,16 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_log_recover_fat_test_application_define(void *first_unused_memory) #endif { - - + + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -129,7 +129,7 @@ void filex_fault_tolerant_log_recover_fat_test_application_define(void *first cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_1_buffer = pointer; pointer += DEMO_STACK_SIZE; thread_2_buffer = pointer; @@ -151,81 +151,81 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Log Recover FAT Test...................."); - + /* Random genearte the write data. */ for (write_index = 0; write_index < write_buffer_size; write_index ++) write_buffer[write_index] = (CHAR)rand(); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } return_if_fail( status == FX_SUCCESS); /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail( status == FX_SUCCESS); @@ -246,7 +246,7 @@ ULONG actual; return_if_fail( status == FX_SUCCESS); /* Clean the buffer. */ - memset(read_buffer, 0, read_buffer_size); + memset(read_buffer, 0, read_buffer_size); /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); @@ -273,7 +273,7 @@ ULONG actual; return_if_fail( status == FX_SUCCESS); /* Clean the buffer. */ - memset(read_buffer, 0, read_buffer_size); + memset(read_buffer, 0, read_buffer_size); /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); @@ -300,7 +300,7 @@ ULONG actual; return_if_fail( status == FX_SUCCESS); /* Clean the buffer. */ - memset(read_buffer, 0, read_buffer_size); + memset(read_buffer, 0, read_buffer_size); /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); @@ -312,8 +312,8 @@ ULONG actual; /* Create the new thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_1_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_1_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -334,14 +334,14 @@ ULONG actual; tx_thread_delete(&ftest_1); /* Create the new thread. */ - tx_thread_create(&ftest_2, "thread 2", ftest_2_entry, 0, - thread_2_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_2, "thread 2", ftest_2_entry, 0, + thread_2_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #else pthread_cancel(ptid1); #endif /* directory_write_interrupt */ - fat_write_interrupt_2 = FX_FALSE; + fat_write_interrupt_2 = FX_FALSE; /* Let the other thread run. */ #ifndef FX_STANDALONE_ENABLE @@ -358,7 +358,7 @@ ULONG actual; status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail( status == FX_SUCCESS); @@ -371,7 +371,7 @@ ULONG actual; return_if_fail( status == FX_SUCCESS); /* Clean the buffer. */ - memset(read_buffer, 0, read_buffer_size); + memset(read_buffer, 0, read_buffer_size); /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); @@ -390,7 +390,7 @@ ULONG actual; return_if_fail( status == FX_SUCCESS); /* Clean the buffer. */ - memset(read_buffer, 0, read_buffer_size); + memset(read_buffer, 0, read_buffer_size); /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); @@ -429,12 +429,12 @@ ULONG actual; #else pthread_cancel(ptid2); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -447,7 +447,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -457,12 +457,12 @@ static void ftest_1_entry(ULONG thread_input) /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write_1; - + /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { error_couter ++; #ifndef FX_STANDALONE_ENABLE @@ -470,13 +470,13 @@ static void ftest_1_entry(ULONG thread_input) #else return NULL; #endif - } + } /* Write 1024 bytes to the file, then update the FAT table. (bytes should be greate than one cluster). */ { fx_file_write(&my_file, (void *) (write_buffer + 1000), 2048); } -} +} #ifndef FX_STANDALONE_ENABLE static void ftest_2_entry(ULONG thread_input) @@ -487,11 +487,11 @@ static void * ftest_2_entry(void * thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif - UINT status; + UINT status; FX_PARAMETER_NOT_USED(thread_input); @@ -501,14 +501,14 @@ static void * ftest_2_entry(void * thread_input) /* Check the status. */ if (status != FX_SUCCESS) { - + error_couter ++; #ifndef FX_STANDALONE_ENABLE return; #else return NULL; #endif - } + } /* Set the callback function to simulate poweoff operation when recover the FAT entry. */ driver_write_callback = my_driver_write_2; @@ -519,11 +519,11 @@ static void * ftest_2_entry(void * thread_input) static UINT my_driver_write_1(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) { - + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the FAT write operation. */ - if ((sector_type == FX_FAT_SECTOR) && (_filex_fault_tolerant_log_check(media_ptr) & FX_FAULT_TOLERANT_LOG_UNDO_DONE) && + if ((sector_type == FX_FAT_SECTOR) && (_filex_fault_tolerant_log_check(media_ptr) & FX_FAULT_TOLERANT_LOG_UNDO_DONE) && (!(_filex_fault_tolerant_log_check(media_ptr) & FX_FAULT_TOLERANT_LOG_REDO_DONE))) { @@ -532,7 +532,7 @@ static UINT my_driver_write_1(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *bloc } /* Interrupt the redo write operation after updated the fat table. */ - if ((fat_updated_flag == FX_TRUE) && (sector_type == FX_DATA_SECTOR) && + if ((fat_updated_flag == FX_TRUE) && (sector_type == FX_DATA_SECTOR) && (_filex_fault_tolerant_log_check(media_ptr) & FX_FAULT_TOLERANT_LOG_REDO_UPDATING)) { @@ -540,14 +540,14 @@ static UINT my_driver_write_1(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *bloc *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - fat_write_interrupt_1 = FX_TRUE; - + fat_write_interrupt_1 = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -559,10 +559,10 @@ static UINT my_driver_write_1(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *bloc /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -575,7 +575,7 @@ static UINT my_driver_write_1(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *bloc /* Return. */ return FX_SUCCESS; -} +} static UINT my_driver_write_2(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) { @@ -590,14 +590,14 @@ static UINT my_driver_write_2(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *bloc *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - fat_write_interrupt_2 = FX_TRUE; - + fat_write_interrupt_2 = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -609,10 +609,10 @@ static UINT my_driver_write_2(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *bloc /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -621,13 +621,13 @@ static UINT my_driver_write_2(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *bloc #else pthread_cancel(ptid2); #endif - } + } /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -635,11 +635,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_log_recover_fat_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Log Recover FAT Test....................N/A\n"); + printf("FileX Test: Fault Tolerant Log Recover FAT Test....................N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_long_directory_create_directory_interrupt_test.c b/test/regression_test/filex_fault_tolerant_long_directory_create_directory_interrupt_test.c index 94f4896..3c65f4c 100644 --- a/test/regression_test/filex_fault_tolerant_long_directory_create_directory_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_long_directory_create_directory_interrupt_test.c @@ -1,18 +1,18 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check directory interrupt for fx_directory_create(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create directories and sub-directories; -Step4: Traverse the directory; + +Check directory interrupt for fx_directory_create(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create directories and sub-directories; +Step4: Traverse the directory; Step5: Create new thread to create new directory with long directory name; -Step6: Terminate the new thread to simulate poweroff when update the directory after record the redo log. -Step7: Open the media; -Step8: Enable fault tolerant feature to recover the data(redo operation); -Step9: Traverse the directory; -Step10: Recreate directory the new directory with long directory name; +Step6: Terminate the new thread to simulate poweroff when update the directory after record the redo log. +Step7: Open the media; +Step8: Enable fault tolerant feature to recover the data(redo operation); +Step9: Traverse the directory; +Step10: Recreate directory the new directory with long directory name; */ #ifndef FX_STANDALONE_ENABLE @@ -27,10 +27,10 @@ Step10: Recreate directory the new directory with long directory name; #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_long_directory_create_directory_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -41,18 +41,18 @@ void filex_fault_tolerant_long_directory_create_directory_interrupt_test_appl /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; -static UCHAR *pointer; +static UCHAR *pointer; #define TEST_COUNT 3 /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -60,37 +60,37 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_counter = 0; static UINT redo_complete =0; -static UINT directory_write_interrupt = FX_FALSE; +static UINT directory_write_interrupt = FX_FALSE; static CHAR dir_name[256] = "C00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; - + static UINT expected_index = 0; static CHAR * expected_name[] = { - + "A0", ".", - "..", - "A1", + "..", + "A1", ".", - "..", + "..", "B0", ".", - "..", - "B1", + "..", + "B1", ".", - "..", - "B2", + "..", + "B2", ".", - "..", - "B00", + "..", + "B00", ".", - "..", - dir_name, + "..", + dir_name, ".", - "..", - "END"}; + "..", + "END"}; /* Define thread prototypes. */ @@ -98,14 +98,14 @@ static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); +static void * ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -static void traverse_directory(CHAR *directory_name); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +static void traverse_directory(CHAR *directory_name); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -119,22 +119,22 @@ void filex_fault_tolerant_long_directory_create_directory_interrupt_test_appl #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; - + /* Create the main thread. */ - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -142,7 +142,7 @@ void filex_fault_tolerant_long_directory_create_directory_interrupt_test_appl cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -161,14 +161,14 @@ void filex_fault_tolerant_long_directory_create_directory_interrupt_test_appl static void ftest_0_entry(ULONG thread_input) { -UINT status; +UINT status; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Long DIR Create DIR Interrupt Test......"); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { @@ -176,57 +176,57 @@ UINT i; if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -234,7 +234,7 @@ UINT i; printf("ERROR!\n"); test_control_return(1); - } + } /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -248,7 +248,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -297,18 +297,18 @@ UINT i; /* Error creating sub-sub-directories. Return to caller. */ printf("ERROR!\n"); test_control_return(6); - } + } /* Set the index as zero before traverse. */ expected_index = 0; - + /* Traverse the directory structure recursively. */ traverse_directory(FX_NULL); - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -324,7 +324,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After interrupt, reread the files. */ + /* After interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -336,9 +336,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(7); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -352,7 +352,7 @@ UINT i; /* Set the index as zero before traverse. */ expected_index = 0; redo_complete = 1; - + /* Traverse the directory structure recursively. */ traverse_directory(FX_NULL); @@ -377,7 +377,7 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -385,9 +385,9 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); } @@ -402,7 +402,7 @@ static void ftest_1_entry(ULONG thread_input) { #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -419,7 +419,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ { FX_PARAMETER_NOT_USED(block_ptr); - + /* Interrupt the Directory write operation after record the redo log. */ if ((sector_type == FX_DIRECTORY_SECTOR) && (_filex_fault_tolerant_log_check(media_ptr) & FX_FAULT_TOLERANT_LOG_REDO_DONE)) { @@ -428,14 +428,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt = FX_TRUE; - + directory_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -447,10 +447,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -500,7 +500,7 @@ UINT skip; /* Compare with what is expected. */ if (strcmp(name, expected_name[expected_index++])) error_counter++; - + /* Determine if this name is a directory or a file. */ status = fx_directory_name_test(&ram_disk, name); @@ -515,7 +515,7 @@ UINT skip; status = fx_file_close(&file); if (status != FX_SUCCESS) error_counter++; - + /* Pickup the next directory entry. */ status = fx_directory_next_entry_find(&ram_disk, name); } @@ -529,16 +529,16 @@ UINT skip; { /* Recursive call to traverse directory. */ traverse_directory(name); - + /* Restore path. */ status = fx_directory_local_path_restore(&ram_disk, &local_path); } status = fx_directory_next_entry_find(&ram_disk, name); - } - } + } + } fx_directory_local_path_clear(&ram_disk); -} +} #else static void traverse_directory(CHAR *directory_name) { @@ -552,7 +552,7 @@ CHAR name[300]; status = fx_directory_next_entry_find(&ram_disk, name); if (strcmp(name, "B0")) error_counter++; - + /* Set the current path */ status = fx_directory_default_set(&ram_disk, "/A0"); status = fx_directory_first_entry_find(&ram_disk, name); @@ -576,7 +576,7 @@ CHAR name[300]; status = fx_directory_next_entry_find(&ram_disk, name); if (strcmp(name, "B00")) error_counter++; - + } #endif @@ -588,11 +588,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_long_directory_create_directory_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Long DIR Create DIR Interrupt Test......N/A\n"); + printf("FileX Test: Fault Tolerant Long DIR Create DIR Interrupt Test......N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_long_directory_create_redo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_long_directory_create_redo_log_interrupt_test.c index 0a6ebfc..871433e 100644 --- a/test/regression_test/filex_fault_tolerant_long_directory_create_redo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_long_directory_create_redo_log_interrupt_test.c @@ -1,18 +1,18 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check directory interrupt for fx_directory_create(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create directories and sub-directories; -Step4: Traverse the directory; + +Check directory interrupt for fx_directory_create(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create directories and sub-directories; +Step4: Traverse the directory; Step5: Create new thread to create new directory with long directory name; -Step6: Terminate the new thread to simulate poweroff when update redo log. -Step7: Open the media; -Step8: Enable fault tolerant feature to recover the data(undo operation); -Step9: Traverse the directory; -Step10: Recreate directory the new directory with long directory name; +Step6: Terminate the new thread to simulate poweroff when update redo log. +Step7: Open the media; +Step8: Enable fault tolerant feature to recover the data(undo operation); +Step9: Traverse the directory; +Step10: Recreate directory the new directory with long directory name; */ #ifndef FX_STANDALONE_ENABLE @@ -27,10 +27,10 @@ Step10: Recreate directory the new directory with long directory name; #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_long_directory_create_redo_log_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -52,7 +52,7 @@ static UCHAR *pointer; #define TEST_COUNT 3 /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -60,37 +60,37 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_counter = 0; static UINT redo_flag =0; -static UINT log_write_interrupt = FX_FALSE; +static UINT log_write_interrupt = FX_FALSE; static CHAR dir_name[256] = "C00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; - + static UINT expected_index = 0; static CHAR * expected_name[] = { - + "A0", ".", - "..", - "A1", + "..", + "A1", ".", - "..", + "..", "B0", ".", - "..", - "B1", + "..", + "B1", ".", - "..", - "B2", + "..", + "B2", ".", - "..", - "B00", + "..", + "B00", ".", - "..", - dir_name, + "..", + dir_name, ".", - "..", - "END"}; + "..", + "END"}; /* Define thread prototypes. */ @@ -98,14 +98,14 @@ static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); +static void * ftest_1_entry(void * thread_input); #endif - + extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -static void traverse_directory(CHAR *directory_name); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +static void traverse_directory(CHAR *directory_name); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -119,22 +119,22 @@ void filex_fault_tolerant_long_directory_create_redo_log_interrupt_test_appli #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; - + /* Create the main thread. */ - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -142,7 +142,7 @@ void filex_fault_tolerant_long_directory_create_redo_log_interrupt_test_appli cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -161,14 +161,14 @@ void filex_fault_tolerant_long_directory_create_redo_log_interrupt_test_appli static void ftest_0_entry(ULONG thread_input) { -UINT status; +UINT status; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Long DIR Create Redo Log Interrupt Test."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { @@ -176,57 +176,57 @@ UINT i; if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -234,7 +234,7 @@ UINT i; printf("ERROR!\n"); test_control_return(1); - } + } /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -248,7 +248,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -297,18 +297,18 @@ UINT i; /* Error creating sub-sub-directories. Return to caller. */ printf("ERROR!\n"); test_control_return(6); - } + } /* Set the index as zero before traverse. */ expected_index = 0; - + /* Traverse the directory structure recursively. */ traverse_directory(FX_NULL); - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -324,7 +324,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After interrupt, reread the files. */ + /* After interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -336,9 +336,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(7); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -351,7 +351,7 @@ UINT i; /* Set the index as zero before traverse. */ expected_index = 0; - redo_flag = 1; + redo_flag = 1; /* Traverse the directory structure recursively. */ traverse_directory(FX_NULL); @@ -376,7 +376,7 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -384,12 +384,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -399,10 +399,10 @@ static void ftest_1_entry(ULONG thread_input) void * ftest_1_entry(void * thread_input) #endif { - + #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -428,14 +428,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - log_write_interrupt = FX_TRUE; - + log_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -447,10 +447,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -497,7 +497,7 @@ UINT skip; /* Compare with what is expected. */ if (strcmp(name, expected_name[expected_index++])) error_counter++; - + /* Determine if this name is a directory or a file. */ status = fx_directory_name_test(&ram_disk, name); @@ -512,7 +512,7 @@ UINT skip; status = fx_file_close(&file); if (status != FX_SUCCESS) error_counter++; - + /* Pickup the next directory entry. */ status = fx_directory_next_entry_find(&ram_disk, name); } @@ -526,17 +526,17 @@ UINT skip; { /* Recursive call to traverse directory. */ traverse_directory(name); - + /* Restore path. */ - status = fx_directory_local_path_restore(&ram_disk, &local_path); + status = fx_directory_local_path_restore(&ram_disk, &local_path); } status = fx_directory_next_entry_find(&ram_disk, name); - } - } + } + } fx_directory_local_path_clear(&ram_disk); -} +} #else static void traverse_directory(CHAR *directory_name) { @@ -550,7 +550,7 @@ CHAR name[300]; status = fx_directory_next_entry_find(&ram_disk, name); if (strcmp(name, "B0")) error_counter++; - + /* Set the current path */ status = fx_directory_default_set(&ram_disk, "/A0"); status = fx_directory_first_entry_find(&ram_disk, name); @@ -574,10 +574,10 @@ CHAR name[300]; status = fx_directory_next_entry_find(&ram_disk, name); if (strcmp(name, "B00")) error_counter++; - + } #endif -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -585,11 +585,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_long_directory_create_redo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Long DIR Create Redo Log Interrupt Test.N/A\n"); + printf("FileX Test: Fault Tolerant Long DIR Create Redo Log Interrupt Test.N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_long_directory_rename_directory_interrupt_test.c b/test/regression_test/filex_fault_tolerant_long_directory_rename_directory_interrupt_test.c index 269cc6d..2462455 100644 --- a/test/regression_test/filex_fault_tolerant_long_directory_rename_directory_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_long_directory_rename_directory_interrupt_test.c @@ -1,18 +1,18 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 3072 bytes; - -Check directory interrupt for fx_directory_rename(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create directories and sub-directories; -Step4: Traverse the directory; + +Check directory interrupt for fx_directory_rename(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create directories and sub-directories; +Step4: Traverse the directory; Step5: Create new thread to rename directory from directory_name_1 to directory_name_2; -Step6: Terminate the new thread to simulate poweroff when update the directory after record the redo log. -Step7: Open the media; -Step8: Enable fault tolerant feature to recover the data(redo operation); -Step9: Create directory directory_name_1; -Step10: Create directory directory_name_2; +Step6: Terminate the new thread to simulate poweroff when update the directory after record the redo log. +Step7: Open the media; +Step8: Enable fault tolerant feature to recover the data(redo operation); +Step9: Create directory directory_name_1; +Step10: Create directory directory_name_2; */ #ifndef FX_STANDALONE_ENABLE @@ -27,10 +27,10 @@ Step10: Create directory directory_name_2; #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_long_directory_rename_directory_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) && (FX_FAULT_TOLERANT_MINIMAL_BUFFER_SIZE >= 3072) #define DEMO_STACK_SIZE 4096 @@ -43,13 +43,13 @@ void filex_fault_tolerant_long_directory_rename_directory_interrupt_test_appl /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; -static UCHAR *pointer; +static UCHAR *pointer; #if (FX_FAULT_TOLERANT_MINIMAL_BUFFER_SIZE >= 3072) #define TEST_COUNT 3 @@ -59,7 +59,7 @@ static UCHAR *pointer; #endif /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -69,74 +69,74 @@ static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; #endif static UINT error_counter = 0; -static UINT directory_write_interrupt = FX_FALSE; +static UINT directory_write_interrupt = FX_FALSE; static CHAR directory_name_1[300] = "/D0/D40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; static CHAR directory_name_2[300] = "/D0/D50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; - - + + static UINT expected_index = 0; static CHAR * expected_name[] = { - + "A0", ".", - "..", - "A1", + "..", + "A1", ".", - "..", - "A00", + "..", + "A00", ".", - "..", - "A2", + "..", + "A2", ".", - "..", - "A3", + "..", + "A3", ".", - "..", + "..", "B0", ".", - "..", - "B1", + "..", + "B1", ".", - "..", - "B2", + "..", + "B2", ".", - "..", - "B00", + "..", + "B00", ".", - "..", - "B3", + "..", + "B3", ".", - "..", + "..", "C0", ".", - "..", - "C1", + "..", + "C1", ".", - "..", - "C2", + "..", + "C2", ".", - "..", - "C3", + "..", + "C3", ".", - "..", - "C00", + "..", + "C00", ".", - "..", + "..", "D0", ".", - "..", - "D1", + "..", + "D1", ".", - "..", - "D2", + "..", + "D2", ".", - "..", - "D3", + "..", + "D3", ".", - "..", - directory_name_1 + 4, + "..", + directory_name_1 + 4, ".", - "..", + "..", "END"}; /* Define thread prototypes. */ @@ -144,15 +144,15 @@ static CHAR * expected_name[] = { static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); -#else -static void * ftest_1_entry(void * thread_input); +#else +static void * ftest_1_entry(void * thread_input); #endif - + extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); +extern void test_control_return(UINT status); static void traverse_directory(CHAR *directory_name); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -166,15 +166,15 @@ void filex_fault_tolerant_long_directory_rename_directory_interrupt_test_appl #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -183,7 +183,7 @@ void filex_fault_tolerant_long_directory_rename_directory_interrupt_test_appl cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -202,53 +202,53 @@ void filex_fault_tolerant_long_directory_rename_directory_interrupt_test_appl static void ftest_0_entry(ULONG thread_input) { -UINT status; +UINT status; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Long Dir Rename DIR Interrupt Test......"); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 384, // Sector size + 256, // Total sectors + 384, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 384, // Sector size + 4200 * 8, // Total sectors + 384, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT16 with sector size 2048 bytes. This needs to be done before opening it! */ @@ -270,21 +270,21 @@ UINT i; else if (i == 3) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 384, // Sector size + 70000 * 8, // Total sectors + 384, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -292,7 +292,7 @@ UINT i; printf("ERROR!\n"); test_control_return(1); - } + } /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -306,7 +306,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -347,7 +347,7 @@ UINT i; status += fx_directory_create(&ram_disk, "/D0/D1"); status += fx_directory_create(&ram_disk, "/D0/D2"); - status += fx_directory_create(&ram_disk, "/D0/D3"); + status += fx_directory_create(&ram_disk, "/D0/D3"); status += fx_directory_create(&ram_disk, directory_name_1); /* Check for errors... */ @@ -371,18 +371,18 @@ UINT i; /* Error creating sub-sub-directories. Return to caller. */ printf("ERROR!\n"); test_control_return(6); - } + } /* Set the index as zero before traverse. */ expected_index = 0; - + /* Traverse the directory structure recursively. */ traverse_directory(FX_NULL); - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -398,7 +398,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After interrupt, reread the files. */ + /* After interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -410,9 +410,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(7); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -456,7 +456,7 @@ UINT i; printf("ERROR!\n"); test_control_return(11); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -464,12 +464,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -482,14 +482,14 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif FX_PARAMETER_NOT_USED(thread_input); /* Set the callback function to simulate poweoff operation. */ driver_write_callback = my_driver_write; - + /* Rename the directory directory_name_1 to directory_name_2. */ fx_directory_rename(&ram_disk, directory_name_1, directory_name_2); } @@ -507,14 +507,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt = FX_TRUE; - + directory_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -526,10 +526,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -543,9 +543,9 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } - + /* Define the FAT12, 16 and 32 directory traversal routine for the local path test. */ -#ifndef FX_STANDALONE_ENABLE +#ifndef FX_STANDALONE_ENABLE static void traverse_directory(CHAR *directory_name) { @@ -578,7 +578,7 @@ UINT skip; /* Compare with what is expected. */ if (strcmp(name, expected_name[expected_index++])) error_counter++; - + /* Determine if this name is a directory or a file. */ status = fx_directory_name_test(&ram_disk, name); @@ -593,7 +593,7 @@ UINT skip; status = fx_file_close(&file); if (status != FX_SUCCESS) error_counter++; - + /* Pickup the next directory entry. */ status = fx_directory_next_entry_find(&ram_disk, name); } @@ -607,17 +607,17 @@ UINT skip; { /* Recursive call to traverse directory. */ traverse_directory(name); - + /* Restore path. */ - status = fx_directory_local_path_restore(&ram_disk, &local_path); + status = fx_directory_local_path_restore(&ram_disk, &local_path); } status = fx_directory_next_entry_find(&ram_disk, name); - } - } + } + } fx_directory_local_path_clear(&ram_disk); -} +} #else static void traverse_directory(CHAR *directory_name) @@ -639,14 +639,14 @@ CHAR name[300]; if (strcmp(name, "D0")) status++; - /* Okay, now postion to the deepest sub-directory and ensure that the directory first/next + /* Okay, now postion to the deepest sub-directory and ensure that the directory first/next operations work properly there as well. */ /* Set the current path */ status = fx_directory_default_set(&ram_disk, "/C0/C3"); /* Check the status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { /* Error setting the path. Return to caller. */ @@ -682,7 +682,7 @@ CHAR name[300]; #endif -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -690,11 +690,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_long_directory_rename_directory_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Long Dir Rename DIR Interrupt Test......N/A\n"); + printf("FileX Test: Fault Tolerant Long Dir Rename DIR Interrupt Test......N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_long_directory_rename_io_error_test.c b/test/regression_test/filex_fault_tolerant_long_directory_rename_io_error_test.c index 6cd131a..1b5e848 100644 --- a/test/regression_test/filex_fault_tolerant_long_directory_rename_io_error_test.c +++ b/test/regression_test/filex_fault_tolerant_long_directory_rename_io_error_test.c @@ -1,12 +1,12 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 3072 bytes; - -Check directory interrupt for fx_directory_rename(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create directories and sub-directories; -Step4: Traverse the directory; + +Check directory interrupt for fx_directory_rename(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create directories and sub-directories; +Step4: Traverse the directory; Step5: Create new thread to rename directory from directory_name_1 to directory_name_2; Step6: Force IO error while generating fault tolerant log file. */ @@ -18,10 +18,10 @@ Step6: Force IO error while generating fault tolerant log file. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_long_directory_rename_io_error_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) && (FX_FAULT_TOLERANT_MINIMAL_BUFFER_SIZE >= 3072) #define DEMO_STACK_SIZE 4096 @@ -34,10 +34,10 @@ void filex_fault_tolerant_long_directory_rename_io_error_test_application_def /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; #endif static FX_MEDIA ram_disk; -static UCHAR *pointer; +static UCHAR *pointer; #if (FX_FAULT_TOLERANT_MINIMAL_BUFFER_SIZE >= 3072) #define TEST_COUNT 3 @@ -47,7 +47,7 @@ static UCHAR *pointer; #endif /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -55,85 +55,85 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_counter = 0; static CHAR directory_name_1[300] = "/D0/D40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; static CHAR directory_name_2[300] = "/D0/D50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; - - + + static UINT expected_index = 0; static CHAR * expected_name[] = { - + "A0", ".", - "..", - "A1", + "..", + "A1", ".", - "..", - "A00", + "..", + "A00", ".", - "..", - "A2", + "..", + "A2", ".", - "..", - "A3", + "..", + "A3", ".", - "..", + "..", "B0", ".", - "..", - "B1", + "..", + "B1", ".", - "..", - "B2", + "..", + "B2", ".", - "..", - "B00", + "..", + "B00", ".", - "..", - "B3", + "..", + "B3", ".", - "..", + "..", "C0", ".", - "..", - "C1", + "..", + "C1", ".", - "..", - "C2", + "..", + "C2", ".", - "..", - "C3", + "..", + "C3", ".", - "..", - "C00", + "..", + "C00", ".", - "..", + "..", "D0", ".", - "..", - "D1", + "..", + "D1", ".", - "..", - "D2", + "..", + "D2", ".", - "..", - "D3", + "..", + "D3", ".", - "..", - directory_name_1 + 4, + "..", + directory_name_1 + 4, ".", - "..", + "..", "END"}; /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -static void traverse_directory(CHAR *directory_name); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +static void traverse_directory(CHAR *directory_name); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); /* Define what the initial system looks like. */ @@ -145,15 +145,15 @@ void filex_fault_tolerant_long_directory_rename_io_error_test_application_def #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -162,7 +162,7 @@ void filex_fault_tolerant_long_directory_rename_io_error_test_application_def cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -181,53 +181,53 @@ void filex_fault_tolerant_long_directory_rename_io_error_test_application_def static void ftest_0_entry(ULONG thread_input) { -UINT status; +UINT status; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Long Dir Rename IO Error Test..........."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 384, // Sector size + 256, // Total sectors + 384, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 384, // Sector size + 4200 * 8, // Total sectors + 384, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT16 with sector size 2048 bytes. This needs to be done before opening it! */ @@ -249,21 +249,21 @@ UINT i; else if (i == 3) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 384, // Sector size + 70000 * 8, // Total sectors + 384, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -271,7 +271,7 @@ UINT i; printf("ERROR!\n"); test_control_return(1); - } + } /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -285,7 +285,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -326,7 +326,7 @@ UINT i; status += fx_directory_create(&ram_disk, "/D0/D1"); status += fx_directory_create(&ram_disk, "/D0/D2"); - status += fx_directory_create(&ram_disk, "/D0/D3"); + status += fx_directory_create(&ram_disk, "/D0/D3"); status += fx_directory_create(&ram_disk, directory_name_1); /* Check for errors... */ @@ -350,15 +350,15 @@ UINT i; /* Error creating sub-sub-directories. Return to caller. */ printf("ERROR!\n"); test_control_return(6); - } + } /* Set the index as zero before traverse. */ expected_index = 0; - + /* Traverse the directory structure recursively. */ traverse_directory(FX_NULL); - -#if !defined(FX_DISABLE_CACHE) + +#if !defined(FX_DISABLE_CACHE) /* Rename the directory directory_name_1 to directory_name_2. */ _fx_ram_driver_io_error_request = 4; status = fx_directory_rename(&ram_disk, directory_name_1, directory_name_2); @@ -381,16 +381,16 @@ UINT i; printf("ERROR!\n"); test_control_return(11); - } - } + } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} - +} + /* Define the FAT12, 16 and 32 directory traversal routine for the local path test. */ -#ifndef FX_STANDALONE_ENABLE +#ifndef FX_STANDALONE_ENABLE static void traverse_directory(CHAR *directory_name) { @@ -423,7 +423,7 @@ UINT skip; /* Compare with what is expected. */ if (strcmp(name, expected_name[expected_index++])) error_counter++; - + /* Determine if this name is a directory or a file. */ status = fx_directory_name_test(&ram_disk, name); @@ -438,7 +438,7 @@ UINT skip; status = fx_file_close(&file); if (status != FX_SUCCESS) error_counter++; - + /* Pickup the next directory entry. */ status = fx_directory_next_entry_find(&ram_disk, name); } @@ -452,17 +452,17 @@ UINT skip; { /* Recursive call to traverse directory. */ traverse_directory(name); - + /* Restore path. */ - status = fx_directory_local_path_restore(&ram_disk, &local_path); + status = fx_directory_local_path_restore(&ram_disk, &local_path); } status = fx_directory_next_entry_find(&ram_disk, name); - } - } + } + } fx_directory_local_path_clear(&ram_disk); -} +} #else static void traverse_directory(CHAR *directory_name) @@ -484,14 +484,14 @@ CHAR name[300]; if (strcmp(name, "D0")) status++; - /* Okay, now postion to the deepest sub-directory and ensure that the directory first/next + /* Okay, now postion to the deepest sub-directory and ensure that the directory first/next operations work properly there as well. */ /* Set the current path */ status = fx_directory_default_set(&ram_disk, "/C0/C3"); /* Check the status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { /* Error setting the path. Return to caller. */ @@ -527,7 +527,7 @@ CHAR name[300]; #endif -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -535,7 +535,7 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_long_directory_rename_io_error_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ diff --git a/test/regression_test/filex_fault_tolerant_long_directory_rename_redo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_long_directory_rename_redo_log_interrupt_test.c index 8f8e0b6..eb14f5f 100644 --- a/test/regression_test/filex_fault_tolerant_long_directory_rename_redo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_long_directory_rename_redo_log_interrupt_test.c @@ -1,19 +1,19 @@ /* This FileX test concentrates on the Fault-Tolerant redo log write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 3072 bytes; - -Check redo log interrupt for fx_directory_rename(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create directories and sub-directories; -Step4: Traverse the directory; + +Check redo log interrupt for fx_directory_rename(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create directories and sub-directories; +Step4: Traverse the directory; Step5: Create new thread to rename directory from directory_name_1 to directory_name_2; -Step6: Terminate the new thread to simulate poweroff when update the redo log. -Step7: Open the media; -Step8: Enable fault tolerant feature to recover the data(undo operation); -Step9: Create directory directory_name_1; -Step10: Create directory directory_name_2; -*/ +Step6: Terminate the new thread to simulate poweroff when update the redo log. +Step7: Open the media; +Step8: Enable fault tolerant feature to recover the data(undo operation); +Step9: Create directory directory_name_1; +Step10: Create directory directory_name_2; +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -27,10 +27,10 @@ Step10: Create directory directory_name_2; #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_long_directory_rename_redo_log_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) && (FX_FAULT_TOLERANT_MINIMAL_BUFFER_SIZE >= 3072) #define DEMO_STACK_SIZE 4096 @@ -43,7 +43,7 @@ void filex_fault_tolerant_long_directory_rename_redo_log_interrupt_test_appli /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else static pthread_t ptid1; @@ -58,7 +58,7 @@ static FX_MEDIA ram_disk; #endif /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *pointer; static UCHAR *cache_buffer; @@ -67,91 +67,91 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_counter = 0; -static UINT log_write_interrupt = FX_FALSE; +static UINT log_write_interrupt = FX_FALSE; static CHAR directory_name_1[256] = "/D0/D4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; static CHAR directory_name_2[256] = "/D0/D5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; - - + + static UINT expected_index = 0; static CHAR * expected_name[] = { - + "A0", ".", - "..", - "A1", + "..", + "A1", ".", - "..", - "A00", + "..", + "A00", ".", - "..", - "A2", + "..", + "A2", ".", - "..", - "A3", + "..", + "A3", ".", - "..", + "..", "B0", ".", - "..", - "B1", + "..", + "B1", ".", - "..", - "B2", + "..", + "B2", ".", - "..", - "B00", + "..", + "B00", ".", - "..", - "B3", + "..", + "B3", ".", - "..", + "..", "C0", ".", - "..", - "C1", + "..", + "C1", ".", - "..", - "C2", + "..", + "C2", ".", - "..", - "C3", + "..", + "C3", ".", - "..", - "C00", + "..", + "C00", ".", - "..", + "..", "D0", ".", - "..", - "D1", + "..", + "D1", ".", - "..", - "D2", + "..", + "D2", ".", - "..", - "D3", + "..", + "D3", ".", - "..", - directory_name_1 + 4, + "..", + directory_name_1 + 4, ".", - "..", - "END"}; + "..", + "END"}; /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); +static void *ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -static void traverse_directory(CHAR *directory_name); +extern void test_control_return(UINT status); +static void traverse_directory(CHAR *directory_name); extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -165,15 +165,15 @@ void filex_fault_tolerant_long_directory_rename_redo_log_interrupt_test_appli #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -182,7 +182,7 @@ void filex_fault_tolerant_long_directory_rename_redo_log_interrupt_test_appli cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -208,64 +208,64 @@ UINT i; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Long Dir Rename Redo LOG Interrupt Test."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 384, // Sector size + 256, // Total sectors + 384, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 384, // Sector size + 4200 * 8, // Total sectors + 384, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 384, // Sector size + 70000 * 8, // Total sectors + 384, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -273,7 +273,7 @@ UINT i; printf("ERROR!\n"); test_control_return(1); - } + } /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -287,7 +287,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -328,7 +328,7 @@ UINT i; status += fx_directory_create(&ram_disk, "/D0/D1"); status += fx_directory_create(&ram_disk, "/D0/D2"); - status += fx_directory_create(&ram_disk, "/D0/D3"); + status += fx_directory_create(&ram_disk, "/D0/D3"); status += fx_directory_create(&ram_disk, directory_name_1); /* Check for errors... */ @@ -352,18 +352,18 @@ UINT i; /* Error creating sub-sub-directories. Return to caller. */ printf("ERROR!\n"); test_control_return(6); - } + } /* Set the index as zero before traverse. */ expected_index = 0; - + /* Traverse the directory structure recursively. */ traverse_directory(FX_NULL); - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -379,7 +379,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After interrupt, reread the files. */ + /* After interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -391,9 +391,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(7); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -414,7 +414,7 @@ UINT i; /* Error creating same directory twice. Return to caller. */ printf("ERROR!\n"); test_control_return(9); - } + } /* Attempt to create the directory_name_2 again. */ status = fx_directory_create(&ram_disk, directory_name_2); @@ -426,7 +426,7 @@ UINT i; /* Error creating same directory twice. Return to caller. */ printf("ERROR!\n"); test_control_return(10); - } + } /* Close the media. */ status = fx_media_close(&ram_disk); @@ -437,7 +437,7 @@ UINT i; printf("ERROR!\n"); test_control_return(11); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -445,12 +445,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -462,21 +462,21 @@ static void ftest_1_entry(ULONG thread_input) { #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif FX_PARAMETER_NOT_USED(thread_input); /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Rename the directory directory_name_1 to directory_name_2. */ fx_directory_rename(&ram_disk, directory_name_1, directory_name_2); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) { - + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the redo log write operation. */ @@ -487,14 +487,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - log_write_interrupt = FX_TRUE; - + log_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -506,10 +506,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -523,9 +523,9 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } - + /* Define the FAT12, 16 and 32 directory traversal routine for the local path test. */ -#ifndef FX_STANDALONE_ENABLE +#ifndef FX_STANDALONE_ENABLE static void traverse_directory(CHAR *directory_name) { @@ -558,7 +558,7 @@ UINT skip; /* Compare with what is expected. */ if (strcmp(name, expected_name[expected_index++])) error_counter++; - + /* Determine if this name is a directory or a file. */ status = fx_directory_name_test(&ram_disk, name); @@ -573,7 +573,7 @@ UINT skip; status = fx_file_close(&file); if (status != FX_SUCCESS) error_counter++; - + /* Pickup the next directory entry. */ status = fx_directory_next_entry_find(&ram_disk, name); } @@ -587,17 +587,17 @@ UINT skip; { /* Recursive call to traverse directory. */ traverse_directory(name); - + /* Restore path. */ - status = fx_directory_local_path_restore(&ram_disk, &local_path); + status = fx_directory_local_path_restore(&ram_disk, &local_path); } status = fx_directory_next_entry_find(&ram_disk, name); - } - } + } + } fx_directory_local_path_clear(&ram_disk); -} +} #else static void traverse_directory(CHAR *directory_name) @@ -619,14 +619,14 @@ CHAR name[300]; if (strcmp(name, "D0")) status++; - /* Okay, now postion to the deepest sub-directory and ensure that the directory first/next + /* Okay, now postion to the deepest sub-directory and ensure that the directory first/next operations work properly there as well. */ /* Set the current path */ status = fx_directory_default_set(&ram_disk, "/C0/C3"); /* Check the status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { /* Error setting the path. Return to caller. */ @@ -662,7 +662,7 @@ CHAR name[300]; #endif -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -670,11 +670,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_long_directory_rename_redo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Long Dir Rename Redo LOG Interrupt Test.N/A\n"); + printf("FileX Test: Fault Tolerant Long Dir Rename Redo LOG Interrupt Test.N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_long_file_create_directory_interrupt_test.c b/test/regression_test/filex_fault_tolerant_long_file_create_directory_interrupt_test.c index 451d460..7adcff0 100644 --- a/test/regression_test/filex_fault_tolerant_long_file_create_directory_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_long_file_create_directory_interrupt_test.c @@ -1,19 +1,19 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; -Check directory interrupt for fx_file_create() : -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; +Check directory interrupt for fx_file_create() : +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 26 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to create new file with long file name; -Step7: Terminate the new thread to simulate poweroff when update directory. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(redo operation); +Step7: Terminate the new thread to simulate poweroff when update directory. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(redo operation); Step10: Check the test files. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" #else @@ -26,10 +26,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_long_file_create_directory_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -42,17 +42,17 @@ void filex_fault_tolerant_long_file_create_directory_interrupt_test_applicati /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -60,13 +60,13 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT directory_write_interrupt = FX_FALSE; -static CHAR read_buffer[1024]; -static UINT read_buffer_size = 1024; +static UINT directory_write_interrupt = FX_FALSE; +static CHAR read_buffer[1024]; +static UINT read_buffer_size = 1024; static CHAR file_name[256] = "C00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; - + #define TEST_COUNT 3 @@ -77,12 +77,12 @@ static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); +static void *ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -96,15 +96,15 @@ void filex_fault_tolerant_long_file_create_directory_interrupt_test_applicati #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -113,7 +113,7 @@ void filex_fault_tolerant_long_file_create_directory_interrupt_test_applicati cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -133,71 +133,71 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Long File Create DIR Interrupt Test....."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -219,7 +219,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -239,13 +239,13 @@ UINT i; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -256,7 +256,7 @@ UINT i; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -267,7 +267,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -278,7 +278,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -289,7 +289,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -305,13 +305,13 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -322,7 +322,7 @@ UINT i; status = fx_file_write(&my_file, " 012345678901234567890123\n", 26); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -333,7 +333,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -344,7 +344,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); @@ -355,7 +355,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -371,13 +371,13 @@ UINT i; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -388,7 +388,7 @@ UINT i; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -399,7 +399,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -410,7 +410,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -421,18 +421,18 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -448,7 +448,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -460,9 +460,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(22); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -477,40 +477,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -521,40 +521,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -565,40 +565,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -609,40 +609,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, file_name, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(36); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(37); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_END_OF_FILE) || (actual != 0)) + if ((status != FX_END_OF_FILE) || (actual != 0)) { printf("ERROR!\n"); test_control_return(38); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -658,7 +658,7 @@ UINT i; printf("ERROR!\n"); test_control_return(40); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -666,12 +666,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -684,7 +684,7 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -692,7 +692,7 @@ static void ftest_1_entry(ULONG thread_input) /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Create a file called file name in the root directory. */ fx_file_create(&ram_disk, file_name); } @@ -710,14 +710,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt = FX_TRUE; - + directory_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -729,10 +729,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -746,7 +746,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -754,11 +754,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_long_file_create_directory_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Long File Create DIR Interrupt Test.....N/A\n"); + printf("FileX Test: Fault Tolerant Long File Create DIR Interrupt Test.....N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_long_file_create_redo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_long_file_create_redo_log_interrupt_test.c index 6c86269..2a40e21 100644 --- a/test/regression_test/filex_fault_tolerant_long_file_create_redo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_long_file_create_redo_log_interrupt_test.c @@ -1,19 +1,19 @@ /* This FileX test concentrates on the Fault-Tolerant redo LOG write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check redo log interrupt for fx_file_create() : -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check redo log interrupt for fx_file_create() : +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 26 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to create new file with long file name; -Step7: Terminate the new thread to simulate poweroff when update the redo log. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(undo operation); +Step7: Terminate the new thread to simulate poweroff when update the redo log. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Check the test files. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -27,10 +27,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_long_file_create_redo_log_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -43,17 +43,17 @@ void filex_fault_tolerant_long_file_create_redo_log_interrupt_test_applicatio /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -61,14 +61,14 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT log_write_interrupt = FX_FALSE; -static CHAR read_buffer[1024]; -static UINT read_buffer_size = 1024; +static UINT log_write_interrupt = FX_FALSE; +static CHAR read_buffer[1024]; +static UINT read_buffer_size = 1024; static CHAR file_name[256] = "C00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; - - + + #define TEST_COUNT 3 /* Define thread prototypes. */ @@ -77,12 +77,12 @@ static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); +static void * ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -96,15 +96,15 @@ void filex_fault_tolerant_long_file_create_redo_log_interrupt_test_applicatio #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -113,7 +113,7 @@ void filex_fault_tolerant_long_file_create_redo_log_interrupt_test_applicatio cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -133,71 +133,71 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Long File Create Redo LOG Interrupt Test."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -219,7 +219,7 @@ UINT i; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -239,13 +239,13 @@ UINT i; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -256,7 +256,7 @@ UINT i; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -267,7 +267,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -278,7 +278,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -289,7 +289,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -305,13 +305,13 @@ UINT i; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -322,7 +322,7 @@ UINT i; status = fx_file_write(&my_file, " 012345678901234567890123\n", 26); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -333,7 +333,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -344,7 +344,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); @@ -355,7 +355,7 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -371,13 +371,13 @@ UINT i; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -388,7 +388,7 @@ UINT i; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -399,7 +399,7 @@ UINT i; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -410,7 +410,7 @@ UINT i; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -421,17 +421,17 @@ UINT i; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -447,7 +447,7 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -459,9 +459,9 @@ UINT i; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(22); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -476,40 +476,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -520,40 +520,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -564,40 +564,40 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, "TEST2.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -608,12 +608,12 @@ UINT i; status = fx_file_open(&ram_disk, &my_file, file_name, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status == FX_SUCCESS) + if (status == FX_SUCCESS) { printf("ERROR!\n"); test_control_return(36); - } + } /* Close the media. */ status = fx_media_close(&ram_disk); @@ -624,7 +624,7 @@ UINT i; printf("ERROR!\n"); test_control_return(37); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -632,12 +632,12 @@ UINT i; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -647,10 +647,10 @@ static void ftest_1_entry(ULONG thread_input) void * ftest_1_entry(void * thread_input) #endif { - + #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -658,14 +658,14 @@ static void ftest_1_entry(ULONG thread_input) /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Create a file called file name in the root directory. */ fx_file_create(&ram_disk, file_name); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) { - + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the redo log write operation. */ @@ -676,14 +676,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - log_write_interrupt = FX_TRUE; - + log_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -695,10 +695,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -712,7 +712,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -720,11 +720,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_long_file_create_redo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Long File Create Redo LOG Interrupt Test.N/A\n"); + printf("FileX Test: Fault Tolerant Long File Create Redo LOG Interrupt Test.N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_loop_write_data_test.c b/test/regression_test/filex_fault_tolerant_loop_write_data_test.c index 78b5a9e..293bbca 100644 --- a/test/regression_test/filex_fault_tolerant_loop_write_data_test.c +++ b/test/regression_test/filex_fault_tolerant_loop_write_data_test.c @@ -1,31 +1,31 @@ /* This FileX test concentrates on the Fault-Tolerant data loop write operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; 1024 1024 1024 1024 1024 1024 |------------|------------|-----------|------------|------------|------------| | | TEST.TXT | TEST.TXT | | | | |------------|------------|-----------|------------|------------|------------| - -Check loop write data operation: -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create new file called "TEST.TXT"; + +Check loop write data operation: +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create new file called "TEST.TXT"; Step4: Check the media available bytes; Step5: Write 1500 bytes to "TEST.TXT"(two clusters); Step6: Check the media available bytes; -Step7: Loop to write random size bytes to "TEST.TXT"(less than two clusters); +Step7: Loop to write random size bytes to "TEST.TXT"(less than two clusters); Step8: Check the media available bytes every write operation. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" #endif -#include "fx_api.h" +#include "fx_api.h" #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_loop_write_data_test_application_define(void *first_unused_memory); @@ -39,14 +39,14 @@ void filex_fault_tolerant_loop_write_data_test_application_define(void *first /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -54,21 +54,21 @@ static UCHAR *fault_tolerant_buffer; static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; #endif -static CHAR write_buffer[2048]; -static UINT write_buffer_size = 2048; +static CHAR write_buffer[2048]; +static UINT write_buffer_size = 2048; static UINT write_index; -static CHAR read_buffer[4096]; -static UINT read_buffer_size = 4096; +static CHAR read_buffer[4096]; +static UINT read_buffer_size = 4096; static UINT i; - + #define TEST_COUNT 3 /* FAT12, 16, 32. */ /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); extern void _fx_ram_driver(FX_MEDIA *media_ptr); extern void test_control_return(UINT status); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); /* Define what the initial system looks like. */ @@ -79,16 +79,16 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_loop_write_data_test_application_define(void *first_unused_memory) #endif { - - + + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -97,7 +97,7 @@ void filex_fault_tolerant_loop_write_data_test_application_define(void *first cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; #endif /* Initialize the FileX system. */ @@ -105,7 +105,7 @@ void filex_fault_tolerant_loop_write_data_test_application_define(void *first #ifdef FX_STANDALONE_ENABLE ftest_0_entry(0); #endif -} +} /* Define the test threads. */ @@ -114,7 +114,7 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT loop_count; UINT seek_index; UINT write_size; @@ -131,64 +131,64 @@ ULONG available_bytes; /* Random genearte the write data. */ for (write_index = 0; write_index < write_buffer_size; write_index ++) write_buffer[write_index] = (CHAR)rand(); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -198,8 +198,8 @@ ULONG available_bytes; test_control_return(1); } - /* Initialize the parmeters. */ - file_size = 1500; + /* Initialize the parmeters. */ + file_size = 1500; two_cluster_size = 2048; /* Open the ram_disk. */ @@ -214,7 +214,7 @@ ULONG available_bytes; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -224,17 +224,17 @@ ULONG available_bytes; printf("ERROR!\n"); test_control_return(3); } - + /* Pickup the available bytes in the media. */ status = fx_media_space_available(&ram_disk, &available_bytes); - + /* Check for available bytes error. */ if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(4); - } + } /* Create a file called TEST.TXT in the root directory. */ status = fx_file_create(&ram_disk, "TEST.TXT"); @@ -245,13 +245,13 @@ ULONG available_bytes; printf("ERROR!\n"); test_control_return(5); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -262,23 +262,23 @@ ULONG available_bytes; status = fx_file_write(&my_file, (void *) write_buffer, file_size); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(7); } - + /* Pickup the available bytes in the media. */ status = fx_media_space_available(&ram_disk, ¤t_available_bytes); - + /* Check for available bytes error. */ if ((status != FX_SUCCESS) && (available_bytes != (current_available_bytes + two_cluster_size * 2))) { printf("ERROR!\n"); test_control_return(8); - } + } /* Update the avalibale_bytes. */ available_bytes = current_available_bytes; @@ -294,12 +294,12 @@ ULONG available_bytes; status = fx_file_seek(&my_file, seek_index); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(9); - } + } /* Random generate the write size, (0 ~ two cluster size - seek_index); */ write_size = (UINT)rand() % (two_cluster_size - seek_index + 1); @@ -308,7 +308,7 @@ ULONG available_bytes; status = fx_file_write(&my_file, (void *) write_buffer, write_size); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -323,18 +323,18 @@ ULONG available_bytes; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(11); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != file_size)) + if ((status != FX_SUCCESS) || (actual != file_size)) { printf("ERROR!\n"); @@ -350,19 +350,19 @@ ULONG available_bytes; printf("ERROR!\n"); test_control_return(13); - } + } } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(14); - } + } /* Close the media. */ status = fx_media_close(&ram_disk); @@ -373,15 +373,15 @@ ULONG available_bytes; printf("ERROR!\n"); test_control_return(15); - } + } } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -389,11 +389,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_loop_write_data_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Loop Write DATA Test....................N/A\n"); + printf("FileX Test: Fault Tolerant Loop Write DATA Test....................N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_media_check_test.c b/test/regression_test/filex_fault_tolerant_media_check_test.c index 0c48d3a..3fdb3ae 100644 --- a/test/regression_test/filex_fault_tolerant_media_check_test.c +++ b/test/regression_test/filex_fault_tolerant_media_check_test.c @@ -59,14 +59,14 @@ void filex_fault_tolerant_media_check_application_define(void *first_unused_m #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -98,20 +98,20 @@ ULONG errors_detected; printf("FileX Test: Fault Tolerant Media Check Test........................"); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - sizeof(cache_buffer), // Media buffer size + sizeof(cache_buffer), // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 2048, // Sector size + 256, // Total sectors + 2048, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -173,14 +173,14 @@ ULONG errors_detected; test_control_return(0); } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) #else void filex_fault_tolerant_media_check_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ diff --git a/test/regression_test/filex_fault_tolerant_media_full_test.c b/test/regression_test/filex_fault_tolerant_media_full_test.c index a8c6804..25711a9 100644 --- a/test/regression_test/filex_fault_tolerant_media_full_test.c +++ b/test/regression_test/filex_fault_tolerant_media_full_test.c @@ -1,25 +1,25 @@ /* This FileX test concentrates on the Fault-Tolerant Media Full test. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; -Check media full operation: -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create new file called "TEST.TXT"; -Step4: Get the media available bytes; +Check media full operation: +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create new file called "TEST.TXT"; +Step4: Get the media available bytes; Step5: Loop to write bytes out of the file to fill the media; -Step6: Check the media available bytes. +Step6: Check the media available bytes. Step7: Loop to read and check the file data from the media; -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" #endif #include "fx_api.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_media_full_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) #define DEMO_STACK_SIZE 4096 @@ -30,29 +30,29 @@ void filex_fault_tolerant_media_full_test_application_define(void *first_unus /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); +extern void test_control_return(UINT status); /* Define what the initial system looks like. */ @@ -64,20 +64,20 @@ void filex_fault_tolerant_media_full_test_application_define(void *first_unus #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; - /* Setup memory for the RAM disk and the sector cache. */ + /* Setup memory for the RAM disk and the sector cache. */ cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; @@ -90,7 +90,7 @@ void filex_fault_tolerant_media_full_test_application_define(void *first_unus ftest_0_entry(0); #endif } - + /* Define the test threads. */ @@ -108,75 +108,75 @@ ULONG i, j; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Media Full Test........................."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } return_if_fail( status == FX_SUCCESS); /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); - - /* Enable the Fault-tolerant feature. */ + + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail( status == FX_SUCCESS); - + /* Create a file called TEST.TXT in the root directory. */ status = fx_file_create(&ram_disk, "TEST.TXT"); return_if_fail( status == FX_SUCCESS); @@ -211,7 +211,7 @@ ULONG i, j; return_if_fail( (status == FX_SUCCESS) && (j == 0)); #ifndef FX_DISABLE_CACHE - /* At this point, we should invalidate the (which also flushes the cache) media to ensure that all + /* At this point, we should invalidate the (which also flushes the cache) media to ensure that all dirty sectors are written. */ status = fx_media_cache_invalidate(&ram_disk); return_if_fail((status == FX_SUCCESS) && (ram_disk.fx_media_sector_cache_dirty_count == 0)); @@ -231,7 +231,7 @@ ULONG i, j; /* Now read in all the bytes again to make sure the file contents are really there. */ j = 0; - read_value = 0; + read_value = 0; write_value = 0; while (j < available_bytes) { @@ -244,7 +244,7 @@ ULONG i, j; /* Increment byte count. */ j = j + sizeof(ULONG); - + /* Increment write value. */ write_value++; } @@ -258,12 +258,12 @@ ULONG i, j; return_if_fail( status == FX_SUCCESS); } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -271,11 +271,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_media_full_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Media Full Test.........................N/A\n"); + printf("FileX Test: Fault Tolerant Media Full Test.........................N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_recover_fail_test.c b/test/regression_test/filex_fault_tolerant_recover_fail_test.c index bd7c1cb..879658b 100644 --- a/test/regression_test/filex_fault_tolerant_recover_fail_test.c +++ b/test/regression_test/filex_fault_tolerant_recover_fail_test.c @@ -6,11 +6,11 @@ #include #include #endif -#include "fx_api.h" +#include "fx_api.h" #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_recover_fail_test_application_define(void *first_unused_memory); @@ -24,51 +24,51 @@ void filex_fault_tolerant_recover_fail_test_application_define(void *first_un /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE -static UCHAR *cache_buffer; -static UCHAR *fault_tolerant_buffer; +static UCHAR *cache_buffer; +static UCHAR *fault_tolerant_buffer; static UCHAR *thread_buffer; #else -static UCHAR cache_buffer[CACHE_SIZE]; +static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT data_write_interrupt = FX_FALSE; -static CHAR write_buffer[2048]; -static UINT write_buffer_size = 2048; -static UINT write_index; -static CHAR read_buffer[4096]; -static UINT read_buffer_size = 4096; +static UINT data_write_interrupt = FX_FALSE; +static CHAR write_buffer[2048]; +static UINT write_buffer_size = 2048; +static UINT write_index; +static CHAR read_buffer[4096]; +static UINT read_buffer_size = 4096; static UINT data_size = 0; - -#define SEEK_COUNT 5 + +#define SEEK_COUNT 5 #define FAT_COUNT 3 /* FAT12, 16, 32. */ #define TEST_COUNT FAT_COUNT * SEEK_COUNT /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); -#endif +static void * ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -81,16 +81,16 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_recover_fail_test_application_define(void *first_unused_memory) #endif { - - + + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -99,7 +99,7 @@ void filex_fault_tolerant_recover_fail_test_application_define(void *first_un cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -119,32 +119,32 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Fault tolerant recover fail test......................."); - + for (i = 1; i <= 2; i++) { - + /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); /* Open the ram_disk and enable fault_tolerant feature. */ @@ -160,7 +160,7 @@ UINT i; return_if_fail( status == FX_SUCCESS); /* Read the bytes of the test file. */ - memset(read_buffer, 0, read_buffer_size); + memset(read_buffer, 0, read_buffer_size); status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); return_if_fail( (status == FX_SUCCESS) && (actual == 28)); @@ -180,7 +180,7 @@ UINT i; return_if_fail( status == FX_SUCCESS); /* Read the bytes of the test file. */ - memset(read_buffer, 0, read_buffer_size); + memset(read_buffer, 0, read_buffer_size); status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); return_if_fail( (status == FX_SUCCESS) && (actual == data_size)); @@ -190,8 +190,8 @@ UINT i; /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -207,14 +207,14 @@ UINT i; pthread_join(ptid1,NULL); #endif - /* After write interrupt, try to enable fault_tolerant again. */ + /* After write interrupt, try to enable fault_tolerant again. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); /* Enable the Fault-tolerant feature to recover the media. */ - /* Make a mistake when fx_fault_tolerant_recover link original chain back to the front of the insertion point. */ + /* Make a mistake when fx_fault_tolerant_recover link original chain back to the front of the insertion point. */ _fx_utility_fat_entry_write_error_request = i; status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail( status == FX_IO_ERROR); @@ -231,7 +231,7 @@ UINT i; #endif } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); } @@ -243,26 +243,26 @@ static void ftest_1_entry(ULONG thread_input) #else void * ftest_1_entry(void * thread_input) #endif -{ +{ #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif - + UINT status; FX_PARAMETER_NOT_USED(thread_input); /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - + /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST1.TXT", FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { error_couter ++; #ifndef FX_STANDALONE_ENABLE @@ -270,12 +270,12 @@ static void ftest_1_entry(ULONG thread_input) #else return NULL; #endif - } + } status = fx_file_seek(&my_file, 1500); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { error_couter ++; #ifndef FX_STANDALONE_ENABLE @@ -283,12 +283,12 @@ static void ftest_1_entry(ULONG thread_input) #else return NULL; #endif - } + } /* Random genearte the write data. */ for (write_index = 0; write_index < write_buffer_size; write_index ++) { - write_buffer[write_index] = (CHAR)rand(); + write_buffer[write_index] = (CHAR)rand(); } /* Write 1024 bytes to the file, then update the FAT table. (bytes should be greate than one cluster). */ @@ -308,14 +308,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - data_write_interrupt = FX_TRUE; - + data_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -327,10 +327,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -344,7 +344,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -352,11 +352,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_recover_fail_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault tolerant recover fail test.......................N/A\n"); + printf("FileX Test: Fault tolerant recover fail test.......................N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_unicode_directory_create_directory_interrupt_test.c b/test/regression_test/filex_fault_tolerant_unicode_directory_create_directory_interrupt_test.c index 4782839..a2b769d 100644 --- a/test/regression_test/filex_fault_tolerant_unicode_directory_create_directory_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_unicode_directory_create_directory_interrupt_test.c @@ -1,18 +1,18 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check directory interrupt for fx_unicode_directory_create(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create directories and sub-directories; -Step4: Traverse the directory; + +Check directory interrupt for fx_unicode_directory_create(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create directories and sub-directories; +Step4: Traverse the directory; Step5: Create new thread to create new directory "/B/B2/B22/B222"; -Step6: Terminate the new thread to simulate poweroff when update the directory after record the redo log. -Step7: Open the media; -Step8: Enable fault tolerant feature to recover the data(redo operation); -Step9: Traverse the directory; -Step10: Recreate directory "/B/B2/B22/B222"; +Step6: Terminate the new thread to simulate poweroff when update the directory after record the redo log. +Step7: Open the media; +Step8: Enable fault tolerant feature to recover the data(redo operation); +Step9: Traverse the directory; +Step10: Recreate directory "/B/B2/B22/B222"; */ #ifndef FX_STANDALONE_ENABLE @@ -27,10 +27,10 @@ Step10: Recreate directory "/B/B2/B22/B222"; #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_unicode_directory_create_directory_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -41,18 +41,18 @@ void filex_fault_tolerant_unicode_directory_create_directory_interrupt_test_a /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; -static UCHAR *pointer; +static UCHAR *pointer; #define TEST_COUNT 3 /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -60,25 +60,25 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_counter = 0; -static UINT directory_write_interrupt = FX_FALSE; +static UINT directory_write_interrupt = FX_FALSE; static UCHAR directory_name_A[] = {'A', 0, 0, 0}; -static UCHAR directory_name_B[] = {'B', 0, 0, 0}; +static UCHAR directory_name_B[] = {'B', 0, 0, 0}; static UCHAR directory_name_C[] = {'C', 0, 0, 0}; static UCHAR directory_name_A_A1[] = {'A', 0, '1', 0, 0, 0}; static UCHAR directory_name_A_A2[] = {'A', 0, '2', 0, 0, 0}; -static UCHAR directory_name_A_A3[] = {'A', 0, '3', 0, 0, 0}; +static UCHAR directory_name_A_A3[] = {'A', 0, '3', 0, 0, 0}; static UCHAR directory_name_B_B1[] = {'B', 0, '1', 0, 0, 0}; static UCHAR directory_name_B_B2[] = {'B', 0, '2', 0, 0, 0}; -static UCHAR directory_name_B_B3[] = {'B', 0, '3', 0, 0, 0}; +static UCHAR directory_name_B_B3[] = {'B', 0, '3', 0, 0, 0}; static UCHAR directory_name_C_C1[] = {'C', 0, '1', 0, 0, 0}; static UCHAR directory_name_C_C2[] = {'C', 0, '2', 0, 0, 0}; -static UCHAR directory_name_C_C3[] = {'C', 0, '3', 0, 0, 0}; +static UCHAR directory_name_C_C3[] = {'C', 0, '3', 0, 0, 0}; static UCHAR directory_name_A_A1_A11[] = {'A', 0, '1', 0, '1', 0, 0, 0}; static UCHAR directory_name_B_B2_B22[] = {'B', 0, '2', 0, '2', 0, 0, 0}; -static UCHAR directory_name_C_C3_C33[] = {'C', 0, '3', 0, '3', 0, 0, 0}; +static UCHAR directory_name_C_C3_C33[] = {'C', 0, '3', 0, '3', 0, 0, 0}; static UCHAR directory_name_B_B2_B22_B222[] = {'B', 0, '2', 0, '2', 0, '2', 0, 0, 0}; static CHAR directory_name_A_short[20]; static CHAR directory_name_B_short[20]; @@ -101,25 +101,25 @@ static CHAR directory_name_path_short[100]; static UINT expected_index = 0; static CHAR **expected_name; static CHAR *expected_name_0[] = { "A", ".", "..", "A1", ".", "..", "A11", ".", "..", "A2", ".", "..", "A3", ".", "..", "B", ".", "..", "B1", ".", - "..", "B2", ".", "..", "B22", ".", "..", "B3", ".", "..", "C", ".", "..", "C1", ".", "..", "C2", ".", "..", "C3", ".", "..", "C33", ".", "..", "END"}; + "..", "B2", ".", "..", "B22", ".", "..", "B3", ".", "..", "C", ".", "..", "C1", ".", "..", "C2", ".", "..", "C3", ".", "..", "C33", ".", "..", "END"}; static CHAR *expected_name_1[] = { "A", ".", "..", "A1", ".", "..", "A11", ".", "..", "A2", ".", "..", "A3", ".", "..", "B", ".", "..", "B1", ".", "..", "B2", ".", "..", "B22", ".", "..", "B222", ".", "..", "B3", ".", "..", "C", ".", "..", "C1", ".", "..", "C2", ".", "..", "C3", ".", "..", "C33", ".", - "..", "END"}; + "..", "END"}; /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); -#endif - +static void * ftest_1_entry(void * thread_input); +#endif + extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -static void traverse_directory(CHAR *directory_name); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +static void traverse_directory(CHAR *directory_name); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -133,22 +133,22 @@ void filex_fault_tolerant_unicode_directory_create_directory_interrupt_test_a #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; - + /* Create the main thread. */ - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -156,7 +156,7 @@ void filex_fault_tolerant_unicode_directory_create_directory_interrupt_test_a cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -175,7 +175,7 @@ void filex_fault_tolerant_unicode_directory_create_directory_interrupt_test_a static void ftest_0_entry(ULONG thread_input) { -UINT status; +UINT status; UINT i; UINT j; UINT index; @@ -186,72 +186,72 @@ FX_LOCAL_PATH local_path; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Unicode Dir Create DIR Interrupt Test..."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail( status == FX_SUCCESS); - /* Set the local path to "\\". */ + /* Set the local path to "\\". */ #ifndef FX_STANDALONE_ENABLE status = fx_directory_local_path_set(&ram_disk, &local_path, "\\"); #else @@ -267,7 +267,7 @@ FX_LOCAL_PATH local_path; length = fx_unicode_length_get(directory_name_C); status += fx_unicode_directory_create(&ram_disk, directory_name_C, length, directory_name_C_short); return_if_fail( status == FX_SUCCESS); - + /* Initailize the directory structure. */ index = 0; directory_name_path_short[index++] = '/'; @@ -286,7 +286,7 @@ FX_LOCAL_PATH local_path; break; } } - + directory_name_path_short[index] = FX_NULL; /* Set the local path to /A. */ @@ -296,17 +296,17 @@ FX_LOCAL_PATH local_path; status = fx_directory_default_set(&ram_disk, directory_name_path_short); #endif return_if_fail( status == FX_SUCCESS); - - /* Create the next level of sub-directories. - "/A/A1", "/A/A2", "/A/A3", */ + + /* Create the next level of sub-directories. + "/A/A1", "/A/A2", "/A/A3", */ length = fx_unicode_length_get(directory_name_A_A1); - status = fx_unicode_directory_create(&ram_disk, directory_name_A_A1, length, directory_name_A_A1_short); + status = fx_unicode_directory_create(&ram_disk, directory_name_A_A1, length, directory_name_A_A1_short); length = fx_unicode_length_get(directory_name_A_A2); - status += fx_unicode_directory_create(&ram_disk, directory_name_A_A2, length, directory_name_A_A2_short); + status += fx_unicode_directory_create(&ram_disk, directory_name_A_A2, length, directory_name_A_A2_short); length = fx_unicode_length_get(directory_name_A_A3); status += fx_unicode_directory_create(&ram_disk, directory_name_A_A3, length, directory_name_A_A3_short); return_if_fail( status == FX_SUCCESS); - + /* Initailize the directory structure. */ index = 0; directory_name_path_short[index++] = '/'; @@ -325,7 +325,7 @@ FX_LOCAL_PATH local_path; break; } } - + directory_name_path_short[index] = FX_NULL; /* Set the local path to /B. */ @@ -335,17 +335,17 @@ FX_LOCAL_PATH local_path; status = fx_directory_default_set(&ram_disk, directory_name_path_short); #endif return_if_fail( status == FX_SUCCESS); - - /* Create the next level of sub-directories. + + /* Create the next level of sub-directories. "/B/B1", "/B/B2", "/B/B3", */ length = fx_unicode_length_get(directory_name_B_B1); - status = fx_unicode_directory_create(&ram_disk, directory_name_B_B1, length, directory_name_B_B1_short); + status = fx_unicode_directory_create(&ram_disk, directory_name_B_B1, length, directory_name_B_B1_short); length = fx_unicode_length_get(directory_name_B_B2); - status += fx_unicode_directory_create(&ram_disk, directory_name_B_B2, length, directory_name_B_B2_short); + status += fx_unicode_directory_create(&ram_disk, directory_name_B_B2, length, directory_name_B_B2_short); length = fx_unicode_length_get(directory_name_B_B3); status += fx_unicode_directory_create(&ram_disk, directory_name_B_B3, length, directory_name_B_B3_short); return_if_fail( status == FX_SUCCESS); - + /* Initailize the directory structure. */ index = 0; directory_name_path_short[index++] = '/'; @@ -363,8 +363,8 @@ FX_LOCAL_PATH local_path; { break; } - } - + } + directory_name_path_short[index] = FX_NULL; /* Set the local path to /C. */ @@ -375,19 +375,19 @@ FX_LOCAL_PATH local_path; #endif return_if_fail( status == FX_SUCCESS); - /* Create the next level of sub-directories. - "/C/C1", "/C/C2", "/C/C1" */ + /* Create the next level of sub-directories. + "/C/C1", "/C/C2", "/C/C1" */ length = fx_unicode_length_get(directory_name_C_C1); - status = fx_unicode_directory_create(&ram_disk, directory_name_C_C1, length, directory_name_C_C1_short); + status = fx_unicode_directory_create(&ram_disk, directory_name_C_C1, length, directory_name_C_C1_short); length = fx_unicode_length_get(directory_name_C_C2); - status = fx_unicode_directory_create(&ram_disk, directory_name_C_C2, length, directory_name_C_C2_short); + status = fx_unicode_directory_create(&ram_disk, directory_name_C_C2, length, directory_name_C_C2_short); length = fx_unicode_length_get(directory_name_C_C3); status = fx_unicode_directory_create(&ram_disk, directory_name_C_C3, length, directory_name_C_C3_short); return_if_fail( status == FX_SUCCESS); - /* Now create the third level of sub-directories... + /* Now create the third level of sub-directories... "/A/A1/A11", "/B/B2/B22", "/C/C3/C33" */ - + /* Initailize the directory structure. */ index = 0; directory_name_path_short[index++] = '/'; @@ -405,8 +405,8 @@ FX_LOCAL_PATH local_path; { break; } - } - + } + directory_name_path_short[index++] = '/'; /* Construct the directory structure /A/A1. */ @@ -422,8 +422,8 @@ FX_LOCAL_PATH local_path; { break; } - } - + } + directory_name_path_short[index] = FX_NULL; /* Set the local path to /A/A1. */ @@ -433,9 +433,9 @@ FX_LOCAL_PATH local_path; status = fx_directory_default_set(&ram_disk, directory_name_path_short); #endif length = fx_unicode_length_get(directory_name_A_A1_A11); - status += fx_unicode_directory_create(&ram_disk, directory_name_A_A1_A11, length, directory_name_A_A1_A11_short); + status += fx_unicode_directory_create(&ram_disk, directory_name_A_A1_A11, length, directory_name_A_A1_A11_short); return_if_fail( status == FX_SUCCESS); - + /* Initailize the directory structure. */ index = 0; directory_name_path_short[index++] = '/'; @@ -453,8 +453,8 @@ FX_LOCAL_PATH local_path; { break; } - } - + } + directory_name_path_short[index++] = '/'; /* Construct the directory structure /B/B2. */ @@ -471,10 +471,10 @@ FX_LOCAL_PATH local_path; break; } } - + directory_name_path_short[index] = FX_NULL; - /* Set the local path to /B/B2. */ + /* Set the local path to /B/B2. */ #ifndef FX_STANDALONE_ENABLE status = fx_directory_local_path_set(&ram_disk, &local_path, directory_name_path_short); #else @@ -501,8 +501,8 @@ FX_LOCAL_PATH local_path; { break; } - } - + } + directory_name_path_short[index++] = '/'; /* Construct the directory structure /C/C3. */ @@ -519,30 +519,30 @@ FX_LOCAL_PATH local_path; break; } } - + directory_name_path_short[index] = FX_NULL; - /* Set the local path to /C/C3. */ + /* Set the local path to /C/C3. */ #ifndef FX_STANDALONE_ENABLE status = fx_directory_local_path_set(&ram_disk, &local_path, directory_name_path_short); #else status = fx_directory_default_set(&ram_disk, directory_name_path_short); #endif length = fx_unicode_length_get(directory_name_C_C3_C33); - status += fx_unicode_directory_create(&ram_disk, directory_name_C_C3_C33, length, directory_name_C_C3_C33_short); + status += fx_unicode_directory_create(&ram_disk, directory_name_C_C3_C33, length, directory_name_C_C3_C33_short); return_if_fail( status == FX_SUCCESS); /* Set the index as zero before traverse. */ expected_index = 0; - + /* Traverse the directory structure recursively. */ expected_name = expected_name_0; traverse_directory(FX_NULL); - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -558,25 +558,25 @@ FX_LOCAL_PATH local_path; pthread_join(ptid1,NULL); #endif - /* After interrupt, reread the files. */ + /* After interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); return_if_fail( status == FX_SUCCESS); /* Set the index as zero before traverse. */ expected_index = 0; - + /* Traverse the directory structure recursively. */ expected_name = expected_name_1; traverse_directory(FX_NULL); - - /* Attempt to create the same directory again. */ - /* Set the local path to /B/B2/B22. */ + + /* Attempt to create the same directory again. */ + /* Set the local path to /B/B2/B22. */ #ifndef FX_STANDALONE_ENABLE status = fx_directory_local_path_set(&ram_disk, &local_path, directory_name_path_short); #else @@ -596,12 +596,12 @@ FX_LOCAL_PATH local_path; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -610,17 +610,17 @@ static void ftest_1_entry(ULONG thread_input) #else void * ftest_1_entry(void * thread_input) #endif -{ +{ #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif UINT index; UINT j; -ULONG length; +ULONG length; FX_LOCAL_PATH local_path; FX_PARAMETER_NOT_USED(thread_input); @@ -628,8 +628,8 @@ FX_LOCAL_PATH local_path; /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - /* Now create the fourth level of sub-directories... - "/B/B2/B22/B222" */ + /* Now create the fourth level of sub-directories... + "/B/B2/B22/B222" */ /* Initailize the directory structure. */ index = 0; @@ -648,7 +648,7 @@ FX_LOCAL_PATH local_path; { break; } - } + } directory_name_path_short[index++] = '/'; @@ -666,7 +666,7 @@ FX_LOCAL_PATH local_path; break; } } - + directory_name_path_short[index++] = '/'; /* Construct the directory structure /B/B2/B22. */ @@ -686,14 +686,14 @@ FX_LOCAL_PATH local_path; directory_name_path_short[index] = FX_NULL; - /* Set the local path to /B/B2/B22. */ + /* Set the local path to /B/B2/B22. */ #ifndef FX_STANDALONE_ENABLE fx_directory_local_path_set(&ram_disk, &local_path, directory_name_path_short); #else fx_directory_default_set(&ram_disk, directory_name_path_short); #endif length = fx_unicode_length_get(directory_name_B_B2_B22_B222); - fx_unicode_directory_create(&ram_disk, directory_name_B_B2_B22_B222, length, directory_name_B_B2_B22_B222_short); + fx_unicode_directory_create(&ram_disk, directory_name_B_B2_B22_B222, length, directory_name_B_B2_B22_B222_short); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) @@ -709,14 +709,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt = FX_TRUE; - + directory_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -728,10 +728,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -787,7 +787,7 @@ UINT skip; /* Compare with what is expected. */ if (strcmp(name, expected_name[expected_index++])) error_counter++; - + /* Determine if this name is a directory or a file. */ status = fx_directory_name_test(&ram_disk, name); @@ -802,7 +802,7 @@ UINT skip; status = fx_file_close(&file); if (status != FX_SUCCESS) error_counter++; - + /* Pickup the next directory entry. */ status = fx_directory_next_entry_find(&ram_disk, name); } @@ -816,23 +816,23 @@ UINT skip; { /* Recursive call to traverse directory. */ traverse_directory(name); - + /* Restore path. */ #ifndef FX_STANDALONE_ENABLE - status = fx_directory_local_path_restore(&ram_disk, &local_path); -#endif + status = fx_directory_local_path_restore(&ram_disk, &local_path); +#endif } status = fx_directory_next_entry_find(&ram_disk, name); - } - } + } + } #ifndef FX_STANDALONE_ENABLE fx_directory_local_path_clear(&ram_disk); #endif -} +} -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -840,11 +840,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_unicode_directory_create_directory_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Unicode Dir Create DIR Interrupt Test...N/A\n"); + printf("FileX Test: Fault Tolerant Unicode Dir Create DIR Interrupt Test...N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_unicode_directory_rename_directory_interrupt_test.c b/test/regression_test/filex_fault_tolerant_unicode_directory_rename_directory_interrupt_test.c index 07327fc..6184662 100644 --- a/test/regression_test/filex_fault_tolerant_unicode_directory_rename_directory_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_unicode_directory_rename_directory_interrupt_test.c @@ -1,18 +1,18 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check directory interrupt for fx_unicode_directory_rename(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create directories and sub-directories; -Step4: Traverse the directory; + +Check directory interrupt for fx_unicode_directory_rename(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create directories and sub-directories; +Step4: Traverse the directory; Step5: Create new thread to rename the directory "/B/B2/B22" to "/B/B2/B23"; -Step6: Terminate the new thread to simulate poweroff when update the directory after record the redo log. -Step7: Open the media; -Step8: Enable fault tolerant feature to recover the data(redo operation); -Step9: Traverse the directory; -Step10: Recreate directory "/B/B2/B22" and "/B/B2/B23"; +Step6: Terminate the new thread to simulate poweroff when update the directory after record the redo log. +Step7: Open the media; +Step8: Enable fault tolerant feature to recover the data(redo operation); +Step9: Traverse the directory; +Step10: Recreate directory "/B/B2/B22" and "/B/B2/B23"; */ #ifndef FX_STANDALONE_ENABLE @@ -27,10 +27,10 @@ Step10: Recreate directory "/B/B2/B22" and "/B/B2/B23"; #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_unicode_directory_rename_directory_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -41,18 +41,18 @@ void filex_fault_tolerant_unicode_directory_rename_directory_interrupt_test_a /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; -static UCHAR *pointer; +static UCHAR *pointer; #define TEST_COUNT 3 /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -60,25 +60,25 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_counter = 0; -static UINT directory_write_interrupt = FX_FALSE; +static UINT directory_write_interrupt = FX_FALSE; static UCHAR directory_name_A[] = {'A', 0, 0, 0}; -static UCHAR directory_name_B[] = {'B', 0, 0, 0}; +static UCHAR directory_name_B[] = {'B', 0, 0, 0}; static UCHAR directory_name_C[] = {'C', 0, 0, 0}; static UCHAR directory_name_A_A1[] = {'A', 0, '1', 0, 0, 0}; static UCHAR directory_name_A_A2[] = {'A', 0, '2', 0, 0, 0}; -static UCHAR directory_name_A_A3[] = {'A', 0, '3', 0, 0, 0}; +static UCHAR directory_name_A_A3[] = {'A', 0, '3', 0, 0, 0}; static UCHAR directory_name_B_B1[] = {'B', 0, '1', 0, 0, 0}; static UCHAR directory_name_B_B2[] = {'B', 0, '2', 0, 0, 0}; -static UCHAR directory_name_B_B3[] = {'B', 0, '3', 0, 0, 0}; +static UCHAR directory_name_B_B3[] = {'B', 0, '3', 0, 0, 0}; static UCHAR directory_name_C_C1[] = {'C', 0, '1', 0, 0, 0}; static UCHAR directory_name_C_C2[] = {'C', 0, '2', 0, 0, 0}; -static UCHAR directory_name_C_C3[] = {'C', 0, '3', 0, 0, 0}; +static UCHAR directory_name_C_C3[] = {'C', 0, '3', 0, 0, 0}; static UCHAR directory_name_A_A1_A11[] = {'A', 0, '1', 0, '1', 0, 0, 0}; -static UCHAR directory_name_B_B2_B22[] = {'B', 0, '2', 0, '2', 0, 0, 0}; +static UCHAR directory_name_B_B2_B22[] = {'B', 0, '2', 0, '2', 0, 0, 0}; static UCHAR directory_name_B_B2_B23[] = {'B', 0, '2', 0, '3', 0, 0, 0}; -static UCHAR directory_name_C_C3_C33[] = {'C', 0, '3', 0, '3', 0, 0, 0}; +static UCHAR directory_name_C_C3_C33[] = {'C', 0, '3', 0, '3', 0, 0, 0}; static CHAR directory_name_A_short[20]; static CHAR directory_name_B_short[20]; static CHAR directory_name_C_short[20]; @@ -100,102 +100,102 @@ static CHAR directory_name_path_short[100]; static UINT expected_index = 0; static CHAR **expected_name; static CHAR * expected_name_0[] = { - + "A", ".", - "..", - "A1", + "..", + "A1", ".", - "..", - "A11", + "..", + "A11", ".", - "..", - "A2", + "..", + "A2", ".", - "..", - "A3", + "..", + "A3", ".", - "..", + "..", "B", ".", - "..", - "B1", + "..", + "B1", ".", - "..", - "B2", + "..", + "B2", ".", - "..", - "B22", + "..", + "B22", ".", - "..", - "B3", + "..", + "B3", ".", - "..", + "..", "C", ".", - "..", - "C1", + "..", + "C1", ".", - "..", - "C2", + "..", + "C2", ".", - "..", - "C3", + "..", + "C3", ".", - "..", - "C33", + "..", + "C33", ".", - "..", - "END"}; + "..", + "END"}; static CHAR * expected_name_1[] = { - + "A", ".", - "..", - "A1", + "..", + "A1", ".", - "..", - "A11", + "..", + "A11", ".", - "..", - "A2", + "..", + "A2", ".", - "..", - "A3", + "..", + "A3", ".", - "..", + "..", "B", ".", - "..", - "B1", + "..", + "B1", ".", - "..", - "B2", + "..", + "B2", ".", - "..", - "B23", + "..", + "B23", ".", - "..", - "B3", + "..", + "B3", ".", - "..", + "..", "C", ".", - "..", - "C1", + "..", + "C1", ".", - "..", - "C2", + "..", + "C2", ".", - "..", - "C3", + "..", + "C3", ".", - "..", - "C33", + "..", + "C33", ".", - "..", - "END"}; + "..", + "END"}; /* Define thread prototypes. */ @@ -204,14 +204,14 @@ static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); +static void *ftest_1_entry(void * thread_input); #endif - + extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -static void traverse_directory(CHAR *directory_name); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +static void traverse_directory(CHAR *directory_name); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -225,20 +225,20 @@ void filex_fault_tolerant_unicode_directory_rename_directory_interrupt_test_a #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; - + /* Create the main thread. */ - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -246,7 +246,7 @@ void filex_fault_tolerant_unicode_directory_rename_directory_interrupt_test_a cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -265,7 +265,7 @@ void filex_fault_tolerant_unicode_directory_rename_directory_interrupt_test_a static void ftest_0_entry(ULONG thread_input) { -UINT status; +UINT status; UINT i; UINT j; UINT index; @@ -276,64 +276,64 @@ FX_LOCAL_PATH local_path; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Unicode Dir Rename DIR Interrupt Test..."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -341,7 +341,7 @@ FX_LOCAL_PATH local_path; printf("ERROR!\n"); test_control_return(1); - } + } /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -355,7 +355,7 @@ FX_LOCAL_PATH local_path; test_control_return(2); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -364,7 +364,7 @@ FX_LOCAL_PATH local_path; printf("ERROR!\n"); test_control_return(3); - } + } /* Set the local path to "\\". */ #ifndef FX_STANDALONE_ENABLE @@ -372,14 +372,14 @@ FX_LOCAL_PATH local_path; #else status = fx_directory_default_set(&ram_disk, "\\"); #endif - + /* Check status. */ if (status) { printf("ERROR!\n"); test_control_return(4); - } + } /* Create a series of directories..."/A", "/B", "/C" */ length = fx_unicode_length_get(directory_name_A); @@ -397,7 +397,7 @@ FX_LOCAL_PATH local_path; printf("ERROR!\n"); test_control_return(5); } - + /* Initailize the directory structure. */ index = 0; directory_name_path_short[index++] = '/'; @@ -416,7 +416,7 @@ FX_LOCAL_PATH local_path; break; } } - + directory_name_path_short[index] = FX_NULL; /* Set the local path to /A. */ @@ -425,7 +425,7 @@ FX_LOCAL_PATH local_path; #else status = fx_directory_default_set(&ram_disk, directory_name_path_short); #endif - + /* Check for errors... */ if (status != FX_SUCCESS) { @@ -434,16 +434,16 @@ FX_LOCAL_PATH local_path; printf("ERROR!\n"); test_control_return(6); } - - /* Create the next level of sub-directories. - "/A/A1", "/A/A2", "/A/A3", */ + + /* Create the next level of sub-directories. + "/A/A1", "/A/A2", "/A/A3", */ length = fx_unicode_length_get(directory_name_A_A1); - status = fx_unicode_directory_create(&ram_disk, directory_name_A_A1, length, directory_name_A_A1_short); + status = fx_unicode_directory_create(&ram_disk, directory_name_A_A1, length, directory_name_A_A1_short); length = fx_unicode_length_get(directory_name_A_A2); - status += fx_unicode_directory_create(&ram_disk, directory_name_A_A2, length, directory_name_A_A2_short); + status += fx_unicode_directory_create(&ram_disk, directory_name_A_A2, length, directory_name_A_A2_short); length = fx_unicode_length_get(directory_name_A_A3); status += fx_unicode_directory_create(&ram_disk, directory_name_A_A3, length, directory_name_A_A3_short); - + /* Check for errors... */ if (status != FX_SUCCESS) { @@ -452,7 +452,7 @@ FX_LOCAL_PATH local_path; printf("ERROR!\n"); test_control_return(7); } - + /* Initailize the directory structure. */ index = 0; directory_name_path_short[index++] = '/'; @@ -471,7 +471,7 @@ FX_LOCAL_PATH local_path; break; } } - + directory_name_path_short[index] = FX_NULL; /* Set the local path to /B. */ @@ -480,7 +480,7 @@ FX_LOCAL_PATH local_path; #else status = fx_directory_default_set(&ram_disk, directory_name_path_short); #endif - + /* Check for errors... */ if (status != FX_SUCCESS) { @@ -489,16 +489,16 @@ FX_LOCAL_PATH local_path; printf("ERROR!\n"); test_control_return(8); } - - /* Create the next level of sub-directories. + + /* Create the next level of sub-directories. "/B/B1", "/B/B2", "/B/B3", */ length = fx_unicode_length_get(directory_name_B_B1); - status = fx_unicode_directory_create(&ram_disk, directory_name_B_B1, length, directory_name_B_B1_short); + status = fx_unicode_directory_create(&ram_disk, directory_name_B_B1, length, directory_name_B_B1_short); length = fx_unicode_length_get(directory_name_B_B2); - status += fx_unicode_directory_create(&ram_disk, directory_name_B_B2, length, directory_name_B_B2_short); + status += fx_unicode_directory_create(&ram_disk, directory_name_B_B2, length, directory_name_B_B2_short); length = fx_unicode_length_get(directory_name_B_B3); status += fx_unicode_directory_create(&ram_disk, directory_name_B_B3, length, directory_name_B_B3_short); - + /* Check for errors... */ if (status != FX_SUCCESS) { @@ -507,7 +507,7 @@ FX_LOCAL_PATH local_path; printf("ERROR!\n"); test_control_return(9); } - + /* Initailize the directory structure. */ index = 0; directory_name_path_short[index++] = '/'; @@ -525,8 +525,8 @@ FX_LOCAL_PATH local_path; { break; } - } - + } + directory_name_path_short[index] = FX_NULL; /* Set the local path to /C. */ @@ -535,7 +535,7 @@ FX_LOCAL_PATH local_path; #else status = fx_directory_default_set(&ram_disk, directory_name_path_short); #endif - + /* Check for errors... */ if (status != FX_SUCCESS) { @@ -545,12 +545,12 @@ FX_LOCAL_PATH local_path; test_control_return(10); } - /* Create the next level of sub-directories. - "/C/C1", "/C/C2", "/C/C1" */ + /* Create the next level of sub-directories. + "/C/C1", "/C/C2", "/C/C1" */ length = fx_unicode_length_get(directory_name_C_C1); - status = fx_unicode_directory_create(&ram_disk, directory_name_C_C1, length, directory_name_C_C1_short); + status = fx_unicode_directory_create(&ram_disk, directory_name_C_C1, length, directory_name_C_C1_short); length = fx_unicode_length_get(directory_name_C_C2); - status = fx_unicode_directory_create(&ram_disk, directory_name_C_C2, length, directory_name_C_C2_short); + status = fx_unicode_directory_create(&ram_disk, directory_name_C_C2, length, directory_name_C_C2_short); length = fx_unicode_length_get(directory_name_C_C3); status = fx_unicode_directory_create(&ram_disk, directory_name_C_C3, length, directory_name_C_C3_short); @@ -563,9 +563,9 @@ FX_LOCAL_PATH local_path; test_control_return(11); } - /* Now create the third level of sub-directories... + /* Now create the third level of sub-directories... "/A/A1/A11", "/B/B2/B22", "/C/C3/C33" */ - + /* Initailize the directory structure. */ index = 0; directory_name_path_short[index++] = '/'; @@ -583,8 +583,8 @@ FX_LOCAL_PATH local_path; { break; } - } - + } + directory_name_path_short[index++] = '/'; /* Construct the directory structure /A/A1. */ @@ -600,8 +600,8 @@ FX_LOCAL_PATH local_path; { break; } - } - + } + directory_name_path_short[index] = FX_NULL; /* Set the local path to /A/A1. */ @@ -611,8 +611,8 @@ FX_LOCAL_PATH local_path; status = fx_directory_default_set(&ram_disk, directory_name_path_short); #endif length = fx_unicode_length_get(directory_name_A_A1_A11); - status += fx_unicode_directory_create(&ram_disk, directory_name_A_A1_A11, length, directory_name_A_A1_A11_short); - + status += fx_unicode_directory_create(&ram_disk, directory_name_A_A1_A11, length, directory_name_A_A1_A11_short); + /* Check for errors... */ if (status != FX_SUCCESS) { @@ -621,7 +621,7 @@ FX_LOCAL_PATH local_path; printf("ERROR!\n"); test_control_return(12); } - + /* Initailize the directory structure. */ index = 0; directory_name_path_short[index++] = '/'; @@ -639,8 +639,8 @@ FX_LOCAL_PATH local_path; { break; } - } - + } + directory_name_path_short[index++] = '/'; /* Construct the directory structure /B/B2. */ @@ -657,10 +657,10 @@ FX_LOCAL_PATH local_path; break; } } - + directory_name_path_short[index] = FX_NULL; - /* Set the local path to /B/B2. */ + /* Set the local path to /B/B2. */ #ifndef FX_STANDALONE_ENABLE status = fx_directory_local_path_set(&ram_disk, &local_path, directory_name_path_short); #else @@ -668,7 +668,7 @@ FX_LOCAL_PATH local_path; #endif length = fx_unicode_length_get(directory_name_B_B2_B22); status += fx_unicode_directory_create(&ram_disk, directory_name_B_B2_B22, length, directory_name_B_B2_B22_short); - + /* Check for errors... */ if (status != FX_SUCCESS) { @@ -676,7 +676,7 @@ FX_LOCAL_PATH local_path; /* Error creating directories. Return to caller. */ printf("ERROR!\n"); test_control_return(13); - } + } /* Initailize the directory structure. */ index = 0; @@ -695,8 +695,8 @@ FX_LOCAL_PATH local_path; { break; } - } - + } + directory_name_path_short[index++] = '/'; /* Construct the directory structure /C/C3. */ @@ -713,17 +713,17 @@ FX_LOCAL_PATH local_path; break; } } - + directory_name_path_short[index] = FX_NULL; - /* Set the local path to /C/C3. */ + /* Set the local path to /C/C3. */ #ifndef FX_STANDALONE_ENABLE status = fx_directory_local_path_set(&ram_disk, &local_path, directory_name_path_short); #else status = fx_directory_default_set(&ram_disk, directory_name_path_short); #endif length = fx_unicode_length_get(directory_name_C_C3_C33); - status += fx_unicode_directory_create(&ram_disk, directory_name_C_C3_C33, length, directory_name_C_C3_C33_short); + status += fx_unicode_directory_create(&ram_disk, directory_name_C_C3_C33, length, directory_name_C_C3_C33_short); /* Check for errors... */ if (status != FX_SUCCESS) @@ -732,19 +732,19 @@ FX_LOCAL_PATH local_path; /* Error creating sub-sub-directories. Return to caller. */ printf("ERROR!\n"); test_control_return(14); - } - + } + /* Set the index as zero before traverse. */ expected_index = 0; - + /* Traverse the directory structure recursively. */ expected_name = expected_name_0; traverse_directory(FX_NULL); - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -753,14 +753,14 @@ FX_LOCAL_PATH local_path; /* Let the other thread run. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_relinquish(); + tx_thread_relinquish(); #else pthread_create(&ptid1, NULL, &ftest_1_entry, NULL); usleep(10); pthread_join(ptid1,NULL); #endif - /* After interrupt, reread the files. */ + /* After interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -772,9 +772,9 @@ FX_LOCAL_PATH local_path; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(15); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -784,22 +784,22 @@ FX_LOCAL_PATH local_path; printf("ERROR!\n"); test_control_return(16); } - + /* Set the index as zero before traverse. */ expected_index = 0; - + /* Traverse the directory structure recursively. */ expected_name = expected_name_1; traverse_directory(FX_NULL); - /* Set the local path to /B/B2. */ + /* Set the local path to /B/B2. */ #ifndef FX_STANDALONE_ENABLE - status = fx_directory_local_path_set(&ram_disk, &local_path, directory_name_path_short); + status = fx_directory_local_path_set(&ram_disk, &local_path, directory_name_path_short); #else status = fx_directory_default_set(&ram_disk, directory_name_path_short); #endif - /* Attempt to create the same directory again "/B/B2/B22". */ + /* Attempt to create the same directory again "/B/B2/B22". */ length = fx_unicode_length_get(directory_name_B_B2_B22); status = fx_unicode_directory_create(&ram_disk, directory_name_B_B2_B22, length, directory_name_B_B2_B22_short); @@ -811,8 +811,8 @@ FX_LOCAL_PATH local_path; printf("ERROR!\n"); test_control_return(17); } - - /* Attempt to create the same directory again "/B/B2/B23". */ + + /* Attempt to create the same directory again "/B/B2/B23". */ length = fx_unicode_length_get(directory_name_B_B2_B23); status = fx_unicode_directory_create(&ram_disk, directory_name_B_B2_B23, length, directory_name_B_B2_B23_short); @@ -834,7 +834,7 @@ FX_LOCAL_PATH local_path; printf("ERROR!\n"); test_control_return(18); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -842,12 +842,12 @@ FX_LOCAL_PATH local_path; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -856,27 +856,27 @@ static void ftest_1_entry(ULONG thread_input) #else void * ftest_1_entry(void * thread_input) #endif -{ +{ #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif - + UINT index; UINT j; -ULONG directory_name_B_B2_B22_length; -ULONG directory_name_B_B2_B23_length; +ULONG directory_name_B_B2_B22_length; +ULONG directory_name_B_B2_B23_length; FX_LOCAL_PATH local_path; FX_PARAMETER_NOT_USED(thread_input); /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - - /* Set the local path to /B/B2. */ + + /* Set the local path to /B/B2. */ /* Initailize the directory structure. */ index = 0; @@ -895,7 +895,7 @@ FX_LOCAL_PATH local_path; { break; } - } + } directory_name_path_short[index++] = '/'; @@ -916,18 +916,18 @@ FX_LOCAL_PATH local_path; directory_name_path_short[index] = FX_NULL; - /* Set the local path to /B/B2. */ + /* Set the local path to /B/B2. */ #ifndef FX_STANDALONE_ENABLE fx_directory_local_path_set(&ram_disk, &local_path, directory_name_path_short); #else fx_directory_default_set(&ram_disk, directory_name_path_short); #endif - directory_name_B_B2_B22_length = fx_unicode_length_get(directory_name_B_B2_B22); + directory_name_B_B2_B22_length = fx_unicode_length_get(directory_name_B_B2_B22); directory_name_B_B2_B23_length = fx_unicode_length_get(directory_name_B_B2_B23); /* Rename "/B/B2/B22" to "/B/B2/B23". */ - fx_unicode_directory_rename(&ram_disk, directory_name_B_B2_B22, directory_name_B_B2_B22_length, - directory_name_B_B2_B23, directory_name_B_B2_B23_length, directory_name_B_B2_B23_short); + fx_unicode_directory_rename(&ram_disk, directory_name_B_B2_B22, directory_name_B_B2_B22_length, + directory_name_B_B2_B23, directory_name_B_B2_B23_length, directory_name_B_B2_B23_short); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) @@ -943,14 +943,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt = FX_TRUE; - + directory_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -962,10 +962,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -1021,7 +1021,7 @@ UINT skip; /* Compare with what is expected. */ if (strcmp(name, expected_name[expected_index++])) error_counter++; - + /* Determine if this name is a directory or a file. */ status = fx_directory_name_test(&ram_disk, name); @@ -1036,7 +1036,7 @@ UINT skip; status = fx_file_close(&file); if (status != FX_SUCCESS) error_counter++; - + /* Pickup the next directory entry. */ status = fx_directory_next_entry_find(&ram_disk, name); } @@ -1050,23 +1050,23 @@ UINT skip; { /* Recursive call to traverse directory. */ traverse_directory(name); - + /* Restore path. */ #ifndef FX_STANDALONE_ENABLE - status = fx_directory_local_path_restore(&ram_disk, &local_path); -#endif + status = fx_directory_local_path_restore(&ram_disk, &local_path); +#endif } status = fx_directory_next_entry_find(&ram_disk, name); - } - } + } + } #ifndef FX_STANDALONE_ENABLE fx_directory_local_path_clear(&ram_disk); #endif } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -1074,11 +1074,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_unicode_directory_rename_directory_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Unicode Dir Rename DIR Interrupt Test...N/A\n"); + printf("FileX Test: Fault Tolerant Unicode Dir Rename DIR Interrupt Test...N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_unicode_directory_rename_redo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_unicode_directory_rename_redo_log_interrupt_test.c index fa79ec8..efeece4 100644 --- a/test/regression_test/filex_fault_tolerant_unicode_directory_rename_redo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_unicode_directory_rename_redo_log_interrupt_test.c @@ -1,18 +1,18 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check redo log interrupt for fx_unicode_directory_rename(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create directories and sub-directories; -Step4: Traverse the directory; + +Check redo log interrupt for fx_unicode_directory_rename(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create directories and sub-directories; +Step4: Traverse the directory; Step5: Create new thread to rename the directory "/B/B2/B22" to "/B/B2/B23"; -Step6: Terminate the new thread to simulate poweroff when update the redo log. -Step7: Open the media; -Step8: Enable fault tolerant feature to recover the data(undo operation); -Step9: Traverse the directory; -Step10: Recreate directory "/B/B2/B22" and "/B/B2/B23"; +Step6: Terminate the new thread to simulate poweroff when update the redo log. +Step7: Open the media; +Step8: Enable fault tolerant feature to recover the data(undo operation); +Step9: Traverse the directory; +Step10: Recreate directory "/B/B2/B22" and "/B/B2/B23"; */ #ifndef FX_STANDALONE_ENABLE @@ -27,10 +27,10 @@ Step10: Recreate directory "/B/B2/B22" and "/B/B2/B23"; #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_unicode_directory_rename_redo_log_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -41,18 +41,18 @@ void filex_fault_tolerant_unicode_directory_rename_redo_log_interrupt_test_ap /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; -static UCHAR *pointer; +static UCHAR *pointer; #define TEST_COUNT 3 /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -60,25 +60,25 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_counter = 0; -static UINT redo_log_write_interrupt = FX_FALSE; +static UINT redo_log_write_interrupt = FX_FALSE; static UCHAR directory_name_A[] = {'A', 0, 0, 0}; -static UCHAR directory_name_B[] = {'B', 0, 0, 0}; +static UCHAR directory_name_B[] = {'B', 0, 0, 0}; static UCHAR directory_name_C[] = {'C', 0, 0, 0}; static UCHAR directory_name_A_A1[] = {'A', 0, '1', 0, 0, 0}; static UCHAR directory_name_A_A2[] = {'A', 0, '2', 0, 0, 0}; -static UCHAR directory_name_A_A3[] = {'A', 0, '3', 0, 0, 0}; +static UCHAR directory_name_A_A3[] = {'A', 0, '3', 0, 0, 0}; static UCHAR directory_name_B_B1[] = {'B', 0, '1', 0, 0, 0}; static UCHAR directory_name_B_B2[] = {'B', 0, '2', 0, 0, 0}; -static UCHAR directory_name_B_B3[] = {'B', 0, '3', 0, 0, 0}; +static UCHAR directory_name_B_B3[] = {'B', 0, '3', 0, 0, 0}; static UCHAR directory_name_C_C1[] = {'C', 0, '1', 0, 0, 0}; static UCHAR directory_name_C_C2[] = {'C', 0, '2', 0, 0, 0}; -static UCHAR directory_name_C_C3[] = {'C', 0, '3', 0, 0, 0}; +static UCHAR directory_name_C_C3[] = {'C', 0, '3', 0, 0, 0}; static UCHAR directory_name_A_A1_A11[] = {'A', 0, '1', 0, '1', 0, 0, 0}; -static UCHAR directory_name_B_B2_B22[] = {'B', 0, '2', 0, '2', 0, 0, 0}; +static UCHAR directory_name_B_B2_B22[] = {'B', 0, '2', 0, '2', 0, 0, 0}; static UCHAR directory_name_B_B2_B23[] = {'B', 0, '2', 0, '3', 0, 0, 0}; -static UCHAR directory_name_C_C3_C33[] = {'C', 0, '3', 0, '3', 0, 0, 0}; +static UCHAR directory_name_C_C3_C33[] = {'C', 0, '3', 0, '3', 0, 0, 0}; static CHAR directory_name_A_short[20]; static CHAR directory_name_B_short[20]; static CHAR directory_name_C_short[20]; @@ -100,68 +100,68 @@ static CHAR directory_name_path_short[100]; static UINT expected_index = 0; static CHAR **expected_name; static CHAR * expected_name_0[] = { - + "A", ".", - "..", - "A1", + "..", + "A1", ".", - "..", - "A11", + "..", + "A11", ".", - "..", - "A2", + "..", + "A2", ".", - "..", - "A3", + "..", + "A3", ".", - "..", + "..", "B", ".", - "..", - "B1", + "..", + "B1", ".", - "..", - "B2", + "..", + "B2", ".", - "..", - "B22", + "..", + "B22", ".", - "..", - "B3", + "..", + "B3", ".", - "..", + "..", "C", ".", - "..", - "C1", + "..", + "C1", ".", - "..", - "C2", + "..", + "C2", ".", - "..", - "C3", + "..", + "C3", ".", - "..", - "C33", + "..", + "C33", ".", - "..", - "END"}; - + "..", + "END"}; + /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); +static void *ftest_1_entry(void * thread_input); #endif - + extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -static void traverse_directory(CHAR *directory_name); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +static void traverse_directory(CHAR *directory_name); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -175,22 +175,22 @@ void filex_fault_tolerant_unicode_directory_rename_redo_log_interrupt_test_ap #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; - + /* Create the main thread. */ - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -198,7 +198,7 @@ void filex_fault_tolerant_unicode_directory_rename_redo_log_interrupt_test_ap cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -217,7 +217,7 @@ void filex_fault_tolerant_unicode_directory_rename_redo_log_interrupt_test_ap static void ftest_0_entry(ULONG thread_input) { -UINT status; +UINT status; UINT i; UINT j; UINT index; @@ -228,64 +228,64 @@ FX_LOCAL_PATH local_path; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Unicode Dir Rename Redo Interrupt Test.."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -293,7 +293,7 @@ FX_LOCAL_PATH local_path; printf("ERROR!\n"); test_control_return(1); - } + } /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -307,7 +307,7 @@ FX_LOCAL_PATH local_path; test_control_return(2); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -316,7 +316,7 @@ FX_LOCAL_PATH local_path; printf("ERROR!\n"); test_control_return(3); - } + } /* Set the local path to "\\". */ #ifndef FX_STANDALONE_ENABLE @@ -324,14 +324,14 @@ FX_LOCAL_PATH local_path; #else status = fx_directory_default_set(&ram_disk, "\\"); #endif - + /* Check status. */ if (status) { printf("ERROR!\n"); test_control_return(4); - } + } /* Create a series of directories..."/A", "/B", "/C" */ length = fx_unicode_length_get(directory_name_A); @@ -349,7 +349,7 @@ FX_LOCAL_PATH local_path; printf("ERROR!\n"); test_control_return(5); } - + /* Initailize the directory structure. */ index = 0; directory_name_path_short[index++] = '/'; @@ -368,7 +368,7 @@ FX_LOCAL_PATH local_path; break; } } - + directory_name_path_short[index] = FX_NULL; /* Set the local path to /A. */ @@ -377,7 +377,7 @@ FX_LOCAL_PATH local_path; #else status = fx_directory_default_set(&ram_disk, directory_name_path_short); #endif - + /* Check for errors... */ if (status != FX_SUCCESS) { @@ -386,16 +386,16 @@ FX_LOCAL_PATH local_path; printf("ERROR!\n"); test_control_return(6); } - - /* Create the next level of sub-directories. - "/A/A1", "/A/A2", "/A/A3", */ + + /* Create the next level of sub-directories. + "/A/A1", "/A/A2", "/A/A3", */ length = fx_unicode_length_get(directory_name_A_A1); - status = fx_unicode_directory_create(&ram_disk, directory_name_A_A1, length, directory_name_A_A1_short); + status = fx_unicode_directory_create(&ram_disk, directory_name_A_A1, length, directory_name_A_A1_short); length = fx_unicode_length_get(directory_name_A_A2); - status += fx_unicode_directory_create(&ram_disk, directory_name_A_A2, length, directory_name_A_A2_short); + status += fx_unicode_directory_create(&ram_disk, directory_name_A_A2, length, directory_name_A_A2_short); length = fx_unicode_length_get(directory_name_A_A3); status += fx_unicode_directory_create(&ram_disk, directory_name_A_A3, length, directory_name_A_A3_short); - + /* Check for errors... */ if (status != FX_SUCCESS) { @@ -404,7 +404,7 @@ FX_LOCAL_PATH local_path; printf("ERROR!\n"); test_control_return(7); } - + /* Initailize the directory structure. */ index = 0; directory_name_path_short[index++] = '/'; @@ -423,7 +423,7 @@ FX_LOCAL_PATH local_path; break; } } - + directory_name_path_short[index] = FX_NULL; /* Set the local path to /B. */ @@ -432,7 +432,7 @@ FX_LOCAL_PATH local_path; #else status = fx_directory_default_set(&ram_disk, directory_name_path_short); #endif - + /* Check for errors... */ if (status != FX_SUCCESS) { @@ -441,16 +441,16 @@ FX_LOCAL_PATH local_path; printf("ERROR!\n"); test_control_return(8); } - - /* Create the next level of sub-directories. + + /* Create the next level of sub-directories. "/B/B1", "/B/B2", "/B/B3", */ length = fx_unicode_length_get(directory_name_B_B1); - status = fx_unicode_directory_create(&ram_disk, directory_name_B_B1, length, directory_name_B_B1_short); + status = fx_unicode_directory_create(&ram_disk, directory_name_B_B1, length, directory_name_B_B1_short); length = fx_unicode_length_get(directory_name_B_B2); - status += fx_unicode_directory_create(&ram_disk, directory_name_B_B2, length, directory_name_B_B2_short); + status += fx_unicode_directory_create(&ram_disk, directory_name_B_B2, length, directory_name_B_B2_short); length = fx_unicode_length_get(directory_name_B_B3); status += fx_unicode_directory_create(&ram_disk, directory_name_B_B3, length, directory_name_B_B3_short); - + /* Check for errors... */ if (status != FX_SUCCESS) { @@ -459,7 +459,7 @@ FX_LOCAL_PATH local_path; printf("ERROR!\n"); test_control_return(9); } - + /* Initailize the directory structure. */ index = 0; directory_name_path_short[index++] = '/'; @@ -477,8 +477,8 @@ FX_LOCAL_PATH local_path; { break; } - } - + } + directory_name_path_short[index] = FX_NULL; /* Set the local path to /C. */ @@ -487,7 +487,7 @@ FX_LOCAL_PATH local_path; #else status = fx_directory_default_set(&ram_disk, directory_name_path_short); #endif - + /* Check for errors... */ if (status != FX_SUCCESS) { @@ -497,12 +497,12 @@ FX_LOCAL_PATH local_path; test_control_return(10); } - /* Create the next level of sub-directories. - "/C/C1", "/C/C2", "/C/C1" */ + /* Create the next level of sub-directories. + "/C/C1", "/C/C2", "/C/C1" */ length = fx_unicode_length_get(directory_name_C_C1); - status = fx_unicode_directory_create(&ram_disk, directory_name_C_C1, length, directory_name_C_C1_short); + status = fx_unicode_directory_create(&ram_disk, directory_name_C_C1, length, directory_name_C_C1_short); length = fx_unicode_length_get(directory_name_C_C2); - status = fx_unicode_directory_create(&ram_disk, directory_name_C_C2, length, directory_name_C_C2_short); + status = fx_unicode_directory_create(&ram_disk, directory_name_C_C2, length, directory_name_C_C2_short); length = fx_unicode_length_get(directory_name_C_C3); status = fx_unicode_directory_create(&ram_disk, directory_name_C_C3, length, directory_name_C_C3_short); @@ -515,9 +515,9 @@ FX_LOCAL_PATH local_path; test_control_return(11); } - /* Now create the third level of sub-directories... + /* Now create the third level of sub-directories... "/A/A1/A11", "/B/B2/B22", "/C/C3/C33" */ - + /* Initailize the directory structure. */ index = 0; directory_name_path_short[index++] = '/'; @@ -535,8 +535,8 @@ FX_LOCAL_PATH local_path; { break; } - } - + } + directory_name_path_short[index++] = '/'; /* Construct the directory structure /A/A1. */ @@ -552,8 +552,8 @@ FX_LOCAL_PATH local_path; { break; } - } - + } + directory_name_path_short[index] = FX_NULL; /* Set the local path to /A/A1. */ @@ -563,8 +563,8 @@ FX_LOCAL_PATH local_path; status = fx_directory_default_set(&ram_disk, directory_name_path_short); #endif length = fx_unicode_length_get(directory_name_A_A1_A11); - status += fx_unicode_directory_create(&ram_disk, directory_name_A_A1_A11, length, directory_name_A_A1_A11_short); - + status += fx_unicode_directory_create(&ram_disk, directory_name_A_A1_A11, length, directory_name_A_A1_A11_short); + /* Check for errors... */ if (status != FX_SUCCESS) { @@ -573,7 +573,7 @@ FX_LOCAL_PATH local_path; printf("ERROR!\n"); test_control_return(12); } - + /* Initailize the directory structure. */ index = 0; directory_name_path_short[index++] = '/'; @@ -591,8 +591,8 @@ FX_LOCAL_PATH local_path; { break; } - } - + } + directory_name_path_short[index++] = '/'; /* Construct the directory structure /B/B2. */ @@ -609,10 +609,10 @@ FX_LOCAL_PATH local_path; break; } } - + directory_name_path_short[index] = FX_NULL; - /* Set the local path to /B/B2. */ + /* Set the local path to /B/B2. */ #ifndef FX_STANDALONE_ENABLE status = fx_directory_local_path_set(&ram_disk, &local_path, directory_name_path_short); #else @@ -620,7 +620,7 @@ FX_LOCAL_PATH local_path; #endif length = fx_unicode_length_get(directory_name_B_B2_B22); status += fx_unicode_directory_create(&ram_disk, directory_name_B_B2_B22, length, directory_name_B_B2_B22_short); - + /* Check for errors... */ if (status != FX_SUCCESS) { @@ -628,7 +628,7 @@ FX_LOCAL_PATH local_path; /* Error creating directories. Return to caller. */ printf("ERROR!\n"); test_control_return(13); - } + } /* Initailize the directory structure. */ index = 0; @@ -647,8 +647,8 @@ FX_LOCAL_PATH local_path; { break; } - } - + } + directory_name_path_short[index++] = '/'; /* Construct the directory structure /C/C3. */ @@ -665,17 +665,17 @@ FX_LOCAL_PATH local_path; break; } } - + directory_name_path_short[index] = FX_NULL; - /* Set the local path to /C/C3. */ + /* Set the local path to /C/C3. */ #ifndef FX_STANDALONE_ENABLE status = fx_directory_local_path_set(&ram_disk, &local_path, directory_name_path_short); #else status = fx_directory_default_set(&ram_disk, directory_name_path_short); #endif length = fx_unicode_length_get(directory_name_C_C3_C33); - status += fx_unicode_directory_create(&ram_disk, directory_name_C_C3_C33, length, directory_name_C_C3_C33_short); + status += fx_unicode_directory_create(&ram_disk, directory_name_C_C3_C33, length, directory_name_C_C3_C33_short); /* Check for errors... */ if (status != FX_SUCCESS) @@ -684,19 +684,19 @@ FX_LOCAL_PATH local_path; /* Error creating sub-sub-directories. Return to caller. */ printf("ERROR!\n"); test_control_return(14); - } + } /* Set the index as zero before traverse. */ expected_index = 0; - + /* Traverse the directory structure recursively. */ expected_name = expected_name_0; traverse_directory(FX_NULL); - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -712,7 +712,7 @@ FX_LOCAL_PATH local_path; pthread_join(ptid1,NULL); #endif - /* After interrupt, reread the files. */ + /* After interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -724,9 +724,9 @@ FX_LOCAL_PATH local_path; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(15); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -736,22 +736,22 @@ FX_LOCAL_PATH local_path; printf("ERROR!\n"); test_control_return(16); } - + /* Set the index as zero before traverse. */ expected_index = 0; - + /* Traverse the directory structure recursively. */ expected_name = expected_name_0; traverse_directory(FX_NULL); - /* Set the local path to /B/B2. */ + /* Set the local path to /B/B2. */ #ifndef FX_STANDALONE_ENABLE status = fx_directory_local_path_set(&ram_disk, &local_path, directory_name_path_short); #else status = fx_directory_default_set(&ram_disk, directory_name_path_short); -#endif +#endif - /* Attempt to create the same directory again "/B/B2/B22". */ + /* Attempt to create the same directory again "/B/B2/B22". */ length = fx_unicode_length_get(directory_name_B_B2_B22); status = fx_unicode_directory_create(&ram_disk, directory_name_B_B2_B22, length, directory_name_B_B2_B22_short); @@ -763,8 +763,8 @@ FX_LOCAL_PATH local_path; printf("ERROR!\n"); test_control_return(17); } - - /* Attempt to create the same directory again "/B/B2/B23". */ + + /* Attempt to create the same directory again "/B/B2/B23". */ length = fx_unicode_length_get(directory_name_B_B2_B23); status = fx_unicode_directory_create(&ram_disk, directory_name_B_B2_B23, length, directory_name_B_B2_B23_short); @@ -775,7 +775,7 @@ FX_LOCAL_PATH local_path; /* Error creating same directory twice. Return to caller. */ printf("ERROR!\n"); test_control_return(18); - } + } /* Close the media. */ status = fx_media_close(&ram_disk); @@ -786,7 +786,7 @@ FX_LOCAL_PATH local_path; printf("ERROR!\n"); test_control_return(18); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -794,12 +794,12 @@ FX_LOCAL_PATH local_path; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -808,27 +808,27 @@ static void ftest_1_entry(ULONG thread_input) #else void * ftest_1_entry(void * thread_input) #endif -{ +{ #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif - + UINT index; UINT j; -ULONG directory_name_B_B2_B22_length; -ULONG directory_name_B_B2_B23_length; +ULONG directory_name_B_B2_B22_length; +ULONG directory_name_B_B2_B23_length; FX_LOCAL_PATH local_path; FX_PARAMETER_NOT_USED(thread_input); /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - - /* Set the local path to /B/B2. */ + + /* Set the local path to /B/B2. */ /* Initailize the directory structure. */ index = 0; @@ -847,7 +847,7 @@ FX_LOCAL_PATH local_path; { break; } - } + } directory_name_path_short[index++] = '/'; @@ -868,23 +868,23 @@ FX_LOCAL_PATH local_path; directory_name_path_short[index] = FX_NULL; - /* Set the local path to /B/B2. */ + /* Set the local path to /B/B2. */ #ifndef FX_STANDALONE_ENABLE fx_directory_local_path_set(&ram_disk, &local_path, directory_name_path_short); #else fx_directory_default_set(&ram_disk, directory_name_path_short); #endif - directory_name_B_B2_B22_length = fx_unicode_length_get(directory_name_B_B2_B22); + directory_name_B_B2_B22_length = fx_unicode_length_get(directory_name_B_B2_B22); directory_name_B_B2_B23_length = fx_unicode_length_get(directory_name_B_B2_B23); /* Rename "/B/B2/B22" to "/B/B2/B23". */ - fx_unicode_directory_rename(&ram_disk, directory_name_B_B2_B22, directory_name_B_B2_B22_length, - directory_name_B_B2_B23, directory_name_B_B2_B23_length, directory_name_B_B2_B23_short); + fx_unicode_directory_rename(&ram_disk, directory_name_B_B2_B22, directory_name_B_B2_B22_length, + directory_name_B_B2_B23, directory_name_B_B2_B23_length, directory_name_B_B2_B23_short); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) { - + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the redo log write operation. */ @@ -895,14 +895,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - redo_log_write_interrupt = FX_TRUE; - + redo_log_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -914,10 +914,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -971,7 +971,7 @@ UINT skip; /* Compare with what is expected. */ if (strcmp(name, expected_name[expected_index++])) error_counter++; - + /* Determine if this name is a directory or a file. */ status = fx_directory_name_test(&ram_disk, name); @@ -986,7 +986,7 @@ UINT skip; status = fx_file_close(&file); if (status != FX_SUCCESS) error_counter++; - + /* Pickup the next directory entry. */ status = fx_directory_next_entry_find(&ram_disk, name); } @@ -1000,23 +1000,23 @@ UINT skip; { /* Recursive call to traverse directory. */ traverse_directory(name); - + /* Restore path. */ #ifndef FX_STANDALONE_ENABLE - status = fx_directory_local_path_restore(&ram_disk, &local_path); -#endif + status = fx_directory_local_path_restore(&ram_disk, &local_path); +#endif } status = fx_directory_next_entry_find(&ram_disk, name); - } - } + } + } #ifndef FX_STANDALONE_ENABLE fx_directory_local_path_clear(&ram_disk); #endif -} +} -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -1024,11 +1024,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_unicode_directory_rename_redo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Unicode Dir Rename Redo Interrupt Test..N/A\n"); + printf("FileX Test: Fault Tolerant Unicode Dir Rename Redo Interrupt Test..N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_unicode_file_create_directory_interrupt_test.c b/test/regression_test/filex_fault_tolerant_unicode_file_create_directory_interrupt_test.c index 1eeffbe..85a16d5 100644 --- a/test/regression_test/filex_fault_tolerant_unicode_file_create_directory_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_unicode_file_create_directory_interrupt_test.c @@ -1,19 +1,19 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; -Check directory interrupt for fx_unicode_file_create() : -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; +Check directory interrupt for fx_unicode_file_create() : +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 26 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to create TEST3.TXT; -Step7: Terminate the new thread to simulate poweroff when update directory. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(redo operation); +Step7: Terminate the new thread to simulate poweroff when update directory. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(redo operation); Step10: Check the test files. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" #else @@ -26,10 +26,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_unicode_file_create_directory_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -42,10 +42,10 @@ void filex_fault_tolerant_unicode_file_create_directory_interrupt_test_applic /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; @@ -54,7 +54,7 @@ static UCHAR *pointer; #define TEST_COUNT 3 /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -62,34 +62,34 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT directory_write_interrupt = FX_FALSE; -static CHAR read_buffer[1024]; -static UINT read_buffer_size = 1024; +static UINT directory_write_interrupt = FX_FALSE; +static CHAR read_buffer[1024]; +static UINT read_buffer_size = 1024; static UCHAR file_name_TEST_TXT[] = {'T', 0, 'E', 0, 'S', 0, 'T', 0, '.', 'T', 0, 'X', 0, 'T', 0, 0, 0}; static UCHAR file_name_TEST1_TXT[] = {'T', 0, 'E', 0, 'S', 0, 'T', 0, '1', 0, '.', 'T', 0, 'X', 0, 'T', 0, 0, 0}; static UCHAR file_name_TEST2_TXT[] = {'T', 0, 'E', 0, 'S', 0, 'T', 0, '2', 0, '.', 'T', 0, 'X', 0, 'T', 0, 0, 0}; -static UCHAR file_name_TEST3_TXT[] = {'T', 0, 'E', 0, 'S', 0, 'T', 0, '3', 0, '.', 'T', 0, 'X', 0, 'T', 0, 0, 0}; -static CHAR file_name_TEST_TXT_short[20]; -static CHAR file_name_TEST1_TXT_short[20]; -static CHAR file_name_TEST2_TXT_short[20]; +static UCHAR file_name_TEST3_TXT[] = {'T', 0, 'E', 0, 'S', 0, 'T', 0, '3', 0, '.', 'T', 0, 'X', 0, 'T', 0, 0, 0}; +static CHAR file_name_TEST_TXT_short[20]; +static CHAR file_name_TEST1_TXT_short[20]; +static CHAR file_name_TEST2_TXT_short[20]; static CHAR file_name_TEST3_TXT_short[20]; /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); +static void * ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -103,15 +103,15 @@ void filex_fault_tolerant_unicode_file_create_directory_interrupt_test_applic #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -120,7 +120,7 @@ void filex_fault_tolerant_unicode_file_create_directory_interrupt_test_applic cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -140,7 +140,7 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; UINT length; @@ -148,64 +148,64 @@ UINT length; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Unicode File Create DIR Interrupt Test.."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -227,7 +227,7 @@ UINT length; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -248,13 +248,13 @@ UINT length; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, file_name_TEST_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -265,7 +265,7 @@ UINT length; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -276,7 +276,7 @@ UINT length; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -287,7 +287,7 @@ UINT length; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -298,14 +298,14 @@ UINT length; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(9); } - /* Create a file called TEST1.TXT in the root directory. */ + /* Create a file called TEST1.TXT in the root directory. */ length = fx_unicode_length_get(file_name_TEST1_TXT); status = fx_unicode_file_create(&ram_disk, file_name_TEST1_TXT, length, file_name_TEST1_TXT_short); @@ -315,13 +315,13 @@ UINT length; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, file_name_TEST1_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -332,7 +332,7 @@ UINT length; status = fx_file_write(&my_file, " 012345678901234567890123\n", 26); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -343,7 +343,7 @@ UINT length; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -354,7 +354,7 @@ UINT length; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); @@ -365,14 +365,14 @@ UINT length; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(15); } - /* Create a file called TEST2.TXT in the root directory. */ + /* Create a file called TEST2.TXT in the root directory. */ length = fx_unicode_length_get(file_name_TEST2_TXT); status = fx_unicode_file_create(&ram_disk, file_name_TEST2_TXT, length, file_name_TEST2_TXT_short); @@ -382,13 +382,13 @@ UINT length; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, file_name_TEST2_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -399,7 +399,7 @@ UINT length; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -410,7 +410,7 @@ UINT length; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -421,7 +421,7 @@ UINT length; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -432,18 +432,18 @@ UINT length; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -459,7 +459,7 @@ UINT length; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -471,9 +471,9 @@ UINT length; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(22); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -488,40 +488,40 @@ UINT length; status = fx_file_open(&ram_disk, &my_file, file_name_TEST_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -532,40 +532,40 @@ UINT length; status = fx_file_open(&ram_disk, &my_file, file_name_TEST1_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -576,40 +576,40 @@ UINT length; status = fx_file_open(&ram_disk, &my_file, file_name_TEST2_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -620,40 +620,40 @@ UINT length; status = fx_file_open(&ram_disk, &my_file, file_name_TEST3_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(36); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(37); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_END_OF_FILE) || (actual != 0)) + if ((status != FX_END_OF_FILE) || (actual != 0)) { printf("ERROR!\n"); test_control_return(38); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -669,7 +669,7 @@ UINT length; printf("ERROR!\n"); test_control_return(40); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -677,12 +677,12 @@ UINT length; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -691,11 +691,11 @@ static void ftest_1_entry(ULONG thread_input) #else void * ftest_1_entry(void * thread_input) #endif -{ +{ #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -705,8 +705,8 @@ static void ftest_1_entry(ULONG thread_input) /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - - /* Create a file called TEST3.TXT in the root directory. */ + + /* Create a file called TEST3.TXT in the root directory. */ length = fx_unicode_length_get(file_name_TEST3_TXT); fx_unicode_file_create(&ram_disk, file_name_TEST3_TXT, length, file_name_TEST3_TXT_short); } @@ -724,14 +724,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt = FX_TRUE; - + directory_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -743,10 +743,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -760,7 +760,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -768,11 +768,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_unicode_file_create_directory_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Unicode File Create DIR Interrupt Test..N/A\n"); + printf("FileX Test: Fault Tolerant Unicode File Create DIR Interrupt Test..N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_unicode_file_create_redo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_unicode_file_create_redo_log_interrupt_test.c index 25126db..39a5b0e 100644 --- a/test/regression_test/filex_fault_tolerant_unicode_file_create_redo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_unicode_file_create_redo_log_interrupt_test.c @@ -1,19 +1,19 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; -Check redo log interrupt for fx_unicode_file_create() : -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; +Check redo log interrupt for fx_unicode_file_create() : +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 26 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to create TEST3.TXT; -Step7: Terminate the new thread to simulate poweroff when update redo log. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(undo operation); +Step7: Terminate the new thread to simulate poweroff when update redo log. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Check the test files. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" #else @@ -26,10 +26,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_unicode_file_create_redo_log_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -42,10 +42,10 @@ void filex_fault_tolerant_unicode_file_create_redo_log_interrupt_test_applica /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; @@ -54,7 +54,7 @@ static UCHAR *pointer; #define TEST_COUNT 3 /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -62,34 +62,34 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; -static UINT redo_log_write_interrupt = FX_FALSE; -static CHAR read_buffer[1024]; -static UINT read_buffer_size = 1024; +static UINT redo_log_write_interrupt = FX_FALSE; +static CHAR read_buffer[1024]; +static UINT read_buffer_size = 1024; static UCHAR file_name_TEST_TXT[] = {'T', 0, 'E', 0, 'S', 0, 'T', 0, '.', 'T', 0, 'X', 0, 'T', 0, 0, 0}; static UCHAR file_name_TEST1_TXT[] = {'T', 0, 'E', 0, 'S', 0, 'T', 0, '1', 0, '.', 'T', 0, 'X', 0, 'T', 0, 0, 0}; static UCHAR file_name_TEST2_TXT[] = {'T', 0, 'E', 0, 'S', 0, 'T', 0, '2', 0, '.', 'T', 0, 'X', 0, 'T', 0, 0, 0}; -static UCHAR file_name_TEST3_TXT[] = {'T', 0, 'E', 0, 'S', 0, 'T', 0, '3', 0, '.', 'T', 0, 'X', 0, 'T', 0, 0, 0}; -static CHAR file_name_TEST_TXT_short[20]; -static CHAR file_name_TEST1_TXT_short[20]; -static CHAR file_name_TEST2_TXT_short[20]; +static UCHAR file_name_TEST3_TXT[] = {'T', 0, 'E', 0, 'S', 0, 'T', 0, '3', 0, '.', 'T', 0, 'X', 0, 'T', 0, 0, 0}; +static CHAR file_name_TEST_TXT_short[20]; +static CHAR file_name_TEST1_TXT_short[20]; +static CHAR file_name_TEST2_TXT_short[20]; static CHAR file_name_TEST3_TXT_short[20]; /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); +static void * ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -103,15 +103,15 @@ void filex_fault_tolerant_unicode_file_create_redo_log_interrupt_test_applica #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -120,7 +120,7 @@ void filex_fault_tolerant_unicode_file_create_redo_log_interrupt_test_applica cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -140,7 +140,7 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; UINT length; @@ -148,64 +148,64 @@ UINT length; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant Unicode File Create Redo Interrupt Test."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -227,7 +227,7 @@ UINT length; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -248,13 +248,13 @@ UINT length; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, file_name_TEST_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -265,7 +265,7 @@ UINT length; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -276,7 +276,7 @@ UINT length; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -287,7 +287,7 @@ UINT length; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -298,14 +298,14 @@ UINT length; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(9); } - /* Create a file called TEST1.TXT in the root directory. */ + /* Create a file called TEST1.TXT in the root directory. */ length = fx_unicode_length_get(file_name_TEST1_TXT); status = fx_unicode_file_create(&ram_disk, file_name_TEST1_TXT, length, file_name_TEST1_TXT_short); @@ -315,13 +315,13 @@ UINT length; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, file_name_TEST1_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -332,7 +332,7 @@ UINT length; status = fx_file_write(&my_file, " 012345678901234567890123\n", 26); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -343,7 +343,7 @@ UINT length; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -354,7 +354,7 @@ UINT length; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); @@ -365,14 +365,14 @@ UINT length; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(15); } - /* Create a file called TEST2.TXT in the root directory. */ + /* Create a file called TEST2.TXT in the root directory. */ length = fx_unicode_length_get(file_name_TEST2_TXT); status = fx_unicode_file_create(&ram_disk, file_name_TEST2_TXT, length, file_name_TEST2_TXT_short); @@ -382,13 +382,13 @@ UINT length; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, file_name_TEST2_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -399,7 +399,7 @@ UINT length; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -410,7 +410,7 @@ UINT length; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -421,7 +421,7 @@ UINT length; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -432,18 +432,18 @@ UINT length; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); } - + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -459,7 +459,7 @@ UINT length; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -471,9 +471,9 @@ UINT length; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(22); - } + } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -488,40 +488,40 @@ UINT length; status = fx_file_open(&ram_disk, &my_file, file_name_TEST_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -532,40 +532,40 @@ UINT length; status = fx_file_open(&ram_disk, &my_file, file_name_TEST1_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -576,40 +576,40 @@ UINT length; status = fx_file_open(&ram_disk, &my_file, file_name_TEST2_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(32); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(34); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -620,17 +620,17 @@ UINT length; status = fx_file_open(&ram_disk, &my_file, file_name_TEST3_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status == FX_SUCCESS) + if (status == FX_SUCCESS) { printf("ERROR!\n"); test_control_return(36); - } + } - /* Create a file called TEST3.TXT in the root directory. */ + /* Create a file called TEST3.TXT in the root directory. */ length = fx_unicode_length_get(file_name_TEST3_TXT); status = fx_unicode_file_create(&ram_disk, file_name_TEST3_TXT, length, file_name_TEST3_TXT_short); - + /* Check the create status. */ if (status != FX_SUCCESS) { @@ -648,7 +648,7 @@ UINT length; printf("ERROR!\n"); test_control_return(38); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -656,12 +656,12 @@ UINT length; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -670,11 +670,11 @@ static void ftest_1_entry(ULONG thread_input) #else void * ftest_1_entry(void * thread_input) #endif -{ +{ #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif @@ -684,15 +684,15 @@ static void ftest_1_entry(ULONG thread_input) /* Set the callback function to simulate poweoff operation when write FAT entry. */ driver_write_callback = my_driver_write; - - /* Create a file called TEST3.TXT in the root directory. */ + + /* Create a file called TEST3.TXT in the root directory. */ length = fx_unicode_length_get(file_name_TEST3_TXT); fx_unicode_file_create(&ram_disk, file_name_TEST3_TXT, length, file_name_TEST3_TXT_short); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) { - + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the redo log write operation. */ @@ -703,14 +703,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - redo_log_write_interrupt = FX_TRUE; - + redo_log_write_interrupt = FX_TRUE; + /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -722,10 +722,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -739,7 +739,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -747,11 +747,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_unicode_file_create_redo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Unicode File Create Redo Interrupt Test.N/A\n"); + printf("FileX Test: Fault Tolerant Unicode File Create Redo Interrupt Test.N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_unicode_file_rename_directory_interrupt_test.c b/test/regression_test/filex_fault_tolerant_unicode_file_rename_directory_interrupt_test.c index 0031739..6738450 100644 --- a/test/regression_test/filex_fault_tolerant_unicode_file_rename_directory_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_unicode_file_rename_directory_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check directory interrupt for fx_unicode_file_rename(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check directory interrupt for fx_unicode_file_rename(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 26 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to rename TEST2.TXT to TEST3.TXT; -Step7: Terminate the new thread to simulate poweroff when update the directory after record the redo log. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(redo operation); +Step7: Terminate the new thread to simulate poweroff when update the directory after record the redo log. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(redo operation); Step10: Check the test files. */ @@ -27,10 +27,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_unicode_file_rename_directory_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -44,17 +44,17 @@ void filex_fault_tolerant_unicode_file_rename_directory_interrupt_test_applic /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -62,34 +62,34 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; static UINT directory_write_interrupt = FX_FALSE; -static CHAR read_buffer[1024]; -static UINT read_buffer_size = 1024; - +static CHAR read_buffer[1024]; +static UINT read_buffer_size = 1024; + static UCHAR file_name_TEST_TXT[] = {'T', 0, 'E', 0, 'S', 0, 'T', 0, '.', 'T', 0, 'X', 0, 'T', 0, 0, 0}; static UCHAR file_name_TEST1_TXT[] = {'T', 0, 'E', 0, 'S', 0, 'T', 0, '1', 0, '.', 'T', 0, 'X', 0, 'T', 0, 0, 0}; static UCHAR file_name_TEST2_TXT[] = {'T', 0, 'E', 0, 'S', 0, 'T', 0, '2', 0, '.', 'T', 0, 'X', 0, 'T', 0, 0, 0}; -static UCHAR file_name_TEST3_TXT[] = {'T', 0, 'E', 0, 'S', 0, 'T', 0, '3', 0, '.', 'T', 0, 'X', 0, 'T', 0, 0, 0}; -static CHAR file_name_TEST_TXT_short[20]; -static CHAR file_name_TEST1_TXT_short[20]; -static CHAR file_name_TEST2_TXT_short[20]; +static UCHAR file_name_TEST3_TXT[] = {'T', 0, 'E', 0, 'S', 0, 'T', 0, '3', 0, '.', 'T', 0, 'X', 0, 'T', 0, 0, 0}; +static CHAR file_name_TEST_TXT_short[20]; +static CHAR file_name_TEST1_TXT_short[20]; +static CHAR file_name_TEST2_TXT_short[20]; static CHAR file_name_TEST3_TXT_short[20]; /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); +static void * ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -103,15 +103,15 @@ void filex_fault_tolerant_unicode_file_rename_directory_interrupt_test_applic #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -120,7 +120,7 @@ void filex_fault_tolerant_unicode_file_rename_directory_interrupt_test_applic cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -140,7 +140,7 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; UINT length; @@ -148,64 +148,64 @@ UINT length; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Unicode Rename DIR Interrupt Test.."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -227,7 +227,7 @@ UINT length; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -238,7 +238,7 @@ UINT length; test_control_return(3); } - /* Create a file called TEST.TXT in the root directory. */ + /* Create a file called TEST.TXT in the root directory. */ length = fx_unicode_length_get(file_name_TEST_TXT); status = fx_unicode_file_create(&ram_disk, file_name_TEST_TXT, length, file_name_TEST_TXT_short); @@ -248,13 +248,13 @@ UINT length; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, file_name_TEST_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -265,7 +265,7 @@ UINT length; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -276,7 +276,7 @@ UINT length; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -287,7 +287,7 @@ UINT length; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -298,14 +298,14 @@ UINT length; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(9); } - /* Create a file called TEST1.TXT in the root directory. */ + /* Create a file called TEST1.TXT in the root directory. */ length = fx_unicode_length_get(file_name_TEST1_TXT); status = fx_unicode_file_create(&ram_disk, file_name_TEST1_TXT, length, file_name_TEST1_TXT_short); @@ -315,13 +315,13 @@ UINT length; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, file_name_TEST1_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -332,7 +332,7 @@ UINT length; status = fx_file_write(&my_file, " 012345678901234567890123\n", 26); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -343,7 +343,7 @@ UINT length; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -354,7 +354,7 @@ UINT length; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); @@ -365,7 +365,7 @@ UINT length; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -382,13 +382,13 @@ UINT length; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, file_name_TEST2_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -399,7 +399,7 @@ UINT length; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -410,7 +410,7 @@ UINT length; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -421,7 +421,7 @@ UINT length; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -432,17 +432,17 @@ UINT length; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); - } - + } + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -458,7 +458,7 @@ UINT length; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -472,7 +472,7 @@ UINT length; test_control_return(22); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -487,40 +487,40 @@ UINT length; status = fx_file_open(&ram_disk, &my_file, file_name_TEST_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -531,40 +531,40 @@ UINT length; status = fx_file_open(&ram_disk, &my_file, file_name_TEST1_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -573,7 +573,7 @@ UINT length; /* Shortname should be same, file_name_TEST2_TXT_short should be same as file_name_TEST3_TXT_short. */ if (strcmp(file_name_TEST2_TXT_short, file_name_TEST3_TXT_short)) - { + { printf("ERROR!\n"); test_control_return(32); } @@ -582,47 +582,47 @@ UINT length; status = fx_file_open(&ram_disk, &my_file, file_name_TEST2_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(34); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(35); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(36); - } + } - /* Create a file called TEST2.TXT in the root directory again. */ + /* Create a file called TEST2.TXT in the root directory again. */ length = fx_unicode_length_get(file_name_TEST2_TXT); status = fx_unicode_file_create(&ram_disk, file_name_TEST2_TXT, length, file_name_TEST2_TXT_short); @@ -632,9 +632,9 @@ UINT length; printf("ERROR!\n"); test_control_return(37); - } + } - /* Create a file called TEST3.TXT in the root directory again. */ + /* Create a file called TEST3.TXT in the root directory again. */ length = fx_unicode_length_get(file_name_TEST3_TXT); status = fx_unicode_file_create(&ram_disk, file_name_TEST3_TXT, length, file_name_TEST3_TXT_short); @@ -655,7 +655,7 @@ UINT length; printf("ERROR!\n"); test_control_return(39); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -663,12 +663,12 @@ UINT length; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -677,16 +677,16 @@ static void ftest_1_entry(ULONG thread_input) #else void * ftest_1_entry(void * thread_input) #endif -{ +{ #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif UINT test2_length; - UINT test3_length; + UINT test3_length; FX_PARAMETER_NOT_USED(thread_input); @@ -694,7 +694,7 @@ static void ftest_1_entry(ULONG thread_input) driver_write_callback = my_driver_write; /* Rename the file name from "TEST2.TXT" to "TEST3.TXT". */ - test2_length = fx_unicode_length_get(file_name_TEST2_TXT); + test2_length = fx_unicode_length_get(file_name_TEST2_TXT); test3_length = fx_unicode_length_get(file_name_TEST3_TXT); fx_unicode_file_rename(&ram_disk, file_name_TEST2_TXT, test2_length, file_name_TEST3_TXT, test3_length, file_name_TEST3_TXT_short); } @@ -712,14 +712,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt = FX_TRUE; + directory_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -731,10 +731,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -748,7 +748,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -756,11 +756,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_unicode_file_rename_directory_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Unicode Rename DIR Interrupt Test..N/A\n"); + printf("FileX Test: Fault Tolerant File Unicode Rename DIR Interrupt Test..N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_unicode_file_rename_redo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_unicode_file_rename_redo_log_interrupt_test.c index e596fc6..edbe607 100644 --- a/test/regression_test/filex_fault_tolerant_unicode_file_rename_redo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_unicode_file_rename_redo_log_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant directory write interrupt operation. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; - -Check redo log interrupt for fx_unicode_file_rename(): -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create and write 28 bytes into TEST.TXT; + +Check redo log interrupt for fx_unicode_file_rename(): +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create and write 28 bytes into TEST.TXT; Step4: Create and write 26 bytes into TEST1.TXT; -Step5: Create and write 19 bytes into TEST2.TXT; +Step5: Create and write 19 bytes into TEST2.TXT; Step6: Create new thread to rename TEST2.TXT to TEST3.TXT; -Step7: Terminate the new thread to simulate poweroff when update redo log. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(undo operation); +Step7: Terminate the new thread to simulate poweroff when update redo log. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Check the test files. */ @@ -27,10 +27,10 @@ Step10: Check the test files. #include "fx_system.h" #include "fx_fault_tolerant.h" #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_unicode_file_rename_redo_log_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT_DATA) #define DEMO_STACK_SIZE 4096 @@ -44,17 +44,17 @@ void filex_fault_tolerant_unicode_file_rename_redo_log_interrupt_test_applica /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -62,34 +62,34 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif static UINT error_couter = 0; static UINT redo_log_write_interrupt = FX_FALSE; -static CHAR read_buffer[1024]; -static UINT read_buffer_size = 1024; - +static CHAR read_buffer[1024]; +static UINT read_buffer_size = 1024; + static UCHAR file_name_TEST_TXT[] = {'T', 0, 'E', 0, 'S', 0, 'T', 0, '.', 'T', 0, 'X', 0, 'T', 0, 0, 0}; static UCHAR file_name_TEST1_TXT[] = {'T', 0, 'E', 0, 'S', 0, 'T', 0, '1', 0, '.', 'T', 0, 'X', 0, 'T', 0, 0, 0}; static UCHAR file_name_TEST2_TXT[] = {'T', 0, 'E', 0, 'S', 0, 'T', 0, '2', 0, '.', 'T', 0, 'X', 0, 'T', 0, 0, 0}; -static UCHAR file_name_TEST3_TXT[] = {'T', 0, 'E', 0, 'S', 0, 'T', 0, '3', 0, '.', 'T', 0, 'X', 0, 'T', 0, 0, 0}; -static CHAR file_name_TEST_TXT_short[20]; -static CHAR file_name_TEST1_TXT_short[20]; -static CHAR file_name_TEST2_TXT_short[20]; +static UCHAR file_name_TEST3_TXT[] = {'T', 0, 'E', 0, 'S', 0, 'T', 0, '3', 0, '.', 'T', 0, 'X', 0, 'T', 0, 0, 0}; +static CHAR file_name_TEST_TXT_short[20]; +static CHAR file_name_TEST1_TXT_short[20]; +static CHAR file_name_TEST2_TXT_short[20]; static CHAR file_name_TEST3_TXT_short[20]; /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); +static void * ftest_1_entry(void * thread_input); #endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); @@ -103,15 +103,15 @@ void filex_fault_tolerant_unicode_file_rename_redo_log_interrupt_test_applica #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -120,7 +120,7 @@ void filex_fault_tolerant_unicode_file_rename_redo_log_interrupt_test_applica cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -140,7 +140,7 @@ static void ftest_0_entry(ULONG thread_input) { UINT status; -ULONG actual; +ULONG actual; UINT i; UINT length; @@ -148,64 +148,64 @@ UINT length; /* Print out some test information banners. */ printf("FileX Test: Fault Tolerant File Unicode Rename Redo Interrupt Test."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -227,7 +227,7 @@ UINT length; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -238,7 +238,7 @@ UINT length; test_control_return(3); } - /* Create a file called TEST.TXT in the root directory. */ + /* Create a file called TEST.TXT in the root directory. */ length = fx_unicode_length_get(file_name_TEST_TXT); status = fx_unicode_file_create(&ram_disk, file_name_TEST_TXT, length, file_name_TEST_TXT_short); @@ -248,13 +248,13 @@ UINT length; printf("ERROR!\n"); test_control_return(4); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, file_name_TEST_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -265,7 +265,7 @@ UINT length; status = fx_file_write(&my_file, " ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 28); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -276,7 +276,7 @@ UINT length; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -287,7 +287,7 @@ UINT length; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); @@ -298,14 +298,14 @@ UINT length; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(9); } - /* Create a file called TEST1.TXT in the root directory. */ + /* Create a file called TEST1.TXT in the root directory. */ length = fx_unicode_length_get(file_name_TEST1_TXT); status = fx_unicode_file_create(&ram_disk, file_name_TEST1_TXT, length, file_name_TEST1_TXT_short); @@ -315,13 +315,13 @@ UINT length; printf("ERROR!\n"); test_control_return(10); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, file_name_TEST1_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -332,7 +332,7 @@ UINT length; status = fx_file_write(&my_file, " 012345678901234567890123\n", 26); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -343,7 +343,7 @@ UINT length; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -354,7 +354,7 @@ UINT length; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); @@ -365,7 +365,7 @@ UINT length; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -382,13 +382,13 @@ UINT length; printf("ERROR!\n"); test_control_return(16); - } + } /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, file_name_TEST2_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -399,7 +399,7 @@ UINT length; status = fx_file_write(&my_file, " EXPRESSLOGIC_TEST\n", 19); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -410,7 +410,7 @@ UINT length; status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -421,7 +421,7 @@ UINT length; status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); @@ -432,17 +432,17 @@ UINT length; status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(21); - } - + } + /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -458,7 +458,7 @@ UINT length; pthread_join(ptid1,NULL); #endif - /* After write interrupt, reread the files. */ + /* After write interrupt, reread the files. */ /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -472,7 +472,7 @@ UINT length; test_control_return(22); } - /* Enable the Fault-tolerant feature to recover the media. */ + /* Enable the Fault-tolerant feature to recover the media. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ @@ -487,40 +487,40 @@ UINT length; status = fx_file_open(&ram_disk, &my_file, file_name_TEST_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(24); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(25); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 28)) + if ((status != FX_SUCCESS) || (actual != 28)) { printf("ERROR!\n"); test_control_return(26); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -531,40 +531,40 @@ UINT length; status = fx_file_open(&ram_disk, &my_file, file_name_TEST1_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(28); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(29); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 26)) + if ((status != FX_SUCCESS) || (actual != 26)) { printf("ERROR!\n"); test_control_return(30); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -573,7 +573,7 @@ UINT length; /* Shortname should be same, file_name_TEST2_TXT_short should be same as file_name_TEST3_TXT_short. */ if (strcmp(file_name_TEST2_TXT_short, file_name_TEST3_TXT_short)) - { + { printf("ERROR!\n"); test_control_return(32); } @@ -582,47 +582,47 @@ UINT length; status = fx_file_open(&ram_disk, &my_file, file_name_TEST2_TXT_short, FX_OPEN_FOR_WRITE); /* Check the file open status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(33); - } + } /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(34); - } + } /* Read the bytes of the test file. */ status = fx_file_read(&my_file, read_buffer, read_buffer_size, &actual); /* Check the file read status. */ - if ((status != FX_SUCCESS) || (actual != 19)) + if ((status != FX_SUCCESS) || (actual != 19)) { printf("ERROR!\n"); test_control_return(35); - } + } /* Close the test file. */ status = fx_file_close(&my_file); /* Check the file close status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(36); - } + } - /* Create a file called TEST2.TXT in the root directory again. */ + /* Create a file called TEST2.TXT in the root directory again. */ length = fx_unicode_length_get(file_name_TEST2_TXT); status = fx_unicode_file_create(&ram_disk, file_name_TEST2_TXT, length, file_name_TEST2_TXT_short); @@ -632,9 +632,9 @@ UINT length; printf("ERROR!\n"); test_control_return(37); - } + } - /* Create a file called TEST3.TXT in the root directory again. */ + /* Create a file called TEST3.TXT in the root directory again. */ length = fx_unicode_length_get(file_name_TEST3_TXT); status = fx_unicode_file_create(&ram_disk, file_name_TEST3_TXT, length, file_name_TEST3_TXT_short); @@ -655,7 +655,7 @@ UINT length; printf("ERROR!\n"); test_control_return(39); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -663,12 +663,12 @@ UINT length; #else pthread_cancel(ptid1); #endif - } + } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} /* Define the test threads. */ @@ -677,16 +677,16 @@ static void ftest_1_entry(ULONG thread_input) #else void * ftest_1_entry(void * thread_input) #endif -{ +{ #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif UINT test2_length; - UINT test3_length; + UINT test3_length; FX_PARAMETER_NOT_USED(thread_input); @@ -694,14 +694,14 @@ static void ftest_1_entry(ULONG thread_input) driver_write_callback = my_driver_write; /* Rename the file name from "TEST2.TXT" to "TEST3.TXT". */ - test2_length = fx_unicode_length_get(file_name_TEST2_TXT); + test2_length = fx_unicode_length_get(file_name_TEST2_TXT); test3_length = fx_unicode_length_get(file_name_TEST3_TXT); fx_unicode_file_rename(&ram_disk, file_name_TEST2_TXT, test2_length, file_name_TEST3_TXT, test3_length, file_name_TEST3_TXT_short); } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) { - + FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the redo log write operation. */ @@ -712,14 +712,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - redo_log_write_interrupt = FX_TRUE; + redo_log_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -731,10 +731,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -748,7 +748,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -756,11 +756,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_unicode_file_rename_redo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant File Unicode Rename Redo Interrupt Test.N/A\n"); + printf("FileX Test: Fault Tolerant File Unicode Rename Redo Interrupt Test.N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_write_large_data_directory_interrupt_test.c b/test/regression_test/filex_fault_tolerant_write_large_data_directory_interrupt_test.c index 9779c1d..fe5ebf5 100644 --- a/test/regression_test/filex_fault_tolerant_write_large_data_directory_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_write_large_data_directory_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant write large data directory interrupt test. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; -Check write large data fat interrupt operation: -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create new file called "TEST.TXT"; -Step4: Get the media available bytes; -Step5: Write large bytes out of the file to fill the media -Step7: Terminate the new thread to simulate poweroff when write the directory after record the redo log. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(redo operation); +Check write large data fat interrupt operation: +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create new file called "TEST.TXT"; +Step4: Get the media available bytes; +Step5: Write large bytes out of the file to fill the media +Step7: Terminate the new thread to simulate poweroff when write the directory after record the redo log. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(redo operation); Step10: Check the test files. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" #else @@ -20,15 +20,15 @@ Step10: Check the test files. #include #include #endif -#include "fx_api.h" +#include "fx_api.h" #include "fx_system.h" #include "fx_fault_tolerant.h" #include #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_write_large_data_directory_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) #define DEMO_STACK_SIZE 4096 @@ -39,17 +39,17 @@ void filex_fault_tolerant_write_large_data_directory_interrupt_test_applicati /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -57,29 +57,29 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif -static UINT error_couter = 0; +#endif +static UINT error_couter = 0; static ULONG write_data_size; static ULONG available_bytes; -static UINT directory_write_interrupt = FX_FALSE; +static UINT directory_write_interrupt = FX_FALSE; static ULONG i, j; #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void *ftest_1_entry(void * thread_input); -#endif +static void *ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); -static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); /* Define what the initial system looks like. */ @@ -91,24 +91,24 @@ void filex_fault_tolerant_write_large_data_directory_interrupt_test_applicati #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; - /* Setup memory for the RAM disk and the sector cache. */ + /* Setup memory for the RAM disk and the sector cache. */ cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -119,7 +119,7 @@ void filex_fault_tolerant_write_large_data_directory_interrupt_test_applicati ftest_0_entry(0); #endif } - + /* Define the test threads. */ @@ -154,57 +154,57 @@ ULONG data_value; if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4000 * 8, // Total sectors - 256, // Sector size + 4000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 60000 * 8, // Total sectors - 256, // Sector size + 60000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 400000 * 8, // Total sectors - 256, // Sector size + 400000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -226,17 +226,17 @@ ULONG data_value; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ if (status) { - + printf("ERROR!\n"); test_control_return(3); } - + /* Create a file called TEST.TXT in the root directory. */ status = fx_file_create(&ram_disk, "TEST.TXT"); @@ -269,13 +269,13 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(6); } - + write_data_size = available_bytes; /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -290,7 +290,7 @@ ULONG data_value; usleep(10); pthread_join(ptid1,NULL); #endif - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -303,16 +303,16 @@ ULONG data_value; test_control_return(8); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ if (status) { - + printf("ERROR!\n"); test_control_return(9); - } + } /* Pickup the available bytes in the media again. */ status = fx_media_space_available(&ram_disk, &j); @@ -324,7 +324,7 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(10); } - + /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); @@ -350,7 +350,7 @@ ULONG data_value; /* Now read in all the bytes again to make sure the file contents are really there. */ status = fx_file_read(&my_file, (void *) large_data_buffer, large_data_buffer_size, &actual); - /* Check the file read status. */ + /* Check the file read status. */ if ((status != FX_SUCCESS) || (actual != write_data_size)) { @@ -367,8 +367,8 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(14); - } - + } + /* Close the media. */ status = fx_media_close(&ram_disk); @@ -378,21 +378,21 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(15); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE tx_thread_delete(&ftest_1); -#else +#else pthread_cancel(ptid1); #endif } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} - +} + /* Define the test threads. */ #ifndef FX_STANDALONE_ENABLE @@ -400,34 +400,34 @@ static void ftest_1_entry(ULONG thread_input) #else void * ftest_1_entry(void * thread_input) #endif -{ +{ #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif - UINT status; - + UINT status; + FX_PARAMETER_NOT_USED(thread_input); - /* Set the callback function to simulate poweoff operation when write FAT entry. */ - driver_write_callback = my_driver_write; + /* Set the callback function to simulate poweoff operation when write FAT entry. */ + driver_write_callback = my_driver_write; /* Write the data to fill the media one time. */ status = fx_file_write(&my_file, (void *) large_data_buffer, write_data_size); /* Check the file write status. */ if (status != FX_SUCCESS) - { + { error_couter ++; #ifndef FX_STANDALONE_ENABLE return; #else return NULL; #endif - } + } } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) @@ -443,14 +443,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - directory_write_interrupt = FX_TRUE; + directory_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -462,10 +462,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -479,7 +479,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -487,11 +487,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_write_large_data_directory_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Write Large Data Dir Interrupt test.....N/A\n"); + printf("FileX Test: Fault Tolerant Write Large Data Dir Interrupt test.....N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_write_large_data_fat_chain_cleanup_interrupt_test.c b/test/regression_test/filex_fault_tolerant_write_large_data_fat_chain_cleanup_interrupt_test.c index 2f0e5f3..5c367f3 100644 --- a/test/regression_test/filex_fault_tolerant_write_large_data_fat_chain_cleanup_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_write_large_data_fat_chain_cleanup_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant write large data fat interrupt test. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; -Check write large data fat interrupt operation: -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create new file called "TEST.TXT"; -Step4: Get the media available bytes; -Step5: Write large bytes out of the file to fill the media -Step7: Terminate the new thread to simulate poweroff when cleanup the fat chain after redo log generated. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(redo operation); +Check write large data fat interrupt operation: +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create new file called "TEST.TXT"; +Step4: Get the media available bytes; +Step5: Write large bytes out of the file to fill the media +Step7: Terminate the new thread to simulate poweroff when cleanup the fat chain after redo log generated. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(redo operation); Step10: Check the test files. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" #else @@ -20,15 +20,15 @@ Step10: Check the test files. #include #include #endif -#include "fx_api.h" +#include "fx_api.h" #include "fx_system.h" #include "fx_fault_tolerant.h" #include #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_write_large_data_fat_chain_cleanup_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) #define DEMO_STACK_SIZE 4096 @@ -39,17 +39,17 @@ void filex_fault_tolerant_write_large_data_fat_chain_cleanup_interrupt_test_a /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -57,29 +57,29 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif -static UINT error_couter = 0; +#endif +static UINT error_couter = 0; static ULONG write_data_size; static ULONG available_bytes; -static UINT fat_chain_cleanup_interrupt = FX_FALSE; +static UINT fat_chain_cleanup_interrupt = FX_FALSE; static ULONG i, j; #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); -#endif +static void * ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); -static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); /* Define what the initial system looks like. */ @@ -91,24 +91,24 @@ void filex_fault_tolerant_write_large_data_fat_chain_cleanup_interrupt_test_a #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; - /* Setup memory for the RAM disk and the sector cache. */ + /* Setup memory for the RAM disk and the sector cache. */ cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -119,7 +119,7 @@ void filex_fault_tolerant_write_large_data_fat_chain_cleanup_interrupt_test_a ftest_0_entry(0); #endif } - + /* Define the test threads. */ @@ -154,57 +154,57 @@ ULONG data_value; if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4000 * 8, // Total sectors - 256, // Sector size + 4000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 60000 * 8, // Total sectors - 256, // Sector size + 60000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 400000 * 8, // Total sectors - 256, // Sector size + 400000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -226,17 +226,17 @@ ULONG data_value; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ if (status) { - + printf("ERROR!\n"); test_control_return(3); } - + /* Create a file called TEST.TXT in the root directory. */ status = fx_file_create(&ram_disk, "TEST.TXT"); @@ -257,17 +257,17 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(5); - } + } /* Write 2500 data to test file, take up two cluster. */ status = fx_file_write(&my_file, (void *) large_data_buffer, 2500); /* Check the file write status. */ if (status != FX_SUCCESS) - { + { printf("ERROR!\n"); test_control_return(5); - } + } /* Pickup the available bytes in the media. */ status = fx_media_space_available(&ram_disk, &available_bytes); @@ -279,13 +279,13 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(6); } - + write_data_size = available_bytes; /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -300,7 +300,7 @@ ULONG data_value; usleep(10); pthread_join(ptid1,NULL); #endif - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -313,21 +313,21 @@ ULONG data_value; test_control_return(8); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ if (status) { - + printf("ERROR!\n"); test_control_return(9); - } + } /* Pickup the available bytes in the media again. */ status = fx_media_space_available(&ram_disk, &j); { - + /* Check for available bytes error, two cluster. */ if ((status != FX_SUCCESS) || (j != 2048 * 2)) { @@ -336,7 +336,7 @@ ULONG data_value; test_control_return(10); } } - + /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); @@ -362,7 +362,7 @@ ULONG data_value; /* Now read in all the bytes again to make sure the file contents are really there. */ status = fx_file_read(&my_file, (void *) large_data_buffer, large_data_buffer_size, &actual); - /* Check the file read status. */ + /* Check the file read status. */ if ((status != FX_SUCCESS) || (actual != write_data_size)) { @@ -379,8 +379,8 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(14); - } - + } + /* Close the media. */ status = fx_media_close(&ram_disk); @@ -390,7 +390,7 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(15); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -400,11 +400,11 @@ ULONG data_value; #endif } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} - +} + /* Define the test threads. */ #ifndef FX_STANDALONE_ENABLE @@ -416,23 +416,23 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif - UINT status; - + UINT status; + FX_PARAMETER_NOT_USED(thread_input); - /* Set the callback function to simulate poweoff operation when write FAT entry. */ - driver_write_callback = my_driver_write; + /* Set the callback function to simulate poweoff operation when write FAT entry. */ + driver_write_callback = my_driver_write; /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ if (status != FX_SUCCESS) - { + { error_couter ++; #ifndef FX_STANDALONE_ENABLE return; @@ -446,14 +446,14 @@ static void ftest_1_entry(ULONG thread_input) /* Check the file write status. */ if (status != FX_SUCCESS) - { + { error_couter ++; #ifndef FX_STANDALONE_ENABLE return; #else return NULL; #endif - } + } } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) @@ -469,14 +469,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - fat_chain_cleanup_interrupt = FX_TRUE; + fat_chain_cleanup_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -488,10 +488,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -505,7 +505,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -513,11 +513,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_write_large_data_fat_chain_cleanup_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Write Large Data Fat Chain Cleanup Test.N/A\n"); + printf("FileX Test: Fault Tolerant Write Large Data Fat Chain Cleanup Test.N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_write_large_data_fat_interrupt_test.c b/test/regression_test/filex_fault_tolerant_write_large_data_fat_interrupt_test.c index 464aabe..50aa930 100644 --- a/test/regression_test/filex_fault_tolerant_write_large_data_fat_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_write_large_data_fat_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant write large data fat interrupt test. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; -Check write large data fat interrupt operation: -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create new file called "TEST.TXT"; -Step4: Get the media available bytes; -Step5: Write large bytes out of the file to fill the media -Step7: Terminate the new thread to simulate poweroff when update the fat between undo log generated and redo log not generated. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(undo operation); +Check write large data fat interrupt operation: +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create new file called "TEST.TXT"; +Step4: Get the media available bytes; +Step5: Write large bytes out of the file to fill the media +Step7: Terminate the new thread to simulate poweroff when update the fat between undo log generated and redo log not generated. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Check the test files. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" #else @@ -20,15 +20,15 @@ Step10: Check the test files. #include #include #endif -#include "fx_api.h" +#include "fx_api.h" #include "fx_system.h" #include "fx_fault_tolerant.h" #include #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_write_large_data_fat_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) #define DEMO_STACK_SIZE 4096 @@ -39,10 +39,10 @@ void filex_fault_tolerant_write_large_data_fat_interrupt_test_application_def /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; @@ -51,36 +51,36 @@ static UCHAR *pointer; /* Define the counters used in the test application... */ #ifndef FX_STANDALONE_ENABLE -static UCHAR *cache_buffer; -static UCHAR *fault_tolerant_buffer; +static UCHAR *cache_buffer; +static UCHAR *fault_tolerant_buffer; static UCHAR *thread_buffer; #else -static UCHAR cache_buffer[CACHE_SIZE]; +static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif -static UINT error_couter = 0; +static UINT error_couter = 0; static ULONG write_data_size; static ULONG available_bytes; -static UINT fat_write_interrupt = FX_FALSE; +static UINT fat_write_interrupt = FX_FALSE; static ULONG i, j; #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); -#endif +static void * ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); -static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); /* Define what the initial system looks like. */ @@ -92,24 +92,24 @@ void filex_fault_tolerant_write_large_data_fat_interrupt_test_application_def #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; - /* Setup memory for the RAM disk and the sector cache. */ + /* Setup memory for the RAM disk and the sector cache. */ cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -120,7 +120,7 @@ void filex_fault_tolerant_write_large_data_fat_interrupt_test_application_def ftest_0_entry(0); #endif } - + /* Define the test threads. */ @@ -155,57 +155,57 @@ ULONG data_value; if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4000 * 8, // Total sectors - 256, // Sector size + 4000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 60000 * 8, // Total sectors - 256, // Sector size + 60000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 400000 * 8, // Total sectors - 256, // Sector size + 400000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -227,17 +227,17 @@ ULONG data_value; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ if (status) { - + printf("ERROR!\n"); test_control_return(3); } - + /* Create a file called TEST.TXT in the root directory. */ status = fx_file_create(&ram_disk, "TEST.TXT"); @@ -270,13 +270,13 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(6); } - + write_data_size = available_bytes; /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -291,7 +291,7 @@ ULONG data_value; usleep(10); pthread_join(ptid1,NULL); #endif - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -304,16 +304,16 @@ ULONG data_value; test_control_return(8); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ if (status) { - + printf("ERROR!\n"); test_control_return(9); - } + } /* Pickup the available bytes in the media again. */ status = fx_media_space_available(&ram_disk, &j); @@ -329,7 +329,7 @@ ULONG data_value; } } else - { + { if ((status != FX_SUCCESS) || (j != 0)) { @@ -337,7 +337,7 @@ ULONG data_value; test_control_return(10); } } - + /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); @@ -363,7 +363,7 @@ ULONG data_value; /* Now read in all the bytes again to make sure the file contents are really there. */ status = fx_file_read(&my_file, (void *) large_data_buffer, large_data_buffer_size, &actual); - /* Check the file read status. */ + /* Check the file read status. */ if (i != 3) { if ((status != FX_END_OF_FILE) || (actual != 0)) @@ -374,7 +374,7 @@ ULONG data_value; } } else - { + { if ((status != FX_SUCCESS) || (actual != write_data_size)) { @@ -392,8 +392,8 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(14); - } - + } + /* Close the media. */ status = fx_media_close(&ram_disk); @@ -403,7 +403,7 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(15); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -413,11 +413,11 @@ ULONG data_value; #endif } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} - +} + /* Define the test threads. */ #ifndef FX_STANDALONE_ENABLE @@ -429,30 +429,30 @@ static void ftest_1_entry(ULONG thread_input) #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif - UINT status; - + UINT status; + FX_PARAMETER_NOT_USED(thread_input); - /* Set the callback function to simulate poweoff operation when write FAT entry. */ - driver_write_callback = my_driver_write; + /* Set the callback function to simulate poweoff operation when write FAT entry. */ + driver_write_callback = my_driver_write; /* Write the data to fill the media one time. */ status = fx_file_write(&my_file, (void *) large_data_buffer, write_data_size); /* Check the file write status. */ if (status != FX_SUCCESS) - { + { error_couter ++; #ifndef FX_STANDALONE_ENABLE return; #else return NULL; #endif - } + } } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) @@ -468,14 +468,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - fat_write_interrupt = FX_TRUE; + fat_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -487,10 +487,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -504,7 +504,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -512,11 +512,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_write_large_data_fat_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Write Large Data Fat Interrupt test.....N/A\n"); + printf("FileX Test: Fault Tolerant Write Large Data Fat Interrupt test.....N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_write_large_data_interrupt_test.c b/test/regression_test/filex_fault_tolerant_write_large_data_interrupt_test.c index 52a7f53..b60f825 100644 --- a/test/regression_test/filex_fault_tolerant_write_large_data_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_write_large_data_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant write large data interrupt test. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; -Check write large data fat interrupt operation: -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create new file called "TEST.TXT"; -Step4: Get the media available bytes; -Step5: Write large bytes out of the file to fill the media -Step7: Terminate the new thread to simulate poweroff when update the data between undo log generated and redo log not generated. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(undo operation); +Check write large data fat interrupt operation: +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create new file called "TEST.TXT"; +Step4: Get the media available bytes; +Step5: Write large bytes out of the file to fill the media +Step7: Terminate the new thread to simulate poweroff when update the data between undo log generated and redo log not generated. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Check the test files. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" #else @@ -20,15 +20,15 @@ Step10: Check the test files. #include #include #endif -#include "fx_api.h" +#include "fx_api.h" #include "fx_system.h" #include "fx_fault_tolerant.h" #include #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_write_large_data_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) #define DEMO_STACK_SIZE 4096 @@ -39,17 +39,17 @@ void filex_fault_tolerant_write_large_data_interrupt_test_application_define( /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -57,29 +57,29 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif -static UINT error_couter = 0; +#endif +static UINT error_couter = 0; static ULONG write_data_size; static ULONG available_bytes; -static UINT data_write_interrupt = FX_FALSE; +static UINT data_write_interrupt = FX_FALSE; static ULONG i, j; #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); -#endif +static void * ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); -static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); /* Define what the initial system looks like. */ @@ -90,24 +90,24 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_write_large_data_interrupt_test_application_define(void *first_unused_memory) #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; - /* Setup memory for the RAM disk and the sector cache. */ + /* Setup memory for the RAM disk and the sector cache. */ cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -118,7 +118,7 @@ void filex_fault_tolerant_write_large_data_interrupt_test_application_define( ftest_0_entry(0); #endif } - + /* Define the test threads. */ @@ -153,57 +153,57 @@ ULONG data_value; if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4000 * 8, // Total sectors - 256, // Sector size + 4000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 60000 * 8, // Total sectors - 256, // Sector size + 60000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 400000 * 8, // Total sectors - 256, // Sector size + 400000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -225,17 +225,17 @@ ULONG data_value; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ if (status) { - + printf("ERROR!\n"); test_control_return(3); } - + /* Create a file called TEST.TXT in the root directory. */ status = fx_file_create(&ram_disk, "TEST.TXT"); @@ -268,13 +268,13 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(6); } - + write_data_size = available_bytes; /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -289,7 +289,7 @@ ULONG data_value; usleep(10); pthread_join(ptid1,NULL); #endif - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -302,16 +302,16 @@ ULONG data_value; test_control_return(8); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ if (status) { - + printf("ERROR!\n"); test_control_return(9); - } + } /* Pickup the available bytes in the media again. */ status = fx_media_space_available(&ram_disk, &j); @@ -323,7 +323,7 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(10); } - + /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); @@ -349,7 +349,7 @@ ULONG data_value; /* Now read in all the bytes again to make sure the file contents are really there. */ status = fx_file_read(&my_file, (void *) large_data_buffer, large_data_buffer_size, &actual); - /* Check the file read status. */ + /* Check the file read status. */ if ((status != FX_END_OF_FILE) || (actual != 0)) { @@ -366,8 +366,8 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(14); - } - + } + /* Close the media. */ status = fx_media_close(&ram_disk); @@ -377,21 +377,21 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(15); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE tx_thread_delete(&ftest_1); -#else +#else pthread_cancel(ptid1); #endif } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} - +} + /* Define the test threads. */ #ifndef FX_STANDALONE_ENABLE @@ -399,40 +399,40 @@ static void ftest_1_entry(ULONG thread_input) #else void * ftest_1_entry(void * thread_input) #endif -{ +{ #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif UINT status; FX_PARAMETER_NOT_USED(thread_input); - /* Set the callback function to simulate poweoff operation when write FAT entry. */ - driver_write_callback = my_driver_write; + /* Set the callback function to simulate poweoff operation when write FAT entry. */ + driver_write_callback = my_driver_write; /* Write the data to fill the media one time. */ status = fx_file_write(&my_file, (void *) large_data_buffer, write_data_size); /* Check the file write status. */ if (status != FX_SUCCESS) - { + { #ifndef FX_STANDALONE_ENABLE return; #else return NULL; #endif - } + } } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) -{ +{ FX_PARAMETER_NOT_USED(block_ptr); /* Interrupt the data write operation after record the undo log. */ - if ((sector_type == FX_DATA_SECTOR) && (_filex_fault_tolerant_log_check(media_ptr) & FX_FAULT_TOLERANT_LOG_UNDO_DONE) && + if ((sector_type == FX_DATA_SECTOR) && (_filex_fault_tolerant_log_check(media_ptr) & FX_FAULT_TOLERANT_LOG_UNDO_DONE) && (!(_filex_fault_tolerant_log_check(media_ptr) & FX_FAULT_TOLERANT_LOG_REDO_DONE))) { @@ -440,14 +440,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - data_write_interrupt = FX_TRUE; + data_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -459,10 +459,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -476,7 +476,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -484,11 +484,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_write_large_data_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Write Large Data Interrupt test.........N/A\n"); + printf("FileX Test: Fault Tolerant Write Large Data Interrupt test.........N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_write_large_data_redo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_write_large_data_redo_log_interrupt_test.c index 4a6041f..77efe74 100644 --- a/test/regression_test/filex_fault_tolerant_write_large_data_redo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_write_large_data_redo_log_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant write large data redo log interrupt test. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; -Check write large data fat interrupt operation: -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create new file called "TEST.TXT"; -Step4: Get the media available bytes; -Step5: Write large bytes out of the file to fill the media -Step7: Terminate the new thread to simulate poweroff when update the fat redo log. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(undo operation); +Check write large data fat interrupt operation: +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create new file called "TEST.TXT"; +Step4: Get the media available bytes; +Step5: Write large bytes out of the file to fill the media +Step7: Terminate the new thread to simulate poweroff when update the fat redo log. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Check the test files. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" #else @@ -20,15 +20,15 @@ Step10: Check the test files. #include #include #endif -#include "fx_api.h" +#include "fx_api.h" #include "fx_system.h" #include "fx_fault_tolerant.h" #include #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_write_large_data_redo_log_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) #define DEMO_STACK_SIZE 4096 @@ -39,17 +39,17 @@ void filex_fault_tolerant_write_large_data_redo_log_interrupt_test_applicatio /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -57,29 +57,29 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif -static UINT error_couter = 0; +#endif +static UINT error_couter = 0; static ULONG write_data_size; static ULONG available_bytes; -static UINT redo_log_write_interrupt = FX_FALSE; +static UINT redo_log_write_interrupt = FX_FALSE; static ULONG i, j; #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); -#endif +static void * ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); -static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); /* Define what the initial system looks like. */ @@ -92,24 +92,24 @@ void filex_fault_tolerant_write_large_data_redo_log_interrupt_test_applicatio { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; - /* Setup memory for the RAM disk and the sector cache. */ + /* Setup memory for the RAM disk and the sector cache. */ cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -120,7 +120,7 @@ void filex_fault_tolerant_write_large_data_redo_log_interrupt_test_applicatio ftest_0_entry(0); #endif } - + /* Define the test threads. */ @@ -155,57 +155,57 @@ ULONG data_value; if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4000 * 8, // Total sectors - 256, // Sector size + 4000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 60000 * 8, // Total sectors - 256, // Sector size + 60000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 400000 * 8, // Total sectors - 256, // Sector size + 400000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -227,17 +227,17 @@ ULONG data_value; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ if (status) { - + printf("ERROR!\n"); test_control_return(3); } - + /* Create a file called TEST.TXT in the root directory. */ status = fx_file_create(&ram_disk, "TEST.TXT"); @@ -270,13 +270,13 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(6); } - + write_data_size = available_bytes; /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -291,7 +291,7 @@ ULONG data_value; usleep(10); pthread_join(ptid1,NULL); #endif - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -304,16 +304,16 @@ ULONG data_value; test_control_return(8); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ if (status) { - + printf("ERROR!\n"); test_control_return(9); - } + } /* Pickup the available bytes in the media again. */ status = fx_media_space_available(&ram_disk, &j); @@ -351,7 +351,7 @@ ULONG data_value; /* Now read in all the bytes again to make sure the file contents are really there. */ status = fx_file_read(&my_file, (void *) large_data_buffer, large_data_buffer_size, &actual); - /* Check the file read status. */ + /* Check the file read status. */ if ((status != FX_END_OF_FILE) || (actual != 0)) { @@ -368,8 +368,8 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(14); - } - + } + /* Close the media. */ status = fx_media_close(&ram_disk); @@ -379,7 +379,7 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(15); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE @@ -389,11 +389,11 @@ ULONG data_value; #endif } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} - +} + /* Define the test threads. */ #ifndef FX_STANDALONE_ENABLE @@ -401,34 +401,34 @@ static void ftest_1_entry(ULONG thread_input) #else void * ftest_1_entry(void * thread_input) #endif -{ +{ #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif - UINT status; - + UINT status; + FX_PARAMETER_NOT_USED(thread_input); - /* Set the callback function to simulate poweoff operation when write FAT entry. */ - driver_write_callback = my_driver_write; + /* Set the callback function to simulate poweoff operation when write FAT entry. */ + driver_write_callback = my_driver_write; /* Write the data to fill the media one time. */ status = fx_file_write(&my_file, (void *) large_data_buffer, write_data_size); /* Check the file write status. */ if (status != FX_SUCCESS) - { + { error_couter ++; #ifndef FX_STANDALONE_ENABLE return; #else return NULL; #endif - } + } } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) @@ -444,14 +444,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - redo_log_write_interrupt = FX_TRUE; + redo_log_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -463,10 +463,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -480,7 +480,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -488,11 +488,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_write_large_data_redo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Write Large Data Redo Log Interrupt test.N/A\n"); + printf("FileX Test: Fault Tolerant Write Large Data Redo Log Interrupt test.N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_write_large_data_test.c b/test/regression_test/filex_fault_tolerant_write_large_data_test.c index ff9d31b..36a3d29 100644 --- a/test/regression_test/filex_fault_tolerant_write_large_data_test.c +++ b/test/regression_test/filex_fault_tolerant_write_large_data_test.c @@ -1,15 +1,15 @@ /* This FileX test concentrates on the Fault-Tolerant write large data test. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; -Check media full operation: -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create new file called "TEST.TXT"; -Step4: Get the media available bytes; +Check media full operation: +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create new file called "TEST.TXT"; +Step4: Get the media available bytes; Step5: Write large bytes out of the file to fill the media; -Step6: Check the media available bytes. +Step6: Check the media available bytes. Step7: Loop to read and check the file data from the media; -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" #endif @@ -17,10 +17,10 @@ Step7: Loop to read and check the file data from the media; #include "fx_fault_tolerant.h" #include #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_write_large_data_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) #define DEMO_STACK_SIZE 4096 @@ -31,29 +31,29 @@ void filex_fault_tolerant_write_large_data_test_application_define(void *firs /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif +#endif #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); +extern void test_control_return(UINT status); /* Define what the initial system looks like. */ @@ -65,20 +65,20 @@ void filex_fault_tolerant_write_large_data_test_application_define(void *firs #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; - /* Setup memory for the RAM disk and the sector cache. */ + /* Setup memory for the RAM disk and the sector cache. */ cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; @@ -91,7 +91,7 @@ void filex_fault_tolerant_write_large_data_test_application_define(void *firs ftest_0_entry(0); #endif } - + /* Define the test threads. */ @@ -128,57 +128,57 @@ ULONG data_value; if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4000 * 8, // Total sectors - 256, // Sector size + 4000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 60000 * 8, // Total sectors - 256, // Sector size + 60000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 400000 * 8, // Total sectors - 256, // Sector size + 400000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -200,17 +200,17 @@ ULONG data_value; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ if (status) { - + printf("ERROR!\n"); test_control_return(3); } - + /* Create a file called TEST.TXT in the root directory. */ status = fx_file_create(&ram_disk, "TEST.TXT"); @@ -243,7 +243,7 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(6); } - + /* Write the data to fill the media one time. */ status = fx_file_write(&my_file, (void *) large_data_buffer, available_bytes); @@ -267,7 +267,7 @@ ULONG data_value; } #ifndef FX_DISABLE_CACHE - /* At this point, we should invalidate the (which also flushes the cache) media to ensure that all + /* At this point, we should invalidate the (which also flushes the cache) media to ensure that all dirty sectors are written. */ status = fx_media_cache_invalidate(&ram_disk); @@ -324,7 +324,7 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(13); - } + } /* Close the media. */ status = fx_media_close(&ram_disk); @@ -335,15 +335,15 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(14); - } + } } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} +} -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -351,11 +351,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_write_large_data_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Write Large Data Test...................N/A\n"); + printf("FileX Test: Fault Tolerant Write Large Data Test...................N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_fault_tolerant_write_large_data_undo_log_interrupt_test.c b/test/regression_test/filex_fault_tolerant_write_large_data_undo_log_interrupt_test.c index 34428e9..abcaa17 100644 --- a/test/regression_test/filex_fault_tolerant_write_large_data_undo_log_interrupt_test.c +++ b/test/regression_test/filex_fault_tolerant_write_large_data_undo_log_interrupt_test.c @@ -1,17 +1,17 @@ /* This FileX test concentrates on the Fault-Tolerant write large data undo log interrupt test. */ -/* +/* For FAT 12, 16, 32, one cluster size is 1024 bytes; -Check write large data fat interrupt operation: -Step1: Format and open the media; -Step2: Enable fault tolerant feature; -Step3: Create new file called "TEST.TXT"; -Step4: Get the media available bytes; -Step5: Write large bytes out of the file to fill the media -Step7: Terminate the new thread to simulate poweroff when update the undo log. -Step8: Open the media; -Step9: Enable fault tolerant feature to recover the data(undo operation); +Check write large data fat interrupt operation: +Step1: Format and open the media; +Step2: Enable fault tolerant feature; +Step3: Create new file called "TEST.TXT"; +Step4: Get the media available bytes; +Step5: Write large bytes out of the file to fill the media +Step7: Terminate the new thread to simulate poweroff when update the undo log. +Step8: Open the media; +Step9: Enable fault tolerant feature to recover the data(undo operation); Step10: Check the test files. -*/ +*/ #ifndef FX_STANDALONE_ENABLE #include "tx_api.h" #else @@ -20,15 +20,15 @@ Step10: Check the test files. #include #include #endif -#include "fx_api.h" +#include "fx_api.h" #include "fx_system.h" #include "fx_fault_tolerant.h" #include #include -#include "fx_ram_driver_test.h" +#include "fx_ram_driver_test.h" extern void test_control_return(UINT status); void filex_fault_tolerant_write_large_data_undo_log_interrupt_test_application_define(void *first_unused_memory); - + #if defined (FX_ENABLE_FAULT_TOLERANT) && defined (FX_FAULT_TOLERANT) #define DEMO_STACK_SIZE 4096 @@ -39,17 +39,17 @@ void filex_fault_tolerant_write_large_data_undo_log_interrupt_test_applicatio /* Define the ThreadX and FileX object control blocks... */ #ifndef FX_STANDALONE_ENABLE -static TX_THREAD ftest_0; +static TX_THREAD ftest_0; static TX_THREAD ftest_1; #else -static pthread_t ptid1; +static pthread_t ptid1; #endif static FX_MEDIA ram_disk; static FX_FILE my_file; static UCHAR *pointer; /* Define the counters used in the test application... */ - + #ifndef FX_STANDALONE_ENABLE static UCHAR *cache_buffer; static UCHAR *fault_tolerant_buffer; @@ -57,29 +57,29 @@ static UCHAR *thread_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; -#endif -static UINT error_couter = 0; +#endif +static UINT error_couter = 0; static ULONG write_data_size; static ULONG available_bytes; -static UINT undo_log_write_interrupt = FX_FALSE; +static UINT undo_log_write_interrupt = FX_FALSE; static ULONG i, j; #define TEST_COUNT 3 /* Define thread prototypes. */ -static void ftest_0_entry(ULONG thread_input); +static void ftest_0_entry(ULONG thread_input); #ifndef FX_STANDALONE_ENABLE static void ftest_1_entry(ULONG thread_input); #else -static void * ftest_1_entry(void * thread_input); -#endif +static void * ftest_1_entry(void * thread_input); +#endif extern void _fx_ram_driver(FX_MEDIA *media_ptr); -extern void test_control_return(UINT status); -extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); -extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); -static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +extern void test_control_return(UINT status); +extern UINT _filex_fault_tolerant_log_check(FX_MEDIA *media_ptr); +extern UINT (*driver_write_callback)(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); +static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr); /* Define what the initial system looks like. */ @@ -91,24 +91,24 @@ void filex_fault_tolerant_write_large_data_undo_log_interrupt_test_applicatio #endif { - + #ifndef FX_STANDALONE_ENABLE /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; - /* Setup memory for the RAM disk and the sector cache. */ + /* Setup memory for the RAM disk and the sector cache. */ cache_buffer = pointer; pointer += CACHE_SIZE; fault_tolerant_buffer = pointer; - pointer += FAULT_TOLERANT_SIZE; + pointer += FAULT_TOLERANT_SIZE; thread_buffer = pointer; pointer += DEMO_STACK_SIZE; #endif @@ -119,7 +119,7 @@ void filex_fault_tolerant_write_large_data_undo_log_interrupt_test_applicatio ftest_0_entry(0); #endif } - + /* Define the test threads. */ @@ -154,57 +154,57 @@ ULONG data_value; if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4000 * 8, // Total sectors - 256, // Sector size + 4000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 60000 * 8, // Total sectors - 256, // Sector size + 60000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 400000 * 8, // Total sectors - 256, // Sector size + 400000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -226,17 +226,17 @@ ULONG data_value; test_control_return(2); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ if (status) { - + printf("ERROR!\n"); test_control_return(3); } - + /* Create a file called TEST.TXT in the root directory. */ status = fx_file_create(&ram_disk, "TEST.TXT"); @@ -269,13 +269,13 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(6); } - + write_data_size = available_bytes; /* Create the main thread. */ #ifndef FX_STANDALONE_ENABLE - tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, - thread_buffer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_1, "thread 1", ftest_1_entry, 0, + thread_buffer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); #endif @@ -290,7 +290,7 @@ ULONG data_value; usleep(10); pthread_join(ptid1,NULL); #endif - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -303,16 +303,16 @@ ULONG data_value; test_control_return(8); } - /* Enable the Fault-tolerant feature. */ + /* Enable the Fault-tolerant feature. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); /* Check status. */ if (status) { - + printf("ERROR!\n"); test_control_return(9); - } + } /* Pickup the available bytes in the media again. */ status = fx_media_space_available(&ram_disk, &j); @@ -324,7 +324,7 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(10); } - + /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); @@ -350,7 +350,7 @@ ULONG data_value; /* Now read in all the bytes again to make sure the file contents are really there. */ status = fx_file_read(&my_file, (void *) large_data_buffer, large_data_buffer_size, &actual); - /* Check the file read status. */ + /* Check the file read status. */ if ((status != FX_END_OF_FILE) || (actual != 0)) { @@ -367,8 +367,8 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(14); - } - + } + /* Close the media. */ status = fx_media_close(&ram_disk); @@ -378,21 +378,21 @@ ULONG data_value; printf("ERROR!\n"); test_control_return(15); - } + } /* Delete the thread. */ #ifndef FX_STANDALONE_ENABLE tx_thread_delete(&ftest_1); -#else +#else pthread_cancel(ptid1); #endif } - /* Output successful. */ + /* Output successful. */ printf("SUCCESS!\n"); test_control_return(0); -} - +} + /* Define the test threads. */ #ifndef FX_STANDALONE_ENABLE @@ -400,38 +400,38 @@ static void ftest_1_entry(ULONG thread_input) #else void * ftest_1_entry(void * thread_input) #endif -{ +{ #ifdef FX_STANDALONE_ENABLE UINT oldtype; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); #endif - UINT status; - + UINT status; + FX_PARAMETER_NOT_USED(thread_input); - /* Set the callback function to simulate poweoff operation when write FAT entry. */ - driver_write_callback = my_driver_write; + /* Set the callback function to simulate poweoff operation when write FAT entry. */ + driver_write_callback = my_driver_write; /* Write the data to fill the media one time. */ status = fx_file_write(&my_file, (void *) large_data_buffer, write_data_size); /* Check the file write status. */ if (status != FX_SUCCESS) - { + { error_couter ++; #ifndef FX_STANDALONE_ENABLE return; #else return NULL; #endif - } + } } static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ptr, UINT *operation_ptr) -{ +{ FX_PARAMETER_NOT_USED(block_ptr); @@ -443,14 +443,14 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ *operation_ptr = FX_OP_WRITE_INTERRUPT; /* Update the flag. */ - undo_log_write_interrupt = FX_TRUE; + undo_log_write_interrupt = FX_TRUE; /* Clean the callback function. */ driver_write_callback = FX_NULL; - + /* Delete the media protection structure if FX_SINGLE_THREAD is not defined. */ -#ifndef FX_SINGLE_THREAD +#ifndef FX_SINGLE_THREAD #ifndef FX_DONT_CREATE_MUTEX /* Note that the protection is never released. The mutex delete @@ -462,10 +462,10 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Clean the media data. */ _fx_system_media_opened_ptr = FX_NULL; - _fx_system_media_opened_count = 0; + _fx_system_media_opened_count = 0; /* Clean the media. */ - memset(media_ptr, 0, sizeof(FX_MEDIA)); + memset(media_ptr, 0, sizeof(FX_MEDIA)); /* Simulate poweroff. */ /* First terminate the thread to ensure it is ready for deletion. */ @@ -479,7 +479,7 @@ static UINT my_driver_write(FX_MEDIA *media_ptr, UINT sector_type, UCHAR *block_ /* Return. */ return FX_SUCCESS; } -#else +#else #ifdef CTEST void test_application_define(void *first_unused_memory) @@ -487,11 +487,11 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_write_large_data_undo_log_interrupt_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ - printf("FileX Test: Fault Tolerant Write Large Data Undo Log Interrupt test.N/A\n"); + printf("FileX Test: Fault Tolerant Write Large Data Undo Log Interrupt test.N/A\n"); test_control_return(255); } diff --git a/test/regression_test/filex_file_allocate_test.c b/test/regression_test/filex_file_allocate_test.c index c2f7575..10e047d 100644 --- a/test/regression_test/filex_file_allocate_test.c +++ b/test/regression_test/filex_file_allocate_test.c @@ -48,7 +48,7 @@ static UCHAR *fault_tolerant_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; #ifdef FX_ENABLE_FAULT_TOLERANT -static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; +static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; #endif /* FX_ENABLE_FAULT_TOLERANT */ #endif @@ -80,7 +80,7 @@ void filex_file_allocate_application_define(void *first_unused_memory) tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); - + pointer = pointer + DEMO_STACK_SIZE; /* Setup memory for the RAM disk and the sector cache. */ diff --git a/test/regression_test/filex_file_allocate_truncate_test.c b/test/regression_test/filex_file_allocate_truncate_test.c index a7231dc..8354f2f 100644 --- a/test/regression_test/filex_file_allocate_truncate_test.c +++ b/test/regression_test/filex_file_allocate_truncate_test.c @@ -53,13 +53,13 @@ void filex_file_allocate_truncate_application_define(void *first_unused_memor #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -99,20 +99,20 @@ ULONG i; printf("FileX Test: File allocate/truncate test............................"); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -121,7 +121,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(1); } - + /* Attempt to truncate a file before the file is opened */ status = fx_file_extended_truncate(&my_file, 0); if (status != FX_NOT_OPEN) @@ -129,7 +129,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(2); } - + /* Attempt to release a file before the file is opened */ status = fx_file_extended_truncate_release(&my_file, 0); if (status != FX_NOT_OPEN) @@ -174,7 +174,7 @@ ULONG i; /* Pickup the available bytes in the media. */ status = fx_media_space_available(&ram_disk, &available_bytes); - + /* Check for available bytes error. */ if ((status != FX_SUCCESS) || (available_bytes < sizeof(ULONG))) { @@ -194,7 +194,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(8); } - + /* Try to release more than was allocated */ status = fx_file_extended_truncate_release(&my_file, 0xFFFFFFFFFFFFFFFF); if (status != FX_SUCCESS) @@ -202,7 +202,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(9); } - + /* Attempt to truncate a file that is not open for writing */ status = fx_file_extended_truncate(&read_only, 0); if (status != FX_ACCESS_ERROR) @@ -210,7 +210,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(10); } - + /* Attempt to release a file that is not open for writing */ status = fx_file_extended_truncate_release(&read_only, 0); if (status != FX_ACCESS_ERROR) @@ -218,7 +218,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(11); } - + /* Attempt to truncate a file while the media is write protected */ ram_disk.fx_media_driver_write_protect = FX_TRUE; status = fx_file_extended_truncate(&my_file, 0); @@ -227,7 +227,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(12); } - + /* Attempt to release a file while the media is write protected */ status = fx_file_extended_truncate_release(&my_file, 0); if (status != FX_WRITE_PROTECT) @@ -236,7 +236,7 @@ ULONG i; test_control_return(13); } ram_disk.fx_media_driver_write_protect = FX_FALSE; - + ram_disk.fx_media_bytes_per_sector = 0; /* Attempt to release a file while the media is corrupted. */ @@ -255,7 +255,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(14); } - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING /* send null pointer to generate an error */ @@ -265,7 +265,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(15); } - + /* send null pointer to generate an error */ status = fx_file_extended_truncate(FX_NULL, 0xFF); if (status != FX_PTR_ERROR) @@ -273,7 +273,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(16); } - + /* send null pointer to generate an error */ status = fx_file_extended_truncate_release(FX_NULL, 0xFF); if (status != FX_PTR_ERROR) @@ -281,7 +281,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(17); } - + /* send null pointer to generate an error */ status = fx_file_extended_allocate(FX_NULL, 0xFF); if (status != FX_PTR_ERROR) @@ -289,7 +289,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(18); } - + /* send null pointer to generate an error */ status = fx_file_best_effort_allocate(FX_NULL, 0xFF, FX_NULL); if (status != FX_PTR_ERROR) @@ -301,7 +301,7 @@ ULONG i; /* Allocate half the size first... */ status = fx_file_allocate(&my_file, available_bytes/2); - + /* Check the file allocate status. */ if (status != FX_SUCCESS) { @@ -313,31 +313,31 @@ ULONG i; /* Pickup the available bytes in the media again. */ status = fx_media_space_available(&ram_disk, &i); - - /* Attempt to allocate all the bytes again... but the best effort should just get us the + + /* Attempt to allocate all the bytes again... but the best effort should just get us the remaining bytes... */ status += fx_file_best_effort_allocate(&my_file, available_bytes, &actual); - + /* Check the best effort file allocate status. */ if ((status != FX_SUCCESS) || (actual != i)) { printf("ERROR!\n"); test_control_return(21); - } - -#ifdef FX_UPDATE_FILE_SIZE_ON_ALLOCATE + } + +#ifdef FX_UPDATE_FILE_SIZE_ON_ALLOCATE /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); /* Check the file seek status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(22); } - + /* send null pointer to generate an error */ status = fx_file_best_effort_allocate(FX_NULL, 1500, FX_NULL); if (status != FX_PTR_ERROR) @@ -352,7 +352,7 @@ ULONG i; write_value = 0; while (i < available_bytes) { - + /* Write 4 bytes to the file. */ status = fx_file_write(&my_file, (void *) &write_value, sizeof(ULONG)); @@ -363,17 +363,17 @@ ULONG i; printf("ERROR!\n"); test_control_return(24); } - + /* Increment byte count. */ i = i + sizeof(ULONG); - + /* Increment write value. */ write_value++; } - + /* Pickup the available bytes in the media again. */ status = fx_media_space_available(&ram_disk, &i); - + /* Check for available bytes error. */ if ((status != FX_SUCCESS) || (i != 0)) { @@ -381,12 +381,12 @@ ULONG i; printf("ERROR!\n"); test_control_return(25); } - + #ifndef FX_DISABLE_CACHE - /* At this point, we should invalidate the (which also flushes the cache) media to ensure that all + /* At this point, we should invalidate the (which also flushes the cache) media to ensure that all dirty sectors are written. */ status = fx_media_cache_invalidate(&ram_disk); - + /* Check for invalidate errors. */ if ((status != FX_SUCCESS) || (ram_disk.fx_media_sector_cache_dirty_count)) { @@ -394,15 +394,15 @@ ULONG i; printf("ERROR!\n"); test_control_return(26); } - + /* See if any sectors are still valid in the cache. */ for (i = 0; i < FX_MAX_SECTOR_CACHE; i++) { - + /* Determine if this cache entry is still valid. */ if (ram_disk.fx_media_sector_cache[i].fx_cached_sector_valid) { - + printf("ERROR!\n"); test_control_return(27); } @@ -411,7 +411,7 @@ ULONG i; /* Now truncate half the file... */ status = fx_file_truncate(&my_file, available_bytes/2); - + /* Check for errors... */ if ((status) || (my_file.fx_file_current_file_size != my_file.fx_file_current_available_size/2)) { @@ -419,7 +419,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(28); } - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING /* send null pointer to generate an error */ @@ -429,7 +429,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(29); } - + /* send null pointer to generate an error */ status = fx_file_truncate_release(FX_NULL, 0); if (status != FX_PTR_ERROR) @@ -441,7 +441,7 @@ ULONG i; /* Now truncate the remainder of file... */ status = fx_file_truncate(&my_file, 0); - + /* Check for errors... */ if ((status) || (my_file.fx_file_current_file_size != 0)) { @@ -452,7 +452,7 @@ ULONG i; /* Pickup the available bytes in the media again. */ status = fx_media_space_available(&ram_disk, &i); - + /* Check for available bytes error. */ if ((status != FX_SUCCESS) || (i != 0)) { @@ -466,7 +466,7 @@ ULONG i; write_value = 0; while (i < available_bytes) { - + /* Write 4 bytes to the file. */ status = fx_file_write(&my_file, (void *) &write_value, sizeof(ULONG)); @@ -477,20 +477,20 @@ ULONG i; printf("ERROR!\n"); test_control_return(33); } - + /* Increment byte count. */ i = i + sizeof(ULONG); - + /* Increment write value. */ write_value++; } - + /* Now truncate and release half the file... */ status = fx_file_truncate_release(&my_file, available_bytes/2); /* Pickup the available bytes in the media again. */ status += fx_media_space_available(&ram_disk, &i); - + /* Check for errors... */ if ((status) || (my_file.fx_file_current_file_size != available_bytes/2)) { @@ -504,9 +504,9 @@ ULONG i; /* Pickup the available bytes in the media again. */ status += fx_media_space_available(&ram_disk, &i); - + /* Check for errors... */ - if ((status) || (my_file.fx_file_current_file_size != 0) || + if ((status) || (my_file.fx_file_current_file_size != 0) || (i != available_bytes)) { @@ -522,10 +522,10 @@ ULONG i; /* Pickup the available bytes in the media again. */ status = fx_media_space_available(&ram_disk, &available_bytes); - + /* Restore the actual available clusters. */ ram_disk.fx_media_available_clusters = temp; - + /* Check for errors... */ if ((status) || (available_bytes != 0xFFFFFFFF)) { @@ -533,12 +533,12 @@ ULONG i; printf("ERROR!\n"); test_control_return(36); } - + /* Close the file. */ status = fx_file_close(&my_file); /* Close the media. */ - status += fx_media_close(&ram_disk); + status += fx_media_close(&ram_disk); /* Determine if the test was successful. */ if (status != FX_SUCCESS) @@ -550,20 +550,20 @@ ULONG i; /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 18000, // Total sectors - 128, // Sector size + 18000, // Total sectors + 128, // Sector size 3, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -572,7 +572,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(38); } - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); @@ -618,7 +618,7 @@ ULONG i; status += fx_file_open(&ram_disk, &read_only, "TEST.TXT", FX_OPEN_FOR_READ); status += fx_file_open(&ram_disk, &my_file1, "TEST1.TXT", FX_OPEN_FOR_READ); status += fx_file_open(&ram_disk, &my_file2, "TEST17.TXT", FX_OPEN_FOR_READ); - + /* Write 2048 bytes to the file. */ for (i = 0; i < 4096; i++) { @@ -629,7 +629,7 @@ ULONG i; /* Allocate some additional clusters. */ status += fx_file_allocate(&my_file, 128*6); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -637,7 +637,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(41); } - + /* Now truncate the file to a value less than the available size, but greater than the current size. */ status = fx_file_extended_truncate_release(&my_file, 4096 + 128); if (status != FX_SUCCESS) @@ -645,7 +645,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(42); } - + /* Now truncate the file to the available size. */ status = fx_file_extended_truncate_release(&my_file, 4096); if (status != FX_SUCCESS) @@ -661,7 +661,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(44); } - + /* Now truncate the file to nothing. */ status = fx_file_extended_truncate_release(&my_file, 0); if (status != FX_SUCCESS) @@ -669,36 +669,36 @@ ULONG i; printf("ERROR!\n"); test_control_return(45); } - + /* Close everything down. */ status = fx_file_close(&my_file); status += fx_file_close(&my_file1); status += fx_file_close(&my_file2); status += fx_file_close(&read_only); status += fx_media_close(&ram_disk); - + /* Check status. */ if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(46); - } - + } + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 18000, // Total sectors - 128, // Sector size + 18000, // Total sectors + 128, // Sector size 3, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -707,7 +707,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(47); } - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -734,7 +734,7 @@ ULONG i; /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); status += fx_file_open(&ram_disk, &read_only, "TEST.TXT", FX_OPEN_FOR_READ); - + /* Write 2048 bytes to the file. */ for (i = 0; i < 4096; i++) { @@ -742,10 +742,10 @@ ULONG i; status += fx_file_write(&my_file, " ", 1); status += fx_file_read(&read_only, buffer, 1, &actual); } - + /* Flush the media. */ status += fx_media_flush(&ram_disk); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -753,7 +753,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(50); } - + /* Now truncate the file to half the available size, but force an I/O error on the directory entry write. */ _fx_ram_driver_io_error_request = 1; status = fx_file_extended_truncate_release(&my_file, 2048); @@ -763,7 +763,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(51); } - + /* Now truncate the file with FAT I/O Error. */ _fx_utility_fat_entry_read_error_request = 1; status = fx_file_extended_truncate_release(&my_file, 2000); @@ -818,31 +818,31 @@ ULONG i; status = fx_file_close(&my_file); status += fx_file_close(&read_only); status += fx_media_close(&ram_disk); - + /* Check status. */ if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(54); - } + } /* Test the cluster values of 1 and fx_media_fat_reserved errors in the FAT chain. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 18000, // Total sectors - 128, // Sector size + 18000, // Total sectors + 128, // Sector size 3, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -851,7 +851,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(55); } - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -878,7 +878,7 @@ ULONG i; /* Open the test file. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); status += fx_file_open(&ram_disk, &read_only, "TEST.TXT", FX_OPEN_FOR_READ); - + /* Write 2048 bytes to the file. */ for (i = 0; i < 4096; i++) { @@ -886,10 +886,10 @@ ULONG i; status += fx_file_write(&my_file, " ", 1); status += fx_file_read(&read_only, buffer, 1, &actual); } - + /* Flush the media. */ status += fx_media_flush(&ram_disk); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -897,7 +897,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(58); } - + /* Now truncate one byte of the file. */ status = fx_file_extended_truncate_release(&my_file, 4095); @@ -962,31 +962,31 @@ ULONG i; status = fx_file_close(&my_file); status += fx_file_close(&read_only); status += fx_media_close(&ram_disk); - + /* Check status. */ if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(63); - } + } /* Test file extended truncate corner cases. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 18000, // Total sectors - 128, // Sector size + 18000, // Total sectors + 128, // Sector size 3, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -995,7 +995,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(64); } - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -1055,7 +1055,7 @@ ULONG i; status += fx_file_open(&ram_disk, &read_only, "TEST.TXT", FX_OPEN_FOR_READ); status += fx_file_open(&ram_disk, &my_file1, "TEST1.TXT", FX_OPEN_FOR_WRITE); status += fx_file_open(&ram_disk, &my_file2, "TEST30.TXT", FX_OPEN_FOR_WRITE); - + /* Write 2048 bytes to the file. */ for (i = 0; i < 4096; i++) { @@ -1063,10 +1063,10 @@ ULONG i; status += fx_file_write(&my_file, " ", 1); status += fx_file_read(&read_only, buffer, 1, &actual); } - + /* Flush the media. */ status += fx_media_flush(&ram_disk); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -1074,7 +1074,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(68); } - + /* Now truncate one byte of the file. */ status = fx_file_extended_truncate(&my_file, 4095); @@ -1086,7 +1086,7 @@ ULONG i; /* Seek to make the file offset less than our new truncate size. */ status = fx_file_seek(&my_file, 4094); - + /* Truncate another byte of the file. */ status = fx_file_extended_truncate(&my_file, 4094); @@ -1095,18 +1095,18 @@ ULONG i; printf("ERROR!\n"); test_control_return(70); } - + /* Now truncate the another byte of the file, but with a FAT read error. */ _fx_utility_fat_entry_read_error_request = 1; status = fx_file_extended_truncate(&my_file, 4093); _fx_utility_fat_entry_read_error_request = 0; - if (status != FX_IO_ERROR) + if (status != FX_IO_ERROR) { printf("ERROR!\n"); test_control_return(71); } - - + + /* Now truncate the file but force a FAT entry of 1. */ _fx_utility_fat_entry_read_error_request = 10003; status = fx_file_extended_truncate(&my_file, 4092); @@ -1133,13 +1133,13 @@ ULONG i; status += fx_file_close(&my_file2); status += fx_file_close(&read_only); status += fx_media_close(&ram_disk); - + /* Check status. */ if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(74); - } + } else { diff --git a/test/regression_test/filex_file_attributes_read_set_test.c b/test/regression_test/filex_file_attributes_read_set_test.c index 98ccf9b..a828617 100644 --- a/test/regression_test/filex_file_attributes_read_set_test.c +++ b/test/regression_test/filex_file_attributes_read_set_test.c @@ -4,7 +4,7 @@ #include "tx_api.h" #endif #include "fx_api.h" -#include +#include #include "fx_ram_driver_test.h" #define DEMO_STACK_SIZE 4096 @@ -61,13 +61,13 @@ void filex_file_attributes_read_set_application_define(void *first_unused_mem #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -103,20 +103,20 @@ FX_FILE open_file; printf("FileX Test: File attributes read/set test.........................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -125,7 +125,7 @@ FX_FILE open_file; printf("ERROR!\n"); test_control_return(1); } - + /* Attempt to read file attributes before the media has been opened */ status = fx_file_attributes_read(&ram_disk, "TEST.TXT", &attributes); if (status != FX_MEDIA_NOT_OPEN) @@ -133,7 +133,7 @@ FX_FILE open_file; printf("ERROR!\n"); test_control_return(2); } - + /* Attempt to set file attributes before the media has been opened */ status = fx_file_attributes_set(&ram_disk, "TEST.TXT", 0); if (status != FX_MEDIA_NOT_OPEN) @@ -153,7 +153,7 @@ FX_FILE open_file; printf("ERROR!\n"); test_control_return(4); } - + /* Attempt to set file attributes while the media is write protected */ ram_disk.fx_media_driver_write_protect = FX_TRUE; status = fx_file_attributes_set(&ram_disk, "TEST.TXT", FX_READ_ONLY); @@ -163,7 +163,7 @@ FX_FILE open_file; test_control_return(5); } ram_disk.fx_media_driver_write_protect = FX_FALSE; - + /* attempt to read file attributes from a file that does not exist */ status = fx_file_attributes_read(&ram_disk, "TEST.TXT", &attributes); if (status == FX_SUCCESS) @@ -171,7 +171,7 @@ FX_FILE open_file; printf("ERROR!\n"); test_control_return(6); } - + /* Attempt to set file attributes before the media has been opened */ status = fx_file_attributes_set(&ram_disk, "TEST.TXT", attributes); if (status == FX_SUCCESS) @@ -179,7 +179,7 @@ FX_FILE open_file; printf("ERROR!\n"); test_control_return(7); } - + /* attempt to read file attributes from something that is not a file */ status = fx_directory_create(&ram_disk, "NOT_A_FILE"); status += fx_file_attributes_read(&ram_disk, "NOT_A_FILE", &attributes); @@ -188,7 +188,7 @@ FX_FILE open_file; printf("ERROR!\n"); test_control_return(8); } - + /* Attempt to set file attributes before the media has been opened */ status = fx_file_attributes_set(&ram_disk, "NOT_A_FILE", FX_READ_ONLY); if (status != FX_NOT_A_FILE) @@ -215,9 +215,9 @@ FX_FILE open_file; printf("ERROR!\n"); test_control_return(10); } - + #ifndef FX_DISABLE_ERROR_CHECKING - + /* send null pointer to generate an error */ status = fx_file_attributes_set(FX_NULL, "filename", FX_READ_ONLY); if (status != FX_PTR_ERROR) @@ -225,7 +225,7 @@ FX_FILE open_file; printf("ERROR!\n"); test_control_return(11); } - + /* send null pointer to generate an error */ status = fx_file_attributes_set(&ram_disk, "filename", 0x40); if (status != FX_INVALID_ATTR) @@ -233,7 +233,7 @@ FX_FILE open_file; printf("ERROR!\n"); test_control_return(12); } - + /* send null pointer to generate an error */ status = fx_file_attributes_read(FX_NULL, "filename", FX_NULL); if (status != FX_PTR_ERROR) @@ -241,7 +241,7 @@ FX_FILE open_file; printf("ERROR!\n"); test_control_return(13); } - + #endif /* Invalidate the media cache. */ @@ -265,13 +265,13 @@ FX_FILE open_file; status = fx_file_attributes_set(&ram_disk, "TEST.TXT", attributes | FX_READ_ONLY); /* Check the attributes set status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(15); } - + /* Write the attributes out to the file while another file is opened to get better code coverage */ status = fx_file_create(&ram_disk, "open_file.txt"); status += fx_file_open(&ram_disk, &open_file, "open_file.txt", FX_OPEN_FOR_WRITE); @@ -306,7 +306,7 @@ FX_FILE open_file; printf("ERROR!\n"); test_control_return(18); } - + /* Attempt to set file attributes for a file that is open */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_READ); status += fx_file_attributes_set(&ram_disk, "TEST.TXT", attributes); @@ -317,7 +317,7 @@ FX_FILE open_file; } /* Close the media. */ - status = fx_media_close(&ram_disk); + status = fx_media_close(&ram_disk); /* Determine if the test was successful. */ if (status != FX_SUCCESS) @@ -327,24 +327,24 @@ FX_FILE open_file; test_control_return(20); } - /* Now test the attributes set with multiple files open that have directory entries that reside on + /* Now test the attributes set with multiple files open that have directory entries that reside on different logical sectors. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -353,7 +353,7 @@ FX_FILE open_file; printf("ERROR!\n"); test_control_return(21); } - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); @@ -390,10 +390,10 @@ FX_FILE open_file; status += fx_file_open(&ram_disk, &my_file7, "TEST8.TXT", FX_OPEN_FOR_WRITE); status += fx_file_open(&ram_disk, &my_file8, "TEST9.TXT", FX_OPEN_FOR_WRITE); status += fx_file_open(&ram_disk, &my_file9, "TEST10.TXT", FX_OPEN_FOR_WRITE); - + /* Now set the attributes for TEST.TXT. */ status += fx_file_attributes_set(&ram_disk, "TEST.TXT", FX_READ_ONLY); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -404,7 +404,7 @@ FX_FILE open_file; } /* Close the media. */ - status = fx_media_close(&ram_disk); + status = fx_media_close(&ram_disk); /* Determine if the test was successful. */ if (status != FX_SUCCESS) diff --git a/test/regression_test/filex_file_create_delete_test.c b/test/regression_test/filex_file_create_delete_test.c index 725b51f..ac4fcac 100644 --- a/test/regression_test/filex_file_create_delete_test.c +++ b/test/regression_test/filex_file_create_delete_test.c @@ -40,10 +40,10 @@ static FX_FILE file_7; #ifndef FX_STANDALONE_ENABLE static UCHAR *ram_disk_memory; static UCHAR *cache_buffer; -static UCHAR *fault_tolerant_buffer; +static UCHAR *fault_tolerant_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; -static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; +static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; #endif static UCHAR fat_buffer[128]; static UCHAR name_buffer[FX_MAX_LONG_NAME_LEN+1]; @@ -71,13 +71,13 @@ void filex_file_create_delete_application_define(void *first_unused_memory) #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -118,50 +118,50 @@ UINT temp_attr; printf("FileX Test: File create/delete test................................"); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 256, // Sector size + 512, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Attempt to invalidate the media cache before the media is opened to generate an error */ status = fx_media_cache_invalidate(&ram_disk); return_if_fail( status == FX_MEDIA_NOT_OPEN); - + /* Attempt to get space available information before the media is opened to generate an error */ status = fx_media_extended_space_available(&ram_disk, &temp); return_if_fail( status == FX_MEDIA_NOT_OPEN); - + /* Attempt to allocate space before the media is opened to generate an error */ status = fx_file_extended_allocate(&file_1, 0); return_if_fail( status == FX_NOT_OPEN); - + /* Attempt to allocate space before the media is opened to generate an error */ status = fx_file_extended_best_effort_allocate(&file_1, 0, &temp); return_if_fail( status == FX_NOT_OPEN); - + /* try to create a file before the media has been opened to generate an error */ status = fx_file_create(&ram_disk, "asdf"); return_if_fail( status == FX_MEDIA_NOT_OPEN); - + /* try to close a file before the file has been opened to generate an error */ status = fx_file_close(&file_1); return_if_fail( status == FX_NOT_OPEN); - + /* try to delete a file before the media has been opened to generate an error */ status = fx_file_delete(&ram_disk, "asdf"); return_if_fail( status == FX_MEDIA_NOT_OPEN); - + /* this will be caught by _fxe_file_open instead of _fx_file_open if DISABLE_ERROR_CHECKING is not defined */ /* Attempt to open a file before the media has been opened to generate an error */ status = fx_file_open(&ram_disk, &file_5, "rootname2", FX_OPEN_FOR_WRITE); @@ -170,7 +170,7 @@ UINT temp_attr; /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); - + #ifdef FX_ENABLE_FAULT_TOLERANT /* Enable fault tolerant if FX_ENABLE_FAULT_TOLERANT is defined. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); @@ -180,7 +180,7 @@ UINT temp_attr; /* try to create a file with an illegal name to generate an error */ status = fx_file_create(&ram_disk, ""); return_if_fail( status == FX_INVALID_NAME); - + /* try to create a file with an illegal path to generate an error */ status = fx_file_create(&ram_disk, "/subdir/root"); return_if_fail( status == FX_INVALID_PATH); @@ -193,11 +193,11 @@ UINT temp_attr; status += fx_file_create(&ram_disk, "/subdir/rootname"); status += fx_file_create(&ram_disk, "/subdir/rootname1"); return_if_fail( status == FX_SUCCESS); - + /* Attempt to open a file that is not a file to generate an error */ status = fx_file_open(&ram_disk, &file_5, "subdir", FX_OPEN_FOR_WRITE); return_if_fail( status == FX_NOT_A_FILE); - + /* try to create and delete a file when the media is write protected to generate an error */ ram_disk.fx_media_driver_write_protect = FX_TRUE; status = fx_file_create(&ram_disk, "asdf"); @@ -205,7 +205,7 @@ UINT temp_attr; status = fx_file_delete(&ram_disk, "rootname"); return_if_fail( status == FX_WRITE_PROTECT); - + /* Attempt to open a file while the media is write protected to generate an error */ status = fx_file_open(&ram_disk, &file_5, "rootname2", FX_OPEN_FOR_WRITE); return_if_fail( status == FX_WRITE_PROTECT); @@ -214,20 +214,20 @@ UINT temp_attr; /* Attempt to create the same file again. This should cause an error! */ status = fx_file_create(&ram_disk, "rootname"); return_if_fail( status == FX_ALREADY_CREATED); - + /* attempt to open a file with an invalid open type to generate an error */ /* This code is executing differently on local vs server. Disabled until cause is explored status = fx_file_open(&ram_disk, &file_5, "rootname2", 3); return_if_fail( status == FX_ACCESS_ERROR); */ - + /* try to delete a file in a directory that is read only */ status = fx_file_attributes_read(&ram_disk, "rootname2", &temp_attr); status += fx_file_attributes_set(&ram_disk, "rootname2", FX_READ_ONLY); status += fx_file_delete(&ram_disk, "rootname2"); status += fx_file_attributes_set(&ram_disk, "rootname2", temp_attr); return_if_fail( status == FX_WRITE_PROTECT); - + /* Open all the files. */ status = fx_file_open(&ram_disk, &file_1, "rootname", FX_OPEN_FOR_WRITE); status += fx_file_open(&ram_disk, &file_2, "rootname1", FX_OPEN_FOR_WRITE); @@ -235,64 +235,64 @@ UINT temp_attr; status += fx_file_open(&ram_disk, &file_4, "/subdir/rootname1", FX_OPEN_FOR_WRITE); status += fx_file_open(&ram_disk, &file_5, "rootname2", FX_OPEN_FOR_READ); return_if_fail( status == FX_SUCCESS); - + /* attempt to open a file that is already open */ status = fx_file_open(&ram_disk, &file_6, "rootname", FX_OPEN_FOR_WRITE); return_if_fail( status == FX_ACCESS_ERROR); - + /* try to create and delete a file when the media is write protected to generate an error */ ram_disk.fx_media_driver_write_protect = FX_TRUE; status = fx_file_create(&ram_disk, "asdf"); return_if_fail( status == FX_WRITE_PROTECT); status = fx_file_delete(&ram_disk, "asdf"); return_if_fail( status == FX_WRITE_PROTECT); - + /* Attempt to allocate space while the media is write protected to generate an error */ status = fx_file_extended_allocate(&file_1, 1); return_if_fail( status == FX_WRITE_PROTECT); status = fx_file_extended_best_effort_allocate(&file_1, 1, &temp); return_if_fail( status == FX_WRITE_PROTECT); ram_disk.fx_media_driver_write_protect = FX_FALSE; - + /* test the error checking */ #ifndef FX_DISABLE_ERROR_CHECKING - + /* send a null pointer to generate an error */ status = fx_media_extended_space_available(FX_NULL, FX_NULL); return_if_fail( status == FX_PTR_ERROR); - + /* send a null pointer to generate an error */ status = fx_file_extended_best_effort_allocate(FX_NULL, 0, FX_NULL); - + /* send null pointer to generate an error */ status = fx_file_create(FX_NULL, "rootname"); return_if_fail( status == FX_PTR_ERROR); - + /* send null pointer to generate an error */ status = fx_file_open(FX_NULL, FX_NULL, "rootname", 0); return_if_fail( status == FX_PTR_ERROR); - + /* attempt to open an already open file to generate an error */ status = fx_file_open(&ram_disk, &file_1, "rootname", FX_OPEN_FOR_WRITE); return_if_fail( status == FX_PTR_ERROR); - + /* Attempt to allocate space for a file that is not open to write to generate an error */ status = fx_file_open(&ram_disk, &file_5, "rootname2", FX_OPEN_FOR_READ); status = fx_file_extended_allocate(&file_5, 1); return_if_fail( status == FX_ACCESS_ERROR); - + /* Attempt to allocate space for a file that is not open to write to generate an error */ status = fx_file_extended_best_effort_allocate(&file_5, 0, &temp); return_if_fail( status == FX_ACCESS_ERROR); - + /* Allocate 0 space for a file */ status = fx_file_extended_allocate(&file_1, 0); return_if_fail( status == FX_SUCCESS); - + /* Allocate 0 space for a file */ status = fx_file_extended_best_effort_allocate(&file_1, 0, &temp); return_if_fail( status == FX_SUCCESS); - + /* Attempt to allocate too much space for a file */ status = fx_file_extended_allocate(&file_1, 0xFFFFFFFFFFFFFFFF); return_if_fail( status == FX_NO_MORE_SPACE); @@ -306,13 +306,13 @@ UINT temp_attr; return_if_fail(status == FX_MEDIA_INVALID); ram_disk.fx_media_bytes_per_sector = 256; - + #endif /* FX_DISABLE_ERROR_CHECKING */ - + /* try to delete an open file to generate an error */ status = fx_file_delete(&ram_disk, "rootname"); return_if_fail( status == FX_ACCESS_ERROR); - + /* try to delete something that is not a file to generate an error */ status = fx_file_delete(&ram_disk, "subdir"); return_if_fail( status == FX_NOT_A_FILE); @@ -334,7 +334,7 @@ UINT temp_attr; /* Now read the buffer. */ status = fx_file_read(&file_1, buffer, 30, &actual); return_if_fail( (status == FX_SUCCESS) && (actual == 26)); - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING /* send null pointer to generate an error */ @@ -361,13 +361,13 @@ UINT temp_attr; status += fx_file_close(&file_4); status += fx_file_close(&file_5); return_if_fail( status == FX_SUCCESS); - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING /* send null pointer to generate an error */ status = fx_file_close(FX_NULL); return_if_fail(status == FX_PTR_ERROR); - + /* send null pointer to generate an error */ status = fx_file_delete(FX_NULL, "rootname"); return_if_fail(status == FX_PTR_ERROR); @@ -389,37 +389,37 @@ UINT temp_attr; /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); - + /* Test corner cases in extended best effort allocate. */ - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 7000, // Total sectors - FAT 16 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); return_if_fail( status == FX_SUCCESS); - + /* Create a file. */ status = fx_file_create(&ram_disk, "TEST.TXT"); - + /* Create a secondary file. */ status += fx_file_create(&ram_disk, "TEST1.TXT"); return_if_fail( status == FX_SUCCESS); - + /* Open the file. */ status = fx_file_open(&ram_disk, &file_6, "TEST.TXT", FX_OPEN_FOR_WRITE); status += fx_file_open(&ram_disk, &file_5, "TEST1.TXT", FX_OPEN_FOR_WRITE); @@ -427,7 +427,7 @@ UINT temp_attr; /* Write one cluster of information to the TEST1.TXT file. */ status = fx_file_write(&file_5, buffer, 128); - + /* Close the secondary file. */ status += fx_file_close(&file_5); @@ -438,14 +438,14 @@ UINT temp_attr; status += fx_file_write(&file_6, buffer, 128); } return_if_fail( status == FX_SUCCESS); - + /* Attempt to allocate when there is nothing available. */ status = fx_file_extended_best_effort_allocate(&file_6, 128, &actual64); return_if_fail( status == FX_NO_MORE_SPACE); - + /* Now release the first cluster to create a hole at the front. */ status = fx_file_delete(&ram_disk, "TEST1.TXT"); - + /* Now flush everything out. */ fx_media_flush(&ram_disk); _fx_utility_FAT_flush(&ram_disk); @@ -457,7 +457,7 @@ UINT temp_attr; } /* Read the first FAT sector. */ - status += fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); + status += fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); /* Add a FAT entry randomly in the FAT table. */ fat_buffer[4] = 0x03; @@ -466,7 +466,7 @@ UINT temp_attr; /* Write the FAT corruption out. */ status += fx_media_write(&ram_disk, 1, (VOID *) fat_buffer); return_if_fail( status == FX_SUCCESS); - + /* Attempt to allocate when there is nothing available - with a lost cluster. */ status = fx_file_extended_best_effort_allocate(&file_6, 128, &actual64); return_if_fail( status == FX_NO_MORE_SPACE); @@ -488,7 +488,7 @@ UINT temp_attr; } /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); + status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); /* Make the first entry available. */ fat_buffer[4] = 0x00; @@ -507,15 +507,15 @@ UINT temp_attr; status += fx_file_write(&file_6, fat_buffer, 128); status += fx_file_write(&file_6, fat_buffer, 128); status += fx_file_write(&file_6, fat_buffer, 128); - status += fx_file_write(&file_6, fat_buffer, 128); - + status += fx_file_write(&file_6, fat_buffer, 128); + /* Allocate 4 clusters. */ status += fx_file_extended_best_effort_allocate(&file_6, 512, &actual64); return_if_fail( status == FX_SUCCESS); /* Release all the clusters for this file. */ status = fx_file_extended_truncate_release(&file_6, 0); - + /* Allocate 4 clusters with no clusters in the file. */ status += fx_file_extended_best_effort_allocate(&file_6, 512, &actual64); return_if_fail( status == FX_SUCCESS); @@ -524,26 +524,26 @@ UINT temp_attr; status += fx_file_write(&file_6, fat_buffer, 128); status += fx_file_write(&file_6, fat_buffer, 128); status += fx_file_write(&file_6, fat_buffer, 128); - status += fx_file_write(&file_6, fat_buffer, 128); + status += fx_file_write(&file_6, fat_buffer, 128); /* Now allocate perform allocations with I/O errors on building the new FAT chain. */ _fx_utility_fat_entry_write_error_request = 1; status += fx_file_extended_best_effort_allocate(&file_6, 512, &actual64); _fx_utility_fat_entry_write_error_request = 0; return_if_fail( status == FX_IO_ERROR); - + /* Now allocate perform allocations with I/O error on writing the EOF. */ _fx_utility_fat_entry_write_error_request = 4; status = fx_file_extended_best_effort_allocate(&file_6, 512, &actual64); _fx_utility_fat_entry_write_error_request = 0; return_if_fail( status == FX_IO_ERROR); - + /* Now allocate perform allocations with I/O error on linking to last cluster. */ _fx_utility_fat_entry_write_error_request = 5; status = fx_file_extended_best_effort_allocate(&file_6, 512, &actual64); _fx_utility_fat_entry_write_error_request = 0; return_if_fail( status == FX_IO_ERROR); - + /* Release all the clusters for this file. */ status = fx_file_extended_truncate_release(&file_6, 0); @@ -564,37 +564,37 @@ UINT temp_attr; _fx_utility_logical_sector_write_error_request = 0; return_if_fail( status == FX_IO_ERROR); #endif - + /* Close the file and the media. */ status = fx_file_close(&file_6); status += fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 21000, // Total sectors - FAT 16 - 128, // Sector size + 128, // Sector size 3, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); return_if_fail( status == FX_SUCCESS); - + /* Create a file. */ status = fx_file_create(&ram_disk, "TEST.TXT"); return_if_fail( status == FX_SUCCESS); - + /* Open the file. */ status = fx_file_open(&ram_disk, &file_6, "TEST.TXT", FX_OPEN_FOR_WRITE); return_if_fail( status == FX_SUCCESS); @@ -624,35 +624,35 @@ UINT temp_attr; return_if_fail( status == FX_SUCCESS); /* Test corner cases in extended allocate. */ - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 7000, // Total sectors - FAT 16 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); return_if_fail( status == FX_SUCCESS); - + /* Create a file. */ status = fx_file_create(&ram_disk, "TEST.TXT"); - + /* Create a secondary file. */ status += fx_file_create(&ram_disk, "TEST1.TXT"); return_if_fail( status == FX_SUCCESS); - + /* Open the file. */ status = fx_file_open(&ram_disk, &file_6, "TEST.TXT", FX_OPEN_FOR_WRITE); status = fx_file_open(&ram_disk, &file_5, "TEST1.TXT", FX_OPEN_FOR_WRITE); @@ -660,26 +660,26 @@ UINT temp_attr; /* Write one cluster of information to the TEST1.TXT file. */ status = fx_file_write(&file_5, buffer, 128); - + /* Close the secondary file. */ status += fx_file_close(&file_5); /* Loop to take up the entire ram disk by writing to this file. */ while (ram_disk.fx_media_available_clusters) { - + /* Write a one cluster block. */ status += fx_file_write(&file_6, buffer, 128); } return_if_fail( status == FX_SUCCESS); - + /* Attempt to allocate when there is nothing available. */ status = fx_file_extended_allocate(&file_6, 128); return_if_fail( status == FX_NO_MORE_SPACE); - + /* Now release the first cluster to create a hole at the front. */ status = fx_file_delete(&ram_disk, "TEST1.TXT"); - + /* Now flush everything out. */ fx_media_flush(&ram_disk); _fx_utility_FAT_flush(&ram_disk); @@ -691,7 +691,7 @@ UINT temp_attr; } /* Read the first FAT sector. */ - status += fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); + status += fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); /* Add a FAT entry randomly in the FAT table. */ fat_buffer[4] = 0x03; @@ -700,7 +700,7 @@ UINT temp_attr; /* Write the FAT corruption out. */ status += fx_media_write(&ram_disk, 1, (VOID *) fat_buffer); return_if_fail( status == FX_SUCCESS); - + /* Attempt to allocate when there is nothing available - with a lost cluster. */ status = fx_file_extended_allocate(&file_6, 128); return_if_fail( status == FX_NO_MORE_SPACE); @@ -722,7 +722,7 @@ UINT temp_attr; } /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); + status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); /* Make the first entry available. */ fat_buffer[4] = 0x00; @@ -741,15 +741,15 @@ UINT temp_attr; status += fx_file_write(&file_6, fat_buffer, 128); status += fx_file_write(&file_6, fat_buffer, 128); status += fx_file_write(&file_6, fat_buffer, 128); - status += fx_file_write(&file_6, fat_buffer, 128); - + status += fx_file_write(&file_6, fat_buffer, 128); + /* Allocate 4 clusters. */ status += fx_file_extended_allocate(&file_6, 512); return_if_fail( status == FX_SUCCESS); /* Release all the clusters for this file. */ status = fx_file_extended_truncate_release(&file_6, 0); - + /* Allocate 4 clusters with no clusters in the file. */ status += fx_file_extended_allocate(&file_6, 512); return_if_fail( status == FX_SUCCESS); @@ -758,26 +758,26 @@ UINT temp_attr; status += fx_file_write(&file_6, fat_buffer, 128); status += fx_file_write(&file_6, fat_buffer, 128); status += fx_file_write(&file_6, fat_buffer, 128); - status += fx_file_write(&file_6, fat_buffer, 128); + status += fx_file_write(&file_6, fat_buffer, 128); /* Now allocate perform allocations with I/O errors on building the new FAT chain. */ _fx_utility_fat_entry_write_error_request = 1; status += fx_file_extended_allocate(&file_6, 512); _fx_utility_fat_entry_write_error_request = 0; return_if_fail( status == FX_IO_ERROR); - + /* Now allocate perform allocations with I/O error on writing the EOF. */ _fx_utility_fat_entry_write_error_request = 4; status = fx_file_extended_allocate(&file_6, 512); _fx_utility_fat_entry_write_error_request = 0; return_if_fail( status == FX_IO_ERROR); - + /* Now allocate perform allocations with I/O error on linking to last cluster. */ _fx_utility_fat_entry_write_error_request = 5; status = fx_file_extended_allocate(&file_6, 512); _fx_utility_fat_entry_write_error_request = 0; return_if_fail( status == FX_IO_ERROR); - + /* Release all the clusters for this file. */ status = fx_file_extended_truncate_release(&file_6, 0); @@ -799,37 +799,37 @@ UINT temp_attr; _fx_utility_logical_sector_write_error_request = 0; return_if_fail( status == FX_IO_ERROR); #endif - + /* Close the file and the media. */ status = fx_file_close(&file_6); status += fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 21000, // Total sectors - FAT 16 - 128, // Sector size + 128, // Sector size 3, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); return_if_fail( status == FX_SUCCESS); - + /* Create a file. */ status = fx_file_create(&ram_disk, "TEST.TXT"); return_if_fail( status == FX_SUCCESS); - + /* Open the file. */ status = fx_file_open(&ram_disk, &file_6, "TEST.TXT", FX_OPEN_FOR_WRITE); return_if_fail( status == FX_SUCCESS); @@ -856,7 +856,7 @@ UINT temp_attr; /* Now test the maximum allocate size. */ actual64 = file_6.fx_file_current_available_size; file_6.fx_file_current_available_size = 0xFFFFFFF8; - + /* Allocate more clusters but with the file near maximum size to test the maximum size logic. */ status = fx_file_extended_allocate(&file_6, 512); file_6.fx_file_current_available_size = actual64; @@ -865,7 +865,7 @@ UINT temp_attr; /* Now test the maximum allocate size. */ actual64 = file_6.fx_file_current_available_size; file_6.fx_file_current_available_size = 0xFFFFFFFFFFFFFFF8; - + /* Allocate more clusters but with the file near maximum size to test the maximum size logic. */ status = fx_file_extended_allocate(&file_6, 512); file_6.fx_file_current_available_size = actual64; @@ -874,7 +874,7 @@ UINT temp_attr; /* Now test the maximum allocate size. */ actual64 = file_6.fx_file_current_available_size; file_6.fx_file_current_available_size = 0xFFFFFFF8; - + /* Allocate more clusters but with the file near maximum size to test the maximum size logic. */ status = fx_file_extended_best_effort_allocate(&file_6, 512, &actual64); file_6.fx_file_current_available_size = actual64; @@ -883,7 +883,7 @@ UINT temp_attr; /* Now test the maximum allocate size. */ actual64 = file_6.fx_file_current_available_size; file_6.fx_file_current_available_size = 0xFFFFFFFFFFFFFFF8; - + /* Allocate more clusters but with the file near maximum size to test the maximum size logic. */ status = fx_file_extended_best_effort_allocate(&file_6, 512, &actual64); file_6.fx_file_current_available_size = actual64; @@ -892,35 +892,35 @@ UINT temp_attr; /* Now test a maximium size allocation. */ status = fx_file_extended_best_effort_allocate(&file_6, 0xFFFFFFFFFFFFFFF8ULL, &actual64); return_if_fail( status == FX_NO_MORE_SPACE); - + /* Close the file and the media. */ status = fx_file_close(&file_6); status += fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); - + /* Check the corner cases of file delete. */ - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 7000, // Total sectors - FAT 16 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); return_if_fail( status == FX_SUCCESS); - + /* Create a set of files. */ status = fx_file_create(&ram_disk, "TEST.TXT"); status += fx_file_create(&ram_disk, "TEST1.TXT"); @@ -954,7 +954,7 @@ UINT temp_attr; status += fx_file_create(&ram_disk, "TEST29.TXT"); status += fx_file_create(&ram_disk, "TEST30.TXT"); return_if_fail( status == FX_SUCCESS); - + /* Open a couple files.... */ status = fx_file_open(&ram_disk, &file_4, "TEST.TXT", FX_OPEN_FOR_WRITE); status = fx_file_open(&ram_disk, &file_5, "TEST1.TXT", FX_OPEN_FOR_WRITE); @@ -977,7 +977,7 @@ UINT temp_attr; status += fx_file_write(&file_7, fat_buffer, 128); status += fx_file_write(&file_7, fat_buffer, 128); return_if_fail( status == FX_SUCCESS); - + /* Now flush everything out. */ fx_media_flush(&ram_disk); _fx_utility_FAT_flush(&ram_disk); @@ -987,10 +987,10 @@ UINT temp_attr; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_cluster = 0; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_value = 0; } - + /* Close TEST.TXT. */ status = fx_file_close(&file_4); - + /* Attempt to delete the file, but with open files on a different offset/sector and a write I/O error. */ _fx_utility_logical_sector_read_error_request = 2; status += fx_file_delete(&ram_disk, "TEST.TXT"); @@ -1011,13 +1011,13 @@ UINT temp_attr; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_cluster = 0; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_value = 0; } - + /* Attempt to delete the file, but with a FAT read error. */ _fx_utility_fat_entry_read_error_request = 1; status += fx_file_delete(&ram_disk, "TEST1.TXT"); _fx_utility_fat_entry_read_error_request = 0; return_if_fail( status == FX_IO_ERROR); - + /* Now flush everything out. */ fx_media_flush(&ram_disk); _fx_utility_FAT_flush(&ram_disk); @@ -1027,13 +1027,13 @@ UINT temp_attr; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_cluster = 0; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_value = 0; } - + /* Attempt to delete the file, but with a FAT write error. */ _fx_utility_fat_entry_write_error_request = 1; status = fx_file_delete(&ram_disk, "TEST30.TXT"); _fx_utility_fat_entry_write_error_request = 0; return_if_fail( status == FX_IO_ERROR); - + /* Now flush everything out. */ fx_media_flush(&ram_disk); _fx_utility_FAT_flush(&ram_disk); @@ -1043,9 +1043,9 @@ UINT temp_attr; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_cluster = 0; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_value = 0; } - + /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); + status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); /* Make the first entry available. */ fat_buffer[4] = 0x02; @@ -1058,25 +1058,25 @@ UINT temp_attr; /* Attempt to delete the file, but with a bad FAT chain. */ status = fx_file_delete(&ram_disk, "TEST.TXT"); return_if_fail( status == FX_FAT_READ_ERROR); - + /* Attempt to delete the file that exceeds the cluster clount (that we modify to be small). */ actual = ram_disk.fx_media_total_clusters; ram_disk.fx_media_total_clusters = 1; - status = fx_file_delete(&ram_disk, "TEST29.TXT"); + status = fx_file_delete(&ram_disk, "TEST29.TXT"); ram_disk.fx_media_total_clusters = actual; return_if_fail( status == FX_FAT_READ_ERROR); - + /* Build a long file name, exceeding FX_MAX_LONG_NAME_LEN. */ for (i = 0; i < (FX_MAX_LONG_NAME_LEN+1); i++) { name_buffer[i] = 'a'; } name_buffer[FX_MAX_LONG_NAME_LEN] = 0; - + /* Attempt to create a file with this extra long name... this is expected to fail. */ status = fx_file_create(&ram_disk, (CHAR *)name_buffer); return_if_fail( status == FX_INVALID_NAME); - + /* Now open and write to a file so we can test file close I/O error condition. */ status = fx_file_open(&ram_disk, &file_7, "TEST20.TXT", FX_OPEN_FOR_WRITE); status += fx_file_write(&file_7, fat_buffer, 128); @@ -1086,11 +1086,11 @@ UINT temp_attr; status += fx_file_close(&file_7); _fx_utility_logical_sector_read_error_request = 0; return_if_fail( status == FX_IO_ERROR); - + /* Now call the best effort allocate with a closed file handle. */ status = fx_file_best_effort_allocate(&file_7, 1, &actual); return_if_fail( status == FX_NOT_OPEN); - + /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); diff --git a/test/regression_test/filex_file_date_time_set_test.c b/test/regression_test/filex_file_date_time_set_test.c index df3ecce..eb1b781 100644 --- a/test/regression_test/filex_file_date_time_set_test.c +++ b/test/regression_test/filex_file_date_time_set_test.c @@ -58,13 +58,13 @@ void filex_file_date_time_set_application_define(void *first_unused_memory) #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -105,20 +105,20 @@ FX_FILE my_file; printf("FileX Test: File date/time set test................................"); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -127,7 +127,7 @@ FX_FILE my_file; printf("ERROR!\n"); test_control_return(1); } - + /* try to retrieve directory information before the media has been opened to generate an error */ status = fx_directory_information_get(&ram_disk, "DOES_NOT_EXIST", &attributes, &size, &year, &month, &day, &hour, &minute, &second); @@ -136,7 +136,7 @@ FX_FILE my_file; printf("ERROR!\n"); test_control_return(2); } - + /* Attempt to set the date and time for a file before the media is opened to generate an error */ status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2000, 1, 1, 1, 1, 1); if (status != FX_MEDIA_NOT_OPEN) @@ -169,10 +169,10 @@ FX_FILE my_file; printf("ERROR!\n"); test_control_return(5); } - + /* test error checking */ #ifndef FX_DISABLE_ERROR_CHECKING - + /* send a null pointer to generate an error */ status = fx_directory_information_get(&ram_disk, "DOES_NOT_EXIST", FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL); @@ -181,7 +181,7 @@ FX_FILE my_file; printf("ERROR!\n"); test_control_return(6); } - + /* send null pointer to generate an error */ status = fx_file_date_time_set(FX_NULL, "TEST.TXT", 0, 0, 0, 0, 0, 0); if (status != FX_PTR_ERROR) @@ -189,7 +189,7 @@ FX_FILE my_file; printf("ERROR!\n"); test_control_return(7); } - + /* send an invalid year to generate an error */ status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 0, 0, 0, 0, 0, 0); if (status != FX_INVALID_YEAR) @@ -197,7 +197,7 @@ FX_FILE my_file; printf("ERROR!\n"); test_control_return(8); } - + /* send an invalid month to generate an error */ status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2015, 0, 1, 0, 0, 0); if (status != FX_INVALID_MONTH) @@ -205,7 +205,7 @@ FX_FILE my_file; printf("ERROR!\n"); test_control_return(9); } - + /* send a valid and invalid day for each month to generate an error */ for (i = 1; i <= 12; i++) { @@ -215,7 +215,7 @@ FX_FILE my_file; printf("ERROR!\n"); test_control_return(10); } - + status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2015, i, 1, 1, 1, 1); if (status != FX_SUCCESS) { @@ -223,7 +223,7 @@ FX_FILE my_file; test_control_return(11); } } - + /* send an invalid day for feb of a leap year */ status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2016, 2, 0, 0, 0, 0); if (status != FX_INVALID_DAY) @@ -231,7 +231,7 @@ FX_FILE my_file; printf("ERROR!\n"); test_control_return(12); } - + /* send an invalid hour to generate an error */ status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2000, 1, 1, 99, 0, 0); if (status != FX_INVALID_HOUR) @@ -239,7 +239,7 @@ FX_FILE my_file; printf("ERROR!\n"); test_control_return(13); } - + /* send an invalid minute to generate an error */ status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2000, 1, 1, 1, 99, 0); if (status != FX_INVALID_MINUTE) @@ -247,7 +247,7 @@ FX_FILE my_file; printf("ERROR!\n"); test_control_return(14); } - + /* send an invalid second to generate an error */ status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2000, 1, 1, 1, 1, 99); if (status != FX_INVALID_SECOND) @@ -257,7 +257,7 @@ FX_FILE my_file; } #endif - + /* Attempt to set the date and time for a file that does not exist to generate an error */ status = fx_file_date_time_set(&ram_disk, "DOES_NOT_EXIST", 2000, 1, 1, 1, 1, 1); if (status == FX_SUCCESS) @@ -270,17 +270,17 @@ FX_FILE my_file; fx_media_cache_invalidate(&ram_disk); /* Set the date and time for the file. */ - status = fx_file_date_time_set(&ram_disk, "TEST.TXT", + status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 1999, 12, 31, 23, 59, 58); /* Check the date/time set status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(17); } - + /* try to retrieve directory information for something that doesnt exist to generate an error */ status = fx_directory_information_get(&ram_disk, "DOES_NOT_EXIST", &attributes, &size, &year, &month, &day, &hour, &minute, &second); @@ -298,14 +298,14 @@ FX_FILE my_file; &year, &month, &day, &hour, &minute, &second); /* Check the date/time status. */ - if ((status != FX_SUCCESS) || (attributes != FX_ARCHIVE) || (size != 0) || + if ((status != FX_SUCCESS) || (attributes != FX_ARCHIVE) || (size != 0) || (year != 1999) || (month != 12) || (day != 31) || (hour != 23) || (minute != 59) || (second != 58)) { printf("ERROR!\n"); test_control_return(19); } - + /* get the date/time for the other files while some are opened to get better code coverage */ status = fx_file_open(&ram_disk, &my_file, "OPENED_FOR_WRITE.TXT", FX_OPEN_FOR_WRITE); status += fx_directory_information_get(&ram_disk, "OPENED_FOR_WRITE.TXT", &attributes, &size, @@ -319,7 +319,7 @@ FX_FILE my_file; } /* Close the media. */ - status = fx_media_close(&ram_disk); + status = fx_media_close(&ram_disk); /* Determine if the test was successful. */ if (status != FX_SUCCESS) @@ -330,11 +330,11 @@ FX_FILE my_file; } #ifndef FX_DISABLE_ERROR_CHECKING /* Set the date and time for with an invalid file name. */ - status = fx_file_date_time_set(&ram_disk, NULL, + status = fx_file_date_time_set(&ram_disk, NULL, 1999, 12, 31, 23, 59, 58); /* Check the date/time set status. */ - if (status != FX_PTR_ERROR) + if (status != FX_PTR_ERROR) { printf("ERROR!\n"); @@ -342,11 +342,11 @@ FX_FILE my_file; } /* Set the date and time for with an invalid year. */ - status = fx_file_date_time_set(&ram_disk, "TEST.TXT", + status = fx_file_date_time_set(&ram_disk, "TEST.TXT", FX_MAXIMUM_YEAR+1, 12, 31, 23, 59, 58); /* Check the date/time set status. */ - if (status != FX_INVALID_YEAR) + if (status != FX_INVALID_YEAR) { printf("ERROR!\n"); @@ -354,11 +354,11 @@ FX_FILE my_file; } /* Set the date and time for with an invalid day for January. */ - status = fx_file_date_time_set(&ram_disk, "TEST.TXT", + status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2016, 1, 32, 23, 59, 58); /* Check the date/time set status. */ - if (status != FX_INVALID_DAY) + if (status != FX_INVALID_DAY) { printf("ERROR!\n"); @@ -366,11 +366,11 @@ FX_FILE my_file; } /* Set the date and time for with an invalid day for Febuary leap year. */ - status = fx_file_date_time_set(&ram_disk, "TEST.TXT", + status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2016, 2, 30, 23, 59, 58); /* Check the date/time set status. */ - if (status != FX_INVALID_DAY) + if (status != FX_INVALID_DAY) { printf("ERROR!\n"); @@ -378,11 +378,11 @@ FX_FILE my_file; } /* Set the date and time for with a valid day for Febuary leap year. */ - status = fx_file_date_time_set(&ram_disk, "TEST.TXT", + status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2016, 2, 29, 24, 59, 58); /* Check the date/time set status. */ - if (status != FX_INVALID_HOUR) + if (status != FX_INVALID_HOUR) { printf("ERROR!\n"); @@ -390,11 +390,11 @@ FX_FILE my_file; } /* Set the date and time for with an invalid day for Febuary. */ - status = fx_file_date_time_set(&ram_disk, "TEST.TXT", + status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2017, 2, 29, 23, 59, 58); /* Check the date/time set status. */ - if (status != FX_INVALID_DAY) + if (status != FX_INVALID_DAY) { printf("ERROR!\n"); @@ -402,11 +402,11 @@ FX_FILE my_file; } /* Set the date and time for with an invalid day for March. */ - status = fx_file_date_time_set(&ram_disk, "TEST.TXT", + status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2017, 3, 32, 23, 59, 58); /* Check the date/time set status. */ - if (status != FX_INVALID_DAY) + if (status != FX_INVALID_DAY) { printf("ERROR!\n"); @@ -414,11 +414,11 @@ FX_FILE my_file; } /* Set the date and time for with an invalid day for April. */ - status = fx_file_date_time_set(&ram_disk, "TEST.TXT", + status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2017, 4, 31, 23, 59, 58); /* Check the date/time set status. */ - if (status != FX_INVALID_DAY) + if (status != FX_INVALID_DAY) { printf("ERROR!\n"); @@ -426,11 +426,11 @@ FX_FILE my_file; } /* Set the date and time for with an invalid day for May. */ - status = fx_file_date_time_set(&ram_disk, "TEST.TXT", + status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2017, 5, 32, 23, 59, 58); /* Check the date/time set status. */ - if (status != FX_INVALID_DAY) + if (status != FX_INVALID_DAY) { printf("ERROR!\n"); @@ -438,11 +438,11 @@ FX_FILE my_file; } /* Set the date and time for with an invalid day for June. */ - status = fx_file_date_time_set(&ram_disk, "TEST.TXT", + status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2017, 6, 31, 23, 59, 58); /* Check the date/time set status. */ - if (status != FX_INVALID_DAY) + if (status != FX_INVALID_DAY) { printf("ERROR!\n"); @@ -450,11 +450,11 @@ FX_FILE my_file; } /* Set the date and time for with an invalid day for July. */ - status = fx_file_date_time_set(&ram_disk, "TEST.TXT", + status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2017, 7, 32, 23, 59, 58); /* Check the date/time set status. */ - if (status != FX_INVALID_DAY) + if (status != FX_INVALID_DAY) { printf("ERROR!\n"); @@ -462,11 +462,11 @@ FX_FILE my_file; } /* Set the date and time for with an invalid day for August. */ - status = fx_file_date_time_set(&ram_disk, "TEST.TXT", + status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2017, 8, 32, 23, 59, 58); /* Check the date/time set status. */ - if (status != FX_INVALID_DAY) + if (status != FX_INVALID_DAY) { printf("ERROR!\n"); @@ -474,11 +474,11 @@ FX_FILE my_file; } /* Set the date and time for with an invalid day for September. */ - status = fx_file_date_time_set(&ram_disk, "TEST.TXT", + status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2017, 9, 31, 23, 59, 58); /* Check the date/time set status. */ - if (status != FX_INVALID_DAY) + if (status != FX_INVALID_DAY) { printf("ERROR!\n"); @@ -486,11 +486,11 @@ FX_FILE my_file; } /* Set the date and time for with an invalid day for October. */ - status = fx_file_date_time_set(&ram_disk, "TEST.TXT", + status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2017, 10, 32, 23, 59, 58); /* Check the date/time set status. */ - if (status != FX_INVALID_DAY) + if (status != FX_INVALID_DAY) { printf("ERROR!\n"); @@ -498,11 +498,11 @@ FX_FILE my_file; } /* Set the date and time for with an invalid day for November. */ - status = fx_file_date_time_set(&ram_disk, "TEST.TXT", + status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2017, 11, 31, 23, 59, 58); /* Check the date/time set status. */ - if (status != FX_INVALID_DAY) + if (status != FX_INVALID_DAY) { printf("ERROR!\n"); @@ -510,11 +510,11 @@ FX_FILE my_file; } /* Set the date and time for with an invalid day for December. */ - status = fx_file_date_time_set(&ram_disk, "TEST.TXT", + status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2017, 12, 32, 23, 59, 58); /* Check the date/time set status. */ - if (status != FX_INVALID_DAY) + if (status != FX_INVALID_DAY) { printf("ERROR!\n"); @@ -522,20 +522,20 @@ FX_FILE my_file; } #endif /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 64, // Directory Entries 0, // Hidden sectors - 4096, // Total sectors - 128, // Sector size + 4096, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -556,7 +556,7 @@ FX_FILE my_file; printf("ERROR!\n"); test_control_return(39); } - + /* Create a bunch of files. */ status = fx_file_create(&ram_disk, "TEST.TXT"); status += fx_file_create(&ram_disk, "TEST1.TXT"); @@ -601,7 +601,7 @@ FX_FILE my_file; status += fx_file_open(&ram_disk, &file_6, "TEST30.TXT", FX_OPEN_FOR_WRITE); /* Now get information on the first file... requesting on the "second" parameter. */ - status += fx_directory_information_get(&ram_disk, "TEST.TXT", FX_NULL, FX_NULL, + status += fx_directory_information_get(&ram_disk, "TEST.TXT", FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, &second); @@ -614,7 +614,7 @@ FX_FILE my_file; } /* Now get information on the first file... requesting on the "minute" parameter. */ - status += fx_directory_information_get(&ram_disk, "TEST.TXT", FX_NULL, FX_NULL, + status += fx_directory_information_get(&ram_disk, "TEST.TXT", FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, &minute, FX_NULL); @@ -625,10 +625,10 @@ FX_FILE my_file; printf("ERROR!\n"); test_control_return(41); } - + /* Close the media. */ status = fx_media_close(&ram_disk); - + /* Determine if there was an error. */ if (status != FX_SUCCESS) { diff --git a/test/regression_test/filex_file_name_test.c b/test/regression_test/filex_file_name_test.c index e9ba1aa..1569221 100644 --- a/test/regression_test/filex_file_name_test.c +++ b/test/regression_test/filex_file_name_test.c @@ -62,13 +62,13 @@ void filex_file_name_application_define(void *first_unused_memory) #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -104,24 +104,24 @@ ULONG i; printf("FileX Test: File name test........................................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 512, // Sector size + 512, // Total sectors + 512, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ return_if_fail( status == FX_SUCCESS); - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -153,7 +153,7 @@ ULONG i; /* Write to the file. */ status = fx_file_write(&my_file, write_data, sizeof(write_data)); return_if_fail( status == FX_SUCCESS); - + /* Close the file. */ status = fx_file_close(&my_file); return_if_fail( status == FX_SUCCESS); @@ -175,7 +175,7 @@ ULONG i; /* Write to the file. */ status = fx_file_write(&my_file, write_data, sizeof(write_data)); return_if_fail( status == FX_SUCCESS); - + /* Close the file. */ status = fx_file_close(&my_file); return_if_fail( status == FX_SUCCESS); @@ -199,7 +199,7 @@ ULONG i; return_if_fail( status == FX_SUCCESS); return_if_fail( actual == sizeof(write_data)); return_if_fail( memcmp(read_data, write_data, actual) == 0); - + /* Close the file. */ status = fx_file_close(&my_file); return_if_fail( status == FX_SUCCESS); diff --git a/test/regression_test/filex_file_naming_test.c b/test/regression_test/filex_file_naming_test.c index beffd14..5f307a4 100644 --- a/test/regression_test/filex_file_naming_test.c +++ b/test/regression_test/filex_file_naming_test.c @@ -51,13 +51,13 @@ void filex_file_naming_application_define(void *first_unused_memory) #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -93,20 +93,20 @@ CHAR special_name[10]; printf("FileX Test: File naming test......................................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -186,7 +186,7 @@ CHAR special_name[10]; /* Error creating special name. Return to caller. */ printf("ERROR!\n"); test_control_return(5); - } + } /* Create another special file name. */ special_name[0] = (CHAR)0xE5; @@ -207,7 +207,7 @@ CHAR special_name[10]; /* Error creating special name. Return to caller. */ printf("ERROR!\n"); test_control_return(6); - } + } /* Create the next level of sub-directories.... with the interesting names... */ status = fx_directory_default_set(&ram_disk, "/A0"); @@ -223,7 +223,7 @@ CHAR special_name[10]; status += fx_file_create(&ram_disk, "/.d0.dir/test.txt"); status += fx_file_create(&ram_disk, "/.b0/TEST.TXT"); status += fx_media_flush(&ram_disk); - + /* Check for errors. */ if (status != FX_SUCCESS) { @@ -231,7 +231,7 @@ CHAR special_name[10]; /* Error creating interesting file names. Return to caller. */ printf("ERROR!\n"); test_control_return(7); - } + } /* Now attempt to delete the files in each of these sub-directories. */ status = fx_file_delete(&ram_disk, "/A0/.a.a.a."); @@ -258,7 +258,7 @@ CHAR special_name[10]; /* Error deleting test files in the interesting sub-directories. Return to caller. */ printf("ERROR!\n"); test_control_return(8); - } + } /* Set default to root directory. */ status = fx_directory_default_set(&ram_disk, "/"); @@ -266,7 +266,7 @@ CHAR special_name[10]; /* Flush the media... should be empty at this point. */ status += fx_media_flush(&ram_disk); - /* Now fill the media's root directory until we get an error... We will use 8.3 names + /* Now fill the media's root directory until we get an error... We will use 8.3 names to attempt to create 32 names. */ status += fx_file_create(&ram_disk, "A01"); status += fx_file_create(&ram_disk, "A02"); @@ -360,7 +360,7 @@ CHAR special_name[10]; status += fx_file_delete(&ram_disk, "A30"); status += fx_file_delete(&ram_disk, "A31"); status += fx_file_delete(&ram_disk, "A32"); - + /* Check for errors... */ if (status != FX_SUCCESS) { @@ -372,7 +372,7 @@ CHAR special_name[10]; /* Flush the media. */ status = fx_media_flush(&ram_disk); - + /* Now do the same thing, except with 2 entry long names. */ status += fx_file_create(&ram_disk, "b01"); status += fx_file_create(&ram_disk, "b02"); @@ -432,7 +432,7 @@ CHAR special_name[10]; status += fx_file_delete(&ram_disk, "b14"); status += fx_file_delete(&ram_disk, "b15"); status += fx_file_delete(&ram_disk, "b16"); - + /* Check for errors... */ if (status != FX_SUCCESS) { @@ -447,7 +447,7 @@ CHAR special_name[10]; /* Now delete this file. */ status += fx_file_delete(&ram_disk, "TEST.T~ "); - + /* Check for errors... */ if (status != FX_SUCCESS) { @@ -456,7 +456,7 @@ CHAR special_name[10]; printf("ERROR!\n"); test_control_return(14); } - + /* Close the media. */ status = fx_media_close(&ram_disk); diff --git a/test/regression_test/filex_file_read_write_test.c b/test/regression_test/filex_file_read_write_test.c index 7e69263..2be90b1 100644 --- a/test/regression_test/filex_file_read_write_test.c +++ b/test/regression_test/filex_file_read_write_test.c @@ -61,13 +61,13 @@ void filex_file_read_write_application_define(void *first_unused_memory) #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -110,20 +110,20 @@ ULONG i, j; printf("FileX Test: File read/write test..................................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 511, // Total sectors - 128, // Sector size + 511, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -156,7 +156,7 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(3); } - + /* try to write to a file before it has been opened */ status = fx_file_write(&my_file, (void *) &write_value, sizeof(ULONG)); if (status != FX_NOT_OPEN) @@ -176,7 +176,7 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(4); } - + /* try to write to a file while it is write protected */ ram_disk.fx_media_driver_write_protect = FX_TRUE; status = fx_file_write(&my_file, (void *) &write_value, sizeof(ULONG)); @@ -186,7 +186,7 @@ ULONG i, j; test_control_return(23); } ram_disk.fx_media_driver_write_protect = FX_FALSE; - + /* try to write to a file that is not opened for writing */ status = fx_file_write(&read_only, (void *) &write_value, sizeof(ULONG)); if (status != FX_ACCESS_ERROR) @@ -194,7 +194,7 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(23); } - + ram_disk.fx_media_bytes_per_sector = 0; /* Try to write to a file when media is corrupted. */ @@ -209,7 +209,7 @@ ULONG i, j; /* Pickup the available bytes in the media. */ status = fx_media_space_available(&ram_disk, &available_bytes); - + /* Check for available bytes error. */ if ((status != FX_SUCCESS) || (available_bytes < sizeof(ULONG))) { @@ -217,7 +217,7 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(5); } - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING /* send null pointer to generate an error */ @@ -234,7 +234,7 @@ ULONG i, j; write_value = 0; while (i < available_bytes) { - + /* Write 4 bytes to the file. */ status = fx_file_write(&my_file, (void *) &write_value, sizeof(ULONG)); @@ -245,17 +245,17 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(6); } - + /* Increment byte count. */ i = i + sizeof(ULONG); - + /* Increment write value. */ write_value++; } - + /* Pickup the available bytes in the media again. */ status = fx_media_space_available(&ram_disk, &i); - + /* Check for available bytes error. */ if ((status != FX_SUCCESS) || (i != 0)) { @@ -263,12 +263,12 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(7); } - + #ifndef FX_DISABLE_CACHE - /* At this point, we should invalidate the (which also flushes the cache) media to ensure that all + /* At this point, we should invalidate the (which also flushes the cache) media to ensure that all dirty sectors are written. */ status = fx_media_cache_invalidate(&ram_disk); - + /* Check for flush errors. */ if ((status != FX_SUCCESS) || (ram_disk.fx_media_sector_cache_dirty_count)) { @@ -276,21 +276,21 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(8); } - + /* See if any sectors are still valid in the cache. */ for (i = 0; i < FX_MAX_SECTOR_CACHE; i++) { - + /* Determine if this cache entry is still valid. */ if (ram_disk.fx_media_sector_cache[i].fx_cached_sector_valid) { - + printf("ERROR!\n"); test_control_return(81); } } #endif - + /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); @@ -301,7 +301,7 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(9); } - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING /* send null pointer to generate an error */ @@ -318,7 +318,7 @@ ULONG i, j; read_value = 0; while (i < available_bytes) { - + /* Read 4 bytes from the file. */ status = fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); @@ -357,20 +357,20 @@ ULONG i, j; } /* Reformat the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 511, // Total sectors (ensure clusters divisible by 4) - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -391,7 +391,7 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(14); } - + /* Read 4 bytes from the file. */ status = fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); if (status != FX_NOT_OPEN) @@ -424,7 +424,7 @@ ULONG i, j; /* Pickup the available bytes in the media. */ status = fx_media_space_available(&ram_disk, &available_bytes); - + /* Check for available bytes error. */ if ((status != FX_SUCCESS) || (available_bytes < sizeof(ULONG))) { @@ -438,7 +438,7 @@ ULONG i, j; write_value = 0; while (i < available_bytes) { - + /* Write 4 bytes to the file. */ status = fx_file_write(&my_file, (void *) &write_value, sizeof(ULONG)); @@ -449,17 +449,17 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(18); } - + /* Increment byte count. */ i = i + sizeof(ULONG); - + /* Increment write value. */ write_value++; } - + /* Pickup the available bytes in the media again. */ status = fx_media_space_available(&ram_disk, &i); - + /* Check for available bytes error. */ if ((status != FX_SUCCESS) || (i != 0)) { @@ -467,12 +467,12 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(19); } - + #ifndef FX_DISABLE_CACHE - /* At this point, we should invalidate the media to ensure that all + /* At this point, we should invalidate the media to ensure that all dirty sectors are written. */ status = fx_media_cache_invalidate(&ram_disk); - + /* Check for flush errors. */ if ((status != FX_SUCCESS) || (ram_disk.fx_media_sector_cache_dirty_count)) { @@ -484,17 +484,17 @@ ULONG i, j; /* See if any sectors are still valid in the cache. */ for (i = 0; i < ram_disk.fx_media_sector_cache_size; i++) { - + /* Determine if this cache entry is still valid. */ if (ram_disk.fx_media_sector_cache[i].fx_cached_sector_valid) { - + printf("ERROR!\n"); test_control_return(81); } } #endif - + /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); @@ -511,7 +511,7 @@ ULONG i, j; read_value = 0; while (i < available_bytes) { - + /* Read 4 bytes from the file. */ status = fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); @@ -540,7 +540,7 @@ ULONG i, j; /* Close the media. */ status = fx_media_close(&ram_disk); - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); @@ -564,18 +564,18 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(26); } - + /* Now read in all the bytes again to make sure the file contents are really there. */ i = 0; read_value = 0; while (i < available_bytes) { - + /* Read as much as 4 sectors full of bytes from the file. */ status = fx_file_read(&my_file, (void *) my_buffer, sizeof(my_buffer), &actual); /* Check the file read status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -585,15 +585,15 @@ ULONG i, j; /* Determine if the contents are what is expected. */ for (j = 0; j < actual/sizeof(ULONG); j++) { - + /* Determine if the buffer is correct. */ if (read_value != my_buffer[j]) { - + printf("ERROR!\n"); test_control_return(28); } - + read_value++; } @@ -603,7 +603,7 @@ ULONG i, j; /* Close the file. */ status = fx_file_close(&my_file); - + /* Open the file again but with the fast option. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_READ_FAST); @@ -615,18 +615,18 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(29); } - + /* Now read in all the bytes again to make sure the file contents are really there. */ i = 0; read_value = 0; while (i < available_bytes) { - + /* Read as much as 4 sectors full of bytes from the file. */ status = fx_file_read(&my_file, (void *) my_buffer, sizeof(my_buffer), &actual); /* Check the file read status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -636,15 +636,15 @@ ULONG i, j; /* Determine if the contents are what is expected. */ for (j = 0; j < actual/sizeof(ULONG); j++) { - + /* Determine if the buffer is correct. */ if (read_value != my_buffer[j]) { - + printf("ERROR!\n"); test_control_return(31); } - + read_value++; } @@ -665,7 +665,7 @@ ULONG i, j; /* Delete the file. */ status = fx_file_delete(&ram_disk, "TEST.TXT"); - + /* Check the file delete status. */ if (status != FX_SUCCESS) { @@ -677,7 +677,7 @@ ULONG i, j; /* Write the file in blocks and then read ulong at a time. */ status = fx_file_create(&ram_disk, "TEST.TXT"); status += fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); - + /* Check the file open status. */ if (status != FX_SUCCESS) { @@ -685,7 +685,7 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(34); } - + /* Now write the big buffer at the same time. */ /* Now read in all the bytes again to make sure the file contents are really there. */ i = 0; @@ -696,17 +696,17 @@ ULONG i, j; /* Build the buffer. */ for (j = 0; j < actual/sizeof(ULONG); j++) { - + /* Build the buffer entry. */ my_buffer[j] = read_value++; } - + /* Write 4 sectors at a time. */ status = fx_file_write(&my_file, (void *) my_buffer, sizeof(my_buffer)); /* Check the file write status. */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -716,15 +716,15 @@ ULONG i, j; /* Increment byte count. */ i = i + sizeof(my_buffer); } - + /* At this point, seek to the beginning of the file and read every 4 bytes. */ status = fx_file_seek(&my_file, 0); - + i = 0; read_value = 0; while (i < available_bytes) { - + /* Read 4 bytes from the file. */ status = fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); @@ -742,9 +742,9 @@ ULONG i, j; /* Close the file. */ status += fx_file_close(&my_file); - + /* Close the media. */ - status += fx_media_close(&ram_disk); + status += fx_media_close(&ram_disk); /* Determine if the test was successful. */ if (status != FX_SUCCESS) @@ -754,23 +754,23 @@ ULONG i, j; test_control_return(37); } - /* Test the update of files open for reading while the write is happening. */ + /* Test the update of files open for reading while the write is happening. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 6000, // Total sectors - FAT16 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -801,32 +801,32 @@ ULONG i, j; status += fx_file_open(&ram_disk, &my_file2, "TEST.TXT", FX_OPEN_FOR_WRITE); status += fx_file_open(&ram_disk, &my_file3, "TEST1.TXT", FX_OPEN_FOR_WRITE); status += fx_file_open(&ram_disk, &my_file4, "TEST2.TXT", FX_OPEN_FOR_WRITE); - status += fx_file_write(&my_file4, my_buffer, 128); - + status += fx_file_write(&my_file4, my_buffer, 128); + /* Now loop through the maximum of clusters to fill and read the file. */ i = 0; while (ram_disk.fx_media_available_clusters) { - + if (i == 4) { status += fx_file_close(&my_file4); status += fx_file_delete(&ram_disk, "TEST2.TXT"); } - + /* Write to the writable file. */ status += fx_file_write(&my_file2, my_buffer, 128); - + /* Read the data in the file from the other 2 file handles. */ status += fx_file_read(&my_file1, my_buffer, 128, &actual1); status += fx_file_read(&my_file, my_buffer, 128, &actual2); - + /* Check the status. */ if (status) break; i++; } - + /* Close the files and the media. */ status += fx_file_close(&my_file); status += fx_file_close(&my_file1); @@ -842,23 +842,23 @@ ULONG i, j; test_control_return(40); } - /* Test the update of files open for reading while the write is happening with multiple sectors per cluster. */ + /* Test the update of files open for reading while the write is happening with multiple sectors per cluster. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 6000, // Total sectors - FAT16 - 128, // Sector size + 128, // Sector size 2, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -889,29 +889,29 @@ ULONG i, j; status += fx_file_open(&ram_disk, &my_file2, "TEST.TXT", FX_OPEN_FOR_WRITE); status += fx_file_open(&ram_disk, &my_file3, "TEST1.TXT", FX_OPEN_FOR_WRITE); status += fx_file_open(&ram_disk, &my_file4, "TEST2.TXT", FX_OPEN_FOR_WRITE); - status += fx_file_write(&my_file4, my_buffer, 128); - + status += fx_file_write(&my_file4, my_buffer, 128); + /* Now loop through the maximum of clusters to fill and read the file. */ i = 0; while (ram_disk.fx_media_available_clusters) { - + if (i == 4) { status += fx_file_close(&my_file4); status += fx_file_delete(&ram_disk, "TEST2.TXT"); } - + /* Write to the writable file. */ status += fx_file_write(&my_file2, my_buffer, 128); status += fx_file_write(&my_file2, my_buffer, 128); - + /* Read the data in the file from the other 2 file handles. */ status += fx_file_read(&my_file1, my_buffer, 128, &actual1); status += fx_file_read(&my_file, my_buffer, 128, &actual2); status += fx_file_read(&my_file1, my_buffer, 128, &actual1); status += fx_file_read(&my_file, my_buffer, 128, &actual2); - + /* Check the status. */ if (status) break; @@ -929,18 +929,18 @@ ULONG i, j; /* Now force a wrap of the FAT search. */ ram_disk.fx_media_available_clusters++; - + status = fx_file_write(&my_file2, my_buffer, 128); - + /* Did we get an error? */ if (status != FX_NO_MORE_SPACE) { - + /* Error, return error code. */ printf("ERROR!\n"); - test_control_return(44); + test_control_return(44); } - + /* Close the files and the media. */ status = fx_file_close(&my_file); status += fx_file_close(&my_file1); @@ -956,23 +956,23 @@ ULONG i, j; test_control_return(43); } - /* Test the update of files open for reading while the write is happening - with random errors! */ + /* Test the update of files open for reading while the write is happening - with random errors! */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 6000, // Total sectors - FAT16 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -1000,17 +1000,17 @@ ULONG i, j; fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_READ); fx_file_open(&ram_disk, &my_file1, "TEST.TXT", FX_OPEN_FOR_READ); fx_file_open(&ram_disk, &my_file2, "TEST.TXT", FX_OPEN_FOR_WRITE); - fx_file_open(&ram_disk, &my_file3, "TEST1.TXT", FX_OPEN_FOR_WRITE); - + fx_file_open(&ram_disk, &my_file3, "TEST1.TXT", FX_OPEN_FOR_WRITE); + /* Now loop through the maximum of clusters to fill and read the file. */ i = 0; while (ram_disk.fx_media_available_clusters) { - + /* Flush the media. */ fx_media_flush(&ram_disk); _fx_utility_logical_sector_flush(&ram_disk, 1, 60000, FX_TRUE); - + /* Setup the random I/O Error. */ _fx_ram_driver_io_error_request = (rand() & 4); if (_fx_ram_driver_io_error_request == 0) @@ -1019,7 +1019,7 @@ ULONG i, j; _fx_utility_fat_entry_read_error_request = _fx_ram_driver_io_error_request; _fx_utility_logical_sector_write_error_request = _fx_ram_driver_io_error_request; _fx_utility_logical_sector_read_error_request = _fx_ram_driver_io_error_request; - + /* Write to the writable file. */ if (i & 1) { @@ -1030,7 +1030,7 @@ ULONG i, j; fx_file_write(&my_file2, my_buffer, 32); fx_file_write(&my_file2, my_buffer, 32); fx_file_write(&my_file2, my_buffer, 32); - fx_file_write(&my_file2, my_buffer, 32); + fx_file_write(&my_file2, my_buffer, 32); } /* Setup the random I/O Error. */ @@ -1041,7 +1041,7 @@ ULONG i, j; _fx_utility_fat_entry_read_error_request = _fx_ram_driver_io_error_request; _fx_utility_logical_sector_write_error_request = _fx_ram_driver_io_error_request; _fx_utility_logical_sector_read_error_request = _fx_ram_driver_io_error_request; - + /* Read the data in the file from the other 2 file handles. */ if (i & 1) { @@ -1052,7 +1052,7 @@ ULONG i, j; fx_file_read(&my_file1, my_buffer, 32, &actual1); fx_file_read(&my_file1, my_buffer, 32, &actual1); fx_file_read(&my_file1, my_buffer, 32, &actual1); - fx_file_read(&my_file1, my_buffer, 32, &actual1); + fx_file_read(&my_file1, my_buffer, 32, &actual1); } /* Setup the random I/O Error. */ @@ -1074,7 +1074,7 @@ ULONG i, j; i++; } - + /* Close the files and the media. */ fx_file_close(&my_file); fx_file_close(&my_file1); @@ -1082,24 +1082,24 @@ ULONG i, j; fx_media_close(&ram_disk); - /* Test the write of partial cluster and direct I/O over non-contigous clusters. */ + /* Test the write of partial cluster and direct I/O over non-contigous clusters. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 6000, // Total sectors - FAT16 - 128, // Sector size + 128, // Sector size 3, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -1126,19 +1126,19 @@ ULONG i, j; status += fx_file_create(&ram_disk, "TEST1.TXT"); status += fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); status += fx_file_open(&ram_disk, &my_file4,"TEST1.TXT", FX_OPEN_FOR_WRITE); - + /* Write a small amount of data first to cause an unalignment and partial sector write. */ status += fx_file_write(&my_file, my_buffer, 32); status += fx_file_write(&my_file4, my_buffer, 32); status += fx_file_write(&my_file, my_buffer, 128*4); - status += fx_file_write(&my_file, my_buffer, 128*4); - + status += fx_file_write(&my_file, my_buffer, 128*4); + /* Now loop through the maximum of clusters to fill up the rest of the FAT table. */ i = 0; while (ram_disk.fx_media_available_clusters) { - - + + /* Write to the writable file. */ status += fx_file_write(&my_file, my_buffer, 32); status += fx_file_write(&my_file4, my_buffer, 32); @@ -1160,26 +1160,26 @@ ULONG i, j; { /* Read chunks of the file. */ status = fx_file_read(&my_file, my_buffer, 128*4, &actual); - + } while (status != FX_END_OF_FILE); - + /* Now delete the second file to leave holes in the FAT table. */ status += fx_file_close(&my_file4); status += fx_file_delete(&ram_disk, "TEST1.TXT"); - /* Finally, perform a direct write with that can't be done with contigous clusters. */ + /* Finally, perform a direct write with that can't be done with contigous clusters. */ status = fx_file_write(&my_file, my_buffer, 128*4); - + /* Did we get an error? */ if (status != FX_SUCCESS) { - + /* Error, return error code. */ printf("ERROR!\n"); - test_control_return(49); + test_control_return(49); } - + /* Close the files and the media. */ status = fx_file_close(&my_file); status += fx_media_close(&ram_disk); @@ -1194,23 +1194,23 @@ ULONG i, j; } - /* Test the write of partial cluster and direct I/O when the FAT chain is broken. */ + /* Test the write of partial cluster and direct I/O when the FAT chain is broken. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 14000, // Total sectors - FAT16 - 128, // Sector size + 128, // Sector size 2, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -1235,12 +1235,12 @@ ULONG i, j; /* Create a file called TEST.TXT in the root directory. */ status = fx_file_create(&ram_disk, "TEST.TXT"); status += fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); - + /* Write a data first to build a FAT chain. */ status += fx_file_write(&my_file, my_buffer, 128*4); status += fx_file_write(&my_file, my_buffer, 128*4); status += fx_file_write(&my_file, my_buffer, 128*4); - status += fx_file_write(&my_file, my_buffer, 128*4); + status += fx_file_write(&my_file, my_buffer, 128*4); status += fx_file_seek(&my_file, 0); status += fx_media_flush(&ram_disk); _fx_utility_FAT_flush(&ram_disk); @@ -1250,9 +1250,9 @@ ULONG i, j; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_cluster = 0; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_value = 0; } - + /* Read the first FAT sector. */ - status += fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); + status += fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); /* Add a FAT entry randomly in the FAT table. */ fat_buffer[6] = 1; @@ -1274,7 +1274,7 @@ ULONG i, j; /* Now attempt to write a partial sector. */ status = fx_file_write(&my_file, my_buffer, 128*4); - + /* See if we get the file corrupt error. */ if (status != FX_FILE_CORRUPT) { @@ -1283,7 +1283,7 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(54); } - + status = fx_file_write(&my_file, my_buffer, 128*4); status += fx_file_write(&my_file, my_buffer, 128*4); @@ -1295,8 +1295,8 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(55); } - - + + /* Close the files and the media. */ status = fx_file_close(&my_file); status += fx_media_close(&ram_disk); @@ -1310,23 +1310,23 @@ ULONG i, j; test_control_return(56); } - /* Test the maximum write size. */ + /* Test the maximum write size. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 1000, // Total sectors - FAT12 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -1351,7 +1351,7 @@ ULONG i, j; /* Create a file called TEST.TXT in the root directory. */ status = fx_file_create(&ram_disk, "TEST.TXT"); status += fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); - + /* Write a data first to build a FAT chain. */ status += fx_file_write(&my_file, my_buffer, 128); @@ -1364,7 +1364,7 @@ ULONG i, j; test_control_return(59); } - /* Now manually setup the file offset to force an error. */ + /* Now manually setup the file offset to force an error. */ temp = (ULONG)my_file.fx_file_current_file_offset; my_file.fx_file_current_file_offset = 0xFFFFFFF0; @@ -1383,10 +1383,10 @@ ULONG i, j; /* Also save, adjust the current available so that one new cluster will be written. */ my_file.fx_file_current_available_size = 0xFFFFFFF0; temp1 = (ULONG)my_file.fx_file_current_available_size; - + /* Now attempt to write a massive file to exercise the maximum available file size logic. */ status = fx_file_write(&my_file, my_buffer, 1); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -1395,15 +1395,15 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(61); } - + /* Now restore the original offset. */ my_file.fx_file_current_file_offset = temp; my_file.fx_file_current_available_size = temp1; - + /* Close the file. */ status = fx_file_close(&my_file); status += fx_media_close(&ram_disk); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -1414,23 +1414,23 @@ ULONG i, j; } - /* Test the remaining I/O error paths in file write. */ + /* Test the remaining I/O error paths in file write. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 1000, // Total sectors - FAT12 - 128, // Sector size + 128, // Sector size 3, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -1455,7 +1455,7 @@ ULONG i, j; /* Create a file called TEST.TXT in the root directory. */ status = fx_file_create(&ram_disk, "TEST.TXT"); status += fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -1478,11 +1478,11 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(66); } - + /* Close the file. */ status = fx_file_close(&my_file); status += fx_media_close(&ram_disk); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -1491,22 +1491,22 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(67); } - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 1000, // Total sectors - FAT12 - 128, // Sector size + 128, // Sector size 3, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -1531,7 +1531,7 @@ ULONG i, j; /* Create a file called TEST.TXT in the root directory. */ status = fx_file_create(&ram_disk, "TEST.TXT"); status += fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -1554,11 +1554,11 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(71); } - + /* Close the file. */ status = fx_file_close(&my_file); status += fx_media_close(&ram_disk); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -1568,22 +1568,22 @@ ULONG i, j; test_control_return(72); } - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 1000, // Total sectors - FAT12 - 128, // Sector size + 128, // Sector size 3, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -1609,7 +1609,7 @@ ULONG i, j; status = fx_file_create(&ram_disk, "TEST.TXT"); status += fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); status += fx_file_write(&my_file, my_buffer, 128*4); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -1632,11 +1632,11 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(76); } - + /* Close the file. */ status = fx_file_close(&my_file); status += fx_media_close(&ram_disk); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -1647,20 +1647,20 @@ ULONG i, j; } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 1000, // Total sectors - FAT12 - 128, // Sector size + 128, // Sector size 3, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -1686,7 +1686,7 @@ ULONG i, j; status = fx_file_create(&ram_disk, "TEST.TXT"); status += fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); status += fx_file_write(&my_file, my_buffer, 128+64); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -1707,11 +1707,11 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(81); } - + /* Close the file. */ status = fx_file_close(&my_file); status += fx_media_close(&ram_disk); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -1719,25 +1719,25 @@ ULONG i, j; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(82); - } + } - /* Test the read of partial cluster and direct I/O when the FAT chain is broken. */ + /* Test the read of partial cluster and direct I/O when the FAT chain is broken. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 14000, // Total sectors - FAT16 - 128, // Sector size + 128, // Sector size 2, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -1762,12 +1762,12 @@ ULONG i, j; /* Create a file called TEST.TXT in the root directory. */ status = fx_file_create(&ram_disk, "TEST.TXT"); status += fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); - + /* Write a data first to build a FAT chain. */ status += fx_file_write(&my_file, my_buffer, 128*4); status += fx_file_write(&my_file, my_buffer, 128*4); status += fx_file_write(&my_file, my_buffer, 128*4); - status += fx_file_write(&my_file, my_buffer, 128*4); + status += fx_file_write(&my_file, my_buffer, 128*4); status += fx_file_seek(&my_file, 0); status += fx_media_flush(&ram_disk); _fx_utility_FAT_flush(&ram_disk); @@ -1777,9 +1777,9 @@ ULONG i, j; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_cluster = 0; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_value = 0; } - + /* Read the first FAT sector. */ - status += fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); + status += fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); /* Add a FAT entry randomly in the FAT table. */ fat_buffer[6] = 1; @@ -1810,28 +1810,28 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(86); } - + /* Close everything down. */ fx_file_close(&my_file); - fx_media_abort(&ram_disk); + fx_media_abort(&ram_disk); - /* Test the read of partial cluster and direct I/O when the FAT chain is broken - at the beginning of the FAT chain! */ + /* Test the read of partial cluster and direct I/O when the FAT chain is broken - at the beginning of the FAT chain! */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 14000, // Total sectors - FAT16 - 128, // Sector size + 128, // Sector size 2, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -1856,12 +1856,12 @@ ULONG i, j; /* Create a file called TEST.TXT in the root directory. */ status = fx_file_create(&ram_disk, "TEST.TXT"); status += fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); - + /* Write a data first to build a FAT chain. */ status += fx_file_write(&my_file, my_buffer, 128*4); status += fx_file_write(&my_file, my_buffer, 128*4); status += fx_file_write(&my_file, my_buffer, 128*4); - status += fx_file_write(&my_file, my_buffer, 128*4); + status += fx_file_write(&my_file, my_buffer, 128*4); status += fx_file_seek(&my_file, 0); status += fx_media_flush(&ram_disk); _fx_utility_FAT_flush(&ram_disk); @@ -1871,9 +1871,9 @@ ULONG i, j; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_cluster = 0; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_value = 0; } - + /* Read the first FAT sector. */ - status += fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); + status += fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); /* Add a FAT entry randomly in the FAT table. */ fat_buffer[4] = 1; @@ -1906,29 +1906,29 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(90); } - + /* Close everything down. */ fx_file_close(&my_file); - fx_media_abort(&ram_disk); + fx_media_abort(&ram_disk); - /* Test the read of partial cluster and direct I/O when the FAT chain is broken - at the beginning of the FAT chain and with FFs instead of 1! */ + /* Test the read of partial cluster and direct I/O when the FAT chain is broken - at the beginning of the FAT chain and with FFs instead of 1! */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 14000, // Total sectors - FAT16 - 128, // Sector size + 128, // Sector size 2, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -1953,12 +1953,12 @@ ULONG i, j; /* Create a file called TEST.TXT in the root directory. */ status = fx_file_create(&ram_disk, "TEST.TXT"); status += fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); - + /* Write a data first to build a FAT chain. */ status += fx_file_write(&my_file, my_buffer, 128*4); status += fx_file_write(&my_file, my_buffer, 128*4); status += fx_file_write(&my_file, my_buffer, 128*4); - status += fx_file_write(&my_file, my_buffer, 128*4); + status += fx_file_write(&my_file, my_buffer, 128*4); status += fx_file_seek(&my_file, 0); status += fx_media_flush(&ram_disk); _fx_utility_FAT_flush(&ram_disk); @@ -1968,9 +1968,9 @@ ULONG i, j; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_cluster = 0; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_value = 0; } - + /* Read the first FAT sector. */ - status += fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); + status += fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); /* Add a FAT entry randomly in the FAT table. */ fat_buffer[4] = 0xFF; @@ -2003,29 +2003,29 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(94); } - + /* Close everything down. */ fx_file_close(&my_file); - fx_media_abort(&ram_disk); + fx_media_abort(&ram_disk); - /* Test the read with I/O FAT read error. */ + /* Test the read with I/O FAT read error. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 14000, // Total sectors - FAT16 - 128, // Sector size + 128, // Sector size 2, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -2050,12 +2050,12 @@ ULONG i, j; /* Create a file called TEST.TXT in the root directory. */ status = fx_file_create(&ram_disk, "TEST.TXT"); status += fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); - + /* Write a data first to build a FAT chain. */ status += fx_file_write(&my_file, my_buffer, 128*4); status += fx_file_write(&my_file, my_buffer, 128*4); status += fx_file_write(&my_file, my_buffer, 128*4); - status += fx_file_write(&my_file, my_buffer, 128*4); + status += fx_file_write(&my_file, my_buffer, 128*4); status += fx_file_seek(&my_file, 0); status += fx_media_flush(&ram_disk); _fx_utility_FAT_flush(&ram_disk); @@ -2065,7 +2065,7 @@ ULONG i, j; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_cluster = 0; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_value = 0; } - + /* Read the file to get the file IO error. */ _fx_utility_fat_entry_read_error_request = 1; status = fx_file_read(&my_file, my_buffer, 128*4, &actual); @@ -2079,29 +2079,29 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(97); } - + /* Close everything down. */ fx_file_close(&my_file); - fx_media_abort(&ram_disk); + fx_media_abort(&ram_disk); - /* Test the read with I/O logical sector read error. */ + /* Test the read with I/O logical sector read error. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 14000, // Total sectors - FAT16 - 128, // Sector size + 128, // Sector size 2, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -2126,12 +2126,12 @@ ULONG i, j; /* Create a file called TEST.TXT in the root directory. */ status = fx_file_create(&ram_disk, "TEST.TXT"); status += fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); - + /* Write a data first to build a FAT chain. */ status += fx_file_write(&my_file, my_buffer, 128*4); status += fx_file_write(&my_file, my_buffer, 128*4); status += fx_file_write(&my_file, my_buffer, 128*4); - status += fx_file_write(&my_file, my_buffer, 128*4); + status += fx_file_write(&my_file, my_buffer, 128*4); status += fx_file_seek(&my_file, 0); status += fx_media_flush(&ram_disk); _fx_utility_FAT_flush(&ram_disk); @@ -2141,7 +2141,7 @@ ULONG i, j; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_cluster = 0; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_value = 0; } - + /* Read the file to get the file IO error. */ _fx_ram_driver_io_error_request = 2; status = fx_file_read(&my_file, my_buffer, 128*4, &actual); @@ -2155,29 +2155,29 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(97); } - + /* Close everything down. */ fx_file_close(&my_file); - fx_media_abort(&ram_disk); + fx_media_abort(&ram_disk); - /* Test the file open with I/O read errors when walking the FAT chain. */ + /* Test the file open with I/O read errors when walking the FAT chain. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 7000, // Total sectors - FAT16 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -2204,15 +2204,15 @@ ULONG i, j; status += fx_file_create(&ram_disk, "TEST1.TXT"); status += fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); status += fx_file_open(&ram_disk, &my_file1, "TEST1.TXT", FX_OPEN_FOR_WRITE); - + /* Write a data first to build a FAT chain. */ status += fx_file_write(&my_file, my_buffer, 128*4); status += fx_file_write(&my_file, my_buffer, 128*4); status += fx_file_write(&my_file, my_buffer, 128*4); - status += fx_file_write(&my_file, my_buffer, 128*4); - status += fx_file_write(&my_file1, my_buffer, 128*4); - status += fx_file_write(&my_file, my_buffer, 128*4); - + status += fx_file_write(&my_file, my_buffer, 128*4); + status += fx_file_write(&my_file1, my_buffer, 128*4); + status += fx_file_write(&my_file, my_buffer, 128*4); + /* Close the file. */ status += fx_file_close(&my_file); status += fx_file_close(&my_file1); @@ -2235,13 +2235,13 @@ ULONG i, j; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_cluster = 0; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_value = 0; } - - + + /* Now open the file with an I/O error on the FAT entry read when walking the FAT chain. */ _fx_utility_fat_entry_read_error_request = 1; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); _fx_utility_fat_entry_read_error_request = 0; - + /* See if we got the I/O Error. */ if (status != FX_IO_ERROR) { @@ -2250,7 +2250,7 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(101); } - + /* Now break the FAT chain and try to open the file. */ /* Now flush everything out. */ @@ -2264,7 +2264,7 @@ ULONG i, j; } /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); + status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); /* Add a FAT entry randomly in the FAT table. */ fat_buffer[4] = 2; @@ -2283,7 +2283,7 @@ ULONG i, j; /* Now open the file with a corrupted FAT entry which will cause an error when walking the FAT chain. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); - + /* See if we got the FAT chain. */ if (status != FX_FAT_READ_ERROR) { @@ -2304,7 +2304,7 @@ ULONG i, j; } /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); + status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); /* Add a FAT entry randomly in the FAT table. */ fat_buffer[4] = 0xF0; @@ -2321,10 +2321,10 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(104); } - + /* Now open the file with a corrupted FAT entry which will cause an error when walking the FAT chain. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); - + /* See if we got the file corrupt error. */ if (status != FX_FILE_CORRUPT) { @@ -2345,7 +2345,7 @@ ULONG i, j; } /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); + status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); /* Fix the FAT chain. */ fat_buffer[4] = 3; @@ -2368,7 +2368,7 @@ ULONG i, j; ram_disk.fx_media_total_clusters = 4; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); ram_disk.fx_media_total_clusters = temp; - + /* Check status. */ if (status != FX_FAT_READ_ERROR) { @@ -2380,7 +2380,7 @@ ULONG i, j; /* Now open the file with a good FAT chain. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); - + /* Check status. */ if (status != FX_SUCCESS) { @@ -2389,11 +2389,11 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(108); } - + /* Now allocate another cluster to the end of the file. */ status = fx_file_allocate(&my_file, 256); status += fx_file_close(&my_file); - + /* Check status. */ if (status != FX_SUCCESS) { @@ -2402,10 +2402,10 @@ ULONG i, j; printf("ERROR!\n"); test_control_return(109); } - + /* Now open the file again with an extra cluster at the end of the file... */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); - + /* Check status. */ if (status != FX_SUCCESS) { @@ -2413,11 +2413,11 @@ ULONG i, j; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(110); - } - + } + /* Close the file again. */ fx_file_close(&my_file); - + /* Now flush everything out. */ fx_media_flush(&ram_disk); _fx_utility_FAT_flush(&ram_disk); @@ -2429,7 +2429,7 @@ ULONG i, j; } /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); + status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); /* Fix the FAT chain. */ fat_buffer[4] = 0; @@ -2449,7 +2449,7 @@ ULONG i, j; /* Now open the file again with an invalid last cluster at the end of the file... */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); - + /* Check status. */ if (status != FX_FILE_CORRUPT) { @@ -2457,7 +2457,7 @@ ULONG i, j; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(112); - } + } /* Now flush everything out. */ fx_media_flush(&ram_disk); @@ -2470,7 +2470,7 @@ ULONG i, j; } /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); + status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); /* Fix the FAT chain. */ fat_buffer[4] = 3; @@ -2483,7 +2483,7 @@ ULONG i, j; /* Now open the file again with an invalid last cluster at the end of the file... */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); - + /* Check status. */ if (status != FX_FILE_CORRUPT) { @@ -2491,7 +2491,7 @@ ULONG i, j; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(113); - } + } /* Now flush everything out. */ fx_media_flush(&ram_disk); @@ -2504,7 +2504,7 @@ ULONG i, j; } /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); + status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); /* Fix the FAT chain. */ fat_buffer[0x32] = 0xff; @@ -2517,7 +2517,7 @@ ULONG i, j; status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); status += fx_file_write(&my_file, buffer, 128*3); status += fx_file_seek(&my_file, 0); - + /* Set the flag to cause the cache update to bypass. */ _fx_utility_logical_sector_read_1_error_request = 1; status += fx_file_read(&my_file, buffer, 128*3, &actual); @@ -2527,13 +2527,13 @@ ULONG i, j; _fx_utility_logical_sector_read_1_error_request = 1000000; status += fx_file_read(&my_file, buffer, 128*3, &actual); _fx_utility_logical_sector_read_1_error_request = 0; - + #ifndef FX_ENABLE_FAULT_TOLERANT /* Call the logical sector flush with a large error value to get that path taken as well. */ _fx_utility_logical_sector_flush_error_request = 1000000; status += _fx_utility_logical_sector_flush(&ram_disk, 0, 60000, FX_FALSE); _fx_utility_logical_sector_flush_error_request = 0; - + /* Check status. */ if (status != FX_SUCCESS) { @@ -2541,28 +2541,28 @@ ULONG i, j; /* Error, return error code. */ printf("ERROR!\n"); test_control_return(116); - } + } #endif /* Close everything down. */ fx_file_close(&my_file); - fx_media_abort(&ram_disk); + fx_media_abort(&ram_disk); /* FAT32. */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70000, // Total sectors - FAT16 - 512, // Sector size + 512, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); status += fx_file_create(&ram_disk, "TEST.TXT"); return_if_fail(FX_SUCCESS == status); diff --git a/test/regression_test/filex_file_rename_test.c b/test/regression_test/filex_file_rename_test.c index 8d15922..39ffa99 100644 --- a/test/regression_test/filex_file_rename_test.c +++ b/test/regression_test/filex_file_rename_test.c @@ -32,10 +32,10 @@ static FX_FILE my_file; #ifndef FX_STANDALONE_ENABLE static UCHAR *ram_disk_memory; static UCHAR *cache_buffer; -static UCHAR *fault_tolerant_buffer; +static UCHAR *fault_tolerant_buffer; #else static UCHAR cache_buffer[CACHE_SIZE]; -static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; +static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; #endif @@ -61,13 +61,13 @@ void filex_file_rename_application_define(void *first_unused_memory) #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -107,33 +107,33 @@ UINT i; printf("FileX Test: File rename test......................................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors -/* Allocated a larger disk to enable fault tolerant feature. */ +/* Allocated a larger disk to enable fault tolerant feature. */ #ifdef FX_ENABLE_FAULT_TOLERANT - 512 * 8, // Total sectors - 256, // Sector size + 512 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster #else - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster #endif 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* try to rename a file to something invalid */ status = fx_file_rename(&ram_disk, "MYTEST", ""); return_if_fail( status == FX_INVALID_NAME); - + /* try to rename a file before the media is opened */ status = fx_file_rename(&ram_disk, "MYTEST", "OURTEST"); return_if_fail( status == FX_MEDIA_NOT_OPEN); @@ -141,7 +141,7 @@ UINT i; /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); - + #ifdef FX_ENABLE_FAULT_TOLERANT /* Enable fault tolerant if FX_ENABLE_FAULT_TOLERANT is defined. */ status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_buffer, FAULT_TOLERANT_SIZE); @@ -153,11 +153,11 @@ UINT i; status = fx_file_rename(&ram_disk, "MYTEST", "OURTEST"); ram_disk.fx_media_driver_write_protect = FX_FALSE; return_if_fail( status == FX_WRITE_PROTECT); - + /* try to rename a file that cant be found */ status = fx_file_rename(&ram_disk, "MYTEST", "OURTEST"); return_if_fail( status != FX_SUCCESS); - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING @@ -171,12 +171,12 @@ UINT i; status = fx_file_create(&ram_disk, "MYTEST"); status += fx_file_rename(&ram_disk, "MYTEST", "OURTEST"); return_if_fail( status == FX_SUCCESS); - + /* rename the files to lower case and upper case versions of themselves */ status = fx_file_rename(&ram_disk, "OURTEST", "ourtest"); status += fx_file_rename(&ram_disk, "ourtest", "OURTEST"); return_if_fail( status == FX_SUCCESS); - + /* try to rename a file into a subdirectory that does not exist */ status = fx_file_rename(&ram_disk, "OURTEST", "DOES_NOT_EXITS/OURTEST"); return_if_fail( status == FX_INVALID_NAME); @@ -185,11 +185,11 @@ UINT i; status = fx_directory_create(&ram_disk, "/subdir1"); status += fx_directory_create(&ram_disk, "/subdir2"); return_if_fail( status == FX_SUCCESS); - + /* try to rename a file to something that already exists */ status = fx_file_rename(&ram_disk, "OURTEST", "subdir1"); return_if_fail( status == FX_ALREADY_CREATED); - + #ifndef FX_DONT_UPDATE_OPEN_FILES /* rename a file while it is open and while another is opened to get code coverage */ @@ -207,9 +207,9 @@ UINT i; status += fx_file_rename(&ram_disk, "/subdir1/NEWOURTEST", "/subdir2/OURTEST"); status += fx_file_rename(&ram_disk, "/subdir2/OURTEST", "OURTEST"); status += fx_file_rename(&ram_disk, "OURTEST", ".OURTEST"); - status += fx_file_delete(&ram_disk, ".OURTEST"); + status += fx_file_delete(&ram_disk, ".OURTEST"); return_if_fail( status == FX_SUCCESS); - + /* try to rename a file that isnt a file */ status = fx_file_rename(&ram_disk, "subdir1", "OURTEST"); return_if_fail( status == FX_NOT_A_FILE); @@ -219,20 +219,20 @@ UINT i; return_if_fail( status == FX_SUCCESS); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 128, // Directory Entries 0, // Hidden sectors - 6000, // Total sectors - 128, // Sector size + 6000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); /* Open the ram_disk. */ @@ -245,7 +245,7 @@ UINT i; long_name1[i] = 'a'; long_name2[i] = 'a'; } - + /* Put NULL and special character at the end of the file. */ long_name1[i] = 0; long_name1[i-1] = 0; @@ -253,7 +253,7 @@ UINT i; long_name2[i] = 0; long_name2[i-1] = 0; long_name2[i-2] = '~'; - + /* Create a super short file name. */ status = fx_file_create(&ram_disk, "sname"); status += fx_file_create(&ram_disk, long_name1); @@ -262,7 +262,7 @@ UINT i; /* Attempt to change the short name with leading spaces. */ status = fx_file_rename(&ram_disk, "sname", " name"); return_if_fail( status == FX_SUCCESS); - + /* Now attempt to change the short name with middle spaces. */ status = fx_file_rename(&ram_disk, "name", "\\new name"); return_if_fail( status == FX_SUCCESS); @@ -276,7 +276,7 @@ UINT i; long_name2[FX_MAX_LONG_NAME_LEN-1] = 0; /* Change the name of the second long file name. */ - long_name2[FX_MAX_LONG_NAME_LEN-3] = 'a'; + long_name2[FX_MAX_LONG_NAME_LEN-3] = 'a'; status = fx_file_rename(&ram_disk, long_name1, long_name2); return_if_fail( status == FX_SUCCESS); @@ -291,7 +291,7 @@ UINT i; /* Close the file. */ fx_file_close(&my_file); - + /* Now test the directory free search logic when there are no more entries. */ /* First, fill up the root directory. */ @@ -329,13 +329,13 @@ UINT i; status += fx_file_create(&ram_disk, "aaaaaaaaaaaaa1031"); status += fx_file_create(&ram_disk, "aaaaaaaaaaaaa1032"); status += fx_file_create(&ram_disk, "aaaaaaaaaaaaa1033"); - - /* Now attempt to rename the long file again. */ + + /* Now attempt to rename the long file again. */ status += fx_file_rename(&ram_disk, long_name2, long_name1); - /* Check status - this should fail because we do not have enough room in the root directory. */ + /* Check status - this should fail because we do not have enough room in the root directory. */ return_if_fail( status == FX_NO_MORE_SPACE); - + /* Now test I/O error on directory entry write inside of the rename processing. */ fx_media_flush(&ram_disk); _fx_utility_logical_sector_flush(&ram_disk, 1, 60000, FX_TRUE); @@ -343,11 +343,11 @@ UINT i; status = fx_file_rename(&ram_disk, "new name", "sname"); _fx_utility_logical_sector_write_error_request = 0; return_if_fail( status == FX_IO_ERROR); - + /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); - + printf("SUCCESS!\n"); test_control_return(0); } diff --git a/test/regression_test/filex_file_seek_test.c b/test/regression_test/filex_file_seek_test.c index 7543a1e..f09ecae 100644 --- a/test/regression_test/filex_file_seek_test.c +++ b/test/regression_test/filex_file_seek_test.c @@ -52,13 +52,13 @@ void filex_file_seek_application_define(void *first_unused_memory) #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -97,20 +97,20 @@ ULONG i; printf("FileX Test: File seek test........................................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -119,7 +119,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(2); } - + /* Attempt to seek before the media is opened to generate an error */ status = fx_file_extended_seek(&my_file, 0); if (status != FX_NOT_OPEN) @@ -127,7 +127,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(2); } - + /* Attempt to seek before the media is opened to generate an error */ status = fx_file_extended_relative_seek(&my_file, 0, 0); if (status != FX_NOT_OPEN) @@ -169,7 +169,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(6); } - + /* Attempt to seek before the media is opened to generate an error */ status = fx_file_extended_relative_seek(&my_file, 0xFFFFFFFFFFFFFFFF, FX_SEEK_BACK); if (status != FX_SUCCESS) @@ -177,7 +177,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(7); } - + /* test error checking */ #ifndef FX_DISABLE_ERROR_CHECKING /* send null pointer to generate an error */ @@ -187,7 +187,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(8); } - + /* send an invalid option to generate an error */ status = fx_file_relative_seek(&my_file, 0xFFFFFFFF, 4); if (status != FX_INVALID_OPTION) @@ -195,7 +195,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(9); } - + /* send null pointer to generate an error */ status = fx_file_extended_seek(FX_NULL, 0xFF); if (status != FX_PTR_ERROR) @@ -203,7 +203,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(10); } - + /* send null pointer to generate an error */ status = fx_file_extended_relative_seek(FX_NULL, 0xFF, FX_SEEK_BEGIN); if (status != FX_PTR_ERROR) @@ -211,7 +211,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(11); } - + /* send null pointer to generate an error */ status = fx_file_extended_relative_seek(&my_file, 0xFF, 4); if (status != FX_INVALID_OPTION) @@ -219,12 +219,12 @@ ULONG i; printf("ERROR!\n"); test_control_return(12); } - + #endif /* FX_DISABLE_ERROR_CHECKING */ /* Pickup the available bytes in the media. */ status = fx_media_space_available(&ram_disk, &available_bytes); - + /* Check for available bytes error. */ if ((status != FX_SUCCESS) || (available_bytes < sizeof(ULONG))) { @@ -238,7 +238,7 @@ ULONG i; write_value = 0; while (i < available_bytes) { - + /* Write 4 bytes to the file. */ status = fx_file_write(&my_file, (void *) &write_value, sizeof(ULONG)); @@ -249,17 +249,17 @@ ULONG i; printf("ERROR!\n"); test_control_return(14); } - + /* Increment byte count. */ i = i + sizeof(ULONG); - + /* Increment write value. */ write_value++; } - + /* Pickup the available bytes in the media again. */ status = fx_media_space_available(&ram_disk, &i); - + /* Check for available bytes error. */ if ((status != FX_SUCCESS) || (i != 0)) { @@ -267,12 +267,12 @@ ULONG i; printf("ERROR!\n"); test_control_return(15); } - + #ifndef FX_DISABLE_CACHE - /* At this point, we should invalidate the (which also flushes the cache) media to ensure that all + /* At this point, we should invalidate the (which also flushes the cache) media to ensure that all dirty sectors are written. */ status = fx_media_cache_invalidate(&ram_disk); - + /* Check for invalidate errors. */ if ((status != FX_SUCCESS) || (ram_disk.fx_media_sector_cache_dirty_count)) { @@ -280,21 +280,21 @@ ULONG i; printf("ERROR!\n"); test_control_return(16); } - + /* See if any sectors are still valid in the cache. */ for (i = 0; i < FX_MAX_SECTOR_CACHE; i++) { - + /* Determine if this cache entry is still valid. */ if (ram_disk.fx_media_sector_cache[i].fx_cached_sector_valid) { - + printf("ERROR!\n"); test_control_return(17); } } #endif - + /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); @@ -308,61 +308,61 @@ ULONG i; /* Read the 4 bytes at the front of the file... should be 0! */ status = fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); - + /* Determine if it is correct. */ if ((status) || (read_value != 0) || (actual != sizeof(ULONG))) { - + printf("ERROR!\n"); test_control_return(19); } /* Read the next 4 bytes at the front of the file... should be 1! */ status = fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); - + /* Determine if it is correct. */ if ((status) || (read_value != 1) || (actual != sizeof(ULONG))) { - + printf("ERROR!\n"); test_control_return(20); } /* Seek to near the last 4 bytes of the file. */ status = fx_file_seek(&my_file, available_bytes - 4); - + /* Read the last 4 bytes of the file... should be available_bytes/sizeof(ULONG)! */ status += fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); - + /* Determine if it is correct. */ if ((status) || (read_value != (available_bytes/sizeof(ULONG) - 1)) || (actual != sizeof(ULONG))) { - + printf("ERROR!\n"); test_control_return(21); } - + /* Read the past the end of the file... should get an error in this case. */ status = fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); - + /* Determine if it is correct. */ if (status != FX_END_OF_FILE) { - + printf("ERROR!\n"); test_control_return(22); } /* Seek to the middle of the file. */ status = fx_file_seek(&my_file, available_bytes/2); - + /* Read the middle 4 bytes of the file... should be (available_bytes/2)/sizeof(ULONG)! */ status += fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); - + /* Determine if it is correct. */ if ((status) || (read_value != (available_bytes/(2*sizeof(ULONG)))) || (actual != sizeof(ULONG))) { - + printf("ERROR!\n"); test_control_return(23); } @@ -373,7 +373,7 @@ ULONG i; /* Determine if it is correct. */ if (status != FX_SUCCESS) { - + printf("ERROR!\n"); test_control_return(24); } @@ -394,61 +394,61 @@ ULONG i; /* Read the 4 bytes at the front of the file... should be 0! */ status = fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); - + /* Determine if it is correct. */ if ((status) || (read_value != 0) || (actual != sizeof(ULONG))) { - + printf("ERROR!\n"); test_control_return(26); } /* Read the next 4 bytes at the front of the file... should be 1! */ status = fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); - + /* Determine if it is correct. */ if ((status) || (read_value != 1) || (actual != sizeof(ULONG))) { - + printf("ERROR!\n"); test_control_return(27); } /* Seek to near the last 4 bytes of the file. */ status = fx_file_seek(&my_file, available_bytes - 4); - + /* Read the last 4 bytes of the file... should be available_bytes/sizeof(ULONG)! */ status += fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); - + /* Determine if it is correct. */ if ((status) || (read_value != (available_bytes/sizeof(ULONG) - 1)) || (actual != sizeof(ULONG))) { - + printf("ERROR!\n"); test_control_return(28); } - + /* Read the past the end of the file... should get an error in this case. */ status = fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); - + /* Determine if it is correct. */ if (status != FX_END_OF_FILE) { - + printf("ERROR!\n"); test_control_return(29); } /* Seek to the middle of the file. */ status = fx_file_seek(&my_file, available_bytes/2); - + /* Read the middle 4 bytes of the file... should be (available_bytes/2)/sizeof(ULONG)! */ status += fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); - + /* Determine if it is correct. */ if ((status) || (read_value != (available_bytes/(2*sizeof(ULONG)))) || (actual != sizeof(ULONG))) { - + printf("ERROR!\n"); test_control_return(30); } @@ -459,7 +459,7 @@ ULONG i; /* Determine if it is correct. */ if (status != FX_SUCCESS) { - + printf("ERROR!\n"); test_control_return(31); } @@ -477,7 +477,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(32); } - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING /* send null pointer to generate an error */ @@ -492,22 +492,22 @@ ULONG i; /* Read the 4 bytes at the front of the file... should be 0! */ status = fx_file_relative_seek(&my_file, 0, FX_SEEK_BEGIN); status += fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); - + /* Determine if it is correct. */ if ((status) || (read_value != 0) || (actual != sizeof(ULONG))) { - + printf("ERROR!\n"); test_control_return(34); } /* Read the next 4 bytes at the front of the file... should be 1! */ status = fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); - + /* Determine if it is correct. */ if ((status) || (read_value != 1) || (actual != sizeof(ULONG))) { - + printf("ERROR!\n"); test_control_return(35); } @@ -515,25 +515,25 @@ ULONG i; /* Seek to near the last 4 bytes of the file. */ status = fx_file_relative_seek(&my_file, 0xFFFFFFFF, FX_SEEK_BEGIN); status += fx_file_relative_seek(&my_file, 4, FX_SEEK_BACK); - + /* Read the last 4 bytes of the file... should be available_bytes/sizeof(ULONG)! */ status += fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); - + /* Determine if it is correct. */ if ((status) || (read_value != (available_bytes/sizeof(ULONG) - 1)) || (actual != sizeof(ULONG))) { - + printf("ERROR!\n"); test_control_return(36); } - + /* Read the past the end of the file... should get an error in this case. */ status = fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); - + /* Determine if it is correct. */ if (status != FX_END_OF_FILE) { - + printf("ERROR!\n"); test_control_return(37); } @@ -541,25 +541,25 @@ ULONG i; /* Seek to the middle of the file. */ status = fx_file_relative_seek(&my_file, 0xFFFFFFFF, FX_SEEK_END); status += fx_file_relative_seek(&my_file, available_bytes/2, FX_SEEK_FORWARD); - + /* Read the middle 4 bytes of the file... should be (available_bytes/2)/sizeof(ULONG)! */ status += fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); - + /* Determine if it is correct. */ if ((status) || (read_value != (available_bytes/(2*sizeof(ULONG)))) || (actual != sizeof(ULONG))) { - + printf("ERROR!\n"); test_control_return(38); } /* Seek to the end of the file. */ status = fx_file_relative_seek(&my_file, 0, FX_SEEK_END); - + /* Determine if it is correct. */ if (status != FX_SUCCESS) { - + printf("ERROR!\n"); test_control_return(39); } @@ -568,7 +568,7 @@ ULONG i; status += fx_file_close(&my_file); /* Close the media. */ - status += fx_media_close(&ram_disk); + status += fx_media_close(&ram_disk); /* Determine if the test was successful. */ if (status != FX_SUCCESS) @@ -577,24 +577,24 @@ ULONG i; printf("ERROR!\n"); test_control_return(40); } - - /* Test corner cases of extended seek. */ - + + /* Test corner cases of extended seek. */ + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -713,7 +713,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(51); } - + /* Close the file and the media. */ status = fx_file_close(&my_file); status += fx_media_close(&ram_disk); @@ -729,16 +729,16 @@ ULONG i; _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) diff --git a/test/regression_test/filex_file_write_available_cluster_test.c b/test/regression_test/filex_file_write_available_cluster_test.c index 5d302f0..caaa511 100644 --- a/test/regression_test/filex_file_write_available_cluster_test.c +++ b/test/regression_test/filex_file_write_available_cluster_test.c @@ -46,7 +46,7 @@ static UCHAR test_buffer[4096]; #ifdef FX_ENABLE_FAULT_TOLERANT static UCHAR fault_tolerant_buffer[FAULT_TOLERANT_SIZE]; #endif /* FX_ENABLE_FAULT_TOLERANT */ -static struct step steps[] = +static struct step steps[] = { {0, FX_SEEK_FORWARD, 1136}, {4 * sizeof(test_buffer), FX_SEEK_FORWARD, sizeof(test_buffer)}, @@ -76,13 +76,13 @@ void filex_file_write_available_cluster_application_define(void *first_unused #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -130,20 +130,20 @@ ULONG i, j; #endif /* FX_ENABLE_FAULT_TOLERANT */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 512, // Sector size + 512, // Total sectors + 512, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -259,7 +259,7 @@ ULONG i, j; my_file.fx_file_first_physical_cluster = ram_disk.fx_media_fat_reserved; status += fx_file_write( &my_file, test_buffer, steps[0].size); return_if_fail( status == FX_NOT_FOUND); - + /* Restore data we just modified. */ my_file.fx_file_first_physical_cluster = actual; @@ -304,7 +304,7 @@ ULONG i, j; status = fx_file_close(&my_file); status += fx_media_close( &ram_disk); return_if_fail( status == FX_SUCCESS); - + #ifdef FX_ENABLE_FAULT_TOLERANT if ( enable_fault_tolerant_this_time == 0) { @@ -312,7 +312,7 @@ ULONG i, j; goto TEST_START; } #endif - + #if defined(FX_ENABLE_FAULT_TOLERANT) && !defined(FX_DISABLE_CACHE) FX_CACHED_SECTOR cache_entry; diff --git a/test/regression_test/filex_file_write_notify_test.c b/test/regression_test/filex_file_write_notify_test.c index 8f5dd5a..067d893 100644 --- a/test/regression_test/filex_file_write_notify_test.c +++ b/test/regression_test/filex_file_write_notify_test.c @@ -54,13 +54,13 @@ void filex_file_write_notify_application_define(void *first_unused_memory) #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -97,20 +97,20 @@ FX_FILE my_file; printf("FileX Test: File write notify test................................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 512, // Sector size + 512, // Total sectors + 512, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -119,7 +119,7 @@ FX_FILE my_file; printf("ERROR!\n"); test_control_return(1); } - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); diff --git a/test/regression_test/filex_file_write_seek_test.c b/test/regression_test/filex_file_write_seek_test.c index c6c59c8..0590b4a 100644 --- a/test/regression_test/filex_file_write_seek_test.c +++ b/test/regression_test/filex_file_write_seek_test.c @@ -63,13 +63,13 @@ void filex_file_write_seek_application_define(void *first_unused_memory) #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -104,20 +104,20 @@ ULONG i; printf("FileX Test: File write seek test..................................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 512, // Sector size + 512, // Total sectors + 512, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail(FX_SUCCESS == status); @@ -174,20 +174,20 @@ ULONG i; /* For the coverage of fx_file_write.c. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 512, // Sector size + 70000, // Total sectors + 512, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail(FX_SUCCESS == status); @@ -214,20 +214,20 @@ ULONG i; fx_media_close(&ram_disk); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 512, // Sector size + 70000, // Total sectors + 512, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail(FX_SUCCESS == status); @@ -255,20 +255,20 @@ ULONG i; fx_media_close(&ram_disk); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 512, // Sector size + 70000, // Total sectors + 512, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail(FX_SUCCESS == status); @@ -299,20 +299,20 @@ ULONG i; fx_media_close(&ram_disk); /* Format the media by FAT16 which cluster 0 is available. */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 7000, // Total sectors - 512, // Sector size + 7000, // Total sectors + 512, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail(FX_SUCCESS == status); diff --git a/test/regression_test/filex_media_abort_test.c b/test/regression_test/filex_media_abort_test.c index 49d674e..6abe0c7 100644 --- a/test/regression_test/filex_media_abort_test.c +++ b/test/regression_test/filex_media_abort_test.c @@ -60,13 +60,13 @@ void filex_media_abort_application_define(void *first_unused_memory) #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -75,7 +75,7 @@ UCHAR *pointer; cache_buffer = pointer; pointer = pointer + CACHE_SIZE; cache_buffer2 = pointer; - pointer = pointer + CACHE_SIZE; + pointer = pointer + CACHE_SIZE; ram_disk_memory = pointer; pointer = pointer + (256 * 128); ram_disk_memory2 = pointer; @@ -106,20 +106,20 @@ UCHAR local_buffer[32]; printf("FileX Test: Media abort test......................................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -128,7 +128,7 @@ UCHAR local_buffer[32]; printf("ERROR!\n"); test_control_return(2); } - + /* try to abort before the media has been opened */ status = fx_media_abort(&ram_disk); if (status != FX_MEDIA_NOT_OPEN) @@ -230,7 +230,7 @@ UCHAR local_buffer[32]; printf("ERROR!\n"); test_control_return(9); } - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING /* send null pointer to generate an error */ @@ -351,36 +351,36 @@ UCHAR local_buffer[32]; } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track - + 1); // Sectors per track + /* Format the second media. This needs to be done before opening it! */ - status += fx_media_format(&ram_disk2, + status += fx_media_format(&ram_disk2, _fx_ram_driver, // Driver entry ram_disk_memory2, // RAM disk memory pointer cache_buffer2, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -434,50 +434,50 @@ UCHAR local_buffer[32]; printf("ERROR!\n"); test_control_return(15); } - + /* Now abort the media with a file open and with another media instance open. */ status = fx_media_abort(&ram_disk); status += fx_media_abort(&ram_disk2); - + /* Check the media abort status. */ if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(16); - } + } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track - + 1); // Sectors per track + /* Format the second media. This needs to be done before opening it! */ - status += fx_media_format(&ram_disk2, + status += fx_media_format(&ram_disk2, _fx_ram_driver, // Driver entry ram_disk_memory2, // RAM disk memory pointer cache_buffer2, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -514,7 +514,7 @@ UCHAR local_buffer[32]; /* Abort both media pointers. */ status = fx_media_abort(&ram_disk2); status += fx_media_abort(&ram_disk); - + /* Check the status. */ if (status != FX_SUCCESS) { diff --git a/test/regression_test/filex_media_cache_invalidate_test.c b/test/regression_test/filex_media_cache_invalidate_test.c index 6a883c6..c9f0573 100644 --- a/test/regression_test/filex_media_cache_invalidate_test.c +++ b/test/regression_test/filex_media_cache_invalidate_test.c @@ -54,13 +54,13 @@ void filex_media_cache_invalidate_application_define(void *first_unused_memor #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -99,20 +99,20 @@ ULONG i; printf("FileX Test: Media cache invalidate test............................"); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -133,9 +133,9 @@ ULONG i; printf("ERROR!\n"); test_control_return(21); } - + #ifndef FX_DISABLE_ERROR_CHECKING - + /* send a null pointer to generate an error */ status = fx_media_cache_invalidate(FX_NULL); if (status != FX_PTR_ERROR) @@ -169,7 +169,7 @@ ULONG i; /* Pickup the available bytes in the media. */ status = fx_media_space_available(&ram_disk, &available_bytes); - + /* Check for available bytes error. */ if ((status != FX_SUCCESS) || (available_bytes < sizeof(ULONG))) { @@ -183,7 +183,7 @@ ULONG i; write_value = 0; while (i < available_bytes) { - + /* Write 4 bytes to the file. */ status = fx_file_write(&my_file, (void *) &write_value, sizeof(ULONG)); @@ -194,17 +194,17 @@ ULONG i; printf("ERROR!\n"); test_control_return(6); } - + /* Increment byte count. */ i = i + sizeof(ULONG); - + /* Increment write value. */ write_value++; } - + /* Pickup the available bytes in the media again. */ status = fx_media_space_available(&ram_disk, &i); - + /* Check for available bytes error. */ if ((status != FX_SUCCESS) || (i != 0)) { @@ -212,11 +212,11 @@ ULONG i; printf("ERROR!\n"); test_control_return(7); } - - /* At this point, we should invalidate the (which also flushes the cache) media to ensure that all + + /* At this point, we should invalidate the (which also flushes the cache) media to ensure that all dirty sectors are written. */ status = fx_media_cache_invalidate(&ram_disk); - + /* Check for flush errors. */ if ((status != FX_SUCCESS) || (ram_disk.fx_media_sector_cache_dirty_count)) { @@ -224,20 +224,20 @@ ULONG i; printf("ERROR!\n"); test_control_return(8); } - + /* See if any sectors are still valid in the cache. */ for (i = 0; i < FX_MAX_SECTOR_CACHE; i++) { - + /* Determine if this cache entry is still valid. */ if (ram_disk.fx_media_sector_cache[i].fx_cached_sector_valid) { - + printf("ERROR!\n"); test_control_return(81); } } - + /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); @@ -254,7 +254,7 @@ ULONG i; read_value = 0; while (i < available_bytes) { - + /* Read 4 bytes from the file. */ status = fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); @@ -293,20 +293,20 @@ ULONG i; } /* Reformat the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -352,7 +352,7 @@ ULONG i; /* Pickup the available bytes in the media. */ status = fx_media_space_available(&ram_disk, &available_bytes); - + /* Check for available bytes error. */ if ((status != FX_SUCCESS) || (available_bytes < sizeof(ULONG))) { @@ -366,7 +366,7 @@ ULONG i; write_value = 0; while (i < available_bytes) { - + /* Write 4 bytes to the file. */ status = fx_file_write(&my_file, (void *) &write_value, sizeof(ULONG)); @@ -377,17 +377,17 @@ ULONG i; printf("ERROR!\n"); test_control_return(18); } - + /* Increment byte count. */ i = i + sizeof(ULONG); - + /* Increment write value. */ write_value++; } - + /* Pickup the available bytes in the media again. */ status = fx_media_space_available(&ram_disk, &i); - + /* Check for available bytes error. */ if ((status != FX_SUCCESS) || (i != 0)) { @@ -395,11 +395,11 @@ ULONG i; printf("ERROR!\n"); test_control_return(19); } - - /* At this point, we should invalidate the media to ensure that all + + /* At this point, we should invalidate the media to ensure that all dirty sectors are written. */ status = fx_media_cache_invalidate(&ram_disk); - + /* Check for flush errors. */ if ((status != FX_SUCCESS) || (ram_disk.fx_media_sector_cache_dirty_count)) { @@ -411,16 +411,16 @@ ULONG i; /* See if any sectors are still valid in the cache. */ for (i = 0; i < ram_disk.fx_media_sector_cache_size; i++) { - + /* Determine if this cache entry is still valid. */ if (ram_disk.fx_media_sector_cache[i].fx_cached_sector_valid) { - + printf("ERROR!\n"); test_control_return(81); } } - + /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); @@ -437,7 +437,7 @@ ULONG i; read_value = 0; while (i < available_bytes) { - + /* Read 4 bytes from the file. */ status = fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); diff --git a/test/regression_test/filex_media_check_test.c b/test/regression_test/filex_media_check_test.c index 2cc7401..567c1db 100644 --- a/test/regression_test/filex_media_check_test.c +++ b/test/regression_test/filex_media_check_test.c @@ -59,13 +59,13 @@ void filex_media_check_application_define(void *first_unused_memory) #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -105,22 +105,22 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; printf("FileX Test: Media check test......................................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Try to check the media before the media has been opened */ status = fx_media_check(&ram_disk, scratch_memory, SCRATCH_MEMORY_SIZE, 0, &errors_detected); return_if_fail( status == FX_MEDIA_NOT_OPEN); @@ -128,7 +128,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING @@ -146,15 +146,15 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; status = fx_media_close(&ram_disk); status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); - + /* Invalidate the cache. */ status = fx_media_cache_invalidate(&ram_disk); - + /* Read the first FAT sector. */ - status += fx_media_read(&ram_disk, 1, (VOID *) raw_sector_buffer); + status += fx_media_read(&ram_disk, 1, (VOID *) raw_sector_buffer); /* Check the status. */ - return_if_fail((status == FX_SUCCESS) && + return_if_fail((status == FX_SUCCESS) && (raw_sector_buffer[0] == 0xF8) && /* _fx_media_format_media_type value set during media format */ (raw_sector_buffer[1] == 0xFF) && (raw_sector_buffer[2] == 0xFF)); @@ -163,15 +163,15 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; raw_sector_buffer[30] = 2; raw_sector_buffer[31] = 3; raw_sector_buffer[32] = 4; - + /* Write the FAT sector back... with the errors. */ - status = fx_media_write(&ram_disk, 1, (VOID *) raw_sector_buffer); + status = fx_media_write(&ram_disk, 1, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); - + /* Attempt to check the media but give it a bad scratch_memory_size to throw an error */ status = fx_media_check(&ram_disk, scratch_memory, 0, 0, &errors_detected); return_if_fail( status == FX_NOT_ENOUGH_MEMORY); - + /* Attempt to check the media but give it a bad scratch_memory_size to throw an error */ status = fx_media_check(&ram_disk, scratch_memory, (ram_disk.fx_media_total_clusters / 8), 0, &errors_detected); return_if_fail( status == FX_NOT_ENOUGH_MEMORY); @@ -179,11 +179,11 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Attempt to check the media but give it another bad scratch_memory_size to throw an error */ status = fx_media_check(&ram_disk, scratch_memory, 977, 0, &errors_detected); return_if_fail( status == FX_NOT_ENOUGH_MEMORY); - + /* Check the media for errors. */ status = fx_media_check(&ram_disk, scratch_memory, SCRATCH_MEMORY_SIZE, 0, &errors_detected); return_if_fail( (status == FX_SUCCESS) && (errors_detected == FX_LOST_CLUSTER_ERROR)); - + /* Check the media for errors again, but correct them this time! */ status = fx_media_check(&ram_disk, scratch_memory, SCRATCH_MEMORY_SIZE, FX_LOST_CLUSTER_ERROR, &errors_detected); return_if_fail( (status == FX_SUCCESS) && (errors_detected == FX_LOST_CLUSTER_ERROR)); @@ -214,23 +214,23 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; status += fx_file_close(&my_file); status += fx_media_close(&ram_disk); status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); - + /* Loop to clear the raw sector buffer... */ for (i = 0; i < sizeof(raw_sector_buffer); i++) { - + raw_sector_buffer[i] = 0; - } + } /* Setup original FAT table to break the File's cluster! */ raw_sector_buffer[0] = 0x0F; raw_sector_buffer[1] = 0x0f; raw_sector_buffer[2] = 0xFF; - + /* Write the FAT sector back... with the errors. */ - status += fx_media_write(&ram_disk, 1, (VOID *) raw_sector_buffer); + status += fx_media_write(&ram_disk, 1, (VOID *) raw_sector_buffer); return_if_fail( status == FX_ACCESS_ERROR); - + /* Check the media for errors. */ status = fx_media_check(&ram_disk, scratch_memory, SCRATCH_MEMORY_SIZE, 0, &errors_detected); @@ -269,9 +269,9 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; raw_sector_buffer[0x1D] = 0; raw_sector_buffer[0x1E] = 0; raw_sector_buffer[0x1F] = 0; - + /* Write the root directory sector back... with the errors. */ - status += fx_media_write(&ram_disk, ram_disk.fx_media_root_sector_start, (VOID *) raw_sector_buffer); + status += fx_media_write(&ram_disk, ram_disk.fx_media_root_sector_start, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); /* Check the media for errors. */ @@ -283,30 +283,30 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); - + /* Clear the initial part of the RAM disk memory. */ for (i = 0; i < 4096; i++) { ram_disk_memory[i] = 0; } - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Setup a new, more complicated directory structure. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); status += fx_file_create(&ram_disk, "ROOTF1.TXT"); @@ -325,7 +325,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; status += fx_media_flush(&ram_disk); status += fx_file_create(&ram_disk, "\\SUB1\\SUB2\\SUB2F2.TXT"); return_if_fail( status == FX_SUCCESS); - + /* Write data to the files... */ status += fx_file_open(&ram_disk, &my_file, "ROOTF1.TXT", FX_OPEN_FOR_WRITE); status += fx_file_write(&my_file, "ROOT1_CONTENTS", 14); @@ -341,7 +341,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; status += fx_file_write(&my_file, "SUB1F1_CONTENTS", 15); status += fx_file_close(&my_file); status += fx_media_flush(&ram_disk); - + status += fx_file_open(&ram_disk, &my_file, "\\SUB1\\SUB1F2.TXT", FX_OPEN_FOR_WRITE); status += fx_file_write(&my_file, "SUB1F2_CONTENTS", 15); status += fx_file_close(&my_file); @@ -371,24 +371,24 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; { ram_disk_memory[i] = 0; } - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 128, // Sector size + 70000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Setup a new, more complicated directory structure. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); status += fx_file_create(&ram_disk, "ROOTF1.TXT"); @@ -407,7 +407,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; status += fx_media_flush(&ram_disk); status += fx_file_create(&ram_disk, "\\SUB1\\SUB2\\SUB2F2.TXT"); return_if_fail( status == FX_SUCCESS); - + /* Write data to the files... */ status += fx_file_open(&ram_disk, &my_file, "ROOTF1.TXT", FX_OPEN_FOR_WRITE); status += fx_file_write(&my_file, "ROOT1_CONTENTS", 14); @@ -423,7 +423,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; status += fx_file_write(&my_file, "SUB1F1_CONTENTS", 15); status += fx_file_close(&my_file); status += fx_media_flush(&ram_disk); - + status += fx_file_open(&ram_disk, &my_file, "\\SUB1\\SUB1F2.TXT", FX_OPEN_FOR_WRITE); status += fx_file_write(&my_file, "SUB1F2_CONTENTS", 15); status += fx_file_close(&my_file); @@ -455,24 +455,24 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; { ram_disk_memory[i] = 0; } - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 6000, // Total sectors - FAT16 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Setup a new, more complicated directory structure. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); status += fx_file_create(&ram_disk, "ROOTF1.TXT"); @@ -504,21 +504,21 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Set the second file's FAT chain to the same as the first. */ raw_sector_buffer[0x3A] = raw_sector_buffer[0x1A]; raw_sector_buffer[0x3B] = raw_sector_buffer[0x1B]; - + /* Write the root directory sector back... with the errors. */ - status += fx_media_write(&ram_disk, ram_disk.fx_media_root_sector_start, (VOID *) raw_sector_buffer); + status += fx_media_write(&ram_disk, ram_disk.fx_media_root_sector_start, (VOID *) raw_sector_buffer); status += fx_media_flush(&ram_disk); - + /* Read the first FAT sector. */ status += fx_media_read(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); /* Break the FAT chain of the ROOTF1.TXT file. */ raw_sector_buffer[14] = 0; raw_sector_buffer[15] = 0; - + /* Write the root directory sector back... with the errors. */ - status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); - status += fx_media_flush(&ram_disk); + status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); + status += fx_media_flush(&ram_disk); return_if_fail( status == FX_SUCCESS); /* Check the media for errors. */ @@ -539,25 +539,25 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Loop to run through multiple tests... */ for (i = 0; i < 1000; i++) - { - + { + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 6000, // Total sectors - FAT16 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Setup a new, more complicated directory structure. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128 /*CACHE_SIZE*/); status += fx_file_create(&ram_disk, "ROOTF1.TXT"); @@ -624,11 +624,11 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Set the second file's FAT chain starting cluster to the same as the first. */ raw_sector_buffer[0x3A] = raw_sector_buffer[0x1A]; raw_sector_buffer[0x3B] = raw_sector_buffer[0x1B]; - + /* Write the root directory sector back... with the errors. */ - status += fx_media_write(&ram_disk, ram_disk.fx_media_root_sector_start, (VOID *) raw_sector_buffer); + status += fx_media_write(&ram_disk, ram_disk.fx_media_root_sector_start, (VOID *) raw_sector_buffer); status += fx_media_flush(&ram_disk); - + /* Read the first FAT sector. */ status += fx_media_read(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); @@ -641,15 +641,15 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; } else { - + /* Break with reserved fAT value. */ raw_sector_buffer[14] = 0xF0; raw_sector_buffer[15] = 0xFF; } - + /* Write the root directory sector back... with the errors. */ - status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); - status += fx_media_flush(&ram_disk); + status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); + status += fx_media_flush(&ram_disk); return_if_fail( status == FX_SUCCESS); /* Create I/O errors via the RAM driver interface. */ @@ -657,42 +657,42 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; _fx_utility_logical_sector_flush(&ram_disk, 1, 60000, FX_TRUE); j = (UINT)(rand() % 20); if (j == 0) - j = 1; + j = 1; _fx_ram_driver_io_error_request = j; - + /* Check the media for errors. */ fx_media_check(&ram_disk, scratch_memory, 4000, (((ULONG) i) % 16), &errors_detected); - /* Clear the error generation flags. */ + /* Clear the error generation flags. */ _fx_ram_driver_io_error_request = 0; - + /* Abort the media. */ fx_media_abort(&ram_disk); } - + /* FAT32 I/O error check. */ /* Loop to run through multiple tests... */ for (i = 0; i < 1000; i++) - { - + { + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70000, // Total sectors - FAT32 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Setup a new, more complicated directory structure. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128 /*CACHE_SIZE*/); status += fx_file_create(&ram_disk, "ROOTF1.TXT"); @@ -760,11 +760,11 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Set the second file's FAT chain starting cluster to the same as the first. */ raw_sector_buffer[0x3A] = raw_sector_buffer[0x1A]; raw_sector_buffer[0x3B] = raw_sector_buffer[0x1B]; - + /* Write the root directory sector back... with the errors. */ - status += fx_media_write(&ram_disk, ram_disk.fx_media_root_sector_start, (VOID *) raw_sector_buffer); + status += fx_media_write(&ram_disk, ram_disk.fx_media_root_sector_start, (VOID *) raw_sector_buffer); status += fx_media_flush(&ram_disk); - + /* Read the first FAT sector. */ status += fx_media_read(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); @@ -785,10 +785,10 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; raw_sector_buffer[34] = 0xFF; raw_sector_buffer[35] = 0xFF; } - + /* Write the root directory sector back... with the errors. */ - status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); - status += fx_media_flush(&ram_disk); + status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); + status += fx_media_flush(&ram_disk); return_if_fail( status == FX_SUCCESS); /* Create I/O errors via the RAM driver interface. */ @@ -796,18 +796,18 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; _fx_utility_logical_sector_flush(&ram_disk, 1, 60000, FX_TRUE); j = (UINT)(rand() % 10); if (j == 0) - j = 1; + j = 1; _fx_ram_driver_io_error_request = j; /* Check the media for errors. */ fx_media_check(&ram_disk, scratch_memory, 4000, (((ULONG) i) % 16), &errors_detected); - /* Clear the error generation flags. */ + /* Clear the error generation flags. */ _fx_ram_driver_io_error_request = 0; /* Abort the media. */ fx_media_abort(&ram_disk); - } + } /* FAT32 Test for two files with the same FAT chain. */ @@ -816,22 +816,22 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; { ram_disk_memory[i] = 0; } - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70000, // Total sectors - FAT32 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -840,7 +840,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; printf("ERROR!\n"); test_control_return(33); } - + /* Setup a new, more complicated directory structure. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); status += fx_file_create(&ram_disk, "ROOTF1.TXT"); @@ -872,11 +872,11 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Set the second file's FAT chain to the same as the first. */ raw_sector_buffer[0x3A] = raw_sector_buffer[0x1A]; raw_sector_buffer[0x3B] = raw_sector_buffer[0x1B]; - + /* Write the root directory sector back... with the errors. */ - status += fx_media_write(&ram_disk, ram_disk.fx_media_root_sector_start, (VOID *) raw_sector_buffer); + status += fx_media_write(&ram_disk, ram_disk.fx_media_root_sector_start, (VOID *) raw_sector_buffer); status += fx_media_flush(&ram_disk); - + /* Read the first FAT sector. */ status += fx_media_read(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); @@ -885,10 +885,10 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; raw_sector_buffer[33] = 0; raw_sector_buffer[34] = 0; raw_sector_buffer[35] = 0; - + /* Write the root directory sector back... with the errors. */ - status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); - status += fx_media_flush(&ram_disk); + status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); + status += fx_media_flush(&ram_disk); return_if_fail( status == FX_SUCCESS); /* Check the media for errors. */ @@ -896,11 +896,11 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Determine if any were found - should not have found any errors at this point. */ return_if_fail((status == FX_SUCCESS) && (errors_detected == (FX_FAT_CHAIN_ERROR | FX_DIRECTORY_ERROR | FX_LOST_CLUSTER_ERROR))); - + /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); - + /* FAT32 Test for two files with the same FAT chain and a broken root directory FAT chain. */ /* Clear the initial part of the RAM disk memory. */ @@ -908,24 +908,24 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; { ram_disk_memory[i] = 0; } - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70000, // Total sectors - FAT32 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Setup a new, more complicated directory structure. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); status += fx_file_create(&ram_disk, "ROOTF1.TXT"); @@ -957,11 +957,11 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Set the second file's FAT chain to the same as the first. */ raw_sector_buffer[0x3A] = raw_sector_buffer[0x1A]; raw_sector_buffer[0x3B] = raw_sector_buffer[0x1B]; - + /* Write the root directory sector back... with the errors. */ - status += fx_media_write(&ram_disk, ram_disk.fx_media_root_sector_start, (VOID *) raw_sector_buffer); + status += fx_media_write(&ram_disk, ram_disk.fx_media_root_sector_start, (VOID *) raw_sector_buffer); status += fx_media_flush(&ram_disk); - + /* Read the first FAT sector. */ status += fx_media_read(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); @@ -975,17 +975,17 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; raw_sector_buffer[32] = 0; raw_sector_buffer[33] = 0; raw_sector_buffer[34] = 0; - raw_sector_buffer[35] = 0; - + raw_sector_buffer[35] = 0; + /* Write the root directory sector back... with the errors. */ - status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); - status += fx_media_flush(&ram_disk); + status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); + status += fx_media_flush(&ram_disk); return_if_fail( status == FX_SUCCESS); /* Check the media for errors. */ status = fx_media_check(&ram_disk, scratch_memory, 11000, (FX_FAT_CHAIN_ERROR | FX_DIRECTORY_ERROR | FX_LOST_CLUSTER_ERROR), &errors_detected); return_if_fail( status == FX_ERROR_NOT_FIXED); - + /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); @@ -997,34 +997,34 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; { ram_disk_memory[i] = 0; } - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 6000, // Total sectors - FAT32 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Setup a new, more complicated directory structure. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); status += fx_file_create(&ram_disk, "ROOTF1.TXT"); status += fx_media_flush(&ram_disk); status += fx_file_open(&ram_disk, &my_file, "ROOTF1.TXT", FX_OPEN_FOR_WRITE); - do + do { status = fx_file_write(&my_file, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 26); } while (status == FX_SUCCESS); - + /* Determine if the write had anything other than a no more space error. */ return_if_fail( status == FX_NO_MORE_SPACE); @@ -1041,7 +1041,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Undo the cluster adjustment. */ ram_disk.fx_media_total_clusters = ram_disk.fx_media_total_clusters + 4; return_if_fail( status == FX_SUCCESS); - + /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); @@ -1053,24 +1053,24 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; { ram_disk_memory[i] = 0; } - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 6000, // Total sectors - FAT16 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Setup a deep directory structure. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); status += fx_directory_create(&ram_disk, "\\DIR1"); @@ -1087,17 +1087,17 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; status += fx_file_create(&ram_disk, "\\DIR1\\SUB11"); status += fx_media_flush(&ram_disk); return_if_fail( status == FX_SUCCESS); - + /* Read the first FAT sector. */ status += fx_media_read(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); /* Break the FAT chain of the in the first sub directory. */ raw_sector_buffer[10] = 0; raw_sector_buffer[11] = 0; - + /* Write the root directory sector back... with the errors. */ - status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); - status += fx_media_flush(&ram_disk); + status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); + status += fx_media_flush(&ram_disk); return_if_fail( status == FX_SUCCESS); /* Check the media for errors. */ @@ -1117,24 +1117,24 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; { ram_disk_memory[i] = 0; } - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70000, // Total sectors - FAT32 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Setup a new, more complicated directory structure. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); status += fx_file_create(&ram_disk, "ROOTF1.TXT"); @@ -1167,10 +1167,10 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; raw_sector_buffer[13] = 0; raw_sector_buffer[14] = 0; raw_sector_buffer[15] = 0; - + /* Write the root directory sector back... with the errors. */ - status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); - status += fx_media_flush(&ram_disk); + status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); + status += fx_media_flush(&ram_disk); return_if_fail( status == FX_SUCCESS); /* Check the media for errors. */ @@ -1180,7 +1180,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; #else return_if_fail( status == FX_SUCCESS); #endif - + /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); @@ -1192,34 +1192,34 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; { ram_disk_memory[i] = 0; } - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 6000, // Total sectors - FAT32 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Setup a new, more complicated directory structure. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); status += fx_file_create(&ram_disk, "ROOTF1.TXT"); status += fx_media_flush(&ram_disk); status += fx_file_open(&ram_disk, &my_file, "ROOTF1.TXT", FX_OPEN_FOR_WRITE); - do + do { status = fx_file_write(&my_file, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 26); } while (status == FX_SUCCESS); - + /* Determine if the write had anything other than a no more space error. */ return_if_fail( status == FX_NO_MORE_SPACE); @@ -1233,15 +1233,15 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Make the FAT chain recursive. */ raw_sector_buffer[6] = raw_sector_buffer[4]; raw_sector_buffer[7] = raw_sector_buffer[5]; - + /* Write the root directory sector back... with the errors. */ - status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); - status += fx_media_flush(&ram_disk); + status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); + status += fx_media_flush(&ram_disk); /* Check the media for errors. */ status += fx_media_check(&ram_disk, scratch_memory, 11000, (FX_FAT_CHAIN_ERROR | FX_DIRECTORY_ERROR | FX_LOST_CLUSTER_ERROR), &errors_detected); return_if_fail( status == FX_SUCCESS); - + /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); @@ -1253,24 +1253,24 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; { ram_disk_memory[i] = 0; } - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 6000, // Total sectors - FAT32 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Setup a new, more complicated directory structure. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); status += fx_directory_create(&ram_disk, "SUB1"); @@ -1283,10 +1283,10 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Make the FAT chain recursive. */ raw_sector_buffer[4] = 0; raw_sector_buffer[5] = 0; - + /* Write the FAT sector back... with the errors. */ - status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); - status += fx_media_flush(&ram_disk); + status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); + status += fx_media_flush(&ram_disk); /* Read the root directory's first sector. */ status += fx_media_read(&ram_disk, ram_disk.fx_media_root_sector_start, (VOID *) raw_sector_buffer); @@ -1294,7 +1294,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Check the media for errors. */ status += fx_media_check(&ram_disk, scratch_memory, 11000, (FX_FAT_CHAIN_ERROR | FX_DIRECTORY_ERROR | FX_LOST_CLUSTER_ERROR), &errors_detected); return_if_fail( status == FX_SUCCESS); - + /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); @@ -1306,24 +1306,24 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; { ram_disk_memory[i] = 0; } - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 6000, // Total sectors - FAT32 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Setup a new, more complicated directory structure. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); status += fx_directory_create(&ram_disk, "\\SUB1"); @@ -1353,7 +1353,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Check the media for errors. */ status = fx_media_check(&ram_disk, scratch_memory, 11000, (FX_FAT_CHAIN_ERROR | FX_DIRECTORY_ERROR | FX_LOST_CLUSTER_ERROR), &errors_detected); return_if_fail( status == FX_NOT_ENOUGH_MEMORY); - + /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); @@ -1365,24 +1365,24 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; { ram_disk_memory[i] = 0; } - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 6000, // Total sectors - FAT32 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Setup a new, more complicated directory structure. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); status += fx_directory_create(&ram_disk, "SUB1"); @@ -1395,10 +1395,10 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Make the FAT chain recursive. */ raw_sector_buffer[4] = 0; raw_sector_buffer[5] = 0; - + /* Write the FAT sector back... with the errors. */ - status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); - status += fx_media_flush(&ram_disk); + status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); + status += fx_media_flush(&ram_disk); /* Read the root directory's first sector. */ status += fx_media_read(&ram_disk, ram_disk.fx_media_root_sector_start, (VOID *) raw_sector_buffer); @@ -1406,7 +1406,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Check the media for errors. */ status += fx_media_check(&ram_disk, scratch_memory, 11000, (FX_FAT_CHAIN_ERROR | FX_LOST_CLUSTER_ERROR), &errors_detected); return_if_fail( status == FX_SUCCESS); - + /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); @@ -1418,24 +1418,24 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; { ram_disk_memory[i] = 0; } - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70000, // Total sectors - FAT32 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Setup a new, more complicated directory structure. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); status += fx_file_create(&ram_disk, "ROOTF1.TXT"); @@ -1493,11 +1493,11 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Set the second file's FAT chain to the same as the first. */ raw_sector_buffer[0x3A] = raw_sector_buffer[0x1A]; raw_sector_buffer[0x3B] = raw_sector_buffer[0x1B]; - + /* Write the root directory sector back... with the errors. */ - status += fx_media_write(&ram_disk, ram_disk.fx_media_root_sector_start, (VOID *) raw_sector_buffer); + status += fx_media_write(&ram_disk, ram_disk.fx_media_root_sector_start, (VOID *) raw_sector_buffer); status += fx_media_flush(&ram_disk); - + /* Read the first FAT sector. */ status += fx_media_read(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); @@ -1506,16 +1506,16 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; raw_sector_buffer[13] = 0; raw_sector_buffer[14] = 0; raw_sector_buffer[15] = 0; - + /* Write the root directory sector back... with the errors. */ - status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); - status += fx_media_flush(&ram_disk); + status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); + status += fx_media_flush(&ram_disk); return_if_fail( status == FX_SUCCESS); /* Check the media for errors. */ status = fx_media_check(&ram_disk, scratch_memory, 11000, (FX_DIRECTORY_ERROR | FX_LOST_CLUSTER_ERROR), &errors_detected); return_if_fail( status == FX_ERROR_NOT_FIXED); - + /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); @@ -1539,24 +1539,24 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; { ram_disk_memory[i] = 0; } - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70000, // Total sectors - FAT32 - 512, // Sector size + 512, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* Setup a new, more complicated directory structure. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); status += fx_file_create(&ram_disk, "ROOTF1.TXT"); @@ -1616,11 +1616,11 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Set the second file's FAT chain to the same as the first. */ raw_sector_buffer[0x3A] = raw_sector_buffer[0x1A]; raw_sector_buffer[0x3B] = raw_sector_buffer[0x1B]; - + /* Write the root directory sector back... with the errors. */ - status += fx_media_write(&ram_disk, ram_disk.fx_media_root_sector_start, (VOID *) raw_sector_buffer); + status += fx_media_write(&ram_disk, ram_disk.fx_media_root_sector_start, (VOID *) raw_sector_buffer); status += fx_media_flush(&ram_disk); - + /* Read the first FAT sector. */ status += fx_media_read(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); @@ -1629,16 +1629,16 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; raw_sector_buffer[13] = 0; raw_sector_buffer[14] = 0; raw_sector_buffer[15] = 0; - + /* Write the root directory sector back... with the errors. */ - status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); - status += fx_media_flush(&ram_disk); + status += fx_media_write(&ram_disk, ram_disk.fx_media_reserved_sectors, (VOID *) raw_sector_buffer); + status += fx_media_flush(&ram_disk); return_if_fail( status == FX_SUCCESS); /* Check the media for errors. */ status = fx_media_check(&ram_disk, scratch_memory, 11000, (FX_DIRECTORY_ERROR | FX_LOST_CLUSTER_ERROR), &errors_detected); return_if_fail( status == FX_ERROR_NOT_FIXED); - + /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); @@ -1670,33 +1670,33 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; _fx_utility_logical_sector_flush(&ram_disk, 1, 60000, FX_TRUE); j = (UINT)(rand() % 10); if (j == 0) - j = 1; + j = 1; _fx_ram_driver_io_error_request = j; - + /* Format the media. This needs to be done before opening it! */ - fx_media_format(&ram_disk, + fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MYDISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70000, // Total sectors - FAT32 - 512, // Sector size + 512, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track _fx_utility_FAT_flush(&ram_disk); _fx_utility_logical_sector_flush(&ram_disk, 1, 60000, FX_TRUE); j = (UINT)(rand() % 10); if (j == 0) - j = 1; + j = 1; _fx_ram_driver_io_error_request = j; - + /* Open media with errors. */ fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 512); @@ -1704,7 +1704,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; _fx_utility_logical_sector_flush(&ram_disk, 1, 60000, FX_TRUE); j = (UINT)(rand() % 10); if (j == 0) - j = 1; + j = 1; _fx_ram_driver_io_error_request = j; /* Attempt to close media with errors. */ @@ -1715,7 +1715,7 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; _fx_utility_logical_sector_flush(&ram_disk, 1, 60000, FX_TRUE); j = (UINT)(rand() % 10); if (j == 0) - j = 1; + j = 1; _fx_ram_driver_io_error_request = j; /* Attempt to abort media with errors. */ @@ -1725,70 +1725,70 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; } /* Test I/O errors in _fx_media_check_lost_cluster_check. */ - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 6000, // Total sectors - 128, // Sector size + 6000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); return_if_fail( status == FX_SUCCESS); - + /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 2, (VOID *) raw_sector_buffer); + status = fx_media_read(&ram_disk, 2, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); /* Change the FAT table to introduce lost clusters! */ raw_sector_buffer[30] = 2; raw_sector_buffer[31] = 3; raw_sector_buffer[32] = 4; - + /* Write the FAT sector back... with the errors. */ - status = fx_media_write(&ram_disk, 2, (VOID *) raw_sector_buffer); + status = fx_media_write(&ram_disk, 2, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 3, (VOID *) raw_sector_buffer); + status = fx_media_read(&ram_disk, 3, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); /* Change the FAT table to introduce lost clusters! */ raw_sector_buffer[30] = 5; raw_sector_buffer[31] = 6; raw_sector_buffer[32] = 7; - + /* Write the FAT sector back... with the errors. */ - status = fx_media_write(&ram_disk, 3, (VOID *) raw_sector_buffer); + status = fx_media_write(&ram_disk, 3, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 4, (VOID *) raw_sector_buffer); + status = fx_media_read(&ram_disk, 4, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); /* Change the FAT table to introduce lost clusters! */ raw_sector_buffer[30] = 8; raw_sector_buffer[31] = 9; raw_sector_buffer[32] = 10; - + /* Write the FAT sector back... with the errors. */ - status = fx_media_write(&ram_disk, 4, (VOID *) raw_sector_buffer); + status = fx_media_write(&ram_disk, 4, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); /* Flush and invalidate the cache. */ _fx_utility_logical_sector_flush(&ram_disk, 0, 4000, FX_TRUE); - + /* Force media errors. */ _fx_utility_fat_entry_read_error_request = 1; status = fx_media_check(&ram_disk, scratch_memory, SCRATCH_MEMORY_SIZE, FX_LOST_CLUSTER_ERROR, &errors_detected); @@ -1802,68 +1802,68 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; return_if_fail( status == FX_SUCCESS); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 6000, // Total sectors - 128, // Sector size + 6000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); return_if_fail( status == FX_SUCCESS); - + /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 2, (VOID *) raw_sector_buffer); + status = fx_media_read(&ram_disk, 2, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); /* Change the FAT table to introduce lost clusters! */ raw_sector_buffer[30] = 2; raw_sector_buffer[31] = 3; raw_sector_buffer[32] = 4; - + /* Write the FAT sector back... with the errors. */ - status = fx_media_write(&ram_disk, 2, (VOID *) raw_sector_buffer); + status = fx_media_write(&ram_disk, 2, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 3, (VOID *) raw_sector_buffer); + status = fx_media_read(&ram_disk, 3, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); /* Change the FAT table to introduce lost clusters! */ raw_sector_buffer[30] = 5; raw_sector_buffer[31] = 6; raw_sector_buffer[32] = 7; - + /* Write the FAT sector back... with the errors. */ - status = fx_media_write(&ram_disk, 3, (VOID *) raw_sector_buffer); + status = fx_media_write(&ram_disk, 3, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 4, (VOID *) raw_sector_buffer); + status = fx_media_read(&ram_disk, 4, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); /* Change the FAT table to introduce lost clusters! */ raw_sector_buffer[30] = 8; raw_sector_buffer[31] = 9; raw_sector_buffer[32] = 10; - + /* Write the FAT sector back... with the errors. */ - status = fx_media_write(&ram_disk, 4, (VOID *) raw_sector_buffer); + status = fx_media_write(&ram_disk, 4, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); /* Flush and invalidate the cache. */ _fx_utility_logical_sector_flush(&ram_disk, 0, 4000, FX_TRUE); - + /* Check the media for errors. */ _fx_utility_fat_entry_write_error_request = 1; status = fx_media_check(&ram_disk, scratch_memory, SCRATCH_MEMORY_SIZE, FX_LOST_CLUSTER_ERROR, &errors_detected); @@ -1879,26 +1879,26 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Test the error paths in FAT32 root directory traversal. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70000, // Total sectors - FAT32 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); return_if_fail( status == FX_SUCCESS); - + /* Now create a series to sub-directories to expand the root directory FAT chain. */ status = fx_file_create(&ram_disk, "FILE1"); status += fx_file_create(&ram_disk, "FILE2"); @@ -1930,12 +1930,12 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; status += fx_file_create(&ram_disk, "FILE28"); status += fx_file_create(&ram_disk, "FILE29"); status += fx_file_create(&ram_disk, "FILE30"); - status += fx_file_create(&ram_disk, "FILE31"); + status += fx_file_create(&ram_disk, "FILE31"); status += fx_media_flush(&ram_disk); - + /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 1, (VOID *) raw_sector_buffer); + status = fx_media_read(&ram_disk, 1, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); /* Break the FAT chain of the root directory! */ @@ -1943,15 +1943,15 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; raw_sector_buffer[37] = 0; raw_sector_buffer[38] = 0; raw_sector_buffer[39] = 0; - + /* Write the FAT sector back... with the errors. */ - status = fx_media_write(&ram_disk, 1, (VOID *) raw_sector_buffer); + status = fx_media_write(&ram_disk, 1, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); /* Flush and invalidate the cache. */ fx_media_flush(&ram_disk); _fx_utility_logical_sector_flush(&ram_disk, 0, 4000, FX_TRUE); - + /* Check the media for errors. */ _fx_utility_fat_entry_read_error_request = 1; status = fx_media_check(&ram_disk, scratch_memory, 11000, (FX_LOST_CLUSTER_ERROR | FX_DIRECTORY_ERROR | FX_FAT_CHAIN_ERROR), &errors_detected); @@ -1971,40 +1971,40 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Test the error paths in file FAT traversal. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70000, // Total sectors - FAT32 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); return_if_fail( status == FX_SUCCESS); - + /* Now create a series to sub-directories to expand the root directory FAT chain. */ status = fx_file_create(&ram_disk, "FILE1"); - + /* Flush and invalidate the cache. */ fx_media_flush(&ram_disk); _fx_utility_logical_sector_flush(&ram_disk, 0, 4000, FX_TRUE); /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 1, (VOID *) raw_sector_buffer); + status = fx_media_read(&ram_disk, 1, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); - + /* Open the file. */ - status += fx_file_open(&ram_disk, &my_file, "FILE1", FX_OPEN_FOR_WRITE); - + status += fx_file_open(&ram_disk, &my_file, "FILE1", FX_OPEN_FOR_WRITE); + /* Write to the file. */ status += fx_file_write(&my_file, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 26); status += fx_file_write(&my_file, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 26); @@ -2077,9 +2077,9 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; status += fx_file_write(&my_file, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 26); status += fx_file_close(&my_file); status += fx_media_flush(&ram_disk); - + /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 1, (VOID *) raw_sector_buffer); + status = fx_media_read(&ram_disk, 1, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); /* Break the FAT chain of the root directory! */ @@ -2087,15 +2087,15 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; raw_sector_buffer[37] = 0; raw_sector_buffer[38] = 0; raw_sector_buffer[39] = 0; - + /* Write the FAT sector back... with the errors. */ - status = fx_media_write(&ram_disk, 1, (VOID *) raw_sector_buffer); + status = fx_media_write(&ram_disk, 1, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); /* Flush and invalidate the cache. */ fx_media_flush(&ram_disk); _fx_utility_logical_sector_flush(&ram_disk, 0, 4000, FX_TRUE); - + /* Check the media for errors. */ _fx_utility_fat_entry_write_error_request = 1; status = fx_media_check(&ram_disk, scratch_memory, 11000, (FX_LOST_CLUSTER_ERROR | FX_DIRECTORY_ERROR | FX_FAT_CHAIN_ERROR), &errors_detected); @@ -2109,43 +2109,43 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; /* Test the error paths in sub-directory delete path. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70000, // Total sectors - FAT32 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); return_if_fail( status == FX_SUCCESS); - + /* Now create a sub-directory. */ status = fx_directory_create(&ram_disk, "SUB1"); - + /* Flush and invalidate the cache. */ fx_media_flush(&ram_disk); _fx_utility_logical_sector_flush(&ram_disk, 0, 4000, FX_TRUE); /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 1, (VOID *) raw_sector_buffer); + status = fx_media_read(&ram_disk, 1, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); - + /* Open the file. */ - status += fx_file_open(&ram_disk, &my_file, "FILE1", FX_OPEN_FOR_WRITE); + status += fx_file_open(&ram_disk, &my_file, "FILE1", FX_OPEN_FOR_WRITE); status += fx_media_flush(&ram_disk); - + /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 1, (VOID *) raw_sector_buffer); + status = fx_media_read(&ram_disk, 1, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); /* Break the FAT chain of the sub-directory! */ @@ -2153,15 +2153,15 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; raw_sector_buffer[13] = 0; raw_sector_buffer[14] = 0; raw_sector_buffer[15] = 0; - + /* Write the FAT sector back... with the errors. */ - status = fx_media_write(&ram_disk, 1, (VOID *) raw_sector_buffer); + status = fx_media_write(&ram_disk, 1, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); /* Flush and invalidate the cache. */ fx_media_flush(&ram_disk); _fx_utility_logical_sector_flush(&ram_disk, 0, 4000, FX_TRUE); - + /* Check the media for errors. */ _fx_ram_driver_io_error_request = 4; status = fx_media_check(&ram_disk, scratch_memory, 11000, (FX_LOST_CLUSTER_ERROR | FX_DIRECTORY_ERROR | FX_FAT_CHAIN_ERROR), &errors_detected); @@ -2173,20 +2173,20 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; return_if_fail( status == FX_SUCCESS); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); /* Open the ram_disk. */ @@ -2205,29 +2205,29 @@ UCHAR specified_ascii_name[] = { 0xe5, 'a', 'b', 'c', 0}; status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); - + /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 1, (VOID *) raw_sector_buffer); + status = fx_media_read(&ram_disk, 1, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); /* Change the FAT table to introduce lost clusters! */ memcpy(raw_sector_buffer_check, raw_sector_buffer, ram_disk.fx_media_bytes_per_sector); raw_sector_buffer[3] = (ram_disk.fx_media_total_clusters + FX_FAT_ENTRY_START) & 0xFF; raw_sector_buffer[4] = (UCHAR)((ram_disk.fx_media_total_clusters + FX_FAT_ENTRY_START) >> 8); - + /* Write the FAT sector back... with the errors. */ - status = fx_media_write(&ram_disk, 1, (VOID *) raw_sector_buffer); + status = fx_media_write(&ram_disk, 1, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); - + /* Attempt to check the media but give it a bad scratch_memory_size to throw an error */ status = fx_media_check(&ram_disk, scratch_memory, SCRATCH_MEMORY_SIZE, FX_FAT_CHAIN_ERROR, &errors_detected); return_if_fail( (status == FX_SUCCESS) && (errors_detected == (FX_FAT_CHAIN_ERROR| FX_DIRECTORY_ERROR| FX_LOST_CLUSTER_ERROR))); - + #if 0 /* Read the first FAT sector again. */ - status = fx_media_read(&ram_disk, 1, (VOID *) raw_sector_buffer); + status = fx_media_read(&ram_disk, 1, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); /* Compare the */ diff --git a/test/regression_test/filex_media_flush_test.c b/test/regression_test/filex_media_flush_test.c index 58aaa8d..6293f4b 100644 --- a/test/regression_test/filex_media_flush_test.c +++ b/test/regression_test/filex_media_flush_test.c @@ -52,13 +52,13 @@ void filex_media_flush_application_define(void *first_unused_memory) #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -95,7 +95,7 @@ ULONG i; /* Print out some test information banners. */ printf("FileX Test: Media flush test......................................."); - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING /* send null pointer to generate an error */ @@ -108,20 +108,20 @@ ULONG i; #endif /* FX_DISABLE_ERROR_CHECKING */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -130,7 +130,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(2); } - + /* try to flush the media before it is opened */ status = fx_media_flush(&ram_disk); if (status != FX_MEDIA_NOT_OPEN) @@ -150,7 +150,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(21); } - + /* try to flush the media while it is write protected */ ram_disk.fx_media_driver_write_protect = FX_TRUE; status = fx_media_flush(&ram_disk); @@ -185,7 +185,7 @@ ULONG i; /* Pickup the available bytes in the media. */ status = fx_media_space_available(&ram_disk, &available_bytes); - + /* Check for available bytes error. */ if ((status != FX_SUCCESS) || (available_bytes < sizeof(ULONG))) { @@ -199,7 +199,7 @@ ULONG i; write_value = 0; while (i < available_bytes) { - + /* Write 4 bytes to the file. */ status = fx_file_write(&my_file, (void *) &write_value, sizeof(ULONG)); @@ -210,17 +210,17 @@ ULONG i; printf("ERROR!\n"); test_control_return(6); } - + /* Increment byte count. */ i = i + sizeof(ULONG); - + /* Increment write value. */ write_value++; } - + /* Pickup the available bytes in the media again. */ status = fx_media_space_available(&ram_disk, &i); - + /* Check for available bytes error. */ if ((status != FX_SUCCESS) || (i != 0)) { @@ -228,7 +228,7 @@ ULONG i; printf("ERROR!\n"); test_control_return(7); } - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING /* send null pointer to generate an error */ @@ -239,11 +239,11 @@ ULONG i; test_control_return(11); } #endif /* FX_DISABLE_ERROR_CHECKING */ - - /* At this point, we should flush the media to ensure that all + + /* At this point, we should flush the media to ensure that all dirty sectors are written. */ status = fx_media_flush(&ram_disk); - + #ifndef FX_DISABLE_CACHE /* Check for flush errors. */ if ((status != FX_SUCCESS) || (ram_disk.fx_media_sector_cache_dirty_count)) @@ -253,7 +253,7 @@ ULONG i; test_control_return(8); } #endif - + /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); @@ -270,7 +270,7 @@ ULONG i; read_value = 0; while (i < available_bytes) { - + /* Read 4 bytes from the file. */ status = fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); @@ -309,20 +309,20 @@ ULONG i; } /* Reformat the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -368,7 +368,7 @@ ULONG i; /* Pickup the available bytes in the media. */ status = fx_media_space_available(&ram_disk, &available_bytes); - + /* Check for available bytes error. */ if ((status != FX_SUCCESS) || (available_bytes < sizeof(ULONG))) { @@ -382,7 +382,7 @@ ULONG i; write_value = 0; while (i < available_bytes) { - + /* Write 4 bytes to the file. */ status = fx_file_write(&my_file, (void *) &write_value, sizeof(ULONG)); @@ -393,17 +393,17 @@ ULONG i; printf("ERROR!\n"); test_control_return(18); } - + /* Increment byte count. */ i = i + sizeof(ULONG); - + /* Increment write value. */ write_value++; } - + /* Pickup the available bytes in the media again. */ status = fx_media_space_available(&ram_disk, &i); - + /* Check for available bytes error. */ if ((status != FX_SUCCESS) || (i != 0)) { @@ -411,11 +411,11 @@ ULONG i; printf("ERROR!\n"); test_control_return(19); } - - /* At this point, we should flush the media to ensure that all + + /* At this point, we should flush the media to ensure that all dirty sectors are written. */ status = fx_media_flush(&ram_disk); - + #ifndef FX_DISABLE_CACHE /* Check for flush errors. */ if ((status != FX_SUCCESS) || (ram_disk.fx_media_sector_cache_dirty_count)) @@ -425,7 +425,7 @@ ULONG i; test_control_return(20); } #endif - + /* Seek to the beginning of the test file. */ status = fx_file_seek(&my_file, 0); @@ -442,7 +442,7 @@ ULONG i; read_value = 0; while (i < available_bytes) { - + /* Read 4 bytes from the file. */ status = fx_file_read(&my_file, (void *) &read_value, sizeof(ULONG), &actual); diff --git a/test/regression_test/filex_media_format_open_close_test.c b/test/regression_test/filex_media_format_open_close_test.c index 3aff351..e8967ab 100644 --- a/test/regression_test/filex_media_format_open_close_test.c +++ b/test/regression_test/filex_media_format_open_close_test.c @@ -52,13 +52,13 @@ void filex_media_format_open_close_application_define(void *first_unused_memo #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -98,7 +98,7 @@ UCHAR local_buffer[32]; if (actual < 256) printf("**** ERROR ***** FileX and tests must be built with FX_MAX_LAST_NAME_LEN=256\n"); - /* Print out some test information banners. */ + /* Print out some test information banners. */ printf("FileX Test: Media format, open, and close test....................."); /* Format the media with invalid parameters. */ @@ -106,16 +106,16 @@ UCHAR local_buffer[32]; _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 4097, // Sector size + 256, // Total sectors + 4097, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Check status. */ if (status != FX_SECTOR_INVALID) @@ -130,16 +130,16 @@ UCHAR local_buffer[32]; _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 0, // Sector size + 256, // Total sectors + 0, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Check status. */ if (status != FX_SECTOR_INVALID) @@ -154,16 +154,16 @@ UCHAR local_buffer[32]; _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 129, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Check status. */ if (status != FX_SECTOR_INVALID) @@ -178,16 +178,16 @@ UCHAR local_buffer[32]; _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 0, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Check status. */ if (status != FX_SECTOR_INVALID) @@ -198,20 +198,20 @@ UCHAR local_buffer[32]; } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -220,7 +220,7 @@ UCHAR local_buffer[32]; printf("ERROR!\n"); test_control_return(2); } - + /* Try to close the media before it has been opened */ status = fx_media_close(&ram_disk); if (status != FX_MEDIA_NOT_OPEN) @@ -248,7 +248,7 @@ UCHAR local_buffer[32]; if (status != FX_SUCCESS) { - /* Check for an already created status. This is not fatal, just + /* Check for an already created status. This is not fatal, just let the user know. */ if (status != FX_ALREADY_CREATED) { @@ -268,10 +268,10 @@ UCHAR local_buffer[32]; printf("ERROR!\n"); test_control_return(4); } - + /* test error checking */ #ifndef FX_DISABLE_ERROR_CHECKING - + /* send a null pointer to generate an error */ status = fx_media_close(FX_NULL); if (status != FX_PTR_ERROR) @@ -279,7 +279,7 @@ UCHAR local_buffer[32]; printf("ERROR!\n"); test_control_return(8); } - + /* send null pointer to generate an error */ status = fx_media_open(FX_NULL, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); if (status != FX_PTR_ERROR) @@ -287,7 +287,7 @@ UCHAR local_buffer[32]; printf("ERROR!\n"); test_control_return(11); } - + /* try to open an already open media to generate an error */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); if (status != FX_PTR_ERROR) @@ -295,7 +295,7 @@ UCHAR local_buffer[32]; printf("ERROR!\n"); test_control_return(11); } - + #endif /* FX_DISABLE_ERROR_CHECKING */ /* Seek to the beginning of the test file. */ @@ -371,7 +371,7 @@ UCHAR local_buffer[32]; /* Create a file called TEST.TXT in the root directory. */ status = fx_file_create(&ram_disk, "TEST.TXT"); - /* Check for an already created status. This is not fatal, just + /* Check for an already created status. This is not fatal, just let the user know. */ if (status != FX_ALREADY_CREATED) { @@ -458,20 +458,20 @@ UCHAR local_buffer[32]; } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -481,7 +481,7 @@ UCHAR local_buffer[32]; test_control_return(11); } - /* Corrupt the bytes per sector field. */ + /* Corrupt the bytes per sector field. */ _fx_utility_16_unsigned_write(&ram_disk_memory[FX_BYTES_SECTOR], 0); /* Open the ram_disk. */ @@ -497,20 +497,20 @@ UCHAR local_buffer[32]; } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -520,7 +520,7 @@ UCHAR local_buffer[32]; test_control_return(13); } - /* Corrupt the total sectors field. */ + /* Corrupt the total sectors field. */ _fx_utility_16_unsigned_write(&ram_disk_memory[FX_SECTORS], 0); _fx_utility_32_unsigned_write(&ram_disk_memory[FX_HUGE_SECTORS], 0); @@ -537,20 +537,20 @@ UCHAR local_buffer[32]; } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -560,7 +560,7 @@ UCHAR local_buffer[32]; test_control_return(15); } - /* Corrupt the reserved sectors field. */ + /* Corrupt the reserved sectors field. */ _fx_utility_16_unsigned_write(&ram_disk_memory[FX_RESERVED_SECTORS], 0); /* Open the ram_disk. */ @@ -576,20 +576,20 @@ UCHAR local_buffer[32]; } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -599,7 +599,7 @@ UCHAR local_buffer[32]; test_control_return(17); } - /* Corrupt the sectors per cluster field. */ + /* Corrupt the sectors per cluster field. */ ram_disk_memory[FX_SECTORS_CLUSTER] = 0; /* Open the ram_disk. */ @@ -615,20 +615,20 @@ UCHAR local_buffer[32]; } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -638,10 +638,10 @@ UCHAR local_buffer[32]; test_control_return(19); } - /* Corrupt the sectors per FAT field. */ + /* Corrupt the sectors per FAT field. */ _fx_utility_16_unsigned_write(&ram_disk_memory[FX_SECTORS_PER_FAT], 0); _fx_utility_32_unsigned_write(&ram_disk_memory[FX_SECTORS_PER_FAT_32], 0); - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); @@ -655,20 +655,20 @@ UCHAR local_buffer[32]; } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -678,7 +678,7 @@ UCHAR local_buffer[32]; test_control_return(21); } - /* Corrupt the number of FATs field. */ + /* Corrupt the number of FATs field. */ ram_disk_memory[FX_NUMBER_OF_FATS] = 0; /* Open the ram_disk. */ @@ -698,16 +698,16 @@ UCHAR local_buffer[32]; _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -718,20 +718,20 @@ UCHAR local_buffer[32]; } /* Format the media with an even number of FAT12 sectors. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 256+9, // Total sectors - need 256 clusters for even FAT table logic to be tested - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -755,20 +755,20 @@ UCHAR local_buffer[32]; } /* Format the media with an even number of FAT16 sectors. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 6144+9, // Total sectors - need 6144 clusters for even FAT table logic to be tested - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -793,20 +793,20 @@ UCHAR local_buffer[32]; /* Format the media with an even number of FAT12 sectors. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 256+9, // Total sectors - need 256 clusters for even FAT table logic to be tested - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -834,20 +834,20 @@ UCHAR local_buffer[32]; } /* Format the media with an even number of FAT16 sectors. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 6144+9, // Total sectors - need 6144 clusters for even FAT table logic to be tested - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -875,20 +875,20 @@ UCHAR local_buffer[32]; } /* Format the media with an even number of FAT32 sectors. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70656+9, // Total sectors - FAT32 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -913,20 +913,20 @@ UCHAR local_buffer[32]; /* Format the media with an even number of FAT32 sectors. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70656+9, // Total sectors - FAT32 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -955,20 +955,20 @@ UCHAR local_buffer[32]; } /* Format the media with volume name containing space! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "NO NAME", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 512, // Total sectors - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -1004,20 +1004,20 @@ UCHAR local_buffer[32]; memset(ram_disk_memory, 0, sizeof(ram_disk_memory)); /* Format the media with an even number of FAT32 sectors. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70656+9, // Total sectors - FAT32 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -1031,8 +1031,8 @@ UCHAR local_buffer[32]; /* Check the FAT entry values, first byte starts with 0xF(_fx_media_format_media_type) */ for(index=0; index< ((70656+9)*128);index++) { - if((ram_disk_memory[index]==0xF8) && (ram_disk_memory[index+1]==0xFF) && (ram_disk_memory[index+2]==0xFF) && - (ram_disk_memory[index+3]==0x0F) && (ram_disk_memory[index+4]==0xFF) && (ram_disk_memory[index+5]==0xFF) && + if((ram_disk_memory[index]==0xF8) && (ram_disk_memory[index+1]==0xFF) && (ram_disk_memory[index+2]==0xFF) && + (ram_disk_memory[index+3]==0x0F) && (ram_disk_memory[index+4]==0xFF) && (ram_disk_memory[index+5]==0xFF) && (ram_disk_memory[index+6]==0xFF) && (ram_disk_memory[index+7]==0x0F)) { break; @@ -1051,6 +1051,6 @@ UCHAR local_buffer[32]; test_control_return(0); } - + } diff --git a/test/regression_test/filex_media_hidden_sectors_test.c b/test/regression_test/filex_media_hidden_sectors_test.c index 2ae0fff..ab7eed8 100644 --- a/test/regression_test/filex_media_hidden_sectors_test.c +++ b/test/regression_test/filex_media_hidden_sectors_test.c @@ -52,13 +52,13 @@ void filex_media_hidden_sectors_test_application_define(void *first_unused_me #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -92,20 +92,20 @@ UINT status; printf("FileX Test: Media Hidden Sectors Test.............................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, hidden_sectors_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries HIDDEN_SECTORS, // Hidden sectors - 256, // Total sectors - SECTOR_SIZE, // Sector size + 256, // Total sectors + SECTOR_SIZE, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -141,7 +141,7 @@ UINT status; } /* Close the media. */ - status = fx_media_close(&ram_disk); + status = fx_media_close(&ram_disk); /* Check the file open status. */ if (status != FX_SUCCESS) @@ -188,7 +188,7 @@ UINT status; } /* Close the media. */ - status = fx_media_close(&ram_disk); + status = fx_media_close(&ram_disk); /* Check the file open status. */ if (status != FX_SUCCESS) @@ -217,7 +217,7 @@ static VOID hidden_sectors_driver(FX_MEDIA *media_ptr) { UCHAR *source_buffer; UCHAR *destination_buffer; -UINT bytes_per_sector; +UINT bytes_per_sector; if (media_ptr -> fx_media_driver_request == FX_DRIVER_BOOT_READ) { @@ -225,7 +225,7 @@ UINT bytes_per_sector; /* Read the boot record and return to the caller. */ /* Calculate the RAM disk boot sector offset, which is at the very beginning of the - RAM disk. Note the RAM disk memory is pointed to by the fx_media_driver_info pointer, + RAM disk. Note the RAM disk memory is pointed to by the fx_media_driver_info pointer, which is supplied by the application in the call to fx_media_open. */ source_buffer = (UCHAR *) media_ptr -> fx_media_driver_info; source_buffer += SECTOR_SIZE * HIDDEN_SECTORS; @@ -260,7 +260,7 @@ UINT bytes_per_sector; /* Write the boot record and return to the caller. */ /* Calculate the RAM disk boot sector offset, which is at the very beginning of the - RAM disk. Note the RAM disk memory is pointed to by the fx_media_driver_info pointer, + RAM disk. Note the RAM disk memory is pointed to by the fx_media_driver_info pointer, which is supplied by the application in the call to fx_media_open. */ destination_buffer = (UCHAR *) media_ptr -> fx_media_driver_info; destination_buffer += SECTOR_SIZE * HIDDEN_SECTORS; diff --git a/test/regression_test/filex_media_multiple_open_close_test.c b/test/regression_test/filex_media_multiple_open_close_test.c index a9de735..9ec0267 100644 --- a/test/regression_test/filex_media_multiple_open_close_test.c +++ b/test/regression_test/filex_media_multiple_open_close_test.c @@ -89,13 +89,13 @@ void filex_media_multiple_format_open_close_application_define(void *first_un #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -142,36 +142,36 @@ ULONG temp3; printf("FileX Test: Multiple Media format, open and close test............."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Format the second media. This needs to be done before opening it! */ - status += fx_media_format(&ram_disk, + status += fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory1, // RAM disk memory pointer cache_buffer1, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ @@ -319,7 +319,7 @@ ULONG temp3; status = fx_file_create(&ram_disk, "TEST.TXT"); status1= fx_file_create(&ram_disk1, "TEST.TXT"); - /* Check for an already created status. This is not fatal, just + /* Check for an already created status. This is not fatal, just let the user know. */ if (status != FX_ALREADY_CREATED) { @@ -328,7 +328,7 @@ ULONG temp3; test_control_return(3); } - /* Check for an already created status. This is not fatal, just + /* Check for an already created status. This is not fatal, just let the user know. */ if (status1 != FX_ALREADY_CREATED) { @@ -440,7 +440,7 @@ ULONG temp3; status = fx_file_create(&ram_disk, "TEST.TXT"); status1= fx_file_create(&ram_disk1, "TEST.TXT"); - /* Check for an already created status. This is not fatal, just + /* Check for an already created status. This is not fatal, just let the user know. */ if (status != FX_ALREADY_CREATED) { @@ -449,7 +449,7 @@ ULONG temp3; test_control_return(11); } - /* Check for an already created status. This is not fatal, just + /* Check for an already created status. This is not fatal, just let the user know. */ if (status1 != FX_ALREADY_CREATED) { @@ -532,20 +532,20 @@ ULONG temp3; /* FAT32 Test for sixteen files and multiple open/close calls. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70000, // Total sectors - FAT32 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -619,7 +619,7 @@ ULONG temp3; /* Open the media again. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); - /* And close it again. */ + /* And close it again. */ status += fx_media_close(&ram_disk); /* Determine if the test was successful. */ @@ -628,11 +628,11 @@ ULONG temp3; printf("ERROR!\n"); test_control_return(21); - } + } /* Test the notify registration functions. */ - /* Setup notify routines for open and close. */ + /* Setup notify routines for open and close. */ status = fx_media_open_notify_set(&ram_disk, ram_disk_open); status += fx_media_close_notify_set(&ram_disk,ram_disk_close); @@ -666,25 +666,25 @@ ULONG temp3; printf("ERROR!\n"); test_control_return(24); - } + } /* FAT32 Test for the additional information sector. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 6000, // Total sectors - FAT16 - 512, // Sector size + 512, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status != FX_SUCCESS) @@ -716,7 +716,7 @@ ULONG temp3; } /* Now setup the media's additional information sector. */ - ram_disk.fx_media_FAT32_additional_info_sector = (my_file.fx_file_first_physical_cluster - 2) + ram_disk.fx_media_data_sector_start; + ram_disk.fx_media_FAT32_additional_info_sector = (my_file.fx_file_first_physical_cluster - 2) + ram_disk.fx_media_data_sector_start; /* Now set the last available clusters to the current available clusters. */ ram_disk.fx_media_FAT32_additional_info_last_available = ram_disk.fx_media_available_clusters; @@ -725,7 +725,7 @@ ULONG temp3; status += fx_media_flush(&ram_disk); /* Now setup the media's additional information sector. */ - ram_disk.fx_media_FAT32_additional_info_sector = (my_file.fx_file_first_physical_cluster - 2) + ram_disk.fx_media_data_sector_start; + ram_disk.fx_media_FAT32_additional_info_sector = (my_file.fx_file_first_physical_cluster - 2) + ram_disk.fx_media_data_sector_start; /* Now set the last available clusters to the current available clusters. */ ram_disk.fx_media_FAT32_additional_info_last_available = ram_disk.fx_media_available_clusters; @@ -739,7 +739,7 @@ ULONG temp3; printf("ERROR!\n"); test_control_return(26); - } + } /* Open the media again. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); @@ -751,10 +751,10 @@ ULONG temp3; printf("ERROR!\n"); test_control_return(27); - } + } /* Now setup the media's additional information sector. */ - ram_disk.fx_media_FAT32_additional_info_sector = (my_file.fx_file_first_physical_cluster - 2) + ram_disk.fx_media_data_sector_start; + ram_disk.fx_media_FAT32_additional_info_sector = (my_file.fx_file_first_physical_cluster - 2) + ram_disk.fx_media_data_sector_start; /* Now clear the last available clusters to the current available clusters. */ ram_disk.fx_media_FAT32_additional_info_last_available = 0; @@ -766,7 +766,7 @@ ULONG temp3; status += fx_media_flush(&ram_disk); /* Now setup the media's additional information sector. */ - ram_disk.fx_media_FAT32_additional_info_sector = (my_file.fx_file_first_physical_cluster - 2) + ram_disk.fx_media_data_sector_start; + ram_disk.fx_media_FAT32_additional_info_sector = (my_file.fx_file_first_physical_cluster - 2) + ram_disk.fx_media_data_sector_start; /* Now clear the last available clusters to the current available clusters. */ ram_disk.fx_media_FAT32_additional_info_last_available = 0; @@ -783,7 +783,7 @@ ULONG temp3; printf("ERROR!\n"); test_control_return(28); - } + } /* Open the media again. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); @@ -795,10 +795,10 @@ ULONG temp3; printf("ERROR!\n"); test_control_return(27); - } + } /* Now setup the media's additional information sector. */ - ram_disk.fx_media_FAT32_additional_info_sector = (my_file.fx_file_first_physical_cluster - 2) + ram_disk.fx_media_data_sector_start; + ram_disk.fx_media_FAT32_additional_info_sector = (my_file.fx_file_first_physical_cluster - 2) + ram_disk.fx_media_data_sector_start; /* Now clear the last available clusters to the current available clusters. */ ram_disk.fx_media_FAT32_additional_info_last_available = 0; @@ -810,7 +810,7 @@ ULONG temp3; status += fx_media_flush(&ram_disk); /* Now setup the media's additional information sector. */ - ram_disk.fx_media_FAT32_additional_info_sector = (my_file.fx_file_first_physical_cluster - 2) + ram_disk.fx_media_data_sector_start; + ram_disk.fx_media_FAT32_additional_info_sector = (my_file.fx_file_first_physical_cluster - 2) + ram_disk.fx_media_data_sector_start; /* Now clear the last available clusters to the current available clusters. */ ram_disk.fx_media_FAT32_additional_info_last_available = 0; @@ -827,7 +827,7 @@ ULONG temp3; printf("ERROR!\n"); test_control_return(29); - } + } /* Open the media again. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); @@ -840,10 +840,10 @@ ULONG temp3; printf("ERROR!\n"); test_control_return(30); - } + } /* Now setup the media's additional information sector. */ - ram_disk.fx_media_FAT32_additional_info_sector = (my_file.fx_file_first_physical_cluster - 2) + ram_disk.fx_media_data_sector_start; + ram_disk.fx_media_FAT32_additional_info_sector = (my_file.fx_file_first_physical_cluster - 2) + ram_disk.fx_media_data_sector_start; /* Now clear the last available clusters to the current available clusters. */ ram_disk.fx_media_FAT32_additional_info_last_available = 0; @@ -865,7 +865,7 @@ ULONG temp3; status += fx_media_flush(&ram_disk); /* Now setup the media's additional information sector. */ - ram_disk.fx_media_FAT32_additional_info_sector = (my_file.fx_file_first_physical_cluster - 2) + ram_disk.fx_media_data_sector_start; + ram_disk.fx_media_FAT32_additional_info_sector = (my_file.fx_file_first_physical_cluster - 2) + ram_disk.fx_media_data_sector_start; /* Now clear the last available clusters to the current available clusters. */ ram_disk.fx_media_FAT32_additional_info_last_available = 0; @@ -882,7 +882,7 @@ ULONG temp3; printf("ERROR!\n"); test_control_return(31); - } + } /* Open the media again. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); @@ -895,10 +895,10 @@ ULONG temp3; printf("ERROR!\n"); test_control_return(32); - } + } /* Now setup the media's additional information sector. */ - ram_disk.fx_media_FAT32_additional_info_sector = (my_file.fx_file_first_physical_cluster - 2) + ram_disk.fx_media_data_sector_start; + ram_disk.fx_media_FAT32_additional_info_sector = (my_file.fx_file_first_physical_cluster - 2) + ram_disk.fx_media_data_sector_start; /* Now clear the last available clusters to the current available clusters. */ ram_disk.fx_media_FAT32_additional_info_last_available = 0; @@ -935,7 +935,7 @@ ULONG temp3; printf("ERROR!\n"); test_control_return(33); - } + } /* Create some additional files. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); @@ -950,7 +950,7 @@ ULONG temp3; status += fx_file_create(&ram_disk, "TEXT9.TXT"); status += fx_file_create(&ram_disk, "TEXT10.TXT"); status += fx_file_create(&ram_disk, "TEXT11.TXT"); - status += fx_media_close(&ram_disk); + status += fx_media_close(&ram_disk); /* Determine if the test was successful. */ if (status != FX_SUCCESS) @@ -958,7 +958,7 @@ ULONG temp3; printf("ERROR!\n"); test_control_return(34); - } + } /* Loop to create the environment for I/O errors... */ for (i = 0; i < 1000; i++) @@ -997,7 +997,7 @@ ULONG temp3; printf("ERROR!\n"); test_control_return(34); - } + } /* Now temporarily set the write protect flag. */ ram_disk.fx_media_driver_write_protect = FX_FALSE; @@ -1010,10 +1010,10 @@ ULONG temp3; printf("ERROR!\n"); test_control_return(34); - } + } /* Now setup the media's additional information sector. */ - ram_disk.fx_media_FAT32_additional_info_sector = (my_file.fx_file_first_physical_cluster - 2) + ram_disk.fx_media_data_sector_start; + ram_disk.fx_media_FAT32_additional_info_sector = (my_file.fx_file_first_physical_cluster - 2) + ram_disk.fx_media_data_sector_start; /* Now clear the last available clusters to the current available clusters. */ ram_disk.fx_media_FAT32_additional_info_last_available = 0; @@ -1021,13 +1021,13 @@ ULONG temp3; /* Create I/O errors via the RAM driver interface. */ j = (UINT)(rand() % 10); if (j == 0) - j = 1; + j = 1; _fx_ram_driver_io_error_request = j; fx_media_flush(&ram_disk); /* Now setup the media's additional information sector. */ - ram_disk.fx_media_FAT32_additional_info_sector = (my_file.fx_file_first_physical_cluster - 2) + ram_disk.fx_media_data_sector_start; + ram_disk.fx_media_FAT32_additional_info_sector = (my_file.fx_file_first_physical_cluster - 2) + ram_disk.fx_media_data_sector_start; /* Now clear the last available clusters to the current available clusters. */ ram_disk.fx_media_FAT32_additional_info_last_available = 0; @@ -1035,16 +1035,16 @@ ULONG temp3; /* Create I/O errors via the RAM driver interface. */ j = (UINT)(rand() % 10); if (j == 0) - j = 1; + j = 1; _fx_ram_driver_io_error_request = j; - /* Close the media... This will attempt to look for the additional information sector and succeed in updating the additional sector. */ - fx_media_close(&ram_disk); + /* Close the media... This will attempt to look for the additional information sector and succeed in updating the additional sector. */ + fx_media_close(&ram_disk); /* Create I/O errors via the RAM driver interface. */ j = (UINT)(rand() % 10); if (j == 0) - j = 1; + j = 1; _fx_ram_driver_io_error_request = j; /* Set the volume. */ @@ -1053,7 +1053,7 @@ ULONG temp3; /* Create I/O errors via the RAM driver interface. */ j = (UINT)(rand() % 10); if (j == 0) - j = 1; + j = 1; _fx_ram_driver_io_error_request = j; /* Get the volume. */ @@ -1071,26 +1071,26 @@ ULONG temp3; printf("ERROR!\n"); test_control_return(33); - } + } /* Additional media open/close corner case tests... including I/O errors. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 6000, // Total sectors - FAT16 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status != FX_SUCCESS) @@ -1177,20 +1177,20 @@ ULONG temp3; fx_media_abort(&ram_disk); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70000, // Total sectors - FAT32 - 512, // Sector size + 512, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status != FX_SUCCESS) @@ -1216,7 +1216,7 @@ ULONG temp3; { /* Write a FAT chain link that exceeds the FAT area. */ status += _fx_utility_FAT_entry_write(&ram_disk, i, i+1); - } + } /* Now close the media. */ status = fx_media_close(&ram_disk); @@ -1245,20 +1245,20 @@ ULONG temp3; /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70000, // Total sectors - FAT32 - 512, // Sector size + 512, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status != FX_SUCCESS) @@ -1281,7 +1281,7 @@ ULONG temp3; /* Write a FAT chain link to check (cluster_number == FAT_entry). */ status = _fx_utility_FAT_entry_write(&ram_disk, 2, 2+1); - + /* Check for error. */ if (status != FX_SUCCESS) { @@ -1311,25 +1311,25 @@ ULONG temp3; printf("ERROR!\n"); test_control_return(41); } - + /* Abort the media. */ fx_media_abort(&ram_disk); - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70000, // Total sectors - FAT32 - 512, // Sector size + 512, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status != FX_SUCCESS) @@ -1501,20 +1501,20 @@ ULONG temp3; } /* Format the media in FAT12 for testing I/O error on available clusters in media open. */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 2000, // Total sectors - FAT12 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status != FX_SUCCESS) @@ -1538,23 +1538,23 @@ ULONG temp3; } /* Abort the media. */ - fx_media_abort(&ram_disk); + fx_media_abort(&ram_disk); /* Format the media in FAT16 for testing I/O error on available clusters in media open. */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 7000, // Total sectors - FAT16 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status != FX_SUCCESS) @@ -1580,7 +1580,7 @@ ULONG temp3; /* Abort the media. */ fx_media_abort(&ram_disk); - /* Open the media again to setup for a media close I/O error. */ + /* Open the media again to setup for a media close I/O error. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); /* Check for error. */ @@ -1591,7 +1591,7 @@ ULONG temp3; test_control_return(57); } - /* Create a file. */ + /* Create a file. */ status = fx_file_create(&ram_disk, "TEST.TXT"); /* Check for error. */ @@ -1641,20 +1641,20 @@ ULONG temp3; fx_media_abort(&ram_disk); /* Format the media in FAT16 for testing I/O error in media close. */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 7000, // Total sectors - FAT16 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status != FX_SUCCESS) @@ -1664,7 +1664,7 @@ ULONG temp3; test_control_return(62); } - /* Open the media again to setup for a media close I/O error. */ + /* Open the media again to setup for a media close I/O error. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); /* Check for error. */ @@ -1675,7 +1675,7 @@ ULONG temp3; test_control_return(63); } - /* Create a file. */ + /* Create a file. */ status = fx_file_create(&ram_disk, "TEST.TXT"); /* Check for error. */ @@ -1731,13 +1731,13 @@ ULONG temp3; printf("ERROR!\n"); test_control_return(66); - } + } #ifndef FX_DISABLE_CACHE #ifdef FX_FAULT_TOLERANT /* While FX__FAULT_TOLERANT is defined, non data sector will flush directly in _fx_utility_logical_sector_write rather than set dirty flag. */ /* For this reason, driver won't be called in _fx_utility_logical_sector_flush which is different from non FAULT_TOLERANT code. */ - _fx_utility_logical_sector_flush_error_request = 1; + _fx_utility_logical_sector_flush_error_request = 1; status = fx_media_close(&ram_disk); #else /* Now attemp to close the media, but with an I/O error introduced so the close will fail trying to write out the directory entry of the open file. */ @@ -1757,22 +1757,22 @@ ULONG temp3; /* Finallay, abort the media. */ fx_media_abort(&ram_disk); - + /* Format the media in FAT16 for testing I/O error in media flush. */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 7000, // Total sectors - FAT16 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status != FX_SUCCESS) @@ -1782,18 +1782,18 @@ ULONG temp3; test_control_return(68); } - /* Open the media again to setup for a media close I/O error. */ + /* Open the media again to setup for a media close I/O error. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); /* Check for error. */ if (status != FX_SUCCESS) { - + printf("ERROR!\n"); test_control_return(69); } - /* Create a file. */ + /* Create a file. */ status = fx_file_create(&ram_disk, "TEST.TXT"); /* Check for error. */ @@ -1806,7 +1806,7 @@ ULONG temp3; /* Open the test files. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); - + /* Check for error. */ if (status != FX_SUCCESS) { @@ -1814,7 +1814,7 @@ ULONG temp3; printf("ERROR!\n"); test_control_return(71); } - + /* Write to the file. */ status += fx_file_write(&my_file, "1234567890", 10); status += fx_file_write(&my_file, "1234567890", 10); @@ -1842,21 +1842,21 @@ ULONG temp3; status += fx_file_write(&my_file, "1234567890", 10); status += fx_media_read(&ram_disk, 2000, raw_sector_buffer); status += fx_media_write(&ram_disk, 2000, raw_sector_buffer); - + /* Check for error. */ if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(72); - } - + } + #if defined(FX_FAULT_TOLERANT) && !defined(FX_DISABLE_CACHE) /* While FX__FAULT_TOLERANT is defined, non data sector will flush directly in _fx_utility_logical_sector_write rather than set dirty flag. */ /* For this reason, driver won't be called in _fx_utility_logical_sector_flush which is different from non FAULT_TOLERANT code. */ - _fx_utility_logical_sector_flush_error_request = 1; + _fx_utility_logical_sector_flush_error_request = 1; status = fx_media_close(&ram_disk); -#else +#else /* Now attemp to flush the media, but with an I/O error introduced so the close will fail trying to write out the directory entry of the open file. */ _fx_ram_driver_io_error_request = 1; status = fx_media_flush(&ram_disk); @@ -1875,20 +1875,20 @@ ULONG temp3; /* Format the media in FAT16 for testing I/O error in media flush. */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 7000, // Total sectors - FAT16 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status != FX_SUCCESS) @@ -1898,18 +1898,18 @@ ULONG temp3; test_control_return(68); } - /* Open the media again to setup for a media close I/O error. */ + /* Open the media again to setup for a media close I/O error. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); /* Check for error. */ if (status != FX_SUCCESS) { - + printf("ERROR!\n"); test_control_return(69); } - /* Create a file. */ + /* Create a file. */ status = fx_file_create(&ram_disk, "TEST.TXT"); /* Check for error. */ @@ -1922,7 +1922,7 @@ ULONG temp3; /* Open the test files. */ status = fx_file_open(&ram_disk, &my_file, "TEST.TXT", FX_OPEN_FOR_WRITE); - + /* Check for error. */ if (status != FX_SUCCESS) { @@ -1930,7 +1930,7 @@ ULONG temp3; printf("ERROR!\n"); test_control_return(71); } - + /* Write to the file. */ status += fx_file_write(&my_file, "1234567890", 10); status += fx_file_write(&my_file, "1234567890", 10); @@ -1958,20 +1958,20 @@ ULONG temp3; status += fx_file_write(&my_file, "1234567890", 10); status += fx_media_read(&ram_disk, 2000, raw_sector_buffer); status += fx_media_write(&ram_disk, 2000, raw_sector_buffer); - + /* Check for error. */ if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(72); - } - + } + #ifndef FX_DISABLE_CACHE #ifdef FX_FAULT_TOLERANT /* While FX__FAULT_TOLERANT is defined, non data sector will flush directly in _fx_utility_logical_sector_write rather than set dirty flag. */ /* For this reason, driver won't be called in _fx_utility_logical_sector_flush which is different from non FAULT_TOLERANT code. */ - _fx_utility_logical_sector_flush_error_request = 1; + _fx_utility_logical_sector_flush_error_request = 1; status = fx_media_close(&ram_disk); #else /* Now attemp to flush the media, but with an I/O error introduced so the close will fail trying to flush logical sectors out. */ @@ -1979,7 +1979,7 @@ ULONG temp3; status = fx_media_flush(&ram_disk); _fx_ram_driver_io_error_request = 0; #endif - + /* Check for the I/O error. */ if (status != FX_IO_ERROR) { @@ -1991,23 +1991,23 @@ ULONG temp3; /* Finallay, abort the media. */ fx_media_abort(&ram_disk); - + /* Now see if we can test the FAT32 format with I/O corner cases. */ _fx_ram_driver_io_error_request = 2211; - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70657, // Total sectors - FAT32 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track _fx_ram_driver_io_error_request = 0; diff --git a/test/regression_test/filex_media_read_write_sector_test.c b/test/regression_test/filex_media_read_write_sector_test.c index cebd127..86f1f0a 100644 --- a/test/regression_test/filex_media_read_write_sector_test.c +++ b/test/regression_test/filex_media_read_write_sector_test.c @@ -58,13 +58,13 @@ void filex_media_read_write_sector_application_define(void *first_unused_memo #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -73,7 +73,7 @@ UCHAR *pointer; cache_buffer = pointer; pointer = pointer + CACHE_SIZE; direct_buffer = pointer; - pointer = pointer + 20*128; + pointer = pointer + 20*128; ram_disk_memory = pointer; #endif @@ -113,47 +113,47 @@ ULONG64 accessed_sectors[300]; #endif /* FX_FAULT_TOLERANT */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 2, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); - + /* try to read before the media has been opened */ - status = fx_media_read(&ram_disk, 1, (VOID *) raw_sector_buffer); + status = fx_media_read(&ram_disk, 1, (VOID *) raw_sector_buffer); return_if_fail( status == FX_MEDIA_NOT_OPEN); - + /* try to write before the media has been opened */ - status = fx_media_write(&ram_disk, 1, (VOID *) raw_sector_buffer); + status = fx_media_write(&ram_disk, 1, (VOID *) raw_sector_buffer); return_if_fail( status == FX_MEDIA_NOT_OPEN); /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); - + /* try to write while the media is write protected */ ram_disk.fx_media_driver_write_protect = FX_TRUE; - status = fx_media_write(&ram_disk, 1, (VOID *) raw_sector_buffer); + status = fx_media_write(&ram_disk, 1, (VOID *) raw_sector_buffer); ram_disk.fx_media_driver_write_protect = FX_FALSE; return_if_fail( status == FX_WRITE_PROTECT); - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING /* send null pointer to generate an error */ status = fx_media_read(FX_NULL, 0, (void *) raw_sector_buffer); return_if_fail( status == FX_PTR_ERROR); - + /* send null pointer to generate an error */ status = fx_media_write(FX_NULL, 0, (void *) raw_sector_buffer); return_if_fail( status == FX_PTR_ERROR); @@ -161,35 +161,35 @@ ULONG64 accessed_sectors[300]; #endif /* FX_DISABLE_ERROR_CHECKING */ /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 1, (VOID *) raw_sector_buffer); - return_if_fail ((status == FX_SUCCESS) && + status = fx_media_read(&ram_disk, 1, (VOID *) raw_sector_buffer); + return_if_fail ((status == FX_SUCCESS) && (raw_sector_buffer[0] == 0xF8) && /* _fx_media_format_media_type value set during media format */ (raw_sector_buffer[1] == 0xFF) && (raw_sector_buffer[2] == 0xFF)); - + /* Write the same, unchanged sector back. */ - status = fx_media_write(&ram_disk, 1, (VOID *) raw_sector_buffer); + status = fx_media_write(&ram_disk, 1, (VOID *) raw_sector_buffer); return_if_fail( status == FX_SUCCESS); /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 2, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 7000, // Total sectors - 128, // Sector size + 7000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -207,7 +207,7 @@ ULONG64 accessed_sectors[300]; logical_sector = 0xFFFFFFFF; status = _fx_utility_logical_sector_write(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DATA_SECTOR); return_if_fail( status == FX_SECTOR_INVALID); - + /* Test for invalid sector. */ logical_sector = ram_disk.fx_media_total_sectors; status = _fx_utility_logical_sector_write(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 4, FX_DATA_SECTOR); @@ -222,12 +222,12 @@ ULONG64 accessed_sectors[300]; logical_sector = 0xFFFFFFFF; status = _fx_utility_logical_sector_write(&ram_disk, logical_sector, direct_buffer, 4, FX_DATA_SECTOR); return_if_fail( status == FX_SECTOR_INVALID); - + /* Test for invalid sector. */ logical_sector = ram_disk.fx_media_total_sectors; status = _fx_utility_logical_sector_write(&ram_disk, logical_sector, direct_buffer, 4, FX_DATA_SECTOR); return_if_fail( status == FX_SECTOR_INVALID); - + /* Write to a sector not in the cache. */ status = _fx_utility_logical_sector_write(&ram_disk, 6900, ram_disk.fx_media_memory_buffer, 1, FX_DATA_SECTOR); @@ -236,7 +236,7 @@ ULONG64 accessed_sectors[300]; logical_sector = ram_disk.fx_media_data_sector_start + 4; for (i = 0; i < 256; i++) { - + status += _fx_utility_logical_sector_read(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DIRECTORY_SECTOR); #ifdef FX_FAULT_TOLERANT if (first_test) @@ -252,13 +252,13 @@ ULONG64 accessed_sectors[300]; #endif logical_sector++; } - + /* At this point the cache is complete full. */ - + /* Now perform direct buffer read ram_disk.fx_media_data_sector_start on sectors before the cache. */ logical_sector = + 2; status = _fx_utility_logical_sector_read(&ram_disk, logical_sector, direct_buffer, 4, FX_DIRECTORY_SECTOR); - + /* Now perform direct buffer write. */ #ifdef FX_FAULT_TOLERANT if (first_test) @@ -272,7 +272,7 @@ ULONG64 accessed_sectors[300]; #ifdef FX_FAULT_TOLERANT } #endif - + /* Perform a flush. */ status += _fx_utility_logical_sector_flush(&ram_disk, logical_sector, 300, FX_TRUE); @@ -283,7 +283,7 @@ ULONG64 accessed_sectors[300]; logical_sector = ram_disk.fx_media_data_sector_start + 4; for (i = 0; i < 256; i++) { - + status += _fx_utility_logical_sector_read(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DIRECTORY_SECTOR); #ifdef FX_FAULT_TOLERANT if (first_test) @@ -303,7 +303,7 @@ ULONG64 accessed_sectors[300]; /* Now perform direct buffer read ram_disk.fx_media_data_sector_start on sectors before the cache. */ logical_sector = (ULONG64)-2; status = _fx_utility_logical_sector_read(&ram_disk, logical_sector, direct_buffer, 4, FX_DIRECTORY_SECTOR); - + /* Now perform direct buffer write. */ #ifdef FX_FAULT_TOLERANT if (first_test) @@ -325,7 +325,7 @@ ULONG64 accessed_sectors[300]; logical_sector = ram_disk.fx_media_data_sector_start + 4; for (i = 0; i < 512; i++) { - + status += _fx_utility_logical_sector_read(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DIRECTORY_SECTOR); #ifdef FX_FAULT_TOLERANT if (first_test) @@ -349,15 +349,15 @@ ULONG64 accessed_sectors[300]; logical_sector = ram_disk.fx_media_data_sector_start + 4; for (i = 0; i < 256; i++) { - + status += _fx_utility_logical_sector_read(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DIRECTORY_SECTOR); logical_sector++; } /* Write same 256 sectors in reverse order. */ for (i = 0; i < 256; i++) - { - + { + logical_sector--; #ifdef FX_FAULT_TOLERANT if (first_test) @@ -381,16 +381,16 @@ ULONG64 accessed_sectors[300]; /* Flush the FAT. */ status += _fx_utility_FAT_map_flush(&ram_disk); - + /* Indicate that the driver needs to know! */ ram_disk.fx_media_driver_free_sector_update = FX_TRUE; - + /* Update FAT entries again, but this time with free marker. */ for (i = 2; i < 6000; i++) { status += _fx_utility_FAT_entry_write(&ram_disk, (ULONG) i, FX_FREE_CLUSTER); } - + /* Flush the FAT. */ status += _fx_utility_FAT_map_flush(&ram_disk); ram_disk.fx_media_driver_free_sector_update = FX_FALSE; @@ -398,7 +398,7 @@ ULONG64 accessed_sectors[300]; /* Random test of 300 sectors. */ for (i = 0; i < 300; i++) { - accessed_sectors[i] = logical_sector + (ULONG64)(rand() % 5000); + accessed_sectors[i] = logical_sector + (ULONG64)(rand() % 5000); status += _fx_utility_logical_sector_read(&ram_disk, accessed_sectors[i], ram_disk.fx_media_memory_buffer, 1, FX_DATA_SECTOR); if ((i > 0) && (rand() & 1)) { @@ -410,7 +410,7 @@ ULONG64 accessed_sectors[300]; /* Random test of 300 sectors with random logical sector flush. */ for (i = 0; i < 300; i++) { - accessed_sectors[i] = logical_sector + (ULONG64)(rand() % 5000); + accessed_sectors[i] = logical_sector + (ULONG64)(rand() % 5000); status += _fx_utility_logical_sector_read(&ram_disk, accessed_sectors[i], ram_disk.fx_media_memory_buffer, 1, FX_DATA_SECTOR); if ((i > 0) && (rand() & 1)) { @@ -423,14 +423,14 @@ ULONG64 accessed_sectors[300]; if (rand() & 1) status += _fx_utility_logical_sector_flush(&ram_disk, accessed_sectors[j], 1, FX_TRUE); else - status += _fx_utility_logical_sector_flush(&ram_disk, accessed_sectors[j], 1, FX_FALSE); + status += _fx_utility_logical_sector_flush(&ram_disk, accessed_sectors[j], 1, FX_FALSE); } } /* Random test of 1000 FAT entry reads/writes. */ for (i = 0; i < 1000; i++) { - + j = ((UINT)rand() % 100); status += _fx_utility_FAT_entry_read(&ram_disk, j+2, &fat_entry); @@ -440,14 +440,14 @@ ULONG64 accessed_sectors[300]; if (rand() & 1) status += _fx_utility_FAT_entry_write(&ram_disk, j+2, j+3); else - status += _fx_utility_FAT_entry_write(&ram_disk, j+2, FX_FREE_CLUSTER); + status += _fx_utility_FAT_entry_write(&ram_disk, j+2, FX_FREE_CLUSTER); } } - + /* Random test of 1000 FAT entry reads/writes with random FAT flush. */ for (i = 0; i < 1000; i++) { - + j = ((UINT)rand() % 100); status += _fx_utility_FAT_entry_read(&ram_disk, j+2, &fat_entry); @@ -457,18 +457,18 @@ ULONG64 accessed_sectors[300]; if (rand() & 1) status += _fx_utility_FAT_entry_write(&ram_disk, j+2, j+3); else - status += _fx_utility_FAT_entry_write(&ram_disk, j+2, FX_FREE_CLUSTER); + status += _fx_utility_FAT_entry_write(&ram_disk, j+2, FX_FREE_CLUSTER); } - + if (rand() & 1) { - + status += _fx_utility_FAT_flush(&ram_disk); } if (rand() & 1) { - + status += _fx_utility_FAT_map_flush(&ram_disk); } } @@ -483,7 +483,7 @@ ULONG64 accessed_sectors[300]; _fx_ram_driver_io_error_request = 1000; for (i = 0; i < 300000; i++) { - + j = ((UINT)rand() % 100); _fx_utility_FAT_entry_read(&ram_disk, j+2, &fat_entry); @@ -493,9 +493,9 @@ ULONG64 accessed_sectors[300]; if (rand() & 1) _fx_utility_FAT_entry_write(&ram_disk, j+2, j+3); else - _fx_utility_FAT_entry_write(&ram_disk, j+2, FX_FREE_CLUSTER); + _fx_utility_FAT_entry_write(&ram_disk, j+2, FX_FREE_CLUSTER); } - + if (i & 1) _fx_utility_FAT_flush(&ram_disk); else @@ -514,7 +514,7 @@ ULONG64 accessed_sectors[300]; logical_sector = ram_disk.fx_media_data_sector_start + 4; for (i = 0; i < 256; i++) { - + status += _fx_utility_logical_sector_read(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DIRECTORY_SECTOR); #ifdef FX_FAULT_TOLERANT if (first_test) @@ -544,7 +544,7 @@ ULONG64 accessed_sectors[300]; logical_sector = ram_disk.fx_media_data_sector_start + 4; for (i = 0; i < 256; i++) { - + status += _fx_utility_logical_sector_read(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DIRECTORY_SECTOR); #ifdef FX_FAULT_TOLERANT if (first_test) @@ -573,7 +573,7 @@ ULONG64 accessed_sectors[300]; logical_sector = ram_disk.fx_media_data_sector_start + 4; for (i = 0; i < 256; i++) { - + status += _fx_utility_logical_sector_read(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DIRECTORY_SECTOR); #ifdef FX_FAULT_TOLERANT if (first_test) @@ -598,21 +598,21 @@ ULONG64 accessed_sectors[300]; return_if_fail( status == FX_SUCCESS); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 2, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 7000, // Total sectors - 128, // Sector size + 7000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track - + 1); // Sectors per track + /* Open the ram_disk. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE-1); return_if_fail( status == FX_SUCCESS); @@ -646,33 +646,33 @@ ULONG64 accessed_sectors[300]; logical_sector = 0xFFFFFFFF; status = _fx_utility_logical_sector_write(&ram_disk, logical_sector, direct_buffer, 4, FX_DATA_SECTOR); return_if_fail( status == FX_SECTOR_INVALID); - + /* Test for invalid sector. */ logical_sector = ram_disk.fx_media_total_sectors; status = _fx_utility_logical_sector_write(&ram_disk, logical_sector, direct_buffer, 4, FX_DATA_SECTOR); return_if_fail( status == FX_SECTOR_INVALID); - + status = 0; /* Read/write 256 sectors, filling the caches. */ logical_sector = ram_disk.fx_media_data_sector_start + 4; for (i = 0; i < 256; i++) { - + status += _fx_utility_logical_sector_read(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DIRECTORY_SECTOR); status += _fx_utility_logical_sector_write(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DATA_SECTOR); logical_sector++; } - + /* At this point the cache is complete full. */ - + /* Now perform direct buffer read ram_disk.fx_media_data_sector_start on sectors before the cache. */ logical_sector = + 2; status = _fx_utility_logical_sector_read(&ram_disk, logical_sector, direct_buffer, 4, FX_DIRECTORY_SECTOR); - + /* Now perform direct buffer write. */ status += _fx_utility_logical_sector_write(&ram_disk, logical_sector, direct_buffer, 4, FX_DATA_SECTOR); - + /* Perform a flush. */ status += _fx_utility_logical_sector_flush(&ram_disk, logical_sector, 300, FX_TRUE); @@ -683,7 +683,7 @@ ULONG64 accessed_sectors[300]; logical_sector = ram_disk.fx_media_data_sector_start + 4; for (i = 0; i < 256; i++) { - + status += _fx_utility_logical_sector_read(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DIRECTORY_SECTOR); status += _fx_utility_logical_sector_write(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DATA_SECTOR); logical_sector++; @@ -692,7 +692,7 @@ ULONG64 accessed_sectors[300]; /* Now perform direct buffer read ram_disk.fx_media_data_sector_start on sectors before the cache. */ logical_sector = (ULONG64)-2; status = _fx_utility_logical_sector_read(&ram_disk, logical_sector, direct_buffer, 4, FX_DIRECTORY_SECTOR); - + /* Now perform direct buffer write. */ status += _fx_utility_logical_sector_write(&ram_disk, logical_sector, direct_buffer, 4, FX_DATA_SECTOR); @@ -703,7 +703,7 @@ ULONG64 accessed_sectors[300]; logical_sector = ram_disk.fx_media_data_sector_start + 4; for (i = 0; i < 300; i++) { - + status += _fx_utility_logical_sector_read(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DIRECTORY_SECTOR); status += _fx_utility_logical_sector_write(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DATA_SECTOR); logical_sector++; @@ -716,15 +716,15 @@ ULONG64 accessed_sectors[300]; logical_sector = ram_disk.fx_media_data_sector_start + 4; for (i = 0; i < 256; i++) { - + status += _fx_utility_logical_sector_read(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DIRECTORY_SECTOR); logical_sector++; } /* Write same 256 sectors in reverse order. */ for (i = 0; i < 256; i++) - { - + { + logical_sector--; status += _fx_utility_logical_sector_write(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DATA_SECTOR); } @@ -737,16 +737,16 @@ ULONG64 accessed_sectors[300]; /* Flush the FAT. */ status += _fx_utility_FAT_map_flush(&ram_disk); - + /* Indicate that the driver needs to know! */ ram_disk.fx_media_driver_free_sector_update = FX_TRUE; - + /* Update FAT entries again, but this time with free marker. */ for (i = 2; i < 6000; i++) { status += _fx_utility_FAT_entry_write(&ram_disk, (ULONG) i, FX_FREE_CLUSTER); } - + /* Flush the FAT. */ status += _fx_utility_FAT_map_flush(&ram_disk); ram_disk.fx_media_driver_free_sector_update = FX_FALSE; @@ -762,7 +762,7 @@ ULONG64 accessed_sectors[300]; /* Random test of 300 sectors. */ for (i = 0; i < 300; i++) { - accessed_sectors[i] = logical_sector + (ULONG64)(rand() % 5000); + accessed_sectors[i] = logical_sector + (ULONG64)(rand() % 5000); status += _fx_utility_logical_sector_read(&ram_disk, accessed_sectors[i], ram_disk.fx_media_memory_buffer, 1, FX_DATA_SECTOR); if ((i > 0) && (rand() & 1)) { @@ -774,7 +774,7 @@ ULONG64 accessed_sectors[300]; /* Random test of 300 sectors with random logical sector flush. */ for (i = 0; i < 300; i++) { - accessed_sectors[i] = logical_sector + (ULONG64)(rand() % 5000); + accessed_sectors[i] = logical_sector + (ULONG64)(rand() % 5000); status += _fx_utility_logical_sector_read(&ram_disk, accessed_sectors[i], ram_disk.fx_media_memory_buffer, 1, FX_DATA_SECTOR); if ((i > 0) && (rand() & 1)) { @@ -787,14 +787,14 @@ ULONG64 accessed_sectors[300]; if (rand() & 1) status += _fx_utility_logical_sector_flush(&ram_disk, accessed_sectors[j], 1, FX_TRUE); else - status += _fx_utility_logical_sector_flush(&ram_disk, accessed_sectors[j], 1, FX_FALSE); + status += _fx_utility_logical_sector_flush(&ram_disk, accessed_sectors[j], 1, FX_FALSE); } } - + /* Random test of 1000 FAT entry reads/writes. */ for (i = 0; i < 1000; i++) { - + j = ((UINT)rand() % 100); status += _fx_utility_FAT_entry_read(&ram_disk, j+2, &fat_entry); @@ -804,14 +804,14 @@ ULONG64 accessed_sectors[300]; if (rand() & 1) status += _fx_utility_FAT_entry_write(&ram_disk, j+2, j+3); else - status += _fx_utility_FAT_entry_write(&ram_disk, j+2, FX_FREE_CLUSTER); + status += _fx_utility_FAT_entry_write(&ram_disk, j+2, FX_FREE_CLUSTER); } } - + /* Random test of 1000 FAT entry reads/writes with random FAT flush. */ for (i = 0; i < 1000; i++) { - + j = ((UINT)rand() % 100); status += _fx_utility_FAT_entry_read(&ram_disk, j+2, &fat_entry); @@ -821,23 +821,23 @@ ULONG64 accessed_sectors[300]; if (rand() & 1) status += _fx_utility_FAT_entry_write(&ram_disk, j+2, j+3); else - status += _fx_utility_FAT_entry_write(&ram_disk, j+2, FX_FREE_CLUSTER); + status += _fx_utility_FAT_entry_write(&ram_disk, j+2, FX_FREE_CLUSTER); } - + if (rand() & 1) { - + status += _fx_utility_FAT_flush(&ram_disk); } if (rand() & 1) { - + status += _fx_utility_FAT_map_flush(&ram_disk); } } return_if_fail( status == FX_SUCCESS); - + /* Set the free sector update. */ ram_disk.fx_media_driver_free_sector_update = FX_TRUE; @@ -847,14 +847,14 @@ ULONG64 accessed_sectors[300]; _fx_ram_driver_io_error_request = 1000; for (i = 0; i < 300000; i++) { - + j = ((UINT)rand() % 100); _fx_utility_logical_sector_read(&ram_disk, (ULONG64) j, ram_disk.fx_media_memory_buffer, 1, FX_DATA_SECTOR); if (rand() & 1) _fx_utility_logical_sector_write(&ram_disk, (ULONG64) j, ram_disk.fx_media_memory_buffer, 1, FX_DATA_SECTOR); - + j = ((UINT)rand() % 100); _fx_utility_FAT_entry_read(&ram_disk, j+2, &fat_entry); @@ -864,9 +864,9 @@ ULONG64 accessed_sectors[300]; if (rand() & 1) _fx_utility_FAT_entry_write(&ram_disk, j+2, j+3); else - _fx_utility_FAT_entry_write(&ram_disk, j+2, FX_FREE_CLUSTER); + _fx_utility_FAT_entry_write(&ram_disk, j+2, FX_FREE_CLUSTER); } - + if (i & 1) _fx_utility_FAT_flush(&ram_disk); else @@ -881,7 +881,7 @@ ULONG64 accessed_sectors[300]; logical_sector = ram_disk.fx_media_data_sector_start + 4; for (i = 0; i < 256; i++) { - + status += _fx_utility_logical_sector_read(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DIRECTORY_SECTOR); status += _fx_utility_logical_sector_write(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DATA_SECTOR); logical_sector++; @@ -890,7 +890,7 @@ ULONG64 accessed_sectors[300]; /* Now perform direct buffer read ram_disk.fx_media_data_sector_start on sectors before the cache. */ logical_sector = ram_disk.fx_media_data_sector_start; status = _fx_utility_logical_sector_read(&ram_disk, logical_sector, direct_buffer, 12, FX_DIRECTORY_SECTOR); - + /* Now perform direct buffer write. */ status += _fx_utility_logical_sector_write(&ram_disk, logical_sector, direct_buffer, 12, FX_DATA_SECTOR); @@ -901,7 +901,7 @@ ULONG64 accessed_sectors[300]; logical_sector = ram_disk.fx_media_data_sector_start + 4; for (i = 0; i < 256; i++) { - + status += _fx_utility_logical_sector_read(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DIRECTORY_SECTOR); status += _fx_utility_logical_sector_write(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DATA_SECTOR); logical_sector++; @@ -921,7 +921,7 @@ ULONG64 accessed_sectors[300]; logical_sector = ram_disk.fx_media_data_sector_start + 4; for (i = 0; i < 256; i++) { - + status += _fx_utility_logical_sector_read(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DIRECTORY_SECTOR); status += _fx_utility_logical_sector_write(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DATA_SECTOR); logical_sector++; @@ -939,7 +939,7 @@ ULONG64 accessed_sectors[300]; logical_sector = ram_disk.fx_media_data_sector_start + 4; for (i = 0; i < 256; i++) { - + status += _fx_utility_logical_sector_read(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DATA_SECTOR); status += _fx_utility_logical_sector_write(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DATA_SECTOR); logical_sector++; @@ -958,7 +958,7 @@ ULONG64 accessed_sectors[300]; logical_sector = ram_disk.fx_media_data_sector_start + 4; for (i = 0; i < 256; i++) { - + status += _fx_utility_logical_sector_read(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DATA_SECTOR); status += _fx_utility_logical_sector_write(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DATA_SECTOR); logical_sector++; @@ -976,7 +976,7 @@ ULONG64 accessed_sectors[300]; logical_sector = ram_disk.fx_media_data_sector_start + 4; for (i = 0; i < 256; i++) { - + status += _fx_utility_logical_sector_read(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DIRECTORY_SECTOR); status += _fx_utility_logical_sector_write(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DATA_SECTOR); logical_sector++; @@ -995,7 +995,7 @@ ULONG64 accessed_sectors[300]; logical_sector = ram_disk.fx_media_data_sector_start + 4; for (i = 0; i < 256; i++) { - + status += _fx_utility_logical_sector_read(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DIRECTORY_SECTOR); status += _fx_utility_logical_sector_write(&ram_disk, logical_sector, ram_disk.fx_media_memory_buffer, 1, FX_DATA_SECTOR); logical_sector++; @@ -1025,22 +1025,22 @@ ULONG64 accessed_sectors[300]; return_if_fail( status == FX_SUCCESS); /* FAT12 FAT flush I/O error testing. */ - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 2, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 2000, // Total sectors - 128, // Sector size + 2000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Open the ram_disk. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -1048,7 +1048,7 @@ ULONG64 accessed_sectors[300]; /* Now loop to write the FAT entries out with random I/O erorrs. */ fat_entry = 4; - for (i = 0; i < 500000; i++) + for (i = 0; i < 500000; i++) { _fx_ram_driver_io_error_request = ((UINT)rand() % 5); @@ -1060,11 +1060,11 @@ ULONG64 accessed_sectors[300]; _fx_utility_logical_sector_flush(&ram_disk, 1, 60000, FX_TRUE); /* Move to next FAT entry. */ - fat_entry++; + fat_entry++; if (fat_entry >= (ram_disk.fx_media_available_clusters-1)) fat_entry = 4; } - for (i = 0; i < 500000; i++) + for (i = 0; i < 500000; i++) { _fx_ram_driver_io_error_request = ((UINT)rand() % 5); @@ -1074,7 +1074,7 @@ ULONG64 accessed_sectors[300]; _fx_utility_FAT_entry_write(&ram_disk, fat_entry, fat_entry+1); /* Move to next FAT entry. */ - fat_entry++; + fat_entry++; if (fat_entry >= (ram_disk.fx_media_available_clusters-1)) fat_entry = 4; } @@ -1083,7 +1083,7 @@ ULONG64 accessed_sectors[300]; /* Set the error flag to make logical sector write return an error. */ _fx_utility_logical_sector_write_error_request = 1; status = _fx_utility_FAT_flush(&ram_disk); - _fx_utility_logical_sector_write_error_request = 70000; /* This should not hit, but satisfy the code coverage. */ + _fx_utility_logical_sector_write_error_request = 70000; /* This should not hit, but satisfy the code coverage. */ _fx_utility_FAT_flush(&ram_disk); _fx_utility_logical_sector_write_error_request = 0; @@ -1092,28 +1092,28 @@ ULONG64 accessed_sectors[300]; return_if_fail( status == FX_SUCCESS); /* FAT16 FAT flush I/O error testing. */ - + /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 2, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 7000, // Total sectors - 128, // Sector size + 7000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); return_if_fail( status == FX_SUCCESS); /* Now loop to write the FAT entries out with random I/O erorrs. */ fat_entry = 4; - for (i = 0; i < 500000; i++) + for (i = 0; i < 500000; i++) { _fx_ram_driver_io_error_request = ((UINT)rand() % 5); @@ -1125,11 +1125,11 @@ ULONG64 accessed_sectors[300]; _fx_utility_logical_sector_flush(&ram_disk, 1, 60000, FX_TRUE); /* Move to next FAT entry. */ - fat_entry++; + fat_entry++; if (fat_entry >= (ram_disk.fx_media_available_clusters-1)) fat_entry = 4; } - for (i = 0; i < 500000; i++) + for (i = 0; i < 500000; i++) { _fx_ram_driver_io_error_request = ((UINT)rand() % 5); @@ -1139,46 +1139,46 @@ ULONG64 accessed_sectors[300]; _fx_utility_FAT_entry_write(&ram_disk, fat_entry, fat_entry+1); /* Move to next FAT entry. */ - fat_entry++; + fat_entry++; if (fat_entry >= (ram_disk.fx_media_available_clusters-1)) fat_entry = 4; } _fx_ram_driver_io_error_request = 0; - + /* Set the error flag to make logical sector write return an error. */ _fx_utility_logical_sector_write_error_request = 1; status = _fx_utility_FAT_flush(&ram_disk); - _fx_utility_logical_sector_write_error_request = 70000; /* This should not hit, but satisfy the code coverage. */ + _fx_utility_logical_sector_write_error_request = 70000; /* This should not hit, but satisfy the code coverage. */ _fx_utility_FAT_flush(&ram_disk); _fx_utility_logical_sector_write_error_request = 0; /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); - + /* FAT32 FAT flush I/O error testing. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 2, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70128, // Total sectors - 128, // Sector size + 70128, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); return_if_fail( status == FX_SUCCESS); /* Now loop to write the FAT entries out with random I/O erorrs. */ fat_entry = 4; - for (i = 0; i < 500000; i++) + for (i = 0; i < 500000; i++) { _fx_ram_driver_io_error_request = ((UINT)rand() % 5); @@ -1190,11 +1190,11 @@ ULONG64 accessed_sectors[300]; _fx_utility_logical_sector_flush(&ram_disk, 1, 60000, FX_TRUE); /* Move to next FAT entry. */ - fat_entry++; + fat_entry++; if (fat_entry >= (ram_disk.fx_media_available_clusters-1)) fat_entry = 4; } - for (i = 0; i < 500000; i++) + for (i = 0; i < 500000; i++) { _fx_ram_driver_io_error_request = ((UINT)rand() % 5); @@ -1204,7 +1204,7 @@ ULONG64 accessed_sectors[300]; _fx_utility_FAT_entry_write(&ram_disk, fat_entry, fat_entry+1); /* Move to next FAT entry. */ - fat_entry++; + fat_entry++; if (fat_entry >= (ram_disk.fx_media_available_clusters-1)) fat_entry = 4; } @@ -1214,10 +1214,10 @@ ULONG64 accessed_sectors[300]; /* Set the error flag to make logical sector write return an error. */ _fx_utility_logical_sector_write_error_request = 1; status = _fx_utility_FAT_flush(&ram_disk); - _fx_utility_logical_sector_write_error_request = 70000; /* This should not hit, but satisfy the code coverage. */ + _fx_utility_logical_sector_write_error_request = 70000; /* This should not hit, but satisfy the code coverage. */ _fx_utility_FAT_flush(&ram_disk); _fx_utility_logical_sector_write_error_request = 0; - + /* Close the media. */ status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); diff --git a/test/regression_test/filex_media_volume_directory_entry_test.c b/test/regression_test/filex_media_volume_directory_entry_test.c index 73adf5f..95c31fb 100644 --- a/test/regression_test/filex_media_volume_directory_entry_test.c +++ b/test/regression_test/filex_media_volume_directory_entry_test.c @@ -102,19 +102,19 @@ static void ftest_0_entry(ULONG thread_input) /* Format the media. This needs to be done before opening it! */ status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 128, // Sector size + 70000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -136,36 +136,36 @@ static void ftest_0_entry(ULONG thread_input) return_if_fail( status == FX_SUCCESS); /* Test for creating direcoty with same name as volume" */ - + /* Format the media. This needs to be done before opening it! */ status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 128, // Sector size + 70000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); - + status = fx_media_volume_set(&ram_disk, VOLUME_LABEL); return_if_fail( status == FX_SUCCESS); status = fx_media_flush(&ram_disk); return_if_fail( status == FX_SUCCESS); - + status = fx_directory_create(&ram_disk, VOLUME_LABEL); return_if_fail( status == FX_SUCCESS); - + status = fx_media_flush(&ram_disk); return_if_fail( status == FX_SUCCESS); diff --git a/test/regression_test/filex_media_volume_get_set_test.c b/test/regression_test/filex_media_volume_get_set_test.c index d81c994..d950578 100644 --- a/test/regression_test/filex_media_volume_get_set_test.c +++ b/test/regression_test/filex_media_volume_get_set_test.c @@ -53,13 +53,13 @@ void filex_media_volume_get_set_application_define(void *first_unused_memory) #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -94,20 +94,20 @@ CHAR volume_buffer[32]; printf("FileX Test: Media volume get/set test.............................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -116,15 +116,15 @@ CHAR volume_buffer[32]; printf("ERROR!\n"); test_control_return(2); } - + /* try to set the media volume name before the media is opened */ status = fx_media_volume_set(&ram_disk, "NEW"); - if (status != FX_MEDIA_NOT_OPEN) + if (status != FX_MEDIA_NOT_OPEN) { printf("ERROR!\n"); test_control_return(11); } - + /* try to get the media volume name before the media is opened */ status = fx_media_volume_get(&ram_disk, volume_buffer, FX_BOOT_SECTOR); if (status != FX_MEDIA_NOT_OPEN) @@ -144,7 +144,7 @@ CHAR volume_buffer[32]; printf("ERROR!\n"); test_control_return(3); } - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING /* send null pointer to generate an error */ @@ -173,16 +173,16 @@ CHAR volume_buffer[32]; #else /* try to set the media volume name to something invalid */ status = fx_media_volume_set(&ram_disk, ""); - if (status != FX_INVALID_NAME) + if (status != FX_INVALID_NAME) { printf("ERROR!\n"); test_control_return(11); } #endif /* FX_DISABLE_ERROR_CHECKING */ - + /* Get the current volume name - from boot record. */ status = fx_media_volume_get(&ram_disk, volume_buffer, FX_BOOT_SECTOR); - + /* Determine if there was an error getting the volume name. */ if ((status != FX_SUCCESS) || (volume_buffer[0] != 'M') || @@ -202,7 +202,7 @@ CHAR volume_buffer[32]; printf("ERROR!\n"); test_control_return(4); } - + /* Set volume_buffer to known state. */ memcpy(volume_buffer, "ORIGINALSTRING", 15); @@ -225,7 +225,7 @@ CHAR volume_buffer[32]; /* Get the current volume name - from root directory. */ status = fx_media_volume_get(&ram_disk, volume_buffer, FX_DIRECTORY_SECTOR); - + /* Determine if we found a volume name in the root directory. * When not, the value from boot sector will be returned. */ if ((status != FX_SUCCESS) || @@ -241,7 +241,7 @@ CHAR volume_buffer[32]; (volume_buffer[9] != 'S') || (volume_buffer[10] != 'K')) { - + /* Error getting the volume name. */ printf("ERROR!\n"); test_control_return(5); @@ -251,9 +251,9 @@ CHAR volume_buffer[32]; status = fx_media_volume_set(&ram_disk, "NEW"); /* Determine if the volume name set was successful... */ - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { - + /* Error setting the volume name. */ printf("ERROR!\n"); test_control_return(6); @@ -264,7 +264,7 @@ CHAR volume_buffer[32]; /* Get the current volume name - from boot record. */ status = fx_media_volume_get(&ram_disk, volume_buffer, FX_BOOT_SECTOR); - + /* Determine if there was an error getting the volume name. */ if ((status != FX_SUCCESS) || (volume_buffer[0] != 'N') || @@ -277,10 +277,10 @@ CHAR volume_buffer[32]; printf("ERROR!\n"); test_control_return(7); } - + /* Get the current volume name - from root directory. */ status = fx_media_volume_get(&ram_disk, volume_buffer, FX_DIRECTORY_SECTOR); - + /* Determine if we found a volume name in the root directory... should not since our format doesn't do that! */ if ((status != FX_SUCCESS) || @@ -289,7 +289,7 @@ CHAR volume_buffer[32]; (volume_buffer[2] != 'W') || (volume_buffer[3] != (CHAR) 0)) { - + /* Error getting the volume name. */ printf("ERROR!\n"); test_control_return(8); @@ -307,20 +307,20 @@ CHAR volume_buffer[32]; } /* Format the media in FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70000, // Total sectors - FAT 32 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -329,7 +329,7 @@ CHAR volume_buffer[32]; printf("ERROR!\n"); test_control_return(11); } - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); @@ -346,12 +346,12 @@ CHAR volume_buffer[32]; /* Set the volume name to a NULL volume name. */ volume_buffer[0] = 0; status = _fx_media_volume_set(&ram_disk, volume_buffer); - if (status != FX_INVALID_NAME) + if (status != FX_INVALID_NAME) { printf("ERROR!\n"); test_control_return(13); } - + /* Now set the volume name to something longer than 11 characters that are lower case. */ status = fx_media_volume_set(&ram_disk, "thisisareallylongvolumename"); if (status != FX_SUCCESS) @@ -405,29 +405,29 @@ CHAR volume_buffer[32]; } /* Close the media. */ status = fx_media_close(&ram_disk); - + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(18); } - + /* Format the media in FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 16, // Directory Entries 0, // Hidden sectors 7000, // Total sectors - FAT 16 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -436,7 +436,7 @@ CHAR volume_buffer[32]; printf("ERROR!\n"); test_control_return(19); } - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -475,7 +475,7 @@ CHAR volume_buffer[32]; printf("ERROR!\n"); test_control_return(21); } - + /* Now set the volume name. */ status = fx_media_volume_set(&ram_disk, "MINE "); if (status != FX_MEDIA_INVALID) @@ -486,7 +486,7 @@ CHAR volume_buffer[32]; /* Now delete the first entry so we can find it. */ status = fx_file_delete(&ram_disk, "FILE1.TXT"); - + /* And set the volume name again. */ status += fx_media_volume_set(&ram_disk, "MINE "); if (status != FX_SUCCESS) @@ -505,7 +505,7 @@ CHAR volume_buffer[32]; /* Close the media. */ status = fx_media_close(&ram_disk); - + if (status != FX_SUCCESS) { printf("ERROR!\n"); @@ -513,20 +513,20 @@ CHAR volume_buffer[32]; } /* Format the media in FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 16, // Directory Entries 0, // Hidden sectors 7000, // Total sectors - FAT 16 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -535,7 +535,7 @@ CHAR volume_buffer[32]; printf("ERROR!\n"); test_control_return(26); } - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -574,10 +574,10 @@ CHAR volume_buffer[32]; printf("ERROR!\n"); test_control_return(28); } - + /* Now delete the first entry so we can find it. */ status = fx_file_delete(&ram_disk, "FILE16.TXT"); - + /* And set the volume name again. */ status += fx_media_volume_set(&ram_disk, "mine~ "); if (status != FX_SUCCESS) @@ -596,28 +596,28 @@ CHAR volume_buffer[32]; /* Close the media. */ status = fx_media_close(&ram_disk); - + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(31); } - + /* Format the media in FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 16, // Directory Entries 0, // Hidden sectors 7000, // Total sectors - FAT 16 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -626,7 +626,7 @@ CHAR volume_buffer[32]; printf("ERROR!\n"); test_control_return(32); } - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -657,7 +657,7 @@ CHAR volume_buffer[32]; status += fx_file_create(&ram_disk, "FILE15.TXT"); /* Leave the last entry free for search test. */ - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -666,7 +666,7 @@ CHAR volume_buffer[32]; printf("ERROR!\n"); test_control_return(34); } - + /* Set the volume name. */ status += fx_media_volume_set(&ram_disk, "MY "); if (status != FX_SUCCESS) @@ -677,28 +677,28 @@ CHAR volume_buffer[32]; /* Close the media. */ status = fx_media_close(&ram_disk); - + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(36); - } + } /* Format the media in FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 16, // Directory Entries 0, // Hidden sectors 7000, // Total sectors - FAT 16 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -707,7 +707,7 @@ CHAR volume_buffer[32]; printf("ERROR!\n"); test_control_return(37); } - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, 128); @@ -740,7 +740,7 @@ CHAR volume_buffer[32]; /* Leave the last entry free for search test... and delete file 5 and 6 to create some available slots. */ status += fx_file_delete(&ram_disk, "FILE6.TXT"); status += fx_file_delete(&ram_disk, "FILE7.TXT"); - + /* Check the status. */ if (status != FX_SUCCESS) { @@ -749,7 +749,7 @@ CHAR volume_buffer[32]; printf("ERROR!\n"); test_control_return(39); } - + /* Set the volume name. */ status = fx_media_volume_set(&ram_disk, "MY "); if (status != FX_SUCCESS) @@ -767,7 +767,7 @@ CHAR volume_buffer[32]; } /* Test the I/O errors. */ - + /* Cause an error reading sector 0. */ _fx_utility_logical_sector_flush(&ram_disk, 0, 60000, FX_TRUE); _fx_ram_driver_io_error_request = 1; @@ -883,32 +883,32 @@ CHAR volume_buffer[32]; { printf("ERROR!\n"); test_control_return(51); - } + } /* Close the media. */ status = fx_media_close(&ram_disk); - + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(52); - } + } /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail(status == FX_SUCCESS); status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); @@ -924,31 +924,31 @@ CHAR volume_buffer[32]; /* Close the media. */ status = fx_media_close(&ram_disk); - + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(53); - } + } /* This test is added to check if fx_media_volume_get() returns volume entry that was marked free */ memset(ram_disk_memory,'\0',sizeof(ram_disk_memory)); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "NO NAME", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 512, // Sector size + 70000 * 8, // Total sectors + 512, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail(status == FX_SUCCESS); status = fx_media_open(&ram_disk, "RAMDISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); @@ -972,33 +972,33 @@ CHAR volume_buffer[32]; /* Close the media. */ status = fx_media_close(&ram_disk); - + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(54); - } + } - /* Modify first character of the volume label entry in boot sector. This is done to verify + /* Modify first character of the volume label entry in boot sector. This is done to verify if the volume entry marked free is returned or not */ ram_disk_memory[71] = 0x39; - /* First Character of Volume label in data section + /* First Character of Volume label in data section The absolute address was found by looping accross the ram_disk_memory to find the Volume name in data section */ ram_disk_memory[2241024] = FX_DIR_ENTRY_FREE; memset(cache_buffer,'\0',sizeof(cache_buffer)); - + status = fx_media_open(&ram_disk, "RAMDISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail(status == FX_SUCCESS);; status = fx_media_volume_get(&ram_disk, volume_buffer, FX_DIRECTORY_SECTOR); return_if_fail(status == FX_SUCCESS); - + if ((status != FX_SUCCESS) || (volume_buffer[0] != '9')) { printf("ERROR!\n"); test_control_return(55); - } + } printf("SUCCESS!\n"); test_control_return(0); diff --git a/test/regression_test/filex_system_date_time_test.c b/test/regression_test/filex_system_date_time_test.c index 5b28e8b..1ce0fb1 100644 --- a/test/regression_test/filex_system_date_time_test.c +++ b/test/regression_test/filex_system_date_time_test.c @@ -52,13 +52,13 @@ void filex_system_date_time_application_define(void *first_unused_memory) #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -96,20 +96,20 @@ UINT i; printf("FileX Test: System date/time get/set test.........................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 128, // Sector size + 256, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -130,10 +130,10 @@ UINT i; printf("ERROR!\n"); test_control_return(3); } - + /* test for error checking by sending bad information */ #ifndef FX_DISABLE_ERROR_CHECKING - + /* check system date get pointer error */ status = fx_system_date_get(FX_NULL, FX_NULL, FX_NULL); if (status != FX_PTR_ERROR) @@ -141,15 +141,15 @@ UINT i; printf("ERROR!\n"); test_control_return(4); } - + /* check system time get pointer error */ status = fx_system_time_get(FX_NULL, FX_NULL, FX_NULL); if (status != FX_PTR_ERROR) { printf("ERROR!\n"); test_control_return(5); - } - + } + /* check system time set bad hours */ status = fx_system_time_set(99, 0, 0); if (status != FX_INVALID_HOUR) @@ -157,7 +157,7 @@ UINT i; printf("ERROR!\n"); test_control_return(6); } - + /* check system time set bad minutes */ status = fx_system_time_set(0, 99, 0); if (status != FX_INVALID_MINUTE) @@ -165,7 +165,7 @@ UINT i; printf("ERROR!\n"); test_control_return(7); } - + /* check system time set bad seconds */ status = fx_system_time_set(0, 0, 99); if (status != FX_INVALID_SECOND) @@ -173,7 +173,7 @@ UINT i; printf("ERROR!\n"); test_control_return(8); } - + /* check system date set bad year */ status = fx_system_date_set(99, 6, 6); if (status != FX_INVALID_YEAR) @@ -181,7 +181,7 @@ UINT i; printf("ERROR!\n"); test_control_return(9); } - + /* check system date set bad month */ status = fx_system_date_set(2015, 99, 6); if (status != FX_INVALID_MONTH) @@ -189,7 +189,7 @@ UINT i; printf("ERROR!\n"); test_control_return(10); } - + /* check good and bad inputs for each month */ for (i = 1; i <= 12; i++) { @@ -200,7 +200,7 @@ UINT i; printf("ERROR!\n"); test_control_return(11); } - + /* invalid input for month i */ status = fx_system_date_set(2015, i, 99); if (status != FX_INVALID_DAY) @@ -209,7 +209,7 @@ UINT i; test_control_return(12); } } - + /* check bad input for feb on a leap year */ status = fx_system_date_set(2016, 2, 99); if (status != FX_INVALID_DAY) @@ -217,14 +217,14 @@ UINT i; printf("ERROR!\n"); test_control_return(13); } - - + + #endif /* Set the date and time. */ - status = fx_system_date_set(1999, 12, 31); - - /* Check for successful date set. */ + status = fx_system_date_set(1999, 12, 31); + + /* Check for successful date set. */ if (status != FX_SUCCESS) { @@ -232,10 +232,10 @@ UINT i; printf("ERROR!\n"); test_control_return(4); } - + status = fx_system_time_set(23, 59, 58); - /* Check for successful time set. */ + /* Check for successful time set. */ if (status != FX_SUCCESS) { @@ -243,14 +243,14 @@ UINT i; printf("ERROR!\n"); test_control_return(14); } - + /* Call the internal system date get with NULL values. */ status = _fx_system_date_get(FX_NULL, FX_NULL, FX_NULL); - + /* Get the date. */ status += fx_system_date_get(&year, &month, &day); - - /* Check for successful date get. */ + + /* Check for successful date get. */ if ((status != FX_SUCCESS) || (year != 1999) || (month != 12) || @@ -261,10 +261,10 @@ UINT i; printf("ERROR!\n"); test_control_return(15); } - + /* Call the internal system time get. */ status = _fx_system_time_get(FX_NULL, FX_NULL, FX_NULL); - + /* Get the time. */ status += fx_system_time_get(&hour, &minute, &second); @@ -380,20 +380,20 @@ UINT i; status = fx_media_close(&ram_disk); /* Drive the system time logic. */ - + /* Save the system date/time. */ save_date = _fx_system_date; save_time = _fx_system_time; - + /* First call the system timer entry function with an invalid ID. */ _fx_system_timer_entry(0); - + /* Now setup an invalid month to cause the error logic to hit. */ _fx_system_date = _fx_system_date | 0x1E0; /* Set month to all ones - invalid > 12 */ - + /* Now loop for the amount of updates (10 seconds per update) to cause the day to wrap. */ for (i = 0; i < 86400; i++) - { + { /* Adjust the time by calling the time update function. */ _fx_system_timer_entry(FX_TIMER_ID); } @@ -405,7 +405,7 @@ UINT i; /* Now call the system timer entry to walk through the maximum system time. */ for (i = 0; i < 315360000; i++) { - + /* Adjust the time by calling the time update function. */ _fx_system_timer_entry(FX_TIMER_ID); } diff --git a/test/regression_test/filex_unicode_2_test.c b/test/regression_test/filex_unicode_2_test.c index 8d9dbb4..b218afa 100644 --- a/test/regression_test/filex_unicode_2_test.c +++ b/test/regression_test/filex_unicode_2_test.c @@ -42,7 +42,7 @@ static void _fx_terrible_driver(FX_MEDIA *media_ptr) { driver_called_counter++; //printf("\n_fx_terrible_driver has been called %d times.", driver_called_counter); - + // Ensure the variable we want to operate normal at the rest of time. media_ptr -> fx_media_root_cluster_32 = 2; // To cover the branch at Line 203 in fx_unicode_directory_entry_read.c, modify fx_media_root_cluster_32 at a particular time. @@ -69,13 +69,13 @@ void filex_unicode_2_application_define(void *first_unused_memory) #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -94,7 +94,7 @@ UCHAR *pointer; #endif } -static UCHAR long_unicode_name1[] = {1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 0, 0}; +static UCHAR long_unicode_name1[] = {1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 0, 0}; /* Define the test threads. */ static void ftest_0_entry(ULONG thread_input) @@ -109,25 +109,25 @@ UCHAR destination_name_1[128]; printf("FileX Test: Unicode 2 test........................................."); /* Format the media as FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - 128, // Media buffer size + 128, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 128, // Sector size + 70000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_value_if_fail( status == FX_SUCCESS, 1); status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_value_if_fail( status == FX_SUCCESS, 2); - + length = fx_unicode_length_get( long_unicode_name1); status = fx_unicode_directory_create( &ram_disk, long_unicode_name1, length, (CHAR *)destination_name); long_unicode_name1[0]++; @@ -161,25 +161,25 @@ UCHAR destination_name_1[128]; return_value_if_fail( status == FX_SUCCESS, 5); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - 128, // Media buffer size + 128, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 128, // Sector size + 70000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_value_if_fail( status == FX_SUCCESS, 6); status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_value_if_fail( status == FX_SUCCESS, 7); - + length = fx_unicode_length_get( long_unicode_name1); status = fx_unicode_directory_create( &ram_disk, long_unicode_name1, length, (CHAR *)destination_name); long_unicode_name1[0]++; diff --git a/test/regression_test/filex_unicode_3_test.c b/test/regression_test/filex_unicode_3_test.c index 0926d23..56d6ff7 100644 --- a/test/regression_test/filex_unicode_3_test.c +++ b/test/regression_test/filex_unicode_3_test.c @@ -41,7 +41,7 @@ static void _fx_terrible_driver(FX_MEDIA *media_ptr) { driver_called_counter++; // printf("\n_fx_terrible_driver has been called %d times.", driver_called_counter); - if ( + if ( // Make IO ERROR to reach the Line 202 in fx_unicode_directory_search.c (driver_called_counter == 1) ) @@ -64,13 +64,13 @@ void filex_unicode_3_application_define(void *first_unused_memory) #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -89,8 +89,8 @@ UCHAR *pointer; #endif } -static UCHAR long_unicode_name1[] = {1, 0, 0, 0}; -static UCHAR long_unicode_name2[] = {1, 0, 2, 0, 0, 0}; +static UCHAR long_unicode_name1[] = {1, 0, 0, 0}; +static UCHAR long_unicode_name2[] = {1, 0, 2, 0, 0, 0}; /* Define the test threads. */ @@ -106,20 +106,20 @@ FX_LOCAL_PATH local_path; /* Print out some test information banners. */ printf("FileX Test: Unicode 3 test........................................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - 128, // Media buffer size + 128, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 128, // Sector size + 70000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_value_if_fail( status == FX_SUCCESS, 1); status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); diff --git a/test/regression_test/filex_unicode_4_test.c b/test/regression_test/filex_unicode_4_test.c index 7575db9..bdc2f66 100644 --- a/test/regression_test/filex_unicode_4_test.c +++ b/test/regression_test/filex_unicode_4_test.c @@ -110,19 +110,19 @@ FX_FILE my_file; /* Format the media. This needs to be done before opening it! */ status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - 128, // Media buffer size + 128, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 128, // Sector size + 70000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_value_if_fail(status == FX_SUCCESS, 2); status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -139,7 +139,7 @@ FX_FILE my_file; status = fx_unicode_file_create(&ram_disk, long_unicode_name1, length, (CHAR *)destination_name); return_value_if_fail(status == FX_SUCCESS, 5); - // Attempt to create two 8.3 format file by both fx_file_create and fx_unicode_file_create to cover the branch at Line 324 in fx_unicode_directory_search.c + // Attempt to create two 8.3 format file by both fx_file_create and fx_unicode_file_create to cover the branch at Line 324 in fx_unicode_directory_search.c status = fx_file_create(&ram_disk, (CHAR *)specified_ascii_file_name); return_value_if_fail(status == FX_SUCCESS, 6); @@ -338,19 +338,19 @@ FX_FILE my_file; /* Format the media. This needs to be done before opening it! */ status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - 128, // Media buffer size + 128, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 128, // Sector size + 70000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); /* Backup the data which will be modified later. */ @@ -377,19 +377,19 @@ FX_FILE my_file; /* Format the media. This needs to be done before opening it! */ status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - 128, // Media buffer size + 128, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 128, // Sector size + 70000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); /* Backup the data which will be modified later. */ @@ -425,19 +425,19 @@ FX_FILE my_file; /* Format the media. This needs to be done before opening it! */ status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - 128, // Media buffer size + 128, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 128, // Sector size + 70000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_if_fail( status == FX_SUCCESS); /* Backup the data which will be modified later. */ @@ -473,19 +473,19 @@ FX_FILE my_file; return_if_fail( status == FX_SUCCESS); status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - 128, // Media buffer size + 128, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 128, // Sector size + 70000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open( &ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); diff --git a/test/regression_test/filex_unicode_directory_entry_2_test.c b/test/regression_test/filex_unicode_directory_entry_2_test.c index b5db892..4e3e97a 100644 --- a/test/regression_test/filex_unicode_directory_entry_2_test.c +++ b/test/regression_test/filex_unicode_directory_entry_2_test.c @@ -45,13 +45,13 @@ void filex_unicode_directory_entry_2_test_application_define(void *first_unus #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -89,21 +89,21 @@ FX_LOCAL_PATH local_path; printf("FileX Test: Unicode directory entry 2 test........................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size /* To cover the branch, which read mulitple sectors in the same cluster. */ 2, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Open the ram_disk. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); @@ -119,10 +119,10 @@ FX_LOCAL_PATH local_path; /* Close the media to flush buffer. Now we have a disk with a corrupt dir_entry. */ status += fx_media_close(&ram_disk); - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(19); @@ -131,7 +131,7 @@ FX_LOCAL_PATH local_path; status += fx_directory_local_path_set(&ram_disk, &local_path, (CHAR *)destination_name); status += fx_unicode_directory_create(&ram_disk, long_unicode_name, length, (CHAR *) destination_name); - if (status == FX_FILE_CORRUPT) + if (status == FX_FILE_CORRUPT) { printf("ERROR!\n"); test_control_return(19); diff --git a/test/regression_test/filex_unicode_directory_entry_change_test.c b/test/regression_test/filex_unicode_directory_entry_change_test.c index bc549fb..23df71f 100644 --- a/test/regression_test/filex_unicode_directory_entry_change_test.c +++ b/test/regression_test/filex_unicode_directory_entry_change_test.c @@ -98,25 +98,25 @@ FX_DIR_ENTRY *entry_ptr=&entry; UINT status, length; FX_PARAMETER_NOT_USED(thread_input); - + /* Print out some test information banners. */ printf("FileX Test: Unicode directory entry change test...................."); /* Format the media with FAT32. This needs to be done before opening it! */ status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 128, // Sector size + 70000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_value_if_fail(status == FX_SUCCESS, 1); @@ -163,7 +163,7 @@ UINT status, length; entry_ptr->fx_dir_entry_log_sector =ram_disk.fx_media_data_sector_start-1; status = _fx_unicode_directory_entry_change(&ram_disk, entry_ptr, long_unicode_name1, length); return_value_if_fail(status == FX_FILE_CORRUPT, 5); - + /*This case is determined to cover lines 315 in fx_unicode_directory_entry_change.c. */ entry_ptr->fx_dir_entry_byte_offset = CACHE_SIZE + 1; *(ram_disk.fx_media_driver_buffer + CACHE_SIZE + 1) = 90; diff --git a/test/regression_test/filex_unicode_directory_entry_test.c b/test/regression_test/filex_unicode_directory_entry_test.c index d6acf9b..a9b3f85 100644 --- a/test/regression_test/filex_unicode_directory_entry_test.c +++ b/test/regression_test/filex_unicode_directory_entry_test.c @@ -44,7 +44,7 @@ static void _fx_terrible_driver(FX_MEDIA *media_ptr) { driver_called_counter++; // printf("\n_fx_terrible_driver has been called %d times.", driver_called_counter); - if ( + if ( (driver_called_counter <= 3) ) { @@ -66,13 +66,13 @@ void filex_unicode_directory_entry_test_application_define(void *first_unused #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -112,24 +112,24 @@ FX_DIR_ENTRY source_dir, destination_dir; /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ return_value_if_fail( status == FX_SUCCESS, 2); - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_value_if_fail( status == FX_SUCCESS, 3); @@ -153,24 +153,24 @@ FX_DIR_ENTRY source_dir, destination_dir; /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ return_value_if_fail( status == FX_SUCCESS, 2); - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_value_if_fail( status == FX_SUCCESS, 3); @@ -208,20 +208,20 @@ FX_DIR_ENTRY source_dir, destination_dir; /* This time, we'll modify the second dir_entry's first byte, ordinal byte, which will make the filesystem keep reading entries until FX_FILE_CORRUPT. */ /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Open the ram_disk. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); @@ -258,20 +258,20 @@ FX_DIR_ENTRY source_dir, destination_dir; return_value_if_fail( status == FX_SUCCESS, 13); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_value_if_fail( status == FX_SUCCESS, 14); /* Open the ram_disk. */ @@ -290,20 +290,20 @@ FX_DIR_ENTRY source_dir, destination_dir; return_value_if_fail( status == FX_SUCCESS, 17); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - 128, // Media buffer size + 128, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Open the ram_disk. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); diff --git a/test/regression_test/filex_unicode_directory_rename_test.c b/test/regression_test/filex_unicode_directory_rename_test.c index 1048f15..245881e 100644 --- a/test/regression_test/filex_unicode_directory_rename_test.c +++ b/test/regression_test/filex_unicode_directory_rename_test.c @@ -27,17 +27,17 @@ static UCHAR *cache_buffer; static UCHAR cache_buffer[CACHE_SIZE]; #endif -static UCHAR old_directory_name[] = {3, 0, 4, 0, 5, 0, 6, 0, 0, 0}; +static UCHAR old_directory_name[] = {3, 0, 4, 0, 5, 0, 6, 0, 0, 0}; static UCHAR new_directory_name1[] = {3, 0, 4, 0, 5, 0, 6, 0, 0, 0}; static UCHAR new_directory_name2[] = {3, 0, 4, 0, 5, 0, 0, 0}; static UCHAR new_directory_name3[] = {3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 0, 0}; -static UCHAR new_directory_name4[] = {2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, 0, 0, 0}; -static UCHAR new_file_name5[] = {'a', 0, 'b', 0, 'c', 0, 0, 0}; -static UCHAR new_file_name5_bak[] = {'a', 0, 'b', 0, 'c', 0, 0, 0}; -static UCHAR new_file_name6[] = {'a', 0, 'y', 0, 'c', 0, 0, 0}; -static UCHAR new_file_name7[] = {'a', 1, 'z', 0, 'c', 0, 0, 0}; -static UCHAR new_file_name8[] = {'z' + 1, 0, 'z', 0, 'c', 0, 'd', 0, 0, 0}; -static UCHAR new_file_name9[] = {'z' + 1, 1, 'z', 0, 'c', 0, 'd', 0, 0, 0}; +static UCHAR new_directory_name4[] = {2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, 0, 0, 0}; +static UCHAR new_file_name5[] = {'a', 0, 'b', 0, 'c', 0, 0, 0}; +static UCHAR new_file_name5_bak[] = {'a', 0, 'b', 0, 'c', 0, 0, 0}; +static UCHAR new_file_name6[] = {'a', 0, 'y', 0, 'c', 0, 0, 0}; +static UCHAR new_file_name7[] = {'a', 1, 'z', 0, 'c', 0, 0, 0}; +static UCHAR new_file_name8[] = {'z' + 1, 0, 'z', 0, 'c', 0, 'd', 0, 0, 0}; +static UCHAR new_file_name9[] = {'z' + 1, 1, 'z', 0, 'c', 0, 'd', 0, 0, 0}; static UCHAR destination_name[100]; #define TEST_COUNT 3 @@ -64,13 +64,13 @@ void filex_unicode_directory_rename_application_define(void *first_unused_mem #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -99,71 +99,71 @@ static void ftest_0_entry(ULONG thread_input) UINT i; UINT status, count; ULONG length; -ULONG old_length; +ULONG old_length; ULONG new_length; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Unicode Directory rename test.........................."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -172,7 +172,7 @@ ULONG new_length; printf("ERROR!\n"); test_control_return(1); } - + /* Attempt to rename a directory while the media is not open */ status = fx_unicode_directory_rename(&ram_disk, (UCHAR *)"name", 1, (UCHAR *)"name", 1, (CHAR *) destination_name); if (status != FX_MEDIA_NOT_OPEN) @@ -192,7 +192,7 @@ ULONG new_length; printf("ERROR!\n"); test_control_return(3); } - + /* Attempt to rename a directory that does not exist */ status = fx_unicode_directory_rename(&ram_disk, (UCHAR *)"does_not_exist", 1, (UCHAR *)"does_not_exist", 1, (CHAR *) destination_name); if (status == FX_SUCCESS) @@ -213,7 +213,7 @@ ULONG new_length; printf("ERROR!\n"); test_control_return(5); } - + /* Only run this if error checking is enabled */ #ifndef FX_DISABLE_ERROR_CHECKING /* Send null pointer to generate an error. */ @@ -283,7 +283,7 @@ ULONG new_length; test_control_return(10); } - /* Attempt to create the old_directory_name again. */ + /* Attempt to create the old_directory_name again. */ length = fx_unicode_length_get(old_directory_name); status = fx_unicode_directory_create(&ram_disk, old_directory_name, length, (CHAR *) destination_name); @@ -296,7 +296,7 @@ ULONG new_length; test_control_return(11); } - /* Attempt to create the new_directory_name1 that same as old_directory_name again. */ + /* Attempt to create the new_directory_name1 that same as old_directory_name again. */ length = fx_unicode_length_get(new_directory_name1); status = fx_unicode_directory_create(&ram_disk, new_directory_name1, length, (CHAR *) destination_name); @@ -310,7 +310,7 @@ ULONG new_length; } - /* Attempt to create the new_directory_name2 again. */ + /* Attempt to create the new_directory_name2 again. */ length = fx_unicode_length_get(new_directory_name2); status = fx_unicode_directory_create(&ram_disk, new_directory_name2, length, (CHAR *) destination_name); @@ -323,7 +323,7 @@ ULONG new_length; test_control_return(13); } - /* Attempt to create the new_directory_name1 again. */ + /* Attempt to create the new_directory_name1 again. */ length = fx_unicode_length_get(new_directory_name3); status = fx_unicode_directory_create(&ram_disk, new_directory_name3, length, (CHAR *) destination_name); @@ -336,7 +336,7 @@ ULONG new_length; test_control_return(14); } - /* Attempt to create the new_directory_name4 again. */ + /* Attempt to create the new_directory_name4 again. */ length = fx_unicode_length_get(new_directory_name4); status = fx_unicode_directory_create(&ram_disk, new_directory_name4, length, (CHAR *) destination_name); diff --git a/test/regression_test/filex_unicode_fat_entry_1_test.c b/test/regression_test/filex_unicode_fat_entry_1_test.c index e69e47a..7737696 100644 --- a/test/regression_test/filex_unicode_fat_entry_1_test.c +++ b/test/regression_test/filex_unicode_fat_entry_1_test.c @@ -38,13 +38,13 @@ void filex_unicode_fat_entry_1_test_application_define(void *first_unused_mem UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -76,20 +76,20 @@ FX_LOCAL_PATH local_path; printf("FileX Test: Unicode fat entry 1 test..............................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Open the ram_disk. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); @@ -121,7 +121,7 @@ FX_LOCAL_PATH local_path; test_control_return(0); } -#else +#else extern void test_control_return(UINT status); #ifdef CTEST @@ -130,7 +130,7 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_enable_4_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ diff --git a/test/regression_test/filex_unicode_fat_entry_2_test.c b/test/regression_test/filex_unicode_fat_entry_2_test.c index b2f259c..c4fab8c 100644 --- a/test/regression_test/filex_unicode_fat_entry_2_test.c +++ b/test/regression_test/filex_unicode_fat_entry_2_test.c @@ -48,13 +48,13 @@ void filex_unicode_fat_entry_2_test_application_define(void *first_unused_mem #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -92,20 +92,20 @@ FX_LOCAL_PATH local_path; printf("FileX Test: Unicode fat entry 2 test..............................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Open the ram_disk. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); @@ -125,10 +125,10 @@ FX_LOCAL_PATH local_path; /* Close the media to flush buffer. Now we have a disk with a corrupt dir_entry. */ status += fx_media_close(&ram_disk); - + /* Open the ram_disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); - if (status != FX_SUCCESS) + if (status != FX_SUCCESS) { printf("ERROR!\n"); test_control_return(19); @@ -141,7 +141,7 @@ FX_LOCAL_PATH local_path; #endif status += fx_unicode_directory_create(&ram_disk, long_unicode_name, length, (CHAR *)destination_name); - if (status == FX_SUCCESS) + if (status == FX_SUCCESS) { printf("ERROR!\n"); test_control_return(19); diff --git a/test/regression_test/filex_unicode_fat_entry_3_test.c b/test/regression_test/filex_unicode_fat_entry_3_test.c index 746cd84..2287657 100644 --- a/test/regression_test/filex_unicode_fat_entry_3_test.c +++ b/test/regression_test/filex_unicode_fat_entry_3_test.c @@ -46,13 +46,13 @@ void filex_unicode_fat_entry_3_test_application_define(void *first_unused_mem #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -98,20 +98,20 @@ FX_LOCAL_PATH local_path; printf("FileX Test: Unicode fat entry 3 test..............................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 7000, // Total sectors - FAT16 - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -148,7 +148,7 @@ FX_LOCAL_PATH local_path; } /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); + status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); /* Add a FAT entry randomly in the FAT table. */ fat_buffer[6] = 0x32; @@ -173,7 +173,7 @@ FX_LOCAL_PATH local_path; } /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); + status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); /* Add a FAT entry randomly in the FAT table. */ fat_buffer[6] = 0x03; @@ -195,7 +195,7 @@ FX_LOCAL_PATH local_path; } /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); + status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); /* Recovery FAT chain. */ fat_buffer[6] = 0x06; @@ -217,7 +217,7 @@ FX_LOCAL_PATH local_path; } /* Read the first FAT sector. */ - status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); + status = fx_media_read(&ram_disk, 1, (VOID *) fat_buffer); /* Make FAT chain a circle. */ fat_buffer[12] = 0x03; diff --git a/test/regression_test/filex_unicode_fat_entry_test.c b/test/regression_test/filex_unicode_fat_entry_test.c index aa30447..0cf418f 100644 --- a/test/regression_test/filex_unicode_fat_entry_test.c +++ b/test/regression_test/filex_unicode_fat_entry_test.c @@ -37,13 +37,13 @@ void filex_unicode_fat_entry_test_application_define(void *first_unused_memor UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -75,20 +75,20 @@ FX_LOCAL_PATH local_path; printf("FileX Test: Unicode fat entry test................................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Open the ram_disk. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); @@ -104,7 +104,7 @@ FX_LOCAL_PATH local_path; /* Close the media to flush buffer. Now we have a disk with a corrupt dir_entry. */ status += fx_media_close(&ram_disk); - + /* Open the ram_disk. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); return_value_if_fail( status == FX_SUCCESS, 2); @@ -119,7 +119,7 @@ FX_LOCAL_PATH local_path; test_control_return(0); } -#else +#else extern void test_control_return(UINT status); #ifdef CTEST @@ -128,7 +128,7 @@ void test_application_define(void *first_unused_memory) void filex_fault_tolerant_enable_4_test_application_define(void *first_unused_memory) #endif { - + FX_PARAMETER_NOT_USED(first_unused_memory); /* Print out some test information banners. */ diff --git a/test/regression_test/filex_unicode_file_directory_rename_extra_2_test.c b/test/regression_test/filex_unicode_file_directory_rename_extra_2_test.c index 3d337ee..72c2515 100644 --- a/test/regression_test/filex_unicode_file_directory_rename_extra_2_test.c +++ b/test/regression_test/filex_unicode_file_directory_rename_extra_2_test.c @@ -47,13 +47,13 @@ void filex_unicode_file_directory_rename_extra_2_test_application_define(void #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -73,8 +73,8 @@ UCHAR *pointer; } static UCHAR new_file_name[] = {'a', 0, 'b', 0, 'c', 0, 0, 0}; -static UCHAR long_unicode_name1[] = {1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 0, 0}; -static UCHAR long_unicode_name2[] = {2, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 0, 0}; +static UCHAR long_unicode_name1[] = {1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 0, 0}; +static UCHAR long_unicode_name2[] = {2, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 0, 0}; static UCHAR destination_name[100]; /* Define the test threads. */ @@ -92,20 +92,20 @@ FX_LOCAL_PATH local_path; printf("FileX Test: Unicode file directory rename extra 2 test............."); /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 128, // Sector size + 70000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -122,24 +122,24 @@ FX_LOCAL_PATH local_path; #endif /* Close the media. */ - status = fx_media_close(&ram_disk); + status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 128, // Sector size + 70000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -156,27 +156,27 @@ FX_LOCAL_PATH local_path; #endif /* Close the media. */ - status = fx_media_close(&ram_disk); + status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); - + fx_media_abort( &ram_disk); /* Try fx_unicode_direcotry_create this time. */ /* Format the media with FAT32. This needs to be done before opening it! */ - status += fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status += fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 128, // Sector size + 70000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -191,27 +191,27 @@ FX_LOCAL_PATH local_path; return_if_fail( status == FX_IO_ERROR); /* Close the media. */ - status = fx_media_close(&ram_disk); + status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); fx_media_abort( &ram_disk); /* Try fx_unicode_file_rename this time. */ /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 128, // Sector size + 70000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -231,27 +231,27 @@ FX_LOCAL_PATH local_path; return_if_fail( status == FX_IO_ERROR); /* Close the media. */ - status = fx_media_close(&ram_disk); + status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); fx_media_abort( &ram_disk); /* Try fx_unicode_file_rename this time. */ /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 128, // Sector size + 70000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -271,27 +271,27 @@ FX_LOCAL_PATH local_path; return_if_fail( status == FX_IO_ERROR); /* Close the media. */ - status = fx_media_close(&ram_disk); + status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); fx_media_abort( &ram_disk); /* Try fx_unicode_directory_rename this time. */ /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 128, // Sector size + 70000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -318,20 +318,20 @@ FX_LOCAL_PATH local_path; /* Try fx_unicode_directory_rename this time. */ /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 128, // Sector size + 70000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -357,20 +357,20 @@ FX_LOCAL_PATH local_path; fx_media_abort( &ram_disk); /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 128, // Sector size + 70000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -380,26 +380,26 @@ FX_LOCAL_PATH local_path; status = fx_unicode_directory_create( &ram_disk, new_file_name, length, (CHAR *)destination_name); /* Close the media. */ - status = fx_media_close(&ram_disk); + status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); - + fx_media_abort( &ram_disk); /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 128, // Sector size + 70000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -433,26 +433,26 @@ FX_LOCAL_PATH local_path; #endif /* FX_ENABLE_FAULT_TOLERANT */ /* Close the media. */ - status = fx_media_close(&ram_disk); + status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); - + fx_media_abort( &ram_disk); /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - 0, // Media buffer size + 0, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000, // Total sectors - 128, // Sector size + 70000, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -471,26 +471,26 @@ FX_LOCAL_PATH local_path; #endif /* Close the media. */ - status = fx_media_close(&ram_disk); + status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); - + fx_media_abort( &ram_disk); /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - 0, // Media buffer size + 0, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors 70000, // Total sectors s - 128, // Sector size + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); return_if_fail( status == FX_SUCCESS); @@ -521,10 +521,10 @@ FX_LOCAL_PATH local_path; status = fx_unicode_directory_create( &ram_disk, long_unicode_name1, length, (CHAR *)destination_name); long_unicode_name1[0] = temp; return_if_fail( status == FX_SUCCESS); - - status = fx_media_close(&ram_disk); + + status = fx_media_close(&ram_disk); return_if_fail( status == FX_SUCCESS); - + printf("SUCCESS!\n"); test_control_return(0); } diff --git a/test/regression_test/filex_unicode_file_directory_rename_extra_test.c b/test/regression_test/filex_unicode_file_directory_rename_extra_test.c index 0c25cbe..5ea2279 100644 --- a/test/regression_test/filex_unicode_file_directory_rename_extra_test.c +++ b/test/regression_test/filex_unicode_file_directory_rename_extra_test.c @@ -46,13 +46,13 @@ void filex_unicode_file_directory_rename_extra_test_application_define(void * #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -71,9 +71,9 @@ UCHAR *pointer; #endif } -static UCHAR new_file_name5[] = {'a', 0, 'b', 0, 'c', 0, 0, 0}; -static UCHAR new_file_name5_bak[] = {'a', 0, 'b', 0, 'c', 0, 0, 0}; -static UCHAR new_file_name6[] = {'1', 0, 'b', 0, 'c', 0, 'd', 0, 0, 0}; +static UCHAR new_file_name5[] = {'a', 0, 'b', 0, 'c', 0, 0, 0}; +static UCHAR new_file_name5_bak[] = {'a', 0, 'b', 0, 'c', 0, 0, 0}; +static UCHAR new_file_name6[] = {'1', 0, 'b', 0, 'c', 0, 'd', 0, 0, 0}; static UCHAR destination_name[100]; /* Define the test threads. */ @@ -90,20 +90,20 @@ UCHAR temp; printf("FileX Test: Unicode file directory rename extra test..............."); /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_value_if_fail( status == FX_SUCCESS, 1); status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -114,7 +114,7 @@ UCHAR temp; return_value_if_fail( status == FX_SUCCESS, 3); temp = new_file_name5[0]; - + /* Attempt to create more than 26 files with unicode names with the same length. */ for ( count = 0; count < 28; count++) { @@ -158,20 +158,20 @@ UCHAR temp; fx_media_abort( &ram_disk); /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track return_value_if_fail( status == FX_SUCCESS, 1); status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory_large, cache_buffer, CACHE_SIZE); @@ -182,7 +182,7 @@ UCHAR temp; return_value_if_fail( status == FX_SUCCESS, 3); temp = new_file_name5[0]; - + /* Attempt to create more than 26 files with unicode names with the same length. */ for ( count = 0; count < 28; count++) { diff --git a/test/regression_test/filex_unicode_file_rename_test.c b/test/regression_test/filex_unicode_file_rename_test.c index 313cd15..064e759 100644 --- a/test/regression_test/filex_unicode_file_rename_test.c +++ b/test/regression_test/filex_unicode_file_rename_test.c @@ -27,17 +27,17 @@ static UCHAR *cache_buffer; static UCHAR cache_buffer[CACHE_SIZE]; #endif /* Notice that old_file_name is the same as new_file_name1. */ -static UCHAR old_file_name[] = {3, 0, 4, 0, 5, 0, 6, 0, 0, 0}; +static UCHAR old_file_name[] = {3, 0, 4, 0, 5, 0, 6, 0, 0, 0}; static UCHAR new_file_name1[] = {3, 0, 4, 0, 5, 0, 6, 0, 0, 0}; static UCHAR new_file_name2[] = {3, 0, 4, 0, 5, 0, 0, 0}; static UCHAR new_file_name3[] = {3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 0, 0}; -static UCHAR new_file_name4[] = {2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, 0, 0, 0}; -static UCHAR new_file_name5[] = {'a', 0, 'b', 0, 'c', 0, 0, 0}; -static UCHAR new_file_name5_bak[] = {'a', 0, 'b', 0, 'c', 0, 0, 0}; -static UCHAR new_file_name6[] = {'a', 0, 'y', 0, 'c', 0, 0, 0}; -static UCHAR new_file_name7[] = {'a', 1, 'z', 0, 'c', 0, 0, 0}; -static UCHAR new_file_name8[] = {'z' + 1, 0, 'z', 0, 'c', 0, 'd', 0, 0, 0}; -static UCHAR new_file_name9[] = {'z' + 1, 1, 'z', 0, 'c', 0, 'd', 0, 0, 0}; +static UCHAR new_file_name4[] = {2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, 0, 0, 0}; +static UCHAR new_file_name5[] = {'a', 0, 'b', 0, 'c', 0, 0, 0}; +static UCHAR new_file_name5_bak[] = {'a', 0, 'b', 0, 'c', 0, 0, 0}; +static UCHAR new_file_name6[] = {'a', 0, 'y', 0, 'c', 0, 0, 0}; +static UCHAR new_file_name7[] = {'a', 1, 'z', 0, 'c', 0, 0, 0}; +static UCHAR new_file_name8[] = {'z' + 1, 0, 'z', 0, 'c', 0, 'd', 0, 0, 0}; +static UCHAR new_file_name9[] = {'z' + 1, 1, 'z', 0, 'c', 0, 'd', 0, 0, 0}; static UCHAR destination_name[100]; #define TEST_COUNT 3 @@ -64,13 +64,13 @@ void filex_unicode_file_rename_application_define(void *first_unused_memory) #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -99,71 +99,71 @@ static void ftest_0_entry(ULONG thread_input) UINT i; UINT status, count; ULONG length; -ULONG old_length; +ULONG old_length; ULONG new_length; FX_PARAMETER_NOT_USED(thread_input); /* Print out some test information banners. */ printf("FileX Test: Unicode File Rename Test..............................."); - + /* Loop to test FAT 12, 16, 32. */ for (i = 0; i < TEST_COUNT; i ++) { if (i == 0) { /* Format the media with FAT12. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 256, // Sector size + 256, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 1) { /* Format the media with FAT16. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 4200 * 8, // Total sectors - 256, // Sector size + 4200 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } else if (i == 2) { /* Format the media with FAT32. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, - _fx_ram_driver, // Driver entry + status = fx_media_format(&ram_disk, + _fx_ram_driver, // Driver entry ram_disk_memory_large, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 70000 * 8, // Total sectors - 256, // Sector size + 70000 * 8, // Total sectors + 256, // Sector size 8, // Sectors per cluster 1, // Heads - 1); // Sectors per track - } + 1); // Sectors per track + } /* Determine if the format had an error. */ if (status) @@ -172,7 +172,7 @@ ULONG new_length; printf("ERROR!\n"); test_control_return(1); } - + /* Attempt to rename a file before the media has been opened */ status = fx_unicode_file_rename(&ram_disk, (UCHAR *)"name", 1, (UCHAR *)"name", 1, (CHAR *) destination_name); if (status != FX_MEDIA_NOT_OPEN) @@ -270,7 +270,7 @@ ULONG new_length; test_control_return(9); } - /* Attempt to create the old_file_name again. */ + /* Attempt to create the old_file_name again. */ length = fx_unicode_length_get(old_file_name); status = fx_unicode_file_create(&ram_disk, old_file_name, length, (CHAR *) destination_name); @@ -283,7 +283,7 @@ ULONG new_length; test_control_return(10); } - /* Attempt to create the new_file_name1 same as old_file_name again. */ + /* Attempt to create the new_file_name1 same as old_file_name again. */ length = fx_unicode_length_get(new_file_name1); status = fx_unicode_file_create(&ram_disk, new_file_name1, length, (CHAR *) destination_name); @@ -297,7 +297,7 @@ ULONG new_length; } - /* Attempt to create the new_file_name2 again. */ + /* Attempt to create the new_file_name2 again. */ length = fx_unicode_length_get(new_file_name2); status = fx_unicode_file_create(&ram_disk, new_file_name2, length, (CHAR *) destination_name); @@ -310,7 +310,7 @@ ULONG new_length; test_control_return(12); } - /* Attempt to create the new_file_name1 again. */ + /* Attempt to create the new_file_name1 again. */ length = fx_unicode_length_get(new_file_name3); status = fx_unicode_file_create(&ram_disk, new_file_name3, length, (CHAR *) destination_name); @@ -323,7 +323,7 @@ ULONG new_length; test_control_return(13); } - /* Attempt to create the new_file_name4 again. */ + /* Attempt to create the new_file_name4 again. */ length = fx_unicode_length_get(new_file_name4); status = fx_unicode_file_create(&ram_disk, new_file_name4, length, (CHAR *) destination_name); @@ -335,7 +335,7 @@ ULONG new_length; printf("ERROR!\n"); test_control_return(14); } - + #ifndef FX_DISABLE_ERROR_CHECKING /* send a null pointer to generate an error */ status = fx_unicode_file_rename(FX_NULL, old_file_name, old_length, new_file_name1, new_length, (CHAR *) destination_name); diff --git a/test/regression_test/filex_unicode_name_string_test.c b/test/regression_test/filex_unicode_name_string_test.c index 5c9100e..60e49c3 100644 --- a/test/regression_test/filex_unicode_name_string_test.c +++ b/test/regression_test/filex_unicode_name_string_test.c @@ -48,13 +48,13 @@ void filex_unicode_name_string_application_define(void *first_unused_memory) #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -98,20 +98,20 @@ FX_LOCAL_PATH local_path; printf("FileX Test: Unicode name string test..............................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Open the ram_disk. */ status += fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE); @@ -122,7 +122,7 @@ FX_LOCAL_PATH local_path; /* Disable write protect */ ram_disk.fx_media_driver_write_protect = FX_FALSE; - /* lengthen the unicode name to include the last 0 */ + /* lengthen the unicode name to include the last 0 */ ULONG length = 15; /* Test creating directory. */ @@ -159,7 +159,7 @@ FX_LOCAL_PATH local_path; /* Specify last found name as the directory we just created. */ buffer[255] = '/'; buffer[256] = 0; - + for (UINT i = 0; i <= 256; i++) ram_disk.fx_media_last_found_name[i] = (CHAR)buffer[i]; diff --git a/test/regression_test/filex_unicode_test.c b/test/regression_test/filex_unicode_test.c index 94b1ec9..7363228 100644 --- a/test/regression_test/filex_unicode_test.c +++ b/test/regression_test/filex_unicode_test.c @@ -73,14 +73,14 @@ void filex_unicode_application_define(void *first_unused_memory) { #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -117,20 +117,20 @@ UINT i; printf("FileX Test: Unicode test..........................................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 100, // Directory Entries 0, // Hidden sectors - 512, // Total sectors - 128, // Sector size + 512, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -139,10 +139,10 @@ UINT i; printf("ERROR!\n"); test_control_return(1); } - + /* try to do all the unicode commands before the media is opened to generate an error */ length = 1; - + /* short name get */ status = fx_unicode_short_name_get(&ram_disk, directory_name, length, (CHAR *) destination_name); if (status != FX_MEDIA_NOT_OPEN) @@ -150,7 +150,7 @@ UINT i; printf("ERROR!\n"); test_control_return(2); } - + /* Call extended version of short name get. */ status = fx_unicode_short_name_get_extended(&ram_disk, directory_name, length, (CHAR*)destination_name, sizeof(destination_name)); if (status != FX_MEDIA_NOT_OPEN) @@ -202,7 +202,7 @@ UINT i; printf("ERROR!\n"); test_control_return(6); } - + /* try to create a directory while the media is write protected */ ram_disk.fx_media_driver_write_protect = FX_TRUE; status = fx_unicode_directory_create(&ram_disk, directory_name, length, (CHAR *) destination_name); @@ -211,7 +211,7 @@ UINT i; printf("ERROR!\n"); test_control_return(7); } - + /* try to create a file while the media is write protected */ status = fx_unicode_file_create(&ram_disk, short_unicode_name, length, (CHAR *) destination_name); if (status != FX_WRITE_PROTECT) @@ -231,7 +231,7 @@ UINT i; printf("ERROR!\n"); test_control_return(9); } - + /* name get */ status = fx_unicode_name_get(FX_NULL, (CHAR *) destination_name, destination_name, &length); if (status != FX_PTR_ERROR) @@ -248,7 +248,7 @@ UINT i; test_control_return(11); } #endif /* FX_DISABLE_ERROR_CHECKING */ - + /* Create the a short and long unicode file name. */ length = fx_unicode_length_get(short_unicode_name); status = fx_unicode_file_create(&ram_disk, short_unicode_name, length, (CHAR *) destination_name); @@ -270,7 +270,7 @@ UINT i; /* Try to create the same name again - this should result in an error! */ length = fx_unicode_length_get(long_unicode_name); status += fx_unicode_file_create(&ram_disk, long_unicode_name, length, (CHAR *) destination_name); - + /* Check for expected error. */ if (status != FX_ALREADY_CREATED) { @@ -280,7 +280,7 @@ UINT i; test_control_return(14); } - /* Try creating a unicode name twice... this should result in an error as well. */ + /* Try creating a unicode name twice... this should result in an error as well. */ length = fx_unicode_length_get(short_unicode_name); status = fx_unicode_file_create(&ram_disk, short_unicode_name, length, (CHAR *) destination_name); @@ -308,7 +308,7 @@ UINT i; length = fx_unicode_length_get(directory_name); status = fx_unicode_directory_create(&ram_disk, directory_name, length, (CHAR *) destination_name); status += fx_file_create(&ram_disk, "qrstuvwxyz"); - + /* Check for erros. */ if (status != FX_SUCCESS) { @@ -374,7 +374,7 @@ UINT i; length = fx_unicode_length_get(short_unicode_name); status += fx_unicode_short_name_get(&ram_disk, short_unicode_name, length, (CHAR *) destination_name); status += fx_unicode_name_get(&ram_disk, (CHAR *) destination_name, destination_name, &length); - + /* Check for errors. */ if ((status) || (length != fx_unicode_length_get(short_unicode_name))) { @@ -388,7 +388,7 @@ UINT i; length = fx_unicode_length_get(long_unicode_name); status += fx_unicode_short_name_get(&ram_disk, long_unicode_name, length, (CHAR *) destination_name); status += fx_unicode_name_get(&ram_disk, (CHAR *) destination_name, destination_name, &length); - + /* Check for errors. */ if ((status) || (length != fx_unicode_length_get(long_unicode_name))) { @@ -402,7 +402,7 @@ UINT i; length = fx_unicode_length_get(directory_name); status += fx_unicode_short_name_get(&ram_disk, directory_name, length, (CHAR *) destination_name); status += fx_unicode_name_get(&ram_disk, (CHAR *) destination_name, destination_name, &length); - + /* Check for errors. */ if ((status) || (length != fx_unicode_length_get(directory_name))) { @@ -419,11 +419,11 @@ UINT i; status += fx_file_delete(&ram_disk, "abcdefghijklmnop"); length = fx_unicode_length_get(long_unicode_name); status += fx_unicode_short_name_get(&ram_disk, long_unicode_name, length, (CHAR *) destination_name); - status += fx_file_delete(&ram_disk, (CHAR *) destination_name); + status += fx_file_delete(&ram_disk, (CHAR *) destination_name); length = fx_unicode_length_get(short_unicode_name); status += fx_unicode_short_name_get(&ram_disk, short_unicode_name, length, (CHAR *) destination_name); - status += fx_file_delete(&ram_disk, (CHAR *) destination_name); - + status += fx_file_delete(&ram_disk, (CHAR *) destination_name); + /* Check for erros. */ if (status != FX_SUCCESS) { @@ -434,14 +434,14 @@ UINT i; } - /* Move the directory default back to the root. */ + /* Move the directory default back to the root. */ status += fx_directory_default_set(&ram_disk, "/"); /* Test the short/long name get routines with the short unicode name. */ length = fx_unicode_length_get(short_unicode_name); status += fx_unicode_short_name_get(&ram_disk, short_unicode_name, length, (CHAR *) destination_name); status += fx_unicode_name_get(&ram_disk, (CHAR *) destination_name, destination_name, &length); - + /* Check for errors. */ if ((status) || (length != fx_unicode_length_get(short_unicode_name))) { @@ -455,7 +455,7 @@ UINT i; length = fx_unicode_length_get(long_unicode_name); status += fx_unicode_short_name_get(&ram_disk, long_unicode_name, length, (CHAR *) destination_name); status += fx_unicode_name_get(&ram_disk, (CHAR *) destination_name, destination_name, &length); - + /* Check for errors. */ if ((status) || (length != fx_unicode_length_get(long_unicode_name))) { @@ -469,7 +469,7 @@ UINT i; length = fx_unicode_length_get(directory_name); status += fx_unicode_short_name_get(&ram_disk, directory_name, length, (CHAR *) destination_name); status += fx_unicode_name_get(&ram_disk, (CHAR *) destination_name, destination_name, &length); - + /* Check for errors. */ if ((status) || (length != fx_unicode_length_get(directory_name))) { @@ -486,7 +486,7 @@ UINT i; status += fx_file_delete(&ram_disk, "abcdefghijklmnop"); length = fx_unicode_length_get(long_unicode_name); status += fx_unicode_short_name_get(&ram_disk, long_unicode_name, length, (CHAR *) destination_name); - status += fx_file_delete(&ram_disk, (CHAR *) destination_name); + status += fx_file_delete(&ram_disk, (CHAR *) destination_name); length = fx_unicode_length_get(short_unicode_name); status += fx_unicode_short_name_get(&ram_disk, short_unicode_name, length, (CHAR *) destination_name); status += fx_file_delete(&ram_disk, (CHAR *) destination_name); diff --git a/test/regression_test/filex_utility_fat_flush_test.c b/test/regression_test/filex_utility_fat_flush_test.c index f35573f..3e3f1bb 100644 --- a/test/regression_test/filex_utility_fat_flush_test.c +++ b/test/regression_test/filex_utility_fat_flush_test.c @@ -53,13 +53,13 @@ void filex_utility_fat_flush_application_define(void *first_unused_memory) #ifndef FX_STANDALONE_ENABLE UCHAR *pointer; - + /* Setup the working pointer. */ pointer = (UCHAR *) first_unused_memory; /* Create the main thread. */ - tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, - pointer, DEMO_STACK_SIZE, + tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0, + pointer, DEMO_STACK_SIZE, 4, 4, TX_NO_TIME_SLICE, TX_AUTO_START); pointer = pointer + DEMO_STACK_SIZE; @@ -97,20 +97,20 @@ ULONG i; printf("FileX Test: Utility FAT flush test......................................."); /* Format the media. This needs to be done before opening it! */ - status = fx_media_format(&ram_disk, + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer cache_buffer, // Media buffer pointer - CACHE_SIZE, // Media buffer size + CACHE_SIZE, // Media buffer size "MY_RAM_DISK", // Volume Name 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 511, // Total sectors - 128, // Sector size + 511, // Total sectors + 128, // Sector size 1, // Sectors per cluster 1, // Heads - 1); // Sectors per track + 1); // Sectors per track /* Determine if the format had an error. */ if (status) @@ -133,8 +133,8 @@ ULONG i; } /* Create a file called TEST.TXT in the root directory. */ - status = fx_file_create(&ram_disk, "TEST.TXT"); - + status = fx_file_create(&ram_disk, "TEST.TXT"); + /* Check the create status. */ if (status != FX_SUCCESS) { @@ -155,7 +155,7 @@ ULONG i; /* Pickup the available bytes in the media. */ status = fx_media_space_available(&ram_disk, &available_bytes); - + /* Check for available bytes error. */ if ((status != FX_SUCCESS) || (available_bytes < sizeof(ULONG))) { @@ -169,7 +169,7 @@ ULONG i; write_value = 0; while (i < available_bytes) { - + /* Write 4 bytes to the file. */ status = fx_file_write(&my_file, (void *) &write_value, sizeof(ULONG)); @@ -180,17 +180,17 @@ ULONG i; printf("ERROR!\n"); test_control_return(6); } - + /* Increment byte count. */ i = i + sizeof(ULONG); - + /* Increment write value. */ write_value++; } - + /* Pickup the available bytes in the media again. */ status = fx_media_space_available(&ram_disk, &i); - + /* Check for available bytes error. */ if ((status != FX_SUCCESS) || (i != 0)) { @@ -198,41 +198,41 @@ ULONG i; printf("ERROR!\n"); test_control_return(7); } - + for (i = 0; i < FX_MAX_FAT_CACHE; i++) { ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_cluster = 496; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_value = 1; ram_disk.fx_media_fat_cache[i].fx_fat_cache_entry_dirty = 1; } - - _fx_utility_FAT_flush(&ram_disk); - - /* Note: If definition of FX_FAT_MAP_SIZE is changed in future, the value checked in + + _fx_utility_FAT_flush(&ram_disk); + + /* Note: If definition of FX_FAT_MAP_SIZE is changed in future, the value checked in return_value_if_fail will change for individual array element */ for(i=0;i