OpenVZ Forum


Home » Mailing lists » Devel » [PATCH 0/2] cryo: fixes for handling options -l and -f
[PATCH 0/2] cryo: fixes for handling options -l and -f [message #30864] Mon, 09 June 2008 14:47 Go to next message
Benjamin Thery is currently offline  Benjamin Thery
Messages: 79
Registered: March 2007
Member
Serge,

I've cloned your cryo tree and I'm starting to play with it.
Here are a couple of trivial patches to fix some small issues
with options handling: -l (list) and -f in checkpoint mode.

Still trying to restart the 'sleep' test program.

Benjamin
-- 
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
[PATCH 1/2] cryo: Fix option -l [message #30865 is a reply to message #30864] Mon, 09 June 2008 14:47 Go to previous messageGo to next message
Benjamin Thery is currently offline  Benjamin Thery
Messages: 79
Registered: March 2007
Member
This tiny patch fixes the handling of option -l.
'l' must be added to the getopt() call and the subsequent switch{] if
we don't want to exit too soon.

This makes the following command works:

$ cr -l -t test.cryo

Signed-off-by: Benjamin Thery <benjamin.thery@bull.net>
---
 cr.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: cryodev/cr.c
===================================================================
--- cryodev.orig/cr.c
+++ cryodev/cr.c
@@ -1227,10 +1227,11 @@ int main(int argc, char **argv)
 	int fd = 0;
 	int perm = O_RDONLY;
 
-	while ((ch = getopt(argc, argv, "dmp:rRksf:")) != EOF) {
+	while ((ch = getopt(argc, argv, "dlmp:rRksf:")) != EOF) {
 		switch (ch) {
 		case 'd': 	cr_mode |= CR_DEBUG; Debug_mode = 1; break;
 		case 'k': 	cr_mode |= CR_KILL; break;
+		case 'l':	mode = ch; break;
 		case 's':	cr_mode |= CR_STOP; break;
 		case 'm':	cr_mode |= CR_MMAP; break;
 		case 'p':	mode = ch; fd = 1; perm = O_WRONLY; pid = (pid_t)atoi(optarg); break;

-- 
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
[PATCH 2/2] cryo: Fix option -f in checkpointing mode [message #30866 is a reply to message #30864] Mon, 09 June 2008 14:47 Go to previous messageGo to next message
Benjamin Thery is currently offline  Benjamin Thery
Messages: 79
Registered: March 2007
Member
Option -f couldn't be used in conjunction with option -p (for checkpointing).
O_CREAT is missing in the flags passed to open().

Now, we can do:

$ cr -p MYPID -f test.cryo

(I know the coding style is not perfect (long lines, several instructions
on the same line), but it fits with cryo's style :) ).

Signed-off-by: Benjamin Thery <benjamin.thery@bull.net>
---
 cr.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: cryodev/cr.c
===================================================================
--- cryodev.orig/cr.c
+++ cryodev/cr.c
@@ -1234,7 +1234,7 @@ int main(int argc, char **argv)
 		case 'l':	mode = ch; break;
 		case 's':	cr_mode |= CR_STOP; break;
 		case 'm':	cr_mode |= CR_MMAP; break;
-		case 'p':	mode = ch; fd = 1; perm = O_WRONLY; pid = (pid_t)atoi(optarg); break;
+		case 'p':	mode = ch; fd = 1; perm = O_WRONLY|O_CREAT; pid = (pid_t)atoi(optarg); break;
 		case 'r':	mode = ch; break;
 		case 'f':	strncpy(filename, optarg, sizeof(filename)); break;
 		default:	usage(); exit(1);

-- 
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Re: [PATCH 2/2] cryo: Fix option -f in checkpointing mode [message #30879 is a reply to message #30866] Mon, 09 June 2008 16:42 Go to previous messageGo to next message
serue is currently offline  serue
Messages: 750
Registered: February 2006
Senior Member
Quoting Dave Hansen (dave@linux.vnet.ibm.com):
> On Mon, 2008-06-09 at 16:47 +0200, Benjamin Thery wrote:
> > Option -f couldn't be used in conjunction with option -p (for
> > checkpointing).
> > O_CREAT is missing in the flags passed to open().
> > 
> > Now, we can do:
> > 
> > $ cr -p MYPID -f test.cryo
> > 
> > (I know the coding style is not perfect (long lines, several
> > instructions
> > on the same line), but it fits with cryo's style :) ).
> 
> So, I suggest that we start using kernel coding style on this sucker.
> We're all used to it, and the original developer isn't around to bitch
> about it. :)

Yeah, agreed.  That does *not* mean that I want pure style fix patches!!  :)

thanks,
-serge
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Re: [PATCH 2/2] cryo: Fix option -f in checkpointing mode [message #30880 is a reply to message #30879] Mon, 09 June 2008 16:44 Go to previous messageGo to next message
Dave Hansen is currently offline  Dave Hansen
Messages: 240
Registered: October 2005
Senior Member
On Mon, 2008-06-09 at 11:42 -0500, Serge E. Hallyn wrote:
> > So, I suggest that we start using kernel coding style on this
> sucker.
> > We're all used to it, and the original developer isn't around to
> bitch
> > about it. :)
> 
> Yeah, agreed.  That does *not* mean that I want pure style fix
> patches!!  :)

Yep, I'd say treat it the same way we do whitespace in the kernel.
Touch it if you're either in the *IMMEDIATE* area or or patching the
code itself.  

-- Dave

_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Re: [PATCH 0/2] cryo: fixes for handling options -l and -f [message #30882 is a reply to message #30864] Mon, 09 June 2008 16:55 Go to previous message
serue is currently offline  serue
Messages: 750
Registered: February 2006
Senior Member
Quoting Benjamin Thery (benjamin.thery@bull.net):
> Serge,
> 
> I've cloned your cryo tree and I'm starting to play with it.
> Here are a couple of trivial patches to fix some small issues
> with options handling: -l (list) and -f in checkpoint mode.
> 
> Still trying to restart the 'sleep' test program.
> 
> Benjamin
> -- 

Thanks, applied.

-serge
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Re: [PATCH 2/2] cryo: Fix option -f in checkpointing mode [message #30884 is a reply to message #30866] Mon, 09 June 2008 16:16 Go to previous message
Dave Hansen is currently offline  Dave Hansen
Messages: 240
Registered: October 2005
Senior Member
On Mon, 2008-06-09 at 16:47 +0200, Benjamin Thery wrote:
> Option -f couldn't be used in conjunction with option -p (for
> checkpointing).
> O_CREAT is missing in the flags passed to open().
> 
> Now, we can do:
> 
> $ cr -p MYPID -f test.cryo
> 
> (I know the coding style is not perfect (long lines, several
> instructions
> on the same line), but it fits with cryo's style :) ).

So, I suggest that we start using kernel coding style on this sucker.
We're all used to it, and the original developer isn't around to bitch
about it. :)

-- Dave

_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Previous Topic: Re: restarting tests/sleep
Next Topic: Re: restarting tests/sleep
Goto Forum:
  


Current Time: Mon Jun 17 16:33:15 GMT 2024

Total time taken to generate the page: 0.03780 seconds