You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge commit 'origin/master' into next
Manual merge of: arch/powerpc/include/asm/elf.h drivers/i2c/busses/i2c-mpc.c
This commit is contained in:
+20
-6
@@ -97,6 +97,20 @@ config LZO_COMPRESS
|
||||
config LZO_DECOMPRESS
|
||||
tristate
|
||||
|
||||
#
|
||||
# These all provide a common interface (hence the apparent duplication with
|
||||
# ZLIB_INFLATE; DECOMPRESS_GZIP is just a wrapper.)
|
||||
#
|
||||
config DECOMPRESS_GZIP
|
||||
select ZLIB_INFLATE
|
||||
tristate
|
||||
|
||||
config DECOMPRESS_BZIP2
|
||||
tristate
|
||||
|
||||
config DECOMPRESS_LZMA
|
||||
tristate
|
||||
|
||||
#
|
||||
# Generic allocator support is selected if needed
|
||||
#
|
||||
@@ -136,12 +150,6 @@ config TEXTSEARCH_BM
|
||||
config TEXTSEARCH_FSM
|
||||
tristate
|
||||
|
||||
#
|
||||
# plist support is select#ed if needed
|
||||
#
|
||||
config PLIST
|
||||
boolean
|
||||
|
||||
config HAS_IOMEM
|
||||
boolean
|
||||
depends on !NO_IOMEM
|
||||
@@ -174,4 +182,10 @@ config DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
|
||||
bool "Disable obsolete cpumask functions" if DEBUG_PER_CPU_MAPS
|
||||
depends on EXPERIMENTAL && BROKEN
|
||||
|
||||
#
|
||||
# Netlink attribute parsing support is select'ed if needed
|
||||
#
|
||||
config NLATTR
|
||||
bool
|
||||
|
||||
endmenu
|
||||
|
||||
+43
-33
@@ -402,7 +402,7 @@ config LOCKDEP
|
||||
bool
|
||||
depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
|
||||
select STACKTRACE
|
||||
select FRAME_POINTER if !X86 && !MIPS && !PPC
|
||||
select FRAME_POINTER if !X86 && !MIPS && !PPC && !ARM_UNWIND
|
||||
select KALLSYMS
|
||||
select KALLSYMS_ALL
|
||||
|
||||
@@ -847,60 +847,70 @@ config BUILD_DOCSRC
|
||||
|
||||
Say N if you are unsure.
|
||||
|
||||
config DYNAMIC_PRINTK_DEBUG
|
||||
bool "Enable dynamic printk() call support"
|
||||
config DYNAMIC_DEBUG
|
||||
bool "Enable dynamic printk() support"
|
||||
default n
|
||||
depends on PRINTK
|
||||
depends on DEBUG_FS
|
||||
select PRINTK_DEBUG
|
||||
help
|
||||
|
||||
Compiles debug level messages into the kernel, which would not
|
||||
otherwise be available at runtime. These messages can then be
|
||||
enabled/disabled on a per module basis. This mechanism implicitly
|
||||
enables all pr_debug() and dev_dbg() calls. The impact of this
|
||||
compile option is a larger kernel text size of about 2%.
|
||||
enabled/disabled based on various levels of scope - per source file,
|
||||
function, module, format string, and line number. This mechanism
|
||||
implicitly enables all pr_debug() and dev_dbg() calls. The impact of
|
||||
this compile option is a larger kernel text size of about 2%.
|
||||
|
||||
Usage:
|
||||
|
||||
Dynamic debugging is controlled by the debugfs file,
|
||||
dynamic_printk/modules. This file contains a list of the modules that
|
||||
can be enabled. The format of the file is the module name, followed
|
||||
by a set of flags that can be enabled. The first flag is always the
|
||||
'enabled' flag. For example:
|
||||
Dynamic debugging is controlled via the 'dynamic_debug/ddebug' file,
|
||||
which is contained in the 'debugfs' filesystem. Thus, the debugfs
|
||||
filesystem must first be mounted before making use of this feature.
|
||||
We refer the control file as: <debugfs>/dynamic_debug/ddebug. This
|
||||
file contains a list of the debug statements that can be enabled. The
|
||||
format for each line of the file is:
|
||||
|
||||
<module_name> <enabled=0/1>
|
||||
.
|
||||
.
|
||||
.
|
||||
filename:lineno [module]function flags format
|
||||
|
||||
<module_name> : Name of the module in which the debug call resides
|
||||
<enabled=0/1> : whether the messages are enabled or not
|
||||
filename : source file of the debug statement
|
||||
lineno : line number of the debug statement
|
||||
module : module that contains the debug statement
|
||||
function : function that contains the debug statement
|
||||
flags : 'p' means the line is turned 'on' for printing
|
||||
format : the format used for the debug statement
|
||||
|
||||
From a live system:
|
||||
|
||||
snd_hda_intel enabled=0
|
||||
fixup enabled=0
|
||||
driver enabled=0
|
||||
nullarbor:~ # cat <debugfs>/dynamic_debug/ddebug
|
||||
# filename:lineno [module]function flags format
|
||||
fs/aio.c:222 [aio]__put_ioctx - "__put_ioctx:\040freeing\040%p\012"
|
||||
fs/aio.c:248 [aio]ioctx_alloc - "ENOMEM:\040nr_events\040too\040high\012"
|
||||
fs/aio.c:1770 [aio]sys_io_cancel - "calling\040cancel\012"
|
||||
|
||||
Enable a module:
|
||||
Example usage:
|
||||
|
||||
$echo "set enabled=1 <module_name>" > dynamic_printk/modules
|
||||
// enable the message at line 1603 of file svcsock.c
|
||||
nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' >
|
||||
<debugfs>/dynamic_debug/ddebug
|
||||
|
||||
Disable a module:
|
||||
// enable all the messages in file svcsock.c
|
||||
nullarbor:~ # echo -n 'file svcsock.c +p' >
|
||||
<debugfs>/dynamic_debug/ddebug
|
||||
|
||||
$echo "set enabled=0 <module_name>" > dynamic_printk/modules
|
||||
// enable all the messages in the NFS server module
|
||||
nullarbor:~ # echo -n 'module nfsd +p' >
|
||||
<debugfs>/dynamic_debug/ddebug
|
||||
|
||||
Enable all modules:
|
||||
// enable all 12 messages in the function svc_process()
|
||||
nullarbor:~ # echo -n 'func svc_process +p' >
|
||||
<debugfs>/dynamic_debug/ddebug
|
||||
|
||||
$echo "set enabled=1 all" > dynamic_printk/modules
|
||||
// disable all 12 messages in the function svc_process()
|
||||
nullarbor:~ # echo -n 'func svc_process -p' >
|
||||
<debugfs>/dynamic_debug/ddebug
|
||||
|
||||
Disable all modules:
|
||||
|
||||
$echo "set enabled=0 all" > dynamic_printk/modules
|
||||
|
||||
Finally, passing "dynamic_printk" at the command line enables
|
||||
debugging for all modules. This mode can be turned off via the above
|
||||
disable command.
|
||||
See Documentation/dynamic-debug-howto.txt for additional information.
|
||||
|
||||
source "samples/Kconfig"
|
||||
|
||||
|
||||
+9
-3
@@ -11,7 +11,8 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \
|
||||
rbtree.o radix-tree.o dump_stack.o \
|
||||
idr.o int_sqrt.o extable.o prio_tree.o \
|
||||
sha1.o irq_regs.o reciprocal_div.o argv_split.o \
|
||||
proportions.o prio_heap.o ratelimit.o show_mem.o is_single_threaded.o
|
||||
proportions.o prio_heap.o ratelimit.o show_mem.o \
|
||||
is_single_threaded.o plist.o decompress.o
|
||||
|
||||
lib-$(CONFIG_MMU) += ioremap.o
|
||||
lib-$(CONFIG_SMP) += cpumask.o
|
||||
@@ -40,7 +41,6 @@ lib-$(CONFIG_GENERIC_FIND_NEXT_BIT) += find_next_bit.o
|
||||
lib-$(CONFIG_GENERIC_FIND_LAST_BIT) += find_last_bit.o
|
||||
obj-$(CONFIG_GENERIC_HWEIGHT) += hweight.o
|
||||
obj-$(CONFIG_LOCK_KERNEL) += kernel_lock.o
|
||||
obj-$(CONFIG_PLIST) += plist.o
|
||||
obj-$(CONFIG_DEBUG_PREEMPT) += smp_processor_id.o
|
||||
obj-$(CONFIG_DEBUG_LIST) += list_debug.o
|
||||
obj-$(CONFIG_DEBUG_OBJECTS) += debugobjects.o
|
||||
@@ -65,6 +65,10 @@ obj-$(CONFIG_REED_SOLOMON) += reed_solomon/
|
||||
obj-$(CONFIG_LZO_COMPRESS) += lzo/
|
||||
obj-$(CONFIG_LZO_DECOMPRESS) += lzo/
|
||||
|
||||
lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o
|
||||
lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o
|
||||
lib-$(CONFIG_DECOMPRESS_LZMA) += decompress_unlzma.o
|
||||
|
||||
obj-$(CONFIG_TEXTSEARCH) += textsearch.o
|
||||
obj-$(CONFIG_TEXTSEARCH_KMP) += ts_kmp.o
|
||||
obj-$(CONFIG_TEXTSEARCH_BM) += ts_bm.o
|
||||
@@ -82,7 +86,9 @@ obj-$(CONFIG_HAVE_LMB) += lmb.o
|
||||
|
||||
obj-$(CONFIG_HAVE_ARCH_TRACEHOOK) += syscall.o
|
||||
|
||||
obj-$(CONFIG_DYNAMIC_PRINTK_DEBUG) += dynamic_printk.o
|
||||
obj-$(CONFIG_DYNAMIC_DEBUG) += dynamic_debug.o
|
||||
|
||||
obj-$(CONFIG_NLATTR) += nlattr.o
|
||||
|
||||
hostprogs-y := gen_crc32table
|
||||
clean-files := crc32table.h
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* decompress.c
|
||||
*
|
||||
* Detect the decompression method based on magic number
|
||||
*/
|
||||
|
||||
#include <linux/decompress/generic.h>
|
||||
|
||||
#include <linux/decompress/bunzip2.h>
|
||||
#include <linux/decompress/unlzma.h>
|
||||
#include <linux/decompress/inflate.h>
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/string.h>
|
||||
|
||||
#ifndef CONFIG_DECOMPRESS_GZIP
|
||||
# define gunzip NULL
|
||||
#endif
|
||||
#ifndef CONFIG_DECOMPRESS_BZIP2
|
||||
# define bunzip2 NULL
|
||||
#endif
|
||||
#ifndef CONFIG_DECOMPRESS_LZMA
|
||||
# define unlzma NULL
|
||||
#endif
|
||||
|
||||
static const struct compress_format {
|
||||
unsigned char magic[2];
|
||||
const char *name;
|
||||
decompress_fn decompressor;
|
||||
} compressed_formats[] = {
|
||||
{ {037, 0213}, "gzip", gunzip },
|
||||
{ {037, 0236}, "gzip", gunzip },
|
||||
{ {0x42, 0x5a}, "bzip2", bunzip2 },
|
||||
{ {0x5d, 0x00}, "lzma", unlzma },
|
||||
{ {0, 0}, NULL, NULL }
|
||||
};
|
||||
|
||||
decompress_fn decompress_method(const unsigned char *inbuf, int len,
|
||||
const char **name)
|
||||
{
|
||||
const struct compress_format *cf;
|
||||
|
||||
if (len < 2)
|
||||
return NULL; /* Need at least this much... */
|
||||
|
||||
for (cf = compressed_formats; cf->name; cf++) {
|
||||
if (!memcmp(inbuf, cf->magic, 2))
|
||||
break;
|
||||
|
||||
}
|
||||
if (name)
|
||||
*name = cf->name;
|
||||
return cf->decompressor;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,167 @@
|
||||
#ifdef STATIC
|
||||
/* Pre-boot environment: included */
|
||||
|
||||
/* prevent inclusion of _LINUX_KERNEL_H in pre-boot environment: lots
|
||||
* errors about console_printk etc... on ARM */
|
||||
#define _LINUX_KERNEL_H
|
||||
|
||||
#include "zlib_inflate/inftrees.c"
|
||||
#include "zlib_inflate/inffast.c"
|
||||
#include "zlib_inflate/inflate.c"
|
||||
|
||||
#else /* STATIC */
|
||||
/* initramfs et al: linked */
|
||||
|
||||
#include <linux/zutil.h>
|
||||
|
||||
#include "zlib_inflate/inftrees.h"
|
||||
#include "zlib_inflate/inffast.h"
|
||||
#include "zlib_inflate/inflate.h"
|
||||
|
||||
#include "zlib_inflate/infutil.h"
|
||||
|
||||
#endif /* STATIC */
|
||||
|
||||
#include <linux/decompress/mm.h>
|
||||
|
||||
#define INBUF_LEN (16*1024)
|
||||
|
||||
/* Included from initramfs et al code */
|
||||
STATIC int INIT gunzip(unsigned char *buf, int len,
|
||||
int(*fill)(void*, unsigned int),
|
||||
int(*flush)(void*, unsigned int),
|
||||
unsigned char *out_buf,
|
||||
int *pos,
|
||||
void(*error_fn)(char *x)) {
|
||||
u8 *zbuf;
|
||||
struct z_stream_s *strm;
|
||||
int rc;
|
||||
size_t out_len;
|
||||
|
||||
set_error_fn(error_fn);
|
||||
rc = -1;
|
||||
if (flush) {
|
||||
out_len = 0x8000; /* 32 K */
|
||||
out_buf = malloc(out_len);
|
||||
} else {
|
||||
out_len = 0x7fffffff; /* no limit */
|
||||
}
|
||||
if (!out_buf) {
|
||||
error("Out of memory while allocating output buffer");
|
||||
goto gunzip_nomem1;
|
||||
}
|
||||
|
||||
if (buf)
|
||||
zbuf = buf;
|
||||
else {
|
||||
zbuf = malloc(INBUF_LEN);
|
||||
len = 0;
|
||||
}
|
||||
if (!zbuf) {
|
||||
error("Out of memory while allocating input buffer");
|
||||
goto gunzip_nomem2;
|
||||
}
|
||||
|
||||
strm = malloc(sizeof(*strm));
|
||||
if (strm == NULL) {
|
||||
error("Out of memory while allocating z_stream");
|
||||
goto gunzip_nomem3;
|
||||
}
|
||||
|
||||
strm->workspace = malloc(flush ? zlib_inflate_workspacesize() :
|
||||
sizeof(struct inflate_state));
|
||||
if (strm->workspace == NULL) {
|
||||
error("Out of memory while allocating workspace");
|
||||
goto gunzip_nomem4;
|
||||
}
|
||||
|
||||
if (len == 0)
|
||||
len = fill(zbuf, INBUF_LEN);
|
||||
|
||||
/* verify the gzip header */
|
||||
if (len < 10 ||
|
||||
zbuf[0] != 0x1f || zbuf[1] != 0x8b || zbuf[2] != 0x08) {
|
||||
if (pos)
|
||||
*pos = 0;
|
||||
error("Not a gzip file");
|
||||
goto gunzip_5;
|
||||
}
|
||||
|
||||
/* skip over gzip header (1f,8b,08... 10 bytes total +
|
||||
* possible asciz filename)
|
||||
*/
|
||||
strm->next_in = zbuf + 10;
|
||||
/* skip over asciz filename */
|
||||
if (zbuf[3] & 0x8) {
|
||||
while (strm->next_in[0])
|
||||
strm->next_in++;
|
||||
strm->next_in++;
|
||||
}
|
||||
strm->avail_in = len - (strm->next_in - zbuf);
|
||||
|
||||
strm->next_out = out_buf;
|
||||
strm->avail_out = out_len;
|
||||
|
||||
rc = zlib_inflateInit2(strm, -MAX_WBITS);
|
||||
|
||||
if (!flush) {
|
||||
WS(strm)->inflate_state.wsize = 0;
|
||||
WS(strm)->inflate_state.window = NULL;
|
||||
}
|
||||
|
||||
while (rc == Z_OK) {
|
||||
if (strm->avail_in == 0) {
|
||||
/* TODO: handle case where both pos and fill are set */
|
||||
len = fill(zbuf, INBUF_LEN);
|
||||
if (len < 0) {
|
||||
rc = -1;
|
||||
error("read error");
|
||||
break;
|
||||
}
|
||||
strm->next_in = zbuf;
|
||||
strm->avail_in = len;
|
||||
}
|
||||
rc = zlib_inflate(strm, 0);
|
||||
|
||||
/* Write any data generated */
|
||||
if (flush && strm->next_out > out_buf) {
|
||||
int l = strm->next_out - out_buf;
|
||||
if (l != flush(out_buf, l)) {
|
||||
rc = -1;
|
||||
error("write error");
|
||||
break;
|
||||
}
|
||||
strm->next_out = out_buf;
|
||||
strm->avail_out = out_len;
|
||||
}
|
||||
|
||||
/* after Z_FINISH, only Z_STREAM_END is "we unpacked it all" */
|
||||
if (rc == Z_STREAM_END) {
|
||||
rc = 0;
|
||||
break;
|
||||
} else if (rc != Z_OK) {
|
||||
error("uncompression error");
|
||||
rc = -1;
|
||||
}
|
||||
}
|
||||
|
||||
zlib_inflateEnd(strm);
|
||||
if (pos)
|
||||
/* add + 8 to skip over trailer */
|
||||
*pos = strm->next_in - zbuf+8;
|
||||
|
||||
gunzip_5:
|
||||
free(strm->workspace);
|
||||
gunzip_nomem4:
|
||||
free(strm);
|
||||
gunzip_nomem3:
|
||||
if (!buf)
|
||||
free(zbuf);
|
||||
gunzip_nomem2:
|
||||
if (flush)
|
||||
free(out_buf);
|
||||
gunzip_nomem1:
|
||||
return rc; /* returns Z_OK (0) if successful */
|
||||
}
|
||||
|
||||
#define decompress gunzip
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,414 +0,0 @@
|
||||
/*
|
||||
* lib/dynamic_printk.c
|
||||
*
|
||||
* make pr_debug()/dev_dbg() calls runtime configurable based upon their
|
||||
* their source module.
|
||||
*
|
||||
* Copyright (C) 2008 Red Hat, Inc., Jason Baron <jbaron@redhat.com>
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/fs.h>
|
||||
|
||||
extern struct mod_debug __start___verbose[];
|
||||
extern struct mod_debug __stop___verbose[];
|
||||
|
||||
struct debug_name {
|
||||
struct hlist_node hlist;
|
||||
struct hlist_node hlist2;
|
||||
int hash1;
|
||||
int hash2;
|
||||
char *name;
|
||||
int enable;
|
||||
int type;
|
||||
};
|
||||
|
||||
static int nr_entries;
|
||||
static int num_enabled;
|
||||
int dynamic_enabled = DYNAMIC_ENABLED_NONE;
|
||||
static struct hlist_head module_table[DEBUG_HASH_TABLE_SIZE] =
|
||||
{ [0 ... DEBUG_HASH_TABLE_SIZE-1] = HLIST_HEAD_INIT };
|
||||
static struct hlist_head module_table2[DEBUG_HASH_TABLE_SIZE] =
|
||||
{ [0 ... DEBUG_HASH_TABLE_SIZE-1] = HLIST_HEAD_INIT };
|
||||
static DECLARE_MUTEX(debug_list_mutex);
|
||||
|
||||
/* dynamic_printk_enabled, and dynamic_printk_enabled2 are bitmasks in which
|
||||
* bit n is set to 1 if any modname hashes into the bucket n, 0 otherwise. They
|
||||
* use independent hash functions, to reduce the chance of false positives.
|
||||
*/
|
||||
long long dynamic_printk_enabled;
|
||||
EXPORT_SYMBOL_GPL(dynamic_printk_enabled);
|
||||
long long dynamic_printk_enabled2;
|
||||
EXPORT_SYMBOL_GPL(dynamic_printk_enabled2);
|
||||
|
||||
/* returns the debug module pointer. */
|
||||
static struct debug_name *find_debug_module(char *module_name)
|
||||
{
|
||||
int i;
|
||||
struct hlist_head *head;
|
||||
struct hlist_node *node;
|
||||
struct debug_name *element;
|
||||
|
||||
element = NULL;
|
||||
for (i = 0; i < DEBUG_HASH_TABLE_SIZE; i++) {
|
||||
head = &module_table[i];
|
||||
hlist_for_each_entry_rcu(element, node, head, hlist)
|
||||
if (!strcmp(element->name, module_name))
|
||||
return element;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* returns the debug module pointer. */
|
||||
static struct debug_name *find_debug_module_hash(char *module_name, int hash)
|
||||
{
|
||||
struct hlist_head *head;
|
||||
struct hlist_node *node;
|
||||
struct debug_name *element;
|
||||
|
||||
element = NULL;
|
||||
head = &module_table[hash];
|
||||
hlist_for_each_entry_rcu(element, node, head, hlist)
|
||||
if (!strcmp(element->name, module_name))
|
||||
return element;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* caller must hold mutex*/
|
||||
static int __add_debug_module(char *mod_name, int hash, int hash2)
|
||||
{
|
||||
struct debug_name *new;
|
||||
char *module_name;
|
||||
int ret = 0;
|
||||
|
||||
if (find_debug_module(mod_name)) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
module_name = kmalloc(strlen(mod_name) + 1, GFP_KERNEL);
|
||||
if (!module_name) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
module_name = strcpy(module_name, mod_name);
|
||||
module_name[strlen(mod_name)] = '\0';
|
||||
new = kzalloc(sizeof(struct debug_name), GFP_KERNEL);
|
||||
if (!new) {
|
||||
kfree(module_name);
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
INIT_HLIST_NODE(&new->hlist);
|
||||
INIT_HLIST_NODE(&new->hlist2);
|
||||
new->name = module_name;
|
||||
new->hash1 = hash;
|
||||
new->hash2 = hash2;
|
||||
hlist_add_head_rcu(&new->hlist, &module_table[hash]);
|
||||
hlist_add_head_rcu(&new->hlist2, &module_table2[hash2]);
|
||||
nr_entries++;
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int unregister_dynamic_debug_module(char *mod_name)
|
||||
{
|
||||
struct debug_name *element;
|
||||
int ret = 0;
|
||||
|
||||
down(&debug_list_mutex);
|
||||
element = find_debug_module(mod_name);
|
||||
if (!element) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
hlist_del_rcu(&element->hlist);
|
||||
hlist_del_rcu(&element->hlist2);
|
||||
synchronize_rcu();
|
||||
kfree(element->name);
|
||||
if (element->enable)
|
||||
num_enabled--;
|
||||
kfree(element);
|
||||
nr_entries--;
|
||||
out:
|
||||
up(&debug_list_mutex);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(unregister_dynamic_debug_module);
|
||||
|
||||
int register_dynamic_debug_module(char *mod_name, int type, char *share_name,
|
||||
char *flags, int hash, int hash2)
|
||||
{
|
||||
struct debug_name *elem;
|
||||
int ret = 0;
|
||||
|
||||
down(&debug_list_mutex);
|
||||
elem = find_debug_module(mod_name);
|
||||
if (!elem) {
|
||||
if (__add_debug_module(mod_name, hash, hash2))
|
||||
goto out;
|
||||
elem = find_debug_module(mod_name);
|
||||
if (dynamic_enabled == DYNAMIC_ENABLED_ALL &&
|
||||
!strcmp(mod_name, share_name)) {
|
||||
elem->enable = true;
|
||||
num_enabled++;
|
||||
}
|
||||
}
|
||||
elem->type |= type;
|
||||
out:
|
||||
up(&debug_list_mutex);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(register_dynamic_debug_module);
|
||||
|
||||
int __dynamic_dbg_enabled_helper(char *mod_name, int type, int value, int hash)
|
||||
{
|
||||
struct debug_name *elem;
|
||||
int ret = 0;
|
||||
|
||||
if (dynamic_enabled == DYNAMIC_ENABLED_ALL)
|
||||
return 1;
|
||||
rcu_read_lock();
|
||||
elem = find_debug_module_hash(mod_name, hash);
|
||||
if (elem && elem->enable)
|
||||
ret = 1;
|
||||
rcu_read_unlock();
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__dynamic_dbg_enabled_helper);
|
||||
|
||||
static void set_all(bool enable)
|
||||
{
|
||||
struct debug_name *e;
|
||||
struct hlist_node *node;
|
||||
int i;
|
||||
long long enable_mask;
|
||||
|
||||
for (i = 0; i < DEBUG_HASH_TABLE_SIZE; i++) {
|
||||
if (module_table[i].first != NULL) {
|
||||
hlist_for_each_entry(e, node, &module_table[i], hlist) {
|
||||
e->enable = enable;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (enable)
|
||||
enable_mask = ULLONG_MAX;
|
||||
else
|
||||
enable_mask = 0;
|
||||
dynamic_printk_enabled = enable_mask;
|
||||
dynamic_printk_enabled2 = enable_mask;
|
||||
}
|
||||
|
||||
static int disabled_hash(int i, bool first_table)
|
||||
{
|
||||
struct debug_name *e;
|
||||
struct hlist_node *node;
|
||||
|
||||
if (first_table) {
|
||||
hlist_for_each_entry(e, node, &module_table[i], hlist) {
|
||||
if (e->enable)
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
hlist_for_each_entry(e, node, &module_table2[i], hlist2) {
|
||||
if (e->enable)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static ssize_t pr_debug_write(struct file *file, const char __user *buf,
|
||||
size_t length, loff_t *ppos)
|
||||
{
|
||||
char *buffer, *s, *value_str, *setting_str;
|
||||
int err, value;
|
||||
struct debug_name *elem = NULL;
|
||||
int all = 0;
|
||||
|
||||
if (length > PAGE_SIZE || length < 0)
|
||||
return -EINVAL;
|
||||
|
||||
buffer = (char *)__get_free_page(GFP_KERNEL);
|
||||
if (!buffer)
|
||||
return -ENOMEM;
|
||||
|
||||
err = -EFAULT;
|
||||
if (copy_from_user(buffer, buf, length))
|
||||
goto out;
|
||||
|
||||
err = -EINVAL;
|
||||
if (length < PAGE_SIZE)
|
||||
buffer[length] = '\0';
|
||||
else if (buffer[PAGE_SIZE-1])
|
||||
goto out;
|
||||
|
||||
err = -EINVAL;
|
||||
down(&debug_list_mutex);
|
||||
|
||||
if (strncmp("set", buffer, 3))
|
||||
goto out_up;
|
||||
s = buffer + 3;
|
||||
setting_str = strsep(&s, "=");
|
||||
if (s == NULL)
|
||||
goto out_up;
|
||||
setting_str = strstrip(setting_str);
|
||||
value_str = strsep(&s, " ");
|
||||
if (s == NULL)
|
||||
goto out_up;
|
||||
s = strstrip(s);
|
||||
if (!strncmp(s, "all", 3))
|
||||
all = 1;
|
||||
else
|
||||
elem = find_debug_module(s);
|
||||
if (!strncmp(setting_str, "enable", 6)) {
|
||||
value = !!simple_strtol(value_str, NULL, 10);
|
||||
if (all) {
|
||||
if (value) {
|
||||
set_all(true);
|
||||
num_enabled = nr_entries;
|
||||
dynamic_enabled = DYNAMIC_ENABLED_ALL;
|
||||
} else {
|
||||
set_all(false);
|
||||
num_enabled = 0;
|
||||
dynamic_enabled = DYNAMIC_ENABLED_NONE;
|
||||
}
|
||||
err = 0;
|
||||
} else if (elem) {
|
||||
if (value && (elem->enable == 0)) {
|
||||
dynamic_printk_enabled |= (1LL << elem->hash1);
|
||||
dynamic_printk_enabled2 |= (1LL << elem->hash2);
|
||||
elem->enable = 1;
|
||||
num_enabled++;
|
||||
dynamic_enabled = DYNAMIC_ENABLED_SOME;
|
||||
err = 0;
|
||||
printk(KERN_DEBUG
|
||||
"debugging enabled for module %s\n",
|
||||
elem->name);
|
||||
} else if (!value && (elem->enable == 1)) {
|
||||
elem->enable = 0;
|
||||
num_enabled--;
|
||||
if (disabled_hash(elem->hash1, true))
|
||||
dynamic_printk_enabled &=
|
||||
~(1LL << elem->hash1);
|
||||
if (disabled_hash(elem->hash2, false))
|
||||
dynamic_printk_enabled2 &=
|
||||
~(1LL << elem->hash2);
|
||||
if (num_enabled)
|
||||
dynamic_enabled = DYNAMIC_ENABLED_SOME;
|
||||
else
|
||||
dynamic_enabled = DYNAMIC_ENABLED_NONE;
|
||||
err = 0;
|
||||
printk(KERN_DEBUG
|
||||
"debugging disabled for module %s\n",
|
||||
elem->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!err)
|
||||
err = length;
|
||||
out_up:
|
||||
up(&debug_list_mutex);
|
||||
out:
|
||||
free_page((unsigned long)buffer);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void *pr_debug_seq_start(struct seq_file *f, loff_t *pos)
|
||||
{
|
||||
return (*pos < DEBUG_HASH_TABLE_SIZE) ? pos : NULL;
|
||||
}
|
||||
|
||||
static void *pr_debug_seq_next(struct seq_file *s, void *v, loff_t *pos)
|
||||
{
|
||||
(*pos)++;
|
||||
if (*pos >= DEBUG_HASH_TABLE_SIZE)
|
||||
return NULL;
|
||||
return pos;
|
||||
}
|
||||
|
||||
static void pr_debug_seq_stop(struct seq_file *s, void *v)
|
||||
{
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
static int pr_debug_seq_show(struct seq_file *s, void *v)
|
||||
{
|
||||
struct hlist_head *head;
|
||||
struct hlist_node *node;
|
||||
struct debug_name *elem;
|
||||
unsigned int i = *(loff_t *) v;
|
||||
|
||||
rcu_read_lock();
|
||||
head = &module_table[i];
|
||||
hlist_for_each_entry_rcu(elem, node, head, hlist) {
|
||||
seq_printf(s, "%s enabled=%d", elem->name, elem->enable);
|
||||
seq_printf(s, "\n");
|
||||
}
|
||||
rcu_read_unlock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct seq_operations pr_debug_seq_ops = {
|
||||
.start = pr_debug_seq_start,
|
||||
.next = pr_debug_seq_next,
|
||||
.stop = pr_debug_seq_stop,
|
||||
.show = pr_debug_seq_show
|
||||
};
|
||||
|
||||
static int pr_debug_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
return seq_open(filp, &pr_debug_seq_ops);
|
||||
}
|
||||
|
||||
static const struct file_operations pr_debug_operations = {
|
||||
.open = pr_debug_open,
|
||||
.read = seq_read,
|
||||
.write = pr_debug_write,
|
||||
.llseek = seq_lseek,
|
||||
.release = seq_release,
|
||||
};
|
||||
|
||||
static int __init dynamic_printk_init(void)
|
||||
{
|
||||
struct dentry *dir, *file;
|
||||
struct mod_debug *iter;
|
||||
unsigned long value;
|
||||
|
||||
dir = debugfs_create_dir("dynamic_printk", NULL);
|
||||
if (!dir)
|
||||
return -ENOMEM;
|
||||
file = debugfs_create_file("modules", 0644, dir, NULL,
|
||||
&pr_debug_operations);
|
||||
if (!file) {
|
||||
debugfs_remove(dir);
|
||||
return -ENOMEM;
|
||||
}
|
||||
for (value = (unsigned long)__start___verbose;
|
||||
value < (unsigned long)__stop___verbose;
|
||||
value += sizeof(struct mod_debug)) {
|
||||
iter = (struct mod_debug *)value;
|
||||
register_dynamic_debug_module(iter->modname,
|
||||
iter->type,
|
||||
iter->logical_modname,
|
||||
iter->flag_names, iter->hash, iter->hash2);
|
||||
}
|
||||
if (dynamic_enabled == DYNAMIC_ENABLED_ALL)
|
||||
set_all(true);
|
||||
return 0;
|
||||
}
|
||||
module_init(dynamic_printk_init);
|
||||
/* may want to move this earlier so we can get traces as early as possible */
|
||||
|
||||
static int __init dynamic_printk_setup(char *str)
|
||||
{
|
||||
if (str)
|
||||
return -ENOENT;
|
||||
dynamic_enabled = DYNAMIC_ENABLED_ALL;
|
||||
return 0;
|
||||
}
|
||||
/* Use early_param(), so we can get debug output as early as possible */
|
||||
early_param("dynamic_printk", dynamic_printk_setup);
|
||||
+1
-1
@@ -39,7 +39,7 @@ static __cacheline_aligned_in_smp DEFINE_SPINLOCK(kernel_flag);
|
||||
int __lockfunc __reacquire_kernel_lock(void)
|
||||
{
|
||||
while (!_raw_spin_trylock(&kernel_flag)) {
|
||||
if (test_thread_flag(TIF_NEED_RESCHED))
|
||||
if (need_resched())
|
||||
return -EAGAIN;
|
||||
cpu_relax();
|
||||
}
|
||||
|
||||
+1
-1
@@ -212,7 +212,7 @@ static int kobject_add_internal(struct kobject *kobj)
|
||||
* @fmt: format string used to build the name
|
||||
* @vargs: vargs to format the string.
|
||||
*/
|
||||
static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
|
||||
int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
|
||||
va_list vargs)
|
||||
{
|
||||
const char *old_name = kobj->name;
|
||||
|
||||
+11
-1
@@ -118,6 +118,13 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
|
||||
kset = top_kobj->kset;
|
||||
uevent_ops = kset->uevent_ops;
|
||||
|
||||
/* skip the event, if uevent_suppress is set*/
|
||||
if (kobj->uevent_suppress) {
|
||||
pr_debug("kobject: '%s' (%p): %s: uevent_suppress "
|
||||
"caused the event to drop!\n",
|
||||
kobject_name(kobj), kobj, __func__);
|
||||
return 0;
|
||||
}
|
||||
/* skip the event, if the filter returns zero. */
|
||||
if (uevent_ops && uevent_ops->filter)
|
||||
if (!uevent_ops->filter(kset, kobj)) {
|
||||
@@ -227,6 +234,9 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
|
||||
NETLINK_CB(skb).dst_group = 1;
|
||||
retval = netlink_broadcast(uevent_sock, skb, 0, 1,
|
||||
GFP_KERNEL);
|
||||
/* ENOBUFS should be handled in userspace */
|
||||
if (retval == -ENOBUFS)
|
||||
retval = 0;
|
||||
} else
|
||||
retval = -ENOMEM;
|
||||
}
|
||||
@@ -248,7 +258,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
|
||||
goto exit;
|
||||
|
||||
retval = call_usermodehelper(argv[0], argv,
|
||||
env->envp, UMH_WAIT_EXEC);
|
||||
env->envp, UMH_NO_WAIT);
|
||||
}
|
||||
|
||||
exit:
|
||||
|
||||
+502
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,6 @@
|
||||
#ifndef INFLATE_H
|
||||
#define INFLATE_H
|
||||
|
||||
/* inflate.h -- internal inflate state definition
|
||||
* Copyright (C) 1995-2004 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
@@ -105,3 +108,4 @@ struct inflate_state {
|
||||
unsigned short work[288]; /* work area for code table building */
|
||||
code codes[ENOUGH]; /* space for code tables */
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef INFTREES_H
|
||||
#define INFTREES_H
|
||||
|
||||
/* inftrees.h -- header to use inftrees.c
|
||||
* Copyright (C) 1995-2005 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
@@ -53,3 +56,4 @@ typedef enum {
|
||||
extern int zlib_inflate_table (codetype type, unsigned short *lens,
|
||||
unsigned codes, code **table,
|
||||
unsigned *bits, unsigned short *work);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user