This file is indexed.

/usr/src/open-vm-tools-10.0.7/vmhgfs/fsutil.h is in open-vm-tools-dkms 2:10.0.7-3227872-2ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*********************************************************
 * Copyright (C) 2006-2015 VMware, Inc. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation version 2 and no later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 *
 *********************************************************/

/*
 * fsutil.h --
 *
 * Functions used in more than one type of filesystem operation will be
 * exported from this file.
 */

#ifndef _HGFS_DRIVER_FSUTIL_H_
#define _HGFS_DRIVER_FSUTIL_H_

/* Must come before any kernel header file. */
#include "driver-config.h"

#include <linux/signal.h>
#include "compat_fs.h"

#include "module.h"                /* For kuid_t kgid_t types. */
#include "inode.h"
#include "request.h"
#include "vm_basic_types.h"
#include "hgfsProto.h"

/*
 * Struct used to pass around attributes that Linux cares about.
 * These aren't just the attributes seen in HgfsAttr[V2]; we add a filename
 * pointer for convenience (used by SearchRead and Getattr).
 */
typedef struct HgfsAttrInfo {
   HgfsOp requestType;
   HgfsAttrValid mask;
   HgfsFileType type;              /* File type */
   uint64 allocSize;               /* Disk allocation size (in bytes) */
   uint64 size;                    /* File size (in bytes) */
   uint64 accessTime;              /* Time of last access */
   uint64 writeTime;               /* Time of last write */
   uint64 attrChangeTime;          /* Time file attributes were last changed */
   HgfsPermissions specialPerms;   /* Special permissions bits */
   HgfsPermissions ownerPerms;     /* Owner permissions bits */
   HgfsPermissions groupPerms;     /* Group permissions bits */
   HgfsPermissions otherPerms;     /* Other permissions bits */
   HgfsPermissions effectivePerms; /* Permissions in effect for the user on the
                                      host. */
   uint32 userId;                  /* UID */
   uint32 groupId;                 /* GID */
   uint64 hostFileId;              /* Inode number */
} HgfsAttrInfo;


/*
 * ino_t is 32-bits on 32-bit arch. We have to squash the 64-bit value down
 * so that it will fit.
 * Note, this is taken from CIFS so we apply the same algorithm.
 */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
/*
 * We use hash_64 to convert the value to 31 bits, and
 * then add 1, to ensure that we don't end up with a 0 as the value.
 */
#if BITS_PER_LONG == 64
static inline ino_t
HgfsUniqueidToIno(uint64 fileid)
{
   return (ino_t)fileid;
}
#else
#include <linux/hash.h>

static inline ino_t
HgfsUniqueidToIno(uint64 fileid)
{
   return (ino_t)hash_64(fileid, (sizeof(ino_t) * 8) - 1) + 1;
}
#endif

#else
static inline ino_t
HgfsUniqueidToIno(uint64 fileid)
{
   ino_t ino = (ino_t) fileid;
   if (sizeof(ino_t) < sizeof(uint64)) {
      ino ^= fileid >> (sizeof(uint64)-sizeof(ino_t)) * 8;
   }
   return ino;
}
#endif

/* Public functions (with respect to the entire module). */
int HgfsUnpackCommonAttr(HgfsReq *req,
                         HgfsAttrInfo *attr);
void HgfsChangeFileAttributes(struct inode *inode,
                              HgfsAttrInfo const *attr);
int HgfsPrivateGetattr(struct dentry *dentry,
                       HgfsAttrInfo *attr,
                       char **fileName);
struct inode *HgfsIget(struct super_block *sb,
                       ino_t ino,
                       HgfsAttrInfo const *attr);
int HgfsInstantiateRoot(struct super_block *sb,
                        struct dentry **rootDentry);
int HgfsInstantiate(struct dentry *dentry,
                    ino_t ino,
                    HgfsAttrInfo const *attr);
int HgfsBuildPath(char *buffer,
                  size_t bufferLen,
                  struct dentry *dentry);
void HgfsDentryAgeReset(struct dentry *dentry);
void HgfsDentryAgeForce(struct dentry *dentry);
int HgfsGetOpenMode(uint32 flags);
int HgfsGetOpenFlags(uint32 flags);
int HgfsCreateFileInfo(struct file *file,
                       HgfsHandle handle);
void HgfsReleaseFileInfo(struct file *file);
int HgfsGetHandle(struct inode *inode,
                  HgfsOpenMode mode,
                  HgfsHandle *handle);
int HgfsStatusConvertToLinux(HgfsStatus hgfsStatus);
void HgfsSetUidGid(struct inode *parent,
                   struct dentry *dentry,
                   kuid_t uid,
                   kgid_t gid);


#endif // _HGFS_DRIVER_FSUTIL_H_