~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/ntfs/mft.h

Version: ~ [ linux-5.18 ] ~ [ linux-5.17.9 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.41 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.117 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.195 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.244 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.280 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.315 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*
  3  * mft.h - Defines for mft record handling in NTFS Linux kernel driver.
  4  *         Part of the Linux-NTFS project.
  5  *
  6  * Copyright (c) 2001-2004 Anton Altaparmakov
  7  */
  8 
  9 #ifndef _LINUX_NTFS_MFT_H
 10 #define _LINUX_NTFS_MFT_H
 11 
 12 #include <linux/fs.h>
 13 #include <linux/highmem.h>
 14 #include <linux/pagemap.h>
 15 
 16 #include "inode.h"
 17 
 18 extern MFT_RECORD *map_mft_record(ntfs_inode *ni);
 19 extern void unmap_mft_record(ntfs_inode *ni);
 20 
 21 extern MFT_RECORD *map_extent_mft_record(ntfs_inode *base_ni, MFT_REF mref,
 22                 ntfs_inode **ntfs_ino);
 23 
 24 static inline void unmap_extent_mft_record(ntfs_inode *ni)
 25 {
 26         unmap_mft_record(ni);
 27         return;
 28 }
 29 
 30 #ifdef NTFS_RW
 31 
 32 /**
 33  * flush_dcache_mft_record_page - flush_dcache_page() for mft records
 34  * @ni:         ntfs inode structure of mft record
 35  *
 36  * Call flush_dcache_page() for the page in which an mft record resides.
 37  *
 38  * This must be called every time an mft record is modified, just after the
 39  * modification.
 40  */
 41 static inline void flush_dcache_mft_record_page(ntfs_inode *ni)
 42 {
 43         flush_dcache_page(ni->page);
 44 }
 45 
 46 extern void __mark_mft_record_dirty(ntfs_inode *ni);
 47 
 48 /**
 49  * mark_mft_record_dirty - set the mft record and the page containing it dirty
 50  * @ni:         ntfs inode describing the mapped mft record
 51  *
 52  * Set the mapped (extent) mft record of the (base or extent) ntfs inode @ni,
 53  * as well as the page containing the mft record, dirty.  Also, mark the base
 54  * vfs inode dirty.  This ensures that any changes to the mft record are
 55  * written out to disk.
 56  *
 57  * NOTE:  Do not do anything if the mft record is already marked dirty.
 58  */
 59 static inline void mark_mft_record_dirty(ntfs_inode *ni)
 60 {
 61         if (!NInoTestSetDirty(ni))
 62                 __mark_mft_record_dirty(ni);
 63 }
 64 
 65 extern int ntfs_sync_mft_mirror(ntfs_volume *vol, const unsigned long mft_no,
 66                 MFT_RECORD *m, int sync);
 67 
 68 extern int write_mft_record_nolock(ntfs_inode *ni, MFT_RECORD *m, int sync);
 69 
 70 /**
 71  * write_mft_record - write out a mapped (extent) mft record
 72  * @ni:         ntfs inode describing the mapped (extent) mft record
 73  * @m:          mapped (extent) mft record to write
 74  * @sync:       if true, wait for i/o completion
 75  *
 76  * This is just a wrapper for write_mft_record_nolock() (see mft.c), which
 77  * locks the page for the duration of the write.  This ensures that there are
 78  * no race conditions between writing the mft record via the dirty inode code
 79  * paths and via the page cache write back code paths or between writing
 80  * neighbouring mft records residing in the same page.
 81  *
 82  * Locking the page also serializes us against ->readpage() if the page is not
 83  * uptodate.
 84  *
 85  * On success, clean the mft record and return 0.  On error, leave the mft
 86  * record dirty and return -errno.
 87  */
 88 static inline int write_mft_record(ntfs_inode *ni, MFT_RECORD *m, int sync)
 89 {
 90         struct page *page = ni->page;
 91         int err;
 92 
 93         BUG_ON(!page);
 94         lock_page(page);
 95         err = write_mft_record_nolock(ni, m, sync);
 96         unlock_page(page);
 97         return err;
 98 }
 99 
100 extern bool ntfs_may_write_mft_record(ntfs_volume *vol,
101                 const unsigned long mft_no, const MFT_RECORD *m,
102                 ntfs_inode **locked_ni);
103 
104 extern ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, const int mode,
105                 ntfs_inode *base_ni, MFT_RECORD **mrec);
106 extern int ntfs_extent_mft_record_free(ntfs_inode *ni, MFT_RECORD *m);
107 
108 #endif /* NTFS_RW */
109 
110 #endif /* _LINUX_NTFS_MFT_H */
111 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp