fsmount

  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 _fsmount as _fsmount
  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
 57RTEMS_FSTAB_NONE = _fsmount.RTEMS_FSTAB_NONE
 58r"""No conditions."""
 59RTEMS_FSTAB_OK = _fsmount.RTEMS_FSTAB_OK
 60r"""Complete mount process was successful."""
 61RTEMS_FSTAB_ERROR_MOUNT_POINT = _fsmount.RTEMS_FSTAB_ERROR_MOUNT_POINT
 62r"""Mount point creation failed."""
 63RTEMS_FSTAB_ERROR_MOUNT = _fsmount.RTEMS_FSTAB_ERROR_MOUNT
 64r"""File system mount failed."""
 65RTEMS_FSTAB_ERROR = _fsmount.RTEMS_FSTAB_ERROR
 66r"""Something failed."""
 67RTEMS_FSTAB_ANY = _fsmount.RTEMS_FSTAB_ANY
 68r"""Any condition."""
 69class rtems_fstab_entry(object):
 70    r"""File system table entry."""
 71
 72    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
 73    __repr__ = _swig_repr
 74    source = property(_fsmount.rtems_fstab_entry_source_get, _fsmount.rtems_fstab_entry_source_set, doc=r"""Source for the mount.""")
 75    target = property(_fsmount.rtems_fstab_entry_target_get, _fsmount.rtems_fstab_entry_target_set, doc=r"""Target for the mount.""")
 76    type = property(_fsmount.rtems_fstab_entry_type_get, _fsmount.rtems_fstab_entry_type_set, doc=r"""File system operations.""")
 77    options = property(_fsmount.rtems_fstab_entry_options_get, _fsmount.rtems_fstab_entry_options_set, doc=r"""File system mount options.""")
 78    report_reasons = property(_fsmount.rtems_fstab_entry_report_reasons_get, _fsmount.rtems_fstab_entry_report_reasons_set, doc=r"""Report 'condition flags'.""")
 79    abort_reasons = property(_fsmount.rtems_fstab_entry_abort_reasons_get, _fsmount.rtems_fstab_entry_abort_reasons_set, doc=r"""Abort 'condition flags'.""")
 80
 81    def __init__(self):
 82        r"""__init__(rtems_fstab_entry self) -> rtems_fstab_entry"""
 83        _fsmount.rtems_fstab_entry_swiginit(self, _fsmount.new_rtems_fstab_entry())
 84    __swig_destroy__ = _fsmount.delete_rtems_fstab_entry
 85
 86# Register rtems_fstab_entry in _fsmount:
 87_fsmount.rtems_fstab_entry_swigregister(rtems_fstab_entry)
 88
 89def rtems_fsmount(fstab, size, abort_index):
 90    r"""
 91    Mounts the file systems listed in the file system mount table.
 92
 93    Mounts the file systems listed in the file system mount table *fstab* of
 94    size *size*.
 95
 96    Each file system will be mounted according to its table entry parameters.
 97    In case of an abort condition the corresponding table index will be reported
 98    in *abort_index*.  The pointer *abort_index* may be ``NULL``.  The mount
 99    point paths will be created with rtems_mkdir() and need not exist
100    beforehand.
101
102    On success, zero is returned.  On error, -1 is returned, and ``errno`` is set
103    appropriately.
104
105    See also: rtems_bdpart_register_from_disk().
106
107    The following example code tries to mount a FAT file system within a SD
108    Card.  Some cards do not have a partition table so at first it tries to find
109    a file system inside the hole disk.  If this is successful the mount process
110    will be aborted because the 'RTEMS_FSTAB_OK' condition is true.  If this
111    did not work it tries to mount the file system inside the first partition.
112    If this fails the mount process will not be aborted (this is already the
113    last entry), but the last error status will be returned.
114
115    .. code-block:: c++
116
117        #include <stdio.h>
118        #include <string.h>
119        #include <errno.h>
120
121        #include <rtems.h>
122        #include <rtems/bdpart.h>
123        #include <rtems/error.h>
124        #include <rtems/fsmount.h>
125
126        static const rtems_fstab_entry fstab [] = {
127          {
128            .source = "/dev/sd-card-a",
129            .target = "/mnt",
130            .type = "dosfs",
131            .options = RTEMS_FILESYSTEM_READ_WRITE,
132            .report_reasons = RTEMS_FSTAB_ANY,
133            .abort_reasons = RTEMS_FSTAB_OK
134          }, {
135            .source = "/dev/sd-card-a1",
136            .target = "/mnt",
137            .type = "dosfs",
138            .options = RTEMS_FILESYSTEM_READ_WRITE,
139            .report_reasons = RTEMS_FSTAB_ANY,
140            .abort_reasons = RTEMS_FSTAB_NONE
141          }
142        };
143
144        static void my_mount(void)
145        {
146          rtems_status_code sc = RTEMS_SUCCESSFUL;
147          int rv = 0;
148          size_t abort_index = 0;
149
150          sc = rtems_bdpart_register_from_disk("/dev/sd-card-a");
151          if (sc != RTEMS_SUCCESSFUL) {
152            printf("read partition table failed: %s\n", rtems_status_text(sc));
153          }
154
155          rv = rtems_fsmount(fstab, sizeof(fstab) / sizeof(fstab [0]), &abort_index);
156          if (rv != 0) {
157            printf("mount failed: %s\n", strerror(errno));
158          }
159          printf("mount aborted at %zu\n", abort_index);
160        }
161    """
162    return _fsmount.rtems_fsmount(fstab, size, abort_index)
RTEMS_FSTAB_NONE = See C documentation

No conditions.

RTEMS_FSTAB_OK = See C documentation

Complete mount process was successful.

RTEMS_FSTAB_ERROR_MOUNT_POINT = See C documentation

Mount point creation failed.

RTEMS_FSTAB_ERROR_MOUNT = See C documentation

File system mount failed.

RTEMS_FSTAB_ERROR = See C documentation

Something failed.

RTEMS_FSTAB_ANY = See C documentation

Any condition.

class rtems_fstab_entry:
70class rtems_fstab_entry(object):
71    r"""File system table entry."""
72
73    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
74    __repr__ = _swig_repr
75    source = property(_fsmount.rtems_fstab_entry_source_get, _fsmount.rtems_fstab_entry_source_set, doc=r"""Source for the mount.""")
76    target = property(_fsmount.rtems_fstab_entry_target_get, _fsmount.rtems_fstab_entry_target_set, doc=r"""Target for the mount.""")
77    type = property(_fsmount.rtems_fstab_entry_type_get, _fsmount.rtems_fstab_entry_type_set, doc=r"""File system operations.""")
78    options = property(_fsmount.rtems_fstab_entry_options_get, _fsmount.rtems_fstab_entry_options_set, doc=r"""File system mount options.""")
79    report_reasons = property(_fsmount.rtems_fstab_entry_report_reasons_get, _fsmount.rtems_fstab_entry_report_reasons_set, doc=r"""Report 'condition flags'.""")
80    abort_reasons = property(_fsmount.rtems_fstab_entry_abort_reasons_get, _fsmount.rtems_fstab_entry_abort_reasons_set, doc=r"""Abort 'condition flags'.""")
81
82    def __init__(self):
83        r"""__init__(rtems_fstab_entry self) -> rtems_fstab_entry"""
84        _fsmount.rtems_fstab_entry_swiginit(self, _fsmount.new_rtems_fstab_entry())
85    __swig_destroy__ = _fsmount.delete_rtems_fstab_entry

File system table entry.

rtems_fstab_entry()
82    def __init__(self):
83        r"""__init__(rtems_fstab_entry self) -> rtems_fstab_entry"""
84        _fsmount.rtems_fstab_entry_swiginit(self, _fsmount.new_rtems_fstab_entry())

__init__(rtems_fstab_entry self) -> rtems_fstab_entry

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

The membership flag

source
target
type
options
report_reasons
abort_reasons
def rtems_fsmount(fstab, size, abort_index):
 90def rtems_fsmount(fstab, size, abort_index):
 91    r"""
 92    Mounts the file systems listed in the file system mount table.
 93
 94    Mounts the file systems listed in the file system mount table *fstab* of
 95    size *size*.
 96
 97    Each file system will be mounted according to its table entry parameters.
 98    In case of an abort condition the corresponding table index will be reported
 99    in *abort_index*.  The pointer *abort_index* may be ``NULL``.  The mount
100    point paths will be created with rtems_mkdir() and need not exist
101    beforehand.
102
103    On success, zero is returned.  On error, -1 is returned, and ``errno`` is set
104    appropriately.
105
106    See also: rtems_bdpart_register_from_disk().
107
108    The following example code tries to mount a FAT file system within a SD
109    Card.  Some cards do not have a partition table so at first it tries to find
110    a file system inside the hole disk.  If this is successful the mount process
111    will be aborted because the 'RTEMS_FSTAB_OK' condition is true.  If this
112    did not work it tries to mount the file system inside the first partition.
113    If this fails the mount process will not be aborted (this is already the
114    last entry), but the last error status will be returned.
115
116    .. code-block:: c++
117
118        #include <stdio.h>
119        #include <string.h>
120        #include <errno.h>
121
122        #include <rtems.h>
123        #include <rtems/bdpart.h>
124        #include <rtems/error.h>
125        #include <rtems/fsmount.h>
126
127        static const rtems_fstab_entry fstab [] = {
128          {
129            .source = "/dev/sd-card-a",
130            .target = "/mnt",
131            .type = "dosfs",
132            .options = RTEMS_FILESYSTEM_READ_WRITE,
133            .report_reasons = RTEMS_FSTAB_ANY,
134            .abort_reasons = RTEMS_FSTAB_OK
135          }, {
136            .source = "/dev/sd-card-a1",
137            .target = "/mnt",
138            .type = "dosfs",
139            .options = RTEMS_FILESYSTEM_READ_WRITE,
140            .report_reasons = RTEMS_FSTAB_ANY,
141            .abort_reasons = RTEMS_FSTAB_NONE
142          }
143        };
144
145        static void my_mount(void)
146        {
147          rtems_status_code sc = RTEMS_SUCCESSFUL;
148          int rv = 0;
149          size_t abort_index = 0;
150
151          sc = rtems_bdpart_register_from_disk("/dev/sd-card-a");
152          if (sc != RTEMS_SUCCESSFUL) {
153            printf("read partition table failed: %s\n", rtems_status_text(sc));
154          }
155
156          rv = rtems_fsmount(fstab, sizeof(fstab) / sizeof(fstab [0]), &abort_index);
157          if (rv != 0) {
158            printf("mount failed: %s\n", strerror(errno));
159          }
160          printf("mount aborted at %zu\n", abort_index);
161        }
162    """
163    return _fsmount.rtems_fsmount(fstab, size, abort_index)

Mounts the file systems listed in the file system mount table.

Mounts the file systems listed in the file system mount table fstab of size size.

Each file system will be mounted according to its table entry parameters. In case of an abort condition the corresponding table index will be reported in abort_index. The pointer abort_index may be NULL. The mount point paths will be created with rtems_mkdir() and need not exist beforehand.

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

See also: rtems_bdpart_register_from_disk().

The following example code tries to mount a FAT file system within a SD Card. Some cards do not have a partition table so at first it tries to find a file system inside the hole disk. If this is successful the mount process will be aborted because the 'RTEMS_FSTAB_OK' condition is true. If this did not work it tries to mount the file system inside the first partition. If this fails the mount process will not be aborted (this is already the last entry), but the last error status will be returned.

#include <stdio.h>
#include <string.h>
#include <errno.h>

#include <rtems.h>
#include <rtems/bdpart.h>
#include <rtems/error.h>
#include <rtems/fsmount.h>

static const rtems_fstab_entry fstab [] = {
  {
    .source = "/dev/sd-card-a",
    .target = "/mnt",
    .type = "dosfs",
    .options = RTEMS_FILESYSTEM_READ_WRITE,
    .report_reasons = RTEMS_FSTAB_ANY,
    .abort_reasons = RTEMS_FSTAB_OK
  }, {
    .source = "/dev/sd-card-a1",
    .target = "/mnt",
    .type = "dosfs",
    .options = RTEMS_FILESYSTEM_READ_WRITE,
    .report_reasons = RTEMS_FSTAB_ANY,
    .abort_reasons = RTEMS_FSTAB_NONE
  }
};

static void my_mount(void)
{
  rtems_status_code sc = RTEMS_SUCCESSFUL;
  int rv = 0;
  size_t abort_index = 0;

  sc = rtems_bdpart_register_from_disk("/dev/sd-card-a");
  if (sc != RTEMS_SUCCESSFUL) {
    printf("read partition table failed: %s\n", rtems_status_text(sc));
  }

  rv = rtems_fsmount(fstab, sizeof(fstab) / sizeof(fstab [0]), &abort_index);
  if (rv != 0) {
    printf("mount failed: %s\n", strerror(errno));
  }
  printf("mount aborted at %zu\n", abort_index);
}