Commit Graph

597 Commits

Author SHA1 Message Date
Chris Johns
c49985691f Change all references of rtems.com to rtems.org. 2014-03-21 08:10:47 +11:00
Joel Sherrill
ba386a632e dosfs/fat.c: Remove use of register keyword 2014-02-03 17:45:33 -06:00
Sebastian Huber
5b34e7ada4 IMFS: Improved support for generic nodes
The rtems_filesystem_location_info_t::node_access_2 was unused by the
IMFS.  Use it to hold the context of generic nodes.  This makes it
possible to use node handlers for objects with and without a
corresponding file system node.

For example network sockets created with socket() have only a file
descriptor, but no corresponding file system node.  The UNIX(4) domain
sockets can be bound to file system nodes.  In both cases the
rtems_filesystem_location_info_t must provide a pointer to the socket
structure used by the socket node handlers.  With the context pointer
(for sockets, this is the socket structure) in
rtems_filesystem_location_info_t::node_access_2 the same node handlers
can be used in both cases.
2014-01-21 13:22:52 +01:00
Sebastian Huber
45e82bb862 IMFS: Allow sockets as generic nodes 2014-01-21 13:22:52 +01:00
Sebastian Huber
c1d8ee4cdc libcsupport: Accept NULL for zero-length entries 2013-12-20 10:31:53 +01:00
Sebastian Huber
56bea4339f Filesystem: Use default kqfilter and poll handler 2013-12-20 10:31:53 +01:00
Sebastian Huber
2f68778f08 Filesystem: Add readv/writev handlers
The readv() and writev() support was implemented in terms of multiple
calls to the read and write handlers.  This imposes a problem on device
files which use an IO vector as single request entity.  For example a
low-level network device (e.g. BPF(4)) may use an IO vector to create
one frame from multiple protocol layers each with its own IO vector
entry.
2013-12-20 10:31:53 +01:00
Alan Cudmore
a9619f3cb6 For PR 2164 - RFS File System - fix bitmap_create_search loop bug
This is for the RFS file system. There is a bug in the
rtems_rfs_bitmap_create_search loop. It is supposed to iterate
over the range of bits in a search element ( usually 32 bits ),
so it should loop through bits 0 through 31. Instead it loops
through 0 - 32, causing some blocks not to be allocated. As in
PR 2163, this depends on the block size and number of blocks in
a file system. Block sizes and group sizes that are powers of 2
seem to work fine ( 512 byte blocks, 4096 block groups, etc ).
When the block sizes are not powers of 2, then this loop error
causes some of the blocks at the end of a group to be skipped,
preventing 100% of the blocks from being used. A simple test
for this and PR2163 is to create a RAM disk with block size
3900 and at least 1 full group ( 31200 blocks ). A file system
with these sizes will not be able to allocate 100% of the blocks.
2013-12-19 11:07:47 +11:00
Alan Cudmore
9b48dc67ed For PR 2162 - RFS File System - statvfs reports 1 block free
This is for the RFS file system. The statvfs call reports 1 block free
when the file system is full because it does not account for the superblock
in its calculation of free blocks.
This is a simple fix that adjusts the number of blocks reported to account
for the superblock. We may want to wait for a more complete solution such
as locating the superblock in each group.
2013-12-19 11:07:41 +11:00
Alan Cudmore
e60b7b1b4f For PR 2163 - RFS File System - fix group search algorithm bug
This is for the RFS file system. There is a bug in the group search
algorithm where it will skip groups, causing blocks to remain
unallocated. This is dependant on the size of the blocks and number
of blocks in a group, so it does not always show up. The fix corrects
the skipping of groups during the search, allowing all of the blocks
to be found.
2013-12-19 11:03:27 +11:00
Sebastian Huber
fb664a21c2 nfsclient: Move defines to cover all header files 2013-12-16 14:30:25 +01:00
Sebastian Huber
99c2323d4f JFFS2: Do not re-define struct iovec 2013-12-16 14:30:25 +01:00
Sebastian Huber
98e5c954bd PR2160: imfs: Use ENOSYS for unsupported nodes
Return an error status with errno set to ENOSYS during node creation for
nodes not available in the current configuration.
2013-12-11 09:39:09 +01:00
Chris Johns
c59f668c42 PR2138: rtems_rfs_rtems_initialize() can erroneously set errno.
Patch from Nick for this. Thanks.
2013-12-10 15:00:27 +11:00
Chris Johns
9da8740f05 PR2159: Have the FIFO driver read follow POSIX standard.
The read call was only returning once the requested buffer was full.
The change returns any available data.
2013-12-10 12:33:22 +11:00
Chris Johns
b51d8a4996 libfs/imfs: Set the FIFO control block.
The FIFO was incorrectly set to the default control block.
2013-12-10 12:30:20 +11:00
Joel Sherrill
03e54614a3 statvfs filesystem handlers: Remove restrict 2013-11-27 13:06:16 -06:00
Daniel Ramirez
bb81e04ae3 statvfs and ALL filesystem handlers: Add restrict keyword. 2013-11-21 16:56:48 -06:00
Sebastian Huber
8cb28826ff Filesystem: Add kernel event filter handler
This handler is necessary to implement the KQUEUE(2) system calls.

Add <sys/event.h> from FreeBSD 8.4.
2013-11-04 15:22:48 +01:00
Sebastian Huber
1682946057 Filesystem: Add poll() handler
This handler is necessary to implement the SELECT(2) and POLL(2) system
calls.

Add <sys/poll.h> from FreeBSD 8.4.
2013-11-04 15:22:47 +01:00
Sebastian Huber
ba120d1aaa Filesystem: Use ENOTTY for default ioctl() handler
This is in line with Linux and FreeBSD.
2013-10-31 14:32:25 +01:00
Sebastian Huber
73e734535b IMFS: Use IMFS_mtime_ctime_update() 2013-10-27 18:51:01 +01:00
Ralf Kirchner
e89ed92495 dosfs: Ensure initially the sector size is used as bdbuf block size 2013-10-18 12:08:00 -04:00
Sebastian Huber
1f724a0309 RFS: Include missing header file 2013-10-16 14:45:00 +02:00
Sebastian Huber
3c2bb2238a Return EINVAL in default ftruncate() handler
According to POSIX this case is implementation defined.  Linux and
FreeBSD return EINVAL.
2013-10-11 16:22:00 +02:00
Joel Sherrill
40eea0015f nfsclient/src/dirutils.c: Fix missing prototype warnings 2013-09-22 10:36:57 -05:00
Sebastian Huber
3c96bee3f9 JFFS2: Add RTEMS support 2013-09-19 13:16:06 +02:00
Sebastian Huber
78b85286f0 JFFS2: Update Linux compatibility layer
Modify compatbility layer for RTEMS.  Add support for Linux 3.11 based
JFFS2.
2013-09-19 13:16:06 +02:00
Sebastian Huber
672038b174 JFFS2: Import from eCos
Import of Linux compatibility layer and JFFS2 file system support from
eCos.

The files are imported from eCos CVS on 2013-09-16.

cvs -d :pserver:anoncvs@ecos.sourceware.org:/cvs/ecos login
cvs -z3 -d :pserver:anoncvs@ecos.sourceware.org:/cvs/ecos co -P ecos

The files

"ecos/packages/compat/linux/current/asm/atomic.h",
"ecos/packages/compat/linux/current/asm/bug.h",
"ecos/packages/compat/linux/current/asm/page.h",
"ecos/packages/compat/linux/current/cyg/crc/crc.h",
"ecos/packages/compat/linux/current/cyg/infra/cyg_type.h",
"ecos/packages/compat/linux/current/linux/compiler.h",
"ecos/packages/compat/linux/current/linux/completion.h",
"ecos/packages/compat/linux/current/linux/config.h",
"ecos/packages/compat/linux/current/linux/crc32.h",
"ecos/packages/compat/linux/current/linux/errno.h",
"ecos/packages/compat/linux/current/linux/fs.h",
"ecos/packages/compat/linux/current/linux/kernel.h",
"ecos/packages/compat/linux/current/linux/list.h",
"ecos/packages/compat/linux/current/linux/mtd/compatmac.h",
"ecos/packages/compat/linux/current/linux/mtd/mtd.h",
"ecos/packages/compat/linux/current/linux/pagemap.h",
"ecos/packages/compat/linux/current/linux/rbtree.h",
"ecos/packages/compat/linux/current/linux/rwsem.h",
"ecos/packages/compat/linux/current/linux/sched.h",
"ecos/packages/compat/linux/current/linux/slab.h",
"ecos/packages/compat/linux/current/linux/spinlock.h",
"ecos/packages/compat/linux/current/linux/stat.h",
"ecos/packages/compat/linux/current/linux/string.h",
"ecos/packages/compat/linux/current/linux/timer.h",
"ecos/packages/compat/linux/current/linux/types.h",
"ecos/packages/compat/linux/current/linux/version.h",
"ecos/packages/compat/linux/current/linux/vmalloc.h",
"ecos/packages/compat/linux/current/linux/wait.h",
"ecos/packages/compat/linux/current/linux/workqueue.h", and
"ecos/packages/compat/linux/current/linux/zlib.h"
"ecos/packages/compat/linux/current/linux/zutil.h"

are copied to "cpukit/libfs/src/jffs2/include".

The file "ecos/packages/services/crc/current/src/crc32.c" is copied to
"cpukit/libfs/src/jffs2/src/compat-crc32.c".

The file "ecos/packages/compat/linux/current/src/rbtree.c" is copied to
"cpukit/libfs/src/jffs2/src/compat-rbtree.c".

The file "ecos/packages/fs/jffs2/current/src/dir-ecos.c" is copied to
"cpukit/libfs/src/jffs2/src/dir-rtems.c".

The file "ecos/packages/fs/jffs2/current/src/flashio.c" is copied to
"cpukit/libfs/src/jffs2/src/flashio.c".

The file "ecos/packages/fs/jffs2/current/src/fs-ecos.c" is copied to
"cpukit/libfs/src/jffs2/src/fs-rtems.c".

The file "ecos/packages/fs/jffs2/current/src/malloc-ecos.c" is copied to
"cpukit/libfs/src/jffs2/src/malloc-rtems.c".

The file "ecos/packages/fs/jffs2/current/src/os-ecos.h" is copied to
"cpukit/libfs/src/jffs2/src/os-rtems.h".

The LICENSE file referenced in some files of this patch set is part of a
previous patch set imported from Linux.
2013-09-19 13:16:06 +02:00
Sebastian Huber
0c0f128e11 JFFS2: Import from Linux
Import of Journalling Flash File System, Version 2 from Linux 3.11.
This part of the Linux kernel is under a separate license which is
similar to the RTEMS license.

The file "cpukit/libfs/src/jffs2/include/linux/jffs2.h" is a copy of
"linux-3.11/include/uapi/linux/jffs2.h".

The file "LICENSE.JFFS2" is a copy of "linux-3.11/fs/jffs2/LICENCE".

The files

"linux-3.11/fs/jffs2/LICENCE",
"linux-3.11/fs/jffs2/acl.h",
"linux-3.11/fs/jffs2/build.c",
"linux-3.11/fs/jffs2/compr.c",
"linux-3.11/fs/jffs2/compr.h",
"linux-3.11/fs/jffs2/compr_rtime.c",
"linux-3.11/fs/jffs2/compr_rubin.c",
"linux-3.11/fs/jffs2/compr_zlib.c",
"linux-3.11/fs/jffs2/debug.c",
"linux-3.11/fs/jffs2/debug.h",
"linux-3.11/fs/jffs2/erase.c",
"linux-3.11/fs/jffs2/gc.c",
"linux-3.11/fs/jffs2/jffs2_fs_i.h",
"linux-3.11/fs/jffs2/jffs2_fs_sb.h",
"linux-3.11/fs/jffs2/nodelist.c",
"linux-3.11/fs/jffs2/nodelist.h",
"linux-3.11/fs/jffs2/nodemgmt.c",
"linux-3.11/fs/jffs2/read.c",
"linux-3.11/fs/jffs2/readinode.c",
"linux-3.11/fs/jffs2/scan.c",
"linux-3.11/fs/jffs2/summary.h",
"linux-3.11/fs/jffs2/write.c", and
"linux-3.11/fs/jffs2/xattr.h"

are copied to "cpukit/libfs/src/jffs2/src".
2013-09-19 13:16:06 +02:00
Sebastian Huber
c5b2d7944c IMFS: Fix truncate according to POSIX
ftruncate() and open() with O_TRUNC shall upon successful completion
mark for update the st_ctime and st_mtime fields of the file.

truncate() shall upon successful completion, if the file size is
changed, mark for update the st_ctime and st_mtime fields of the file.

The POSIX standard "The Open Group Base Specifications Issue 7", IEEE
Std 1003.1, 2013 Edition says nothing about the behaviour of truncate()
if the file size remains unchanged.

Future directions of the standard may mandate the behaviour specified in
ftruncate():

http://austingroupbugs.net/view.php?id=489
2013-09-13 16:47:55 +02:00
Sebastian Huber
f82851c5f7 IMFS: Use inline functions instead of macros 2013-09-13 16:47:55 +02:00
Sebastian Huber
b6657c3957 Filesystem: Add and use rtems_filesystem_chmod()
Implement POSIX requirements in the high-level file system layer.
2013-09-12 15:31:12 +02:00
Ralf Kirchner
3dbb68d991 dosfs: Correct handling of iconv() return value 2013-09-10 14:48:51 +02:00
Gedare Bloom
8ee95e609f imfs: use safe string functions
Replace strcpy and strcat with counted variants.
2013-09-05 14:44:24 -04:00
Gedare Bloom
97ae1eeb38 imfs: check return value from mkdir 2013-09-05 14:13:32 -04:00
Gedare Bloom
b6cfbab43f dosfs: Eliminate empty case statements that fall through to default.
Also eliminates possibly dead code in case the name_type can never
actually be MSDOS_NAME_INVALID.

1063860 Logically dead code.
2013-09-05 14:03:00 -04:00
Gedare Bloom
c963ac7e39 nfs: Fix ln option processing.
If opts is NULL, then strchr() will dereference it and search for 's'.

1063863 Dereference after null check
2013-09-05 13:44:04 -04:00
Gedare Bloom
a8007dc2ca dosfs: Unsigned compared against 0
Change the type for storing the return from iconv to be signed.
2013-09-05 13:15:33 -04:00
Gedare Bloom
e4c192655e dosfs: Unsigned compared against 0
Fix the type of "cmpltd" to be ssize_t so that assigning it to -1
will terminate processing as intended.
2013-09-05 13:09:37 -04:00
Gedare Bloom
551468c2db dosfs: Unintentional integer overflow
Explicitly promote 32-bit integer to 64-bits for multiplication.
2013-09-05 12:58:34 -04:00
Gedare Bloom
a6d3525604 IMFS: Resource leak
Free fs_info in case root_node is NULL.
2013-09-05 11:53:39 -04:00
Sebastian Huber
a839d62b88 RFS: Use unprotected chain operations
This area is protected by the RFS file system instance lock.
2013-08-27 10:48:15 +02:00
Sebastian Huber
630365b927 Filesystem: Avoid usage of uninitialized variable
This is a cosmetic fix.  There was no bug.
2013-08-23 10:06:34 +02:00
Sebastian Huber
389ffb280f dosfs: Use unprotected chain operations
This area is protected by the FAT file system instance lock.
2013-08-21 15:02:59 +02:00
Nick Withers
712c62d8a5 Add "const void* data" parameter to rtems_rfs_rtems_initialize()'s declaration, matching its definition
See https://www.rtems.org/bugzilla/show_bug.cgi?id=2137
2013-08-09 18:24:31 +10:00
Sebastian Huber
ae75429ca1 PR766: Delete __RTEMS_VIOLATE_KERNEL_VISIBILITY__ 2013-08-08 14:11:22 +02:00
R. Diez
ffa2defc78 Fix compiler warnings 2013-08-06 11:02:56 +02:00
Chris Johns
681f198539 Return the amount of data written when an error occurs rather than
the error.

The change lets the mrfs_fsrdwr test pass.
2013-07-27 23:57:05 +10:00
Sebastian Huber
fe6c170cf5 score: Create states implementation header
Move implementation specific parts of states.h and states.inl into new
header file statesimpl.h.  The states.h contains now only the
application visible API.
2013-07-26 11:55:45 +02:00