[PATCH 1/2] kexec-tool: Add generic function to append a string to second kernel commandline

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


Hi,

o Patch to add a generic function to append a string eg. reset_devices, to the 
  second kernel command line.

Signed-off-by: Ankita Garg <ankita at in.ibm.com>
--

 kexec.c |   16 ++++++++++++++++
 kexec.h |    2 +-
 2 files changed, 17 insertions(+), 1 deletion(-)

Index: kexec-tools-testing-20061214/kexec/kexec.c
===================================================================
--- kexec-tools-testing-20061214.orig/kexec/kexec.c	2008-04-11 03:05:38.000000000 -0500
+++ kexec-tools-testing-20061214/kexec/kexec.c	2008-04-11 03:10:05.000000000 -0500
@@ -347,6 +347,22 @@
 	return base;
 }
 
+int cmdline_append_string(char *cmdline, char *append_str, int cmdline_size)
+{
+	int cmdlen;
+
+	if(cmdline_size)
+	{
+		cmdlen = strlen(cmdline) + strlen(append_str);
+		if (cmdlen > (cmdline_size - 1))
+			die("Command line overflow\n");
+	}
+	strcat(cmdline, append_str);
+	dfprintf(stdout, "Command line after adding reset_devices\n");
+	dfprintf(stdout, "%s\n", cmdline);
+	return 0;
+}
+
 char *slurp_file(const char *filename, off_t *r_size)
 {
 	int fd;
Index: kexec-tools-testing-20061214/kexec/kexec.h
===================================================================
--- kexec-tools-testing-20061214.orig/kexec/kexec.h	2008-04-11 03:05:38.000000000 -0500
+++ kexec-tools-testing-20061214/kexec/kexec.h	2008-04-11 19:33:25.000000000 -0500
@@ -188,7 +188,8 @@
 	const void *buf, unsigned long bufsz, unsigned long memsz,
 	unsigned long buf_align, unsigned long buf_min, unsigned long buf_max,
 	int buf_end);
-
+extern int cmdline_append_string(char *cmdline, char *append_str,
+	int cmdline_size);
 extern unsigned char purgatory[];
 extern size_t purgatory_size;
 

Regards, 
-- 
Ankita Garg (ankita at in.ibm.com)
Linux Technology Center
IBM India Systems & Technology Labs, 
Bangalore, India   


[Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Photo]     [Yosemite]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Linux Media]     [Linux Resources]

Powered by Linux