+link rel
[www.jankratochvil.net.git] / project / captive / doc / Details.html.pl
1 #! /usr/bin/perl
2
3 # $Id$
4 # Captive project doc Details page Perl template.
5 # Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; exactly version 2 of June 1991 is required
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
20
21 package project::captive::doc::Details;
22 require 5.6.0;  # at least 'use warnings;' but we need some 5.6.0+ modules anyway
23 our $VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
24 our $CVS_ID=q$Id$;
25 use strict;
26 use warnings;
27
28 BEGIN{ open F,"Makefile"; our $top_dir=pop @{[split /\s/,(grep /^top_srcdir/,<F>)[0]]}; eval "use lib '$top_dir'"; close F; }
29 use My::Web;
30 require CGI;
31 BEGIN { Wuse 'project::captive::doc::Macros'; }
32
33
34 project::captive::doc::Macros->init(
35                 "__PACKAGE__"=>__PACKAGE__,
36                 "title"=>'Captive NTFS Developer Documentation: Implementation Details',
37                 "rel_prev"=>'CacheManager.html.pl',
38                 "rel_next"=>'APITypes.html.pl',
39                 );
40
41
42 print <<"HERE";
43
44
45 <h1>Implementation Details</h1>
46
47         <a name="emulmeth"><h2>Choice of the Emulation Methods</h2></a>
48
49                 <p>The intent of the project was to get reliable read-write access to
50                 <span class="productname">NTFS</span> partition. There are several possible
51                 ways to achieve that:</p>
52
53                 <a name="emulmeth_vm"><h3>Virtualmachine Running the Original W32 Subsystem</h3></a>
54
55                         <p>Creating virtual-hardware PC and running the original W32 binaries
56                         including their boot-loader etc. Disk device access would be passed as
57                         virtual IDE disk (=hard disk drive). File access API would be implemented
58                         either by special escaping by some trapped instruction out of the
59                         virtualmachine while using W32 file access API or using the standard W32
60                         SMB (Server Message Block) network access through some virtual network
61                         card. The latter network access solution is almost the currently available
62                         possibility of running full-blown disk-sharing real
63                         <span class="productname">Microsoft Windows NT</span> inside virtual
64                         machine emulator such as <span class="productname">VMware</span>.</p>
65
66                         <p>pros: Full compatibility due to fully native codebase.</p>
67
68                         <p>cons: Hard to debug, missing documentation of NT booting internals,
69                         possible problems by different PC virtual-hardware than expected by NT,
70                         requirement of fully installed
71                         <span class="productname">Microsoft Windows NT</span> product.</p>
72
73                 <a name="method_ntoskrnl"><h3>&quot;ntoskrnl.exe&quot; Inside Virtual Address Space</h3></a>
74
75                         <p>This solution was chosen by the project. Binary filesystem driver and
76                         also <span class="fname">ntoskrnl.exe</span> binary file are required.
77                         Unfortunately <span class="fname">ntoskrnl.exe</span> expects a&nbsp;native
78                         PC virtual-hardware missing during regular UNIX user space process
79                         emulation, therefore such instructions must be trapped and emulated/ignored
80                         from case to case.</p>
81
82                         <p>Also the <a name="init_ntoskrnl">initialization code of <span
83                         class="fname">ntoskrnl.exe</span></a> is not executed by this project since
84                         it expects to get full PC hardware access privileges and thus some
85                         datastructures do not get initialized by it (need to be trapped later at
86                         runtime stage). Some of the missing initializations are solved by
87                         @{[ a_href 'APITypes.html.pl#functype_wrap','API functions wrapping' ]}.
88
89                         <p>pros: Lightweight, easier to debug.</p>
90
91                         <p>cons: Possible incompatible emulation of
92                         <span class="fname">ntoskrnl.exe</span> parts, missing documentation needed
93                         for the implementation.</p>
94
95                 <a name="emulmeth_fs"><h3>Filesystem Driver Inside Virtual Address Space</h3></a>
96
97                         <p>Unlike @{[ a_href 'Details.html.pl#method_ntoskrnl','previous method' ]} here we do not use
98                         even <span class="fname">ntoskrnl.exe</span> as the complete kernel part of
99                         W32 is <a name="native_ntoskrnl">emulated from the project source
100                         files</a>. <span class="fname">cdfs.sys</span> driver was successfuly ran
101                         in this manner in the former versions of this project but the possibility
102                         to run without <span class="fname">ntoskrnl.exe</span> was dropped since it
103                         had no licensing gains (you need the original
104                         <span class="productname">Microsoft Windows NT</span> files at least for
105                         the filesystem driver itself) and the emulation of undocumented parts
106                         reusable from <span class="fname">ntoskrnl.exe</span> binary was
107                         a&nbsp;pain.</p>
108
109                         <p>pros: Lightweight, easier to debug.</p>
110
111                         <p>cons: Possible incompatible emulation of the whole
112                         <span class="fname">ntoskrnl.exe</span>, its missing documentation.</p>
113
114
115         <a name="apichoice"><h2>API Function Implementation Choices</h2></a>
116
117                 <p>During the initial point of the project development all the API
118                 functions were defined as unimplemented, of course. Any call of such
119                 unimplemented function is fatal and results in program termination. When we
120                 need to implement any required API function we have multiple choices to do
121                 so:
122                 @{[ a_href 'APITypes.html.pl#functype_pass','Direct pass to original <span class="fname">ntoskrnl.exe</span>' ]},
123                 @{[ a_href 'APITypes.html.pl#functype_wrap','Wrap of the original <span class="fname">ntoskrnl.exe</span> function' ]},
124                 @{[ a_href 'APITypes.html.pl#functype_native_reactos','Native implementation &ndash; $ReactOS' ]},
125                 @{[ a_href 'APITypes.html.pl#functype_native_wine','Native implementation &ndash; $Wine' ]}
126                 or
127                 @{[ a_href 'APITypes.html.pl#functype_native_libcaptive','Native implementation &ndash; project specific' ]}.
128                 <!-- a_href 'APITypes.html.pl#functype_undef','Undefined function' -->
129
130
131         <a name="sandbox"><h2>Sandboxing of W32 Filesystem</h2></a>
132
133                 <p>The emulated W32 environment running the original W32 filesystem driver
134                 is separated from the rest of UNIX OS. It achieves the following goals:</p>
135
136                 <ul>
137                         <li><b>Restartable</b>: W32 driver can be restartde in clean state if it crashed</li>
138                         <li><b>Secure</b>: Malicious W32 code cannot affect the security of UNIX OS</li>
139                         <li><b>Stable</b>: Buggy W32 cannot crash any part of UNIX OS</li>
140                 </ul>
141
142                 <p>Sandboxing is provided with the following attributes:</p>
143                 
144                 <ul>
145                         <li>standalone UNIX process with separate memory space</li>
146                         <li>chroot(2) in empty directory to prevent any UNIX OS filesystem access</li>
147                         <li>setuid(2) to own user/group to prevent interaction with UNIX processes</li>
148                         <li>setrlimit(2) to limit system resources available for W32 environment</li>
149                         <li>the only connection with the UNIX OS by CORBA/ORBit RPC</li>
150                 </ul>
151
152                 <p>This security is almost the same as provided by
153                 emulated virtual machines such as
154                 @{[ a_href 'http://www.vmware.com/solutions/security.html','VMware' ]}.</p>
155
156                 @{[ doc_img 'dia/inheritance','Sandboxing Scheme' ]}
157
158                 <p>Project can be also used in non-sandboxed mode by
159                 <span class="command">--no-sandbox</span> option as it is easier to debug
160                 without CORBA/ORBit RPC. In this case the
161                 <span class="type">DirectorySlave</span>/<span class="type">FileSlave</span>
162                 options are used directly instead of their
163                 <span class="type">DirectoryParent</span>/<span class="type">FileParent</span>
164                 peers.</p>
165
166
167         <a name="patched"><h2>&quot;patched&quot; vs. &quot;unpatched&quot; Libraries</h2></a>
168
169                 <p>Library is called <span class="constant">patched</span> if we require
170                 loading its original binary code file. Project needs to patch it to be able
171                 to trap all the function entry points. The only currently
172                 <span class="constant">patched</span> library of this project is
173                 <span class="fname">ntoskrnl.exe</span>.</p>
174
175                 <p>Library is called <span class="constant">unpatched</span> if no original
176                 binary code is needed since all of its functions are completely emulated by
177                 @{[ a_href 'APITypes.html.pl#functype_native','the native implementations' ]} of this project.
178                 The typical <span class="constant">unpatched</span> representative is
179                 <span class="fname">hal.dll</span> as it specializes on the hardware
180                 dependent code and therefore it must be completely replaced by this project
181                 running in the $gnulinux operating system environment. Early versions of
182                 this project had also full <span class="constant">unpatched</span>
183                 <a href="#native_ntoskrnl">native implementation of
184                 <span class="fname">ntoskrnl.exe</span></a> but it no longer applies.</p>
185
186         <a name="mman"><h2>Memory Management</h2></a>
187
188                 <p>Original <span class="productname">Microsoft Windows NT</span>
189                 architecture uses two address space areas &ndash; user space and kernel space.
190                 User space is mapped in the range <span class="constant">0x00000000</span>
191                 to <span class="constant">0x7FFFFFFF</span>, kernel space is mapped in the
192                 range <span class="constant">0x80000000</span>
193                 (<span class="constant">KERNEL_BASE</span> in $ReactOS sources) to
194                 <span class="constant">0xFFFFFFFF</span>. All these virtual memory ranges
195                 represent addresses after their MMU (Memory Management Unit) mapping, of
196                 course. More discussion can be found in the
197                 <a href="http://www.microsoft.com/hwdev/platform/server/PAE/PAEmem.asp">description 
198                 by <span class="productname">Microsoft</span></a>.</p>
199
200                 <p>This project runs in the virtual address space used both for the UNIX
201                 user space process part and for the W32 kernel space. Therefore this
202                 project defines that W32 kernel runs in the whole range
203                 <span class="constant">0x00000000</span> to
204                 <span class="constant">0xFFFFFFFF</span> since there are no special mapping
205                 assumptions about the UNIX user space process mapping. No W32 user space
206                 exists in this project. Such approach also nullifies any special memory
207                 moving operations between W32 kernel space and W32 user space memory areas
208                 (such as <span class="function">MmSafeCopyToUser()</span>).</p>
209
210         <a name="unicode"><h2>Unicode Strings and Characters</h2></a>
211
212                 <p>W32 platform uses 16-bit type <span class="type">wchar_t</span> while $gnulinux uses a
213                 32-bit one. This can be problem during GCC (GNU C&nbsp;Compiler)
214                 compilation of combination of native UNIX C&nbsp;sources (assuming 32-bit
215                 GCC with 32-bit <span class="type">wchar_t</span>) and
216                 $ReactOS C sources (assuming W32 compiler with 16-bit
217                 <span class="type">wchar_t</span>) for literal wide strings
218                 (C source file systax: <span class="command">L&quot;wstring&quot;</span>).
219                 Possibilities to solve this issue list:</p>
220
221                 <ul>
222                         <li>
223                                 <p>Using <span class="constant">-fshort-wchar</span> GCC option and
224                                 strictly differentiate between compilation of
225                                 <span class="productname">ReactOS</span> code and UNIX code.</p>
226
227                                 <p>pros: No source modifications needed, no runtime performance hit.</p>
228
229                                 <p>cons: No type checking if some part of code has bad compilation
230                                 flags, complicated way to completely split
231                                 <span class="productname">ReactOS</span> and UNIX code.</p>
232                         </li>
233                         <li>
234                                 <p>Wrap all <span class="productname">ReactOS</span> literal constants
235                                 by some conversions function call (implemented as macro
236                                 <span class="function">REACTOS_UCS2()</span> by this project).</p>
237
238                                 <p>pros: Any forgotten/mistaken conversions are type-checked and warned
239                                 during the compilation by GCC.</p>
240
241                                 <p>cons: All compiled <span class="productname">ReactOS</span> sources
242                                 files containing literal wide strings have to be wrapped/modified,
243                                 performance hit by runtime string conversions.</p>
244
245                                 <p>This solution was chosen to get the internal sanity checking
246                                 benefit.</p>
247                         </li>
248                 </ul>
249
250         <a name="binfmt"><h2>Supported Binary Formats</h2></a>
251
252                 <p>The native W32 binary format is identified as
253                 <span class="constant">PE-32</span> (Portable Executable 32-bit), such
254                 files have all the usual extensions such as
255                 <span class="fname">.sys</span>, <span class="fname">.exe</span>,
256                 <span class="fname">.dll</span> etc. <span class="constant">PE-32</span>
257                 loading support was already implemented by $ReactOS, its memory mapping
258                 specifics just had to be ported to $gnulinux environment by this project.
259                 This loading support does not (yet) cover importing of debug symbols from
260                 W32 <span class="fname">.PDB</span> (Program DataBase) files in $gnulinux
261                 ABI (Application Binary Interface) compatible way.</p>
262
263                 <p>This project also supports transparent loading of UNIX
264                 <span class="fname">.so</span> (Shared Object file) binary format. If you
265                 have W32 source files for some W32 library you can try to compile it by GCC
266                 to get the shared library with $gnulinux ABI compatible debug information
267                 (GCC option <span class="constant">-ggdb3</span> recommended). Beware of
268                 possible compilation problems as <span class="productname">Microsoft</span>
269                 C&nbsp;code expects <span class="constant">exception</span> handling to be
270                 supported by the compiler (definitely not the case of the plain C compiler
271                 of GCC) &mdash; all the exception catching code should be discarded as any
272                 @{[ a_href '#exception_fatal','generated exceptions are always fatal' ]} when
273                 such driver is running in the scope of this project. You can use the
274                 following script of this project to compile W32 filesystem source files as
275                 UNIX <span class="fname">.so</span>:
276                 @{[ captive_srcfile 'src/w32-mod/ext2fsd.so-build.sh' ]}</p>
277                 
278                 <p>Be aware of some differences if you use
279                 <span class="constant">PE-32</span> binary format file vs.
280                 <span class="fname">.so</span> format file.
281                 <span class="constant">PE-32</span> use the appropriate W32 specific
282                 @{[ a_href '#calltype','cdecl/stdcall/fastcall call types' ]},
283                 <span class="fname">.so</span> must be completely compiled in the standard
284                 UNIX @{[ a_href 'CallType.html.pl#calltype_cdecl','cdecl call type semantics' ]}.
285                 @{[ a_href 'APITypes.html.pl#functype_native','Native function implementations' ]} do not need
286                 to be explicitely exported by <span class="fname">captivesym</span> as they
287                 are resolved automatically by the UNIX dynamic system linker. It may be
288                 surprising you will have to fix all such missing symbol exports if you
289                 advance during the development from the debugging
290                 <span class="fname">.so</span> file for the production version of the
291                 original <span class="constant">PE-32</span> binary file.</p>
292
293
294         <a name="mounted_one"><h2>At Most One Mounted Filesystem</h2></a>
295
296                 <p>The project technically supports only one (exactly one...) mounted
297                 filesystem device and only one filesystem driver. There is nothing
298                 complicated to support multiple disks and multiple loaded filesystem
299                 modules but as they would share the address space it would only bring
300                 a&nbsp;possible complications during bug reports and the bug solving
301                 itself.  It was considered as a&nbsp;more sane way to support multiple W32
302                 mounted disks by completely separately running project instances in
303                 a&nbsp;different UNIX processes communicating from their sandboxes via
304                 @{[ a_href 'Details.html.pl#sandbox','CORBA sandbox interface' ]}. This sandboxing
305                 feature is not yet deployed although its code is already prepared.</p>
306
307                 <p>The project also does not support any state cleanup to be able to load
308                 filesystem&nbsp;<span class="constant">A</span>,
309                 cleanup&nbsp;<span class="constant">A</span> and load a different
310                 filesystem&nbsp;<span class="constant">B</span> in the same process address
311                 space. It complies with the preventions of the possible debugging
312                 complications as noted above. Despite this you still must call the function
313                 <span class="function">captive_shutdown()</span> to flush all the pending
314                 filesystem buffers to the disk. After calling
315                 <span class="function">captive_shutdown()</span> the process address space is
316                 no longer usable for any further project operations and the process is
317                 expected to be terminated in the manner compatible with its driving
318                 @{[ a_href 'Details.html.pl#sandbox','CORBA sandbox interface' ]} control master.</p>
319
320                 <p>Each sandbox executing the untrusted W32 binary filesystem driver code
321                 is connected through its
322                 @{[ a_href 'Details.html.pl#sandbox','CORBA sandbox interface' ]} at the point of upper
323                 layer <span class="constant">libcaptive</span>-specific filesystem API, at
324                 the point of the bottom layer of <span class="type">GIOChannel</span>
325                 device access and also for transfers of GLib logging
326                 messages/warnings/errors out of the sandbox to the user.</p>
327
328
329         <a name="synchronous"><h2>Multithreading and Multiple Processors</h2></a>
330
331                 <p>W32 platform stands on its&nbsp;thorough architecture parallelism. It
332                 must lock all its objects to maintain coherence in presence of
333                 multithreading and multiple processors. Since the author of this project
334                 considers any parallel execution a serious obstacle for debugging the whole
335                 project architecture was designed to prevent any undeterministic behaviour.
336                 Therefore this projects always emulates uniprocessor
337                 <span class="productname">Microsoft Windows NT</span> kernel
338                 (<span class="constant">KeNumberProcessors</span> symbol is always 1),
339                 everything runs in the single initial thread/process and all the filesystem
340                 operations are performed as synchronous
341                         (&quot;synchronous&quot; by flags
342                         <span class="constant">FILE_SYNCHRONOUS_IO_ALERT</span>,
343                         <span class="constant">FO_SYNCHRONOUS_IO</span>,
344                         <span class="constant">IRP_SYNCHRONOUS_API</span>,
345                         <span class="constant">IRP_SYNCHRONOUS_PAGING_IO</span>,
346                         forced <span class="constant">TRUE</span> result of
347                         <span class="function">IoIsOperationSynchronous()</span>
348                         etc.).
349                 For several cases needed only by <span class="fname">ntfs.sys</span> there
350                 had to be supported asynchronous access
351                 (<span class="constant">STATUS_PENDING</span> return code) &ndash; parallel
352                 execution is emulated by GLib
353                 <span class="function">g_idle_add_full()</span> with
354                 <span class="function">g_main_context_iteration()</span> called during
355                 <span class="function">KeWaitForSingleObject()</span>.</p>
356                 Since there is a&nbsp;possibility a&nbsp;real W32 parallel threading would
357                 be yet needed in the future all the code that would be hit by W32
358                 multithreading capability is marked by
359                 <span class="constant">TODO:thread</span> comment.</p>
360
361                 <p>Multiple processors (SMP) support will never need to be implemented
362                 since uniprocessor W32 kernels apparently run the filesystem driver modules
363                 fine. As this project implements only the uniprocessor W32 kernel all the
364                 processor locking functions and structures such as
365                 <span class="constant">KSPIN_LOCK</span> etc. can be safely implemented as
366                 no-operations.</p>
367
368                 <p>Asynchronous callbacks registered for
369                 <span class="constant">IO_WORKITEM</span>s are passed as GLib idle
370                 functions by <span class="function">g_idle_add_full()</span>. Although they
371                 will probably never be executed during non-interactive project's batch
372                 executions it is the&nbsp;responsibility of W32 driver implementation to
373                 complete all the pending tasks before its W32 shutdown. Such W32 shutdown
374                 is done during cleanup of the project's&nbsp;execution by
375                 <span class="function">captive_shutdown()</span>.</p>
376
377         <a name="paranoia"><h2>Paranoia Checks</h2></a>
378
379                 <p>A&nbsp;general approach of software projects development is to implement
380                 many internal sanity checks during the development stage but to produce the
381                 most optimized final release product without those debugging checks.</p>
382
383                 <p>Facilities for these practices can be seen in the standard
384                 C&nbsp;include files for example as function
385                 <span class="function">assert()</span> which gets disabled by the
386                 <span class="constant">NDEBUG</span> symbol used during the final optimized
387                 executable compilation. This project uses Gnome GLib messaging subsystem
388                 offering sanity checks discarded by symbols
389                 <span class="constant">G_DISABLE_ASSERT</span> and
390                 <span class="constant">G_DISABLE_CHECKS</span>.
391                 <span class="productname">Microsoft</span> also produces two versions of
392                 its products &ndash; regular customers use the &quot;free build&quot; (also
393                 called &quot;retail&quot;) while the programmers should develop their code
394                 on the &quot;checked build&quot; product releases.</p>
395
396                 <p>As this project will always run unknown binary code of proprietary W32
397                 filesystem drivers, the code can never be trusted. Such code even runs in
398                 the same unprotected address space as its controlling UNIX code. Since
399                 there is not enough documentation for the W32 components of the system and
400                 also such documentation is usually misleading it can never be considered as
401                 100% emulation. Even in the final releases all the sanity checks
402                 implemented in this project should remain active as all the project's code
403                 always interacts with unknown and untrusted W32 binaries.</p>
404
405                 <p><span class="productname">Microsoft Windows NT</span> code is written in
406                 a&nbsp;foolproof style as it accepts even invalid input values, and which
407                 it usually corrects. This makes long-term debugging a&nbsp;pain as it hides
408                 sources of problems. &quot;Checked build&quot; releases were probably
409                 designed to fix this flaw by strict consistency checks but it did not reach
410                 its goals as such checks are usually missing in the code.</p>
411
412                 <p>This project has strict consistency checks across all the code to make
413                 the debugging phase easy enough. Failed sanity check is not always
414                 a&nbsp;bug &ndash; sometimes it just means the real W32 binary code is more
415                 benevolent than it could be expected according to the documentation and
416                 such sanity check gets removed for the next version build. In other cases
417                 the failed sanity checks mean the execution path for some unexpected
418                 arguments combination was not yet implemented by this project. I may also
419                 mean a bug, of course...</p>
420
421                 <p>Last but not least &ndash; never miss a&nbsp;possible sanity check as its
422                 later removal is in an order of magnitude cheaper than an&nbsp;uncaught
423                 invalid assumption. Failed assertion is not always a&nbsp;bug although it
424                 has to be fixed, of course.</p>
425
426
427         <a name="logfile"><h2>STATUS_LOG_FILE_FULL</h2></a>
428
429                 <p>After writing approx. 1MB of data on NTFS test partition NTFS driver
430                 returns for any further write requests
431                 <span class="constant">STATUS_LOG_FILE_FULL</status> error code.
432                 Apparently it is caused by the fact this project is
433                 @{[ a_href 'Details.html.pl#synchronous','single-threaded' ]} and it ignores the spawn
434                 of parallel journalling thread during <span class="fname">ntfs.sys</span>
435                 initialization.</p>
436
437                 <p>Fortunately <span class="fname">ntfs.sys</span> will clear its
438                 journalling log file during filesystem unmount. This project will therefore
439                 remount the volume if <span class="constant">STATUS_LOG_FILE_FULL</status>
440                 is detected to workaround missing journalling thread.</p>
441
442                 <p>Similiar behaviour can be seen during write of compressed files &mdash;
443                 the file gets written uncompressed and its compression will proceed only
444                 during the final filesystem unmount.</p>
445
446                 <p>For these reasons it was mandatory to support
447                 @{[ a_href 'Details.html.pl#parent_connector','transparent volume remounting' ]}.</p>
448
449
450         <a name="parent_connector"><h2><span class="constant">ParentConnector</span> volume remounter</h2></a>
451
452                 <p>The sandbox master component of this project has control of restarting
453                 its sandbox slaves containing the W32 filesystem. Target goal of
454                 <span class="constant">ParentConnector</span> component is to transparently
455                 provide persistent view of files and directories over the sandboxed slaves
456                 being restarted.</p>
457                 
458                 <p>In the case of read-only operations it would be simple as we could only
459                 save our state of currently opened filesystem objects with their read
460                 file/directory offset. Write operations can be handled as the read-only
461                 ones as long as all the operations are successful. In the case of W32
462                 filesystem crash we loose all the past write operations. If we would redo
463                 all the write operations we could very easily invoke the same crash.
464                 Therefore we write:</p>
465
466                         <blockquote class="command">
467                                 <p>Filesystem crash broke dirty object: FILE/PATH/NAME</p>
468                         </blockquote>
469
470                 <p>message to syslog and refuse any further operations with this
471                 object.</p>
472
473                 @{[ doc_img 'dia/parent-connector','Parent Connector' ]}
474
475                 <p><span class="constant">HANDLE</span> represents W32 object open in
476                 existing W32 filesystem.<span class="constant">HANDLE</span> is created
477                 on-demand according to the saved state of the object (such as its
478                 pathname). Even the whole <span class="constant">VFS</span> sandbox slave
479                 is spawn on-demand if some object operation requests it.</p>
480
481                 <p>W32 filesystem crash can obviously occur at any moment - it generates
482                 @{[ a_href 'http://developer.gnome.org/doc/API/2.0/gobject/','GObject' ]}
483                 @{[ a_href 'http://developer.gnome.org/doc/API/2.0/gobject/gobject-Signals.html','signal' ]}
484                 <span class="constant">abort</span>. Successful filesystem unmount
485                 (even as the part of remount operation) must be first preceded by
486                 <span class="constant">detach</span> signal to close all existing
487                 W32 <span class="constant">HANDLE</span>s. After their close the filesystem
488                 gets the unmount requests. Only in the case all the close operations
489                 succeeded including the final filesystem unmount the signal
490                 <span class="constant">cease</span> can be activated to notify all the
491                 dirty (written) objects they are now clean. During this
492                 <span class="constant">cease</span> signal the project will also
493                 @{[ a_href '#safe_flush','flush' ]} the sandbox commit buffer to its
494                 underlying media.</p>
495
496                 <p>Objects never written remain in <span class="constant">clean</span>
497                 state and they can be transparently reopened even if W32 filesystem crash
498                 occurs.</p>
499
500
501 HERE
502
503
504 project::captive::doc::Macros->footer();