source: rtems/cpukit/libblock/src/ramdisk-register.c @ 24b94c4

5
Last change on this file since 24b94c4 was 24b94c4, checked in by Sebastian Huber <sebastian.huber@…>, on 07/30/18 at 04:39:09

ramdisk: Use rtems_blkdev_create()

Update #3358.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup rtems_ramdisk
5 *
6 * @brief RAM disk block device implementation.
7 */
8
9/*
10 * Copyright (c) 2009-2012 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Obere Lagerstr. 30
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.org/license/LICENSE.
21 */
22
23#ifdef HAVE_CONFIG_H
24  #include "config.h"
25#endif
26
27#include <rtems/ramdisk.h>
28
29rtems_status_code ramdisk_register(
30  uint32_t media_block_size,
31  rtems_blkdev_bnum media_block_count,
32  bool trace,
33  const char *disk
34)
35{
36  rtems_status_code sc = RTEMS_SUCCESSFUL;
37  ramdisk *rd = NULL;
38
39  rd = ramdisk_allocate(NULL, media_block_size, media_block_count, trace);
40  if (rd == NULL) {
41    return RTEMS_UNSATISFIED;
42  }
43
44  sc = rtems_blkdev_create(
45    disk,
46    media_block_size,
47    media_block_count,
48    ramdisk_ioctl,
49    rd
50  );
51  if (sc != RTEMS_SUCCESSFUL) {
52    ramdisk_free(rd);
53
54    return RTEMS_UNSATISFIED;
55  }
56
57  return RTEMS_SUCCESSFUL;
58}
Note: See TracBrowser for help on using the repository browser.