28 Oct, 2020

1 commit

  • iov_iter based variant for reading a seq_file. seq_read is
    reimplemented on top of the iter variant.

    Bug: 171770067
    Link: https://lore.kernel.org/r/20201027080745.GA31045@infradead.org
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Greg Kroah-Hartman
    Change-Id: I216f87fbe072a1e3a41c597df574c43d6d21ba80

    Christoph Hellwig
     

05 Jun, 2020

1 commit

  • Patch series "seq_file: Introduce DEFINE_SEQ_ATTRIBUTE() helper macro".

    As discussed in
    https://lore.kernel.org/lkml/20191129222310.GA3712618@kroah.com/, we could
    introduce a new helper macro to reduce losts of boilerplate code, vmstat
    and kprobes is the example which covert to use it, if this is accepted, I
    will send out more cleanups.

    This patch (of 3):

    Introduce DEFINE_SEQ_ATTRIBUTE() helper macro to decrease code duplication.

    [akpm@linux-foundation.org: coding style fixes]
    Signed-off-by: Kefeng Wang
    Signed-off-by: Andrew Morton
    Cc: Greg KH
    Cc: Ingo Molnar
    Cc: Kefeng Wang
    Cc: Anil S Keshavamurthy
    Cc: "David S. Miller"
    Cc: Masami Hiramatsu
    Cc: Al Viro
    Link: http://lkml.kernel.org/r/20200509064031.181091-1-wangkefeng.wang@huawei.com
    Link: http://lkml.kernel.org/r/20200509064031.181091-2-wangkefeng.wang@huawei.com
    Signed-off-by: Linus Torvalds

    Kefeng Wang
     

08 Apr, 2020

1 commit

  • The process maps file was the only user of version (introduced back in
    2005). Now that it uses ppos instead, we can remove it.

    Signed-off-by: Matthew Wilcox (Oracle)
    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Andrew Morton
    Link: http://lkml.kernel.org/r/20200317193201.9924-4-adobriyan@gmail.com
    Signed-off-by: Linus Torvalds

    Matthew Wilcox (Oracle)
     

04 Feb, 2020

1 commit

  • The most notable change is DEFINE_SHOW_ATTRIBUTE macro split in
    seq_file.h.

    Conversion rule is:

    llseek => proc_lseek
    unlocked_ioctl => proc_ioctl

    xxx => proc_xxx

    delete ".owner = THIS_MODULE" line

    [akpm@linux-foundation.org: fix drivers/isdn/capi/kcapi_proc.c]
    [sfr@canb.auug.org.au: fix kernel/sched/psi.c]
    Link: http://lkml.kernel.org/r/20200122180545.36222f50@canb.auug.org.au
    Link: http://lkml.kernel.org/r/20191225172546.GB13378@avx2
    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Stephen Rothwell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

04 Jul, 2019

1 commit

  • I'm exposing some information about NFS clients in pseudofiles. I
    expect to eventually have simple tools to help read those pseudofiles.

    But it's also helpful if the raw files are human-readable to the extent
    possible. It aids debugging and makes them usable on systems that don't
    have the latest nfs-utils.

    A minor challenge there is opaque client-generated protocol objects like
    state owners and client identifiers. Some clients generate those to
    include handy information in plain ascii. But they may also include
    arbitrary byte sequences.

    I think the simplest approach is to limit to isprint(c) && isascii(c)
    and escape everything else.

    That means you can just cat the file and get something that looks OK.
    Also, I'm trying to keep these files legal YAML, which requires them to
    UTF-8, and this is a simple way to guarantee that.

    Acked-by: Kees Cook
    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

12 Apr, 2018

3 commits

  • For fine-grained debugging and usercopy protection.

    Link: http://lkml.kernel.org/r/20180310085027.GA17121@avx2
    Signed-off-by: Alexey Dobriyan
    Reviewed-by: Andrew Morton
    Cc: Al Viro
    Cc: Glauber Costa
    Cc: Vladimir Davydov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     
  • seq_put_decimal_ull_w(m, str, val, width) prints a decimal number with a
    specified minimal field width.

    It is equivalent of seq_printf(m, "%s%*d", str, width, val), but it
    works much faster.

    == test_smaps.py
    num = 0
    with open("/proc/1/smaps") as f:
    for x in xrange(10000):
    data = f.read()
    f.seek(0, 0)
    ==

    == Before patch ==
    $ time python test_smaps.py
    real 0m4.593s
    user 0m0.398s
    sys 0m4.158s

    == After patch ==
    $ time python test_smaps.py
    real 0m3.828s
    user 0m0.413s
    sys 0m3.408s

    $ perf -g record python test_smaps.py
    == Before patch ==
    - 79.01% 3.36% python [kernel.kallsyms] [k] show_smap.isra.33
    - 75.65% show_smap.isra.33
    + 48.85% seq_printf
    + 15.75% __walk_page_range
    + 9.70% show_map_vma.isra.23
    0.61% seq_puts

    == After patch ==
    - 75.51% 4.62% python [kernel.kallsyms] [k] show_smap.isra.33
    - 70.88% show_smap.isra.33
    + 24.82% seq_put_decimal_ull_w
    + 19.78% __walk_page_range
    + 12.74% seq_printf
    + 11.08% show_map_vma.isra.23
    + 1.68% seq_puts

    [akpm@linux-foundation.org: fix drivers/of/unittest.c build]
    Link: http://lkml.kernel.org/r/20180212074931.7227-1-avagin@openvz.org
    Signed-off-by: Andrei Vagin
    Cc: Alexey Dobriyan
    Cc: KAMEZAWA Hiroyuki
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrei Vagin
     
  • seq_put_hex_ll() prints a number in hexadecimal notation and works
    faster than seq_printf().

    == test.py
    num = 0
    with open("/proc/1/maps") as f:
    while num < 10000 :
    data = f.read()
    f.seek(0, 0)
    num = num + 1
    ==

    == Before patch ==
    $ time python test.py

    real 0m1.561s
    user 0m0.257s
    sys 0m1.302s

    == After patch ==
    $ time python test.py

    real 0m0.986s
    user 0m0.279s
    sys 0m0.707s

    $ perf -g record python test.py:

    == Before patch ==
    - 67.42% 2.82% python [kernel.kallsyms] [k] show_map_vma.isra.22
    - 64.60% show_map_vma.isra.22
    - 44.98% seq_printf
    - seq_vprintf
    - vsnprintf
    + 14.85% number
    + 12.22% format_decode
    5.56% memcpy_erms
    + 15.06% seq_path
    + 4.42% seq_pad
    + 2.45% __GI___libc_read

    == After patch ==
    - 47.35% 3.38% python [kernel.kallsyms] [k] show_map_vma.isra.23
    - 43.97% show_map_vma.isra.23
    + 20.84% seq_path
    - 15.73% show_vma_header_prefix
    10.55% seq_put_hex_ll
    + 2.65% seq_put_decimal_ull
    0.95% seq_putc
    + 6.96% seq_pad
    + 2.94% __GI___libc_read

    [avagin@openvz.org: use unsigned int instead of int where it is suitable]
    Link: http://lkml.kernel.org/r/20180214025619.4005-1-avagin@openvz.org
    [avagin@openvz.org: v2]
    Link: http://lkml.kernel.org/r/20180117082050.25406-1-avagin@openvz.org
    Link: http://lkml.kernel.org/r/20180112185812.7710-1-avagin@openvz.org
    Signed-off-by: Andrei Vagin
    Cc: Alexey Dobriyan
    Cc: KAMEZAWA Hiroyuki
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrei Vagin
     

07 Feb, 2018

1 commit


02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

08 Oct, 2016

1 commit

  • Allow some seq_puts removals by taking a string instead of a single
    char.

    [akpm@linux-foundation.org: update vmstat_show(), per Joe]
    Link: http://lkml.kernel.org/r/667e1cf3d436de91a5698170a1e98d882905e956.1470704995.git.joe@perches.com
    Signed-off-by: Joe Perches
    Cc: Joe Perches
    Cc: Andi Kleen
    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

15 Apr, 2016

1 commit

  • A lot of seqfile users seem to be using things like %pK that uses the
    credentials of the current process, but that is actually completely
    wrong for filesystem interfaces.

    The unix semantics for permission checking files is to check permissions
    at _open_ time, not at read or write time, and that is not just a small
    detail: passing off stdin/stdout/stderr to a suid application and making
    the actual IO happen in privileged context is a classic exploit
    technique.

    So if we want to be able to look at permissions at read time, we need to
    use the file open credentials, not the current ones. Normal file
    accesses can just use "f_cred" (or any of the helper functions that do
    that, like file_ns_capable()), but the seqfile interfaces do not have
    any such options.

    It turns out that seq_file _does_ save away the user_ns information of
    the file, though. Since user_ns is just part of the full credential
    information, replace that special case with saving off the cred pointer
    instead, and suddenly seq_file has all the permission information it
    needs.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

12 Sep, 2015

1 commit

  • The seq_ function return values were frequently misused.

    See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
    seq_has_overflowed() and make public")

    All uses of these return values have been removed, so convert the
    return types to void.

    Miscellanea:

    o Move seq_put_decimal_ and seq_escape prototypes closer the
    other seq_vprintf prototypes
    o Reorder seq_putc and seq_puts to return early on overflow
    o Add argument names to seq_vprintf and seq_printf
    o Update the seq_escape kernel-doc
    o Convert a couple of leading spaces to tabs in seq_escape

    Signed-off-by: Joe Perches
    Cc: Al Viro
    Cc: Steven Rostedt
    Cc: Mark Brown
    Cc: Stephen Rothwell
    Cc: Joerg Roedel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

11 Sep, 2015

1 commit

  • This introduces a new helper and switches current users to use it. All
    patches are compiled tested. kmemleak is tested via its own test suite.

    This patch (of 6):

    The new seq_hex_dump() is a complete analogue of print_hex_dump().

    We have few users of this functionality already. It allows to reduce their
    codebase.

    Signed-off-by: Andy Shevchenko
    Cc: Alexander Viro
    Cc: Joe Perches
    Cc: Tadeusz Struk
    Cc: Helge Deller
    Cc: Ingo Tuchscherer
    Cc: Catalin Marinas
    Cc: Vladimir Kondratiev
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Shevchenko
     

05 Sep, 2015

1 commit

  • Many file systems that implement the show_options hook fail to correctly
    escape their output which could lead to unescaped characters (e.g. new
    lines) leaking into /proc/mounts and /proc/[pid]/mountinfo files. This
    could lead to confusion, spoofed entries (resulting in things like
    systemd issuing false d-bus "mount" notifications), and who knows what
    else. This looks like it would only be the root user stepping on
    themselves, but it's possible weird things could happen in containers or
    in other situations with delegated mount privileges.

    Here's an example using overlay with setuid fusermount trusting the
    contents of /proc/mounts (via the /etc/mtab symlink). Imagine the use
    of "sudo" is something more sneaky:

    $ BASE="ovl"
    $ MNT="$BASE/mnt"
    $ LOW="$BASE/lower"
    $ UP="$BASE/upper"
    $ WORK="$BASE/work/ 0 0
    none /proc fuse.pwn user_id=1000"
    $ mkdir -p "$LOW" "$UP" "$WORK"
    $ sudo mount -t overlay -o "lowerdir=$LOW,upperdir=$UP,workdir=$WORK" none /mnt
    $ cat /proc/mounts
    none /root/ovl/mnt overlay rw,relatime,lowerdir=ovl/lower,upperdir=ovl/upper,workdir=ovl/work/ 0 0
    none /proc fuse.pwn user_id=1000 0 0
    $ fusermount -u /proc
    $ cat /proc/mounts
    cat: /proc/mounts: No such file or directory

    This fixes the problem by adding new seq_show_option and
    seq_show_option_n helpers, and updating the vulnerable show_option
    handlers to use them as needed. Some, like SELinux, need to be open
    coded due to unusual existing escape mechanisms.

    [akpm@linux-foundation.org: add lost chunk, per Kees]
    [keescook@chromium.org: seq_show_option should be using const parameters]
    Signed-off-by: Kees Cook
    Acked-by: Serge Hallyn
    Acked-by: Jan Kara
    Acked-by: Paul Moore
    Cc: J. R. Okajima
    Signed-off-by: Kees Cook
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kees Cook
     

24 Jun, 2015

1 commit


14 Feb, 2015

1 commit

  • Now that all bitmap formatting usages have been converted to
    '%*pb[l]', the separate formatting functions are unnecessary. The
    following functions are removed.

    * bitmap_scn[list]printf()
    * cpumask_scnprintf(), cpulist_scnprintf()
    * [__]nodemask_scnprintf(), [__]nodelist_scnprintf()
    * seq_bitmap[_list](), seq_cpumask[_list](), seq_nodemask[_list]()
    * seq_buf_bitmask()

    Signed-off-by: Tejun Heo
    Cc: Rusty Russell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tejun Heo
     

30 Oct, 2014

1 commit

  • The return values of seq_printf/puts/putc are frequently misused.

    Start down a path to remove all the return value uses of these
    functions.

    Move the seq_overflow() to a global inlined function called
    seq_has_overflowed() that can be used by the users of seq_file() calls.

    Update the documentation to not show return types for seq_printf
    et al. Add a description of seq_has_overflowed().

    Link: http://lkml.kernel.org/p/848ac7e3d1c31cddf638a8526fa3c59fa6fdeb8a.1412031505.git.joe@perches.com

    Cc: Al Viro
    Signed-off-by: Joe Perches
    [ Reworked the original patch from Joe ]
    Signed-off-by: Steven Rostedt

    Joe Perches
     

15 Nov, 2013

1 commit

  • There are several users who want to know bytes written by seq_*() for
    alignment purpose. Currently they are using %n format for knowing it
    because seq_*() returns 0 on success.

    This patch introduces seq_setwidth() and seq_pad() for allowing them to
    align without using %n format.

    Signed-off-by: Tetsuo Handa
    Signed-off-by: Kees Cook
    Cc: Joe Perches
    Cc: David Miller
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tetsuo Handa
     

08 Jul, 2013

1 commit

  • When we convert the file_lock_list to a set of percpu lists, we'll need
    a way to iterate over them in order to output /proc/locks info. Add
    some seq_list_*_percpu helpers to handle that.

    Signed-off-by: Jeff Layton
    Acked-by: J. Bruce Fields
    Signed-off-by: Al Viro

    Jeff Layton
     

10 Apr, 2013

1 commit

  • Same as single_open(), but preallocates the buffer of given size.
    Doesn't make any sense for sizes up to PAGE_SIZE and doesn't make
    sense if output of show() exceeds PAGE_SIZE only rarely - seq_read()
    will take care of growing the buffer and redoing show(). If you
    _know_ that it will be large, it might make more sense to look into
    saner iterator, rather than go with single-shot one. If that's
    impossible, single_open_size() might be for you.

    Again, don't use that without a good reason; occasionally that's really
    the best way to go, but very often there are better solutions.

    Signed-off-by: Al Viro

    Al Viro
     

15 Aug, 2012

1 commit

  • struct file already has a user namespace associated with it
    in file->f_cred->user_ns, unfortunately because struct
    seq_file has no struct file backpointer associated with
    it, it is difficult to get at the user namespace in seq_file
    context. Therefore add a helper function seq_user_ns to return
    the associated user namespace and a user_ns field to struct
    seq_file to be used in implementing seq_user_ns.

    Cc: Al Viro
    Cc: Eric Dumazet
    Cc: KAMEZAWA Hiroyuki
    Cc: Alexey Dobriyan
    Acked-by: David S. Miller
    Acked-by: Serge Hallyn
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     

11 Jun, 2012

1 commit

  • The existing seq_printf function is rewritten in terms of the new
    seq_vprintf which is also exported to modules. This allows GFS2
    (and potentially other seq_file users) to have a vprintf based
    interface and to avoid an extra copy into a temporary buffer in
    some cases.

    Signed-off-by: Steven Whitehouse
    Reported-by: Eric Dumazet
    Acked-by: Al Viro

    Steven Whitehouse
     

25 Mar, 2012

1 commit

  • Pull cleanup from Paul Gortmaker:
    "The changes shown here are to unify linux's BUG support under the one
    file. Due to historical reasons, we have some BUG code
    in bug.h and some in kernel.h -- i.e. the support for BUILD_BUG in
    linux/kernel.h predates the addition of linux/bug.h, but old code in
    kernel.h wasn't moved to bug.h at that time. As a band-aid, kernel.h
    was including to pseudo link them.

    This has caused confusion[1] and general yuck/WTF[2] reactions. Here
    is an example that violates the principle of least surprise:

    CC lib/string.o
    lib/string.c: In function 'strlcat':
    lib/string.c:225:2: error: implicit declaration of function 'BUILD_BUG_ON'
    make[2]: *** [lib/string.o] Error 1
    $
    $ grep linux/bug.h lib/string.c
    #include
    $

    We've included for the BUG infrastructure and yet we
    still get a compile fail! [We've not kernel.h for BUILD_BUG_ON.] Ugh -
    very confusing for someone who is new to kernel development.

    With the above in mind, the goals of this changeset are:

    1) find and fix any include/*.h files that were relying on the
    implicit presence of BUG code.
    2) find and fix any C files that were consuming kernel.h and hence
    relying on implicitly getting some/all BUG code.
    3) Move the BUG related code living in kernel.h to
    4) remove the asm/bug.h from kernel.h to finally break the chain.

    During development, the order was more like 3-4, build-test, 1-2. But
    to ensure that git history for bisect doesn't get needless build
    failures introduced, the commits have been reorderd to fix the problem
    areas in advance.

    [1] https://lkml.org/lkml/2012/1/3/90
    [2] https://lkml.org/lkml/2012/1/17/414"

    Fix up conflicts (new radeon file, reiserfs header cleanups) as per Paul
    and linux-next.

    * tag 'bug-for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux:
    kernel.h: doesn't explicitly use bug.h, so don't include it.
    bug: consolidate BUILD_BUG_ON with other bug code
    BUG: headers with BUG/BUG_ON etc. need linux/bug.h
    bug.h: add include of it to various implicit C users
    lib: fix implicit users of kernel.h for TAINT_WARN
    spinlock: macroize assert_spin_locked to avoid bug.h dependency
    x86: relocate get/set debugreg fcns to include/asm/debugreg.

    Linus Torvalds
     

24 Mar, 2012

2 commits

  • Process accounting applications as top, ps visit some files under
    /proc/. With seq_put_decimal_ull(), we can optimize /proc//stat
    and /proc//statm files.

    This patch adds
    - seq_put_decimal_ll() for signed values.
    - allow delimiter == 0.
    - convert seq_printf() to seq_put_decimal_ull/ll in /proc/stat, statm.

    Test result on a system with 2000+ procs.

    Before patch:
    [kamezawa@bluextal test]$ top -b -n 1 | wc -l
    2223
    [kamezawa@bluextal test]$ time top -b -n 1 > /dev/null

    real 0m0.675s
    user 0m0.044s
    sys 0m0.121s

    [kamezawa@bluextal test]$ time ps -elf > /dev/null

    real 0m0.236s
    user 0m0.056s
    sys 0m0.176s

    After patch:
    kamezawa@bluextal ~]$ time top -b -n 1 > /dev/null

    real 0m0.657s
    user 0m0.052s
    sys 0m0.100s

    [kamezawa@bluextal ~]$ time ps -elf > /dev/null

    real 0m0.198s
    user 0m0.050s
    sys 0m0.145s

    Considering top, ps tend to scan /proc periodically, this will reduce cpu
    consumption by top/ps to some extent.

    [akpm@linux-foundation.org: checkpatch fixes]
    Signed-off-by: KAMEZAWA Hiroyuki
    Cc: Alexey Dobriyan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KAMEZAWA Hiroyuki
     
  • == stat_check.py
    num = 0
    with open("/proc/stat") as f:
    while num < 1000 :
    data = f.read()
    f.seek(0, 0)
    num = num + 1
    ==

    perf shows

    20.39% stat_check.py [kernel.kallsyms] [k] format_decode
    13.41% stat_check.py [kernel.kallsyms] [k] number
    12.61% stat_check.py [kernel.kallsyms] [k] vsnprintf
    10.85% stat_check.py [kernel.kallsyms] [k] memcpy
    4.85% stat_check.py [kernel.kallsyms] [k] radix_tree_lookup
    4.43% stat_check.py [kernel.kallsyms] [k] seq_printf

    This patch removes most of calls to vsnprintf() by adding num_to_str()
    and seq_print_decimal_ull(), which prints decimal numbers without rich
    functions provided by printf().

    On my 8cpu box.
    == Before patch ==
    [root@bluextal test]# time ./stat_check.py

    real 0m0.150s
    user 0m0.026s
    sys 0m0.121s

    == After patch ==
    [root@bluextal test]# time ./stat_check.py

    real 0m0.055s
    user 0m0.022s
    sys 0m0.030s

    [akpm@linux-foundation.org: remove incorrect comment, use less statck in num_to_str(), move comment from .h to .c, simplify seq_put_decimal_ull()]
    [andrea@betterlinux.com: avoid breaking the ABI in /proc/stat]
    Signed-off-by: KAMEZAWA Hiroyuki
    Signed-off-by: Andrea Righi
    Cc: Eric Dumazet
    Cc: Glauber Costa
    Cc: Peter Zijlstra
    Cc: Ingo Molnar
    Cc: Paul Turner
    Cc: Russell King
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KAMEZAWA Hiroyuki
     

05 Mar, 2012

1 commit

  • If a header file is making use of BUG, BUG_ON, BUILD_BUG_ON, or any
    other BUG variant in a static inline (i.e. not in a #define) then
    that header really should be including and not just
    expecting it to be implicitly present.

    We can make this change risk-free, since if the files using these
    headers didn't have exposure to linux/bug.h already, they would have
    been causing compile failures/warnings.

    Signed-off-by: Paul Gortmaker

    Paul Gortmaker
     

04 Jan, 2012

1 commit


01 Nov, 2011

1 commit

  • Standardize the style for compiler based printf format verification.
    Standardized the location of __printf too.

    Done via script and a little typing.

    $ grep -rPl --include=*.[ch] -w "__attribute__" * | \
    grep -vP "^(tools|scripts|include/linux/compiler-gcc.h)" | \
    xargs perl -n -i -e 'local $/; while (<>) { s/\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf\s*,\s*(.+)\s*,\s*(.+)\s*\)\s*\)\s*\)/__printf($1, $2)/g ; print; }'

    [akpm@linux-foundation.org: revert arch bits]
    Signed-off-by: Joe Perches
    Cc: "Kirill A. Shutemov"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

21 Jul, 2011

1 commit

  • Moving the event counter into the dynamically allocated 'struc seq_file'
    allows poll() support without the need to allocate its own tracking
    structure.

    All current users are switched over to use the new counter.

    Requested-by: Andrew Morton akpm@linux-foundation.org
    Acked-by: NeilBrown
    Tested-by: Lucas De Marchi lucas.demarchi@profusion.mobi
    Signed-off-by: Kay Sievers
    Signed-off-by: Al Viro

    Kay Sievers
     

23 Feb, 2010

1 commit


11 Feb, 2010

1 commit


24 Sep, 2009

1 commit

  • Add two helpers that allow access to the seq_file's own buffer, but
    hide the internal details of seq_files.

    This allows easier implementation of special purpose filling
    functions. It also cleans up some existing functions which duplicated
    the seq_file logic.

    Make these inline functions in seq_file.h, as suggested by Al.

    Signed-off-by: Miklos Szeredi
    Acked-by: Hugh Dickins
    Signed-off-by: Al Viro

    Miklos Szeredi
     

19 Jun, 2009

1 commit

  • seq_write() can be used to construct seq_files containing arbitrary data.
    Required by the gcov-profiling interface to synthesize binary profiling
    data files.

    Signed-off-by: Peter Oberparleiter
    Cc: Andi Kleen
    Cc: Huang Ying
    Cc: Li Wei
    Cc: Michael Ellerman
    Cc: Ingo Molnar
    Cc: Heiko Carstens
    Cc: Martin Schwidefsky
    Cc: Rusty Russell
    Cc: WANG Cong
    Cc: Sam Ravnborg
    Cc: Jeff Dike
    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Oberparleiter
     

30 Mar, 2009

1 commit


19 Feb, 2009

1 commit

  • Currently seq_read assumes that the offset passed to it is always the
    offset it passed to user space. In the case pread this assumption is
    broken and we do the wrong thing when presented with pread.

    To solve this I introduce an offset cache inside of struct seq_file so we
    know where our logical file position is. Then in seq_read if we try to
    read from another offset we reset our data structures and attempt to go to
    the offset user space wanted.

    [akpm@linux-foundation.org: restore FMODE_PWRITE]
    [pjt@google.com: seq_open needs its fmode opened up to take advantage of this]
    Signed-off-by: Eric Biederman
    Cc: Alexey Dobriyan
    Cc: Al Viro
    Cc: Paul Turner
    Cc: [2.6.25.x, 2.6.26.x, 2.6.27.x, 2.6.28.x]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Biederman
     

30 Dec, 2008

2 commits

  • Impact: cleanup, futureproof

    nr_cpu_ids is the (badly named) runtime limit on possible CPU numbers;
    ie. the variable version of NR_CPUS.

    With the new cpumask operators, only bits less than this are defined.
    So we should use it everywhere, rather than NR_CPUS. Eventually this
    will make it possible to allocate cpumasks of the minimal length at runtime.

    Signed-off-by: Rusty Russell
    Signed-off-by: Mike Travis
    Acked-by: Ingo Molnar

    Rusty Russell
     
  • Impact: cleanup

    seq_bitmap just calls bitmap_scnprintf on the bits: that arg can be const.
    Similarly, seq_cpumask just calls seq_bitmap.

    Signed-off-by: Rusty Russell

    Rusty Russell
     

23 Nov, 2008

1 commit


20 Oct, 2008

1 commit