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]

Re: ROMFS in anoncvs


Indeed, the defintions for the modes have changed in eCos since I
initially wrote the ROMFS code. I don't quite see how it is possible for
the ipaq demo to work, given the changes...

However, the following changes to mk_romfs.c will fix the incompatibility.
It would be good if there were some way to include the eCos sys/stat.h so
that any change in the future could be taken care of, but that seems
impossible...

Index: mk_romfs.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/rom/current/support/mk_romfs.c,v
retrieving revision 1.1
diff -r1.1 mk_romfs.c
151c151
<     mode_t mode;		// Type and permissions
---
>     mode_t st_mode;		// Type and permissions
251a252,275
> // Damn it. When did these definitions change??? The modes were
identical when
> // I initially wrote this code, but changed sometime.
> static unsigned long ConvertMode( unsigned long posix_mode ) {
>     unsigned long result = 0;
>     if ( S_ISDIR( posix_mode ) ) result |= 1<<0;
>     if ( S_ISCHR( posix_mode ) ) result |= 1<<1;
>     if ( S_ISBLK( posix_mode ) ) result |= 1<<2;
>     if ( S_ISREG( posix_mode ) ) result |= 1<<3;
>     if ( S_ISFIFO(posix_mode ) ) result |= 1<<4;
>     // We cannot create MQ, SEM, or SHM entries here
>     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;
>     return result;
> }
>
316c340
<     node->mode = stbuff.st_mode;
---
>     node->st_mode = stbuff.st_mode;
377c401
< 	if ( IS_DIRECTORY( th->mode ) ) {
---
> 	if ( IS_DIRECTORY( th->st_mode ) ) {
388c412
< 	if ( IS_DIRECTORY( np->mode ) ) {
---
> 	if ( IS_DIRECTORY( np->st_mode ) ) {
406c430
< 	if ( IS_DIRECTORY( np->mode ) && np->child )
---
> 	if ( IS_DIRECTORY( np->st_mode ) && np->child )
420c444
< 	if ( IS_DATAFILE( np->mode ) || IS_SYMLINK( np->mode ) ) {
---
> 	if ( IS_DATAFILE( np->st_mode ) || IS_SYMLINK( np->st_mode ) ) {
436c460
< 	if ( IS_DIRECTORY( np->mode ) ) {
---
> 	if ( IS_DIRECTORY( np->st_mode ) ) {
449c473
< 	if ( IS_EXECUTABLE( np->mode ) ) {
---
> 	if ( IS_EXECUTABLE( np->st_mode ) ) {
465c489
< 	if ( IS_DIRECTORY( np->mode ) ) {
---
> 	if ( IS_DIRECTORY( np->st_mode ) ) {
474c498
<     outputlong( (char*) &anode.mode, np->mode );
---
>     outputlong( (char*) &anode.mode, ConvertMode( np->st_mode ) );
498c522
< 	if ( IS_DIRECTORY( np->mode ) && np->child ) {
---
> 	if ( IS_DIRECTORY( np->st_mode ) && np->child ) {
527c551
<     if ( IS_SYMLINK( np->mode ) ) {
---
>     if ( IS_SYMLINK( np->st_mode ) ) {
572c596
< 	if ( IS_DIRECTORY( first->mode ) ) {
---
> 	if ( IS_DIRECTORY( first->st_mode ) ) {



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