Topic : TOS - The Operating System Author : Version : tos.hyp (December 19, 2008) Subject : Programmieren/Atari Nodes : 3010 Index Size : 93790 HCP-Version : 5 Compiled on : Atari @charset : atarist @lang : @default : Title @help : @options : +g -i -s +x +zz -t4 @width : 70 View Ref-File11.5.15.1.4 dfs_drv_close TOS Name: »dfs_drv_close« Parameters: d0 = int mode a0 = DMD *d -> d0 = long errcode Description: The dfs_drv_close function too fulfills two tasks, depending on mode: 1. mode == 0: The DOS_XFS asks the DFS whether the drive may be closed. If this is not permitted, then EACCDN must be returned, else E_OK (required e.g. for Dlock). Opened files were already recognized be the kernel and DOS_XFS, i.e. in that case dfs_drv_close will not be called at all. For this reason, generally no altered sector buffers may exist, even those that are currently being read or written (this is always done via files!). In this case it suffices, therefore, always to return an E_OK. Things become more problematic if one uses a write-back cache. With this it may happen that no file is open any more, but a buffer still holds data that have to be written back. The kernel makes a sync call (xfs_sync, which is passed on to dfs_sync) before the inquiry is made; thus no altered buffers ought to exist any more - if they do, then for safety's sake the DFS should return EACCON. Das DOS_XFS fragt das DFS, ob das Laufwerk geschlossen werden darf. Wenn dies nicht erlaubt ist, muß EACCDN geliefert werden, sonst E_OK (nötig z.B. für Dlock()). Geöffnete Dateien wurden bereits von Kernel und DOS_XFS erkannt, d.h. in solch einem Fall wird dfs_drv_close überhaupt nicht aufgerufen. 2. mode == 1: The DOS_XFS forces the closing of the drive, the DFS must return E_OK. No caches may be written back, since the drive is already invalid (after a media change has been reported already). With Dlock, dfs_drv_close is first called in mode 0, then - if no error has occurred - with mode 1. This strategy will be carried out also even if at some time a mechanism is built in that monitors the eject button of interchangeable-media drives or CD-ROMs, and bars ejection if necessary. Group: Make-up of a DFS See also: MagiC's DFS-concept