diff options
| author | sakumisu <[email protected]> | 2026-06-01 20:26:07 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2026-06-01 20:26:07 +0800 |
| commit | b5789f4e687145839598677b53efd62f9cd3a209 (patch) | |
| tree | c13bf7baafb0b818ff0079141d2b101bbf0843ad /platform | |
| parent | 30a4b70564254534e35f31bdced45da2bec3662c (diff) | |
refactor(class/mtp): remove system stat and fcntl dependence
Signed-off-by: sakumisu <[email protected]>
Diffstat (limited to 'platform')
| -rw-r--r-- | platform/fatfs/usbd_fatfs_mtp.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/platform/fatfs/usbd_fatfs_mtp.c b/platform/fatfs/usbd_fatfs_mtp.c index 10de5395..8126e3d5 100644 --- a/platform/fatfs/usbd_fatfs_mtp.c +++ b/platform/fatfs/usbd_fatfs_mtp.c @@ -220,7 +220,7 @@ struct mtp_dirent *usbd_mtp_readdir(MTP_DIR *dir) #define SS(fs) ((fs)->ssize) /* Variable sector size */ #endif -int usbd_mtp_stat(const char *path, struct stat *buf) +int usbd_mtp_stat(const char *path, struct mtp_stat *buf) { FILINFO file_info; FRESULT result; @@ -232,14 +232,14 @@ int usbd_mtp_stat(const char *path, struct stat *buf) printf("f_stat failed, cause: %s\n", show_error_string(result)); return -1; } - buf->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH | - S_IWUSR | S_IWGRP | S_IWOTH; + buf->st_mode = MTP_S_IFREG | MTP_S_IRUSR | MTP_S_IRGRP | MTP_S_IROTH | + MTP_S_IWUSR | MTP_S_IWGRP | MTP_S_IWOTH; if (file_info.fattrib & AM_DIR) { - buf->st_mode &= ~S_IFREG; - buf->st_mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH; + buf->st_mode &= ~MTP_S_IFREG; + buf->st_mode |= MTP_S_IFDIR | MTP_S_IXUSR | MTP_S_IXGRP | MTP_S_IXOTH; } if (file_info.fattrib & AM_RDO) - buf->st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH); + buf->st_mode &= ~(MTP_S_IWUSR | MTP_S_IWGRP | MTP_S_IWOTH); buf->st_size = file_info.fsize; buf->st_blksize = f->csize * SS(f); @@ -282,11 +282,11 @@ int usbd_mtp_open(const char *path, uint8_t mode) { BYTE flags; - if (mode == O_RDONLY) { + if (mode == MTP_O_RDONLY) { flags = FA_READ | FA_OPEN_EXISTING; - } else if (mode == O_WRONLY) { + } else if (mode == MTP_O_WRONLY) { flags = FA_WRITE | FA_OPEN_ALWAYS; - } else if (mode == O_RDWR) { + } else if (mode == MTP_O_RDWR) { flags = FA_READ | FA_WRITE | FA_OPEN_ALWAYS; } else { return -1; // Invalid mode |
