bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #24342] -inum predicate shoud use dirent.d_ino instead of stat.


From: George Spelvin
Subject: Re: [bug #24342] -inum predicate shoud use dirent.d_ino instead of stat.st_ino
Date: Sun, 08 Mar 2009 10:50:17 -0400

James Youngman <address@hidden> wrote:
> The updated patches are what I actually pushed (into 4.5.x).

Ah, thank you.  The posted patches wouldn't apply to savannah git HEAD
due to a conflict in the ChangeLog.  (Easy enough to work around, but
worrisome.)

The (tested) simplified version is, of course,
+  boolean todo = pred_ptr->need_stat ||
+              (pred_ptr->need_type && !state.have_type) ||
+              (pred_ptr->need_inum &&
+               (!p->st_ino || !state.have_type || S_ISDIR(p->st_mode)));

I poked at the leaf optimization, but it appears I'd have to change the
prototypes for the entire predicate system, which is extremely annoying.

One option is to understand the "state" structure and how its contents
relate to the predicate arguments.  I'm currently very confused by that.

The other is to pack the dirent info into the existing struct stat.
I'm thinking about that.  One possibility is to have some file type
bits that mean "you'll need to call stat(2) for details, but it's NOT
a directory".  For example, st.st_mode == 1.

Every S_IFxxx I can find, *except* Masscomp's S_IFCTG (contiguous
file), which my Google-fu cannot find a numeric value for:
0000
0001 FIFO
0010 CHR
0011 MPC        /* Multiplexed char device: V7 & Coherent */
0100 DIR
0101 NAM        /* Xenix special named file */
0110 BLK
0111 MPB        /* Multiplexed block device: V7 & Coherent */
1000 REG
1001 NWK        /* HP-UX network special */
     CMP        /* VxFS compressed */
1010 LNK
1011 SHAD       /* Solaris shadow inode for ACL, not seen by userspace */
1100 SOCK
1101 DOOR       /* Solaris door */
1110 WHT        /* BSD whiteout, not seen by userspace */
1111




reply via email to

[Prev in Thread] Current Thread [Next in Thread]