Commit Graph

170 Commits

Author SHA1 Message Date
Sebastian Huber
53da07e436 Filesystem: PR1255: Move offset update to handlers
It is now the responsibility of the read() and write() handler to update
the offset field of the IO descriptor (rtems_libio_t).  This change
makes it possible to protect the IO descriptor from concurrent access by
per file locks.
2012-05-15 10:01:42 +02:00
Sebastian Huber
3c462734ba libblock: Fix purge device tree traversal 2012-05-14 16:57:59 +02:00
Joel Sherrill
9b4422a251 Remove All CVS Id Strings Possible Using a Script
Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines
  next to each other after Id string line removed.
+ remove entire comment blocks which only exited to
  contain CVS Ids
+ If the processing left a blank line at the top of
  a file, it was removed.
2012-05-11 08:44:13 -05:00
Sebastian Huber
84ab4fce24 libblock: Add RTEMS_BLKIO_PURGEDEV 2012-05-11 13:58:43 +02:00
Sebastian Huber
30d412469c Filesystem: PR1398: Fix lseek() mechanic
According to POSIX the lseek() function shall not, by itself, extend the
size of a file.

Remove the size field of rtems_libio_t.  A file has only one size but
may have multiple open file descriptors.  Thus a file size field in the
file descriptor may lead to inconsistencies.

New default handlers rtems_filesystem_default_lseek_file() and
rtems_filesystem_default_lseek_directory().
2012-05-11 13:58:43 +02:00
Sebastian Huber
08b9d53460 libblock: PR2040: Fix recycle destination update
Check the availablity of a recycle destination segment only when it is
necessary to avoid missing resycle source segment erasures.
2012-04-16 11:06:45 +02:00
Sebastian Huber
ac50df2304 libblock: PR2040: Add starvation threshold
Do not use the unavailable block count as the erased blocks starvation
threshold.  Use instead the block count of the largest segment.  This
improves the starvation resolution gain of available blocks.
2012-04-16 11:06:45 +02:00
Sebastian Huber
b467782b53 libblock: Add rtems_bdbuf_set_block_size()
The new function rtems_bdbuf_set_block_size() must be used to set the
block size of a disk device.  It will check if the block size is valid
and set the new fields block_to_media_block_shift and bds_per_group of
the rtems_disk_device structure.  This helps to avoid complex arithmetic
operations in the block device buffer get and read path.
2012-04-12 10:42:43 +02:00
Sebastian Huber
3d60c1b22a libblock: Change error status to fatal error
Calling the bdbuf API functions in the not configured state is now a
fatal error.
2012-04-12 10:42:43 +02:00
Sebastian Huber
462ee70f9b libblock: Use unprotected chain operations
The transfer chain is accessed by at most one thread at a time.
2012-04-12 10:42:43 +02:00
Sebastian Huber
89a84c0fa3 libblock: Use unprotected chain operations
The chains are protected by the bdbuf cache lock.
2012-04-12 10:42:42 +02:00
Sebastian Huber
5b045eb6f8 Filesystem: Change type of ioctl_return
Change the ioctl_return type of rtems_libio_ioctl_args_t to match the
ioctl() return value type.
2012-04-03 15:03:18 +02:00
Sebastian Huber
9f808d1f53 PR2040: libblock: Flash disk starvations statistic 2012-03-14 10:49:49 +01:00
Sebastian Huber
a757d0f80a PR2040: libblock: Flash disk documentation 2012-03-14 10:49:49 +01:00
Sebastian Huber
a309a7941e PR2040: libblock: Fix return status 2012-03-14 10:49:07 +01:00
Sebastian Huber
c08072ce31 PR2040: libblock: Avoid erased blocks starvation
The compaction process needs erased blocks.  It is only possible to
erase an entire segment.  Thus in order to make a progress we always
need enough erased blocks to empty a used or available segment which can
be erased in turn.  A (possibly the worst case) lower bound of erased
blocks is the block count of the largest segment.  The number of
unavailable blocks specified by the configuration will be used to
determine the erase blocks starvation situation.  The number of
unavailable blocks must be greater than or equal to the number of blocks
in the largest segment.
2012-03-14 10:48:54 +01:00
Sebastian Huber
f9fd0c203e PR2040: libblock: Track number of erased blocks 2012-03-14 10:48:39 +01:00
Sebastian Huber
12806cd02f PR2040: libblock: Use segment control as parameter 2012-03-14 10:48:17 +01:00
Sebastian Huber
3ab9c76d3f libblock: Use new API for disk media 2012-03-13 12:24:19 +01:00
Sebastian Huber
01211720ec libblock: Add generic IMFS block device nodes
New functions
 o rtems_blkdev_create(), and
 o rtems_blkdev_create_partition().

New test libtests/block11.
2012-03-13 12:24:18 +01:00
Sebastian Huber
291c926449 libblock: Split file and simplify 2012-03-13 12:24:18 +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
c42b03f498 libblock: Remove superfluous volatile qualifier
All these variables are protected by the bdbuf cache mutex.
2012-03-13 12:24:18 +01:00
Sebastian Huber
a3170f70b6 libblock: Discard extended partitions
Discard the extended partitions after evaluation.  This prevents logical
disks that contain other logical disks.
2012-03-13 12:24:17 +01:00
Sebastian Huber
c93fc2b36b libblock: rtems_ide_part_table_initialize() API 2012-03-13 12:24:17 +01:00
Sebastian Huber
4f3cbd9240 libblock: New IO control RTEMS_BLKIO_GETDISKDEV 2012-03-13 12:24:17 +01:00
Sebastian Huber
03ad6b1d85 libblock: Avoid bdbuf API 2012-03-13 12:24:17 +01:00
Sebastian Huber
5e88538f97 libblock: Split file 2012-03-13 12:24:17 +01:00
Sebastian Huber
beea58072d libblock: Add optional free at delete request 2012-03-13 12:24:16 +01:00
Ralf Corsepius
da13f46bdb 2011-12-09 Ralf Corsépius <ralf.corsepius@rtems.org>
* libblock/src/flashdisk.c:
	Make rtems_fdisk_crc16_gen_factors static.
	* libblock/src/nvdisk.c:
	Make rtems_nvdisk_crc16_gen_factors static.
2011-12-09 13:04:48 +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
Joel Sherrill
0d23caa93c 2011-07-07 Joel Sherrill <joel.sherrill@oarcorp.com>
* libblock/src/nvdisk-sram.c, libi2c/libi2c.c,
	libmisc/shell/main_msdosfmt.c: Eliminate use of GNU old-style field
	designator extension as recommended by clang.
2011-07-07 22:15:00 +00:00
Sebastian Huber
fd9537b79d 2011-05-11 Sebastian Huber <sebastian.huber@embedded-brains.de>
PR 1790/cpukit
	* libblock/src/flashdisk.c: Fixed memset() parameters.
2011-05-11 08:28:49 +00:00
Ralf Corsepius
b907b479e5 2011-02-22 Ralf Corsépius <ralf.corsepius@rtems.org>
* libblock/src/media-path.c: Remove warnings.
2011-02-22 15:11:06 +00:00
Sebastian Huber
a8afce3872 2011-02-17 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libblock/include/rtems/bdpart.h (rtems_bdpart_format):
	Preserve previous API.
	* libblock/src/bdpart-create.c, libblock/src/bdpart-read.c,
	libblock/src/bdpart-write.c: Reflect changes above.
	* libmisc/shell/fdisk.c: Reflect changes above.
2011-02-17 16:25:43 +00:00
Ralf Corsepius
fc658e4e69 2011-02-10 Ralf Corsépius <ralf.corsepius@rtems.org>
* libblock/include/rtems/bdpart.h (rtems_bdpart_format):
	Eliminate unnamed union (Non c99-compliant).
	* libblock/src/bdpart-create.c, libblock/src/bdpart-read.c,
	libblock/src/bdpart-write.c: Reflect changes above.
2011-02-10 23:34:58 +00:00
Sebastian Huber
1680638ab6 2011-01-21 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libblock/src/blkdev-ops.c: New file.
	* libblock/Makefile.am: Reflect change from above.
	* libblock/include/rtems/blkdev.h: Declare rtems_blkdev_generic_ops.
2011-01-21 09:43:24 +00:00
Sebastian Huber
61380a5451 2011-01-20 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libblock/src/show_bdbuf.c, score/src/objectmp.c: Avoid chain API
	violations.
2011-01-20 08:16:15 +00:00
Sebastian Huber
d4d6bd813f 2010-08-25 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libblock/include/rtems/media.h, libblock/src/media-server.c: Use
	chains instead of a message queue.
2010-08-25 08:44:14 +00:00
Sebastian Huber
6ef96da17e 2010-08-25 Sebastian Huber <sebastian.huber@embedded-brains.de>
CID 114/SECURE_CODING
	* libblock/src/media.c: Avoid strcpy().
2010-08-25 08:31:43 +00:00
Sebastian Huber
2b5bd836ce 2010-08-25 Sebastian Huber <sebastian.huber@embedded-brains.de>
CID 113/SECURE_CODING
	* libblock/src/media-path.c: Avoid strcpy().  Style.  Use assert() to
	avoid dead code.
2010-08-25 08:26:21 +00:00
Joel Sherrill
bf4766fe69 2010-08-23 Joel Sherrill <joel.sherrill@oarcorp.com>
* libblock/src/flashdisk.c, libblock/src/nvdisk.c,
	libcsupport/src/ioctl.c, libfs/src/dosfs/fat_file.c: Add va_end().
2010-08-23 23:17:42 +00:00
Sebastian Huber
f6c33f3eef 2010-08-13 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libblock/src/media.c: Use unprotected chain extract.
2010-08-13 12:50:56 +00:00
Sebastian Huber
d91e3a71bb 2010-08-13 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libblock/include/rtems/media.h, libblock/src/media-desc.c,
	libblock/src/media-dev-ident.c, libblock/src/media-path.c,
	libblock/src/media-server.c, libblock/src/media.c: New files.
	* Makefile.am, preinstall.am, libblock/Makefile.am: Reflect changes
	above.
2010-08-13 12:40:16 +00:00
Joel Sherrill
71c012aff5 2010-07-04 Joel Sherrill <joel.sherrill@oarcorp.com>
* libblock/include/rtems/ide_part_table.h, libblock/src/bdbuf.c,
	libcsupport/src/__times.c, libcsupport/src/libio_init.c,
	libcsupport/src/mallocfreespace.c, libcsupport/src/mount-mgr.c,
	libcsupport/src/mount.c, libcsupport/src/rewinddir.c,
	libcsupport/src/seekdir.c, libcsupport/src/telldir.c,
	libcsupport/src/unmount.c, libfs/src/dosfs/fat.c,
	libfs/src/dosfs/fat_fat_operations.c, libfs/src/dosfs/msdos_create.c,
	libfs/src/dosfs/msdos_dir.c, libfs/src/dosfs/msdos_eval.c,
	libfs/src/dosfs/msdos_file.c, libfs/src/dosfs/msdos_format.c,
	libfs/src/dosfs/msdos_fsunmount.c, libfs/src/dosfs/msdos_initsupp.c,
	libfs/src/dosfs/msdos_rename.c, libmisc/cpuuse/cpuusagereport.c,
	libmisc/shell/vis.c, libmisc/stackchk/check.c, sapi/src/posixapi.c,
	telnetd/telnetd.c: Remove include of assert.h when it is not needed.
2010-07-04 14:53:47 +00:00
Joel Sherrill
15bcb4113c 2010-06-14 Joel Sherrill <joel.sherrilL@OARcorp.com>
PR 1553/filesystem
	Coverity Id 37
	* libblock/src/flashdisk.c: Fix two paths which should have returned an
	error but did not have the return statement.
2010-06-14 13:01:58 +00:00
Sebastian Huber
eaee27b0b9 2010-06-08 Sebastian Huber <sebastian.huber@embedded-brains.de>
PR 1524/filesystem
	* libcsupport/src/rtems_mkdir.c: New file.
	* libcsupport/src/Makefile.am: Reflect change above.
	* libcsupport/include/rtems/libio.h: Added rtems_mkdir().
	* libmisc/fsmount/fsmount.h, libmisc/fsmount/fsmount.c,
	libblock/src/bdpart-mount.c, libnetworking/rtems/mkrootfs.h,
	libnetworking/rtems/mkrootfs.c, libfs/src/pipe/pipe.c: Use
	rtems_mkdir().  Removed rtems_fsmount_create_mount_point() and
	rtems_rootfs_mkdir().
2010-06-08 12:59:51 +00:00
Chris Johns
29e92b090c 2010-05-31 Chris Johns <chrisj@rtems.org>
* libcsupport/Makefile.am: Add mount-mgr.c.
        * libcsupport/src/mount-mgr.c: New.
        * include/rtems/fs.h: Added rtems_filesystem_location_mount.
        * libcsupport/include/rtems/libio.h, libcsupport/src/mount.c: New
        mount interface. It is similar to Linux.
        * libcsupport/include/rtems/libio_.h: Remove the
        init_fs_mount_table call.
        * libcsupport/src/base_fs.c: Remove init_fs_mount_table_call. Use
        the new mount call. Remove setting the root node in the global
        pathloc. Mount does this now.
        * libcsupport/src/privateenv.c: Remove the hack to set the root
        mount table entry in the environment.
        * libcsupport/src/unmount.cL Free the target string.
        * libblock/src/bdpart-mount.c: New mount API.

        * libfs/src/devfs/devfs.h, libfs/src/devfs/devfs_init.c,
        libfs/src/dosfs/dosfs.h, libfs/src/dosfs/msdos.h,
        libfs/src/dosfs/msdos_init.c, libfs/src/imfs/imfs.h,
        libfs/src/imfs/imfs_eval.c, libfs/src/imfs/imfs_init.c,
        libfs/src/imfs/miniimfs_init.c,
        libfs/src/nfsclient/src/librtemsNfs.h,
        libfs/src/rfs/rtems-rfs-rtems.c, libfs/src/rfs/rtems-rfs.h,
        libnetworking/lib/ftpfs.c, libnetworking/rtems/ftpfs.h,
        libnetworking/rtems/tftp.h: New mount_h API.

        * libfs/src/devfs/devfs_eval.c: Local include of extern ops.
        * libfs/src/nfsclient/src/nfs.c: New mount API. Removed the mount
        me call and fixed the initialisation to happen when mounting.

        * libmisc/Makefile.am, libmisc/shell/shellconfig.h: Remove mount
        filesystem files.

        * libmisc/fsmount/fsmount.c, libmisc/fsmount/fsmount.h: Updated to
        the new mount table values.

        * libmisc/shell/main_mount_ftp.c,
        libmisc/shell/main_mount_msdos.c, libmisc/shell/main_mount_rfs.c,
        libmisc/shell/main_mount_tftp.c: Removed.

        * libmisc/shell/main_mount.c: Use the new mount API. Also access
        the file system table for the file system types.

        * libnetworking/lib/tftpDriver.c: Updated to the new mount
        API. Fixed to allow mounting from any mount point. Also can now
        have more than file system mounted.

        * sapi/include/confdefs.h: Add file system configuration support.
2010-05-31 13:56:37 +00:00
Ralf Corsepius
f22c1544c5 2010-05-22 Ralf Corsépius <ralf.corsepius@rtems.org>
* libblock/include/rtems/nvdisk.h, libblock/src/nvdisk-sram.c:
	Use pointer arithmetic instead of int32_t arithmetic for 16bit
	compatibility.
2010-05-22 16:51:05 +00:00
Ralf Corsepius
b5926be790 2010-05-22 Ralf Corsépius <ralf.corsepius@rtems.org>
* libblock/src/flashdisk.c, libblock/src/nvdisk.c:
	Cast argp to uintptr_t temporary instead of uint32_t temporary
	(Avoid incompatible pointer casts on 16bit targets).
2010-05-22 16:43:09 +00:00