From: "Pali Rohár" <pali.rohar@gmail.com>
To: chenchacha <chen.chenchacha@foxmail.com>
Cc: hirofumi@mail.parknet.co.jp, linux-kernel@vger.kernel.org,
andy.shevchenko@gmail.com
Subject: Re: [PATCH 2/2] Add a new function to get root directory with ATTR_VOLUME
Date: Thu, 4 Oct 2018 19:29:15 +0200 [thread overview]
Message-ID: <20181004172915.z7zm5jqcb4vtq6py@pali> (raw)
In-Reply-To: <20181004172101.15525-3-chen.chenchacha@foxmail.com>
[-- Attachment #1: Type: text/plain, Size: 2078 bytes --]
On Friday 05 October 2018 01:21:01 chenchacha wrote:
> Signed-off-by: chenchacha <chen.chenchacha@foxmail.com>
> ---
> fs/fat/dir.c | 13 +++++++++++++
> fs/fat/fat.h | 2 ++
> 2 files changed, 15 insertions(+)
>
> diff --git a/fs/fat/dir.c b/fs/fat/dir.c
> index 7f5f3699fc6c..4fdcc1200f2b 100644
> --- a/fs/fat/dir.c
> +++ b/fs/fat/dir.c
> @@ -881,6 +881,19 @@ static int fat_get_short_entry(struct inode *dir, loff_t *pos,
> return -ENOENT;
> }
>
> +int fat_get_root_entry(struct inode *dir, struct buffer_head **bh,
> + struct msdos_dir_entry **de)
fat_get_root_volume_entry would be better name. It does not return root
entry, but volume label entry.
> +{
> + loff_t offset = 0;
> +
> + *de = NULL;
> + while (fat_get_entry(dir, &offset, bh, de) >= 0) {
> + if (!IS_FREE((*de)->name) && (*de)->attr & ATTR_VOLUME)
You should check that cluster number is zero. As e.g. first entry with
ATTR_VOLUME can be also LFN entry and not real volume label. So you
should properly check mask and filter out also LFN entries which have
ATTR_VOLUME flag set too.
> + return 0;
> + }
> + return -ENOENT;
> +}
> +
> /*
> * The ".." entry can not provide the "struct fat_slot_info" information
> * for inode, nor a usable i_pos. So, this function provides some information
> diff --git a/fs/fat/fat.h b/fs/fat/fat.h
> index be012de96f65..4195cb1e891a 100644
> --- a/fs/fat/fat.h
> +++ b/fs/fat/fat.h
> @@ -302,6 +302,8 @@ extern int fat_scan(struct inode *dir, const unsigned char *name,
> struct fat_slot_info *sinfo);
> extern int fat_scan_logstart(struct inode *dir, int i_logstart,
> struct fat_slot_info *sinfo);
> +extern int fat_get_root_entry(struct inode *dir, struct buffer_head **bh,
> + struct msdos_dir_entry **de);
> extern int fat_get_dotdot_entry(struct inode *dir, struct buffer_head **bh,
> struct msdos_dir_entry **de);
> extern int fat_alloc_new_dir(struct inode *dir, struct timespec64 *ts);
> --
> 2.19.0
>
--
Pali Rohár
pali.rohar@gmail.com
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
next prev parent reply other threads:[~2018-10-04 17:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-04 17:20 [PATCH 0/2] fs: fat: add ioctl method to read voluem label in fat filesystem driver chenchacha
2018-10-04 17:21 ` [PATCH 2/2] Add a new function to get root directory with ATTR_VOLUME chenchacha
2018-10-04 17:29 ` Pali Rohár [this message]
2018-10-04 17:26 ` [PATCH 0/2] fs: fat: add ioctl method to read voluem label in fat filesystem driver Pali Rohár
[not found] ` <20181004172101.15525-2-chen.chenchacha@foxmail.com>
2018-10-04 17:33 ` [PATCH 1/2] Add FAT_IOCTL_GET_VOLUME_LABEL in fat_generic_ioctl() Pali Rohár
[not found] ` <5bb8734a.1c69fb81.9fdf4.0461SMTPIN_ADDED_BROKEN@mx.google.com>
2018-10-06 8:37 ` Pali Rohár
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181004172915.z7zm5jqcb4vtq6py@pali \
--to=pali.rohar@gmail.com \
--cc=andy.shevchenko@gmail.com \
--cc=chen.chenchacha@foxmail.com \
--cc=hirofumi@mail.parknet.co.jp \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox