1 /* mkswap(8) without any sanity checks */
16 unsigned char sws_uuid[16];
17 unsigned char sws_volume[16];
18 uint32_t padding[117];
22 int main(int argc, char **argv)
24 struct swap_header *hdr;
31 fprintf(stderr, "usage: %s PATH\n", argv[0]);
35 page_size = sysconf(_SC_PAGESIZE);
36 if (page_size == -1) {
41 hdr = calloc(1, page_size);
47 file = fopen(argv[1], "r+");
54 ret = fstat(fileno(file), &st);
63 hdr->last_page = st.st_size / page_size - 1;
64 memset(&hdr->sws_uuid, 0x99, sizeof(hdr->sws_uuid));
65 memcpy((char *)hdr + page_size - 10, "SWAPSPACE2", 10);
67 if (fwrite(hdr, page_size, 1, file) != 1) {
74 if (fclose(file) == EOF) {