linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] cfg80211: a few genregdb.awk updates
@ 2013-10-28  2:19 Luis R. Rodriguez
  2013-10-28  2:19 ` [PATCH 1/2] cfg80211: add function helpers to genregdb.awk Luis R. Rodriguez
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Luis R. Rodriguez @ 2013-10-28  2:19 UTC (permalink / raw)
  To: linux-wireless; +Cc: wireless-regdb, Luis R. Rodriguez

A few updates while toying with genregdb.awk for small
regulatory domains. This depends on the antenna gain removal
patch.

Luis R. Rodriguez (2):
  cfg80211: add function helpers to genregdb.awk
  cfg80211: fix parsing when db.txt ends on a rule

 net/wireless/genregdb.awk | 38 +++++++++++++++++++++++++++-----------
 1 file changed, 27 insertions(+), 11 deletions(-)

-- 
1.8.4.rc3


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] cfg80211: add function helpers to genregdb.awk
  2013-10-28  2:19 [PATCH 0/2] cfg80211: a few genregdb.awk updates Luis R. Rodriguez
@ 2013-10-28  2:19 ` Luis R. Rodriguez
  2013-10-28  2:19 ` [PATCH 2/2] cfg80211: fix parsing when db.txt ends on a rule Luis R. Rodriguez
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Luis R. Rodriguez @ 2013-10-28  2:19 UTC (permalink / raw)
  To: linux-wireless; +Cc: wireless-regdb, Luis R. Rodriguez, John W. Linville

This has no functional change, this just lets us reuse
helpers at a later time.

Cc: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 net/wireless/genregdb.awk | 36 +++++++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/net/wireless/genregdb.awk b/net/wireless/genregdb.awk
index 3e241e4e..95baf61 100755
--- a/net/wireless/genregdb.awk
+++ b/net/wireless/genregdb.awk
@@ -33,15 +33,7 @@ BEGIN {
 	regdb = "const struct ieee80211_regdomain *reg_regdb[] = {\n"
 }
 
-/^[ \t]*#/ {
-	# Ignore
-}
-
-!active && /^[ \t]*$/ {
-	# Ignore
-}
-
-!active && /country/ {
+function parse_country_head() {
 	country=$2
 	sub(/:/, "", country)
 	printf "static const struct ieee80211_regdomain regdom_%s = {\n", country
@@ -57,7 +49,8 @@ BEGIN {
 	regdb = regdb "\t&regdom_" country ",\n"
 }
 
-active && /^[ \t]*\(/ {
+function parse_reg_rule()
+{
 	start = $1
 	sub(/\(/, "", start)
 	end = $3
@@ -117,7 +110,8 @@ active && /^[ \t]*\(/ {
 	rules++
 }
 
-active && /^[ \t]*$/ {
+function print_tail_country()
+{
 	active = 0
 	printf "\t},\n"
 	printf "\t.n_reg_rules = %d\n", rules
@@ -125,6 +119,26 @@ active && /^[ \t]*$/ {
 	rules = 0;
 }
 
+/^[ \t]*#/ {
+	# Ignore
+}
+
+!active && /^[ \t]*$/ {
+	# Ignore
+}
+
+!active && /country/ {
+	parse_country_head()
+}
+
+active && /^[ \t]*\(/ {
+	parse_reg_rule()
+}
+
+active && /^[ \t]*$/ {
+	print_tail_country()
+}
+
 END {
 	print regdb "};"
 	print ""
-- 
1.8.4.rc3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] cfg80211: fix parsing when db.txt ends on a rule
  2013-10-28  2:19 [PATCH 0/2] cfg80211: a few genregdb.awk updates Luis R. Rodriguez
  2013-10-28  2:19 ` [PATCH 1/2] cfg80211: add function helpers to genregdb.awk Luis R. Rodriguez
@ 2013-10-28  2:19 ` Luis R. Rodriguez
  2013-10-28 13:58 ` [PATCH 0/2] cfg80211: a few genregdb.awk updates Johannes Berg
  2013-11-11 14:12 ` Johannes Berg
  3 siblings, 0 replies; 6+ messages in thread
From: Luis R. Rodriguez @ 2013-10-28  2:19 UTC (permalink / raw)
  To: linux-wireless; +Cc: wireless-regdb, Luis R. Rodriguez

If genregdb.awk assumes the file will end with an
extra empty line or a comment line. This is could
not be true so just address this.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 net/wireless/genregdb.awk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/wireless/genregdb.awk b/net/wireless/genregdb.awk
index 95baf61..13b982d 100755
--- a/net/wireless/genregdb.awk
+++ b/net/wireless/genregdb.awk
@@ -140,6 +140,8 @@ active && /^[ \t]*$/ {
 }
 
 END {
+	if (active)
+		print_tail_country()
 	print regdb "};"
 	print ""
 	print "int reg_regdb_size = ARRAY_SIZE(reg_regdb);"
-- 
1.8.4.rc3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] cfg80211: a few genregdb.awk updates
  2013-10-28  2:19 [PATCH 0/2] cfg80211: a few genregdb.awk updates Luis R. Rodriguez
  2013-10-28  2:19 ` [PATCH 1/2] cfg80211: add function helpers to genregdb.awk Luis R. Rodriguez
  2013-10-28  2:19 ` [PATCH 2/2] cfg80211: fix parsing when db.txt ends on a rule Luis R. Rodriguez
@ 2013-10-28 13:58 ` Johannes Berg
  2013-11-07 18:54   ` John W. Linville
  2013-11-11 14:12 ` Johannes Berg
  3 siblings, 1 reply; 6+ messages in thread
From: Johannes Berg @ 2013-10-28 13:58 UTC (permalink / raw)
  To: Luis R. Rodriguez, John Linville; +Cc: linux-wireless, wireless-regdb

I'd apply this, but would prefer John to take a look - he wrote the awk
script and I'm not familiar with it.

johannes


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] cfg80211: a few genregdb.awk updates
  2013-10-28 13:58 ` [PATCH 0/2] cfg80211: a few genregdb.awk updates Johannes Berg
@ 2013-11-07 18:54   ` John W. Linville
  0 siblings, 0 replies; 6+ messages in thread
From: John W. Linville @ 2013-11-07 18:54 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Luis R. Rodriguez, linux-wireless, wireless-regdb

On Mon, Oct 28, 2013 at 02:58:55PM +0100, Johannes Berg wrote:
> I'd apply this, but would prefer John to take a look - he wrote the awk
> script and I'm not familiar with it.

They seem OK to me.

Acked-by: John W. Linville <linville@tuxdriver.com>

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] cfg80211: a few genregdb.awk updates
  2013-10-28  2:19 [PATCH 0/2] cfg80211: a few genregdb.awk updates Luis R. Rodriguez
                   ` (2 preceding siblings ...)
  2013-10-28 13:58 ` [PATCH 0/2] cfg80211: a few genregdb.awk updates Johannes Berg
@ 2013-11-11 14:12 ` Johannes Berg
  3 siblings, 0 replies; 6+ messages in thread
From: Johannes Berg @ 2013-11-11 14:12 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linux-wireless, wireless-regdb

On Mon, 2013-10-28 at 03:19 +0100, Luis R. Rodriguez wrote:
> A few updates while toying with genregdb.awk for small
> regulatory domains. This depends on the antenna gain removal
> patch.

Applied, thanks.

johannes


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-11-11 14:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-28  2:19 [PATCH 0/2] cfg80211: a few genregdb.awk updates Luis R. Rodriguez
2013-10-28  2:19 ` [PATCH 1/2] cfg80211: add function helpers to genregdb.awk Luis R. Rodriguez
2013-10-28  2:19 ` [PATCH 2/2] cfg80211: fix parsing when db.txt ends on a rule Luis R. Rodriguez
2013-10-28 13:58 ` [PATCH 0/2] cfg80211: a few genregdb.awk updates Johannes Berg
2013-11-07 18:54   ` John W. Linville
2013-11-11 14:12 ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).