]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/fat/dir.c
fat (exportfs): rebuild directory-inode if fat_dget()
[karo-tx-linux.git] / fs / fat / dir.c
index 165012ef363aafc77c23c839b5c72fb02c7db0b4..7a6f02caf286d4fa20990b259dd5e4773eeff96e 100644 (file)
@@ -964,6 +964,29 @@ int fat_scan(struct inode *dir, const unsigned char *name,
 }
 EXPORT_SYMBOL_GPL(fat_scan);
 
+/*
+ * Scans a directory for a given logstart.
+ * Returns an error code or zero.
+ */
+int fat_scan_logstart(struct inode *dir, int i_logstart,
+                     struct fat_slot_info *sinfo)
+{
+       struct super_block *sb = dir->i_sb;
+
+       sinfo->slot_off = 0;
+       sinfo->bh = NULL;
+       while (fat_get_short_entry(dir, &sinfo->slot_off, &sinfo->bh,
+                                  &sinfo->de) >= 0) {
+               if (fat_get_start(MSDOS_SB(sb), sinfo->de) == i_logstart) {
+                       sinfo->slot_off -= sizeof(*sinfo->de);
+                       sinfo->nr_slots = 1;
+                       sinfo->i_pos = fat_make_i_pos(sb, sinfo->bh, sinfo->de);
+                       return 0;
+               }
+       }
+       return -ENOENT;
+}
+
 static int __fat_remove_entries(struct inode *dir, loff_t pos, int nr_slots)
 {
        struct super_block *sb = dir->i_sb;