mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-03 12:44:33 +02:00
Merge branch 'bugfix/spiffs_partition_label_usage' into 'master'
spiffs: clarify the usage of partition_label, fix the example Closes IDFGH-2313 See merge request espressif/esp-idf!7092
This commit is contained in:
@@ -49,8 +49,7 @@ esp_err_t esp_vfs_spiffs_register(const esp_vfs_spiffs_conf_t * conf);
|
|||||||
/**
|
/**
|
||||||
* Unregister and unmount SPIFFS from VFS
|
* Unregister and unmount SPIFFS from VFS
|
||||||
*
|
*
|
||||||
* @param partition_label Optional, label of the partition to unregister.
|
* @param partition_label Same label as passed to esp_vfs_spiffs_register.
|
||||||
* If not specified, first partition with subtype=spiffs is used.
|
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK if successful
|
* - ESP_OK if successful
|
||||||
@@ -73,8 +72,7 @@ bool esp_spiffs_mounted(const char* partition_label);
|
|||||||
/**
|
/**
|
||||||
* Format the SPIFFS partition
|
* Format the SPIFFS partition
|
||||||
*
|
*
|
||||||
* @param partition_label Optional, label of the partition to format.
|
* @param partition_label Same label as passed to esp_vfs_spiffs_register.
|
||||||
* If not specified, first partition with subtype=spiffs is used.
|
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK if successful
|
* - ESP_OK if successful
|
||||||
* - ESP_FAIL on error
|
* - ESP_FAIL on error
|
||||||
@@ -84,8 +82,7 @@ esp_err_t esp_spiffs_format(const char* partition_label);
|
|||||||
/**
|
/**
|
||||||
* Get information for SPIFFS
|
* Get information for SPIFFS
|
||||||
*
|
*
|
||||||
* @param partition_label Optional, label of the partition to get info for.
|
* @param partition_label Same label as passed to esp_vfs_spiffs_register
|
||||||
* If not specified, first partition with subtype=spiffs is used.
|
|
||||||
* @param[out] total_bytes Size of the file system
|
* @param[out] total_bytes Size of the file system
|
||||||
* @param[out] used_bytes Current used bytes in the file system
|
* @param[out] used_bytes Current used bytes in the file system
|
||||||
*
|
*
|
||||||
|
@@ -43,7 +43,7 @@ void app_main(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t total = 0, used = 0;
|
size_t total = 0, used = 0;
|
||||||
ret = esp_spiffs_info(NULL, &total, &used);
|
ret = esp_spiffs_info(conf.partition_label, &total, &used);
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to get SPIFFS partition information (%s)", esp_err_to_name(ret));
|
ESP_LOGE(TAG, "Failed to get SPIFFS partition information (%s)", esp_err_to_name(ret));
|
||||||
} else {
|
} else {
|
||||||
@@ -94,6 +94,6 @@ void app_main(void)
|
|||||||
ESP_LOGI(TAG, "Read from file: '%s'", line);
|
ESP_LOGI(TAG, "Read from file: '%s'", line);
|
||||||
|
|
||||||
// All done, unmount partition and disable SPIFFS
|
// All done, unmount partition and disable SPIFFS
|
||||||
esp_vfs_spiffs_unregister(NULL);
|
esp_vfs_spiffs_unregister(conf.partition_label);
|
||||||
ESP_LOGI(TAG, "SPIFFS unmounted");
|
ESP_LOGI(TAG, "SPIFFS unmounted");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user