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

« back to all changes in this revision

Viewing changes to modules/solaris/vmhgfs/cpName.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2009-03-20 10:19:00 UTC
  • mfrom: (1.1.4 upstream) (2.4.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090320101900-1o604camiubq2de8
Tags: 2009.03.18-154848-2
Correcting patch system depends (Closes: #520493).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*********************************************************
 
2
 * Copyright (C) 1998 VMware, Inc. All rights reserved.
 
3
 *
 
4
 * The contents of this file are subject to the terms of the Common
 
5
 * Development and Distribution License (the "License") version 1.0
 
6
 * and no later version.  You may not use this file except in
 
7
 * compliance with the License.
 
8
 *
 
9
 * You can obtain a copy of the License at
 
10
 *         http://www.opensource.org/licenses/cddl1.php
 
11
 *
 
12
 * See the License for the specific language governing permissions
 
13
 * and limitations under the License.
 
14
 *
 
15
 *********************************************************/
 
16
 
 
17
/*
 
18
 * cpName.h --
 
19
 *
 
20
 *    Cross-platform name format used by hgfs.
 
21
 *
 
22
 */
 
23
 
 
24
#ifndef __CP_NAME_H__
 
25
#define __CP_NAME_H__
 
26
 
 
27
 
 
28
#ifdef __KERNEL__
 
29
#  include "driver-config.h"
 
30
#  include <linux/string.h>
 
31
#elif defined(__FreeBSD__)
 
32
#   if defined(_KERNEL)
 
33
#      include <sys/libkern.h>
 
34
#      define strchr(s,c)       index(s,c)
 
35
#   else
 
36
#      include <string.h>
 
37
#   endif
 
38
#elif defined(__APPLE__) && defined(KERNEL)
 
39
#  include <string.h>
 
40
#elif !defined(sun)
 
41
#  include <stdlib.h>
 
42
#  include <string.h>
 
43
#endif
 
44
 
 
45
#include "vm_basic_types.h"
 
46
 
 
47
 
 
48
/* Status codes for processing share names */
 
49
typedef enum {
 
50
   HGFS_NAME_STATUS_COMPLETE,            /* Name is complete */
 
51
   HGFS_NAME_STATUS_FAILURE,             /* Name processing failed */
 
52
   HGFS_NAME_STATUS_INCOMPLETE_BASE,     /* Name is base of namespace */
 
53
   HGFS_NAME_STATUS_INCOMPLETE_ROOT,     /* Name is "root" only */
 
54
   HGFS_NAME_STATUS_INCOMPLETE_DRIVE,    /* Name is "root drive" only */
 
55
   HGFS_NAME_STATUS_INCOMPLETE_UNC,      /* Name is "root unc" only */
 
56
   HGFS_NAME_STATUS_INCOMPLETE_UNC_MACH, /* Name is "root unc <x>" only */
 
57
   HGFS_NAME_STATUS_DOES_NOT_EXIST,      /* Name does not exist */
 
58
   HGFS_NAME_STATUS_ACCESS_DENIED,       /* Desired access to share denied */
 
59
   HGFS_NAME_STATUS_SYMBOLIC_LINK,       /* Name contains a symbolic link */
 
60
   HGFS_NAME_STATUS_OUT_OF_MEMORY,       /* Out of memory while processing */
 
61
   HGFS_NAME_STATUS_TOO_LONG,            /* Name has overly long component */
 
62
} HgfsNameStatus;
 
63
 
 
64
 
 
65
int
 
66
CPName_ConvertTo(char const *nameIn, // IN:  The buf to convert
 
67
                 size_t bufOutSize,  // IN:  The size of the output buffer
 
68
                 char *bufOut);      // OUT: The output buffer
 
69
 
 
70
int
 
71
CPName_LinuxConvertTo(char const *nameIn, // IN:  buf to convert
 
72
                      size_t bufOutSize,  // IN:  size of the output buffer
 
73
                      char *bufOut);      // OUT: output buffer
 
74
 
 
75
int
 
76
CPName_WindowsConvertTo(char const *nameIn, // IN:  buf to convert
 
77
                        size_t bufOutSize,  // IN:  size of the output buffer
 
78
                        char *bufOut);      // OUT: output buffer
 
79
 
 
80
int
 
81
CPName_ConvertFrom(char const **bufIn, // IN/OUT: Input to convert
 
82
                   size_t *inSize,     // IN/OUT: Size of input buffer
 
83
                   size_t *outSize,    // IN/OUT: Size of output buffer
 
84
                   char **bufOut);     // IN/OUT: Output buffer
 
85
 
 
86
HgfsNameStatus
 
87
CPName_ConvertFromRoot(char const **bufIn, // IN/OUT: Input to convert
 
88
                       size_t *inSize,     // IN/OUT: Size of input
 
89
                       size_t *outSize,    // IN/OUT: Size of output buf
 
90
                       char **bufOut);     // IN/OUT: Output buffer
 
91
 
 
92
int
 
93
CPName_GetComponent(char const *begin,  // IN: Beginning of buffer
 
94
                    char const *end,    // IN: End of buffer
 
95
                    char const **next); // OUT: Next component
 
96
 
 
97
char const *
 
98
CPName_Print(char const *in, // IN: Name to print
 
99
             size_t size);   // IN: Size of name
 
100
 
 
101
 
 
102
#endif /* __CP_NAME_H__ */