+Tue Jul 17 16:39:18 CEST 2007 Daniel Veillard <veillard@redhat.com>
+
+ * src/openvz_conf.c src/libvirt.c: cleanup, avoid some warnings,
+ and reuse the existing uuid generation function.
+
Tue Jul 17 15:24:27 CEST 2007 Daniel Veillard <veillard@redhat.com>
* configure.in src/Makefile.am src/driver.h src/libvirt.c:
/* Richard Steven's classic readline() function */
+static
int openvz_readline(int fd, char *ptr, int maxlen)
{
int n, rc;
return n;
}
-void openvzGenerateUUID(unsigned char *uuid)
-{
- unsigned int i;
- int fd;
-
- /* seed rand() with kernel entrophy */
- fd = open("/dev/urandom", O_RDONLY);
- if(fd != -1) {
- read(fd, &i, sizeof(int));
- srand(i);
- close(fd);
- }
- else {
- srand((int) time(NULL));
- }
-
- for (i = 0 ; i < VIR_UUID_BUFLEN ; i++) {
- uuid[i] = (unsigned char)(1 + (int) (256.0 * (rand() / (RAND_MAX + 1.0))));
- }
-}
-
int openvzGetVPSUUID(int vpsid, char *uuidbuf)
{
char conf_file[PATH_MAX];
return -1;
if(uuid[0] == (int)NULL) {
- openvzGenerateUUID(new_uuid);
+ virUUIDGenerate(new_uuid);
bzero(uuid, (VIR_UUID_BUFLEN * 2) + 1);
for(i = 0; i < VIR_UUID_BUFLEN; i ++)
sprintf(uuid + (i * 2), "%02x", (unsigned char)new_uuid[i]);