diff options
author | Philip Tricca <flihp@twobit.us> | 2015-06-17 15:30:54 -0700 |
---|---|---|
committer | Joe MacDonald <joe_macdonald@mentor.com> | 2015-08-08 16:43:23 -0400 |
commit | e9b28794f168ca20fc5477f46a65135eb19248a4 (patch) | |
tree | 32590fa8cd464e3fc029dcd8aee3d4254655a207 | |
parent | 6319e568d0a3a9ac051e86ecf9b8fbc4b151757c (diff) | |
download | meta-selinux-e9b28794f168ca20fc5477f46a65135eb19248a4.tar.gz |
e2fsprogs: Insert calls to xattr module into mke2fs and build xattr code.
Signed-off-by: Philip Tricca <flihp@twobit.us>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
-rw-r--r-- | recipes-devtools/e2fsprogs/e2fsprogs/mke2fs.c-create_inode.c-copy-xattrs.patch | 164 | ||||
-rw-r--r-- | recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bbappend | 1 |
2 files changed, 165 insertions, 0 deletions
diff --git a/recipes-devtools/e2fsprogs/e2fsprogs/mke2fs.c-create_inode.c-copy-xattrs.patch b/recipes-devtools/e2fsprogs/e2fsprogs/mke2fs.c-create_inode.c-copy-xattrs.patch new file mode 100644 index 0000000..8b0109f --- /dev/null +++ b/recipes-devtools/e2fsprogs/e2fsprogs/mke2fs.c-create_inode.c-copy-xattrs.patch | |||
@@ -0,0 +1,164 @@ | |||
1 | Insert calls into xattr module to copy xattrs for each file system object | ||
2 | copied by mke2fs when '-d' is specified. This requires a call to | ||
3 | set_inode_xattr in two places: | ||
4 | misc/create_inode.c: to copy xattrs as part of the recursive traversal | ||
5 | of the source directory | ||
6 | misc/mke2fs.c: to copy the xattr block associated with the root of the | ||
7 | file system | ||
8 | |||
9 | Insert a call to xattr_cleanup to free any resources that need special | ||
10 | handling in the xattr module. | ||
11 | |||
12 | We also add the necessary rules to Makefile.in to build the xattr module | ||
13 | and link it into executables as required. | ||
14 | |||
15 | Signed-off-by: Philip Tricca <flihp@twobit.us> | ||
16 | |||
17 | Index: e2fsprogs-1.42.9/misc/mke2fs.c | ||
18 | =================================================================== | ||
19 | --- e2fsprogs-1.42.9.orig/misc/mke2fs.c | ||
20 | +++ e2fsprogs-1.42.9/misc/mke2fs.c | ||
21 | @@ -56,6 +56,7 @@ extern int optind; | ||
22 | #include "../version.h" | ||
23 | #include "quota/mkquota.h" | ||
24 | #include "create_inode.h" | ||
25 | +#include "xattr.h" | ||
26 | |||
27 | #define STRIDE_LENGTH 8 | ||
28 | |||
29 | @@ -2744,6 +2745,11 @@ no_journal: | ||
30 | hdlinks.count = 0; | ||
31 | current_fs = fs; | ||
32 | root = EXT2_ROOT_INO; | ||
33 | + retval = set_inode_xattr (fs, EXT2_ROOT_INO, root_dir); | ||
34 | + if (retval) { | ||
35 | + fprintf(stderr, "%s", _("Error setting xattr for inode: 0x%x\n"), EXT2_ROOT_INO); | ||
36 | + return retval; | ||
37 | + } | ||
38 | retval = populate_fs(root, root_dir); | ||
39 | if (retval) { | ||
40 | fprintf(stderr, "%s", | ||
41 | @@ -2751,6 +2757,7 @@ no_journal: | ||
42 | return retval; | ||
43 | } else if (!quiet) | ||
44 | printf("%s", _("done\n")); | ||
45 | + xattr_cleanup(); | ||
46 | } | ||
47 | |||
48 | if (!quiet) | ||
49 | Index: e2fsprogs-1.42.9/misc/create_inode.c | ||
50 | =================================================================== | ||
51 | --- e2fsprogs-1.42.9.orig/misc/create_inode.c | ||
52 | +++ e2fsprogs-1.42.9/misc/create_inode.c | ||
53 | @@ -1,5 +1,6 @@ | ||
54 | #include "create_inode.h" | ||
55 | #include <limits.h> | ||
56 | +#include "xattr.h" | ||
57 | |||
58 | #if __STDC_VERSION__ < 199901L | ||
59 | # if __GNUC__ >= 2 | ||
60 | @@ -549,6 +550,12 @@ errcode_t populate_fs(ext2_ino_t parent_ | ||
61 | return retval; | ||
62 | } | ||
63 | |||
64 | + if ((retval = set_inode_xattr (current_fs, ino, name))) { | ||
65 | + com_err(__func__, retval, | ||
66 | + _("while setting xattrs for \"%s\""), name); | ||
67 | + return retval; | ||
68 | + } | ||
69 | + | ||
70 | /* Save the hardlink ino */ | ||
71 | if (save_inode) { | ||
72 | /* | ||
73 | Index: e2fsprogs-1.42.9/debugfs/Makefile.in | ||
74 | =================================================================== | ||
75 | --- e2fsprogs-1.42.9.orig/debugfs/Makefile.in | ||
76 | +++ e2fsprogs-1.42.9/debugfs/Makefile.in | ||
77 | @@ -18,7 +18,7 @@ MK_CMDS= _SS_DIR_OVERRIDE=../lib/ss ../l | ||
78 | |||
79 | DEBUG_OBJS= debug_cmds.o debugfs.o util.o ncheck.o icheck.o ls.o \ | ||
80 | lsdel.o dump.o set_fields.o logdump.o htree.o unused.o e2freefrag.o \ | ||
81 | - filefrag.o extent_cmds.o extent_inode.o zap.o create_inode.o | ||
82 | + filefrag.o extent_cmds.o extent_inode.o zap.o create_inode.o xattr.o | ||
83 | |||
84 | RO_DEBUG_OBJS= ro_debug_cmds.o ro_debugfs.o util.o ncheck.o icheck.o ls.o \ | ||
85 | lsdel.o logdump.o htree.o e2freefrag.o filefrag.o extent_cmds.o \ | ||
86 | @@ -29,12 +29,16 @@ SRCS= debug_cmds.c $(srcdir)/debugfs.c $ | ||
87 | $(srcdir)/dump.c $(srcdir)/set_fields.c ${srcdir}/logdump.c \ | ||
88 | $(srcdir)/htree.c $(srcdir)/unused.c ${srcdir}/../misc/e2freefrag.c \ | ||
89 | $(srcdir)/filefrag.c $(srcdir)/extent_inode.c $(srcdir)/zap.c \ | ||
90 | - $(srcdir)/../misc/create_inode.c | ||
91 | + $(srcdir)/../misc/create_inode.c $(srcdir)/../misc/xattr.c | ||
92 | |||
93 | CREATE_INODE_DEPS= $(srcdir)/../misc/create_inode.h \ | ||
94 | $(srcdir)/../misc/create_inode.c $(top_builddir)/lib/config.h \ | ||
95 | $(srcdir)/../lib/ext2fs/ext2fs.h $(srcdir)/../lib/et/com_err.h \ | ||
96 | - $(srcdir)/../lib/e2p/e2p.h $(srcdir)/../misc/nls-enable.h | ||
97 | + $(srcdir)/../lib/e2p/e2p.h $(srcdir)/../misc/nls-enable.h \ | ||
98 | + $(srcdir)/../misc/xattr.h | ||
99 | + | ||
100 | +XATTR_DEPS= $(srcdir)/../misc/xattr.h $(srcdir)/../misc/xattr.h \ | ||
101 | + $(srcdir)/../lib/et/com_err.h $(srcdir)/../lib/ext2fs/ext2fs.h | ||
102 | |||
103 | LIBS= $(LIBEXT2FS) $(LIBE2P) $(LIBSS) $(LIBCOM_ERR) $(LIBBLKID) \ | ||
104 | $(LIBUUID) | ||
105 | @@ -92,6 +96,11 @@ create_inode.o: $(CREATE_INODE_DEPS) | ||
106 | $(Q) $(CC) -c $(ALL_CFLAGS) -I$(srcdir) \ | ||
107 | $(srcdir)/../misc/create_inode.c -DDEBUGFS -o $@ | ||
108 | |||
109 | +xattr.o: $(XATTR_DEPS) | ||
110 | + $(E) " CC $@" | ||
111 | + $(Q) $(CC) -c $(ALL_CFLAGS) -I$(srcdir) \ | ||
112 | + $(srcdir)/../misc/xattr.c -o $@ | ||
113 | + | ||
114 | debugfs.8: $(DEP_SUBSTITUTE) $(srcdir)/debugfs.8.in | ||
115 | $(E) " SUBST $@" | ||
116 | $(Q) $(SUBSTITUTE_UPTIME) $(srcdir)/debugfs.8.in debugfs.8 | ||
117 | Index: e2fsprogs-1.42.9/misc/Makefile.in | ||
118 | =================================================================== | ||
119 | --- e2fsprogs-1.42.9.orig/misc/Makefile.in | ||
120 | +++ e2fsprogs-1.42.9/misc/Makefile.in | ||
121 | @@ -43,7 +43,7 @@ LPROGS= @E2INITRD_PROG@ | ||
122 | TUNE2FS_OBJS= tune2fs.o util.o | ||
123 | MKLPF_OBJS= mklost+found.o | ||
124 | MKE2FS_OBJS= mke2fs.o util.o profile.o prof_err.o default_profile.o \ | ||
125 | - create_inode.o | ||
126 | + create_inode.o xattr.o | ||
127 | CHATTR_OBJS= chattr.o | ||
128 | LSATTR_OBJS= lsattr.o | ||
129 | UUIDGEN_OBJS= uuidgen.o | ||
130 | @@ -62,7 +62,7 @@ PROFILED_TUNE2FS_OBJS= profiled/tune2fs. | ||
131 | PROFILED_MKLPF_OBJS= profiled/mklost+found.o | ||
132 | PROFILED_MKE2FS_OBJS= profiled/mke2fs.o profiled/util.o profiled/profile.o \ | ||
133 | profiled/prof_err.o profiled/default_profile.o \ | ||
134 | - profiled/create_inode.o | ||
135 | + profiled/create_inode.o profiled/xattr.o | ||
136 | PROFILED_CHATTR_OBJS= profiled/chattr.o | ||
137 | PROFILED_LSATTR_OBJS= profiled/lsattr.o | ||
138 | PROFILED_UUIDGEN_OBJS= profiled/uuidgen.o | ||
139 | @@ -84,7 +84,8 @@ SRCS= $(srcdir)/tune2fs.c $(srcdir)/mklo | ||
140 | $(srcdir)/uuidgen.c $(srcdir)/blkid.c $(srcdir)/logsave.c \ | ||
141 | $(srcdir)/filefrag.c $(srcdir)/base_device.c \ | ||
142 | $(srcdir)/ismounted.c $(srcdir)/../e2fsck/profile.c \ | ||
143 | - $(srcdir)/e2undo.c $(srcdir)/e2freefrag.c $(srcdir)/create_inode.c | ||
144 | + $(srcdir)/e2undo.c $(srcdir)/e2freefrag.c $(srcdir)/create_inode.c \ | ||
145 | + $(srcdir)/xattr.c | ||
146 | |||
147 | LIBS= $(LIBEXT2FS) $(LIBCOM_ERR) | ||
148 | DEPLIBS= $(LIBEXT2FS) $(DEPLIBCOM_ERR) | ||
149 | @@ -634,7 +635,8 @@ mke2fs.o: $(srcdir)/mke2fs.c $(top_build | ||
150 | $(srcdir)/util.h profile.h prof_err.h $(top_srcdir)/version.h \ | ||
151 | $(srcdir)/nls-enable.h $(top_srcdir)/lib/quota/mkquota.h $(srcdir)/create_inode.h\ | ||
152 | $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ | ||
153 | - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h | ||
154 | + $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ | ||
155 | + $(srcdir)/xattr.h | ||
156 | chattr.o: $(srcdir)/chattr.c $(top_builddir)/lib/config.h \ | ||
157 | $(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \ | ||
158 | $(top_builddir)/lib/ext2fs/ext2_types.h $(top_srcdir)/lib/et/com_err.h \ | ||
159 | @@ -716,3 +718,5 @@ create_inode.o: $(srcdir)/create_inode.h | ||
160 | $(top_builddir)/lib/config.h $(top_srcdir)/lib/ext2fs/ext2fs.h \ | ||
161 | $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/e2p/e2p.h \ | ||
162 | $(srcdir)/nls-enable.h | ||
163 | +xattr.o: $(srcdir)/xattr.h $(srcdir)/xattr.c \ | ||
164 | + $(top_builddir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2fs.h | ||
diff --git a/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bbappend b/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bbappend index 02318ea..3950bf7 100644 --- a/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bbappend +++ b/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bbappend | |||
@@ -2,4 +2,5 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | |||
2 | 2 | ||
3 | SRC_URI += " \ | 3 | SRC_URI += " \ |
4 | file://misc-xattr-add-xattr-module-stub.patch \ | 4 | file://misc-xattr-add-xattr-module-stub.patch \ |
5 | file://mke2fs.c-create_inode.c-copy-xattrs.patch \ | ||
5 | " | 6 | " |