~n-muench/ubuntu/precise/open-vm-tools/open-vm-tools.raring-precise.backport

« back to all changes in this revision

Viewing changes to lib/misc/iovector.c

  • Committer: Package Import Robot
  • Author(s): Nate Muench
  • Date: 2012-01-23 16:09:45 UTC
  • mfrom: (1.4.6) (2.4.26 sid)
  • Revision ID: package-import@ubuntu.com-20120123160945-b6s0r1vkcovucpf3
Tags: 2011.12.20-562307-0ubuntu1
* Merge latest upstream git tag. Fixes building on Precise
  (LP: #898289, LP: #905612)

* Items merged from Debian unstable:
  - debian/control:
    + open-vm-tools recommends open-vm-dkms. (LP: #598933)
    + open-vm-tools now suggests open-vm-toolbox. (LP: #604998)
  (From 2011.08.21-471295-1 release)
  - Updating maintainer and uploaders fields.
  - Removing vcs fields.
  - Removing references to Daniel's old email address.
  - Updating years in copyright file.
  - Updating to standards version 3.9.2.
  - Updating to debhelper version 8.
  - Switching to source format 3.0 (quilt).
  - Removing manual chrpath setting.
  - Removing exclusion from plugins from debhelper shlibs.
  - Rediffing kvers.patch.
  (From 2011.09.23-491607-1 release)
  - Marking binary architecture-dependend packages as linux and kfreebsd
  only.
  - Removing liburiparser-dev from build-depends as upstream dropped
  unity support.
  - Building with libproc-dev on amd64 again.
  - Dropping disabling of dnet support.
  (From 2011.09.23-491607-2 release)
  - Adding doxygen to build-depends for api documentation.
  - Adding libcunit1-dev to build-depends for test suites.
  - Minimizing rules file.
  - Adding open-vm-tools-dev package, containing only the api
    documentation for now.
  (From 2011.09.23-491607-3 release)
  - Sorting overrides in rules alphabetically.
  - Compacting copyright file.
  - Adding udev rule to set timeout for vmware scsi devices
  (From 2011.12.20-562307-1 release)
  - Adding patch to correct typo in upstreams dkms configuration

* Remaining Changes:
  - Remove Stable part of version numbering.
  - debian folder:
    + Re-added open-vm-dkms.postinst & open-vm-dkms.prerm.
      * Allows dkms modules to compile upon installation.
  - debian/control:
    + Re-add open-vm-source and make into a transitional package
      for open-vm-toolbox.
    + Return dependancies that were moved to open-vm-tools back to
      open-vm-toolbox.
  - debian/rules and debian/open-vm-toolbox.lintian-overrides:
    + Make vmware-user-suid-wrapper suid-root
  - debian/rules:
    + Added CFLAGS field with -Wno-deprecated-declarations
      * Will suppress issues with glib 2.31 or later.
    + Add line to copy vmware-xdg-detect-de into place.
    + Install vmware-user.desktop through toolbox package.
  - debian/open-vm-tools.init:
    + Re-add 'modprobe [-r] vmblock'.
    + Add 'modprobe [-r] vmxnet'.
      * Incase it's not loaded during boot.
    + Remove and re-add pcnet32 module
      * Will be done before (remove) and after (readd) vmxnet module
        is added.
      * If vmxnet doesn't exist (aka modules fail to build), pcnet32 can be
        still used for network connectivity.
      * Workaround until a better fix can be done.
  - Re-add gnome-session to debian/local/xautostart.conf
  - Manpages removed (from debian/manpages):
    + vmmemctl.9
    + vmxnet3.9
    + Remove references to manpages that have been removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
177
177
   ASSERT(iovIn);
178
178
   ASSERT(iovOut);
179
179
 
180
 
   memcpy(iovOut, iovIn, sizeof *iovOut);
 
180
   Util_Memcpy(iovOut, iovIn, sizeof *iovOut);
181
181
   if (iovIn->numEntries <= numStaticEntries) {
182
182
      iovOut->allocEntries = NULL;
183
183
      iovOut->entries = staticEntries;
186
186
                                             sizeof(struct iovec));
187
187
      iovOut->entries = iovOut->allocEntries;
188
188
   }
189
 
   memcpy(iovOut->entries, iovIn->entries, 
 
189
   Util_Memcpy(iovOut->entries, iovIn->entries, 
190
190
          iovIn->numEntries * sizeof(struct iovec));
191
191
}
192
192
 
389
389
 
390
390
   v = Util_SafeMalloc(sizeof *v + origV->numEntries * sizeof(struct iovec));
391
391
   iov = &v->iov;
392
 
   memcpy(iov, origV, sizeof *iov);
 
392
   Util_Memcpy(iov, origV, sizeof *iov);
393
393
   iov->allocEntries = NULL;
394
394
   iov->numSectors = numSectors;
395
395
 
402
402
 
403
403
      ASSERT(origV->numEntries == 1);
404
404
      iov->entries = v->e;
405
 
      memcpy(iov->entries, origV->entries, sizeof(struct iovec));
 
405
      Util_Memcpy(iov->entries, origV->entries, sizeof(struct iovec));
406
406
 
407
407
      iov->numBytes = iov->numSectors * sectorSize;
408
408
 
417
417
   if (origV->numSectors == numSectors) {
418
418
      cpySize = origV->numEntries * sizeof *origV->entries;
419
419
      iov->entries = v->e;
420
 
      memcpy(iov->entries, origV->entries, cpySize);
 
420
      Util_Memcpy(iov->entries, origV->entries, cpySize);
421
421
 
422
422
      origV->startSector += numSectors;
423
423
      origV->numSectors = 0;
437
437
      cpySize = iov->numEntries * sizeof *iov->entries;
438
438
      tmpPtr = iov->entries;
439
439
      iov->entries = v->e;
440
 
      memcpy(iov->entries, tmpPtr, cpySize);
 
440
      Util_Memcpy(iov->entries, tmpPtr, cpySize);
441
441
 
442
442
      origV->numEntries -= iov->numEntries;
443
443
      if (overlap.iov_len != 0) { 
490
490
 
491
491
      numBytes = MIN(bufSize - count, entries[i].iov_len);
492
492
 
493
 
      memcpy(&bufOut[count], entries[i].iov_base, numBytes);
 
493
      Util_Memcpy(&bufOut[count], entries[i].iov_base, numBytes);
494
494
      count += numBytes;
495
495
 
496
496
      if (count >= bufSize) {
525
525
   struct VMIOVecAndEntries* v;
526
526
 
527
527
   v = Util_SafeMalloc(sizeof *v + iovIn->numEntries * sizeof(struct iovec));
528
 
   memcpy(&v->iov, iovIn, sizeof *iovIn);
 
528
   Util_Memcpy(&v->iov, iovIn, sizeof *iovIn);
529
529
   v->iov.allocEntries = NULL;
530
530
   v->iov.entries = v->e;
531
 
   memcpy(v->iov.entries, iovIn->entries,
 
531
   Util_Memcpy(v->iov.entries, iovIn->entries,
532
532
          iovIn->numEntries * sizeof(struct iovec));
533
533
 
534
534
   return &v->iov;
581
581
 */
582
582
 
583
583
void
584
 
IOV_WriteBufToIov(uint8* bufIn,                 // IN
 
584
IOV_WriteBufToIov(const uint8* bufIn,           // IN
585
585
                  size_t bufSize,               // IN
586
586
                  struct iovec* entries,        // OUT
587
587
                  int numEntries)               // IN
600
600
 
601
601
      numBytes = MIN(bufSize - count, entries[i].iov_len);
602
602
 
603
 
      memcpy(entries[i].iov_base, &bufIn[count], numBytes);
 
603
      Util_Memcpy(entries[i].iov_base, &bufIn[count], numBytes);
604
604
      count += numBytes;
605
605
      if (count >= bufSize) {
606
606
         return;
702
702
   i = IOVFindFirstEntryOffset(entries, numEntries, iovOffset, &entryOffset);
703
703
 
704
704
   for (; count && (i < numEntries); i++) {
 
705
      char *base = (char *)(entries[i].iov_base) + entryOffset;
 
706
      size_t iov_len = entries[i].iov_len;
 
707
 
705
708
      ASSERT(entries[i].iov_base || entries[i].iov_len == 0);
706
709
      ASSERT(entries[i].iov_base != LAZY_ALLOC_MAGIC);
707
710
 
708
 
      if (entries[i].iov_len <= 0) {
 
711
      if (iov_len <= 0) {
709
712
         continue;
710
713
      }
711
 
      entryLen = MIN(count, entries[i].iov_len - entryOffset);
 
714
      entryLen = MIN(count, iov_len - entryOffset);
712
715
 
713
 
      memcpy(bufOut, (char *)(entries[i].iov_base) + entryOffset, entryLen);
 
716
      Util_Memcpy(bufOut, base, entryLen);
714
717
 
715
718
      count -= entryLen;
716
719
      bufOut += entryLen;
758
761
   i = IOVFindFirstEntryOffset(entries, numEntries, iovOffset, &entryOffset);
759
762
 
760
763
   for (; count && (i < numEntries); i++) {
 
764
      char *base = (char *)(entries[i].iov_base) + entryOffset;
 
765
      size_t iov_len = entries[i].iov_len;
 
766
 
761
767
      ASSERT_BUG(33859, entries[i].iov_base || entries[i].iov_len == 0);
762
768
      ASSERT(entries[i].iov_base != LAZY_ALLOC_MAGIC);
763
769
 
764
 
      if (entries[i].iov_len <= 0) {
 
770
      if (iov_len <= 0) {
765
771
         continue;
766
772
      }
767
 
      entryLen = MIN(count, entries[i].iov_len - entryOffset);
768
 
 
769
 
      memcpy((char *)(entries[i].iov_base) + entryOffset, bufIn, entryLen);
 
773
      entryLen = MIN(count, iov_len - entryOffset);
 
774
      
 
775
      Util_Memcpy(base, bufIn, entryLen);
770
776
 
771
777
      count -= entryLen;
772
778
      bufIn += entryLen;
811
817
   size_t entryLen = 0, srcEntryOffset, copyLen, retval;
812
818
   uint64 srcStartByte, dstStartByte, startByte, endByte;
813
819
   int64 count, srcIovOffset, dstIovOffset;
814
 
   struct iovec *srcEntries;
 
820
   struct iovec *srcEntries = srcIov->entries;
 
821
   uint32 srcNumEntries = srcIov->numEntries;
 
822
   struct iovec *dstEntries = dstIov->entries;
 
823
   uint32 dstNumEntries = dstIov->numEntries;
815
824
   int i;
816
825
 
817
826
   ASSERT(srcIov);
854
863
   retval = (size_t)count;
855
864
 
856
865
   /* first find the src entry where to start */
857
 
   i = IOVFindFirstEntryOffset(srcEntries, srcIov->numEntries,
 
866
   i = IOVFindFirstEntryOffset(srcEntries, srcNumEntries,
858
867
                               (size_t) srcIovOffset, &srcEntryOffset);
859
868
 
860
 
   for (; count && (i < srcIov->numEntries); i++) {
 
869
   for (; count && (i < srcNumEntries); i++) {
 
870
      size_t iov_len = srcEntries[i].iov_len;
 
871
 
861
872
      ASSERT(srcEntries[i].iov_base || srcEntries[i].iov_len == 0);
862
873
      ASSERT(srcEntries[i].iov_base != LAZY_ALLOC_MAGIC);
863
874
 
864
 
      if (srcEntries[i].iov_len <= 0) {
 
875
      if (iov_len <= 0) {
865
876
         continue;
866
877
      }
867
 
      entryLen = MIN(count, srcEntries[i].iov_len - srcEntryOffset);
 
878
      entryLen = MIN(count, iov_len - srcEntryOffset);
868
879
 
869
880
      copyLen = IOV_WriteBufToIovPlus(
870
881
                           (uint8 *)(srcEntries[i].iov_base) + srcEntryOffset,
871
 
                                      entryLen, dstIov->entries,
872
 
                                      dstIov->numEntries, dstIovOffset);
 
882
                                      entryLen, dstEntries,
 
883
                                      dstNumEntries, dstIovOffset);
873
884
 
874
885
      if (copyLen == 0) {  /* finished */
875
886
         break;