~ubuntu-branches/ubuntu/quantal/open-vm-tools/quantal-201210021442

« back to all changes in this revision

Viewing changes to modules/linux/vmhgfs/vmci.c

  • Committer: Bazaar Package Importer
  • Author(s): Serge Hallyn
  • Date: 2011-03-31 14:20:05 UTC
  • mfrom: (1.4.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110331142005-3n9red91p7ogkweo
Tags: 2011.03.28-387002-0ubuntu1
* Merge latest upstream git tag.  This has the unlocked_ioctl change
  needed to fix dkms build failures (LP: #727342)
* Changes in debian/rules:
  - work around a bug in toolbox/Makefile, where install-exec-hook is
    not happening.  This needs to get fixed the right way.
  - don't install 'vmware-user' which seems to no longer exist
  - move /etc/xdg into open-vm-toolbox (which should be done using .install)
* debian/open-vm-tools.init: add 'modprobe [-r] vmblock'. (LP: #332323)
* debian/rules and debian/open-vm-toolbox.lintian-overrides:
  - Make vmware-user-suid-wrapper suid-root (LP: #332323)

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
#include "vm_assert.h"
40
40
#include "vmci_call_defs.h"
41
41
#include "vmci_defs.h"
42
 
#include "vmciKernelAPI.h"
 
42
#include "vmciKernelAPI1.h"
43
43
 
44
44
static Bool HgfsVmciChannelOpen(HgfsTransportChannel *channel);
45
45
static void HgfsVmciChannelClose(HgfsTransportChannel *channel);
328
328
   /* Reference is taken here */
329
329
   req = HgfsTransportGetPendingRequest(id);
330
330
   if (!req) {
 
331
      LOG(0, (KERN_WARNING "No request with id %"FMT64"u \n", id));
331
332
      goto exit;
332
333
   }
333
334
 
334
335
   transportStatus = (HgfsVmciTransportStatus *)req->buffer;
335
336
   if (transportStatus->status != HGFS_TS_IO_COMPLETE) {
 
337
      LOG(0, (KERN_WARNING "Request not completed with id %"FMT64"u \n", id));
336
338
      goto exit;
337
339
   }
338
340
 
432
434
 
433
435
   ASSERT(channel->status == HGFS_CHANNEL_NOTCONNECTED);
434
436
   ASSERT(channel->priv == NULL);
 
437
   memset(&gHgfsShmemPages, 0, sizeof gHgfsShmemPages);
435
438
 
436
439
   if (USE_VMCI == 0) {
437
440
      goto error;
454
457
      goto error;
455
458
   }
456
459
 
457
 
   gHgfsShmemPages.list = kmalloc(sizeof gHgfsShmemPages.list * HGFS_VMCI_SHMEM_PAGES,
 
460
   gHgfsShmemPages.list = kmalloc(sizeof *gHgfsShmemPages.list * HGFS_VMCI_SHMEM_PAGES,
458
461
                                  GFP_KERNEL);
459
462
   if (!gHgfsShmemPages.list) {
460
463
      goto error;
461
464
   }
462
465
 
463
 
   memset(gHgfsShmemPages.list, 0, sizeof gHgfsShmemPages.list * HGFS_VMCI_SHMEM_PAGES);
 
466
   memset(gHgfsShmemPages.list, 0, sizeof *gHgfsShmemPages.list * HGFS_VMCI_SHMEM_PAGES);
464
467
 
465
468
   for (i = 0; i < HGFS_VMCI_SHMEM_PAGES; i++) {
466
469
      gHgfsShmemPages.list[i].va = __get_free_page(GFP_KERNEL);
482
485
 
483
486
   ret = HgfsVmciChannelPassGuestPages(channel);
484
487
   if (!ret) {
 
488
      for (i = 0; i < gHgfsShmemPages.totalPageCount; i++) {
 
489
         LOG(1, (KERN_WARNING "Freeing pages\n"));
 
490
         free_page(gHgfsShmemPages.list[i].va);
 
491
      }
485
492
      LOG(1, (KERN_WARNING "Failed to pass pages to the guest %d\n", ret));
486
493
      goto error;
487
494
   }
539
546
      if (ret == HGFS_VMCI_TRANSPORT_ERROR) {
540
547
         LOG(0, (KERN_WARNING "HGFS Transport error occured. Don't blame VMCI\n"));
541
548
      }
 
549
      LOG(0, (KERN_WARNING "Cannot communicate with Server.\n"));
 
550
   } else {
 
551
      int i;
 
552
      for (i = 0; i < gHgfsShmemPages.totalPageCount; i++) {
 
553
         free_page(gHgfsShmemPages.list[i].va);
 
554
      }
542
555
   }
543
556
 
544
557
   kfree(dg);
669
682
   int j;
670
683
 
671
684
   ASSERT(req);
 
685
   ASSERT(req->buffer);
672
686
   ASSERT(req->state == HGFS_REQ_STATE_UNSENT || req->state == HGFS_REQ_STATE_ALLOCATED);
673
687
   ASSERT(req->payloadSize <= req->bufferSize);
674
688
 
718
732
   ASSERT(total == 0);
719
733
   ASSERT(bufferSize == req->bufferSize + sizeof (HgfsVmciTransportStatus));
720
734
 
721
 
   LOG(8, ("Size of request is %Zu\n", req->payloadSize));
 
735
   LOG(0, (KERN_WARNING "Size of request is %Zu\n", req->payloadSize));
722
736
 
723
737
   for (j = 0; j < req->numEntries; j++, iovCount++) {
724
738
      /* I will have to probably do page table walk here, haven't figured it out yet */
 
739
      ASSERT(req->dataPacket);
725
740
      transportHeader->iov[iovCount].pa = page_to_phys(req->dataPacket[j].page);
726
741
      transportHeader->iov[iovCount].pa += req->dataPacket[j].offset;
727
742
      transportHeader->iov[iovCount].len = req->dataPacket[j].len;