.SH NAME
mkswap \- set up a Linux swap area
.SH SYNOPSIS
-.BI "mkswap [\-c] [\-v" N "] [\-f] [\-p " PSZ "] [\-L " label "] " device " [" size "]"
+.BI "mkswap [\-c] [\-v" N "] [\-f] [\-p " PSZ "] [\-L " label "] [\-U " uuid "] " device " [" size "]"
.SH DESCRIPTION
.B mkswap
sets up a Linux swap area on a device or in a file.
Version 0 (-v0) swap space format is no longer supported in 2.5+ kernels.
+.TP
+.B \-U uuid
+Specify the uuid to use.
+
.SH "SEE ALSO"
.BR fdisk (8),
.BR swapon (8)
static void
usage(void) {
fprintf(stderr,
- _("Usage: %s [-c] [-v0|-v1] [-pPAGESZ] [-L label] /dev/name [blocks]\n"),
+ _("Usage: %s [-c] [-v0|-v1] [-pPAGESZ] [-L label] [-U UUID] /dev/name [blocks]\n"),
program_name);
exit(1);
}
char *pp;
char *opt_label = NULL;
unsigned char *uuid = NULL;
+ unsigned char *uuid_input = NULL;
+ int set_uuid = 0; // User Defined UUID, o: False, 1: True
#ifdef HAVE_LIBUUID
uuid_t uuid_dat;
#endif
case 'v':
version = atoi(argv[i]+2);
break;
+ case 'U':
+ set_uuid = 1;
+ uuid_input = argv[i]+2;
+ if (!*uuid_input && i+1 < argc)
+ uuid_input = argv[++i];
+ break;
default:
usage();
}
}
#ifdef HAVE_LIBUUID
- uuid_generate(uuid_dat);
- uuid = uuid_dat;
+ if(!set_uuid)
+ {
+ uuid_generate(uuid_dat);
+ uuid = uuid_dat;
+ } else {
+ uuid_parse(uuid_input, uuid_dat);
+ uuid = uuid_dat;
+ }
#endif
init_signature_page(); /* get pagesize */