2012-04-23 12:15:04 +02:00
|
|
|
Index: e2fsck/Makefile.in
|
|
|
|
===================================================================
|
2012-05-23 23:39:30 +02:00
|
|
|
--- e2fsck/Makefile.in.orig
|
|
|
|
+++ e2fsck/Makefile.in
|
2012-04-23 12:15:04 +02:00
|
|
|
@@ -68,7 +68,7 @@ OBJS= crc32.o dict.o unix.o e2fsck.o sup
|
2012-01-16 20:28:03 +01:00
|
|
|
pass3.o pass4.o pass5.o journal.o badblocks.o util.o dirinfo.o \
|
|
|
|
dx_dirinfo.o ehandler.o problem.o message.o quota.o recovery.o \
|
|
|
|
region.o revoke.o ea_refcount.o rehash.o profile.o prof_err.o \
|
2012-04-23 12:15:04 +02:00
|
|
|
- logfile.o sigcatcher.o $(MTRACE_OBJ)
|
|
|
|
+ logfile.o sigcatcher.o splash.o $(MTRACE_OBJ)
|
2012-01-16 20:28:03 +01:00
|
|
|
|
|
|
|
PROFILED_OBJS= profiled/dict.o profiled/unix.o profiled/e2fsck.o \
|
|
|
|
profiled/super.o profiled/pass1.o profiled/pass1b.o \
|
2012-04-23 12:15:04 +02:00
|
|
|
@@ -107,6 +107,7 @@ SRCS= $(srcdir)/e2fsck.c \
|
2012-01-16 20:28:03 +01:00
|
|
|
$(srcdir)/rehash.c \
|
|
|
|
$(srcdir)/region.c \
|
|
|
|
$(srcdir)/profile.c \
|
|
|
|
+ $(srcdir)/splash.c \
|
|
|
|
$(srcdir)/sigcatcher.c \
|
2012-04-23 12:15:04 +02:00
|
|
|
$(srcdir)/logfile.c \
|
2012-01-16 20:28:03 +01:00
|
|
|
prof_err.c \
|
2012-04-23 12:15:04 +02:00
|
|
|
@@ -516,6 +517,7 @@ region.o: $(srcdir)/region.c $(top_build
|
2012-01-16 20:28:03 +01:00
|
|
|
$(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \
|
|
|
|
$(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \
|
|
|
|
$(top_srcdir)/lib/quota/quota.h $(top_srcdir)/lib/../e2fsck/dict.h
|
|
|
|
+splash.o: $(srcdir)/splash.c $(srcdir)/splash.h
|
|
|
|
profile.o: $(srcdir)/profile.c $(top_builddir)/lib/config.h \
|
2012-04-23 12:15:04 +02:00
|
|
|
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/et/com_err.h \
|
|
|
|
$(srcdir)/profile.h prof_err.h
|
|
|
|
Index: e2fsck/splash.c
|
|
|
|
===================================================================
|
2012-05-23 23:39:30 +02:00
|
|
|
--- /dev/null
|
|
|
|
+++ e2fsck/splash.c
|
2008-12-05 15:15:07 +01:00
|
|
|
@@ -0,0 +1,100 @@
|
2008-09-29 19:30:42 +02:00
|
|
|
+/*
|
|
|
|
+ * add support for switching the splash screen on boot
|
|
|
|
+ */
|
|
|
|
+#include <stdio.h>
|
|
|
|
+#include <string.h>
|
|
|
|
+#include <sys/types.h>
|
|
|
|
+#include <sys/stat.h>
|
|
|
|
+#include <fcntl.h>
|
|
|
|
+#include <unistd.h>
|
|
|
|
+#include <errno.h>
|
|
|
|
+#include "splash.h"
|
|
|
|
+
|
|
|
|
+static int verbose = 0;
|
|
|
|
+
|
|
|
|
+/* nop implementation
|
|
|
|
+ */
|
|
|
|
+static void nop(void)
|
|
|
|
+{
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static struct splash_ops nop_ops = {
|
|
|
|
+ .splash_on = nop,
|
|
|
|
+ .splash_off = nop
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * bootsplash implementation
|
|
|
|
+ */
|
|
|
|
+#define BOOTSPLASH_CTL "/proc/splash"
|
|
|
|
+
|
|
|
|
+static int bootsplash_exists(void)
|
|
|
|
+{
|
|
|
|
+ struct stat sb;
|
|
|
|
+
|
|
|
|
+ if (stat(BOOTSPLASH_CTL, &sb) == -1)
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ if (S_ISREG(sb.st_mode))
|
|
|
|
+ return 1;
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
2008-10-07 15:56:07 +02:00
|
|
|
+/* write msg to splash control */
|
2008-09-29 19:30:42 +02:00
|
|
|
+static void bootsplash_msg(const char *msg, size_t size)
|
|
|
|
+{
|
|
|
|
+ int fd;
|
|
|
|
+ size_t written;
|
|
|
|
+
|
|
|
|
+ fd = open(BOOTSPLASH_CTL, O_WRONLY);
|
|
|
|
+ if (fd == -1) {
|
|
|
|
+ if (verbose)
|
|
|
|
+ printf("cannot open %s\n", BOOTSPLASH_CTL);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ written = write(fd, msg, size);
|
|
|
|
+ if (written != size) {
|
|
|
|
+ if (verbose)
|
|
|
|
+ printf("size = %i, written = %i\n", size, written);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ close(fd);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void bootsplash_on(void)
|
|
|
|
+{
|
|
|
|
+ if (verbose)
|
|
|
|
+ printf("setting bootsplash silent\n");
|
2008-12-05 15:15:07 +01:00
|
|
|
+ bootsplash_msg("silent\n", 7);
|
2008-09-29 19:30:42 +02:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void bootsplash_off(void)
|
|
|
|
+{
|
|
|
|
+ if (verbose)
|
|
|
|
+ printf("setting bootsplash verbose\n");
|
2008-12-05 15:15:07 +01:00
|
|
|
+ bootsplash_msg("verbose\n", 8);
|
2008-09-29 19:30:42 +02:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static struct splash_ops bootsplash_ops = {
|
|
|
|
+ .splash_on = bootsplash_on,
|
|
|
|
+ .splash_off = bootsplash_off
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * Initialisation
|
|
|
|
+ */
|
|
|
|
+void splash_init(struct splash_ops **ops)
|
|
|
|
+{
|
|
|
|
+ if (bootsplash_exists())
|
|
|
|
+ *ops = &bootsplash_ops;
|
|
|
|
+ else
|
|
|
|
+ *ops = &nop_ops;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void splash_set_verbose(void)
|
|
|
|
+{
|
|
|
|
+ verbose = 1;
|
|
|
|
+}
|
|
|
|
+
|
2012-04-23 12:15:04 +02:00
|
|
|
Index: e2fsck/splash.h
|
|
|
|
===================================================================
|
2012-05-23 23:39:30 +02:00
|
|
|
--- /dev/null
|
|
|
|
+++ e2fsck/splash.h
|
2008-09-29 19:30:42 +02:00
|
|
|
@@ -0,0 +1,13 @@
|
|
|
|
+#ifndef _SPLASH_H
|
|
|
|
+#define _SPLASH_H
|
|
|
|
+
|
|
|
|
+struct splash_ops {
|
|
|
|
+ void (*splash_on)(void);
|
|
|
|
+ void (*splash_off)(void);
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+void splash_init(struct splash_ops **ops);
|
|
|
|
+void splash_set_verbose(void);
|
|
|
|
+
|
|
|
|
+#endif /* _SPLASH_H */
|
|
|
|
+
|
2012-04-23 12:15:04 +02:00
|
|
|
Index: e2fsck/unix.c
|
|
|
|
===================================================================
|
2012-05-23 23:39:30 +02:00
|
|
|
--- e2fsck/unix.c.orig
|
|
|
|
+++ e2fsck/unix.c
|
|
|
|
@@ -51,6 +51,7 @@ extern int optind;
|
2008-09-29 19:30:42 +02:00
|
|
|
#include "e2p/e2p.h"
|
|
|
|
#include "e2fsck.h"
|
|
|
|
#include "problem.h"
|
|
|
|
+#include "splash.h"
|
|
|
|
#include "../version.h"
|
|
|
|
|
|
|
|
/* Command line options */
|
2012-05-23 23:39:30 +02:00
|
|
|
@@ -1138,6 +1139,7 @@ int main (int argc, char *argv[])
|
2008-09-29 19:30:42 +02:00
|
|
|
__u32 features[3];
|
|
|
|
char *cp;
|
2012-05-23 23:39:30 +02:00
|
|
|
int qtype; /* quota type */
|
2008-09-29 19:30:42 +02:00
|
|
|
+ struct splash_ops *sops;
|
|
|
|
|
|
|
|
clear_problem_context(&pctx);
|
2012-01-16 20:28:03 +01:00
|
|
|
sigcatcher_setup();
|
2012-05-23 23:39:30 +02:00
|
|
|
@@ -1169,6 +1171,7 @@ int main (int argc, char *argv[])
|
2008-09-29 19:30:42 +02:00
|
|
|
exit(FSCK_ERROR);
|
|
|
|
}
|
|
|
|
reserve_stdio_fds();
|
|
|
|
+ splash_init(&sops);
|
|
|
|
|
2012-04-23 12:15:04 +02:00
|
|
|
set_up_logging(ctx);
|
|
|
|
if (ctx->logf) {
|
2012-05-23 23:39:30 +02:00
|
|
|
@@ -1543,6 +1546,7 @@ print_unsupp_features:
|
2008-09-29 19:30:42 +02:00
|
|
|
fatal_error(ctx, 0);
|
|
|
|
check_if_skip(ctx);
|
2009-07-03 17:13:02 +02:00
|
|
|
check_resize_inode(ctx);
|
2008-09-29 19:30:42 +02:00
|
|
|
+ sops->splash_off();
|
|
|
|
if (bad_blocks_file)
|
|
|
|
read_bad_blocks_file(ctx, bad_blocks_file, replace_bad_blocks);
|
|
|
|
else if (cflag)
|