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

« back to all changes in this revision

Viewing changes to modules/linux/vmblock/linux/module.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2009-10-18 12:28:19 UTC
  • mfrom: (1.1.7 upstream) (2.4.9 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091018122819-00vqew6m0ztpqcqp
Tags: 2009.10.15-201664-1
MergingĀ upstreamĀ versionĀ 2009.10.15-201664.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 */
25
25
 
26
26
#include "driver-config.h"
27
 
#include "compat_init.h"
28
 
#include "compat_kernel.h"
29
 
#include "compat_module.h"
 
27
#include <linux/init.h>
 
28
#include <linux/module.h>
30
29
#include <linux/limits.h>
31
30
#include <linux/errno.h>
32
 
#include "compat_string.h"
33
31
 
34
32
#include "vmblockInt.h"
35
33
#include "vmblock_version.h"
37
35
/* Module parameters */
38
36
#ifdef VMX86_DEVEL /* { */
39
37
int LOGLEVEL_THRESHOLD = 4;
40
 
#  if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
41
 
   module_param(LOGLEVEL_THRESHOLD, int, 0600);
42
 
#  else
43
 
   MODULE_PARM(LOGLEVEL_THRESHOLD, "i");
44
 
#  endif
 
38
module_param(LOGLEVEL_THRESHOLD, int, 0600);
45
39
MODULE_PARM_DESC(LOGLEVEL_THRESHOLD, "Logging level (0 means no log, "
46
40
                 "10 means very verbose, 4 is default)");
47
41
#endif /* } */
48
42
 
49
43
static char *root = "/tmp/VMwareDnD";
50
 
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
51
44
module_param(root, charp, 0600);
52
 
#else
53
 
MODULE_PARM(root, "s");
54
 
#endif
55
45
MODULE_PARM_DESC(root, "The directory the file system redirects to.");
56
46
 
57
47
/* Module information */
67
57
 */
68
58
MODULE_INFO(supported, "external");
69
59
 
70
 
/* Functions */
71
 
static int VMBlockInit(void);
72
 
static void VMBlockExit(void);
73
 
 
74
 
/* Define init/exit routines */
75
 
module_init(VMBlockInit);
76
 
module_exit(VMBlockExit);
77
 
 
78
 
 
79
60
/*
80
61
 *----------------------------------------------------------------------------
81
62
 *
117
98
   return ret;
118
99
}
119
100
 
 
101
module_init(VMBlockInit);
 
102
 
120
103
 
121
104
/*
122
105
 *----------------------------------------------------------------------------
144
127
   LOG(4, "module unloaded\n");
145
128
}
146
129
 
147
 
 
148
 
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 70)
149
 
/*
150
 
 *----------------------------------------------------------------------------
151
 
 *
152
 
 * strlcpy --
153
 
 *
154
 
 *    2.4 doesn't have strlcpy().
155
 
 *
156
 
 *    Copies at most count - 1 bytes from src to dest, and ensures dest is NUL
157
 
 *    terminated.
158
 
 *
159
 
 * Results:
160
 
 *    Length of src.  If src >= count, src was truncated in copy.
161
 
 *
162
 
 * Side effects:
163
 
 *    None.
164
 
 *
165
 
 *----------------------------------------------------------------------------
166
 
 */
167
 
 
168
 
size_t
169
 
strlcpy(char *dest,         // OUT: destination to copy string to
170
 
        const char *src,    // IN : source to copy string from
171
 
        size_t count)       // IN : size of destination buffer
172
 
{
173
 
   size_t ret;
174
 
   size_t len;
175
 
 
176
 
   ret = strlen(src);
177
 
   len = ret >= count ? count - 1 : ret;
178
 
   memcpy(dest, src, len);
179
 
   dest[len] = '\0';
180
 
   return ret;
181
 
}
182
 
#endif
 
130
module_exit(VMBlockExit);