[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH f14-branch master 1/3] Add noeject support to loader (#477887)



When noeject is passed on the kernel command line disable ejecting the
cdrom.
---
 loader/cdinstall.c |    6 ++++++
 loader/loader.c    |    2 ++
 loader/loader.h    |    2 ++
 3 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/loader/cdinstall.c b/loader/cdinstall.c
index bde1bff..a8e4dfc 100644
--- a/loader/cdinstall.c
+++ b/loader/cdinstall.c
@@ -69,6 +69,12 @@ static void ejectCdrom(char *device) {
     int ejectfd;
 
     if (!device) return;
+
+    if (FL_NOEJECT(flags)) {
+        logMessage(INFO, "noeject in effect, not ejecting cdrom");
+        return;
+    }
+
     logMessage(INFO, "ejecting %s...",device);
     if ((ejectfd = open(device, O_RDONLY | O_NONBLOCK, 0)) >= 0) {
         ioctl(ejectfd, CDROM_LOCKDOOR, 0);
diff --git a/loader/loader.c b/loader/loader.c
index fd71004..a0fecbb 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -1018,6 +1018,8 @@ static void parseCmdLineFlags(struct loaderData_s * loaderData,
             } else {
                 flags |= LOADER_FLAGS_SELINUX;
             }
+        } else if (!strcasecmp(k, "noeject")) {
+            flags |= LOADER_FLAGS_NOEJECT;
         } else if (v != NULL) {
             /* boot arguments that are of the form name=value */
             /* all arguments in this block require the value  */
diff --git a/loader/loader.h b/loader/loader.h
index 1c54c52..e516ca3 100644
--- a/loader/loader.h
+++ b/loader/loader.h
@@ -71,6 +71,7 @@
 #define LOADER_FLAGS_NOKILL		(((uint64_t) 1) << 38)
 #define LOADER_FLAGS_KICKSTART_SEND_SERIAL   (((uint64_t) 1) << 39)
 #define LOADER_FLAGS_AUTOMODDISK        (((uint64_t) 1) << 40)
+#define LOADER_FLAGS_NOEJECT            (((uint64_t) 1) << 41)
 
 #define FL_TEXT(a)               ((a) & LOADER_FLAGS_TEXT)
 #define FL_RESCUE(a)             ((a) & LOADER_FLAGS_RESCUE)
@@ -107,6 +108,7 @@
 #define FL_NOKILL(a)		 ((a) & LOADER_FLAGS_NOKILL)
 #define FL_KICKSTART_SEND_SERIAL(a) ((a) & LOADER_FLAGS_KICKSTART_SEND_SERIAL)
 #define FL_AUTOMODDISK(a)        ((a) & LOADER_FLAGS_AUTOMODDISK)
+#define FL_NOEJECT(a)            ((a) & LOADER_FLAGS_NOEJECT)
 
 void doExit(int) __attribute__ ((noreturn));
 void startNewt(void);
-- 
1.7.2.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]