delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/01/27/07:48:03

Date: Tue, 27 Jan 1998 14:48:05 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Randy Maas <randym AT acm DOT org>
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: <Pine.SUN.3.91.980127144751.843D-100000@is>
MIME-Version: 1.0

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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019