Skip to content

Commit 58c46b8

Browse files
committed
1
Signed-off-by: sakumisu <1203593632@qq.com>
1 parent ee06c34 commit 58c46b8

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

platform/fatfs/usbd_fatfs_mtp.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ struct mtp_dirent *usbd_mtp_readdir(MTP_DIR *dir)
220220
#define SS(fs) ((fs)->ssize) /* Variable sector size */
221221
#endif
222222

223-
int usbd_mtp_stat(const char *path, struct stat *buf)
223+
int usbd_mtp_stat(const char *path, struct mtp_stat *buf)
224224
{
225225
FILINFO file_info;
226226
FRESULT result;
@@ -232,14 +232,14 @@ int usbd_mtp_stat(const char *path, struct stat *buf)
232232
printf("f_stat failed, cause: %s\n", show_error_string(result));
233233
return -1;
234234
}
235-
buf->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH |
236-
S_IWUSR | S_IWGRP | S_IWOTH;
235+
buf->st_mode = MTP_S_IFREG | MTP_S_IRUSR | MTP_S_IRGRP | MTP_S_IROTH |
236+
MTP_S_IWUSR | MTP_S_IWGRP | MTP_S_IWOTH;
237237
if (file_info.fattrib & AM_DIR) {
238-
buf->st_mode &= ~S_IFREG;
239-
buf->st_mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH;
238+
buf->st_mode &= ~MTP_S_IFREG;
239+
buf->st_mode |= MTP_S_IFDIR | MTP_S_IXUSR | MTP_S_IXGRP | MTP_S_IXOTH;
240240
}
241241
if (file_info.fattrib & AM_RDO)
242-
buf->st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
242+
buf->st_mode &= ~(MTP_S_IWUSR | MTP_S_IWGRP | MTP_S_IWOTH);
243243

244244
buf->st_size = file_info.fsize;
245245
buf->st_blksize = f->csize * SS(f);
@@ -282,11 +282,11 @@ int usbd_mtp_open(const char *path, uint8_t mode)
282282
{
283283
BYTE flags;
284284

285-
if (mode == O_RDONLY) {
285+
if (mode == MTP_O_RDONLY) {
286286
flags = FA_READ | FA_OPEN_EXISTING;
287-
} else if (mode == O_WRONLY) {
287+
} else if (mode == MTP_O_WRONLY) {
288288
flags = FA_WRITE | FA_OPEN_ALWAYS;
289-
} else if (mode == O_RDWR) {
289+
} else if (mode == MTP_O_RDWR) {
290290
flags = FA_READ | FA_WRITE | FA_OPEN_ALWAYS;
291291
} else {
292292
return -1; // Invalid mode

0 commit comments

Comments
 (0)