Path: utzoo!attcan!uunet!lll-winken!ubvax!weitek!aimt!breck From: breck@aimt.UU.NET (Robert Breckinridge Beatie) Newsgroups: comp.unix.wizards Subject: Re: minimal loss of information when deallocating inodes? Summary: might st_mode == 0 imply a regular file? Message-ID: <2424@aimt.UU.NET> Date: 4 Jan 89 20:41:46 GMT References: <88Dec24.170417est.38019@neat.ai.toronto.edu> <981@vsi.COM> Organization: AIM Technology, Santa Clara, CA Lines: 49 In article <981@vsi.COM>, friedl@vsi.COM (Stephen J. Friedl) writes: > > It seems to me that marking the mode field to zero is sufficient > for this, as any other kind of file has at least one high-order > bit set (even regular files). This is from from > System V: > > #define S_IFMT 0170000 /* type of file */ > #define S_IFDIR 0040000 /* directory */ > #define S_IFCHR 0020000 /* character special */ > #define S_IFBLK 0060000 /* block special */ > #define S_IFREG 0100000 /* regular */ > #define S_IFIFO 0010000 /* fifo */ > > Comments? Not so much a comment as a question. I was looking into this question the other day and was not able to find a completely satisfactory answer. According to the SVID MKNOD(BA_OS) The mode of the new file is initialized from the argument _mode_. Where the value of _mode_ is interpreted as follows: 0170000 file type; one of the following: 0010000 FIFO-special 0020000 character-special 0040000 directory 0060000 block-special 0100000 or 000000 ordinary-file ^^^^^^ (Unfortunately, I wasn't able to find anything more useful.) Now it doesn't say anything about the mode parameter being placed directly into the di_mode field of the disk inode, but it doesn't say that it won't either. Well, I assumed that calling mknod with the mode field set to 000xxxx creates a file with mode equal to 010xxxx and that inodes whose di_mode field are zero are in fact unallocated since that seems to be the case on most systems I've checked. But is there any guarantee that on a "normal" system V file system this assumption won't blow up in my face. A pointer to the appropriate section in the SVID would be most reassuring. Assurances from a few wizards would be somewhat less reassuring, but would definitely be appreciated. -- Breck Beatie (408)748-8649 {uunet,ames!coherent}!aimt!breck OR breck@aimt.uu.net "Sloppy as hell Little Father. You've embarassed me no end."