mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 08:42:40 +01:00 
			
		
		
		
	Before: If an entry is found, lfs_dir_read returns 1 If at end of directory, lfs_dir_read returns 0 After: If an entry is found, lfs_dir_read returns 0 If at end of directory, lfs_dir_read returns LFS_ERR_NOENT --- lfs_dir_read is a bit of an odd function. It's supposed to match lfs_file_read, but instead of reading bytes, it reads directory entries. Its POSIX equivalent, readdir, indicates whether or not we reached the end of the directory by returning a NULL pointer: struct dirent *readdir(DIR *dirp); But this API needed to change for littlefs, since we don't use errno, instead returning errors as signed integers through all API functions, including lfs_dir_read. So, in an effort to match lfs_file_read, lfs_dir_read returned the "number" of directory entries read, limited to either 0 or 1. Perhaps unsurprisingly, this turned out to be confusing to users, and a better API was proposed hathach to instead return either 0 or LFS_ERR_NOENT, an error which can't occur for other reasons in lfs_dir_read. Suggested by hathach