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

TOMOYO Linux Cross Reference
Linux/include/linux/decompress/mm.h

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 /include/linux/decompress/mm.h (Version linux-6.11.5) and /include/linux/decompress/mm.h (Version linux-2.6.32.71)


  1 /* SPDX-License-Identifier: GPL-2.0 */         << 
  2 /*                                                  1 /*
  3  * linux/compr_mm.h                                 2  * linux/compr_mm.h
  4  *                                                  3  *
  5  * Memory management for pre-boot and ramdisk       4  * Memory management for pre-boot and ramdisk uncompressors
  6  *                                                  5  *
  7  * Authors: Alain Knaff <alain@knaff.lu>            6  * Authors: Alain Knaff <alain@knaff.lu>
  8  *                                                  7  *
  9  */                                                 8  */
 10                                                     9 
 11 #ifndef DECOMPR_MM_H                               10 #ifndef DECOMPR_MM_H
 12 #define DECOMPR_MM_H                               11 #define DECOMPR_MM_H
 13                                                    12 
 14 #ifdef STATIC                                      13 #ifdef STATIC
 15                                                    14 
 16 /* Code active when included from pre-boot env     15 /* Code active when included from pre-boot environment: */
 17                                                    16 
 18 /*                                                 17 /*
 19  * Some architectures want to ensure there is      18  * Some architectures want to ensure there is no local data in their
 20  * pre-boot environment, so that data can arbi !!  19  * pre-boot environment, so that data can arbitarily relocated (via
 21  * GOT references).  This is achieved by defin     20  * GOT references).  This is achieved by defining STATIC_RW_DATA to
 22  * be null.                                        21  * be null.
 23  */                                                22  */
 24 #ifndef STATIC_RW_DATA                             23 #ifndef STATIC_RW_DATA
 25 #define STATIC_RW_DATA static                      24 #define STATIC_RW_DATA static
 26 #endif                                             25 #endif
 27                                                    26 
 28 /*                                             << 
 29  * When an architecture needs to share the mal << 
 30  * between compilation units, it needs to have << 
 31  */                                            << 
 32 #ifndef MALLOC_VISIBLE                         << 
 33 #define MALLOC_VISIBLE static                  << 
 34 #endif                                         << 
 35                                                << 
 36 /* A trivial malloc implementation, adapted fr     27 /* A trivial malloc implementation, adapted from
 37  *  malloc by Hannu Savolainen 1993 and Matthi     28  *  malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
 38  */                                                29  */
 39 STATIC_RW_DATA unsigned long malloc_ptr;           30 STATIC_RW_DATA unsigned long malloc_ptr;
 40 STATIC_RW_DATA int malloc_count;                   31 STATIC_RW_DATA int malloc_count;
 41                                                    32 
 42 MALLOC_VISIBLE void *malloc(int size)          !!  33 static void *malloc(int size)
 43 {                                                  34 {
 44         void *p;                                   35         void *p;
 45                                                    36 
 46         if (size < 0)                              37         if (size < 0)
 47                 return NULL;                   !!  38                 error("Malloc error");
 48         if (!malloc_ptr)                           39         if (!malloc_ptr)
 49                 malloc_ptr = free_mem_ptr;         40                 malloc_ptr = free_mem_ptr;
 50                                                    41 
 51         malloc_ptr = (malloc_ptr + 7) & ~7;    !!  42         malloc_ptr = (malloc_ptr + 3) & ~3;     /* Align */
 52                                                    43 
 53         p = (void *)malloc_ptr;                    44         p = (void *)malloc_ptr;
 54         malloc_ptr += size;                        45         malloc_ptr += size;
 55                                                    46 
 56         if (free_mem_end_ptr && malloc_ptr >=      47         if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr)
 57                 return NULL;                   !!  48                 error("Out of memory");
 58                                                    49 
 59         malloc_count++;                            50         malloc_count++;
 60         return p;                                  51         return p;
 61 }                                                  52 }
 62                                                    53 
 63 MALLOC_VISIBLE void free(void *where)          !!  54 static void free(void *where)
 64 {                                                  55 {
 65         malloc_count--;                            56         malloc_count--;
 66         if (!malloc_count)                         57         if (!malloc_count)
 67                 malloc_ptr = free_mem_ptr;         58                 malloc_ptr = free_mem_ptr;
 68 }                                                  59 }
 69                                                    60 
 70 #define large_malloc(a) malloc(a)                  61 #define large_malloc(a) malloc(a)
 71 #define large_free(a) free(a)                      62 #define large_free(a) free(a)
 72                                                    63 
                                                   >>  64 #define set_error_fn(x)
                                                   >>  65 
 73 #define INIT                                       66 #define INIT
 74                                                    67 
 75 #else /* STATIC */                                 68 #else /* STATIC */
 76                                                    69 
 77 /* Code active when compiled standalone for us     70 /* Code active when compiled standalone for use when loading ramdisk: */
 78                                                    71 
 79 #include <linux/kernel.h>                          72 #include <linux/kernel.h>
 80 #include <linux/fs.h>                              73 #include <linux/fs.h>
 81 #include <linux/string.h>                          74 #include <linux/string.h>
 82 #include <linux/slab.h>                        << 
 83 #include <linux/vmalloc.h>                         75 #include <linux/vmalloc.h>
 84                                                    76 
 85 /* Use defines rather than static inline in or     77 /* Use defines rather than static inline in order to avoid spurious
 86  * warnings when not needed (indeed large_mall     78  * warnings when not needed (indeed large_malloc / large_free are not
 87  * needed by inflate */                            79  * needed by inflate */
 88                                                    80 
 89 #define malloc(a) kmalloc(a, GFP_KERNEL)           81 #define malloc(a) kmalloc(a, GFP_KERNEL)
 90 #define free(a) kfree(a)                           82 #define free(a) kfree(a)
 91                                                    83 
 92 #define large_malloc(a) vmalloc(a)                 84 #define large_malloc(a) vmalloc(a)
 93 #define large_free(a) vfree(a)                     85 #define large_free(a) vfree(a)
                                                   >>  86 
                                                   >>  87 static void(*error)(char *m);
                                                   >>  88 #define set_error_fn(x) error = x;
 94                                                    89 
 95 #define INIT __init                                90 #define INIT __init
 96 #define STATIC                                     91 #define STATIC
 97                                                    92 
 98 #include <linux/init.h>                            93 #include <linux/init.h>
 99                                                    94 
100 #endif /* STATIC */                                95 #endif /* STATIC */
101                                                    96 
102 #endif /* DECOMPR_MM_H */                          97 #endif /* DECOMPR_MM_H */
103                                                    98 

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