Skip to contentSkip to conversation

scripts/tags.sh: Add magic for OFFSET and DEFINE

PATCH In review Kirill Tkhai 2 participants 4 messages Mar 23, 2013 – Mar 27, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/tags.sh: Add magic for OFFSET and DEFINE

Add rules for definitions which is generally used in asm-offsets files.

CC Michal Marek <[email protected]>
CC Andrew Morton <[email protected]>
---
 scripts/tags.sh |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
scripts/tags.sh +3 -1
index 26a87e6..74f02e4 100755
@@ -199,7 +199,9 @@ exuberant()
 	--regex-c='/DEFINE_PER_CPU_SHARED_ALIGNED\(([^,]*,\s*)(\w*).*\)/\2/v/' \
 	--regex-c='/DECLARE_WAIT_QUEUE_HEAD\((\w*)/\1/v/'		\
 	--regex-c='/DECLARE_(TASKLET|WORK|DELAYED_WORK)\((\w*)/\2/v/'	\
-	--regex-c='/DEFINE_PCI_DEVICE_TABLE\((\w*)/\1/v/'
+	--regex-c='/DEFINE_PCI_DEVICE_TABLE\((\w*)/\1/v/'		\
+	--regex-c='/(^\s)OFFSET\((\w*)/\2/v/'				\
+	--regex-c='/(^\s)DEFINE\((\w*)/\2/v/'
 
 	all_kconfigs | xargs $1 -a                              \
 	--langdef=kconfig --language-force=kconfig              \
#1 lore raw
Quoted 13 lines · Kirill Tkhai

Add rules for definitions which is generally used in asm-offsets files.

CC Michal Marek <[email protected]>
CC Andrew Morton <[email protected]>
---
 scripts/tags.sh |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
scripts/tags.sh +0 -0
index 26a87e6..74f02e4 100755

scripts/tags.sh exuberant() · line 204

Quoted 7 lines
scripts/tags.sh +3 -1
@@ -199,7 +199,9 @@ exuberant()
 	--regex-c='/DEFINE_PER_CPU_SHARED_ALIGNED\(([^,]*,\s*)(\w*).*\)/\2/v/' \
 	--regex-c='/DECLARE_WAIT_QUEUE_HEAD\((\w*)/\1/v/'		\
 	--regex-c='/DECLARE_(TASKLET|WORK|DELAYED_WORK)\((\w*)/\2/v/'	\
-	--regex-c='/DEFINE_PCI_DEVICE_TABLE\((\w*)/\1/v/'
+	--regex-c='/DEFINE_PCI_DEVICE_TABLE\((\w*)/\1/v/'		\
+	--regex-c='/(^\s)OFFSET\((\w*)/\2/v/'				\
+	--regex-c='/(^\s)DEFINE\((\w*)/\2/v/'

The macro definitions in the asm-offsets.h file are ammended with a comment explaining what the value actually means. So you see both the value and the semantic of the macro:

#define TI_flags 16 /* offsetof(struct thread_info, flags) # */

By jumping to the asm-offset.c file instead, you would get only a subset of that information.

OFFSET(TI_flags, thread_info, flags);

Unless I'm missing something, I don't think that this patch improves much.

Michal

#2 lore raw

27.03.2013, 01:35, "Michal Marek" <[email protected]>:

Quoted 29 lines · Kirill Tkhai
Quoted 9 lines

 Add rules for definitions which is generally used in asm-offsets files.

CC Michal Marek <[email protected]>
CC Andrew Morton <[email protected]>

 ---
  scripts/tags.sh |    4 +++-

  1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 12 lines

 diff --git a/scripts/tags.sh b/scripts/tags.sh
 index 26a87e6..74f02e4 100755
 --- a/scripts/tags.sh
 +++ b/scripts/tags.sh
 @@ -199,7 +199,9 @@ exuberant() --regex-c='/DEFINE_PER_CPU_SHARED_ALIGNED\(([^,]*,\s*)(\w*).*\)/\2/v/' \
          --regex-c='/DECLARE_WAIT_QUEUE_HEAD\((\w*)/\1/v/' \
          --regex-c='/DECLARE_(TASKLET|WORK|DELAYED_WORK)\((\w*)/\2/v/' \
 - --regex-c='/DEFINE_PCI_DEVICE_TABLE\((\w*)/\1/v/'
 + --regex-c='/DEFINE_PCI_DEVICE_TABLE\((\w*)/\1/v/' \
 + --regex-c='/(^\s)OFFSET\((\w*)/\2/v/' \
 + --regex-c='/(^\s)DEFINE\((\w*)/\2/v/'

The macro definitions in the asm-offsets.h file are ammended with a comment explaining what the value actually means. So you see both the value and the semantic of the macro:

#define TI_flags 16 /* offsetof(struct thread_info, flags)      # */

Quoted 7 lines

By jumping to the asm-offset.c file instead, you would get only a subset of that information.

OFFSET(TI_flags, thread_info, flags);

Unless I'm missing something, I don't think that this patch improves much.

This patch does not annul definitions in asm-offsets.h. They stay still on their places. It adds OFFSETs and DEFINEs from asm-offsets.c files.

When kernel is not precompiled you do not have asm-offsets.h and you are not able to see what is the place offsets are defined for yor architecture.

Also, you are not able to look at other architectures because they do not have precompiled asm-offsets.h.

I use ALLSOURCE_ARCHS=ls arch/ | grep -v Kconfig make tags to generate tags. I thing some people do the same and sometimes they need offsets for another architectures.

Kirill

#3 lore raw
Quoted 15 lines · Kirill Tkhai

27.03.2013, 01:35, "Michal Marek" <[email protected]>:

Quoted 6 lines

The macro definitions in the asm-offsets.h file are ammended with a comment explaining what the value actually means. So you see both the value and the semantic of the macro:

#define TI_flags 16 /* offsetof(struct thread_info, flags) # */

Quoted 7 lines

By jumping to the asm-offset.c file instead, you would get only a subset of that information.

OFFSET(TI_flags, thread_info, flags);

Unless I'm missing something, I don't think that this patch improves much.

Quoted 8 lines

This patch does not annul definitions in asm-offsets.h. They stay still on their places. It adds OFFSETs and DEFINEs from asm-offsets.c files.

When kernel is not precompiled you do not have asm-offsets.h and you are not able to see what is the place offsets are defined for yor architecture.

Also, you are not able to look at other architectures because they do not have precompiled asm-offsets.h.

I see, these are valid use cases for the regexps. I applied your patch to kbuild.git#misc now.

Michal