Date: Tue, 10 Jul 2012 15:14:26 +0000 From: vchan@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r239240 - in soc2012/vchan: ggate gtcp/bwalex-tc-play Message-ID: <20120710151427.013F91065672@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: vchan Date: Tue Jul 10 15:14:26 2012 New Revision: 239240 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239240 Log: debugged a few functions Deleted: soc2012/vchan/ggate/ Modified: soc2012/vchan/gtcp/bwalex-tc-play/tcplay.c Modified: soc2012/vchan/gtcp/bwalex-tc-play/tcplay.c ============================================================================== --- soc2012/vchan/gtcp/bwalex-tc-play/tcplay.c Tue Jul 10 14:21:25 2012 (r239239) +++ soc2012/vchan/gtcp/bwalex-tc-play/tcplay.c Tue Jul 10 15:14:26 2012 (r239240) @@ -29,9 +29,9 @@ #include <sys/types.h> -#if defined(__DragonFly__) +//#if defined(__DragonFly__) #include <sys/param.h> -#endif +//#endif #include <stdio.h> #include <stdlib.h> @@ -47,7 +47,7 @@ //#include <uuid/uuid.h> //#elif defined(__DragonFly__) //#include <libdm.h> -//#include <uuid.h> +#include <uuid.h> #include <geom/gate/g_gate.h> #include <ggate.h> @@ -110,19 +110,19 @@ { "SERPENT-128-XTS", "serpent-xts-plain", 32, 8 }, #endif { "AES-256-XTS", "aes-xts-plain", 64, 8 }, - { "TWOFISH-256-XTS", "twofish-xts-plain", 64, 8 }, - { "SERPENT-256-XTS", "serpent-xts-plain", 64, 8 }, + /*{ "TWOFISH-256-XTS", "twofish-xts-plain", 64, 8 }, + { "SERPENT-256-XTS", "serpent-xts-plain", 64, 8 },*/ { NULL, NULL, 0, 0 } }; const char *valid_cipher_chains[][MAX_CIPHER_CHAINS] = { { "AES-256-XTS", NULL }, - { "TWOFISH-256-XTS", NULL }, + /*{ "TWOFISH-256-XTS", NULL }, { "SERPENT-256-XTS", NULL }, { "AES-256-XTS", "TWOFISH-256-XTS", "SERPENT-256-XTS", NULL }, { "SERPENT-256-XTS", "TWOFISH-256-XTS", "AES-256-XTS", NULL }, #if 0 - /* It seems that all the two-way cascades are the other way round... */ + It seems that all the two-way cascades are the other way round... { "AES-256-XTS", "TWOFISH-256-XTS", NULL }, { "SERPENT-256-XTS", "AES-256-XTS", NULL }, { "TWOFISH-256-XTS", "SERPENT-256-XTS", NULL }, @@ -130,7 +130,7 @@ #endif { "TWOFISH-256-XTS", "AES-256-XTS", NULL }, { "AES-256-XTS", "SERPENT-256-XTS", NULL }, - { "SERPENT-256-XTS", "TWOFISH-256-XTS", NULL }, + { "SERPENT-256-XTS", "TWOFISH-256-XTS", NULL },*/ { NULL } }; @@ -926,7 +926,40 @@ return -1; } - +int +map_volume(const char *map_name, int sflag, + int interactive, time_t timeout) + +{ + + struct g_gate_ctl_create ggioc; + int fd; + + fd = open(map_name, g_gate_openflags(sflags) | O_DIRECT | O_FSYNC); + if (fd == -1) + err(EXIT_FAILURE, "Cannot open %s", map_name); + ggioc.gctl_version = G_GATE_VERSION; + ggioc.gctl_unit = unit; + ggioc.gctl_mediasize = g_gate_mediasize(fd); + if (sectorsize == 0) + sectorsize = g_gate_sectorsize(fd); + ggioc.gctl_sectorsize = sectorsize; + ggioc.gctl_timeout = timeout; + ggioc.gctl_flags = sflags; + ggioc.gctl_maxcount = 0; + strlcpy(ggioc.gctl_info, map_name, sizeof(ggioc.gctl_info)); + g_gate_ioctl(G_GATE_CMD_CREATE, &ggioc); + if (unit == -1) + printf("%s%u\n", G_GATE_PROVIDER_NAME, ggioc.gctl_unit); + unit = ggioc.gctl_unit; + g_gatel_serve(fd); +} + + if (interactive) + printf("All ok!\n"); + + return 0; +} /* int map_volume(const char *map_name, const char *device, int sflag, @@ -964,7 +997,7 @@ */ static -void +int dm_remove_device() { int ret = EINVAL; @@ -1169,7 +1202,7 @@ uu_stack[j-1]); #endif if ((uu_stack[j-1] == NULL) || - ((r = /*and here*/dm_remove_device(uu_stack[--j])) != 0)) { + ((r = dm_remove_device(uu_stack[--j])) != 0)) { tc_log(1, "Tried to unroll dm changes, " "giving up.\n"); break; @@ -1195,7 +1228,7 @@ char map[PATH_MAX]; int i, error; - if ((error = /*and here*/dm_remove_device(mapname)) != 0) { + if ((error = dm_remove_device(mapname)) != 0) { tc_log(1, "Could not remove mapping %s\n", mapname); return error; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120710151427.013F91065672>