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

TOMOYO Linux Cross Reference
Linux/fs/squashfs/fragment.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 ] ~

Diff markup

Differences between /fs/squashfs/fragment.c (Version linux-6.11.5) and /fs/squashfs/fragment.c (Version linux-2.6.0)


  1 // SPDX-License-Identifier: GPL-2.0-or-later        1 
  2 /*                                                
  3  * Squashfs - a compressed read only filesyste    
  4  *                                                
  5  * Copyright (c) 2002, 2003, 2004, 2005, 2006,    
  6  * Phillip Lougher <phillip@squashfs.org.uk>      
  7  *                                                
  8  * fragment.c                                     
  9  */                                               
 10                                                   
 11 /*                                                
 12  * This file implements code to handle compres    
 13  * datablocks).                                   
 14  *                                                
 15  * Regular files contain a fragment index whic    
 16  * location on disk and compressed size using     
 17  * Like everything in Squashfs this fragment l    
 18  * compressed into metadata blocks.  A second     
 19  * these.  This second index table for speed o    
 20  * is small) is read at mount time and cached     
 21  */                                               
 22                                                   
 23 #include <linux/fs.h>                             
 24 #include <linux/vfs.h>                            
 25 #include <linux/slab.h>                           
 26                                                   
 27 #include "squashfs_fs.h"                          
 28 #include "squashfs_fs_sb.h"                       
 29 #include "squashfs.h"                             
 30                                                   
 31 /*                                                
 32  * Look-up fragment using the fragment index t    
 33  * location of the fragment and its compressed    
 34  */                                               
 35 int squashfs_frag_lookup(struct super_block *s    
 36                                 u64 *fragment_    
 37 {                                                 
 38         struct squashfs_sb_info *msblk = sb->s    
 39         int block, offset, size;                  
 40         struct squashfs_fragment_entry fragmen    
 41         u64 start_block;                          
 42                                                   
 43         if (fragment >= msblk->fragments)         
 44                 return -EIO;                      
 45         block = SQUASHFS_FRAGMENT_INDEX(fragme    
 46         offset = SQUASHFS_FRAGMENT_INDEX_OFFSE    
 47                                                   
 48         start_block = le64_to_cpu(msblk->fragm    
 49                                                   
 50         size = squashfs_read_metadata(sb, &fra    
 51                                         &offse    
 52         if (size < 0)                             
 53                 return size;                      
 54                                                   
 55         *fragment_block = le64_to_cpu(fragment    
 56         return squashfs_block_size(fragment_en    
 57 }                                                 
 58                                                   
 59                                                   
 60 /*                                                
 61  * Read the uncompressed fragment lookup table    
 62  */                                               
 63 __le64 *squashfs_read_fragment_index_table(str    
 64         u64 fragment_table_start, u64 next_tab    
 65 {                                                 
 66         unsigned int length = SQUASHFS_FRAGMEN    
 67         __le64 *table;                            
 68                                                   
 69         /*                                        
 70          * Sanity check, length bytes should n    
 71          * this check also traps instances whe    
 72          * incorrectly larger than the next ta    
 73          */                                       
 74         if (fragment_table_start + length > ne    
 75                 return ERR_PTR(-EINVAL);          
 76                                                   
 77         table = squashfs_read_table(sb, fragme    
 78                                                   
 79         /*                                        
 80          * table[0] points to the first fragme    
 81          * should be less than fragment_table_    
 82          */                                       
 83         if (!IS_ERR(table) && le64_to_cpu(tabl    
 84                 kfree(table);                     
 85                 return ERR_PTR(-EINVAL);          
 86         }                                         
 87                                                   
 88         return table;                             
 89 }                                                 
 90                                                   

~ [ 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