This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


I agree with your point.  The only consideration is that you may want to
preserve compatibility with linux, or other versions of stat.h, so that
cross platform JFFS2 tools such as mkfs.jffs2 from the infradead.org/mlt
project will continue to work with eCos.

On Tue, 2003-07-08 at 15:40, Gary Thomas wrote:
> 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
> ------------------------------------------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]