This is the mail archive of the ecos-discuss@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: stat.h


On Sun, Jun 08, 2003 at 04:01:24PM +0200, Bob Koninckx wrote:
> Hi,
> 
> Apparently a number of definitions have been added to
> isoinfra/current/include/sys/stat.h
>
> #define S_IFDIR          (__stat_mode_DIR)
> #define S_IFCHR          (__stat_mode_CHR)
> #define S_IFBLK          (__stat_mode_BLK)
> #define S_IFREG          (__stat_mode_REG)
> #define S_IFFIFO         (__stat_mode_FIFO)
> #define S_IFLNK          (__stat_mode_LNK)
> #define S_IFSOCK         (__stat_mode_SOCK)
> #define S_IFMT           (S_IFDIR|S_IFCHR|S_IFBLK|S_IFREG| \
>                           S_IFFIFO|S_IFLNK|S_IFSOCK)

That was me. Something im porting needs these definitions. They are
part of the POSIX standard, so i added them. 

> 
> Unfortunately, the last three are not consistent with was already
> defined in compat/linux/current/include/linux/stat.h (which is needed by
> the jffs2 package).

I didn't know this file existed :-(

> Will it cause problems if the differences are just
> ignored and the definitions in compat/linux/current/include/linux/stat.h
> made conditional ? I tried this and now the jffs2 package compiles
> again, I am not sure I did not introduce any error though.

As far as i can see, the absolute value of these flags does not
matter. So i think the correct thing to do is remove them from
linux/stat.h.

S_IRUGO, S_IWUGO, S_IXUGO & S_IRWXUGO are not defined in the POSIX
standard, so they should remain in the linux compatibility header.

Here is a patch to do that. 

Jifl, what say you?

      Andrew

Index: packages/compat/linux//current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/compat/linux/current/ChangeLog,v
retrieving revision 1.1
diff -u -r1.1 ChangeLog
--- packages/compat/linux//current/ChangeLog    22 Jan 2003 01:10:41 -0000    1.1
+++ packages/compat/linux//current/ChangeLog    10 Jun 2003 11:59:32 -0000
@@ -1,3 +1,8 @@
+2003-06-10  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+       * include/linux/stat.h: Removed #defines which has been added to 
+       the main eCos sys/stat.h. 
+
 2003-01-21  David Woodhouse  <dwmw2@infradead.org>
 
        * New package.
Index: packages/compat/linux//current/include/linux/stat.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/compat/linux/current/include/linux/stat.h,v
retrieving revision 1.1
diff -u -r1.1 stat.h
--- packages/compat/linux//current/include/linux/stat.h 22 Jan 2003 01:10:41 -0000     1.1
+++ packages/compat/linux//current/include/linux/stat.h 10 Jun 2003 11:59:32 -0000
@@ -4,28 +4,6 @@
 
 #include <sys/stat.h>
 
-/* FIXME: eCos doesn't define bits for symlinks or sockets. In fact,
-   since the inode types are mutually exclusive, it's a bit of a waste
-   of space to have separate bits for each type. */
-#ifndef __stat_mode_LNK
-#define __stat_mode_LNK (1<<19)
-#define S_ISLNK(__mode)  ((__mode) & __stat_mode_LNK)
-#endif
-#ifndef __stat_mode_SOCK
-#define __stat_mode_SOCK (1<<20)
-#define S_ISSOCK(__mode) ((__mode) & __stat_mode_SOCK)
-#endif
-
-#define S_IFMT 0x18001F
-
-#define S_IFDIR __stat_mode_DIR
-#define S_IFREG __stat_mode_REG
-#define S_IFBLK __stat_mode_BLK
-#define S_IFCHR __stat_mode_CHR
-#define S_IFLNK __stat_mode_LNK
-#define S_IFSOCK __stat_mode_SOCK
-#define S_IFIFO __stat_mode_FIFO
-
 #define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH)
 #define S_IWUGO (S_IWUSR|S_IWGRP|S_IWOTH)
 #define S_IXUGO (S_IXUSR|S_IXGRP|S_IXOTH)

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


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