Overlapping #defines in isoinfra/current/include/sys/stat.h
Andrew Lunn
andrew.lunn@ascom.ch
Thu Jul 10 21:59:00 GMT 2003
On Tue, Jul 08, 2003 at 03:17:11PM -0700, Scott Wilkinson wrote:
> 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)
Is suggested by Gary i moved S_I* so that it starts at bit 16. I
tested this with the ROMFS with both an old ROMFS image and a new
image. Both passed the fileio1 test.
>From what i can see, this change will probably only break code that
uses stat to look at the S_I* flags for ROMFS built using the old
mk_romfs. I think its unlikely that anyody is actually doing this in
an embedded system. But i could be wrong....
I've broken jffs2 twice in the last month, so it would be nice if
someone checked this patch to see if this makes three!
Andrew
-------------- next part --------------
Index: fs/rom//current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/rom/current/ChangeLog,v
retrieving revision 1.10
diff -r1.10 ChangeLog
0a1,5
> 2003-07-10 Andrew Lunn <andrew.lunn@ascom.ch>
>
> * support/mk_romfs.c: S_I[RWX]{USR|GRP|OTH} etc changed to match
> the changes in sys/stat.h
>
Index: fs/rom//current/support/mk_romfs.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/rom/current/support/mk_romfs.c,v
retrieving revision 1.6
diff -r1.6 mk_romfs.c
270,280c270,280
< if ( posix_mode & S_IRUSR ) result |= 1<<8;
< if ( posix_mode & S_IWUSR ) result |= 1<<9;
< if ( posix_mode & S_IXUSR ) result |= 1<<10;
< if ( posix_mode & S_IRGRP ) result |= 1<<11;
< if ( posix_mode & S_IWGRP ) result |= 1<<12;
< if ( posix_mode & S_IXGRP ) result |= 1<<13;
< if ( posix_mode & S_IROTH ) result |= 1<<14;
< if ( posix_mode & S_IWOTH ) result |= 1<<15;
< if ( posix_mode & S_IXOTH ) result |= 1<<16;
< if ( posix_mode & S_ISUID ) result |= 1<<17;
< if ( posix_mode & S_ISGID ) result |= 1<<18;
---
> if ( posix_mode & S_IRUSR ) result |= 1<<16;
> if ( posix_mode & S_IWUSR ) result |= 1<<17;
> if ( posix_mode & S_IXUSR ) result |= 1<<18;
> if ( posix_mode & S_IRGRP ) result |= 1<<19;
> if ( posix_mode & S_IWGRP ) result |= 1<<20;
> if ( posix_mode & S_IXGRP ) result |= 1<<21;
> if ( posix_mode & S_IROTH ) result |= 1<<22;
> if ( posix_mode & S_IWOTH ) result |= 1<<23;
> if ( posix_mode & S_IXOTH ) result |= 1<<24;
> if ( posix_mode & S_ISUID ) result |= 1<<25;
> if ( posix_mode & S_ISGID ) result |= 1<<26;
Index: isoinfra/current//ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/isoinfra/current/ChangeLog,v
retrieving revision 1.22
diff -r1.22 ChangeLog
0a1,6
> 2003-07-10 Andrew Lunn <andrew.lunn@ascom.ch>
>
> * include/sys/stat.h :S_I[RWX]{USR|GRP|OTH} etc changed so they
> don't overlap with S_ISLINK and S_ISSOCK. Reported by Scott
> Wilkinson.
>
Index: isoinfra/current//include/sys/stat.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/isoinfra/current/include/sys/stat.h,v
retrieving revision 1.5
diff -r1.5 stat.h
110,112c110,112
< #define S_IRUSR (1<<8)
< #define S_IWUSR (1<<9)
< #define S_IXUSR (1<<10)
---
> #define S_IRUSR (1<<16)
> #define S_IWUSR (1<<17)
> #define S_IXUSR (1<<18)
115,117c115,117
< #define S_IRGRP (1<<11)
< #define S_IWGRP (1<<12)
< #define S_IXGRP (1<<13)
---
> #define S_IRGRP (1<<19)
> #define S_IWGRP (1<<20)
> #define S_IXGRP (1<<21)
120,122c120,122
< #define S_IROTH (1<<14)
< #define S_IWOTH (1<<15)
< #define S_IXOTH (1<<16)
---
> #define S_IROTH (1<<22)
> #define S_IWOTH (1<<23)
> #define S_IXOTH (1<<24)
125,126c125,126
< #define S_ISUID (1<<17)
< #define S_ISGID (1<<18)
---
> #define S_ISUID (1<<25)
> #define S_ISGID (1<<25)
More information about the Ecos-patches
mailing list