On Wednesday 15 January 2020 17:24:37 Namjae Jeon wrote: > This adds the implementation of directory operations for exfat. > > Reviewed-by: Christoph Hellwig <hch@xxxxxx> > Signed-off-by: Namjae Jeon <namjae.jeon@xxxxxxxxxxx> > Signed-off-by: Sungjong Seo <sj1557.seo@xxxxxxxxxxx> > --- > fs/exfat/dir.c | 1244 ++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 1244 insertions(+) > create mode 100644 fs/exfat/dir.c > > diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c > new file mode 100644 > index 000000000000..81a95557a6a3 > --- /dev/null > +++ b/fs/exfat/dir.c ... > +/* read a directory entry from the opened directory */ > +static int exfat_readdir(struct inode *inode, struct exfat_dir_entry *dir_entry) > +{ ... > + while (clu.dir != EXFAT_EOF_CLUSTER) { > + i = dentry & (dentries_per_clu - 1); > + > + for ( ; i < dentries_per_clu; i++, dentry++) { > + ep = exfat_get_dentry(sb, &clu, i, &bh, §or); > + if (!ep) > + return -EIO; > + > + type = exfat_get_entry_type(ep); > + if (type == TYPE_UNUSED) { > + brelse(bh); > + break; > + } > + > + if (type != TYPE_FILE && type != TYPE_DIR) { > + brelse(bh); > + continue; > + } > + > + dir_entry->attr = le16_to_cpu(ep->dentry.file.attr); > + exfat_get_entry_time(sbi, &dir_entry->ctime, > + ep->dentry.file.create_time, > + ep->dentry.file.create_date, > + ep->dentry.file.create_tz); Hello, here is missing processing of create_time_ms entry. I think that exfat_get_entry_time() should be extended to take (optional) time_ms parameter. time_ms is only for create_time nad modify_time (not for access_time). > + exfat_get_entry_time(sbi, &dir_entry->mtime, > + ep->dentry.file.modify_time, > + ep->dentry.file.modify_date, > + ep->dentry.file.modify_tz); Similarly there is missing processing of modify_time_ms entry. > + exfat_get_entry_time(sbi, &dir_entry->atime, > + ep->dentry.file.access_time, > + ep->dentry.file.access_date, > + ep->dentry.file.access_tz); > + > + *uni_name.name = 0x0; > + exfat_get_uniname_from_ext_entry(sb, &dir, dentry, > + uni_name.name); > + exfat_utf16_to_nls(sb, &uni_name, > + dir_entry->namebuf.lfn, > + dir_entry->namebuf.lfnbuf_len); > + brelse(bh); > + > + ep = exfat_get_dentry(sb, &clu, i + 1, &bh, NULL); > + if (!ep) > + return -EIO; > + dir_entry->size = > + le64_to_cpu(ep->dentry.stream.valid_size); > + brelse(bh); > + > + ei->hint_bmap.off = dentry >> dentries_per_clu_bits; > + ei->hint_bmap.clu = clu.dir; > + > + ei->rwoffset = ++dentry; > + return 0; > + } > + -- Pali Rohár pali.rohar@xxxxxxxxx