This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Overlapping #defines in isoinfra/current/include/sys/stat.h
- From: Scott Wilkinson <scott at alliantnetworks dot com>
- To: ecos-patches at sources dot redhat dot com
- Date: 08 Jul 2003 15:17:11 -0700
- Subject: Overlapping #defines in isoinfra/current/include/sys/stat.h
- Organization:
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
Index: stat.h
===================================================================
RCS file: /home/cvs/ecos/packages/isoinfra/current/include/sys/stat.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- stat.h 30 Jun 2003 23:22:45 -0000 1.1.1.2
+++ stat.h 8 Jul 2003 02:14:46 -0000 1.2
@@ -88,8 +88,12 @@
#define S_IFIFO (__stat_mode_FIFO)
#define S_IFLNK (__stat_mode_LNK)
#define S_IFSOCK (__stat_mode_SOCK)
+#if 0
#define S_IFMT (S_IFDIR|S_IFCHR|S_IFBLK|S_IFREG| \
S_IFIFO|S_IFLNK|S_IFSOCK)
+#endif
+#define S_IFMT (S_IFDIR|S_IFCHR|S_IFBLK|S_IFREG| \
+ S_IFIFO)
#endif
#define S_ISDIR(__mode) ((__mode) & __stat_mode_DIR )