The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/fs/ntfs/aops.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /**
    2  * aops.h - Defines for NTFS kernel address space operations and page cache
    3  *          handling.  Part of the Linux-NTFS project.
    4  *
    5  * Copyright (c) 2001-2004 Anton Altaparmakov
    6  * Copyright (c) 2002 Richard Russon
    7  *
    8  * This program/include file is free software; you can redistribute it and/or
    9  * modify it under the terms of the GNU General Public License as published
   10  * by the Free Software Foundation; either version 2 of the License, or
   11  * (at your option) any later version.
   12  *
   13  * This program/include file is distributed in the hope that it will be
   14  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
   15  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   16  * GNU General Public License for more details.
   17  *
   18  * You should have received a copy of the GNU General Public License
   19  * along with this program (in the main directory of the Linux-NTFS
   20  * distribution in the file COPYING); if not, write to the Free Software
   21  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   22  */
   23 
   24 #ifndef _LINUX_NTFS_AOPS_H
   25 #define _LINUX_NTFS_AOPS_H
   26 
   27 #include <linux/mm.h>
   28 #include <linux/highmem.h>
   29 #include <linux/pagemap.h>
   30 #include <linux/fs.h>
   31 
   32 #include "inode.h"
   33 
   34 /**
   35  * ntfs_unmap_page - release a page that was mapped using ntfs_map_page()
   36  * @page:       the page to release
   37  *
   38  * Unpin, unmap and release a page that was obtained from ntfs_map_page().
   39  */
   40 static inline void ntfs_unmap_page(struct page *page)
   41 {
   42         kunmap(page);
   43         page_cache_release(page);
   44 }
   45 
   46 /**
   47  * ntfs_map_page - map a page into accessible memory, reading it if necessary
   48  * @mapping:    address space for which to obtain the page
   49  * @index:      index into the page cache for @mapping of the page to map
   50  *
   51  * Read a page from the page cache of the address space @mapping at position
   52  * @index, where @index is in units of PAGE_CACHE_SIZE, and not in bytes.
   53  *
   54  * If the page is not in memory it is loaded from disk first using the readpage
   55  * method defined in the address space operations of @mapping and the page is
   56  * added to the page cache of @mapping in the process.
   57  *
   58  * If the page belongs to an mst protected attribute and it is marked as such
   59  * in its ntfs inode (NInoMstProtected()) the mst fixups are applied but no
   60  * error checking is performed.  This means the caller has to verify whether
   61  * the ntfs record(s) contained in the page are valid or not using one of the
   62  * ntfs_is_XXXX_record{,p}() macros, where XXXX is the record type you are
   63  * expecting to see.  (For details of the macros, see fs/ntfs/layout.h.)
   64  *
   65  * If the page is in high memory it is mapped into memory directly addressible
   66  * by the kernel.
   67  *
   68  * Finally the page count is incremented, thus pinning the page into place.
   69  *
   70  * The above means that page_address(page) can be used on all pages obtained
   71  * with ntfs_map_page() to get the kernel virtual address of the page.
   72  *
   73  * When finished with the page, the caller has to call ntfs_unmap_page() to
   74  * unpin, unmap and release the page.
   75  *
   76  * Note this does not grant exclusive access. If such is desired, the caller
   77  * must provide it independently of the ntfs_{un}map_page() calls by using
   78  * a {rw_}semaphore or other means of serialization. A spin lock cannot be
   79  * used as ntfs_map_page() can block.
   80  *
   81  * The unlocked and uptodate page is returned on success or an encoded error
   82  * on failure. Caller has to test for error using the IS_ERR() macro on the
   83  * return value. If that evaluates to 'true', the negative error code can be
   84  * obtained using PTR_ERR() on the return value of ntfs_map_page().
   85  */
   86 static inline struct page *ntfs_map_page(struct address_space *mapping,
   87                 unsigned long index)
   88 {
   89         struct page *page = read_mapping_page(mapping, index, NULL);
   90 
   91         if (!IS_ERR(page)) {
   92                 kmap(page);
   93                 if (!PageError(page))
   94                         return page;
   95                 ntfs_unmap_page(page);
   96                 return ERR_PTR(-EIO);
   97         }
   98         return page;
   99 }
  100 
  101 #ifdef NTFS_RW
  102 
  103 extern void mark_ntfs_record_dirty(struct page *page, const unsigned int ofs);
  104 
  105 #endif /* NTFS_RW */
  106 
  107 #endif /* _LINUX_NTFS_AOPS_H */

Cache object: 7af1b0596a62708b4cdbf7652644f7b0


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.