Fix prefix_patch toolkit.
authorngkaho1234 <ngkaho1234@gmail.com>
Wed, 3 Feb 2016 16:40:39 +0000 (16:40 +0000)
committerngkaho1234 <ngkaho1234@gmail.com>
Wed, 3 Feb 2016 16:40:39 +0000 (16:40 +0000)
prefix_patch/ext4_errno.patch
prefix_patch/ext4_oflags.patch
prefix_patch/lwext4_rename.sh

index 7fd0595a0b18793180bf9c4526f7017bea13dd0d..37a9635a483a37fae0a55ec5153ee8fc34fe8e6d 100644 (file)
@@ -1,5 +1,5 @@
 diff --git a/include/ext4_errno.h b/include/ext4_errno.h
-index edf89a9..60a3472 100644
+index edf89a9..a4408c7 100644
 --- a/include/ext4_errno.h
 +++ b/include/ext4_errno.h
 @@ -43,46 +43,74 @@ extern "C" {
@@ -62,47 +62,47 @@ index edf89a9..60a3472 100644
 +
 +#else /* CONFIG_HAVE_OWN_ERRNO */
 +
-+ #define LWEXT4_ERRNO(errno) (LWEXT4_##errno)
++ #define LWEXT4_ERRNO(errno) LWEXT4_##errno
 +
 + enum ext4_errno {
-+      LWEXT4_ERRNO(EOK) = 0
-+      LWEXT4_ERRNO(EPERM) = 1      /* Operation not permitted */
-+      LWEXT4_ERRNO(ENOENT) = 2     /* No such file or directory */
-+      LWEXT4_ERRNO(ESRCH) = 3      /* No such process */
-+      LWEXT4_ERRNO(EINTR) = 4      /* Interrupted system call */
-+      LWEXT4_ERRNO(EIO) = 5        /* I/O error */
-+      LWEXT4_ERRNO(ENXIO) = 6      /* No such device or address */
-+      LWEXT4_ERRNO(E2BIG) = 7      /* Argument list too long */
-+      LWEXT4_ERRNO(ENOEXEC) = 8    /* Exec format error */
-+      LWEXT4_ERRNO(EBADF) = 9      /* Bad file number */
-+      LWEXT4_ERRNO(ECHILD) = 10    /* No child processes */
-+      LWEXT4_ERRNO(EAGAIN) = 11    /* Try again */
-+      LWEXT4_ERRNO(ENOMEM) = 12    /* Out of memory */
-+      LWEXT4_ERRNO(EACCES) = 13    /* Permission denied */
-+      LWEXT4_ERRNO(EFAULT) = 14    /* Bad address */
-+      LWEXT4_ERRNO(ENOTBLK) = 15   /* Block device required */
-+      LWEXT4_ERRNO(EBUSY) = 16     /* Device or resource busy */
-+      LWEXT4_ERRNO(EEXIST) = 17    /* File exists */
-+      LWEXT4_ERRNO(EXDEV) = 18     /* Cross-device link */
-+      LWEXT4_ERRNO(ENODEV) = 19    /* No such device */
-+      LWEXT4_ERRNO(ENOTDIR) = 20   /* Not a directory */
-+      LWEXT4_ERRNO(EISDIR) = 21    /* Is a directory */
-+      LWEXT4_ERRNO(EINVAL) = 22    /* Invalid argument */
-+      LWEXT4_ERRNO(ENFILE) = 23    /* File table overflow */
-+      LWEXT4_ERRNO(EMFILE) = 24    /* Too many open files */
-+      LWEXT4_ERRNO(ENOTTY) = 25    /* Not a typewriter */
-+      LWEXT4_ERRNO(ETXTBSY) = 26   /* Text file busy */
-+      LWEXT4_ERRNO(EFBIG) = 27     /* File too large */
-+      LWEXT4_ERRNO(ENOSPC) = 28    /* No space left on device */
-+      LWEXT4_ERRNO(ESPIPE) = 29    /* Illegal seek */
-+      LWEXT4_ERRNO(EROFS) = 30     /* Read-only file system */
-+      LWEXT4_ERRNO(EMLINK) = 31    /* Too many links */
-+      LWEXT4_ERRNO(EPIPE) = 32     /* Broken pipe */
-+      LWEXT4_ERRNO(EDOM) = 33      /* Math argument out of domain of func */
-+      LWEXT4_ERRNO(ERANGE) = 34    /* Math result not representable */
-+      LWEXT4_ERRNO(ENOTEMPTY) = 39 /* Directory not empty */
-+      LWEXT4_ERRNO(ENODATA) = 61   /* No data available */
-+      LWEXT4_ERRNO(ENOTSUP) = 95   /* Not supported */
++      LWEXT4_ERRNO(EOK) = 0,
++      LWEXT4_ERRNO(EPERM) = 1,      /* Operation not permitted */
++      LWEXT4_ERRNO(ENOENT) = 2,     /* No such file or directory */
++      LWEXT4_ERRNO(ESRCH) = 3,      /* No such process */
++      LWEXT4_ERRNO(EINTR) = 4,      /* Interrupted system call */
++      LWEXT4_ERRNO(EIO) = 5,        /* I/O error */
++      LWEXT4_ERRNO(ENXIO) = 6,      /* No such device or address */
++      LWEXT4_ERRNO(E2BIG) = 7,      /* Argument list too long */
++      LWEXT4_ERRNO(ENOEXEC) = 8,    /* Exec format error */
++      LWEXT4_ERRNO(EBADF) = 9,      /* Bad file number */
++      LWEXT4_ERRNO(ECHILD) = 10,    /* No child processes */
++      LWEXT4_ERRNO(EAGAIN) = 11,    /* Try again */
++      LWEXT4_ERRNO(ENOMEM) = 12,    /* Out of memory */
++      LWEXT4_ERRNO(EACCES) = 13,    /* Permission denied */
++      LWEXT4_ERRNO(EFAULT) = 14,    /* Bad address */
++      LWEXT4_ERRNO(ENOTBLK) = 15,   /* Block device required */
++      LWEXT4_ERRNO(EBUSY) = 16,     /* Device or resource busy */
++      LWEXT4_ERRNO(EEXIST) = 17,    /* File exists */
++      LWEXT4_ERRNO(EXDEV) = 18,     /* Cross-device link */
++      LWEXT4_ERRNO(ENODEV) = 19,    /* No such device */
++      LWEXT4_ERRNO(ENOTDIR) = 20,   /* Not a directory */
++      LWEXT4_ERRNO(EISDIR) = 21,    /* Is a directory */
++      LWEXT4_ERRNO(EINVAL) = 22,    /* Invalid argument */
++      LWEXT4_ERRNO(ENFILE) = 23,    /* File table overflow */
++      LWEXT4_ERRNO(EMFILE) = 24,    /* Too many open files */
++      LWEXT4_ERRNO(ENOTTY) = 25,    /* Not a typewriter */
++      LWEXT4_ERRNO(ETXTBSY) = 26,   /* Text file busy */
++      LWEXT4_ERRNO(EFBIG) = 27,     /* File too large */
++      LWEXT4_ERRNO(ENOSPC) = 28,    /* No space left on device */
++      LWEXT4_ERRNO(ESPIPE) = 29,    /* Illegal seek */
++      LWEXT4_ERRNO(EROFS) = 30,     /* Read-only file system */
++      LWEXT4_ERRNO(EMLINK) = 31,    /* Too many links */
++      LWEXT4_ERRNO(EPIPE) = 32,     /* Broken pipe */
++      LWEXT4_ERRNO(EDOM) = 33,      /* Math argument out of domain of func */
++      LWEXT4_ERRNO(ERANGE) = 34,    /* Math result not representable */
++      LWEXT4_ERRNO(ENOTEMPTY) = 39, /* Directory not empty */
++      LWEXT4_ERRNO(ENODATA) = 61,   /* No data available */
++      LWEXT4_ERRNO(ENOTSUP) = 95    /* Not supported */
 + };
 +
 +#endif /* CONFIG_HAVE_OWN_ERRNO */
index 1362baa9f732b7472883734094b8ca1652356608..dd99906fa9af451730fa4d6ddcc14c796ba6d906 100644 (file)
@@ -1,5 +1,5 @@
 diff --git a/include/ext4_oflags.h b/include/ext4_oflags.h
-index 7f7be7e..e99d1af 100644
+index 7f7be7e..87f42ef 100644
 --- a/include/ext4_oflags.h
 +++ b/include/ext4_oflags.h
 @@ -45,51 +45,33 @@ extern "C" {
@@ -33,15 +33,15 @@ index 7f7be7e..e99d1af 100644
 - #ifndef O_APPEND
 - #define O_APPEND 02000
 - #endif
-+ #define LWEXT4_FLAGS(flags) (LWEXT4_##flags)
++ #define LWEXT4_FLAGS(flags) LWEXT4_##flags
 +
 + enum ext4_oflags {
-+      LWEXT4_FLAGS(O_RDONLY) = 00
-+      LWEXT4_FLAGS(O_WRONLY) = 01
-+      LWEXT4_FLAGS(O_RDWR) = 02
-+      LWEXT4_FLAGS(O_CREAT) = 0100
-+      LWEXT4_FLAGS(O_EXCL) = 0200
-+      LWEXT4_FLAGS(O_TRUNC) = 01000
++      LWEXT4_FLAGS(O_RDONLY) = 00,
++      LWEXT4_FLAGS(O_WRONLY) = 01,
++      LWEXT4_FLAGS(O_RDWR) = 02,
++      LWEXT4_FLAGS(O_CREAT) = 0100,
++      LWEXT4_FLAGS(O_EXCL) = 0200,
++      LWEXT4_FLAGS(O_TRUNC) = 01000,
 +      LWEXT4_FLAGS(O_APPEND) = 02000
 + };
  
@@ -59,8 +59,8 @@ index 7f7be7e..e99d1af 100644
 - #define SEEK_END 2
 - #endif
 + enum ext4_seek_flags {
-+      LWEXT4_FLAGS(SEEK_SET) = 0
-+      LWEXT4_FLAGS(SEEK_CUR) = 1
++      LWEXT4_FLAGS(SEEK_SET) = 0,
++      LWEXT4_FLAGS(SEEK_CUR) = 1,
 +      LWEXT4_FLAGS(SEEK_END) = 2
 + };
  
index 654074355d4f72e5249153f249b7122163545f01..0c90ff219b220c1e010f329a1f90f243c853c120 100755 (executable)
@@ -33,12 +33,12 @@ for errno in $(cat $USED_ERRNO_FILE);do
        echo "For $errno"
        for file in $(find . -name "*.c" | xargs -n 1);do
                if [[ $(basename $file) != $EXT4_ERRNO_H ]];then
-                       sed -i "s/\\<${errno}\\>/${MACRO_NAME}_ERRNO(${errno})/g" $file
+                       sed -i "/${MACRO_NAME}_ERRNO(${errno})/b;s/\\<${errno}\\>/${MACRO_NAME}_ERRNO(${errno})/g" $file
                fi
        done
        for file in $(find . -name "*.h" | xargs -n 1);do
                if [[ $(basename $file) != $EXT4_ERRNO_H ]];then
-                       sed -i "s/\\<${errno}\\>/${MACRO_NAME}_ERRNO(${errno})/g" $file
+                       sed -i "/${MACRO_NAME}_ERRNO(${errno})/b;s/\\<${errno}\\>/${MACRO_NAME}_ERRNO(${errno})/g" $file
                fi
        done
 done
@@ -48,13 +48,13 @@ for oflags in $(cat $USED_OFLAGS_FILE);do
        for file in $(find . -name "*.c" | xargs -n 1);do
                if [[ $(dirname $file) != "./blockdev/"* &&  \
                      $(basename $file) != $EXT4_OFLAGS_H ]];then
-               sed -i "s/\\<${oflags}\\>/${MACRO_NAME}_FLAGS(${oflags})/g" $file
+               sed -i "/${MACRO_NAME}_FLAGS(${oflags})/b;s/\\<${oflags}\\>/${MACRO_NAME}_FLAGS(${oflags})/g" $file
                fi
        done
        for file in $(find . -name "*.h" | xargs -n 1);do
                if [[ $(dirname $file) != "./blockdev/"* &&  \
                      $(basename $file) != $EXT4_OFLAGS_H ]];then
-               sed -i "s/\\<${oflags}\\>/${MACRO_NAME}_FLAGS(${oflags})/g" $file
+               sed -i "/${MACRO_NAME}_FLAGS(${oflags})/b;s/\\<${oflags}\\>/${MACRO_NAME}_FLAGS(${oflags})/g" $file
                fi
        done
 done