From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergei Antonov Subject: Re: [PATCH] hfsplus: emit symlinks from readdir properly Date: Wed, 7 May 2014 16:51:27 +0200 Message-ID: References: <1399464494-12540-1-git-send-email-saproj@gmail.com> <1399472320.2400.19.camel@slavad-CELSIUS-H720> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: "linux-fsdevel@vger.kernel.org" , Al Viro , Christoph Hellwig , Andrew Morton , Hin-Tak Leung To: Vyacheslav Dubeyko Return-path: Received: from mail-ob0-f173.google.com ([209.85.214.173]:61831 "EHLO mail-ob0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751915AbaEGOv2 (ORCPT ); Wed, 7 May 2014 10:51:28 -0400 Received: by mail-ob0-f173.google.com with SMTP id wm4so1319510obc.4 for ; Wed, 07 May 2014 07:51:28 -0700 (PDT) In-Reply-To: <1399472320.2400.19.camel@slavad-CELSIUS-H720> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 7 May 2014 16:18, Vyacheslav Dubeyko wrote: > Hi Sergei, > > On Wed, 2014-05-07 at 14:08 +0200, Sergei Antonov wrote: >> hfsplus_readdir() did not return DT_LNK record type for symbolic links. It >> emitted them as regular files (DT_REG). Programs relying on information from >> readdir did not work correctly with HFS+. >> > > This patch looks good for me. But what about another file types > (S_IFIFO, S_IFCHR, S_IFBLK, S_IFSOCK)? I will resubmit to support them too. Thanks. In this patch I tried to fix the problem I faced (and it was with symlinks). Now I see that the fix can be broader. Resubmitting in a minute. > Thanks, > Vyacheslav Dubeyko. > >> CC: Al Viro >> CC: Christoph Hellwig >> CC: Andrew Morton >> CC: Vyacheslav Dubeyko >> CC: Hin-Tak Leung >> Signed-off-by: Sergei Antonov >> --- >> fs/hfsplus/dir.c | 6 +++++- >> 1 file changed, 5 insertions(+), 1 deletion(-) >> >> diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c >> index bdec665..c5ccb11 100644 >> --- a/fs/hfsplus/dir.c >> +++ b/fs/hfsplus/dir.c >> @@ -212,13 +212,17 @@ static int hfsplus_readdir(struct file *file, struct dir_context *ctx) >> be32_to_cpu(entry.folder.id), DT_DIR)) >> break; >> } else if (type == HFSPLUS_FILE) { >> + u16 mode; >> + >> if (fd.entrylength < sizeof(struct hfsplus_cat_file)) { >> pr_err("small file entry\n"); >> err = -EIO; >> goto out; >> } >> + mode = be16_to_cpu(entry.file.permissions.mode); >> if (!dir_emit(ctx, strbuf, len, >> - be32_to_cpu(entry.file.id), DT_REG)) >> + be32_to_cpu(entry.file.id), >> + S_ISLNK(mode) ? DT_LNK : DT_REG)) >> break; >> } else { >> pr_err("bad catalog entry type\n"); > >