4 # Purpose of this script is to show the method used to integrate fscrypt
5 # sources from the Linux kernel, and the transformations required.
7 # All C files from $LINUX/fs/crypto/ are put under libcfs/libcfs/crypto/.
8 # File $LINUX/include/linux/fscrypt.h is put in libcfs/include/libcfs/crypto/.
9 # File $LINUX/include/uapi/linux/fscrypt.h is placed under
10 # libcfs/include/uapi/linux/.
13 mv libcfs/libcfs/crypto/fscrypt_private.h libcfs/libcfs/crypto/llcrypt_private.h
14 mv libcfs/include/libcfs/crypto/fscrypt.h libcfs/include/libcfs/crypto/llcrypt.h
15 mv libcfs/include/uapi/linux/fscrypt.h libcfs/include/uapi/linux/llcrypt.h
17 file_list=$(find libcfs/libcfs/crypto/ -type f)
18 file_list+=" libcfs/include/libcfs/crypto/Makefile.am"
19 file_list+=" libcfs/include/libcfs/crypto/llcrypt.h"
20 file_list+=" libcfs/include/libcfs/crypto/Makefile.in"
21 file_list+=" libcfs/include/uapi/linux/llcrypt.h"
23 udef_list=$(grep -n "#define FS_" libcfs/include/uapi/linux/llcrypt.h | awk '{print $2}')
25 for file in $file_list; do
27 sed -i s+fscrypt+llcrypt+g $file
28 sed -i s+FSCRYPT+LLCRYPT+g $file
29 sed -i s+FS_CRYPTO_BLOCK_SIZE+LL_CRYPTO_BLOCK_SIZE+g $file
30 sed -i s+FSTR_INIT+LLTR_INIT+g $file
31 sed -i s+FSTR_TO_QSTR+LLTR_TO_QSTR+g $file
32 sed -i s+CONFIG_FS_ENCRYPTION+CONFIG_LL_ENCRYPTION+g $file
33 sed -i s+FS_CFLG_OWN_PAGES+LL_CFLG_OWN_PAGES+g $file
34 sed -i s+fname_name+lname_name+g $file
35 sed -i s+fname_len+lname_len+g $file
36 for def in $udef_list; do
37 newdef=$(echo $def | sed s+^FS_+LL_+)
38 sed -i s+$def+$newdef+g $file
42 for patch in $(cat contrib/scripts/crypto_patches/series); do