{"id":24091744,"url":"https://github.com/RT-Thread-packages/filesystem-sample","last_synced_at":"2025-09-17T01:32:03.036Z","repository":{"id":56272597,"uuid":"145530401","full_name":"RT-Thread-packages/filesystem-sample","owner":"RT-Thread-packages","description":"RT-Thread filesystem samples","archived":false,"fork":false,"pushed_at":"2022-01-14T22:17:30.000Z","size":36,"stargazers_count":8,"open_issues_count":0,"forks_count":6,"subscribers_count":6,"default_branch":"master","last_synced_at":"2023-03-03T05:09:18.660Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RT-Thread-packages.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-21T08:16:11.000Z","updated_at":"2022-05-25T10:57:21.000Z","dependencies_parsed_at":"2022-08-15T15:50:24.291Z","dependency_job_id":null,"html_url":"https://github.com/RT-Thread-packages/filesystem-sample","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RT-Thread-packages%2Ffilesystem-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RT-Thread-packages%2Ffilesystem-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RT-Thread-packages%2Ffilesystem-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RT-Thread-packages%2Ffilesystem-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RT-Thread-packages","download_url":"https://codeload.github.com/RT-Thread-packages/filesystem-sample/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233312713,"owners_count":18657092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-10T07:44:41.497Z","updated_at":"2025-09-17T01:31:57.653Z","avatar_url":"https://github.com/RT-Thread-packages.png","language":"C","readme":"# filesystem samples package\n\n[中文页](README_ZH.md) | English\n\n## 1. Introduction\n\nThis package contains relevant sample code used by the file system.\n\n### 1.1 Example description\n\n| File | Description |\n| ------------- | ---------------------- |\n| readwrite_sample.c | File read and write |\n| rename_sample.c | Change name |\n| stat_sample.c | Get status |\n| mkdir_sample.c | Create directory |\n| opendir_sample.c | Open directory |\n| readdir_sample.c | Read directory |\n| tell_seek_dir_sample.c | Save and set read directory location |\n\n### 1.2 License\n\nThe filesystem samples package complies with the Apache license v2.0, see the `LICENSE` file for details.\n\n### 1.3 Dependency\n\nTo use the filesystem samples package, you need to enable file system related functions in the menuconfig configuration option of RT-Thread. The specific path is as follows:\n\n```\nRT-Thread Components\n    device virtual file system ---\u003e\n```\n\n## 2. How to open the filesystem samples package\n\nTo use the filesystem samples package, you need to select it in the package manager of RT-Thread. The specific path is as follows:\n\n```\nRT-Thread online packages\n    miscellaneous packages ---\u003e\n        samples: kernel and components samples ---\u003e\n            a filesystem_samples package for rt-thread ---\u003e\n```\n\nThen let RT-Thread's package manager automatically update, or use the `pkgs --update` command to update the package to the BSP.\n\n## 3. Use filesystem samples package\n\nAfter opening the filesystem samples package, when performing BSP compilation, the source code of the selected package will be added to the BSP project for compilation.\n\n**API list**\n\n| API | Function |\n| -------------- | ------------------------ |\n| int open(const char *pathname, int oflag, int mode); | open file |\n| int close(int fd); | close file |\n| size_t read(int fd, void *buf, size_t count); | Read data |\n| size_t write(int fd, const void *buf, size_t count); | write data |\n| int rename(const char *oldpath, const char *newpath); | change name |\n| int stat(const char *file_name, struct stat *buf); | Get status |\n| int mkdir(const char *path, mode_t mode); | Create directory |\n| DIR* opendir(const char* name); | Open directory |\n| struct dirent* readdir(DIR *d); | Read directory |\n| off_t telldir(DIR *d); | Get the reading position of the directory stream |\n| void seekdir(DIR *d, off_t offset); | Set the position of the read directory |\n| void rewinddir(DIR *d); | Reset the position of the read directory to the beginning |\n| int closedir(DIR* d); | close directory |\n| int rmdir(const char *pathname); | delete directory |\n| int mkfs(const char * fs_name, const char * device) | format file system |\n\n## 4. Matters needing attention\n\nNothing.\n\n## 5. Contact \u0026 Thanks\n\n* Maintenance: [misonyo](https://github.com/misonyo)\n* Homepage: https://github.com/RT-Thread-packages/filesystem-sample\n","funding_links":[],"categories":["Packages"],"sub_categories":["Misc"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRT-Thread-packages%2Ffilesystem-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRT-Thread-packages%2Ffilesystem-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRT-Thread-packages%2Ffilesystem-sample/lists"}