This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Re: Overlapping #defines in isoinfra/current/include/sys/stat.h
- From: "Gary Thomas" <gary at mlbassoc dot com>
- To: "Scott Wilkinson" <scott at alliantnetworks dot com>
- Cc: ecos-patches at sources dot redhat dot com
- Date: Tue, 8 Jul 2003 16:40:29 -0600 (MDT)
- Subject: Re: Overlapping #defines in isoinfra/current/include/sys/stat.h
- References: <1057702631.1152.43.camel@localhost.localdomain>
Scott Wilkinson said:
> 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?
I'd think it would be better to renumber the S_IRUSR... bits
to start with 16 which would give longer-term stability.
There shouldn't be any programs out there that use hard coded
bits, so this should be OK - or at least it should be possible
to make it work properly.
------------------------------------------------------------
Gary Thomas |
MLB Associates | Consulting for the
+1 (970) 229-1963 | Embedded world
http://www.mlbassoc.com/ |
email: <gary@mlbassoc.com> |
gpg: http://www.chez-thomas.org/gary/gpg_key.asc
------------------------------------------------------------