source: rtems/cpukit/libfs/src/rfs/rtems-rfs-buffer-bdbuf.c @ a9fa9b7

4.104.115
Last change on this file since a9fa9b7 was a9fa9b7, checked in by Chris Johns <chrisj@…>, on 02/18/10 at 00:24:25

2010-02-18 Chris Johns <chrisj@…>

  • libfs/src/rfs/rtems-rfs-bitmaps.c, libfs/src/rfs/rtems-rfs-bitmaps.h, libfs/src/rfs/rtems-rfs-bitmaps-ut.c, libfs/src/rfs/rtems-rfs-block.c, libfs/src/rfs/rtems-rfs-block.h, libfs/src/rfs/rtems-rfs-block-pos.h, libfs/src/rfs/rtems-rfs-buffer-bdbuf.c, libfs/src/rfs/rtems-rfs-buffer.c, libfs/src/rfs/rtems-rfs-buffer-devio.c, libfs/src/rfs/rtems-rfs-buffer.h, libfs/src/rfs/rtems-rfs-data.h, libfs/src/rfs/rtems-rfs-dir.c, libfs/src/rfs/rtems-rfs-dir.h, libfs/src/rfs/rtems-rfs-dir-hash.c, libfs/src/rfs/rtems-rfs-dir-hash.h, libfs/src/rfs/rtems-rfs-file.c, libfs/src/rfs/rtems-rfs-file.h, libfs/src/rfs/rtems-rfs-file-system.c, libfs/src/rfs/rtems-rfs-file-system-fwd.h, libfs/src/rfs/rtems-rfs-file-system.h, libfs/src/rfs/rtems-rfs-format.c, libfs/src/rfs/rtems-rfs-format.h, libfs/src/rfs/rtems-rfs-group.c, libfs/src/rfs/rtems-rfs-group.h, libfs/src/rfs/rtems-rfs.h, libfs/src/rfs/rtems-rfs-inode.c, libfs/src/rfs/rtems-rfs-inode.h, libfs/src/rfs/rtems-rfs-link.c, libfs/src/rfs/rtems-rfs-link.h, libfs/src/rfs/rtems-rfs-mutex.c, libfs/src/rfs/rtems-rfs-mutex.h, libfs/src/rfs/rtems-rfs-rtems.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, libfs/src/rfs/rtems-rfs-rtems.h, libfs/src/rfs/rtems-rfs-rtems-utils.c, libfs/src/rfs/rtems-rfs-shell.c, libfs/src/rfs/rtems-rfs-shell.h, libfs/src/rfs/rtems-rfs-trace.c, libfs/src/rfs/rtems-rfs-trace.h: New.
  • Makefile.am, preinstall.am, libfs/Makefile.am, wrapup/Makefile.am: Updated with the RFS support.
  • libfs/README: Updated after 10 years.
  • libblock/src/flashdisk.c, libblock/src/nvdisk.c, libblock/src/ramdisk-driver.c: Updated to the new error reporting in libblock.
  • libmisc/shell/main_ls.c, libmisc/shell/print-ls.c: Fix printing the size in long mode.
  • libnetworking/nfs/bootp_subr.c, libnetworking/rtems/rtems_bootp.c, libnetworking/rtems/rtems_bsdnet_internal.h: Return the BOOTP/DHCP to the forever behaviour of 4.9 with the ability to call BOOTP and control the process if required.
  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*
2 *  COPYRIGHT (c) 2010 Chris Johns <chrisj@rtems.org>
3 *
4 *  The license and distribution terms for this file may be
5 *  found in the file LICENSE in this distribution or at
6 *  http://www.rtems.com/license/LICENSE.
7 *
8 *  $Id$
9 */
10/**
11 * @file
12 *
13 * @ingroup rtems-rfs
14 *
15 * RTEMS File Systems Buffer Routines for the RTEMS libblock BD buffer cache.
16 *
17 */
18
19#include <errno.h>
20
21#include <rtems/rfs/rtems-rfs-buffer.h>
22#include <rtems/rfs/rtems-rfs-file-system.h>
23
24#if RTEMS_RFS_USE_LIBBLOCK
25
26/**
27 * Show errors.
28 */
29#define RTEMS_RFS_BUFFER_ERRORS 0
30
31int
32rtems_rfs_buffer_bdbuf_request (rtems_rfs_file_system*   fs,
33                                rtems_rfs_buffer_block   block,
34                                bool                     read,
35                                rtems_rfs_buffer**       buffer)
36{
37  rtems_status_code sc;
38  int               rc = 0;
39
40  if (read)
41    sc = rtems_bdbuf_read (rtems_rfs_fs_device (fs), block, buffer);
42  else
43    sc = rtems_bdbuf_get (rtems_rfs_fs_device (fs), block, buffer);
44
45  if (sc != RTEMS_SUCCESSFUL)
46  {
47#if RTEMS_RFS_BUFFER_ERRORS
48    printf ("rtems-rfs: buffer-bdbuf-request: block=%lu: bdbuf-%s: %d: %s\n",
49            block, read ? "read" : "get", sc, rtems_status_text (sc));
50#endif
51    rc = EIO;
52  }
53
54  return rc;
55}
56
57int
58rtems_rfs_buffer_bdbuf_release (rtems_rfs_buffer* buffer,
59                                bool              modified)
60{
61  rtems_status_code sc;
62  int               rc = 0;
63
64  if (rtems_rfs_trace (RTEMS_RFS_TRACE_BUFFER_RELEASE))
65    printf ("rtems-rfs: bdbuf-release: block=%lu bdbuf=%lu %s\n",
66            (rtems_rfs_buffer_block) buffer->user,
67            buffer->block, modified ? "(modified)" : "");
68
69  if (modified)
70    sc = rtems_bdbuf_release_modified (buffer);
71  else
72    sc = rtems_bdbuf_release (buffer);
73
74  if (sc != RTEMS_SUCCESSFUL)
75  {
76#if RTEMS_RFS_BUFFER_ERRORS
77    printf ("rtems-rfs: buffer-release: bdbuf-%s: %s(%d)\n",
78            modified ? "modified" : "not-modified",
79            rtems_status_text (sc), sc);
80#endif
81    rc = EIO;
82  }
83 
84  return rc;
85}
86
87#endif
Note: See TracBrowser for help on using the repository browser.