1 # Copyright (C) 2001 Cluster File Systems, Inc.
3 # This code is issued under the GNU General Public License.
4 # See the file COPYING in this distribution
11 # NOTE: If you are not using a RedHat 12.5 or later kernel, then you need to
12 # apply the following patch first, as it fixes a number of bugs in ext3.
13 # It will be applied automatically by the extN build process, or you
14 # can apply it to the source kernel tree and fix ext3 also. For chaos22
15 # (or other RH < 12.5 kernels) use the "chaos22" patch instead.
16 #EXTN_FIXES = ../patches/patch-2.4.18-chaos22
17 EXTN_FIXES = ext3-2.4.18-fixes.diff
18 EXTNP = htree-ext3-2.4.18.diff linux-2.4.18ea-0.8.26.diff
19 EXTNP+= ext3-2.4.18-ino_sb_macro.diff extN-misc-fixup.diff
20 EXTNC = balloc.c bitmap.c dir.c file.c fsync.c ialloc.c inode.c ioctl.c
21 EXTNC+= namei.c super.c symlink.c
22 EXTNI = extN_fs.h extN_fs_i.h extN_fs_sb.h extN_jbd.h
23 EXTN_EXTRA = include/linux/xattr.h include/linux/extN_xattr.h fs/extN/xattr.c
24 extN_SOURCES = $(EXTNC) xattr.c # punch.c
25 extN_DEPENDENCIES = patch-stamp
26 EXTRA_DIST = $(EXTNP) $(EXTN_FIXES) \
27 extN-2.4.18-ino_sb_fixup.diff extN-2.4.18-exports.diff \
28 $(wildcard extN.patch-*)
29 DISTCLEANFILES = -r $(extN_SOURCES) sed-stamp patch-stamp *.orig *.rej
30 SUB=-e "s/ext3/extN/g" -e "s/EXT3/EXTN/g"
33 cd .. && rm -f $(EXTN_EXTRA)
35 include $(top_srcdir)/Rules
37 # Create a fresh extN patch.
38 # This is for when the patch-stamp target fails for your kernel.
39 # Just edit the files until you like them, then do `make diff', and
40 # it will create a specialized patch for your particular kernel.
41 # Check it in, and the build should work for you without disrupting
42 # the other developers.
43 # Of course, the ideal is to merge changes so that the default patch
44 # set works for nearly everybody. This is mainly for damage control.
47 l='$(EXTNC)'; for f in $$l; do \
49 (cd $(top_srcdir) && \
50 diff -u extN/extN.orig/$$f extN/$$f) >> extN.patchT; \
51 test $$? -le 1 || exit 1; \
53 l='$(EXTNI)'; for f in $$l; do \
55 (cd $(top_srcdir) && \
56 diff -u extN/extN-include.orig/$$f include/linux/$$f)>>extN.patchT;\
57 test $$? -le 1 || exit 1; \
59 l='$(EXTN_EXTRA)'; for f in $$l; do \
60 f=`echo "$$f" | sed 's%^fs/%%'`; \
62 (cd $(top_srcdir) && \
63 diff -u /dev/null $$f) >> extN.patchT; \
64 test $$? -le 1 || exit 1; \
66 mv -f extN.patchT $(srcdir)/extN.patch-$(RELEASE)
67 echo "Don't forget to add $(srcdir)/extN.patch-$(RELEASE) to CVS!"
70 # Just do the SUB transformation on all our source files.
73 rm -rf extN.orig extN-include.orig
74 mkdir extN.orig extN-include.orig
75 list='$(EXTNC)'; for f in $$list; do \
76 echo "creating extN.orig/$$f"; \
77 sed $(SUB) $(LINUX)/fs/ext3/$$f > extN.orig/$$f; \
79 list='$(EXTNI)'; for i in $$list; do \
80 s=`echo $$i | sed "s/extN/ext3/"`; \
81 echo "creating extN-include.orig/$$i"; \
82 sed $(SUB) $(LINUX)/include/linux/$$s > extN-include.orig/$$i; \
86 # Patch the kernel files with our ext3 patches. We need to go through some
87 # extra hoops because the include files are in a different tree and because
88 # patch likes to make local copies of files with (sym)links when it is patching
89 # them. To avoid this, we copy/patch in the source dir instead of the build
90 # dir (if they are different).
91 # We also want to preserve the pristine transformed files for the diff target.
92 patch-stamp: sed-stamp $(EXTNP)
93 cp -a extN.orig/* $(srcdir)
94 cp -a extN-include.orig/* $(top_srcdir)/include/linux
95 test -e $(top_srcdir)/fs || ln -s . $(top_srcdir)/fs
96 list='$(EXTN_EXTRA)'; for f in $$list; do $(RM) $(top_srcdir)/$$f; done
97 if [ -f $(srcdir)/extN.patch-$(RELEASE) ]; then \
98 echo "applying patch $(srcdir)/extN.patch-$(RELEASE)"; \
99 (cd $(top_srcdir) && patch -p0) < $(srcdir)/extN.patch-$(RELEASE); \
101 echo "If first patch fails, read NOTE in extN/Makefile.am"; \
103 sed '/i_version/q' $(srcdir)/extN.orig/namei.c | tail -2 | \
104 grep extN_mark_inode_dirty >/dev/null && list="$(EXTN_FIXES) $$list"; \
105 for p in $$list; do \
106 echo "applying patch $$p"; \
107 sed $(SUB) $(srcdir)/$$p | \
108 (cd $(top_srcdir) && patch -p1) || exit $$?; \
110 echo "It is OK if the next patch says it is already applied"; \
111 echo "applying patch $(srcdir)/extN-2.4.18-exports.diff"; \
112 (cd $(top_srcdir) && \
113 patch -N -p1) < $(srcdir)/extN-2.4.18-exports.diff; \
114 echo "applying patch $(srcdir)/extN-2.4.18-ino_sb_fix.diff"; \
115 (cd $(top_srcdir) && \
116 patch -p1) < $(srcdir)/extN-2.4.18-ino_sb_fixup.diff || exit $$?; \
120 $(extN_SOURCES) $(EXTNI) $(EXTN_EXTRA): patch-stamp
122 # Don't distribute any patched files.
124 $(RM) $(top_srcdir)/fs
125 list='$(EXTNC)'; for f in $$list; do $(RM) $(distdir)/$$f; done
126 list='$(EXTNI)'; for i in $$list; do \
127 $(RM) $(distdir)/../include/linux/$$i; \
129 list='$(EXTN_EXTRA)'; for f in $$list; do $(RM) $(distdir)/../$$f; done