Path: utzoo!attcan!uunet!husc6!think!ames!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn ) Newsgroups: comp.unix.wizards Subject: Re: given inode and fs, determine if dir or not? Message-ID: <8963@smoke.BRL.MIL> Date: 23 Nov 88 06:39:31 GMT References: <25943@teknowledge-vaxc.ARPA> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Distribution: na Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 18 In article <25943@teknowledge-vaxc.ARPA> mkhaw@teknowledge-vaxc.ARPA (Mike Khaw) writes: >If I have an inode (and fs root) on hand, how do I tell whether that >inode is a directory or not? The definition of struct inode suggests >that it's possible, but I can't find a man entry that says how. Assuming you have already figured out how to find the disk block containing the start of the inode, the start of an inode on disk normally consists of essentially the same information that would be returned for stat(2) or fstat(2) and a handful of pointers to the data blocks associated with the inode. (Slightly oversimplified.) There is often a system header file that describes the on-disk inode structure; watch out, because it typically includes descriptions of in-core (kernel) data structures, of which the disk inode information is only a part. Look in your System Administrator Reference Manual under FS(*) (where * depends on the vendor) for information about the file system.