[PATCH] treewide: fix semicolon.cocci warnings
net/netfilter/x_tables.c:716:59-60: Unneeded semicolon Remove unneeded semicolon. Generated by: scripts/coccinelle/misc/semicolon.cocci Signed-off-by: Fengguang Wu--- x_tables.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c @@ -713,7 +713,7 @@ EXPORT_SYMBOL(xt_check_entry_offsets); unsigned int *xt_alloc_entry_offsets(unsigned int size) { if (size < (SIZE_MAX / sizeof(unsigned int))) - return kvmalloc(size * sizeof(unsigned int), GFP_KERNEL);; + return kvmalloc(size * sizeof(unsigned int), GFP_KERNEL); return NULL; -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH nft 2/2] tests: shell: add maps tests
Test adding elements to simple and interval maps. Signed-off-by: Elise Lennion--- .../testcases/maps/0003map_add_many_elements_0 | 61 .../testcases/maps/0004interval_map_create_once_0 | 60 .../maps/0005interval_map_add_many_elements_0 | 66 ++ .../testcases/maps/0006interval_map_overlap_0 | 41 ++ 4 files changed, 228 insertions(+) create mode 100755 tests/shell/testcases/maps/0003map_add_many_elements_0 create mode 100755 tests/shell/testcases/maps/0004interval_map_create_once_0 create mode 100755 tests/shell/testcases/maps/0005interval_map_add_many_elements_0 create mode 100755 tests/shell/testcases/maps/0006interval_map_overlap_0 diff --git a/tests/shell/testcases/maps/0003map_add_many_elements_0 b/tests/shell/testcases/maps/0003map_add_many_elements_0 new file mode 100755 index 000..a2233e3 --- /dev/null +++ b/tests/shell/testcases/maps/0003map_add_many_elements_0 @@ -0,0 +1,61 @@ +#!/bin/bash + +# test adding many map elements + +HOWMANY=31 + +tmpfile=$(mktemp) +if [ ! -w $tmpfile ] ; then + echo "Failed to create tmp file" >&2 + exit 0 +fi + +trap "rm -rf $tmpfile" EXIT # cleanup if aborted + +generate_add() { + echo -n "{" + for ((i=HOWMANY; i>=1; i--)) ; do + for ((j=HOWMANY; j>=1; j--)) ; do + [ "$i" == 1 ] && [ "$j" == 1 ] && break + echo -n "10.0.${i}.${j} : 10.0.${i}.${j}, " + done + done + echo -n "}" +} + +generate_test() { + elements="" + for ((i=1; i<=HOWMANY; i++)) ; do + for ((j=1; j<=HOWMANY; j++)) ; do + elements="$elements 10.0.${i}.${j} : 10.0.${i}.${j}" + [ "$i" == "$HOWMANY" ] && [ "$j" == "$HOWMANY" ] && break + elements="${elements}, " + done + done + echo $elements +} + +echo "add table x +add map x y { type ipv4_addr : ipv4_addr; } +add element x y $(generate_add)" > $tmpfile + +set -e +$NFT -f $tmpfile + +n=$HOWMANY +echo "add element x y { 10.0.1.1 : 10.0.1.1 }" > $tmpfile +$NFT -f $tmpfile + +EXPECTED="table ip x { + map y { + type ipv4_addr : ipv4_addr + elements = { $(generate_test)} + } +}" +GET=$($NFT list ruleset) +if [ "$EXPECTED" != "$GET" ] ; then + DIFF="$(which diff)" + [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET") + exit 1 +fi + diff --git a/tests/shell/testcases/maps/0004interval_map_create_once_0 b/tests/shell/testcases/maps/0004interval_map_create_once_0 new file mode 100755 index 000..7d4877e --- /dev/null +++ b/tests/shell/testcases/maps/0004interval_map_create_once_0 @@ -0,0 +1,60 @@ +#!/bin/bash + +# test adding many elements to an interval map +# this always works because nft is only called once + +HOWMANY=63 + +tmpfile=$(mktemp) +if [ ! -w $tmpfile ] ; then + echo "Failed to create tmp file" >&2 + exit 0 +fi + +trap "rm -rf $tmpfile" EXIT # cleanup if aborted + +generate_add() { + echo -n "{" + for ((i=1; i<=HOWMANY; i++)) ; do + for ((j=1; j<=HOWMANY; j++)) ; do + echo -n "10.${i}.${j}.0/24 : 10.0.${i}.${j}" + [ "$i" == "$HOWMANY" ] && [ "$j" == "$HOWMANY" ] && break + echo -n ", " + done + done + echo -n "}" +} + +generate_test() { + elements="" + for ((i=1; i<=HOWMANY; i++)) ; do + for ((j=1; j<=HOWMANY; j++)) ; do + elements="$elements 10.${i}.${j}.0/24 : 10.0.${i}.${j}" + [ "$i" == "$HOWMANY" ] && [ "$j" == "$HOWMANY" ] && break + elements="${elements}, " + done + done + echo $elements +} + +echo "add table x +add map x y { type ipv4_addr : ipv4_addr; flags interval; } +add element x y $(generate_add)" > $tmpfile + +set -e +$NFT -f $tmpfile + +EXPECTED="table ip x { + map y { + type ipv4_addr : ipv4_addr + flags interval + elements = { $(generate_test)} + } +}" +GET=$($NFT list ruleset) +if [ "$EXPECTED" != "$GET" ] ; then + DIFF="$(which diff)" + [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET") + exit 1 +fi + diff --git a/tests/shell/testcases/maps/0005interval_map_add_many_elements_0 b/tests/shell/testcases/maps/0005interval_map_add_many_elements_0 new file mode 100755 index 000..824f2c8 --- /dev/null +++ b/tests/shell/testcases/maps/0005interval_map_add_many_elements_0 @@ -0,0 +1,66 @@ +#!/bin/bash + +# test adding many elements to an interval map +# even with HOWMANY=2 there are memory allocation failures in the current +# master - the patch fixes that +# NOTE this is only an issue with two separate nft calls + +HOWMANY=2 + +tmpfile=$(mktemp) +if [ ! -w $tmpfile ] ; then + echo
[PATCH nft 1/2] src: sort set elements in netlink_get_setelems()
So users can better track their ruleset via git. Without sorting, the elements can be listed in a different order every time the set is created, generating unnecessary git changes. Mergesort is used. Doesn't sort sets with 'flags interval' set on. Signed-off-by: Elise Lennion--- include/expression.h | 1 + src/Makefile.am | 1 + src/mergesort.c | 100 +++ src/netlink.c| 4 +++ 4 files changed, 106 insertions(+) create mode 100644 src/mergesort.c diff --git a/include/expression.h b/include/expression.h index 71e9c43..ec90265 100644 --- a/include/expression.h +++ b/include/expression.h @@ -396,6 +396,7 @@ extern struct expr *range_expr_alloc(const struct location *loc, extern void compound_expr_add(struct expr *compound, struct expr *expr); extern void compound_expr_remove(struct expr *compound, struct expr *expr); +extern void list_expr_sort(struct list_head *head); extern struct expr *concat_expr_alloc(const struct location *loc); diff --git a/src/Makefile.am b/src/Makefile.am index 2a69e19..65cb4b4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -53,6 +53,7 @@ nft_SOURCES = main.c \ mnl.c \ iface.c \ services.c \ + mergesort.c \ scanner.l \ parser_bison.y diff --git a/src/mergesort.c b/src/mergesort.c new file mode 100644 index 000..a835320 --- /dev/null +++ b/src/mergesort.c @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2017 Elise Lennion + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include + +static int expr_msort_cmp(const struct expr *e1, const struct expr *e2); + +static int concat_expr_msort_cmp(const struct expr *e1, const struct expr *e2) +{ + struct list_head *l = (>expressions)->next; + const struct expr *i1, *i2; + int ret; + + list_for_each_entry(i1, >expressions, list) { + i2 = list_entry(l, typeof(struct expr), list); + + ret = expr_msort_cmp(i1, i2); + if (ret) + return ret; + + l = l->next; + } + + return false; +} + +static int expr_msort_cmp(const struct expr *e1, const struct expr *e2) +{ + switch (e1->ops->type) { + case EXPR_SET_ELEM: + return expr_msort_cmp(e1->key, e2->key); + case EXPR_VALUE: + return mpz_cmp(e1->value, e2->value); + case EXPR_CONCAT: + return concat_expr_msort_cmp(e1, e2); + case EXPR_MAPPING: + return expr_msort_cmp(e1->left, e2->left); + default: + BUG("Unknown expression %s\n", e1->ops->name); + } +} + +static void list_splice_sorted(struct list_head *list, struct list_head *head) +{ + struct list_head *h = head->next; + struct list_head *l = list->next; + + while (l != list) { + if (h == head || + expr_msort_cmp(list_entry(l, typeof(struct expr), list), + list_entry(h, typeof(struct expr), list)) < 0) { + l = l->next; + list_add_tail(l->prev, h); + continue; + } + + h = h->next; + } +} + +static void list_cut_middle(struct list_head *list, struct list_head *head) +{ + struct list_head *s = head->next; + struct list_head *e = head->prev; + + while (e != s) { + e = e->prev; + + if (e != s) + s = s->next; + } + + __list_cut_position(list, head, s); +} + +void list_expr_sort(struct list_head *head) +{ + struct list_head *list; + LIST_HEAD(temp); + + list = + + if (list_empty(head) || list_is_singular(head)) + return; + + list_cut_middle(list, head); + + list_expr_sort(head); + list_expr_sort(list); + + list_splice_sorted(list, head); +} diff --git a/src/netlink.c b/src/netlink.c index 5f478ff..4135f25 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -1666,6 +1666,10 @@ int netlink_get_setelems(struct netlink_ctx *ctx, const struct handle *h, ctx->set = set; set->init = set_expr_alloc(loc); nftnl_set_elem_foreach(nls, list_setelem_cb, ctx); + + if (!(set->flags & NFT_SET_INTERVAL)) + list_expr_sort(>set->init->expressions); + nftnl_set_free(nls); ctx->set = NULL; -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to
Re: [PATCH v2 4/7] x86: put msr-index.h in uapi
On Fri, Jan 6, 2017 at 11:43 AM, Nicolas Dichtelwrote: > This header file is exported, thus move it to uapi. Just hint for the future: -M (move) -C (copy) -D (delete) [though this is NOT for applying] -- With Best Regards, Andy Shevchenko -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 1/2] netfilter: use fwmark_reflect in nf_send_reset
Otherwise, RST packets generated by ipt_REJECT always have mark 0 when the routing is checked later in the same code path. Fixes: e110861f8609 ("net: add a sysctl to reflect the fwmark on replies") Cc: Lorenzo ColittiSigned-off-by: Pau Espin Pedrol --- net/ipv4/netfilter/nf_reject_ipv4.c | 2 ++ net/ipv6/netfilter/nf_reject_ipv6.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/net/ipv4/netfilter/nf_reject_ipv4.c b/net/ipv4/netfilter/nf_reject_ipv4.c index fd8220213afc..146d86105183 100644 --- a/net/ipv4/netfilter/nf_reject_ipv4.c +++ b/net/ipv4/netfilter/nf_reject_ipv4.c @@ -126,6 +126,8 @@ void nf_send_reset(struct net *net, struct sk_buff *oldskb, int hook) /* ip_route_me_harder expects skb->dst to be set */ skb_dst_set_noref(nskb, skb_dst(oldskb)); + nskb->mark = IP4_REPLY_MARK(net, oldskb->mark); + skb_reserve(nskb, LL_MAX_HEADER); niph = nf_reject_iphdr_put(nskb, oldskb, IPPROTO_TCP, ip4_dst_hoplimit(skb_dst(nskb))); diff --git a/net/ipv6/netfilter/nf_reject_ipv6.c b/net/ipv6/netfilter/nf_reject_ipv6.c index 10090400c72f..eedee5d108d9 100644 --- a/net/ipv6/netfilter/nf_reject_ipv6.c +++ b/net/ipv6/netfilter/nf_reject_ipv6.c @@ -157,6 +157,7 @@ void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook) fl6.fl6_sport = otcph->dest; fl6.fl6_dport = otcph->source; fl6.flowi6_oif = l3mdev_master_ifindex(skb_dst(oldskb)->dev); + fl6.flowi6_mark = IP6_REPLY_MARK(net, oldskb->mark); security_skb_classify_flow(oldskb, flowi6_to_flowi()); dst = ip6_route_output(net, NULL, ); if (dst->error) { @@ -180,6 +181,8 @@ void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook) skb_dst_set(nskb, dst); + nskb->mark = fl6.flowi6_mark; + skb_reserve(nskb, hh_len + dst->header_len); ip6h = nf_reject_ip6hdr_put(nskb, oldskb, IPPROTO_TCP, ip6_dst_hoplimit(dst)); -- 2.11.0 -- -- DISCLAIMER. This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 2/2] tcp: fix mark propagation with fwmark_reflect enabled
From: Pau Espin PedrolOtherwise, RST packets generated by the TCP stack for non-existing sockets always have mark 0. The mark from the original packet is assigned to the netns_ipv4/6 socket used to send the response so that it can get copied into the response skb when the socket sends it. Fixes: e110861f8609 ("net: add a sysctl to reflect the fwmark on replies") Cc: Lorenzo Colitti Signed-off-by: Pau Espin Pedrol --- net/ipv4/ip_output.c | 1 + net/ipv6/tcp_ipv6.c | 1 + 2 files changed, 2 insertions(+) diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index fac275c48108..b67719f45953 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -1629,6 +1629,7 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, sk->sk_protocol = ip_hdr(skb)->protocol; sk->sk_bound_dev_if = arg->bound_dev_if; sk->sk_sndbuf = sysctl_wmem_default; + sk->sk_mark = fl4.flowi4_mark; err = ip_append_data(sk, , ip_reply_glue_bits, arg->iov->iov_base, len, 0, , , MSG_DONTWAIT); if (unlikely(err)) { diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 73bc8fc68acd..2b20622a5824 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -840,6 +840,7 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32 dst = ip6_dst_lookup_flow(ctl_sk, , NULL); if (!IS_ERR(dst)) { skb_dst_set(buff, dst); + ctl_sk->sk_mark = fl6.flowi6_mark; ip6_xmit(ctl_sk, buff, , NULL, tclass); TCP_INC_STATS(net, TCP_MIB_OUTSEGS); if (rst) -- 2.11.0 -- -- DISCLAIMER. This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 4/7] x86: put msr-index.h in uapi
On Fri, Jan 06, 2017 at 10:43:56AM +0100, Nicolas Dichtel wrote: > This header file is exported, thus move it to uapi. It should rather not be exported - please remove it from arch/x86/include/uapi/asm/Kbuild instead. Thanks. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 7/7] uapi: export all headers under uapi directories
Regularly, when a new header is created in include/uapi/, the developer forgets to add it in the corresponding Kbuild file. This error is usually detected after the release is out. In fact, all headers under uapi directories should be exported, thus it's useless to have an exhaustive list. After this patch, the following files, which were not exported, are now exported (with make headers_install_all): asm-unicore32/shmparam.h asm-unicore32/ucontext.h asm-hexagon/shmparam.h asm-mips/ucontext.h asm-mips/hwcap.h asm-mips/reg.h drm/vgem_drm.h drm/armada_drm.h drm/omap_drm.h drm/etnaviv_drm.h asm-tile/shmparam.h asm-blackfin/shmparam.h asm-blackfin/ucontext.h asm-powerpc/perf_regs.h rdma/qedr-abi.h asm-parisc/kvm_para.h asm-openrisc/shmparam.h asm-nios2/kvm_para.h asm-nios2/ucontext.h asm-sh/kvm_para.h asm-sh/ucontext.h asm-xtensa/kvm_para.h asm-avr32/kvm_para.h asm-m32r/kvm_para.h asm-h8300/shmparam.h asm-h8300/ucontext.h asm-metag/kvm_para.h asm-metag/shmparam.h asm-metag/ucontext.h asm-m68k/kvm_para.h asm-m68k/shmparam.h linux/bcache.h linux/kvm.h linux/kvm_para.h linux/kfd_ioctl.h linux/cryptouser.h linux/kcm.h linux/kcov.h linux/seg6_iptunnel.h linux/stm.h linux/genwqe linux/genwqe/.install linux/genwqe/genwqe_card.h linux/genwqe/..install.cmd linux/seg6.h linux/cifs linux/cifs/.install linux/cifs/cifs_mount.h linux/cifs/..install.cmd linux/auto_dev-ioctl.h Thanks to Julien Floretfor the tip to get all subdirs with a pure makefile command. Signed-off-by: Nicolas Dichtel --- Documentation/kbuild/makefiles.txt | 41 ++- arch/alpha/include/uapi/asm/Kbuild | 41 --- arch/arc/include/uapi/asm/Kbuild| 3 - arch/arm/include/uapi/asm/Kbuild| 17 - arch/arm64/include/uapi/asm/Kbuild | 18 -- arch/avr32/include/uapi/asm/Kbuild | 20 -- arch/blackfin/include/uapi/asm/Kbuild | 17 - arch/c6x/include/uapi/asm/Kbuild| 8 - arch/cris/include/uapi/arch-v10/arch/Kbuild | 5 - arch/cris/include/uapi/arch-v32/arch/Kbuild | 3 - arch/cris/include/uapi/asm/Kbuild | 43 +-- arch/frv/include/uapi/asm/Kbuild| 33 -- arch/h8300/include/uapi/asm/Kbuild | 28 -- arch/hexagon/include/asm/Kbuild | 3 - arch/hexagon/include/uapi/asm/Kbuild| 13 - arch/ia64/include/uapi/asm/Kbuild | 45 --- arch/m32r/include/uapi/asm/Kbuild | 31 -- arch/m68k/include/uapi/asm/Kbuild | 24 -- arch/metag/include/uapi/asm/Kbuild | 8 - arch/microblaze/include/uapi/asm/Kbuild | 32 -- arch/mips/include/uapi/asm/Kbuild | 37 --- arch/mn10300/include/uapi/asm/Kbuild| 32 -- arch/nios2/include/uapi/asm/Kbuild | 4 +- arch/openrisc/include/asm/Kbuild| 3 - arch/openrisc/include/uapi/asm/Kbuild | 8 - arch/parisc/include/uapi/asm/Kbuild | 28 -- arch/powerpc/include/uapi/asm/Kbuild| 45 --- arch/s390/include/uapi/asm/Kbuild | 52 --- arch/score/include/asm/Kbuild | 4 - arch/score/include/uapi/asm/Kbuild | 32 -- arch/sh/include/uapi/asm/Kbuild | 23 -- arch/sparc/include/uapi/asm/Kbuild | 48 --- arch/tile/include/asm/Kbuild| 3 - arch/tile/include/uapi/arch/Kbuild | 17 - arch/tile/include/uapi/asm/Kbuild | 19 +- arch/unicore32/include/uapi/asm/Kbuild | 6 - arch/x86/include/uapi/asm/Kbuild| 59 arch/xtensa/include/uapi/asm/Kbuild | 23 -- include/Kbuild | 2 - include/asm-generic/Kbuild.asm | 1 - include/scsi/fc/Kbuild | 0 include/uapi/Kbuild | 15 - include/uapi/asm-generic/Kbuild | 36 --- include/uapi/asm-generic/Kbuild.asm | 62 ++-- include/uapi/drm/Kbuild | 22 -- include/uapi/linux/Kbuild | 482 include/uapi/linux/android/Kbuild | 2 - include/uapi/linux/byteorder/Kbuild | 3 - include/uapi/linux/caif/Kbuild | 3 - include/uapi/linux/can/Kbuild | 6 - include/uapi/linux/dvb/Kbuild | 9 - include/uapi/linux/hdlc/Kbuild | 2 - include/uapi/linux/hsi/Kbuild | 2 - include/uapi/linux/iio/Kbuild | 3 - include/uapi/linux/isdn/Kbuild | 2 - include/uapi/linux/mmc/Kbuild | 2 - include/uapi/linux/netfilter/Kbuild | 89 - include/uapi/linux/netfilter/ipset/Kbuild | 5 - include/uapi/linux/netfilter_arp/Kbuild | 3 - include/uapi/linux/netfilter_bridge/Kbuild | 18 -- include/uapi/linux/netfilter_ipv4/Kbuild| 10 - include/uapi/linux/netfilter_ipv6/Kbuild| 13 - include/uapi/linux/nfsd/Kbuild | 6 - include/uapi/linux/raid/Kbuild
[PATCH v2 2/7] h8300: put bitsperlong.h in uapi
This header file is exported, thus move it to uapi. Signed-off-by: Nicolas Dichtel--- arch/h8300/include/asm/bitsperlong.h | 10 +- arch/h8300/include/uapi/asm/bitsperlong.h | 14 ++ 2 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 arch/h8300/include/uapi/asm/bitsperlong.h diff --git a/arch/h8300/include/asm/bitsperlong.h b/arch/h8300/include/asm/bitsperlong.h index e140e46729ac..c0a8e2ee531e 100644 --- a/arch/h8300/include/asm/bitsperlong.h +++ b/arch/h8300/include/asm/bitsperlong.h @@ -1,14 +1,6 @@ #ifndef __ASM_H8300_BITS_PER_LONG #define __ASM_H8300_BITS_PER_LONG -#include - -#if !defined(__ASSEMBLY__) -/* h8300-unknown-linux required long */ -#define __kernel_size_t __kernel_size_t -typedef unsigned long __kernel_size_t; -typedef long __kernel_ssize_t; -typedef long __kernel_ptrdiff_t; -#endif +#include #endif /* __ASM_H8300_BITS_PER_LONG */ diff --git a/arch/h8300/include/uapi/asm/bitsperlong.h b/arch/h8300/include/uapi/asm/bitsperlong.h new file mode 100644 index ..e56cf72369b6 --- /dev/null +++ b/arch/h8300/include/uapi/asm/bitsperlong.h @@ -0,0 +1,14 @@ +#ifndef _UAPI_ASM_H8300_BITS_PER_LONG +#define _UAPI_ASM_H8300_BITS_PER_LONG + +#include + +#if !defined(__ASSEMBLY__) +/* h8300-unknown-linux required long */ +#define __kernel_size_t __kernel_size_t +typedef unsigned long __kernel_size_t; +typedef long __kernel_ssize_t; +typedef long __kernel_ptrdiff_t; +#endif + +#endif /* _UAPI_ASM_H8300_BITS_PER_LONG */ -- 2.8.1 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 6/7] Makefile.headersinst: remove destination-y option
This option was added in commit c7bb349e7c25 ("kbuild: introduce destination-y for exported headers") but never used in-tree. Signed-off-by: Nicolas Dichtel--- Documentation/kbuild/makefiles.txt | 23 --- scripts/Makefile.headersinst | 2 +- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 9b9c4797fc55..37b525d329ae 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt @@ -46,9 +46,8 @@ This document describes the Linux kernel Makefiles. === 7 Kbuild syntax for exported headers --- 7.1 header-y --- 7.2 genhdr-y - --- 7.3 destination-y - --- 7.4 generic-y - --- 7.5 generated-y + --- 7.3 generic-y + --- 7.4 generated-y === 8 Kbuild Variables === 9 Makefile language @@ -1295,21 +1294,7 @@ See subsequent chapter for the syntax of the Kbuild file. #include/linux/Kbuild genhdr-y += version.h - --- 7.3 destination-y - - When an architecture has a set of exported headers that needs to be - exported to a different directory destination-y is used. - destination-y specifies the destination directory for all exported - headers in the file where it is present. - - Example: - #arch/xtensa/platforms/s6105/include/platform/Kbuild - destination-y := include/linux - - In the example above all exported headers in the Kbuild file - will be located in the directory "include/linux" when exported. - - --- 7.4 generic-y + --- 7.3 generic-y If an architecture uses a verbatim copy of a header from include/asm-generic then this is listed in the file @@ -1336,7 +1321,7 @@ See subsequent chapter for the syntax of the Kbuild file. Example: termios.h #include - --- 7.5 generated-y + --- 7.4 generated-y If an architecture generates other header files alongside generic-y wrappers, and not included in genhdr-y, then generated-y specifies diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 3e20d03432d2..876b42cfede4 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst @@ -14,7 +14,7 @@ kbuild-file := $(srctree)/$(obj)/Kbuild include $(kbuild-file) # called may set destination dir (when installing to asm/) -_dst := $(if $(destination-y),$(destination-y),$(if $(dst),$(dst),$(obj))) +_dst := $(if $(dst),$(dst),$(obj)) old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild ifneq ($(wildcard $(old-kbuild-file)),) -- 2.8.1 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 3/7] nios2: put setup.h in uapi
This header file is exported, thus move it to uapi. Signed-off-by: Nicolas Dichtel--- arch/nios2/include/asm/setup.h | 2 +- arch/nios2/include/uapi/asm/setup.h | 6 ++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 arch/nios2/include/uapi/asm/setup.h diff --git a/arch/nios2/include/asm/setup.h b/arch/nios2/include/asm/setup.h index dcbf8cf1a344..d49e9e91bf55 100644 --- a/arch/nios2/include/asm/setup.h +++ b/arch/nios2/include/asm/setup.h @@ -19,7 +19,7 @@ #ifndef _ASM_NIOS2_SETUP_H #define _ASM_NIOS2_SETUP_H -#include +#include #ifndef __ASSEMBLY__ #ifdef __KERNEL__ diff --git a/arch/nios2/include/uapi/asm/setup.h b/arch/nios2/include/uapi/asm/setup.h new file mode 100644 index ..8d8285997ba8 --- /dev/null +++ b/arch/nios2/include/uapi/asm/setup.h @@ -0,0 +1,6 @@ +#ifndef _UAPI_ASM_NIOS2_SETUP_H +#define _UAPI_ASM_NIOS2_SETUP_H + +#include + +#endif /* _UAPI_ASM_NIOS2_SETUP_H */ -- 2.8.1 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 4/7] x86: put msr-index.h in uapi
This header file is exported, thus move it to uapi. Signed-off-by: Nicolas Dichtel--- arch/x86/include/asm/msr-index.h | 694 + arch/x86/include/uapi/asm/msr-index.h | 698 ++ 2 files changed, 699 insertions(+), 693 deletions(-) create mode 100644 arch/x86/include/uapi/asm/msr-index.h diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index 710273c617b8..1baa0628da74 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -1,698 +1,6 @@ #ifndef _ASM_X86_MSR_INDEX_H #define _ASM_X86_MSR_INDEX_H -/* - * CPU model specific register (MSR) numbers. - * - * Do not add new entries to this file unless the definitions are shared - * between multiple compilation units. - */ - -/* x86-64 specific MSRs */ -#define MSR_EFER 0xc080 /* extended feature register */ -#define MSR_STAR 0xc081 /* legacy mode SYSCALL target */ -#define MSR_LSTAR 0xc082 /* long mode SYSCALL target */ -#define MSR_CSTAR 0xc083 /* compat mode SYSCALL target */ -#define MSR_SYSCALL_MASK 0xc084 /* EFLAGS mask for syscall */ -#define MSR_FS_BASE0xc100 /* 64bit FS base */ -#define MSR_GS_BASE0xc101 /* 64bit GS base */ -#define MSR_KERNEL_GS_BASE 0xc102 /* SwapGS GS shadow */ -#define MSR_TSC_AUX0xc103 /* Auxiliary TSC */ - -/* EFER bits: */ -#define _EFER_SCE 0 /* SYSCALL/SYSRET */ -#define _EFER_LME 8 /* Long mode enable */ -#define _EFER_LMA 10 /* Long mode active (read-only) */ -#define _EFER_NX 11 /* No execute enable */ -#define _EFER_SVME 12 /* Enable virtualization */ -#define _EFER_LMSLE13 /* Long Mode Segment Limit Enable */ -#define _EFER_FFXSR14 /* Enable Fast FXSAVE/FXRSTOR */ - -#define EFER_SCE (1<<_EFER_SCE) -#define EFER_LME (1<<_EFER_LME) -#define EFER_LMA (1<<_EFER_LMA) -#define EFER_NX(1<<_EFER_NX) -#define EFER_SVME (1<<_EFER_SVME) -#define EFER_LMSLE (1<<_EFER_LMSLE) -#define EFER_FFXSR (1<<_EFER_FFXSR) - -/* Intel MSRs. Some also available on other CPUs */ - -#define MSR_PPIN_CTL 0x004e -#define MSR_PPIN 0x004f - -#define MSR_IA32_PERFCTR0 0x00c1 -#define MSR_IA32_PERFCTR1 0x00c2 -#define MSR_FSB_FREQ 0x00cd -#define MSR_PLATFORM_INFO 0x00ce - -#define MSR_NHM_SNB_PKG_CST_CFG_CTL0x00e2 -#define NHM_C3_AUTO_DEMOTE (1UL << 25) -#define NHM_C1_AUTO_DEMOTE (1UL << 26) -#define ATM_LNC_C6_AUTO_DEMOTE (1UL << 25) -#define SNB_C1_AUTO_UNDEMOTE (1UL << 27) -#define SNB_C3_AUTO_UNDEMOTE (1UL << 28) - -#define MSR_MTRRcap0x00fe -#define MSR_IA32_BBL_CR_CTL0x0119 -#define MSR_IA32_BBL_CR_CTL3 0x011e - -#define MSR_IA32_SYSENTER_CS 0x0174 -#define MSR_IA32_SYSENTER_ESP 0x0175 -#define MSR_IA32_SYSENTER_EIP 0x0176 - -#define MSR_IA32_MCG_CAP 0x0179 -#define MSR_IA32_MCG_STATUS0x017a -#define MSR_IA32_MCG_CTL 0x017b -#define MSR_IA32_MCG_EXT_CTL 0x04d0 - -#define MSR_OFFCORE_RSP_0 0x01a6 -#define MSR_OFFCORE_RSP_1 0x01a7 -#define MSR_TURBO_RATIO_LIMIT 0x01ad -#define MSR_TURBO_RATIO_LIMIT1 0x01ae -#define MSR_TURBO_RATIO_LIMIT2 0x01af - -#define MSR_LBR_SELECT 0x01c8 -#define MSR_LBR_TOS0x01c9 -#define MSR_LBR_NHM_FROM 0x0680 -#define MSR_LBR_NHM_TO 0x06c0 -#define MSR_LBR_CORE_FROM 0x0040 -#define MSR_LBR_CORE_TO0x0060 - -#define MSR_LBR_INFO_0 0x0dc0 /* ... 0xddf for _31 */ -#define LBR_INFO_MISPRED BIT_ULL(63) -#define LBR_INFO_IN_TX BIT_ULL(62) -#define LBR_INFO_ABORT BIT_ULL(61) -#define LBR_INFO_CYCLES0x - -#define MSR_IA32_PEBS_ENABLE 0x03f1 -#define MSR_IA32_DS_AREA 0x0600 -#define MSR_IA32_PERF_CAPABILITIES 0x0345 -#define MSR_PEBS_LD_LAT_THRESHOLD 0x03f6 - -#define MSR_IA32_RTIT_CTL 0x0570 -#define MSR_IA32_RTIT_STATUS 0x0571 -#define MSR_IA32_RTIT_ADDR0_A 0x0580 -#define MSR_IA32_RTIT_ADDR0_B 0x0581 -#define MSR_IA32_RTIT_ADDR1_A 0x0582 -#define MSR_IA32_RTIT_ADDR1_B 0x0583 -#define MSR_IA32_RTIT_ADDR2_A 0x0584 -#define MSR_IA32_RTIT_ADDR2_B 0x0585 -#define
[PATCH v2 1/7] arm: put types.h in uapi
This header file is exported, thus move it to uapi. Signed-off-by: Nicolas Dichtel--- arch/arm/include/asm/types.h | 36 +-- arch/arm/include/uapi/asm/types.h | 40 +++ 2 files changed, 41 insertions(+), 35 deletions(-) create mode 100644 arch/arm/include/uapi/asm/types.h diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/asm/types.h index a53cdb8f068c..c48fee3d7b3b 100644 --- a/arch/arm/include/asm/types.h +++ b/arch/arm/include/asm/types.h @@ -1,40 +1,6 @@ #ifndef _ASM_TYPES_H #define _ASM_TYPES_H -#include - -/* - * The C99 types uintXX_t that are usually defined in 'stdint.h' are not as - * unambiguous on ARM as you would expect. For the types below, there is a - * difference on ARM between GCC built for bare metal ARM, GCC built for glibc - * and the kernel itself, which results in build errors if you try to build with - * -ffreestanding and include 'stdint.h' (such as when you include 'arm_neon.h' - * in order to use NEON intrinsics) - * - * As the typedefs for these types in 'stdint.h' are based on builtin defines - * supplied by GCC, we can tweak these to align with the kernel's idea of those - * types, so 'linux/types.h' and 'stdint.h' can be safely included from the same - * source file (provided that -ffreestanding is used). - * - *int32_t uint32_t uintptr_t - * bare metal GCC longunsigned long unsigned int - * glibc GCC int unsigned int unsigned int - * kernel int unsigned int unsigned long - */ - -#ifdef __INT32_TYPE__ -#undef __INT32_TYPE__ -#define __INT32_TYPE__ int -#endif - -#ifdef __UINT32_TYPE__ -#undef __UINT32_TYPE__ -#define __UINT32_TYPE__unsigned int -#endif - -#ifdef __UINTPTR_TYPE__ -#undef __UINTPTR_TYPE__ -#define __UINTPTR_TYPE__ unsigned long -#endif +#include #endif /* _ASM_TYPES_H */ diff --git a/arch/arm/include/uapi/asm/types.h b/arch/arm/include/uapi/asm/types.h new file mode 100644 index ..9435a42f575e --- /dev/null +++ b/arch/arm/include/uapi/asm/types.h @@ -0,0 +1,40 @@ +#ifndef _UAPI_ASM_TYPES_H +#define _UAPI_ASM_TYPES_H + +#include + +/* + * The C99 types uintXX_t that are usually defined in 'stdint.h' are not as + * unambiguous on ARM as you would expect. For the types below, there is a + * difference on ARM between GCC built for bare metal ARM, GCC built for glibc + * and the kernel itself, which results in build errors if you try to build with + * -ffreestanding and include 'stdint.h' (such as when you include 'arm_neon.h' + * in order to use NEON intrinsics) + * + * As the typedefs for these types in 'stdint.h' are based on builtin defines + * supplied by GCC, we can tweak these to align with the kernel's idea of those + * types, so 'linux/types.h' and 'stdint.h' can be safely included from the same + * source file (provided that -ffreestanding is used). + * + *int32_t uint32_t uintptr_t + * bare metal GCC longunsigned long unsigned int + * glibc GCC int unsigned int unsigned int + * kernel int unsigned int unsigned long + */ + +#ifdef __INT32_TYPE__ +#undef __INT32_TYPE__ +#define __INT32_TYPE__ int +#endif + +#ifdef __UINT32_TYPE__ +#undef __UINT32_TYPE__ +#define __UINT32_TYPE__unsigned int +#endif + +#ifdef __UINTPTR_TYPE__ +#undef __UINTPTR_TYPE__ +#define __UINTPTR_TYPE__ unsigned long +#endif + +#endif /* _UAPI_ASM_TYPES_H */ -- 2.8.1 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 5/7] Makefile.headersinst: cleanup input files
After the last four patches, all exported headers are under uapi/, thus input-files2 are not needed anymore. The side effect is that input-files1-name is exactly header-y. Note also that unput-files3-name is genhdr-y. Signed-off-by: Nicolas Dichtel--- scripts/Makefile.headersinst | 34 +++--- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 1106d6ca3a38..3e20d03432d2 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst @@ -40,31 +40,20 @@ wrapper-files := $(filter $(header-y), $(generic-y)) srcdir:= $(srctree)/$(obj) gendir:= $(objtree)/$(gen) -oldsrcdir := $(srctree)/$(subst /uapi,,$(obj)) - # all headers files for this dir header-y := $(filter-out $(generic-y), $(header-y)) all-files := $(header-y) $(genhdr-y) $(wrapper-files) output-files := $(addprefix $(installdir)/, $(all-files)) -input-files1 := $(foreach hdr, $(header-y), \ - $(if $(wildcard $(srcdir)/$(hdr)), \ - $(wildcard $(srcdir)/$(hdr))) \ - ) -input-files1-name := $(notdir $(input-files1)) -input-files2 := $(foreach hdr, $(header-y), \ - $(if $(wildcard $(srcdir)/$(hdr)),, \ - $(if $(wildcard $(oldsrcdir)/$(hdr)), \ - $(wildcard $(oldsrcdir)/$(hdr)), \ - $(error Missing UAPI file $(srcdir)/$(hdr))) \ - )) -input-files2-name := $(notdir $(input-files2)) -input-files3 := $(foreach hdr, $(genhdr-y), \ - $(if $(wildcard $(gendir)/$(hdr)), \ - $(wildcard $(gendir)/$(hdr)), \ - $(error Missing generated UAPI file $(gendir)/$(hdr)) \ - )) -input-files3-name := $(notdir $(input-files3)) +# Check that all expected files exist +$(foreach hdr, $(header-y), \ + $(if $(wildcard $(srcdir)/$(hdr)),, \ + $(error Missing UAPI file $(srcdir)/$(hdr)) \ + )) +$(foreach hdr, $(genhdr-y), \ + $(if $(wildcard $(gendir)/$(hdr)),, \ + $(error Missing generated UAPI file $(gendir)/$(hdr)) \ + )) # Work out what needs to be removed oldheaders:= $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h)) @@ -78,9 +67,8 @@ printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@)) quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ file$(if $(word 2, $(all-files)),s)) cmd_install = \ -$(CONFIG_SHELL) $< $(installdir) $(srcdir) $(input-files1-name); \ -$(CONFIG_SHELL) $< $(installdir) $(oldsrcdir) $(input-files2-name); \ -$(CONFIG_SHELL) $< $(installdir) $(gendir) $(input-files3-name); \ +$(CONFIG_SHELL) $< $(installdir) $(srcdir) $(header-y); \ +$(CONFIG_SHELL) $< $(installdir) $(gendir) $(genhdr-y); \ for F in $(wrapper-files); do \ echo "\#include " > $(installdir)/$$F;\ done; \ -- 2.8.1 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 0/7] uapi: export all headers under uapi directories
Here is the v2 of this series. The first 5 patches are just cleanup: some exported headers were still under a non-uapi directory. The patch 6 was spotted by code review: there is no in-tree user of this functionality. The last patch remove the use of header-y. Now all files under an uapi directory are exported. asm is a bit special, most of architectures export asm//include/uapi/asm only, but there is two exceptions: - cris which exports arch/cris/include/uapi/arch-v[10|32]; - tile which exports arch/tile/include/uapi/arch. Because I don't know if the output of 'make headers_install_all' can be changed, I introduce subdir-y in Kbuild file. The headers_install_all target copies all asm//include/uapi/asm to usr/include/asm- but arch/cris/include/uapi/arch-v[10|32] and arch/tile/include/uapi/arch are not prefixed (they are put asis in usr/include/). If it's acceptable to modify the output of 'make headers_install_all' to export asm headers in usr/include/asm-/asm, then I could remove this new subdir-y and exports everything under arch//include/uapi/. Note also that exported files for asm are a mix of files listed by: - include/uapi/asm-generic/Kbuild.asm; - arch/x86/include/uapi/asm/Kbuild; - arch/x86/include/asm/Kbuild. This complicates a lot the processing (arch/x86/include/asm/Kbuild is also used by scripts/Makefile.asm-generic). This series has been tested with a 'make headers_install' on x86 and a 'make headers_install_all'. I've checked the result of both commands. This patch is built against linus tree. I don't know if it should be made against antoher tree. Comments are welcomed, Nicolas -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html