Tue Aug 21 08:22:33 2018 UTC ()
rumpdefs.h, rumperr.h and rumperrno2host.h are generated from makerumpdefs.sh.
Don't edit those files directly. Use __inline instead of inline in the
script file. OK'd by christos.


(msaitoh)
diff -r1.29 -r1.30 src/sys/rump/include/rump/makerumpdefs.sh

cvs diff -r1.29 -r1.30 src/sys/rump/include/rump/makerumpdefs.sh (expand / switch to unified diff)

--- src/sys/rump/include/rump/makerumpdefs.sh 2016/02/02 01:15:24 1.29
+++ src/sys/rump/include/rump/makerumpdefs.sh 2018/08/21 08:22:33 1.30
@@ -1,24 +1,24 @@ @@ -1,24 +1,24 @@
1#!/bin/sh 1#!/bin/sh
2 2
3# Generates various defines needed for using rump on non-NetBSD systems. 3# Generates various defines needed for using rump on non-NetBSD systems.
4# Run this occasionally (yes, it's a slightly suboptimal kludge, but 4# Run this occasionally (yes, it's a slightly suboptimal kludge, but
5# better than nothing). 5# better than nothing).
6 6
7echo Generating rumpdefs.h 7echo Generating rumpdefs.h
8rm -f rumpdefs.h 8rm -f rumpdefs.h
9exec 3>&1 > rumpdefs.h 9exec 3>&1 > rumpdefs.h
10 10
11printf '/* $NetBSD: makerumpdefs.sh,v 1.29 2016/02/02 01:15:24 pooka Exp $ */\n\n' 11printf '/* $NetBSD: makerumpdefs.sh,v 1.30 2018/08/21 08:22:33 msaitoh Exp $ */\n\n'
12printf '/*\n *\tAUTOMATICALLY GENERATED. DO NOT EDIT.\n */\n\n' 12printf '/*\n *\tAUTOMATICALLY GENERATED. DO NOT EDIT.\n */\n\n'
13printf '#ifndef _RUMP_RUMPDEFS_H_\n' 13printf '#ifndef _RUMP_RUMPDEFS_H_\n'
14printf '#define _RUMP_RUMPDEFS_H_\n\n' 14printf '#define _RUMP_RUMPDEFS_H_\n\n'
15printf '#include <rump/rump_namei.h>\n' 15printf '#include <rump/rump_namei.h>\n'
16 16
17fromvers () { 17fromvers () {
18 echo 18 echo
19 sed -n '1{s/\$//gp;q;}' $1 19 sed -n '1{s/\$//gp;q;}' $1
20} 20}
21 21
22# not perfect, but works well enough for the cases so far 22# not perfect, but works well enough for the cases so far
23# (also has one struct-specific hack for MAXNAMLEN) 23# (also has one struct-specific hack for MAXNAMLEN)
24getstruct () { 24getstruct () {
@@ -125,32 +125,32 @@ getstruct ../../../ufs/ufs/ufsmount.h uf @@ -125,32 +125,32 @@ getstruct ../../../ufs/ufs/ufsmount.h uf
125fromvers ../../../fs/sysvbfs/sysvbfs_args.h 125fromvers ../../../fs/sysvbfs/sysvbfs_args.h
126getstruct ../../../fs/sysvbfs/sysvbfs_args.h sysvbfs_args 126getstruct ../../../fs/sysvbfs/sysvbfs_args.h sysvbfs_args
127 127
128fromvers ../../../sys/dirent.h 128fromvers ../../../sys/dirent.h
129getstruct ../../../sys/dirent.h dirent 129getstruct ../../../sys/dirent.h dirent
130 130
131printf '\n#endif /* _RUMP_RUMPDEFS_H_ */\n' 131printf '\n#endif /* _RUMP_RUMPDEFS_H_ */\n'
132 132
133exec 1>&3 133exec 1>&3
134 134
135echo Generating rumperr.h 135echo Generating rumperr.h
136rm -f rumperr.h 136rm -f rumperr.h
137exec > rumperr.h 137exec > rumperr.h
138printf '/* $NetBSD: makerumpdefs.sh,v 1.29 2016/02/02 01:15:24 pooka Exp $ */\n\n' 138printf '/* $NetBSD: makerumpdefs.sh,v 1.30 2018/08/21 08:22:33 msaitoh Exp $ */\n\n'
139printf '/*\n *\tAUTOMATICALLY GENERATED. DO NOT EDIT.\n */\n' 139printf '/*\n *\tAUTOMATICALLY GENERATED. DO NOT EDIT.\n */\n'
140 140
141fromvers ../../../sys/errno.h 141fromvers ../../../sys/errno.h
142 142
143printf "\nstatic inline const char *\nrump_strerror(int error)\n{\n\n" 143printf "\nstatic __inline const char *\nrump_strerror(int error)\n{\n\n"
144printf "\tswitch (error) {\n\tcase 0:\n" 144printf "\tswitch (error) {\n\tcase 0:\n"
145printf "\t\t return \"No error: zero, zip, zilch, none!\";\n" 145printf "\t\t return \"No error: zero, zip, zilch, none!\";\n"
146awk '/^#define[ ]*E.*[0-9]/{ 146awk '/^#define[ ]*E.*[0-9]/{
147 ename = $2 147 ename = $2
148 evalue = $3 148 evalue = $3
149 error = 1 149 error = 1
150 if (ename == "ELAST") { 150 if (ename == "ELAST") {
151 printf "\tdefault:\n" 151 printf "\tdefault:\n"
152 printf "\t\treturn \"Invalid error!\";\n\t}\n}\n" 152 printf "\t\treturn \"Invalid error!\";\n\t}\n}\n"
153 error = 0 153 error = 0
154 exit 0 154 exit 0
155 } 155 }
156 if (preverror + 1 != evalue) 156 if (preverror + 1 != evalue)
@@ -166,33 +166,33 @@ awk '/^#define[ ]*E.*[0-9]/{ @@ -166,33 +166,33 @@ awk '/^#define[ ]*E.*[0-9]/{
166} 166}
167END { 167END {
168 exit error 168 exit error
169}' < ../../../sys/errno.h 169}' < ../../../sys/errno.h
170if [ $? -ne 0 ]; then 170if [ $? -ne 0 ]; then
171 echo 'Parsing errno.h failed!' 1>&3 171 echo 'Parsing errno.h failed!' 1>&3
172 rm -f rumpdefs.h rumperr.h 172 rm -f rumpdefs.h rumperr.h
173 exit 1 173 exit 1
174fi 174fi
175 175
176echo Generating rumperrno2host.h 1>&3 176echo Generating rumperrno2host.h 1>&3
177rm -f rumperrno2host.h 177rm -f rumperrno2host.h
178exec > rumperrno2host.h 178exec > rumperrno2host.h
179printf '/* $NetBSD: makerumpdefs.sh,v 1.29 2016/02/02 01:15:24 pooka Exp $ */\n\n' 179printf '/* $NetBSD: makerumpdefs.sh,v 1.30 2018/08/21 08:22:33 msaitoh Exp $ */\n\n'
180printf '/*\n *\tAUTOMATICALLY GENERATED. DO NOT EDIT.\n */\n' 180printf '/*\n *\tAUTOMATICALLY GENERATED. DO NOT EDIT.\n */\n'
181 181
182fromvers ../../../sys/errno.h 182fromvers ../../../sys/errno.h
183 183
184printf "\n#ifndef ERANGE\n#error include ISO C style errno.h first\n#endif\n" 184printf "\n#ifndef ERANGE\n#error include ISO C style errno.h first\n#endif\n"
185printf "\nstatic inline int \nrump_errno2host(int rumperrno)\n{\n\n" 185printf "\nstatic __inline int \nrump_errno2host(int rumperrno)\n{\n\n"
186printf "\tswitch (rumperrno) {\n\tcase 0:\n" 186printf "\tswitch (rumperrno) {\n\tcase 0:\n"
187printf "\t\t return 0;\n" 187printf "\t\t return 0;\n"
188awk '/^#define[ ]*E.*[0-9]/{ 188awk '/^#define[ ]*E.*[0-9]/{
189 ename = $2 189 ename = $2
190 evalue = $3 190 evalue = $3
191 error = 1 191 error = 1
192 if (ename == "ELAST") { 192 if (ename == "ELAST") {
193 printf "\tdefault:\n" 193 printf "\tdefault:\n"
194 printf "#ifdef EINVAL\n\t\treturn EINVAL;\n" 194 printf "#ifdef EINVAL\n\t\treturn EINVAL;\n"
195 printf "#else\n\t\treturn ERANGE;\n#endif\n" 195 printf "#else\n\t\treturn ERANGE;\n#endif\n"
196 printf "\t}\n}\n" 196 printf "\t}\n}\n"
197 error = 0 197 error = 0
198 exit 0 198 exit 0