Date: Tue, 27 Jan 1998 14:48:05 +0200 (IST) From: Eli Zaretskii To: Randy Maas cc: djgpp-workers AT delorie DOT com Subject: Re: invent inode docs In-Reply-To: <3.0.1.32.19980126152727.007f4b50@yacker.xiotech.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Mon, 26 Jan 1998, Randy Maas wrote: > Since I "needed" stat for a fsext and patched stat.c I found a very useful, > but not quite documented (as far as I know) function that can help fill out > a stat structure: _invent_inode. Thanks! > @itemize @bullet > @item > devices like @file{/dev/nul} or file system extensions > (@pxref{File System Extensions}) > > @item > empty files which were not allocated disk space yet > > @item > or files on networked drives, for which the redirector doesn't bring the > cluster number. > @end itemize This list lacks another important possibility: the case where DOS is bypassed for file operations, notably by 32-bit File Access of Windows 3.11 and Windows 9X, and by DOS emulators on NT, OS/2, DOSEmu etc. > To ensure proper operation of this function, you must call it with a filename > in some canonical form. E.g., with a name returned by @code{truename()} > (@pxref{truename}), or that returned by @code{_fixpath()} (@pxref{_fixpath}). To ensure proper operation, you *must* call `_truename'. `_fixpath' returns names in different format, and since the application doesn't have control on library functions which call `stat' internally, you could get subtle bugs. But since `_truename' doesn't have an FSEXT hook, this makes using `_invent_inode' in a `stat' hook difficult, since `_truename' will know nothing about special files which your extension invents, and might easily fail for these names, with disastrous results (`stat' has a fallback for such failures, but AFAIK it was never tested, since I have never seen `_truename' fail for real files). So I wonder whether we might really need to have a hook inside `_truename', to support hooking `stat'. Did you run tests with hooking `stat' on imaginary files, and if so, how did you resolve these problems? By the way, the name of the function is `_truename', not `truename'; and please don't use the parentheses when you want to mention the name of a function, because it looks like a call to a function with no arguments, not its name.