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

« back to all changes in this revision

Viewing changes to lib/hgfsServer/hgfsServerInt.h

  • 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:
278
278
   HGFS_SESSION_TYPE_INTERNAL,     /* This is a static session. */
279
279
} HgfsSessionInfoType;
280
280
 
281
 
/* HgfsTransportSessionState, used for session status. */
 
281
/* HgfsSessionState, used for session status. */
282
282
typedef enum {
283
283
   HGFS_SESSION_STATE_OPEN,
284
284
   HGFS_SESSION_STATE_CLOSED,
285
285
} HgfsSessionInfoState;
286
286
 
287
 
typedef struct HgfsSessionInfo {
288
 
   /* Unique session id. */
289
 
   uint64 sessionId;
 
287
typedef struct HgfsTransportSessionInfo {
 
288
   /* Default session id. */
 
289
   uint64 defaultSessionId;
 
290
 
 
291
   /* Lock to manipulate the list of sessions */
 
292
   MXUserExclLock *sessionArrayLock;
 
293
 
 
294
   /* List of sessions */
 
295
   DblLnkLst_Links sessionArray;
290
296
 
291
297
   /* Max packet size that is supported by both client and server. */
292
298
   uint32 maxPacketSize;
293
299
 
 
300
   /* Total number of sessions present this transport session*/
 
301
   uint32 numSessions;
 
302
 
294
303
   /* Transport session context. */
295
304
   void *transportData;
296
305
 
303
312
   /* Function callbacks into Hgfs Channels. */
304
313
   HgfsServerChannelCallbacks *channelCbTable;
305
314
 
 
315
   Atomic_uint32 refCount;    /* Reference count for session. */
 
316
 
 
317
   uint32 channelCapabilities;
 
318
} HgfsTransportSessionInfo;
 
319
 
 
320
typedef struct HgfsSessionInfo {
 
321
 
 
322
   DblLnkLst_Links links;
 
323
 
 
324
   Bool isInactive;
 
325
 
 
326
   /* Unique session id. */
 
327
   uint64 sessionId;
 
328
 
 
329
   /* Max packet size that is supported by both client and server. */
 
330
   uint32 maxPacketSize;
 
331
 
 
332
   /* Transport session context. */
 
333
   HgfsTransportSessionInfo *transportSession;
 
334
 
 
335
   /* Current state of the session. */
 
336
   HgfsSessionInfoState state;
 
337
 
306
338
   /* Lock to ensure some fileIO requests are atomic for a handle. */
307
339
   MXUserExclLock *fileIOLock;
308
340
 
 
341
   int numInvalidationAttempts;
 
342
 
309
343
   Atomic_uint32 refCount;    /* Reference count for session. */
310
344
 
311
345
   /*
359
393
   uint32 numberOfCapabilities;
360
394
 
361
395
   Bool activeNotification;
362
 
 
363
396
} HgfsSessionInfo;
364
397
 
 
398
/*
 
399
 * This represents the maximum number of HGFS sessions that can be
 
400
 * created in a HGFS transport session. We picked a random value
 
401
 * for this variable. There is no specific reason behind picking
 
402
 * this value.
 
403
 */
 
404
#define MAX_SESSION_COUNT 1024
 
405
 
 
406
/*
 
407
 * This represents the maximum number attempts made by the HGFS
 
408
 * invalidator before completely destroying the HGFS session. We
 
409
 * picked a random value and there is no specific reason behind
 
410
 * the value 4 for thie variable.
 
411
 */
 
412
#define MAX_SESSION_INVALIDATION_ATTEMPTS 4
365
413
 
366
414
/*
367
415
 * These structs represent information about file open requests, file
474
522
   const char *metaPacket;
475
523
   size_t metaPacketSize;
476
524
   HgfsSessionInfo *session;
 
525
   HgfsTransportSessionInfo *transportSession;
477
526
   HgfsPacket *packet;
478
527
   void const *payload;
479
528
   uint32 payloadOffset;
563
612
                           HgfsSessionInfo *session,     // IN: Session info
564
613
                           HgfsHandle *handle);          // OUT: Search handle
565
614
 
 
615
/* Allocate/Add sessions helper functions. */
 
616
 
 
617
Bool HgfsServerAllocateSession(HgfsTransportSessionInfo *transportSession,
 
618
                               uint32 channelCapabilities,
 
619
                               HgfsSessionInfo **sessionData);
 
620
 
 
621
void HgfsServerSessionGet(HgfsSessionInfo *session);
 
622
 
 
623
HgfsInternalStatus HgfsServerTransportAddSessionToList(HgfsTransportSessionInfo *transportSession,
 
624
                                                       HgfsSessionInfo *sessionInfo);
566
625
 
567
626
/* Unpack/pack requests/reply helper functions. */
568
627
 
569
628
Bool
570
629
HgfsParseRequest(HgfsPacket *packet,          // IN: request packet
571
 
                 HgfsSessionInfo *session,    // IN: current session
 
630
                 HgfsTransportSessionInfo *transportSession,    // IN: current session
572
631
                 HgfsInputParam **input,      // OUT: request parameters
573
632
                 HgfsInternalStatus *status); // OUT: error code
574
633
 
1032
1091
                      size_t packetOutLen,          // IN: Output packet size
1033
1092
                      HgfsInternalStatus status,    // IN: status
1034
1093
                      HgfsHandle id,                // IN: id of the request packet
1035
 
                      HgfsSessionInfo *session,     // IN: session info
 
1094
                      HgfsTransportSessionInfo *transportSession,     // IN: session info
1036
1095
                      HgfsSendFlags flags);         // IN: flags how to send
1037
1096
 
 
1097
/* Get the session with a specific session id */
 
1098
HgfsSessionInfo *
 
1099
HgfsServerTransportGetSessionInfo(HgfsTransportSessionInfo *transportSession,   // IN: transport session info
 
1100
                                  uint64 sessionId);                            // IN: session id
 
1101
 
1038
1102
Bool
1039
1103
HgfsPacketSend(HgfsPacket *packet,            // IN/OUT: Hgfs Packet
1040
1104
               char *packetOut,               // IN: Output packet buffer
1041
1105
               size_t packetOutLen,           // IN: Output packet size
1042
 
               HgfsSessionInfo *session,      // IN: session info
 
1106
               HgfsTransportSessionInfo *transportSession,      // IN: session info
1043
1107
               HgfsSendFlags flags);          // IN: flags how to send
1044
1108
 
1045
1109
Bool
1163
1227
                         HgfsSessionInfo *session,   // IN: Session info
1164
1228
                         HgfsLocalId *localId,       // OUT: Local unique file ID
1165
1229
                         fileDesc *newHandle);       // OUT: Handle to the file
1166
 
void HgfsServerSessionGet(HgfsSessionInfo *session); // IN: session context
1167
 
 
1168
1230
void *
1169
1231
HSPU_GetBuf(HgfsPacket *packet,           // IN/OUT: Hgfs Packet
1170
1232
            uint32 startIndex,            // IN: start index of iov
1172
1234
            size_t bufSize,               // IN: Size of buffer
1173
1235
            Bool *isAllocated,            // OUT: Was buffer allocated ?
1174
1236
            MappingType mappingType,      // IN: Readable/ Writeable ?
1175
 
            HgfsSessionInfo *session);    // IN: Session Info
 
1237
            HgfsTransportSessionInfo *transportSession);    // IN: Session Info
1176
1238
 
1177
1239
void *
1178
1240
HSPU_GetMetaPacket(HgfsPacket *packet,          // IN/OUT: Hgfs Packet
1179
1241
                   size_t *metaPacketSize,      // OUT: Size of metaPacket
1180
 
                   HgfsSessionInfo *session);   // IN: Session Info
 
1242
                   HgfsTransportSessionInfo *transportSession);   // IN: Session Info
1181
1243
 
1182
1244
void *
1183
1245
HSPU_GetDataPacketBuf(HgfsPacket *packet,        // IN/OUT: Hgfs Packet
1184
1246
                      MappingType mappingType,   // IN: Readable/ Writeable ?
1185
 
                      HgfsSessionInfo *session); // IN: Session Info
 
1247
                      HgfsTransportSessionInfo *transportSession); // IN: Session Info
1186
1248
 
1187
1249
void
1188
1250
HSPU_PutPacket(HgfsPacket *packet,         // IN/OUT: Hgfs Packet
1189
 
               HgfsSessionInfo *session);  // IN: Session Info
 
1251
               HgfsTransportSessionInfo *transportSession);  // IN: Session Info
1190
1252
 
1191
1253
void
1192
1254
HSPU_PutBuf(HgfsPacket *packet,        // IN/OUT: Hgfs Packet
1195
1257
            size_t *bufSize,           // IN: Size of the buffer
1196
1258
            Bool *isAllocated,         // IN: Was buffer allocated ?
1197
1259
            MappingType mappingType,   // IN: Readable/ Writeable ?
1198
 
            HgfsSessionInfo *session); // IN: Session info
 
1260
            HgfsTransportSessionInfo *transportSession); // IN: Session info
1199
1261
 
1200
1262
void
1201
1263
HSPU_PutDataPacketBuf(HgfsPacket *packet,         // IN/OUT: Hgfs Packet
1202
 
                      HgfsSessionInfo *session);  // IN: Session Info
 
1264
                      HgfsTransportSessionInfo *transportSession);  // IN: Session Info
1203
1265
 
1204
1266
void
1205
1267
HSPU_PutMetaPacket(HgfsPacket *packet,        // IN/OUT: Hgfs Packet
1206
 
                   HgfsSessionInfo *session); // IN: Session Info
 
1268
                   HgfsTransportSessionInfo *transportSession); // IN: Session Info
1207
1269
 
1208
1270
void
1209
1271
HSPU_CopyBufToDataIovec(HgfsPacket *packet,       // IN/OUT: Hgfs packet
1210
1272
                        void *buf,                // IN: Buffer to copy from
1211
1273
                        uint32 bufSize,           // IN: Size of buffer
1212
 
                        HgfsSessionInfo *session);// IN: Session Info
 
1274
                        HgfsTransportSessionInfo *transportSession);// IN: Session Info
1213
1275
void
1214
1276
HSPU_CopyBufToIovec(HgfsPacket *packet,       // IN/OUT: Hgfs Packet
1215
1277
                    uint32 startIndex,        // IN: start index into iov
1216
1278
                    void *buf,                // IN: Buffer
1217
1279
                    size_t bufSize,           // IN: Size of buffer
1218
 
                    HgfsSessionInfo *session); // IN: Session Info
 
1280
                    HgfsTransportSessionInfo *transportSession); // IN: Session Info
1219
1281
void *
1220
1282
HSPU_GetReplyPacket(HgfsPacket *packet,        // IN/OUT: Hgfs Packet
1221
1283
                    size_t *replyPacketSize,   //IN/OUT: Size of reply Packet
1222
 
                    HgfsSessionInfo *session); // IN: Session Info
 
1284
                    HgfsTransportSessionInfo *transportSession); // IN: Session Info
1223
1285
 
1224
1286
void
1225
1287
HSPU_PutReplyPacket(HgfsPacket *packet,        // IN/OUT: Hgfs Packet
1226
 
                    HgfsSessionInfo *session); // IN: Session Info
 
1288
                    HgfsTransportSessionInfo *transportSession); // IN: Session Info
1227
1289
#endif /* __HGFS_SERVER_INT_H__ */