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

« back to all changes in this revision

Viewing changes to lib/file/file.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:
63
63
#include "base64.h"
64
64
#include "timeutil.h"
65
65
#include "hostinfo.h"
 
66
#include "hostType.h"
66
67
#include "vm_atomic.h"
 
68
#include "fileLock.h"
67
69
 
68
70
#include "unicodeOperations.h"
69
71
 
118
120
int
119
121
File_UnlinkIfExists(ConstUnicode pathName)  // IN:
120
122
{
121
 
   int ret;
122
 
 
123
 
   ret = FileDeletion(pathName, TRUE);
 
123
   int ret = FileDeletion(pathName, TRUE);
124
124
 
125
125
   if (ret != 0) {
126
126
      ret = (ret == ENOENT) ? 0 : -1;
131
131
 
132
132
 
133
133
/*
 
134
 *-----------------------------------------------------------------------------
 
135
 *
 
136
 * File_SupportsMandatoryLock --
 
137
 *
 
138
 *      Determines if the underlying filesystem for a particular location
 
139
 *      can support mandatory locking. Mandatory locking is used within
 
140
 *      FileLock to make the advisory FileLock self-cleaning in the event
 
141
 *      of host failure.
 
142
 *
 
143
 * Results:
 
144
 *      TRUE if FILEIO_OPEN_EXCLUSIVE_LOCK will work, FALSE otherwise.
 
145
 *
 
146
 * Side effects:
 
147
 *      None.
 
148
 *
 
149
 *-----------------------------------------------------------------------------
 
150
 */
 
151
 
 
152
Bool
 
153
File_SupportsMandatoryLock(ConstUnicode pathName) // IN: file to be locked
 
154
{
 
155
   /*
 
156
    * For now, "know" that all ESX filesystems support mandatory locks
 
157
    * and no non-ESX filesystems support mandatory locks.
 
158
    */
 
159
   return HostType_OSIsVMK();
 
160
}
 
161
 
 
162
 
 
163
/*
134
164
 *----------------------------------------------------------------------
135
165
 *
136
166
 * File_IsDirectory --
1286
1316
   Bool ret;
1287
1317
   Bool duringRename;
1288
1318
 
1289
 
   if (FileRename(oldFile, newFile) == 0) {
 
1319
   if (File_Rename(oldFile, newFile) == 0) {
1290
1320
      duringRename = TRUE;
1291
1321
      ret = TRUE;
1292
1322
      Err_SetErrno(0);
1356
1386
      return FALSE;
1357
1387
   }
1358
1388
 
1359
 
   if (FileRename(srcName, dstName) == 0) {
 
1389
   if (File_Rename(srcName, dstName) == 0) {
1360
1390
      ret = TRUE;
1361
1391
   } else {
1362
1392
      struct stat statbuf;
2349
2379
 
2350
2380
   free(baseName);
2351
2381
}
 
2382
 
 
2383
 
 
2384
/*
 
2385
 *-----------------------------------------------------------------------------
 
2386
 *
 
2387
 * File_GetFSMountInfo --
 
2388
 *
 
2389
 *      Platform-independent wrapper around File_GetVMFSMountInfo
 
2390
 *
 
2391
 * Results:
 
2392
 *      On failure return -1.  Otherwise, return fsType, version,
 
2393
 *      remoteIP, remoteMountPoint, and localMountPoint.
 
2394
 *
 
2395
 * Side effects:
 
2396
 *      None
 
2397
 *
 
2398
 *-----------------------------------------------------------------------------
 
2399
 */
 
2400
 
 
2401
int 
 
2402
File_GetFSMountInfo(ConstUnicode pathName,
 
2403
                    char **fsType,
 
2404
                    uint32 *version,
 
2405
                    char **remoteIP,
 
2406
                    char **remoteMountPoint,
 
2407
                    char **localMountPoint)
 
2408
{
 
2409
#if defined VMX86_SERVER
 
2410
   return  File_GetVMFSMountInfo(pathName, fsType, version,
 
2411
                                 remoteIP, remoteMountPoint,
 
2412
                                 localMountPoint);
 
2413
#else 
 
2414
   return -1;
 
2415
#endif
 
2416
}
 
2417
 
 
2418