mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: chenchacha <chen.chenchacha@foxmail.com>
To: hirofumi@mail.parknet.co.jp
Cc: linux-kernel@vger.kernel.org, andy.shevchenko@gmail.com,
	pali.rohar@gmail.com
Subject: [PATCH 2/2] Add a new function to get root directory with ATTR_VOLUME
Date: Fri,  5 Oct 2018 01:21:01 +0800	[thread overview]
Message-ID: <20181004172101.15525-3-chen.chenchacha@foxmail.com> (raw)
In-Reply-To: <20181004172101.15525-1-chen.chenchacha@foxmail.com>

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)
+{
+	loff_t offset = 0;
+
+	*de = NULL;
+	while (fat_get_entry(dir, &offset, bh, de) >= 0) {
+		if (!IS_FREE((*de)->name) && (*de)->attr & ATTR_VOLUME)
+			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


  reply	other threads:[~2018-10-04 17:28 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 ` chenchacha [this message]
2018-10-04 17:29   ` [PATCH 2/2] Add a new function to get root directory with ATTR_VOLUME Pali Rohár
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=20181004172101.15525-3-chen.chenchacha@foxmail.com \
    --to=chen.chenchacha@foxmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pali.rohar@gmail.com \
    /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

Powered by JetHome