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]

FAT FS enhancements


This patch includes the changes to add a fssync function, chmod capabilities, and honor read only flag. The chmod and honor attributes are configurable with a single CDL parameter. The fssync is not configurable.

David Brennan

Index: fs/fat/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/fat/current/ChangeLog,v
retrieving revision 1.3
diff -U5 -w -r1.3 ChangeLog
--- fs/fat/current/ChangeLog 13 Oct 2004 21:11:37 -0000 1.3
+++ fs/fat/current/ChangeLog 19 Oct 2004 03:41:39 -0000
@@ -1,5 +1,18 @@
+2004-10-17 David Brennan <eCos@brennanhome.com>
+
+ * src/fatfs.c:
+ * src/fatfs_supp.c:
+ * tests/fileio1.c:
+ * cdl/fatfs.cdl: Added configurable support for FAT filesystem
+ attributes.
+
+2004-10-13 David Brennan <eCos@brennanhome.com>
+
+ * src/fatfs.c: Added code to setinfo to allow performing a file-system
+ sync
+
2004-10-06 David Brennan <eCos@brennanhome.com>


    * tests/fileio1.c: Added include of <stdio.h> to fix compiler
    warning for rename().

Index: fs/fat/current/cdl/fatfs.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/fat/current/cdl/fatfs.cdl,v
retrieving revision 1.2
diff -U5 -w -r1.2 fatfs.cdl
--- fs/fat/current/cdl/fatfs.cdl 5 Oct 2004 07:45:59 -0000 1.2
+++ fs/fat/current/cdl/fatfs.cdl 19 Oct 2004 03:41:39 -0000
@@ -103,10 +103,18 @@
active_if CYGPKG_INFRA_DEBUG && CYGDBG_USE_ASSERTS
description "This option controls the inclusion of extra
sanity checks in node cache code."
}
+ cdl_option CYGCFG_FS_FAT_USE_ATTRIBUTES {
+ display "Support for FAT FS file attributes"
+ flavor bool
+ default_value 0
+ description "This option controls if the FAT filesystem supports
+ or honors the FAT filesystem file attributes."
+ }
+ # --------------------------------------------------------------------
cdl_option CYGPKG_FS_FAT_TESTS {
display "FAT FS tests"
flavor data
Index: fs/fat/current/src/fatfs.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/fat/current/src/fatfs.c,v
retrieving revision 1.2
diff -U5 -w -r1.2 fatfs.c
--- fs/fat/current/src/fatfs.c 5 Oct 2004 07:45:59 -0000 1.2
+++ fs/fat/current/src/fatfs.c 19 Oct 2004 03:41:40 -0000
@@ -627,10 +627,17 @@
return err;
if (S_ISDIR(node->dentry.mode))
return EISDIR;


+#ifdef CYGCFG_FS_FAT_USE_ATTRIBUTES
+    // if the file is read only and is opened for writing
+    // fail with permission error
+    if (MODE_IS_RDONLY(node->dentry.mode) && (mode & O_WRONLY))
+        return EPERM;
+#endif // CYGCFG_FS_FAT_USE_ATTRIBUTES
+
    // Allocate file object private data and
    // make a reference to this file node

    fd = alloc_fatfs_fd(disk, node);
    if (NULL == fd)
@@ -676,10 +683,16 @@
        return err;

if (ds.node->refcnt > 0)
return EBUSY;
+#ifdef CYGCFG_FS_FAT_USE_ATTRIBUTES
+ // if the file is read only fail with permission error
+ if (MODE_IS_RDONLY(ds.node->dentry.mode))
+ return EPERM;
+#endif // CYGCFG_FS_FAT_USE_ATTRIBUTES
+
err = fatfs_delete_file(disk, &ds.node->dentry);
if (err == ENOERR)
fatfs_node_free(disk, ds.node);
return err;
@@ -787,10 +800,16 @@


    err = fatfs_find(&ds1);
    if (err != ENOERR)
        return err;

+#ifdef CYGCFG_FS_FAT_USE_ATTRIBUTES
+ // if the file is read only fail with permission error
+ if (MODE_IS_RDONLY(ds1.node->dentry.mode))
+ return EPERM;
+#endif // CYGCFG_FS_FAT_USE_ATTRIBUTES
+
// Protect the found nodes from being reused
// by the search for the ds2 dir/node pair
fatfs_node_ref(disk, ds1.dir);
fatfs_node_ref(disk, ds1.node);
@@ -994,10 +1013,45 @@
buf->st_ctime = ds.node->dentry.ctime;


    return ENOERR;
}

+#ifdef CYGCFG_FS_FAT_USE_ATTRIBUTES
+// -------------------------------------------------------------------------
+// fatfs_chmod()
+// Set struct mode info for named object.
+
+static int
+fatfs_chmod(cyg_mtab_entry *mte,
+ cyg_dir dir,
+ const char *name,
+ int new_mode)
+{
+ fatfs_disk_t *disk = (fatfs_disk_t *) mte->data;
+ fatfs_dirsearch_t ds;
+ int err;
+
+ CYG_TRACE4(TFS, "chmod mte=%p dir=%p name='%s' buf=%x",
+ mte, dir, name, new_mode);
+
+ // Verify new_mode is valid
+ if ((new_mode & S_FATFS_CHMOD) != new_mode)
+ return EINVAL;
+ + init_dirsearch(&ds, disk, (fatfs_node_t *) dir, name);
+
+ err = fatfs_find(&ds);
+ if (err != ENOERR)
+ return err;
+
+ // Change the "changeable" mode bits for the file.
+ ds.node->dentry.mode = (ds.node->dentry.mode & (~S_FATFS_CHMOD)) | new_mode;
+
+ return fatfs_write_dir_entry(disk,&ds.node->dentry);
+}
+#endif // CYGCFG_FS_FAT_USE_ATTRIBUTES
+
// -------------------------------------------------------------------------
// fatfs_getinfo()
// Getinfo. Nothing to support here at present.


static int
@@ -1013,23 +1067,46 @@
    return EINVAL;
}

// -------------------------------------------------------------------------
// fatfs_setinfo()
-// Setinfo. Nothing to support here at present.
+// Setinfo. Support for fssync and chmod


static int
fatfs_setinfo(cyg_mtab_entry *mte,
              cyg_dir         dir,
              const char     *name,
              int             key,
              void           *buf,
              int             len)
{
-    CYG_TRACE6(TFS, "getinfo mte=%p dir=%p name='%s' key=%d buf=%p len=%d",
+    int err;
+
+    CYG_TRACE6(TFS, "setinfo mte=%p dir=%p name='%s' key=%d buf=%p len=%d",
                    mte, dir, name, key, buf, len);
-    return EINVAL;
+
+    err = EINVAL;
+
+    switch( key )
+    {
+        case FS_INFO_SYNC:
+            err = cyg_blib_sync(&(((fatfs_disk_t *) mte->data)->blib));
+            if (err != ENOERR)
+               return err;
+            break;
+#ifdef CYGCFG_FS_FAT_USE_ATTRIBUTES
+        case FS_INFO_CHMOD:
+            err = fatfs_chmod(mte, dir, name, *(int*)buf);
+            if (err != ENOERR)
+               return err;
+            break;
+#endif // CYGCFG_FS_FAT_USE_ATTRIBUTES
+        default:
+            err = EINVAL;
+            break;
+    }
+    return err;
}

//==========================================================================
// File operations

Index: fs/fat/current/src/fatfs_supp.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/fat/current/src/fatfs_supp.c,v
retrieving revision 1.2
diff -U5 -w -r1.2 fatfs_supp.c
--- fs/fat/current/src/fatfs_supp.c 5 Oct 2004 07:45:59 -0000 1.2
+++ fs/fat/current/src/fatfs_supp.c 19 Oct 2004 03:41:42 -0000
@@ -1622,10 +1622,25 @@
if (DENTRY_IS_DIR(raw_dentry))
dentry->mode = __stat_mode_DIR;
else
dentry->mode = __stat_mode_REG;
+#ifdef CYGCFG_FS_FAT_USE_ATTRIBUTES
+ if (DENTRY_IS_RDONLY(raw_dentry))
+ dentry->mode |= S_FATFS_RDONLY;
+ if (DENTRY_IS_HIDDEN(raw_dentry))
+ dentry->mode |= S_FATFS_HIDDEN;
+ if (DENTRY_IS_SYSTEM(raw_dentry))
+ dentry->mode |= S_FATFS_SYSTEM;
+ if (DENTRY_IS_VOLUME(raw_dentry))
+ dentry->mode |= S_FATFS_VOLUME;
+ if (DENTRY_IS_DIR(raw_dentry))
+ dentry->mode |= S_FATFS_DIR;
+ if (DENTRY_IS_ARCHIVE(raw_dentry))
+ dentry->mode |= S_FATFS_ARCHIVE;
+#endif // CYGCFG_FS_FAT_USE_ATTRIBUTES
+
date_dos2unix(raw_dentry->crt_time, raw_dentry->crt_date, &dentry->ctime);
date_dos2unix(0, raw_dentry->acc_date, &dentry->atime);
date_dos2unix(raw_dentry->wrt_time, raw_dentry->wrt_date, &dentry->mtime);
dentry->size = raw_dentry->size;
@@ -1641,14 +1656,31 @@
static void
dentry_to_raw(fatfs_dir_entry_t *dentry, fat_raw_dir_entry_t *raw_dentry)
{
set_raw_dentry_filename(raw_dentry, dentry->filename, 0);


- if (__stat_mode_DIR == dentry->mode)
+#ifndef CYGCFG_FS_FAT_USE_ATTRIBUTES
+ if ( S_ISDIR(dentry->mode) )
raw_dentry->attr = DENTRY_ATTR_DIR;
else
raw_dentry->attr = DENTRY_ATTR_ARCHIVE;
+#else
+ raw_dentry->attr = 0;
+ if (MODE_IS_RDONLY(dentry->mode))
+ raw_dentry->attr |= DENTRY_ATTR_RDONLY;
+ if (MODE_IS_HIDDEN(dentry->mode))
+ raw_dentry->attr |= DENTRY_ATTR_HIDDEN;
+ if (MODE_IS_SYSTEM(dentry->mode))
+ raw_dentry->attr |= DENTRY_ATTR_SYSTEM;
+ if (MODE_IS_VOLUME(dentry->mode))
+ raw_dentry->attr |= DENTRY_ATTR_VOLUME;
+ if (MODE_IS_DIR(dentry->mode))
+ raw_dentry->attr |= DENTRY_ATTR_DIR;
+ if (MODE_IS_ARCHIVE(dentry->mode))
+ raw_dentry->attr |= DENTRY_ATTR_ARCHIVE;
+#endif // CYGCFG_FS_FAT_USE_ATTRIBUTES
+
date_unix2dos(dentry->ctime, &raw_dentry->crt_time, &raw_dentry->crt_date);
date_unix2dos(dentry->atime, NULL, &raw_dentry->acc_date);
date_unix2dos(dentry->mtime, &raw_dentry->wrt_time, &raw_dentry->wrt_date);
@@ -1806,10 +1838,18 @@
strncpy(dentry->filename, name, namelen);
dentry->filename[namelen] = '\0';
dentry->mode = mode;
+
+#ifdef CYGCFG_FS_FAT_USE_ATTRIBUTES
+ if (S_ISDIR(dentry->mode))
+ dentry->mode |= S_FATFS_DIR;
+ else
+ dentry->mode |= S_FATFS_ARCHIVE;
+#endif // CYGCFG_FS_FAT_USE_ATTRIBUTES
+
dentry->ctime =
dentry->atime =
dentry->mtime = cyg_timestamp();


dentry->priv_data = 0;
@@ -1937,10 +1977,13 @@
{
CYG_CHECK_DATA_PTRC(disk);
CYG_CHECK_DATA_PTRC(dentry);
dentry->mode = __stat_mode_DIR;
+#ifdef CYGCFG_FS_FAT_USE_ATTRIBUTES
+ dentry->mode |= S_FATFS_DIR;
+#endif // CYGCFG_FS_FAT_USE_ATTRIBUTES
dentry->size = disk->fat_root_dir_size;
dentry->ctime = 0;
dentry->atime = 0;
dentry->mtime = 0;
dentry->filename[0] = '\0';
@@ -2387,11 +2430,11 @@
target->disk_pos = new_pos;
target->parent_cluster = dir2->cluster;


// If we moved a directory, we also have to correct the '..' entry

- if (__stat_mode_DIR == target->mode)
+ if ( S_ISDIR(target->mode) )
{
fat_raw_dir_entry_t raw_cdentry;
fatfs_data_pos_t pos;
fatfs_initpos(disk, target, &pos);
Index: fs/fat/current/tests/fileio1.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/fat/current/tests/fileio1.c,v
retrieving revision 1.2
diff -U5 -w -r1.2 fileio1.c
--- fs/fat/current/tests/fileio1.c 13 Oct 2004 21:11:38 -0000 1.2
+++ fs/fat/current/tests/fileio1.c 19 Oct 2004 03:41:43 -0000
@@ -58,10 +58,11 @@
//==========================================================================


#include <pkgconf/hal.h>
#include <pkgconf/kernel.h>
#include <pkgconf/io_fileio.h>
+#include <pkgconf/fs_fat.h>

#include <cyg/kernel/ktypes.h>         // base kernel types
#include <cyg/infra/cyg_trac.h>        // tracing macros
#include <cyg/infra/cyg_ass.h>         // assertion macros

@@ -286,10 +287,29 @@

    err = close( fd );
    if( err < 0 ) SHOW_RESULT( close, err );
}

+#ifdef CYGCFG_FS_FAT_USE_ATTRIBUTES
+//==========================================================================
+
+static void checkstat(const char *name, const int mode )
+{
+    int err;
+    struct stat filestat;
+
+    diag_printf("<INFO>: check stat %s\n",name);
+
+    err = stat(name, &filestat);
+    if( err != 0 ) SHOW_RESULT( stat, err );
+
+    if ( (filestat.st_mode & S_FATFS_CHMOD) != mode )
+        diag_printf("<FAIL>: stat %s incorrect\n\tExpected %x Was %x\n",
+                    name,mode,(filestat.st_mode & S_FATFS_CHMOD));
+}
+#endif // CYGCFG_FS_FAT_USE_ATTRIBUTES
+
//==========================================================================

static void copyfile( char *name2, char *name1 )
{

@@ -641,18 +661,81 @@
diag_printf("<INFO>: umount /disk2\n"); err = umount( "/disk2" );
if( err < 0 ) SHOW_RESULT( umount, err ); #endif
+#ifdef CYGCFG_FS_FAT_USE_ATTRIBUTES
+ // Create file
+ diag_printf("<INFO>: create /foo\n");
+ createfile( "/foo", 20257 );
+
+ // Verify it is created with archive bit set
+ checkstat( "/foo", S_FATFS_ARCHIVE );
+
+ // Make it System
+ diag_printf("<INFO>: chmod -A+S /foo\n");
+ err = chmod( "/foo", S_FATFS_SYSTEM );
+ if( err < 0 ) SHOW_RESULT( chmod system , err );
+
+ // Verify it is now System
+ checkstat( "/foo", S_FATFS_SYSTEM );
+
+ // Make it Hidden
+ diag_printf("<INFO>: chmod -S+H /foo\n");
+ err = chmod( "/foo", S_FATFS_HIDDEN );
+ if( err < 0 ) SHOW_RESULT( chmod system , err );
+
+ // Verify it is now Hidden
+ checkstat( "/foo", S_FATFS_HIDDEN );
+
+ // Make it Read-only
+ diag_printf("<INFO>: chmod -H+R /foo\n");
+ err = chmod( "/foo", S_FATFS_RDONLY );
+ if( err < 0 ) SHOW_RESULT( chmod system , err );
+
+ // Verify it is now Read-only
+ checkstat( "/foo", S_FATFS_RDONLY );
+
+ // Verify we cannot unlink a read-only file
+ diag_printf("<INFO>: unlink /foo\n");
+ err = unlink( "/foo" );
+ if( err != -EPERM ) SHOW_RESULT( unlink, err );
+
+ // Verify we cannot rename a read-only file
+ diag_printf("<INFO>: rename /foo bundy\n");
+ err = rename( "/foo", "bundy" );
+ if( err != -EPERM ) SHOW_RESULT( rename, err );
+
+ // Verify we cannot open read-only file for writing
+ int fd;
+ diag_printf("<INFO>: create file /foo\n");
+ fd = open( "/foo", O_WRONLY );
+ if( err != -EPERM ) SHOW_RESULT( rename, err );
+ if( err > 0 ) close(fd);
+
+ // Make it Normal
+ diag_printf("<INFO>: chmod -H /foo\n");
+ err = chmod( "/foo", 0 );
+ if( err < 0 ) SHOW_RESULT( chmod none , err );
+
+ // Verify it is now nothing
+ checkstat( "/foo", 0 );
+
+ // Now delete our test file
+ diag_printf("<INFO>: unlink /foo\n");
+ err = unlink( "/foo" );
+ if( err < 0 ) SHOW_RESULT( unlink, err );
+
+#endif // CYGCFG_FS_FAT_USE_ATTRIBUTES
+
maxfile("file.max");


listdir( "/", true, -1, NULL ); diag_printf("<INFO>: unlink file.max\n"); err = unlink( "file.max" );
if( err < 0 ) SHOW_RESULT( unlink, err ); -
diag_printf("<INFO>: umount /\n"); err = umount( "/" );
if( err < 0 ) SHOW_RESULT( umount, err ); CYG_TEST_PASS_FINISH("fileio1");
Index: io/fileio/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/fileio/current/ChangeLog,v
retrieving revision 1.48
diff -U5 -w -r1.48 ChangeLog
--- io/fileio/current/ChangeLog 14 Oct 2004 07:34:29 -0000 1.48
+++ io/fileio/current/ChangeLog 19 Oct 2004 03:42:02 -0000
@@ -1,5 +1,14 @@
+2004-10-13 David Brennan <eCos@brennanhome.com>
+
+ * src/file.cxx: Added a check data ptr in LOCK_FS
+
+2004-10-13 David Brennan <eCos@brennanhome.com>
+
+ * include/fileio.h: Added definition of FS_INFO_SYNC for fssync
+ command
+
2004-10-06 David Brennan <eCos@brennanhome.com>


    * tests/pselect.c: Added check for POSIX signals while building
    the test case.
    * tests/select.c: Include sys/select.h to prevent a possible warning.
Index: io/fileio/current/include/fileio.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/fileio/current/include/fileio.h,v
retrieving revision 1.10
diff -U5 -w -r1.10 fileio.h
--- io/fileio/current/include/fileio.h    1 Dec 2003 14:30:33 -0000    1.10
+++ io/fileio/current/include/fileio.h    19 Oct 2004 03:42:02 -0000
@@ -152,10 +152,12 @@
// Keys for getinfo() and setinfo()

#define FS_INFO_CONF            1       /* pathconf() */
#define FS_INFO_ACCESS          2       /* access() */
#define FS_INFO_GETCWD          3       /* getcwd() */
+#define FS_INFO_SYNC            4       /* fssync() */
+#define FS_INFO_CHMOD           5       /* chmod() */

//-----------------------------------------------------------------------------
// Types for link()

#define CYG_FSLINK_HARD         1       /* form a hard link */
@@ -328,11 +330,11 @@
#define    CYG_FILE_TYPE_FILE      1    /* file */
#define    CYG_FILE_TYPE_SOCKET    2    /* communications endpoint */
#define    CYG_FILE_TYPE_DEVICE    3    /* device */

//-----------------------------------------------------------------------------
-// Keys for getinf() and setinfo()
+// Keys for getinfo() and setinfo()

#define FILE_INFO_CONF 1 /* fpathconf() */

//-----------------------------------------------------------------------------
// Modes for fsync()
Index: io/fileio/current/src/file.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/fileio/current/src/file.cxx,v
retrieving revision 1.10
diff -U5 -w -r1.10 file.cxx
--- io/fileio/current/src/file.cxx    15 Mar 2004 15:41:36 -0000    1.10
+++ io/fileio/current/src/file.cxx    19 Oct 2004 03:42:02 -0000
@@ -69,10 +69,11 @@
//==========================================================================
// Implement filesystem locking protocol.

#define LOCK_FS( _mte_ )  {                             \
   CYG_ASSERT(_mte_ != NULL, "Bad mount table entry");  \
+   CYG_ASSERT(_mte_->fs != NULL, "Bad mount filesystem entry");  \
   cyg_fs_lock( _mte_, (_mte_)->fs->syncmode);          \
}

#define UNLOCK_FS( _mte_ ) cyg_fs_unlock( _mte_, (_mte_)->fs->syncmode)

@@ -522,10 +523,70 @@

    FILEIO_RETURN_VALUE(info.value);
}

//==========================================================================
+// Sync filesystem without unmounting
+
+__externC int fssync( const char *path )
+{
+ FILEIO_ENTRY();
+ + int ret = 0;
+ cyg_mtab_entry *mte = cyg_cdir_mtab_entry;
+ cyg_dir dir = cyg_cdir_dir;
+ const char *name = path;
+
+ ret = cyg_mtab_lookup( &dir, &name, &mte );
+ + if( 0 != ret )
+ FILEIO_RETURN(ENOENT);
+
+ LOCK_FS( mte );
+ + ret = mte->fs->setinfo( mte, dir, name, FS_INFO_SYNC, NULL, 0 );
+ + UNLOCK_FS( mte );
+ + if( 0 != ret )
+ FILEIO_RETURN(ret);
+
+ FILEIO_RETURN_VALUE(ENOERR);
+}
+
+//==========================================================================
+// Set file access flags
+
+__externC int chmod( const char *fname, int new_mode )
+{
+ FILEIO_ENTRY();
+ + int ret = 0;
+ cyg_mtab_entry *mte = cyg_cdir_mtab_entry;
+ cyg_dir dir = cyg_cdir_dir;
+ const char *name = fname;
+
+ ret = cyg_mtab_lookup( &dir, &name, &mte );
+ + if( 0 != ret )
+ FILEIO_RETURN(ENOENT);
+
+ LOCK_FS( mte );
+ + ret = mte->fs->setinfo( mte, dir, name,
+ FS_INFO_CHMOD,
+ (char *)&new_mode, sizeof(new_mode) );
+ + UNLOCK_FS( mte );
+ + if( 0 != ret )
+ FILEIO_RETURN(ret);
+
+ FILEIO_RETURN(ENOERR);
+}
+
+//==========================================================================
// Access() function.
// This simply piggybacks onto stat().


extern int     access(const char *path, int amode)
{
Index: io/fileio/current/tests/select.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/fileio/current/tests/select.c,v
retrieving revision 1.7
diff -U5 -w -r1.7 select.c
--- io/fileio/current/tests/select.c    14 Oct 2004 07:34:30 -0000    1.7
+++ io/fileio/current/tests/select.c    19 Oct 2004 03:42:03 -0000
@@ -82,10 +82,11 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/select.h>
#include <errno.h>
#include <string.h>
+#include <sys/select.h>                // select()

#ifdef CYGPKG_NET
#include <network.h>
#include <arpa/inet.h>
#define TEST_NET
Index: isoinfra/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/isoinfra/current/ChangeLog,v
retrieving revision 1.26
diff -U5 -w -r1.26 ChangeLog
--- isoinfra/current/ChangeLog    15 Mar 2004 15:20:22 -0000    1.26
+++ isoinfra/current/ChangeLog    19 Oct 2004 03:42:08 -0000
@@ -1,5 +1,10 @@
+2004-10-16  David Brennan <eCos@brennanhome.com>
+
+    * include/unistd.h: Added prototype for new fssync function.
+    * include/sys/stat.h: Added info for fat fs attributes
+
2004-03-12  Jonathan Larmour  <jifl@eCosCentric.com>

    * cdl/isoinfra.cdl: Typo: CYGBLD_ISO_STDIO_FILEPOS ->
    CYGBLD_ISO_STDIO_FILEPOS_HEADER.

Index: isoinfra/current/include/unistd.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/isoinfra/current/include/unistd.h,v
retrieving revision 1.7
diff -U5 -w -r1.7 unistd.h
--- isoinfra/current/include/unistd.h    15 Mar 2004 15:20:23 -0000    1.7
+++ isoinfra/current/include/unistd.h    19 Oct 2004 03:42:08 -0000
@@ -236,10 +236,11 @@
extern int      fsync( int fd );
extern int    ftruncate(int fd, off_t length);

extern int     chdir(const char *path);
extern char     *getcwd(char *buf, size_t size);
+extern int     fssync(const char *path);

extern pid_t     getpid(void);
extern pid_t    getppid(void);
extern uid_t     getuid(void);
extern uid_t     geteuid(void);
Index: isoinfra/current/include/sys/stat.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/isoinfra/current/include/sys/stat.h,v
retrieving revision 1.7
diff -U5 -w -r1.7 stat.h
--- isoinfra/current/include/sys/stat.h    15 Jul 2003 13:39:40 -0000    1.7
+++ isoinfra/current/include/sys/stat.h    19 Oct 2004 03:42:08 -0000
@@ -123,10 +123,33 @@
#define S_IRWXO  (S_IROTH|S_IWOTH|S_IXOTH)

#define S_ISUID  (1<<25)
#define S_ISGID  (1<<26)

+// -------------------------------------------------------------------------
+// FAT filesystem dir entry attributes
+
+#define S_FATFS_RDONLY (1<<16) // Read only
+#define S_FATFS_HIDDEN (1<<17) // Hidden
+#define S_FATFS_SYSTEM (1<<18) // System
+#define S_FATFS_VOLUME (1<<19) // Volume label
+#define S_FATFS_DIR (1<<20) // Subdirectory
+#define S_FATFS_ARCHIVE (1<<21) // Needs archiving
+
+// Mode bits which are allowed by chmod
+#define S_FATFS_CHMOD (S_FATFS_RDONLY | S_FATFS_HIDDEN | S_FATFS_SYSTEM | \
+ S_FATFS_ARCHIVE)
+// -------------------------------------------------------------------------
+// mode FAT dir entry attributes macros
+
+#define MODE_IS_RDONLY(__mode) ((__mode) & S_FATFS_RDONLY)
+#define MODE_IS_HIDDEN(__mode) ((__mode) & S_FATFS_HIDDEN)
+#define MODE_IS_SYSTEM(__mode) ((__mode) & S_FATFS_SYSTEM)
+#define MODE_IS_VOLUME(__mode) ((__mode) & S_FATFS_VOLUME)
+#define MODE_IS_DIR(__mode) ((__mode) & S_FATFS_DIR)
+#define MODE_IS_ARCHIVE(__mode) ((__mode) & S_FATFS_ARCHIVE)
+


struct stat {
    mode_t  st_mode;     /* File mode */
    ino_t   st_ino;      /* File serial number */
    dev_t   st_dev;      /* ID of device containing file */
@@ -147,8 +170,10 @@

__externC int fstat( int fd, struct stat *buf );

__externC int mkdir(const char *path, mode_t mode);

+__externC int chmod( const char *fname, int new_mode );
+
#endif /* CYGONCE_ISO_STAT_H multiple inclusion protection */

/* EOF stat.h */


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