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

4.104.115
Last change on this file since 2c0450cb was 1d539c0, checked in by Chris Johns <chrisj@…>, on 04/12/10 at 05:29:25

2010-04-12 Chris Johns <chrisj@…>

libfs/src/rfs/rtems-rfs-buffer-bdbuf.c,
libfs/src/rfs/rtems-rfs-buffer.c, libfs/src/rfs/rtems-rfs-data.h,
libfs/src/rfs/rtems-rfs-dir.c,
libfs/src/rfs/rtems-rfs-file-system.c,
libfs/src/rfs/rtems-rfs-format.c, libfs/src/rfs/rtems-rfs-inode.h,
libfs/src/rfs/rtems-rfs-rtems.c, libfs/src/rfs/rtems-rfs-rtems.h,
libfs/src/rfs/rtems-rfs-shell.c: Fix for PR1502. Clean up problems
on 16bit targets.

  • Property mode set to 100644
File size: 2.1 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#if HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include <errno.h>
24
25#include <rtems/rfs/rtems-rfs-buffer.h>
26#include <rtems/rfs/rtems-rfs-file-system.h>
27
28#if RTEMS_RFS_USE_LIBBLOCK
29
30/**
31 * Show errors.
32 */
33#define RTEMS_RFS_BUFFER_ERRORS 0
34
35int
36rtems_rfs_buffer_bdbuf_request (rtems_rfs_file_system*   fs,
37                                rtems_rfs_buffer_block   block,
38                                bool                     read,
39                                rtems_rfs_buffer**       buffer)
40{
41  rtems_status_code sc;
42  int               rc = 0;
43
44  if (read)
45    sc = rtems_bdbuf_read (rtems_rfs_fs_device (fs), block, buffer);
46  else
47    sc = rtems_bdbuf_get (rtems_rfs_fs_device (fs), block, buffer);
48
49  if (sc != RTEMS_SUCCESSFUL)
50  {
51#if RTEMS_RFS_BUFFER_ERRORS
52    printf ("rtems-rfs: buffer-bdbuf-request: block=%lu: bdbuf-%s: %d: %s\n",
53            block, read ? "read" : "get", sc, rtems_status_text (sc));
54#endif
55    rc = EIO;
56  }
57
58  return rc;
59}
60
61int
62rtems_rfs_buffer_bdbuf_release (rtems_rfs_buffer* buffer,
63                                bool              modified)
64{
65  rtems_status_code sc;
66  int               rc = 0;
67
68  if (rtems_rfs_trace (RTEMS_RFS_TRACE_BUFFER_RELEASE))
69    printf ("rtems-rfs: bdbuf-release: block=%lu bdbuf=%lu %s\n",
70            (rtems_rfs_buffer_block) ((intptr_t) buffer->user),
71            buffer->block, modified ? "(modified)" : "");
72
73  if (modified)
74    sc = rtems_bdbuf_release_modified (buffer);
75  else
76    sc = rtems_bdbuf_release (buffer);
77
78  if (sc != RTEMS_SUCCESSFUL)
79  {
80#if RTEMS_RFS_BUFFER_ERRORS
81    printf ("rtems-rfs: buffer-release: bdbuf-%s: %s(%d)\n",
82            modified ? "modified" : "not-modified",
83            rtems_status_text (sc), sc);
84#endif
85    rc = EIO;
86  }
87 
88  return rc;
89}
90
91#endif
Note: See TracBrowser for help on using the repository browser.