All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Neal <jneal@nks.net>
To: Jeff Dike <jdike@addtoit.com>
Cc: user-mode-linux-devel@lists.sourceforge.net
Subject: Re: [uml-devel] uml_utilities_20030903
Date: Wed, 03 Sep 2003 21:53:17 -0400	[thread overview]
Message-ID: <3F569B0D.4060803@nks.net> (raw)
In-Reply-To: <200309032033.h83KXM6b013752@ccure.karaya.com>

[-- Attachment #1: Type: text/plain, Size: 579 bytes --]

Jeff Dike wrote:
> The main addition in this update is COW V3 support in uml_moo.  uml_mkcow
> is also here, although I wouldn't get too attached to it since I'm thinking
> about moving it into uml_moo and making that the Swiss Army knife of COW file
> manipulation.

Here's the uml_moo.c patch which allows the user to provide the path to
the backing store, overriding the path listed in the COW file.  Useful
when manipulating a COW file created in a chrooted jail.

Updated for uml_utilities_20030903.

Anything you'd like done to it to would make it merge in easier?

-James

[-- Attachment #2: uml_moo.c.patch --]
[-- Type: text/plain, Size: 2247 bytes --]

--- uml_moo.c.orig	Wed Sep  3 12:38:48 2003
+++ uml_moo.c	Wed Sep  3 21:17:55 2003
@@ -38,7 +38,7 @@ static inline void ubd_set_bit(int bit, 
 	data[n] |= (1 << off);
 }
 
-int create_backing_file(char *in, char *out)
+int create_backing_file(char *in, char *out, char *old)
 {
 	int cow_fd, back_fd, in_fd, out_fd;
 	struct stat buf;
@@ -65,10 +65,15 @@ int create_backing_file(char *in, char *
 		exit(1);
 	}
 
+	if(old != NULL) {
+		backing_file = old;
+	}
+
 	if(stat(backing_file, &buf) < 0) {
 		perror("Stating backing file");
 		exit(1);
 	}
+
 	if(buf.st_size != size){
 		fprintf(stderr,"Size mismatch (%ld vs %ld) of COW header "
 			"vs backing file \"%s\"\n", (long int) size, 
@@ -192,13 +197,15 @@ int create_backing_file(char *in, char *
 
 int Usage(char *prog) {
 	fprintf(stderr, "%s usage:\n", prog);
-	fprintf(stderr, "\t%s <COW file> <new backing file>\n", prog);
-	fprintf(stderr, "\t%s -d <COW file>\n", prog);
+	fprintf(stderr, "\t%s [ -O <old backing file> ] <COW file> <new backing file>\n", prog);
+	fprintf(stderr, "\t%s [ -O <old backing file> ] -d <COW file>\n", prog);
 	fprintf(stderr, "Creates a new filesystem image from the COW file "
 		"and its backing file.\n");
 	fprintf(stderr, "Specifying -d will cause a destructive, in-place "
 		"merge of the COW file into\n");
 	fprintf(stderr, "its current backing file\n");
+	fprintf(stderr, "Specifying -O <old backing file> overrides the backing_file\n");
+	fprintf(stderr, "field specified in the COW file.\n");
 	fprintf(stderr, "%s supports version 1 and 2 COW files.\n", prog);
 	exit(1);
 }
@@ -206,6 +213,7 @@ int Usage(char *prog) {
 int main(int argc, char **argv)
 {
 	char *prog = argv[0];
+	char *real_backing_file = NULL;
 	int in_place = 0;
 
 	argv++;
@@ -220,13 +228,23 @@ int main(int argc, char **argv)
 		argc--;
 	}
 
+	if(!strcmp(argv[0], "-O")){
+		real_backing_file = argv[1];
+		argv++;
+		argc--;
+
+		argv++;
+		argc--;
+
+	}
+
 	if(in_place){
 		if(argc != 1) Usage(prog);
-		create_backing_file(argv[0], NULL);
+		create_backing_file(argv[0], NULL, real_backing_file);
 	}
 	else {
 		if(argc != 2) Usage(prog);
-		create_backing_file(argv[0], argv[1]);
+		create_backing_file(argv[0], argv[1], real_backing_file);
 	}
 	return 0;
 }

      parent reply	other threads:[~2003-09-04  1:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-03 20:33 [uml-devel] uml_utilities_20030903 Jeff Dike
2003-09-04  0:06 ` [uml-devel] Re: [uml-user] uml_utilities_20030903 Net Llama!
2003-09-04  2:30   ` Jeff Dike
2003-09-04  1:53 ` James Neal [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F569B0D.4060803@nks.net \
    --to=jneal@nks.net \
    --cc=jdike@addtoit.com \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.