android-common: Fix slab.h includes for 2.6.34-rc4

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: zwliew <zhaoweiliew@gmail.com>
Staging: android: fixed white spaces coding style issue in logger.c

This patch fixes some space-before-tabs warnings found by checkpatch tool on the staging android driver file logger.c

Signed-off-by: Marco Navarra <fromenglish@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: zwliew <zhaoweiliew@gmail.com>
staging: android: logger: Change logger_offset() from macro to function

Convert to function and add log as a parameter, rather than relying
on log in the context of the macro.

Signed-off-by: Tim Bird <tim.bird@am.sony.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: zwliew <zhaoweiliew@gmail.com>

Conflicts:
	drivers/staging/android/logger.c
staging: android: logger: simplify and optimize get_entry_len

Make this code slightly easier to read, and eliminate calls
to sub-routines.  Some of these were previously optimized away
by the compiler, but one memcpy was not.

In my testing, this makes the code about 20% smaller, and
has no sub-routine calls and no branches (on ARM).

v2 of this patch is, IMHO, easier to read than v1. Compared to
that patch it uses __u8 instead of unsigned char, for
consistency with the __u16 val data type, simplifies the
conditional expression, adds a another comment, and
moves a common statement out of the if.

Signed-off-by: Tim Bird <tim.bird@am.sony.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: zwliew <zhaoweiliew@gmail.com>

Conflicts:
	drivers/staging/android/logger.c
staging: android: logger: reorder prepare_to_wait and mutex_lock

If mutex_lock waits, it will return in state TASK_RUNNING,
rubbing out the effect of prepare_to_wait().

Signed-off-by: Tim Bird <tim.bird@am.sony.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: zwliew <zhaoweiliew@gmail.com>
staging: android: logger: clarify code in clock_interval

Add commentary, rename the function and make the code easier to read.

Signed-off-by: Tim Bird <tim.bird@am.sony.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: zwliew <zhaoweiliew@gmail.com>
staging: android: logger: clarify non-update of w_off in do_write_log_from_user

Add comment to explain when w_off is not updated in case of failed second
fragment copy to buffer.

Signed-off-by: Tim Bird <tim.bird@am.sony.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: zwliew <zhaoweiliew@gmail.com>
staging: logger: hold mutex while removing reader

The readers list is traversed under the log->mutex lock
(for example from fix_up_readers()), but the deletion of
elements from this list is not being done under this lock.

Cc: Brian Swetland <swetland@google.com>
Cc: Dima Zavin <dima@android.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: zwliew <zhaoweiliew@gmail.com>

Conflicts:
	drivers/staging/android/logger.c
android: logger: Allow a UID to read it's own log entries

Modify the kernel logger to record the UID associated with
the log entries. Always allow the same UID which generated a
log message to read the log message.

Allow anyone in the logs group, or anyone with CAP_SYSLOG, to
read all log entries.

In addition, allow the client to upgrade log formats, so they
can get additional information from the kernel.

Change-Id: Ie48fb614b43c9302a07ad2673b78dd8749b492b6
Signed-off-by: Nick Kralevich <nnk@google.com>
Signed-off-by: zwliew <zhaoweiliew@gmail.com>

Conflicts:
	drivers/staging/android/logger.c
android: logger: enforce GID and CAP check on log flush

Restrict log flushing to those in the logs group, or
anyone with CAP_SYSLOG.

Change-Id: I5d6977d1c0d60ffe8487771cc195789e5db95454
Signed-off-by: Charndeep Grewal <csgrewa@tycho.ncsc.mil>
Signed-off-by: zwliew <zhaoweiliew@gmail.com>