Short: Flush all filesystem buffers to disk Author: Davide Cutugno Uploader: davidecutugno gmail com (Davide Cutugno) Type: disk/misc Version: 1.5 Architecture: m68k-amigaos >= 2.0.4 ____ _ _ _____ _ _ | _ (_) | | | ___| | | | | | | |_ ___| | __| |__ | |_ _ ___| |__ | | | | / __| |/ /| __|| | | | / __| '_ | |/ /| __ < | |___| | |_| __ | | | |___/ |_|___/_|_|_| |_|__,_|___/_| |_| ============================================= Version 1.5 (c) 2025 Davide Cutugno INTRODUCTION =========================================================================== DiskFlush is a utility that ensures all filesystem buffers are written to disk. It's especially useful before performing a fast reboot to prevent any data loss from cached writes that haven't yet been committed to disk. When the Amiga filesystem caches data, there's always a short delay before it actually writes that data to physical media. DiskFlush forces an immediate write of all cached data across all mounted volumes. REQUIREMENTS =========================================================================== - AmigaOS 2.0 or higher INSTALLATION =========================================================================== Simply copy DiskFlush to a location in your path, such as: C: (System commands directory) SYS:Tools (Common tools directory) USAGE =========================================================================== DiskFlush [OPTION] Options (only one may be specified): QUIET - Suppresses all progress messages VERBOSE - Displays detailed progress information for each operation LISTFAILED - Only outputs a list of devices that failed to flush (ideal for scripts) OPERATION =========================================================================== DiskFlush performs the following operations for each mounted volume: 1. Sends ACTION_FLUSH packet to write all dirty buffers to disk 2. Sends ACTION_INHIBIT with DOSTRUE to perform disk driver update 3. Sends ACTION_INHIBIT with DOSFALSE to release the inhibition If inhibition fails (common for busy volumes or PFS3 volumes): - Falls back to ACTION_DISK_INFO method, which is effective for PFS3 volumes without requiring inhibition This multi-stage approach ensures complete synchronization of all cached data with physical media across all mounted drives in your system, with special handling for volumes that cannot be inhibited. RETURN CODES =========================================================================== DiskFlush returns one of the following exit codes that can be checked in shell scripts: 0 (RETURN_OK) - All devices were successfully flushed 5 (RETURN_WARN) - Some devices were successfully flushed, but others failed 20 (RETURN_FAIL) - No devices could be flushed or an error occurred EXAMPLES =========================================================================== Standard use (shows essential messages): DiskFlush Silent operation (suppresses all messages): DiskFlush QUIET Verbose operation with detailed messages: DiskFlush VERBOSE List only failed devices (useful for scripts): DiskFlush LISTFAILED Before reboot: DiskFlush reboot HISTORY =========================================================================== 1.5 (28.5.2025) - Fixed potential array bounds checking issues - Added NULL pointer safety checks - Improved output formatting for device lists - Fixed memory management to prevent potential crashes - Added LISTFAILED option to output only failed device names - Enhanced command-line validation to ensure only one option is used at a time 1.4 (27.5.2025) - Added enhanced PFS3 volume support with alternative flushing method - Implemented fallback to ACTION_DISK_INFO when inhibition fails - Improved handling for busy volumes to ensure complete flushing 1.3 (26.5.2025) - Enhanced error reporting with separate tracking for inhibit failures - Improved user interface with better formatted output - Added more detailed reporting in verbose mode - Applied HunkShort optimization for smaller executable size - Added PARAMETERS=REGISTERS compiler optimization for faster execution 1.2 (19.5.2025) - Implemented dynamic memory allocation for devices names up to 32 characters - Further reduced memory footprint for resident operation - Ensured proper memory cleanup in all code paths - Improved RAM disk detection using proper case-insensitive string functions - Added compiler optimization directives for smaller code size - Implemented static functions for better inline optimization - Source code added to the distribution 1.1 (19.5.2025) - Optimized for memory resident (PURE/resident) - Reduced buffer sizes for better memory efficiency - Improved RAM disk detection with case-insensitive matching - Enhanced error handling for busy drives 1.0 (16.5.2025) - First public release LEGAL =========================================================================== Copyright © 2025 Davide Cutugno All Rights Reserved. This software is provided as-is, without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, except commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. 2. Altered versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any distribution. CONTACT AND ACKNOWLEDGMENTS =========================================================================== For bug reports, suggestions, or other communications: Davide Cutugno WARNING =========================================================================== This utility was developed with assistance from Claude AI. AI-generated code may not be perfect and may introduce bugs. Always review the source code before release. Thank you for using DiskFlush!