~ubuntu-branches/ubuntu/natty/libvirt/natty-proposed

« back to all changes in this revision

Viewing changes to src/uml/uml_conf.c

  • Committer: Bazaar Package Importer
  • Author(s): Soren Hansen
  • Date: 2010-08-23 14:24:06 UTC
  • Revision ID: james.westby@ubuntu.com-20100823142406-1jsss896fyjl13qp
Tags: 0.8.3-1ubuntu6
* FFe: LP: #622682.
* Replace 9019-Remove-wrong-check-for-uml-monitor-response-size.patch with
  9019-uml-fix-logic-bug-in-checking-reply-length.patch which is what ended
  up getting applied upstream.
* Add the following patches taken from upstream git:
  - 9021-Allow-chardev-of-type-file-for-UML-domains.patch
  - 9022-Rename-qemudShrinkDisks-to-virDomainDiskRemove-and-m.patch
  - 9023-Support-virDomainAttachDevice-and-virDomainDetachDev.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
290
290
 
291
291
static char *
292
292
umlBuildCommandLineChr(virDomainChrDefPtr def,
293
 
                       const char *dev)
 
293
                       const char *dev,
 
294
                       fd_set *keepfd)
294
295
{
295
296
    char *ret = NULL;
296
297
 
339
340
        break;
340
341
 
341
342
    case VIR_DOMAIN_CHR_TYPE_FILE:
342
 
    case VIR_DOMAIN_CHR_TYPE_PIPE:
343
 
        /* XXX could open the file/pipe & just pass the FDs */
 
343
         {
 
344
            int fd_out;
 
345
 
 
346
            if ((fd_out = open(def->data.file.path,
 
347
                               O_WRONLY | O_APPEND | O_CREAT, 0660)) < 0) {
 
348
                virReportSystemError(errno,
 
349
                                     _("failed to open chardev file: %s"),
 
350
                                     def->data.file.path);
 
351
                return NULL;
 
352
            }
 
353
            if (virAsprintf(&ret, "%s%d=null,fd:%d", dev, def->target.port, fd_out) < 0) {
 
354
                virReportOOMError();
 
355
                close(fd_out);
 
356
                return NULL;
 
357
            }
 
358
            FD_SET(fd_out, keepfd);
 
359
        }
 
360
        break;
 
361
   case VIR_DOMAIN_CHR_TYPE_PIPE:
 
362
        /* XXX could open the pipe & just pass the FDs. Be wary of
 
363
         * the effects of blocking I/O, though. */
344
364
 
345
365
    case VIR_DOMAIN_CHR_TYPE_VC:
346
366
    case VIR_DOMAIN_CHR_TYPE_UDP:
386
406
int umlBuildCommandLine(virConnectPtr conn,
387
407
                        struct uml_driver *driver ATTRIBUTE_UNUSED,
388
408
                        virDomainObjPtr vm,
 
409
                        fd_set *keepfd,
389
410
                        const char ***retargv,
390
411
                        const char ***retenv)
391
412
{
508
529
    for (i = 0 ; i < UML_MAX_CHAR_DEVICE ; i++) {
509
530
        char *ret = NULL;
510
531
        if (i == 0 && vm->def->console)
511
 
            ret = umlBuildCommandLineChr(vm->def->console, "con");
 
532
            ret = umlBuildCommandLineChr(vm->def->console, "con", keepfd);
512
533
        if (!ret)
513
534
            if (virAsprintf(&ret, "con%d=none", i) < 0)
514
535
                goto no_memory;
522
543
            if (vm->def->serials[j]->target.port == i)
523
544
                chr = vm->def->serials[j];
524
545
        if (chr)
525
 
            ret = umlBuildCommandLineChr(chr, "ssl");
 
546
            ret = umlBuildCommandLineChr(chr, "ssl", keepfd);
526
547
        if (!ret)
527
548
            if (virAsprintf(&ret, "ssl%d=none", i) < 0)
528
549
                goto no_memory;