Commit Graph

597 Commits

Author SHA1 Message Date
Sebastian Huber
e384438b9c nfsclient: POSIX conformance
According to POSIX the read() call should return the maximum number of
bytes available for regular files.
2012-04-23 16:02:09 +02:00
Sebastian Huber
790f04ddbb PR2039: Fix NULL pointer access
In case rtems_bdbuf_read() returns an error status, the block device
buffer pointer will be set to NULL.  In RFS the chain node of the block
device buffer will be used for RFS purposes.  We must not do this after
an erroneous read.
2012-03-14 09:11:13 +01:00
Sebastian Huber
796967c3df libblock: Change bdbuf API
The functions
 o rtems_bdbuf_get(),
 o rtems_bdbuf_read(),
 o rtems_bdbuf_syncdev(), and
 o rtems_bdbuf_purge_dev(),
use now the disk device instead of the device identifier.  This makes
bdbuf independent of rtems_disk_obtain() and rtems_disk_release().  It
is the responsiblity of the file system to obtain the disk device.  This
also reduces the overhead to get a buffer.

The key for the AVL tree uses now the disk device instead of the device
identifier.  The pointer is interpreted as an unsigned integer.  This
reduces the memory overhead and makes the comparison operation a bit
faster.

Removed function rtems_bdbuf_purge_major().  This function was too
destructive and could have unpredictable side effects.
2012-03-13 12:24:18 +01:00
Sebastian Huber
e998c98518 IMFS: Node specific stat handlers 2012-03-13 12:24:16 +01:00
Sebastian Huber
04ca77e31d IMFS: Generic device identifier 2012-03-13 12:24:16 +01:00
Sebastian Huber
c5392ef924 IMFS: Add make generic node support
Generic nodes are an alternative to standard drivers in RTEMS.  The
handlers of a generic node are called with less overhead compared to the
standard driver operations.  The usage of file system node handlers
enable more features like support for fsync() and fdatasync().  The
generic nodes use the reference counting of the IMFS.  This provides
automatic node destruction when the last reference vanishes.

Extend type IMFS_types_union by new type IMFS_generic_t.

Extend enum IMFS_jnode_types_t by IMFS_GENERIC.

Add functions
 o IMFS_make_generic_node(),
 o IMFS_is_imfs_instance(),
 o IMFS_generic_get_context_by_node(),
 o IMFS_generic_get_context_by_location(), and
 o IMFS_generic_get_context_by_iop().

New test fstests/fsimfsgeneric01.
2012-03-13 12:24:16 +01:00
Sebastian Huber
699ac7c08f IMFS: Add and use node control
Add and use structure IMFS_node_control with support functions.  This
helps to make high level functions independent of the node type and
reduces the number of branches in the code.
2012-03-13 12:24:16 +01:00
Sebastian Huber
70927458b7 IMFS: New support functions
Add and use IMFS_type() and IMFS_is_directory().
2012-03-13 12:24:16 +01:00
Sebastian Huber
6661435f84 IMFS: Removed superfluous imfs_dir_open() 2012-03-13 12:24:16 +01:00
Sebastian Huber
1bdff036ac IMFS: Reference counting for nodes
The introduction of reference counting of nodes avoids the removal of
open nodes and potential usage of freed memory.
2012-03-13 12:24:15 +01:00
Sebastian Huber
2e0ce55bf0 IMFS: Use unprotected chain operations
Directory entry add or removal operations are protected by the file
system instance lock.  There is no need for protected chain operations.
2012-03-13 12:24:15 +01:00
Sebastian Huber
316507ab91 IMFS: Lock the file system during directory reads
Other threads may add or remove directory entries during a read of the
directory.  Use the file system instance lock for protection.
2012-03-13 12:24:15 +01:00
Sebastian Huber
e00cca9b74 IMFS: Do not check for unsupported types
Allow creation of nodes with an unsupported type.  Later the usage of
such nodes will return an error status.
2012-03-13 12:24:15 +01:00
Sebastian Huber
2563410019 Filesystem: Rename defines
o Removed RTEMS_LIBIO_PERMS_SEARCH.
 o Renamed RTEMS_LIBIO_PERMS_READ in RTEMS_FS_PERMS_READ.
 o Renamed RTEMS_LIBIO_PERMS_WRITE in RTEMS_FS_PERMS_WRITE.
 o Renamed RTEMS_LIBIO_PERMS_EXEC in RTEMS_FS_PERMS_EXEC.
 o Renamed RTEMS_LIBIO_FOLLOW_HARD_LINK in RTEMS_FS_FOLLOW_HARD_LINK.
 o Renamed RTEMS_LIBIO_FOLLOW_SYM_LINK in RTEMS_FS_FOLLOW_SYM_LINK.
 o Renamed RTEMS_LIBIO_MAKE in RTEMS_FS_MAKE.
 o Renamed RTEMS_LIBIO_EXCLUSIVE in RTEMS_FS_EXCLUSIVE.
 o Renamed RTEMS_LIBIO_ACCEPT_RESIDUAL_DELIMITERS in
   RTEMS_FS_ACCEPT_RESIDUAL_DELIMITERS.
 o Renamed RTEMS_LIBIO_REJECT_TERMINAL_DOT in
 RTEMS_FS_REJECT_TERMINAL_DOT.
2012-03-13 12:24:10 +01:00
Sebastian Huber
4116fce629 Filesystem: New defaults fsync_h and fdatasync_h
New defaults rtems_filesystem_default_fsync_or_fdatasync() and
rtems_filesystem_default_fsync_or_fdatasync_success() for fsync_h and
fdatasync_h.  The rtems_filesystem_default_fsync_or_fdatasync() sets now
errno to EINVAL according to POSIX.
2012-03-13 12:23:45 +01:00
Sebastian Huber
a76c23738b Filesystem: Change error indication
Change error indication to ESPIPE in rtems_filesystem_default_lseek().
2012-03-13 12:23:45 +01:00
Sebastian Huber
adef4e4696 Filesystem: New function
New function rtems_filesystem_default_lseek_success().
2012-03-13 12:23:45 +01:00
Sebastian Huber
3b7c123c8d Filesystem: Reference counting for locations
o A new data structure rtems_filesystem_global_location_t was
   introduced to be used for
    o the mount point location in the mount table entry,
    o the file system root location in the mount table entry,
    o the root directory location in the user environment, and
    o the current directory location in the user environment.
   During the path evaluation global start locations are obtained to
   ensure that the current file system instance will be not unmounted in
   the meantime.
 o The user environment uses now reference counting and is protected
   from concurrent access.
 o The path evaluation process was completely rewritten and simplified.
   The IMFS, RFS, NFS, and DOSFS use now a generic path evaluation
   method.  Recursive calls in the path evaluation have been replaced
   with iteration to avoid stack overflows.  Only the evaluation of
   symbolic links is recursive.  No dynamic memory allocations and
   intermediate buffers are used in the high level path evaluation.  No
   global locks are held during the file system instance specific path
   evaluation process.
 o Recursive symbolic link evaluation is now limited by
   RTEMS_FILESYSTEM_SYMLOOP_MAX.  Applications can retrieve this value
   via sysconf().
 o The device file system (devFS) uses now no global variables and
   allocation from the workspace.  Node names are allocated from the
   heap.
 o The upper layer lseek() performs now some parameter checks.
 o The upper layer ftruncate() performs now some parameter checks.
 o unmask() is now restricted to the RWX flags and protected from
   concurrent access.
 o The fchmod_h and rmnod_h file system node handlers are now a file
   system operation.
 o The unlink_h operation has been removed.  All nodes are now destroyed
   with the rmnod_h operation.
 o New lock_h, unlock_h, clonenod_h, and are_nodes_equal_h file system
   operations.
 o The path evaluation and file system operations are now protected by
   per file system instance lock and unlock operations.
 o Fix and test file descriptor duplicate in fcntl().
 o New test fstests/fsnofs01.
2012-03-13 12:23:37 +01:00
Sebastian Huber
a4097fdb2f PR 2026/filesystem - Fix semaphore attributes
Semaphores of type RTEMS_SIMPLE_BINARY_SEMAPHORE are not suitable for a
mutex.  Use RTEMS_BINARY_SEMAPHORE with RTEMS_INHERIT_PRIORITY instead.
2012-02-23 11:16:09 +01:00
Sebastian Huber
6491f67d3e Moved empty test in front of busy tests 2012-02-10 10:42:45 +01:00
Sebastian Huber
e303adf444 Check that the file offset is valid after a seek 2012-02-09 11:05:18 +01:00
Sebastian Huber
62d8a5452c POSIX conformance
For symbolic links, the length in bytes of the pathname contained in the
symbolic link should be returned in st_size.
2012-02-08 15:54:54 +01:00
Sebastian Huber
1052242d23 Removed fpathconf file system node handler.
There existed no calling function for this handler.
2012-02-02 15:55:33 +01:00
Joel Sherrill
61250b4ce9 Remove all .cvsignore files. 2012-02-01 10:59:44 -06:00
Chris Johns
8504f12471 2011-12-09 Chris Johns <chrisj@rtems.org>
PR 1968/filesystem
        * libfs/src/rfs/rtems-rfs-file.c: Fix to the seek bug where a seek
        to 0 after reading the end of the file did not point to the
        correct block.
        * libfs/src/rfs/rtems-rfs-rtems.h,
        libfs/src/rfs/rtems-rfs-trace.c: Fix the trace flags. Used to fix
        the bug.
2011-12-09 07:21:02 +00:00
Ralf Corsepius
47528a8f2e 2011-12-06 Ralf Corsépius <ralf.corsepius@rtems.org>
* libfs/src/pipe/pipe.c: Include <rtems/pipe.h> (Missing prototype).
2011-12-06 15:20:50 +00:00
Ralf Corsepius
46ae58a595 2011-12-06 Ralf Corsépius <ralf.corsepius@rtems.org>
* libfs/src/imfs/imfs_debug.c: Make IMFS_print_jnode,
	IMFS_dump_directory static.
	* libfs/src/imfs/memfile.c: Make memfile_free_blocks_in_table static.
2011-12-06 07:05:54 +00:00
Ralf Corsepius
326d83fb6a 2011-12-02 Ralf Corsépius <ralf.corsepius@rtems.org>
* libfs/src/imfs/deviceerrno.c:
	Include <rtems/devfs.h> for missing prototypes.
2011-12-02 17:27:16 +00:00
Ralf Corsepius
03f407b297 2011-12-02 Ralf Corsépius <ralf.corsepius@rtems.org>
* libfs/src/rfs/rtems-rfs-rtems-dev.c:
	Remove duplicate prototype of rtems_deviceio_errno.
	Include <rtems/devfs.h> for rtems_deviceio_errno().
2011-12-02 17:25:31 +00:00
Ralf Corsepius
3eb8f28875 2011-12-02 Ralf Corsépius <ralf.corsepius@rtems.org>
* libfs/src/imfs/imfs_eval.c: Make IMFS_evaluate_permission,
	IMFS_evaluate_hard_link, IMFS_evaluate_sym_link static.
	* libfs/src/imfs/imfs_fifo.c: Make IMFS_fifo_open,
	IMFS_fifo_close, IMFS_fifo_read, IMFS_fifo_write,
	IMFS_fifo_ioctl static.
2011-12-02 13:39:58 +00:00
Ralf Corsepius
66b8047e52 Remove stray whitespaces. 2011-11-06 12:44:24 +00:00
Ralf Corsepius
984c4c492f 2011-11-06 Ralf Corsépius <ralf.corsepius@rtems.org>
PR1945/cpukit
	* libfs/src/nfsclient/src/nfs.c, libfs/src/rfs/rtems-rfs-rtems-dev.c,
	libfs/src/rfs/rtems-rfs-rtems-dir.c,
	libfs/src/rfs/rtems-rfs-rtems-file.c, libnetworking/lib/ftpfs.c,
	libnetworking/lib/tftpDriver.c: Replace rtems_off64_t with off_t.
2011-11-06 12:00:04 +00:00
Ralf Corsepius
22ad826358 2011-11-06 Ralf Corsépius <ralf.corsepius@rtems.org>
PR1945/cpukit
	* libfs/src/imfs/deviceio.c, libfs/src/imfs/imfs.h,
	libfs/src/imfs/imfs_directory.c, libfs/src/imfs/imfs_fifo.c,
	libfs/src/imfs/memfile.c: Replace rtems_off64_t with off_t.
2011-11-06 11:57:10 +00:00
Ralf Corsepius
59ca2f8ccb 2011-11-06 Ralf Corsépius <ralf.corsepius@rtems.org>
PR1945/cpukit
	* libfs/src/dosfs/msdos.h, libfs/src/dosfs/msdos_dir.c,
	libfs/src/dosfs/msdos_file.c:
	Replace rtems_off64_t with off_t.
2011-11-06 11:54:49 +00:00
Ralf Corsepius
e4c0a04bd3 2011-11-06 Ralf Corsépius <ralf.corsepius@rtems.org>
PR1945/cpukit
	* libfs/src/defaults/default_ftruncate.c,
	libfs/src/defaults/default_lseek.c:
	Replace rtems_off64_t with off_t.
2011-11-06 11:52:45 +00:00
Ralf Corsepius
e38658762d 2011-11-06 Ralf Corsépius <ralf.corsepius@rtems.org>
* libfs/src/rfs/rtems-rfs-dir.c: Rename PRIdoff_t into PRIooff_t.
2011-11-06 07:08:32 +00:00
Chris Johns
1e0f63b52c 2011-11-04 Chris Johns <chrisj@rtems.org>
* libfs/src/rfs/rtems-rfs-dir.h: Commit the missing change. Part
        of removing the hardcoded dir string.
2011-11-03 22:02:01 +00:00
Chris Johns
97ae192a23 2011-11-03 Chris Johns <chrisj@rtems.org>
PR 1948/filesystem
        * libfs/src/rfs/rtems-rfs-file-system.c,
        libfs/src/rfs/rtems-rfs-file-system.h,
        libfs/src/rfs/rtems-rfs-format.c, libfs/src/rfs/rtems-rfs-rtems.c:
        Add support for mount passing an ASCIIZ string containing
        configuration options. Remove the hardcoded dir string and
        size. Fix comments.
        * libblock/src/bdbuf.c: Fix state labels in trace output.
2011-11-03 06:32:42 +00:00
Ralf Corsepius
8c30ecd177 2011-10-26 Ralf Corsépius <ralf.corsepius@rtems.org>
* libfs/src/imfs/imfs.h: Add IMFS_memfile_maximum_size.
2011-10-26 03:49:27 +00:00
Ralf Corsepius
9b42315cee 2011-10-20 Ralf Corsépius <ralf.corsepius@rtems.org>
* libfs/src/dosfs/msdos_file.c (msdos_file_datasync):
	Remove unused var "rc".
2011-10-20 10:48:30 +00:00
Ralf Corsepius
49755cfd68 2011-10-18 Ralf Corsépius <ralf.corsepius@rtems.org>
* libfs/src/pipe/fifo.c: Conditionally use var "sc".
2011-10-18 09:35:17 +00:00
Ralf Corsepius
f25425b106 2011-10-17 Ralf Corsépius <ralf.corsepius@rtems.org>
* libfs/src/rfs/rtems-rfs-file-system.c (rtems_rfs_fs_open):
	Comment out unused vars "group", "group_base".
2011-10-17 13:59:26 +00:00
Ralf Corsepius
48943dc195 2011-10-10 Ralf Corsépius <ralf.corsepius@rtems.org>
* libfs/src/devfs/devfs_mknod.c: Remove const cast.
	* libfs/src/imfs/ioman.c: Remove const cast.
	* libfs/src/devfs/devfs.h: Make device_name a const char*.
	* sapi/include/rtems/io.h: Make device_name a const char*.
2011-10-10 07:11:26 +00:00
Ralf Corsepius
da30d6c009 2011-10-07 Ralf Corsépius <ralf.corsepius@rtems.org>
* libfs/src/imfs/memfile.c (memfile_ioctl): Remove unused var
	"the_jnode".
2011-10-07 09:36:35 +00:00
Joel Sherrill
13c4f853e6 2011-08-02 Joel Sherrill <joel.sherrill@oarcorp.com>
PR 1877/cpukit
	* libfs/src/imfs/imfs_mknod.c, libfs/src/imfs/memfile.c,
	sapi/inline/rtems/rbtree.inl, score/include/rtems/score/rbtree.h,
	score/inline/rtems/score/rbtree.inl, score/src/rbtree.c,
	score/src/rbtreefind.c, score/src/rbtreeinsert.c: Add comparison
	function for RBTrees.
2011-08-02 19:25:59 +00:00
Sebastian Huber
363aacef6d 2011-08-01 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libfs/src/nfsclient/src/nfs.c: Fixed creation of directories.
2011-08-01 07:27:25 +00:00
Joel Sherrill
186fee26ef 2011-07-21 Joel Sherrill <joel.sherrill@oarcorp.com>
* libfs/src/dosfs/fat_file.c, libmisc/monitor/monitor.h,
	score/cpu/m68k/rtems/score/cpu.h: Remove stray spaces from unsigned32
	to uint32_t conversion.
2011-07-21 13:18:30 +00:00
Sebastian Huber
a2900a8b4b 2011-07-21 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libcsupport/include/rtems/libio_.h: Added
	rtems_filesystem_is_root_location().
	* libfs/src/imfs/imfs_directory.c, libfs/src/imfs/imfs_eval.c,
	libfs/src/dosfs/msdos_dir.c, libfs/src/dosfs/msdos_eval.c: Use
	rtems_filesystem_is_root_location().
2011-07-21 12:03:26 +00:00
Joel Sherrill
aa03052eee 2011-07-13 Till Straumann <strauman@slac.stanford.edu>
PR 1775/filesystem
	* libfs/src/nfsclient/src/nfs.c: NFSAddress NFS issue where read/write
	problems when requested bytes greater than nfsStBlksize. Failure to
	create files and symlinks.
2011-07-13 19:05:43 +00:00
Chris Johns
acb92e332b 2011-07-04 Chris Johns <chrisj@rtems.org>
PR 1827/filesystem
        * libfs/src/rfs/rtems-rfs-rtems.c: Skip the parent (..) path value
        when eval make moving up out of the RFS file system.
2011-07-04 00:31:25 +00:00