forked from pool/e2fsprogs
fcf0c12c54
Rev filesystems/22 Md5 787d7eb03cbf1ac71bfe45d5b274f9b9 2012-01-16 19:28:03 jankara 100294
194 lines
4.9 KiB
Diff
194 lines
4.9 KiB
Diff
diff -uNr e2fsprogs-1.42.orig/e2fsck/Makefile.in e2fsprogs-1.42/e2fsck/Makefile.in
|
|
--- e2fsprogs-1.42.orig/e2fsck/Makefile.in 2011-09-18 17:10:03.000000000 -0400
|
|
+++ e2fsprogs-1.42/e2fsck/Makefile.in 2012-01-12 13:16:34.647198494 -0500
|
|
@@ -68,7 +68,7 @@
|
|
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 \
|
|
- sigcatcher.o $(MTRACE_OBJ)
|
|
+ sigcatcher.o splash.o $(MTRACE_OBJ)
|
|
|
|
PROFILED_OBJS= profiled/dict.o profiled/unix.o profiled/e2fsck.o \
|
|
profiled/super.o profiled/pass1.o profiled/pass1b.o \
|
|
@@ -78,7 +78,7 @@
|
|
profiled/message.o profiled/problem.o profiled/quota.o \
|
|
profiled/recovery.o profiled/region.o profiled/revoke.o \
|
|
profiled/ea_refcount.o profiled/rehash.o profiled/profile.o \
|
|
- profiled/crc32.o profiled/prof_err.o profiled/sigcatcher.o
|
|
+ profiled/crc32.o profiled/prof_err.o profiled/sigcatcher.o
|
|
|
|
SRCS= $(srcdir)/e2fsck.c \
|
|
$(srcdir)/crc32.c \
|
|
@@ -106,6 +106,7 @@
|
|
$(srcdir)/rehash.c \
|
|
$(srcdir)/region.c \
|
|
$(srcdir)/profile.c \
|
|
+ $(srcdir)/splash.c \
|
|
$(srcdir)/sigcatcher.c \
|
|
prof_err.c \
|
|
$(srcdir)/quota.c \
|
|
@@ -487,6 +488,7 @@
|
|
$(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 \
|
|
$(top_srcdir)/lib/et/com_err.h $(srcdir)/profile.h prof_err.h
|
|
sigcatcher.o: $(srcdir)/sigcatcher.c $(top_builddir)/lib/config.h \
|
|
diff -uNr e2fsprogs-1.42.orig/e2fsck/splash.c e2fsprogs-1.42/e2fsck/splash.c
|
|
--- e2fsprogs-1.42.orig/e2fsck/splash.c 1969-12-31 19:00:00.000000000 -0500
|
|
+++ e2fsprogs-1.42/e2fsck/splash.c 2012-01-12 13:33:24.418574614 -0500
|
|
@@ -0,0 +1,100 @@
|
|
+/*
|
|
+ * 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;
|
|
+}
|
|
+
|
|
+/* write msg to splash control */
|
|
+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");
|
|
+ bootsplash_msg("silent\n", 7);
|
|
+}
|
|
+
|
|
+static void bootsplash_off(void)
|
|
+{
|
|
+ if (verbose)
|
|
+ printf("setting bootsplash verbose\n");
|
|
+ bootsplash_msg("verbose\n", 8);
|
|
+}
|
|
+
|
|
+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;
|
|
+}
|
|
+
|
|
diff -uNr e2fsprogs-1.42.orig/e2fsck/splash.h e2fsprogs-1.42/e2fsck/splash.h
|
|
--- e2fsprogs-1.42.orig/e2fsck/splash.h 1969-12-31 19:00:00.000000000 -0500
|
|
+++ e2fsprogs-1.42/e2fsck/splash.h 2012-01-12 13:33:24.418574614 -0500
|
|
@@ -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 */
|
|
+
|
|
diff -uNr e2fsprogs-1.42.orig/e2fsck/unix.c e2fsprogs-1.42/e2fsck/unix.c
|
|
--- e2fsprogs-1.42.orig/e2fsck/unix.c 2011-11-14 10:55:54.000000000 -0500
|
|
+++ e2fsprogs-1.42/e2fsck/unix.c 2012-01-12 13:20:01.726609643 -0500
|
|
@@ -54,6 +54,7 @@
|
|
#include "e2p/e2p.h"
|
|
#include "e2fsck.h"
|
|
#include "problem.h"
|
|
+#include "splash.h"
|
|
#include "../version.h"
|
|
|
|
/* Command line options */
|
|
@@ -1108,6 +1109,7 @@
|
|
int old_bitmaps;
|
|
__u32 features[3];
|
|
char *cp;
|
|
+ struct splash_ops *sops;
|
|
|
|
clear_problem_context(&pctx);
|
|
sigcatcher_setup();
|
|
@@ -1139,6 +1141,7 @@
|
|
exit(FSCK_ERROR);
|
|
}
|
|
reserve_stdio_fds();
|
|
+ splash_init(&sops);
|
|
|
|
init_resource_track(&ctx->global_rtrack, NULL);
|
|
if (!(ctx->options & E2F_OPT_PREEN) || show_version_only)
|
|
@@ -1484,6 +1487,7 @@
|
|
fatal_error(ctx, 0);
|
|
check_if_skip(ctx);
|
|
check_resize_inode(ctx);
|
|
+ sops->splash_off();
|
|
if (bad_blocks_file)
|
|
read_bad_blocks_file(ctx, bad_blocks_file, replace_bad_blocks);
|
|
else if (cflag)
|