android: ram_console: split out persistent ram

Split ram_console into two halves.

persistent_ram is a set of apis that handle a block of memory
that does not get erased across a reboot.  It provides functions
to fill it as a single buffer or a ring buffer, and to extract
the old data after a reboot.  It handles ecc on the data to
correct bit errors introduced during reboot.

ram_console is now a small wrapper around persistent_ram that
feeds console data into the ringbuffer, and exports the old
data to /proc/last_kmsg after a reboot.

Signed-off-by: Colin Cross <ccross@android.com>
Change-Id: I8c7495e3a6a3dd7cdf3cb067e1afceb3b6aaef3c

Conflicts:
	drivers/staging/android/Kconfig
	drivers/staging/android/Makefile
	drivers/staging/android/ram_console.c
android: persistent_ram: refactor ecc support

Remove CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION and related
 #ifdefs.  Also allow persistent ram zones without ecc enabled.
For some use cases, like the data portion of the upcoming
persistent_vars patches, or a persistent ftrace ringbuffer,
ecc on every update is too expensive.

Signed-off-by: Colin Cross <ccross@android.com>
Change-Id: Ia710344b6c54fe252e0a87353955e063b3c054ab
android: ram_console: honor dmesg_restrict

The Linux kernel has a setting called dmesg_restrict. When true,
only processes with CAP_SYSLOG can view the kernel dmesg logs. This
helps prevent leaking of kernel information into user space.

On Android, it's possible to bypass these restrictions by viewing
/proc/last_kmsg.

This change makes /proc/last_kmsg require the same permissions as
dmesg.

Bug: 5555691
Signed-off-by: Nick Kralevich <nnk@google.com>
Change-Id: I50ecb74012ef2ac0a3cff7325192634341fddae9
fix staging/android
fix
Revert " zram: use size_t instead of u16"

This reverts commit c7b8c75d3ed1a3217d715d01e4d0e80bff2309d8.
Revert " zram: remove unused SECTOR_SIZE define"

This reverts commit 12a96beeb5943c830227a2a3ff9dd03d75e30d40.
Revert " zram: rename struct `table' to `zram_table_entry'"

This reverts commit 5631150f4a1272b0b863b99b5603d52dec432183.
SmittyV