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

TOMOYO Linux Cross Reference
Linux/fs/freevxfs/vxfs_subr.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ 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-only
  2 /*
  3  * Copyright (c) 2000-2001 Christoph Hellwig.
  4  */
  5 
  6 /*
  7  * Veritas filesystem driver - shared subroutines.
  8  */
  9 #include <linux/fs.h>
 10 #include <linux/buffer_head.h>
 11 #include <linux/kernel.h>
 12 #include <linux/pagemap.h>
 13 
 14 #include "vxfs_extern.h"
 15 
 16 
 17 static int              vxfs_read_folio(struct file *, struct folio *);
 18 static sector_t         vxfs_bmap(struct address_space *, sector_t);
 19 
 20 const struct address_space_operations vxfs_aops = {
 21         .read_folio =           vxfs_read_folio,
 22         .bmap =                 vxfs_bmap,
 23 };
 24 
 25 inline void
 26 vxfs_put_page(struct page *pp)
 27 {
 28         kunmap(pp);
 29         put_page(pp);
 30 }
 31 
 32 /**
 33  * vxfs_get_page - read a page into memory.
 34  * @mapping:    mapping to read from
 35  * @n:          page number
 36  *
 37  * Description:
 38  *   vxfs_get_page reads the @n th page of @ip into the pagecache.
 39  *
 40  * Returns:
 41  *   The wanted page on success, else a NULL pointer.
 42  */
 43 struct page *
 44 vxfs_get_page(struct address_space *mapping, u_long n)
 45 {
 46         struct page *                   pp;
 47 
 48         pp = read_mapping_page(mapping, n, NULL);
 49 
 50         if (!IS_ERR(pp)) {
 51                 kmap(pp);
 52                 /** if (!PageChecked(pp)) **/
 53                         /** vxfs_check_page(pp); **/
 54         }
 55         
 56         return (pp);
 57 }
 58 
 59 /**
 60  * vxfs_bread - read buffer for a give inode,block tuple
 61  * @ip:         inode
 62  * @block:      logical block
 63  *
 64  * Description:
 65  *   The vxfs_bread function reads block no @block  of
 66  *   @ip into the buffercache.
 67  *
 68  * Returns:
 69  *   The resulting &struct buffer_head.
 70  */
 71 struct buffer_head *
 72 vxfs_bread(struct inode *ip, int block)
 73 {
 74         struct buffer_head      *bp;
 75         daddr_t                 pblock;
 76 
 77         pblock = vxfs_bmap1(ip, block);
 78         bp = sb_bread(ip->i_sb, pblock);
 79 
 80         return (bp);
 81 }
 82 
 83 /**
 84  * vxfs_getblk - locate buffer for given inode,block tuple
 85  * @ip:         inode
 86  * @iblock:     logical block
 87  * @bp:         buffer skeleton
 88  * @create:     %TRUE if blocks may be newly allocated.
 89  *
 90  * Description:
 91  *   The vxfs_getblk function fills @bp with the right physical
 92  *   block and device number to perform a lowlevel read/write on
 93  *   it.
 94  *
 95  * Returns:
 96  *   Zero on success, else a negativ error code (-EIO).
 97  */
 98 static int
 99 vxfs_getblk(struct inode *ip, sector_t iblock,
100             struct buffer_head *bp, int create)
101 {
102         daddr_t                 pblock;
103 
104         pblock = vxfs_bmap1(ip, iblock);
105         if (pblock != 0) {
106                 map_bh(bp, ip->i_sb, pblock);
107                 return 0;
108         }
109 
110         return -EIO;
111 }
112 
113 /**
114  * vxfs_read_folio - read one page synchronously into the pagecache
115  * @file:       file context (unused)
116  * @folio:      folio to fill in.
117  *
118  * Description:
119  *   The vxfs_read_folio routine reads @folio synchronously into the
120  *   pagecache.
121  *
122  * Returns:
123  *   Zero on success, else a negative error code.
124  *
125  * Locking status:
126  *   @folio is locked and will be unlocked.
127  */
128 static int vxfs_read_folio(struct file *file, struct folio *folio)
129 {
130         return block_read_full_folio(folio, vxfs_getblk);
131 }
132  
133 /**
134  * vxfs_bmap - perform logical to physical block mapping
135  * @mapping:    logical to physical mapping to use
136  * @block:      logical block (relative to @mapping).
137  *
138  * Description:
139  *   Vxfs_bmap find out the corresponding phsical block to the
140  *   @mapping, @block pair.
141  *
142  * Returns:
143  *   Physical block number on success, else Zero.
144  *
145  * Locking status:
146  *   We are under the bkl.
147  */
148 static sector_t
149 vxfs_bmap(struct address_space *mapping, sector_t block)
150 {
151         return generic_block_bmap(mapping, block, vxfs_getblk);
152 }
153 

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

kernel.org | git.kernel.org | LWN.net | Project Home | 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.

sflogo.php