Example #1
0
def dump_index(opts, args):
    summary = collections.defaultdict(set)
    for (key, val) in fsop.get_ops("*", *args):
        for (vfs, impl) in val.iteritems():
            summary[vfs].add(key[0])

    def __ranked(summary):
        return sorted(summary.items(), key=lambda a: len(a[1]), reverse=True)

    for (vfs, fs) in __ranked(summary):
        print "%-20s (%2d): %s" % (vfs, len(fs), ", ".join(sorted(fs)[:10]))
Example #2
0
def dump_index(opts, args):
    summary = collections.defaultdict(set)
    for (key, val) in fsop.get_ops("*", *args):
        for (vfs, impl) in val.iteritems():
            summary[vfs].add(key[0])

    def __ranked(summary):
        return sorted(summary.items(), key=lambda a: len(a[1]), reverse=True)

    for (vfs, fs) in __ranked(summary):
        print "%-20s (%2d): %s" % (vfs, len(fs), ", ".join(sorted(fs)[:10]))
Example #3
0
def count_path_by_funcs(target_funcs, k0, k1):
    res = {}

    matches = fsop.get_ops("*", "*")
    for keys, func_dict in matches:
        fs = keys[0]
        for tf in target_funcs:
            func = func_dict.get(tf, None)
            if func and k0 == keys[1] and k1 == keys[2]:
                res[fs] = func


    fs_list = ["btrfs","ext2","ext3","ext4","fat","jfs","reiserfs","xfs"]

    for fs in fs_list:
        func = res.get(fs, None)
        if func:
            print count_fs("%s @ %s" % (fs, func), [func])
        else:
            print "%s is missing" % fs
    return
Example #4
0
def count_path_by_funcs(target_funcs, k0, k1):
    res = {}

    matches = fsop.get_ops("*", "*")
    for keys, func_dict in matches:
        fs = keys[0]
        for tf in target_funcs:
            func = func_dict.get(tf, None)
            if func and k0 == keys[1] and k1 == keys[2]:
                res[fs] = func

    fs_list = [
        "btrfs", "ext2", "ext3", "ext4", "fat", "jfs", "reiserfs", "xfs"
    ]

    for fs in fs_list:
        func = res.get(fs, None)
        if func:
            print count_fs("%s @ %s" % (fs, func), [func])
        else:
            print "%s is missing" % fs
    return
Example #5
0
if __name__ == "__main__":
    parser = optparse.OptionParser()
    parser.add_option("--linux", help="Linux kernel", default=LINUX)
    parser.add_option("--fs", help="List of fs", default=None)
    parser.add_option("--func", help="List of func", default=None)
    parser.add_option("--line", help="List of code to show", default=30)
    parser.add_option("--index", help="List of summary of funcs",
                      action="store_true", default=None)
    (opts, args) = parser.parse_args()

    fs = "*"
    if opts.fs:
        fs = opts.fs.split(",")

    func = None
    if opts.func:
        func = opts.func.split(",")

    if opts.index:
        dump_index(opts, args)
        exit(0)

    for (key, val) in fsop.get_ops(fs, *args):
        for (vfs, impl) in val.iteritems():
            if func is None or vfs in func:
                print "/".join(key), vfs, impl
                print "-" * 80
                search(key[0], impl, opts.line)


Example #6
0
if __name__ == "__main__":
    parser = optparse.OptionParser()
    parser.add_option("--linux", help="Linux kernel", default=LINUX)
    parser.add_option("--fs", help="List of fs", default=None)
    parser.add_option("--func", help="List of func", default=None)
    parser.add_option("--line", help="List of code to show", default=30)
    parser.add_option("--index",
                      help="List of summary of funcs",
                      action="store_true",
                      default=None)
    (opts, args) = parser.parse_args()

    fs = "*"
    if opts.fs:
        fs = opts.fs.split(",")

    func = None
    if opts.func:
        func = opts.func.split(",")

    if opts.index:
        dump_index(opts, args)
        exit(0)

    for (key, val) in fsop.get_ops(fs, *args):
        for (vfs, impl) in val.iteritems():
            if func is None or vfs in func:
                print "/".join(key), vfs, impl
                print "-" * 80
                search(key[0], impl, opts.line)