Overlapping #defines in isoinfra/current/include/sys/stat.h

Scott Wilkinson scott@alliantnetworks.com
Tue Jul 8 22:18:00 GMT 2003


I was having a problem mounting JFFS2, which I tracked down to what I
believe is a problem in /packages/isoinfra/current/include/sys/stat.h.  

The problem is that the (somewhat recent) addition of:

#define __stat_mode_LNK    (1<<8)
#define __stat_mode_SOCK   (1<<9)
#define S_IFMT           (S_IFDIR|S_IFCHR|S_IFBLK|S_IFREG| \
                          S_IFIFO|S_IFLNK|S_IFSOCK)

conflicts with the long-standing definition of:

#define S_IRUSR  (1<<8)
#define S_IWUSR  (1<<9)

This is a problem for JFFS which uses a single field to hold both
mode and permission information.  This is manifested by problems when
using S_IFMT to mask off the mode bits.  Problem is that it also catches
the S_IRUSR|S_IWUSR permission bits, which confuses things.  (Check out
os_to_jffs2_mode() in jffs2/current/src/os-ecos.h specifically.)

I'm not sure what the correct answer is, but my solution was to change the
definition of S_IFMT to remove the S_IFLNK|S_IFSOCK bits.  This may cause 
trouble with people who use links though?

Scott

-------------- next part --------------
A non-text attachment was scrubbed...
Name: stat_h.patch
Type: text/x-patch
Size: 764 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/ecos-patches/attachments/20030708/b36ac65e/attachment.bin>


More information about the Ecos-patches mailing list