From 37dbce301e05dd872a5598fb4723d3b02293d38b Mon Sep 17 00:00:00 2001 From: Shang Zhou Date: Sat, 7 Oct 2023 10:37:35 +0800 Subject: [PATCH] docs: Provide CN translation for partition-tables.rst --- docs/en/api-guides/partition-tables.rst | 8 ++++---- docs/zh_CN/api-guides/partition-tables.rst | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/docs/en/api-guides/partition-tables.rst b/docs/en/api-guides/partition-tables.rst index ea77d5183f..d096aa9eac 100644 --- a/docs/en/api-guides/partition-tables.rst +++ b/docs/en/api-guides/partition-tables.rst @@ -166,19 +166,19 @@ If you want the partitions in the partition table to work relative to any placem Flags ~~~~~ -Two flags are currently supported, ``encrypted`` and ``readonly``: - +Two flags are currently supported, ``encrypted`` and ``readonly``: + - If ``encrypted`` flag is set, the partition will be encrypted if :doc:`/security/flash-encryption` is enabled. .. note:: ``app`` type partitions will always be encrypted, regardless of whether this flag is set or not. - - If ``readonly`` flag is set, the partition will be read-only. This flag is only supported for ``data`` type partitions except ``ota``` and ``coredump``` subtypes. This flag can help to protect against the accidental writes to partition that contains critical device specific configuration data, e.g., factory data partition. + - If ``readonly`` flag is set, the partition will be read-only. This flag is only supported for ``data`` type partitions except ``ota``` and ``coredump``` subtypes. This flag can help to protect against accidental writes to a partition that contains critical device-specific configuration data, e.g., factory data partition. .. note:: - Using C file I/O API to open a file (``fopen```) in any write mode (``w``, ``w+``, ``a``, ``a+``, ``r+``) will fail and return ``NULL``. Using ``open`` with any other flag than ``O_RDONLY`` will fail and return ``-1`` while ``errno`` global variable will be set to ``EACCES``. This is also true for any other POSIX syscall function performing write or erase operations. Opening a handle in read-write mode for NVS on a read-only partition will fail and return :c:macro:`ESP_ERR_NOT_ALLOWED` error code. Using a lower level API like ``esp_partition``, ``spi_flash``, ``wear_levelling``, etc. to write to a read-only partition will result in :c:macro:`ESP_ERR_NOT_ALLOWED` error code. + Using C file I/O API to open a file (``fopen```) in any write mode (``w``, ``w+``, ``a``, ``a+``, ``r+``) will fail and return ``NULL``. Using ``open`` with any other flag than ``O_RDONLY`` will fail and return ``-1`` while ``errno`` global variable will be set to ``EROFS``. This is also true for any other POSIX syscall function performing write or erase operations. Opening a handle in read-write mode for NVS on a read-only partition will fail and return :c:macro:`ESP_ERR_NOT_ALLOWED` error code. Using a lower level API like ``esp_partition``, ``spi_flash``, etc. to write to a read-only partition will result in :c:macro:`ESP_ERR_NOT_ALLOWED` error code. You can specify multiple flags by separating them with a colon. For example, ``encrypted:readonly``. diff --git a/docs/zh_CN/api-guides/partition-tables.rst b/docs/zh_CN/api-guides/partition-tables.rst index d3bda0a0ac..a62915c6f6 100644 --- a/docs/zh_CN/api-guides/partition-tables.rst +++ b/docs/zh_CN/api-guides/partition-tables.rst @@ -166,11 +166,21 @@ app 分区的大小和偏移地址可以采用十进制数、以 0x 为前缀的 Flags 字段 ~~~~~~~~~~ -当前仅支持 ``encrypted`` 标记。如果 Flags 字段设置为 ``encrypted``,且已启用 :doc:`/security/flash-encryption` 功能,则该分区将会被加密。 +目前支持 ``encrypted`` 和 ``readonly`` 标记: -.. note:: + - 如果 Flags 字段设置为 ``encrypted``,且已启用 :doc:`/security/flash-encryption` 功能,则该分区将会被加密。 - ``app`` 分区始终会被加密,不管 Flags 字段是否设置。 + .. note:: + + 无论是否设置 Flags 字段,``app`` 分区都将保持加密。 + + - 如果 Flags 字段设置为 ``readonly``,则该分区为只读分区。``readonly`` 标记仅支持除 ``ota`` 和 ``coredump`` 子类型外的 ``data`` 分区。使用该标记,防止意外写入如出厂数据分区等包含关键设备特定配置数据的分区。 + + .. note:: + + 在任何写入模式下 (``w``、``w+``、``a``、``a+``、``r+``),尝试通过 C 文件 I/O API 打开文件 (``fopen```) 的操作都将失败并返回 ``NULL``。除 ``O_RDONLY`` 外,``open`` 与任何标志一同使用都将失败并返回 ``-1``,全局变量 ``errno`` 也将设置为 ``EROFS``。上述情况同样适用于通过其他 POSIX 系统调用函数执行写入或擦除的操作。在只读分区上,以读写模式打开 NVS 的句柄将失败并返回 :c:macro:`ESP_ERR_NOT_ALLOWED` 错误代码,使用 ``esp_partition`` 或 ``spi_flash`` 等较低级别的 API 进行写入操作也将返回 :c:macro:`ESP_ERR_NOT_ALLOWED` 错误代码。 + +可以使用冒号连接不同的标记,来同时指定多个标记,如 ``encrypted:readonly``。 生成二进制分区表 ----------------