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

4.104.11
Last change on this file since a290e72a was 355b0544, checked in by Chris Johns <chrisj@…>, on Mar 27, 2010 at 4:04:40 AM

2010-03-27 Chris Johns <chrisj@…>

libfs/src/nfsclient/src/cexphelp.c,
libfs/src/nfsclient/src/dirutils.c,
libfs/src/nfsclient/src/nfs.modini.c,
libfs/src/nfsclient/src/nfsTest.c,
libfs/src/nfsclient/src/rpcio.c,
libfs/src/nfsclient/src/rpcio.modini.c,
libfs/src/nfsclient/src/sock_mbuf.c,
libfs/src/nfsclient/src/xdr_mbuf.c,
libfs/src/rfs/rtems-rfs-bitmaps-ut.c,
libfs/src/rfs/rtems-rfs-bitmaps.c,
libfs/src/rfs/rtems-rfs-block.c,
libfs/src/rfs/rtems-rfs-buffer-bdbuf.c,
libfs/src/rfs/rtems-rfs-buffer-devio.c,
libfs/src/rfs/rtems-rfs-buffer.c,
libfs/src/rfs/rtems-rfs-dir-hash.c, libfs/src/rfs/rtems-rfs-dir.c,
libfs/src/rfs/rtems-rfs-file-system.c,
libfs/src/rfs/rtems-rfs-file.c, libfs/src/rfs/rtems-rfs-format.c,
libfs/src/rfs/rtems-rfs-group.c, libfs/src/rfs/rtems-rfs-inode.c,
libfs/src/rfs/rtems-rfs-link.c, libfs/src/rfs/rtems-rfs-mutex.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-utils.c,
libfs/src/rfs/rtems-rfs-rtems.c, libfs/src/rfs/rtems-rfs-shell.c,
libfs/src/rfs/rtems-rfs-trace.c: Add HAVE_CONFIG_H support to let
files receive configure defines.

  • 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) 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.