Lines Matching refs:rc
72 int rc, ret; in littlefs_increase_infile_value() local
75 rc = fs_open(&file, fname, FS_O_CREATE | FS_O_RDWR); in littlefs_increase_infile_value()
76 if (rc < 0) { in littlefs_increase_infile_value()
77 LOG_ERR("FAIL: open %s: %d", fname, rc); in littlefs_increase_infile_value()
78 return rc; in littlefs_increase_infile_value()
81 rc = fs_read(&file, &boot_count, sizeof(boot_count)); in littlefs_increase_infile_value()
82 if (rc < 0) { in littlefs_increase_infile_value()
83 LOG_ERR("FAIL: read %s: [rd:%d]", fname, rc); in littlefs_increase_infile_value()
86 LOG_PRINTK("%s read count:%u (bytes: %d)\n", fname, boot_count, rc); in littlefs_increase_infile_value()
88 rc = fs_seek(&file, 0, FS_SEEK_SET); in littlefs_increase_infile_value()
89 if (rc < 0) { in littlefs_increase_infile_value()
90 LOG_ERR("FAIL: seek %s: %d", fname, rc); in littlefs_increase_infile_value()
95 rc = fs_write(&file, &boot_count, sizeof(boot_count)); in littlefs_increase_infile_value()
96 if (rc < 0) { in littlefs_increase_infile_value()
97 LOG_ERR("FAIL: write %s: %d", fname, rc); in littlefs_increase_infile_value()
102 boot_count, rc); in littlefs_increase_infile_value()
111 return (rc < 0 ? rc : 0); in littlefs_increase_infile_value()
175 int rc, ret; in littlefs_binary_file_adj() local
184 rc = fs_open(&file, fname, FS_O_CREATE | FS_O_RDWR); in littlefs_binary_file_adj()
185 if (rc < 0) { in littlefs_binary_file_adj()
186 LOG_ERR("FAIL: open %s: %d", fname, rc); in littlefs_binary_file_adj()
187 return rc; in littlefs_binary_file_adj()
190 rc = fs_stat(fname, &dirent); in littlefs_binary_file_adj()
191 if (rc < 0) { in littlefs_binary_file_adj()
192 LOG_ERR("FAIL: stat %s: %d", fname, rc); in littlefs_binary_file_adj()
197 if (rc == 0 && dirent.type == FS_DIR_ENTRY_FILE && dirent.size == 0) { in littlefs_binary_file_adj()
202 rc = fs_read(&file, file_test_pattern, in littlefs_binary_file_adj()
204 if (rc < 0) { in littlefs_binary_file_adj()
206 fname, rc); in littlefs_binary_file_adj()
215 rc = fs_seek(&file, 0, FS_SEEK_SET); in littlefs_binary_file_adj()
216 if (rc < 0) { in littlefs_binary_file_adj()
217 LOG_ERR("FAIL: seek %s: %d", fname, rc); in littlefs_binary_file_adj()
221 rc = fs_write(&file, file_test_pattern, sizeof(file_test_pattern)); in littlefs_binary_file_adj()
222 if (rc < 0) { in littlefs_binary_file_adj()
223 LOG_ERR("FAIL: write %s: %d", fname, rc); in littlefs_binary_file_adj()
233 return (rc < 0 ? rc : 0); in littlefs_binary_file_adj()
240 int rc; in littlefs_flash_erase() local
242 rc = flash_area_open(id, &pfa); in littlefs_flash_erase()
243 if (rc < 0) { in littlefs_flash_erase()
245 id, rc); in littlefs_flash_erase()
246 return rc; in littlefs_flash_erase()
255 rc = flash_area_flatten(pfa, 0, pfa->fa_size); in littlefs_flash_erase()
256 LOG_ERR("Erasing flash area ... %d", rc); in littlefs_flash_erase()
260 return rc; in littlefs_flash_erase()
286 int rc; in littlefs_mount() local
288 rc = littlefs_flash_erase((uintptr_t)mp->storage_dev); in littlefs_mount()
289 if (rc < 0) { in littlefs_mount()
290 return rc; in littlefs_mount()
296 rc = fs_mount(mp); in littlefs_mount()
297 if (rc < 0) { in littlefs_mount()
299 (uintptr_t)mp->storage_dev, mp->mnt_point, rc); in littlefs_mount()
300 return rc; in littlefs_mount()
302 LOG_PRINTK("%s mount: %d\n", mp->mnt_point, rc); in littlefs_mount()
346 int rc; in main() local
350 rc = littlefs_mount(mountpoint); in main()
351 if (rc < 0) { in main()
358 rc = fs_statvfs(mountpoint->mnt_point, &sbuf); in main()
359 if (rc < 0) { in main()
360 LOG_PRINTK("FAIL: statvfs: %d\n", rc); in main()
370 rc = lsdir(mountpoint->mnt_point); in main()
371 if (rc < 0) { in main()
372 LOG_PRINTK("FAIL: lsdir %s: %d\n", mountpoint->mnt_point, rc); in main()
376 rc = littlefs_increase_infile_value(fname1); in main()
377 if (rc) { in main()
381 rc = littlefs_binary_file_adj(fname2); in main()
382 if (rc) { in main()
387 rc = fs_unmount(mountpoint); in main()
388 LOG_PRINTK("%s unmount: %d\n", mountpoint->mnt_point, rc); in main()