Mail Archives: djgpp-workers/1998/01/26/16:24:52
--=====================_885871647==_
Content-Type: text/plain; charset="us-ascii"
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.
I swiped the excellent coment (written by Eli?) out of the source and
modified it to be a txh file. It's attached.
Randy
--=====================_885871647==_
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment; filename="iinode.txh"
@node _invent_inode, file system
@subheading Syntax
@example
ino_t
_invent_inode(const char *name, unsigned time_stamp, unsigned long fsize)
@end example
@subheading Description
This invents an inode number for those files which don't have valid DOS
cluster number. These could be:
@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
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}).
The point here is that the entire program @emph{must} abide by these
conventions through its operation, or else you risk getting different inode
numbers for the same file.
@subheading Return Value
0 on error, otherwise the invented inode number for the file
--=====================_885871647==_
Content-Type: text/plain; charset="us-ascii"
--=====================_885871647==_--
- Raw text -