ramdisk

  1# This file was automatically generated by SWIG (https://www.swig.org).
  2# Version 4.2.1
  3#
  4# Do not make changes to this file unless you know what you are doing - modify
  5# the SWIG interface file instead.
  6
  7from sys import version_info as _swig_python_version_info
  8from mock_rtems import _ramdisk as _ramdisk
  9
 10try:
 11    import builtins as __builtin__
 12except ImportError:
 13    import __builtin__
 14
 15def _swig_repr(self):
 16    try:
 17        strthis = "proxy of " + self.this.__repr__()
 18    except __builtin__.Exception:
 19        strthis = ""
 20    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
 21
 22
 23def _swig_setattr_nondynamic_instance_variable(set):
 24    def set_instance_attr(self, name, value):
 25        if name == "this":
 26            set(self, name, value)
 27        elif name == "thisown":
 28            self.this.own(value)
 29        elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
 30            set(self, name, value)
 31        else:
 32            raise AttributeError("You cannot add instance attributes to %s" % self)
 33    return set_instance_attr
 34
 35
 36def _swig_setattr_nondynamic_class_variable(set):
 37    def set_class_attr(cls, name, value):
 38        if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
 39            set(cls, name, value)
 40        else:
 41            raise AttributeError("You cannot add class attributes to %s" % cls)
 42    return set_class_attr
 43
 44
 45def _swig_add_metaclass(metaclass):
 46    """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
 47    def wrapper(cls):
 48        return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
 49    return wrapper
 50
 51
 52class _SwigNonDynamicMeta(type):
 53    """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
 54    __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)
 55
 56
 57class rtems_ramdisk_config(object):
 58    r"""
 59    **
 60    RAM disk configuration table entry.
 61    """
 62
 63    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
 64    __repr__ = _swig_repr
 65    block_size = property(_ramdisk.rtems_ramdisk_config_block_size_get, _ramdisk.rtems_ramdisk_config_block_size_set, doc=r"""RAM disk block size.""")
 66    block_num = property(_ramdisk.rtems_ramdisk_config_block_num_get, _ramdisk.rtems_ramdisk_config_block_num_set, doc=r"""Number of blocks on this RAM disk.""")
 67    location = property(_ramdisk.rtems_ramdisk_config_location_get, _ramdisk.rtems_ramdisk_config_location_set, doc=r"""
 68    RAM disk location or ``NULL`` if RAM disk memory should be allocated
 69    dynamically.
 70    """)
 71
 72    def __init__(self):
 73        r"""__init__(rtems_ramdisk_config self) -> rtems_ramdisk_config"""
 74        _ramdisk.rtems_ramdisk_config_swiginit(self, _ramdisk.new_rtems_ramdisk_config())
 75    __swig_destroy__ = _ramdisk.delete_rtems_ramdisk_config
 76
 77# Register rtems_ramdisk_config in _ramdisk:
 78_ramdisk.rtems_ramdisk_config_swigregister(rtems_ramdisk_config)
 79
 80def ramdisk_initialize(major, minor, arg):
 81    r"""RAM disk driver initialization entry point."""
 82    return _ramdisk.ramdisk_initialize(major, minor, arg)
 83RAMDISK_DEVICE_BASE_NAME = _ramdisk.RAMDISK_DEVICE_BASE_NAME
 84r"""RAM disk driver table entry."""
 85class ramdisk(object):
 86    r"""
 87     *
 88    RAM disk descriptor.
 89    """
 90
 91    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
 92    __repr__ = _swig_repr
 93    block_size = property(_ramdisk.ramdisk_block_size_get, _ramdisk.ramdisk_block_size_set, doc=r"""RAM disk block size, the media size.""")
 94    block_num = property(_ramdisk.ramdisk_block_num_get, _ramdisk.ramdisk_block_num_set, doc=r"""Number of blocks on this RAM disk.""")
 95    area = property(_ramdisk.ramdisk_area_get, _ramdisk.ramdisk_area_set, doc=r"""RAM disk memory area.""")
 96    initialized = property(_ramdisk.ramdisk_initialized_get, _ramdisk.ramdisk_initialized_set, doc=r"""RAM disk is initialized.""")
 97    malloced = property(_ramdisk.ramdisk_malloced_get, _ramdisk.ramdisk_malloced_set, doc=r"""Indicates if memory is allocated by malloc() for this RAM disk.""")
 98    trace = property(_ramdisk.ramdisk_trace_get, _ramdisk.ramdisk_trace_set, doc=r"""Trace enable.""")
 99    free_at_delete_request = property(_ramdisk.ramdisk_free_at_delete_request_get, _ramdisk.ramdisk_free_at_delete_request_set, doc=r"""Free the RAM disk at the block device delete request.""")
100
101    def __init__(self):
102        r"""__init__(ramdisk self) -> ramdisk"""
103        _ramdisk.ramdisk_swiginit(self, _ramdisk.new_ramdisk())
104    __swig_destroy__ = _ramdisk.delete_ramdisk
105
106# Register ramdisk in _ramdisk:
107_ramdisk.ramdisk_swigregister(ramdisk)
108cvar = _ramdisk.cvar
109
110
111def ramdisk_ioctl(dd, req, argp):
112    r"""
113    ramdisk_ioctl(rtems_disk_device * dd, uint32_t req, void * argp) -> int
114
115    Parameters
116    ----------
117    dd: rtems_disk_device *
118    req: uint32_t
119    argp: void *
120
121    """
122    return _ramdisk.ramdisk_ioctl(dd, req, argp)
123
124def ramdisk_allocate(area_begin, media_block_size, media_block_count, trace):
125    r"""
126    Allocates and initializes a RAM disk descriptor.
127
128    The block size will be *media_block_size*.  The block count will be
129    *media_block_count*.  The disk storage area begins at *area_begin*.  If
130    *area_begin* is ``NULL``, the memory will be allocated and zeroed.  Sets the
131    trace enable to *trace*.
132
133    :rtype: :py:class:`ramdisk`
134    :return: Pointer to allocated and initialized ramdisk structure, or ``NULL``
135        if no memory is available.
136
137    Notes: 
138    Runtime configuration example:
139
140    .. code-block:: c++
141
142        #include <rtems/ramdisk.h>
143
144        rtems_status_code create_ramdisk(
145          const char *device,
146          uint32_t media_block_size,
147          rtems_blkdev_bnum media_block_count
148        )
149        {
150          rtems_status_code sc;
151          ramdisk *rd;
152
153          rd = ramdisk_allocate(NULL, media_block_size, media_block_count, false);
154          if (rd != NULL) {
155            sc = rtems_blkdev_create(
156              device,
157              media_block_size,
158              media_block_count,
159              ramdisk_ioctl,
160              rd
161            );
162          } else {
163            sc = RTEMS_UNSATISFIED;
164          }
165
166          return sc;
167        }
168    """
169    return _ramdisk.ramdisk_allocate(area_begin, media_block_size, media_block_count, trace)
170
171def ramdisk_free(rd):
172    r"""
173    ramdisk_free(ramdisk rd)
174
175    Parameters
176    ----------
177    rd: ramdisk *
178
179    """
180    return _ramdisk.ramdisk_free(rd)
181
182def ramdisk_enable_free_at_delete_request(rd):
183    r"""
184    ramdisk_enable_free_at_delete_request(ramdisk rd)
185
186    Parameters
187    ----------
188    rd: ramdisk *
189
190    """
191    return _ramdisk.ramdisk_enable_free_at_delete_request(rd)
192
193def ramdisk_register(media_block_size, media_block_count, trace, disk):
194    r"""
195    Allocates, initializes and registers a RAM disk.
196
197    The block size will be *media_block_size*.  The block count will be
198    *media_block_count*.  The disk storage will be allocated.  Sets the trace
199    enable to *trace*.  Registers a device node with disk name path *disk*.
200    The registered device number will be returned in *dev*.
201    """
202    return _ramdisk.ramdisk_register(media_block_size, media_block_count, trace, disk)
class rtems_ramdisk_config:
58class rtems_ramdisk_config(object):
59    r"""
60    **
61    RAM disk configuration table entry.
62    """
63
64    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
65    __repr__ = _swig_repr
66    block_size = property(_ramdisk.rtems_ramdisk_config_block_size_get, _ramdisk.rtems_ramdisk_config_block_size_set, doc=r"""RAM disk block size.""")
67    block_num = property(_ramdisk.rtems_ramdisk_config_block_num_get, _ramdisk.rtems_ramdisk_config_block_num_set, doc=r"""Number of blocks on this RAM disk.""")
68    location = property(_ramdisk.rtems_ramdisk_config_location_get, _ramdisk.rtems_ramdisk_config_location_set, doc=r"""
69    RAM disk location or ``NULL`` if RAM disk memory should be allocated
70    dynamically.
71    """)
72
73    def __init__(self):
74        r"""__init__(rtems_ramdisk_config self) -> rtems_ramdisk_config"""
75        _ramdisk.rtems_ramdisk_config_swiginit(self, _ramdisk.new_rtems_ramdisk_config())
76    __swig_destroy__ = _ramdisk.delete_rtems_ramdisk_config

** RAM disk configuration table entry.

rtems_ramdisk_config()
73    def __init__(self):
74        r"""__init__(rtems_ramdisk_config self) -> rtems_ramdisk_config"""
75        _ramdisk.rtems_ramdisk_config_swiginit(self, _ramdisk.new_rtems_ramdisk_config())

__init__(rtems_ramdisk_config self) -> rtems_ramdisk_config

thisown
64    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

The membership flag

block_size
block_num
location
def ramdisk_initialize(major, minor, arg):
81def ramdisk_initialize(major, minor, arg):
82    r"""RAM disk driver initialization entry point."""
83    return _ramdisk.ramdisk_initialize(major, minor, arg)

RAM disk driver initialization entry point.

RAMDISK_DEVICE_BASE_NAME = See C documentation

RAM disk driver table entry.

class ramdisk:
 86class ramdisk(object):
 87    r"""
 88     *
 89    RAM disk descriptor.
 90    """
 91
 92    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
 93    __repr__ = _swig_repr
 94    block_size = property(_ramdisk.ramdisk_block_size_get, _ramdisk.ramdisk_block_size_set, doc=r"""RAM disk block size, the media size.""")
 95    block_num = property(_ramdisk.ramdisk_block_num_get, _ramdisk.ramdisk_block_num_set, doc=r"""Number of blocks on this RAM disk.""")
 96    area = property(_ramdisk.ramdisk_area_get, _ramdisk.ramdisk_area_set, doc=r"""RAM disk memory area.""")
 97    initialized = property(_ramdisk.ramdisk_initialized_get, _ramdisk.ramdisk_initialized_set, doc=r"""RAM disk is initialized.""")
 98    malloced = property(_ramdisk.ramdisk_malloced_get, _ramdisk.ramdisk_malloced_set, doc=r"""Indicates if memory is allocated by malloc() for this RAM disk.""")
 99    trace = property(_ramdisk.ramdisk_trace_get, _ramdisk.ramdisk_trace_set, doc=r"""Trace enable.""")
100    free_at_delete_request = property(_ramdisk.ramdisk_free_at_delete_request_get, _ramdisk.ramdisk_free_at_delete_request_set, doc=r"""Free the RAM disk at the block device delete request.""")
101
102    def __init__(self):
103        r"""__init__(ramdisk self) -> ramdisk"""
104        _ramdisk.ramdisk_swiginit(self, _ramdisk.new_ramdisk())
105    __swig_destroy__ = _ramdisk.delete_ramdisk

* RAM disk descriptor.

ramdisk()
102    def __init__(self):
103        r"""__init__(ramdisk self) -> ramdisk"""
104        _ramdisk.ramdisk_swiginit(self, _ramdisk.new_ramdisk())

__init__(ramdisk self) -> ramdisk

thisown
92    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

The membership flag

block_size
block_num
area
initialized
malloced
trace
free_at_delete_request
cvar = See C documentation
def ramdisk_ioctl(dd, req, argp):
112def ramdisk_ioctl(dd, req, argp):
113    r"""
114    ramdisk_ioctl(rtems_disk_device * dd, uint32_t req, void * argp) -> int
115
116    Parameters
117    ----------
118    dd: rtems_disk_device *
119    req: uint32_t
120    argp: void *
121
122    """
123    return _ramdisk.ramdisk_ioctl(dd, req, argp)

ramdisk_ioctl(rtems_disk_device * dd, uint32_t req, void * argp) -> int

Parameters

dd: rtems_disk_device * req: uint32_t argp: void *

def ramdisk_allocate(area_begin, media_block_size, media_block_count, trace):
125def ramdisk_allocate(area_begin, media_block_size, media_block_count, trace):
126    r"""
127    Allocates and initializes a RAM disk descriptor.
128
129    The block size will be *media_block_size*.  The block count will be
130    *media_block_count*.  The disk storage area begins at *area_begin*.  If
131    *area_begin* is ``NULL``, the memory will be allocated and zeroed.  Sets the
132    trace enable to *trace*.
133
134    :rtype: :py:class:`ramdisk`
135    :return: Pointer to allocated and initialized ramdisk structure, or ``NULL``
136        if no memory is available.
137
138    Notes: 
139    Runtime configuration example:
140
141    .. code-block:: c++
142
143        #include <rtems/ramdisk.h>
144
145        rtems_status_code create_ramdisk(
146          const char *device,
147          uint32_t media_block_size,
148          rtems_blkdev_bnum media_block_count
149        )
150        {
151          rtems_status_code sc;
152          ramdisk *rd;
153
154          rd = ramdisk_allocate(NULL, media_block_size, media_block_count, false);
155          if (rd != NULL) {
156            sc = rtems_blkdev_create(
157              device,
158              media_block_size,
159              media_block_count,
160              ramdisk_ioctl,
161              rd
162            );
163          } else {
164            sc = RTEMS_UNSATISFIED;
165          }
166
167          return sc;
168        }
169    """
170    return _ramdisk.ramdisk_allocate(area_begin, media_block_size, media_block_count, trace)

Allocates and initializes a RAM disk descriptor.

The block size will be media_block_size. The block count will be media_block_count. The disk storage area begins at area_begin. If area_begin is NULL, the memory will be allocated and zeroed. Sets the trace enable to trace.

Returns

Pointer to allocated and initialized ramdisk structure, or NULL if no memory is available.

Notes: Runtime configuration example:

#include <rtems/ramdisk.h>

rtems_status_code create_ramdisk(
  const char *device,
  uint32_t media_block_size,
  rtems_blkdev_bnum media_block_count
)
{
  rtems_status_code sc;
  ramdisk *rd;

  rd = ramdisk_allocate(NULL, media_block_size, media_block_count, false);
  if (rd != NULL) {
    sc = rtems_blkdev_create(
      device,
      media_block_size,
      media_block_count,
      ramdisk_ioctl,
      rd
    );
  } else {
    sc = RTEMS_UNSATISFIED;
  }

  return sc;
}
def ramdisk_free(rd):
172def ramdisk_free(rd):
173    r"""
174    ramdisk_free(ramdisk rd)
175
176    Parameters
177    ----------
178    rd: ramdisk *
179
180    """
181    return _ramdisk.ramdisk_free(rd)

ramdisk_free(ramdisk rd)

Parameters

rd: ramdisk *

def ramdisk_enable_free_at_delete_request(rd):
183def ramdisk_enable_free_at_delete_request(rd):
184    r"""
185    ramdisk_enable_free_at_delete_request(ramdisk rd)
186
187    Parameters
188    ----------
189    rd: ramdisk *
190
191    """
192    return _ramdisk.ramdisk_enable_free_at_delete_request(rd)

ramdisk_enable_free_at_delete_request(ramdisk rd)

Parameters

rd: ramdisk *

def ramdisk_register(media_block_size, media_block_count, trace, disk):
194def ramdisk_register(media_block_size, media_block_count, trace, disk):
195    r"""
196    Allocates, initializes and registers a RAM disk.
197
198    The block size will be *media_block_size*.  The block count will be
199    *media_block_count*.  The disk storage will be allocated.  Sets the trace
200    enable to *trace*.  Registers a device node with disk name path *disk*.
201    The registered device number will be returned in *dev*.
202    """
203    return _ramdisk.ramdisk_register(media_block_size, media_block_count, trace, disk)

Allocates, initializes and registers a RAM disk.

The block size will be media_block_size. The block count will be media_block_count. The disk storage will be allocated. Sets the trace enable to trace. Registers a device node with disk name path disk. The registered device number will be returned in dev.