Back to home page

OSCL-LXR

 
 

    


0001 #
0002 # Small script that refreshes the kernel feature support status in place.
0003 #
0004 
0005 for F_FILE in Documentation/features/*/*/arch-support.txt; do
0006         F=$(grep "^#         Kconfig:" "$F_FILE" | cut -c26-)
0007 
0008         #
0009         # Each feature F is identified by a pair (O, K), where 'O' can
0010         # be either the empty string (for 'nop') or "not" (the logical
0011         # negation operator '!'); other operators are not supported.
0012         #
0013         O=""
0014         K=$F
0015         if [[ "$F" == !* ]]; then
0016                 O="not"
0017                 K=$(echo $F | sed -e 's/^!//g')
0018         fi
0019 
0020         #
0021         # F := (O, K) is 'valid' iff there is a Kconfig file (for some
0022         # arch) which contains K.
0023         #
0024         # Notice that this definition entails an 'asymmetry' between
0025         # the case 'O = ""' and the case 'O = "not"'. E.g., F may be
0026         # _invalid_ if:
0027         #
0028         # [case 'O = ""']
0029         #   1) no arch provides support for F,
0030         #   2) K does not exist (e.g., it was renamed/mis-typed);
0031         #
0032         # [case 'O = "not"']
0033         #   3) all archs provide support for F,
0034         #   4) as in (2).
0035         #
0036         # The rationale for adopting this definition (and, thus, for
0037         # keeping the asymmetry) is:
0038         #
0039         #       We want to be able to 'detect' (2) (or (4)).
0040         #
0041         # (1) and (3) may further warn the developers about the fact
0042         # that K can be removed.
0043         #
0044         F_VALID="false"
0045         for ARCH_DIR in arch/*/; do
0046                 K_FILES=$(find $ARCH_DIR -name "Kconfig*")
0047                 K_GREP=$(grep "$K" $K_FILES)
0048                 if [ ! -z "$K_GREP" ]; then
0049                         F_VALID="true"
0050                         break
0051                 fi
0052         done
0053         if [ "$F_VALID" = "false" ]; then
0054                 printf "WARNING: '%s' is not a valid Kconfig\n" "$F"
0055         fi
0056 
0057         T_FILE="$F_FILE.tmp"
0058         grep "^#" $F_FILE > $T_FILE
0059         echo "    -----------------------" >> $T_FILE
0060         echo "    |         arch |status|" >> $T_FILE
0061         echo "    -----------------------" >> $T_FILE
0062         for ARCH_DIR in arch/*/; do
0063                 ARCH=$(echo $ARCH_DIR | sed -e 's/arch//g' | sed -e 's/\///g')
0064                 K_FILES=$(find $ARCH_DIR -name "Kconfig*")
0065                 K_GREP=$(grep "$K" $K_FILES)
0066                 #
0067                 # Arch support status values for (O, K) are updated according
0068                 # to the following rules.
0069                 #
0070                 #   - ("", K) is 'supported by a given arch', if there is a
0071                 #     Kconfig file for that arch which contains K;
0072                 #
0073                 #   - ("not", K) is 'supported by a given arch', if there is
0074                 #     no Kconfig file for that arch which contains K;
0075                 #
0076                 #   - otherwise: preserve the previous status value (if any),
0077                 #                default to 'not yet supported'.
0078                 #
0079                 # Notice that, according these rules, invalid features may be
0080                 # updated/modified.
0081                 #
0082                 if [ "$O" = "" ] && [ ! -z "$K_GREP" ]; then
0083                         printf "    |%12s: |  ok  |\n" "$ARCH" >> $T_FILE
0084                 elif [ "$O" = "not" ] && [ -z "$K_GREP" ]; then
0085                         printf "    |%12s: |  ok  |\n" "$ARCH" >> $T_FILE
0086                 else
0087                         S=$(grep -v "^#" "$F_FILE" | grep " $ARCH:")
0088                         if [ ! -z "$S" ]; then
0089                                 echo "$S" >> $T_FILE
0090                         else
0091                                 printf "    |%12s: | TODO |\n" "$ARCH" \
0092                                         >> $T_FILE
0093                         fi
0094                 fi
0095         done
0096         echo "    -----------------------" >> $T_FILE
0097         mv $T_FILE $F_FILE
0098 done