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-2.4.18-ino_sb_fixup.diff extN-2.4.18-exports.diff \
27 $(wildcard extN.patch-*)
28 DISTCLEANFILES = -r $(extN_SOURCES) sed-stamp patch-stamp *.orig *.rej
29 SUB=-e "s/ext3/extN/g" -e "s/EXT3/EXTN/g"
32 cd .. && rm -f $(EXTN_EXTRA)
34 include $(top_srcdir)/Rules
36 # Create a fresh extN patch.
37 # This is for when the patch-stamp target fails for your kernel.
38 # Just edit the files until you like them, then do `make diff', and
39 # it will create a specialized patch for your particular kernel.
40 # Check it in, and the build should work for you without disrupting
41 # the other developers.
42 # Of course, the ideal is to merge changes so that the default patch
43 # set works for nearly everybody. This is mainly for damage control.
46 l='$(EXTNC)'; for f in $$l; do \
48 (cd $(top_srcdir) && \
49 diff -u extN/extN.orig/$$f extN/$$f) >> extN.patchT; \
50 test $$? -le 1 || exit 1; \
52 l='$(EXTNI)'; for f in $$l; do \
54 (cd $(top_srcdir) && \
55 diff -u extN/extN-include.orig/$$f include/linux/$$f)>>extN.patchT;\
56 test $$? -le 1 || exit 1; \
58 l='$(EXTN_EXTRA)'; for f in $$l; do \
59 f=`echo "$$f" | sed 's%^fs/%%'`; \
61 (cd $(top_srcdir) && \
62 diff -u /dev/null $$f) >> extN.patchT; \
63 test $$? -le 1 || exit 1; \
65 mv -f extN.patchT $(srcdir)/extN.patch-$(RELEASE)
66 echo "Don't forget to add $(srcdir)/extN.patch-$(RELEASE) to CVS!"
69 # Just do the SUB transformation on all our source files.
72 rm -rf extN.orig extN-include.orig
73 mkdir extN.orig extN-include.orig
74 list='$(EXTNC)'; for f in $$list; do \
75 echo "creating extN.orig/$$f"; \
76 sed $(SUB) $(LINUX)/fs/ext3/$$f > extN.orig/$$f; \
78 list='$(EXTNI)'; for i in $$list; do \
79 s=`echo $$i | sed "s/extN/ext3/"`; \
80 echo "creating extN.orig-include/$$i"; \
81 sed $(SUB) $(LINUX)/include/linux/$$s > extN-include.orig/$$i; \
85 # Patch the kernel files with our ext3 patches. We need to go through some
86 # extra hoops because the include files are in a different tree and because
87 # patch likes to make local copies of files with (sym)links when it is patching
88 # them. To avoid this, we copy/patch in the source dir instead of the build
89 # dir (if they are different).
90 # We also want to preserve the pristine transformed files for the diff target.
91 patch-stamp: sed-stamp $(EXTNP)
92 cp -a extN.orig/* $(srcdir)
93 cp -a extN-include.orig/* $(top_srcdir)/include/linux
94 test -e $(top_srcdir)/fs || ln -s . $(top_srcdir)/fs
95 list='$(EXTN_EXTRA)'; for f in $$list; do $(RM) $(top_srcdir)/$$f; done
96 if [ -f $(srcdir)/extN.patch-$(RELEASE) ]; then \
97 echo "applying patch $(srcdir)/extN.patch-$(RELEASE)"; \
98 (cd $(top_srcdir) && patch -p0) < $(srcdir)/extN.patch-$(RELEASE); \
100 echo "If first patch fails, read NOTE in extN/Makefile.am"; \
102 sed '/i_version/q' $(srcdir)/extN.orig/namei.c | tail -2 | grep extN_mark_inode_dirty >/dev/null && list="$(EXTN_FIXES) $$list"; \
103 for p in $$list; do \
104 echo "applying patch $$p"; \
105 sed $(SUB) $(srcdir)/$$p | \
106 (cd $(top_srcdir) && patch -p1) || exit $$?; \
108 echo "It is OK if the next patch says it is already applied"; \
109 echo "applying patch $(srcdir)/extN-2.4.18-exports.diff"; \
110 (cd $(top_srcdir) && \
111 patch -N -p1) < $(srcdir)/extN-2.4.18-exports.diff; \
112 echo "applying patch $(srcdir)/extN-2.4.18-ino_sb_fix.diff"; \
113 (cd $(top_srcdir) && \
114 patch -p1) < $(srcdir)/extN-2.4.18-ino_sb_fixup.diff || exit $$?; \
118 $(extN_SOURCES) $(EXTNI) $(EXTN_EXTRA): patch-stamp
120 # Don't distribute any patched files.
122 $(RM) $(top_srcdir)/fs
123 list='$(EXTNC)'; for f in $$list; do $(RM) $(distdir)/$$f; done
124 list='$(EXTNI)'; for i in $$list; do \
125 $(RM) $(distdir)/../include/linux/$$i; \
127 list='$(EXTN_EXTRA)'; for f in $$list; do $(RM) $(distdir)/../$$f; done