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

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

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  * Copyright (C) 2010 Marco Stornelli <marco.stornelli@gmail.com>
  4  * Copyright (C) 2011 Kees Cook <keescook@chromium.org>
  5  * Copyright (C) 2011 Google, Inc.
  6  */
  7 
  8 #include <linux/pstore_ram.h>
  9 
 10 /*
 11  * Choose whether access to the RAM zone requires locking or not.  If a zone
 12  * can be written to from different CPUs like with ftrace for example, then
 13  * PRZ_FLAG_NO_LOCK is used. For all other cases, locking is required.
 14  */
 15 #define PRZ_FLAG_NO_LOCK        BIT(0)
 16 /*
 17  * If a PRZ should only have a single-boot lifetime, this marks it as
 18  * getting wiped after its contents get copied out after boot.
 19  */
 20 #define PRZ_FLAG_ZAP_OLD        BIT(1)
 21 
 22 /**
 23  * struct persistent_ram_zone - Details of a persistent RAM zone (PRZ)
 24  *                              used as a pstore backend
 25  *
 26  * @paddr:      physical address of the mapped RAM area
 27  * @size:       size of mapping
 28  * @label:      unique name of this PRZ
 29  * @type:       frontend type for this PRZ
 30  * @flags:      holds PRZ_FLAGS_* bits
 31  *
 32  * @buffer_lock:
 33  *      locks access to @buffer "size" bytes and "start" offset
 34  * @buffer:
 35  *      pointer to actual RAM area managed by this PRZ
 36  * @buffer_size:
 37  *      bytes in @buffer->data (not including any trailing ECC bytes)
 38  *
 39  * @par_buffer:
 40  *      pointer into @buffer->data containing ECC bytes for @buffer->data
 41  * @par_header:
 42  *      pointer into @buffer->data containing ECC bytes for @buffer header
 43  *      (i.e. all fields up to @data)
 44  * @rs_decoder:
 45  *      RSLIB instance for doing ECC calculations
 46  * @corrected_bytes:
 47  *      ECC corrected bytes accounting since boot
 48  * @bad_blocks:
 49  *      ECC uncorrectable bytes accounting since boot
 50  * @ecc_info:
 51  *      ECC configuration details
 52  *
 53  * @old_log:
 54  *      saved copy of @buffer->data prior to most recent wipe
 55  * @old_log_size:
 56  *      bytes contained in @old_log
 57  *
 58  */
 59 struct persistent_ram_zone {
 60         phys_addr_t paddr;
 61         size_t size;
 62         void *vaddr;
 63         char *label;
 64         enum pstore_type_id type;
 65         u32 flags;
 66 
 67         raw_spinlock_t buffer_lock;
 68         struct persistent_ram_buffer *buffer;
 69         size_t buffer_size;
 70 
 71         char *par_buffer;
 72         char *par_header;
 73         struct rs_control *rs_decoder;
 74         int corrected_bytes;
 75         int bad_blocks;
 76         struct persistent_ram_ecc_info ecc_info;
 77 
 78         char *old_log;
 79         size_t old_log_size;
 80 };
 81 
 82 struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size,
 83                         u32 sig, struct persistent_ram_ecc_info *ecc_info,
 84                         unsigned int memtype, u32 flags, char *label);
 85 void persistent_ram_free(struct persistent_ram_zone **_prz);
 86 void persistent_ram_zap(struct persistent_ram_zone *prz);
 87 
 88 int persistent_ram_write(struct persistent_ram_zone *prz, const void *s,
 89                          unsigned int count);
 90 int persistent_ram_write_user(struct persistent_ram_zone *prz,
 91                               const void __user *s, unsigned int count);
 92 
 93 void persistent_ram_save_old(struct persistent_ram_zone *prz);
 94 size_t persistent_ram_old_size(struct persistent_ram_zone *prz);
 95 void *persistent_ram_old(struct persistent_ram_zone *prz);
 96 void persistent_ram_free_old(struct persistent_ram_zone *prz);
 97 ssize_t persistent_ram_ecc_string(struct persistent_ram_zone *prz,
 98         char *str, size_t len);
 99 

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