Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
From: vjv0vjv@yahoo.com (Vince Jameson)
Subject: Re: Tru64 st_flags?
Date: 7 Nov 2002 14:13:14 -0800	[thread overview]
Message-ID: <def432e7.0211071413.559b431f@posting.google.com> (raw)
In-Reply-To: harris-5A72B8.17293206112002@juggl7.zk3.dec.com

Bob Harris <harris@zk3.dec.com> wrote in message news:<harris-5A72B8.17293206112002@juggl7.zk3.dec.com>...
> In article <def432e7.0211061037.6f45689@posting.google.com>,
>  vjv0vjv@yahoo.com (Vince Jameson) wrote:
> 
> X Nikola Milutinovic <Nikola.Milutinovic@ev.co.yu> wrote in message 
> X news:<3DC61ADA.9040702@ev.co.yu>...
> X > Vince Jameson wrote:
> X > > I'm working on an app that needs to periodically call lstat(2) on a
> X > > given file and save off a copy of certain relevant fields ( st_mode,
> X > > the time fields, and so on ).  Right now I'm stuck trying to figure
> X > > out what to do with Tru64's st_flags field.  I understand the presence
> X > > of this field derives from the BSD side of things, and on the BSD
> X > > variants I've dealt with I've been able to find documentation on what
> X > > the various bits in st_flags represent.
> X > > 
> X > > Some of these flags are fairly important ( immutable, append only,
> X > > etc. ), so recently I've been searching for information on how to
> X > > interpret the same field on Tru64 / OSF1, so far without success.  I'm
> X > > curious if anyone knows where to find this information, or failing
> X > > that, whether st_flags is even documented or not.
> X > 
> X > If all esle fails, try /usr/include/*.h files - they are usually well 
> X > commented.
> X > 
> X > Nixie.
> X 
> X 
> X I tried that already, before asking here.  The comment in
> X /usr/include/sys/stat.h regarding st_flags just says "user defined
> X flags for file".  That provides no useful info, and I can't even make
> X the assumption that the contents of the field really are "user
> X defined"; FreeBSD's stat.h says the exact same thing regarding its
> X st_flags field, and then goes on to define a bunch of constants for
> X the various bits in the field.  I put together a quick test app that
> X outputs the hex value of st_flags for a given file, and it's clear
> X there's a pattern of some sort, as opposed to the zero or garbage data
> X one would expect from an unused field.
> X 
> X Vince
> 
> Each file system treats the flags differently.  I only found evidence of 
> autofs and ufs using the flags (and since mfs is based on ufs, I would 
> expect it to use the ufs flags).  AdvFS most definitly does not use 
> them.  It just stores them if a layered file system ask it to, and 
> returns them (CFS, NFS, etc... layer on top of a physical file system, 
> but I don't see either of them generating their own flags, so it looks 
> like a mute point).  It does not appear that CFS, CDFS, DVDFS, NFS, ... 
> uses the flags, but I did not have time for an exhaustive search.  I 
> also do not know what they really mean since I'm not a ufs or autofs 
> developer, nor to I care to learn :-)  Chances are the ufs meanings came 
> from BSD, so I would suspect looking at one of the BSD distribution 
> source code ufs implementations might show more information about some 
> of these flags.
> 
> ufs (from /usr/include/ufs/inode.h)
>     IRENAME          0x0004    /* inode is being renamed */
>     IUPD             0x0010    /* file has been modified */
>     IACC             0x0020    /* inode access time to be updated */
>     ICHG             0x0040    /* inode has been changed */
>     IMOD             0x0080    /* inode has been modified */
>     ISHLOCK          0x0100    /* file has shared lock */
>     IEXLOCK          0x0200    /* file has exclusive lock */
>     ILWAIT           0x0400    /* someone waiting on file lock */
>     INACTIVATING     0x0800    /* inode is being inactivated */
>     INACTWAIT        0x1000    /* waiting for inode inactivation */
>     IREADERROR       0x2000    /* disk read for inode failed */
>     IQUOTA           0x4000    /* inode has quotas attached */
>     IQUOTING         0x8000    /* quota attach in progress */
>     IQUOTWAIT        0x10000   /* waiting while attach progresses */
>     ICHGMETA         0x20000   /* Meta data changed and not on disk */
>     IOLDDEVT         0x40000   /* TEMPORARY: this is an old devt */
>     ICHGCTIME        0x80000   /* inode C-time is to be modified */
>     IFSYNCING        0x1000000 /* fsync taking place on this inode. */
>     IWAITFSYNC       0x2000000 /* Wait for inode's fsync to finish. */
> 
> ufs SysV environment (from /usr/include/s5fs/s5inode.h)
>     S5IUPD           02        /* file has been modified */
>     S5IACC           04        /* inode access time to be updated */
>     S5IMOUNT         010       /* inode is mounted on */
>     S5IWANT          020       /* some process waiting on lock */
>     S5ITEXT          040       /* inode is pure text prototype */
>     S5ICHG           0100      /* inode has been changed */
>     S5ISYN           0200      /* do synchronous write for iupdate */
>     S5IRENAME        0400      /* inode is being renamed */
> 
> autofs
>     AUTOFS_INTERCEPT 0x10000000 /* intercept point */
>     AUTOFS_OBJECT    0x20000000 /* in the AutoFS name space */
> 
>                                         Bob Harris

I seem to have found what I need now.  After reading your post and
searching around in the inode headers for various filesystems, I
realized that st_flags reflects the di_flags member (if there is one)
of the dinode structure ( the on-disk portion of the inode ) for a
given file.   For ufs filesystems, the information I've been looking
for appears to be in /usr/include/ufs/dinode.h.  The flags are defined
as follows:

#define IC_FASTLINK     0x0001          /* Symbolic link in inode */
#define IC_PROPLIST_FRAG        0x0002
#define IC_PROPLIST_BLOCK       0x0004
#define IC_PROPLIST             0x0006  /* Property list exists */
#define IC_XUID                 0x0020  /* uid translation complete */
#define IC_XGID                 0x0040  /* gid translation complete */

I did a little testing to try & verify that these are valid, and it
looks like they are.  Symlinks typically have IC_FASTLINK set, while
files with extended file attributes ( including ACLs ) typically have
IC_PROPLIST and IC_PROPLIST_FRAG set.  IC_XUID and IC_XGID seem to
always be true on UFS.  It looks like AdvFS, System V fs, and nfs do
not use st_flags.  I'm probably safe ignoring cdfs & dvdfs for the
time being, and I suspect it'll turn out they don't have useful info
in st_flags either.

This is going to be useful information for me.  Being able to tell
quickly whether a file has extended attributes ( with the caveat that
this only works on UFS ) may end up giving me a significant
performance boost.  In contrast, Solaris 9 (for example) requires an
additional call to pathconf() to get the same information.

Thanks again,
  Vince


      reply	other threads:[~2002-11-07 22:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-02  1:50 Tru64 st_flags? Vince Jameson
2002-11-04  6:59 ` Nikola Milutinovic
2002-11-06 18:37   ` Vince Jameson
2002-11-06 22:29     ` Bob Harris
2002-11-07 22:13       ` Vince Jameson [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox