Print this page
NEX-5801 Snapshots left over after failed backups
Reviewed by: Rick Mesta <rick.mesta@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Revert "NEX-5801 Snapshots left over after failed backups"
This reverts commit f182fb95f09036db71fbfc6f0a6b90469b761f21.
NEX-5801 Snapshots left over after failed backups
Reviewed by: Rick Mesta <rick.mesta@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
NEX-2911 NDMP logging should use syslog and is too chatty
NEX-1123 NDMP commands can not uniquely identify Nexenta and the file server version (currently 4.0.1) and Sun Microsystems.
OS-49 Switch back to illumos' version of wcwidth()
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
NEX-426 ndmp_config_get_ext_list failed
NEX-250 Failed to open device /dev/rmt/0n because of too many files open
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/cmd/ndmpd/ndmp/ndmpd_config.c
+++ new/usr/src/cmd/ndmpd/ndmp/ndmpd_config.c
1 1 /*
2 2 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
3 3 */
4 4
5 5 /*
6 6 * BSD 3 Clause License
7 7 *
8 8 * Copyright (c) 2007, The Storage Networking Industry Association.
9 9 *
10 10 * Redistribution and use in source and binary forms, with or without
11 11 * modification, are permitted provided that the following conditions
12 12 * are met:
13 13 * - Redistributions of source code must retain the above copyright
14 14 * notice, this list of conditions and the following disclaimer.
15 15 *
16 16 * - Redistributions in binary form must reproduce the above copyright
17 17 * notice, this list of conditions and the following disclaimer in
18 18 * the documentation and/or other materials provided with the
19 19 * distribution.
20 20 *
21 21 * - Neither the name of The Storage Networking Industry Association (SNIA)
22 22 * nor the names of its contributors may be used to endorse or promote
23 23 * products derived from this software without specific prior written
24 24 * permission.
25 25 *
26 26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 27 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 29 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
↓ open down ↓ |
29 lines elided |
↑ open up ↑ |
30 30 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 36 * POSSIBILITY OF SUCH DAMAGE.
37 37 */
38 38 /* Copyright (c) 2007, The Storage Networking Industry Association. */
39 39 /* Copyright (c) 1996, 1997 PDC, Network Appliance. All Rights Reserved */
40 -/* Copyright 2014 Nexenta Systems, Inc. All rights reserved. */
40 +/* Copyright 2016 Nexenta Systems, Inc. All rights reserved. */
41 41
42 42 #include <dirent.h>
43 43 #include <errno.h>
44 44 #include <stdio.h>
45 45 #include <stdlib.h>
46 46 #include <string.h>
47 +#include <syslog.h>
47 48 #include <sys/stat.h>
48 49 #include <sys/mnttab.h>
49 50 #include <sys/mntent.h>
50 51 #include <sys/mntio.h>
51 52 #include <sys/statvfs.h>
52 53 #include <sys/utsname.h>
53 54 #include <sys/scsi/scsi.h>
54 55 #include <unistd.h>
55 56 #include <sys/systeminfo.h>
56 57 #include "ndmpd_common.h"
57 58 #include "ndmpd.h"
58 59
59 60 static void simple_get_attrs(ulong_t *attributes);
60 61
61 62 /*
62 63 * Number of environment variable for the file system
63 64 * info in V3 net_fs_info.
64 65 */
65 66 #define V3_N_FS_ENVS 4
66 67
67 68 /*
68 69 * Is the file system a valid one to be reported to the
69 70 * clients?
70 71 */
71 72 #define IS_VALID_FS(fs) (fs && ( \
72 73 strcasecmp(fs->mnt_fstype, MNTTYPE_UFS) == 0 || \
73 74 strcasecmp(fs->mnt_fstype, MNTTYPE_ZFS) == 0 || \
74 75 strcasecmp(fs->mnt_fstype, MNTTYPE_NFS) == 0 || \
75 76 strcasecmp(fs->mnt_fstype, MNTTYPE_NFS3) == 0 || \
76 77 strcasecmp(fs->mnt_fstype, MNTTYPE_NFS4) == 0))
77 78
78 79 #define MNTTYPE_LEN 10
79 80
80 81 extern struct fs_ops sfs2_ops;
81 82 extern struct fs_ops sfs2cpv_ops;
82 83
83 84
84 85 /*
85 86 * ************************************************************************
86 87 * NDMP V2 HANDLERS
87 88 * ************************************************************************
88 89 */
89 90
90 91 /*
91 92 * ndmpd_config_get_host_info_v2
92 93 *
93 94 * This handler handles the ndmp_config_get_host_info request.
94 95 * Host specific information is returned.
95 96 *
96 97 * Parameters:
97 98 * connection (input) - connection handle.
98 99 * body (input) - request message body.
99 100 *
100 101 * Returns:
101 102 * void
102 103 */
103 104 /*ARGSUSED*/
104 105 void
105 106 ndmpd_config_get_host_info_v2(ndmp_connection_t *connection, void *body)
106 107 {
107 108 ndmp_config_get_host_info_reply_v2 reply;
108 109 ndmp_auth_type auth_types[2];
109 110 char buf[HOSTNAMELEN + 1];
110 111 struct utsname uts;
111 112 char hostidstr[16];
112 113 ulong_t hostid;
113 114
114 115 (void) memset((void*)&reply, 0, sizeof (reply));
|
↓ open down ↓ |
58 lines elided |
↑ open up ↑ |
115 116 (void) memset(buf, 0, sizeof (buf));
116 117 (void) gethostname(buf, sizeof (buf));
117 118
118 119 reply.error = NDMP_NO_ERR;
119 120 reply.hostname = buf;
120 121 (void) uname(&uts);
121 122 reply.os_type = uts.sysname;
122 123 reply.os_vers = uts.release;
123 124
124 125 if (sysinfo(SI_HW_SERIAL, hostidstr, sizeof (hostidstr)) < 0) {
125 - NDMP_LOG(LOG_DEBUG, "sysinfo error: %m.");
126 + syslog(LOG_ERR, "sysinfo error: %m.");
126 127 reply.error = NDMP_UNDEFINED_ERR;
127 128 }
128 129
129 130 /*
130 131 * Convert the hostid to hex. The returned string must match
131 132 * the string returned by hostid(1).
132 133 */
133 134 hostid = strtoul(hostidstr, 0, 0);
134 135 (void) snprintf(hostidstr, sizeof (hostidstr), "%lx", hostid);
135 136 reply.hostid = hostidstr;
136 137
137 138 auth_types[0] = NDMP_AUTH_TEXT;
138 139 reply.auth_type.auth_type_len = 1;
139 140 reply.auth_type.auth_type_val = auth_types;
140 141
141 142 ndmp_send_reply(connection, (void *) &reply,
142 143 "sending ndmp_config_get_host_info reply");
143 144 }
144 145
145 146
146 147 /*
147 148 * ndmpd_config_get_butype_attr_v2
148 149 *
149 150 * This handler handles the ndmp_config_get_butype_attr request.
150 151 * Information about the specified backup type is returned.
151 152 *
152 153 * Parameters:
153 154 * connection (input) - connection handle.
154 155 * body (input) - request message body.
155 156 *
156 157 * Returns:
157 158 * void
158 159 */
159 160 void
160 161 ndmpd_config_get_butype_attr_v2(ndmp_connection_t *connection, void *body)
161 162 {
162 163 ndmp_config_get_butype_attr_request *request;
163 164 ndmp_config_get_butype_attr_reply reply;
|
↓ open down ↓ |
28 lines elided |
↑ open up ↑ |
164 165
165 166 request = (ndmp_config_get_butype_attr_request *)body;
166 167
167 168 reply.error = NDMP_NO_ERR;
168 169
169 170 if (strcmp(request->name, "dump") == 0) {
170 171 (void) simple_get_attrs(&reply.attrs);
171 172 } else if (strcmp(request->name, "tar") == 0) {
172 173 reply.attrs = NDMP_NO_BACKUP_FILELIST;
173 174 } else {
174 - NDMP_LOG(LOG_ERR, "Invalid backup type: %s.", request->name);
175 - NDMP_LOG(LOG_ERR,
175 + syslog(LOG_ERR, "Invalid backup type: %s.", request->name);
176 + syslog(LOG_ERR,
176 177 "Supported backup types are 'dump' and 'tar' only.");
177 178 reply.error = NDMP_ILLEGAL_ARGS_ERR;
178 179 }
179 180
180 181 ndmp_send_reply(connection, (void *) &reply,
181 182 "sending ndmp_config_get_butype_attr reply");
182 183 }
183 184
184 185
185 186 /*
186 187 * ndmpd_config_get_mover_type_v2
187 188 *
188 189 * This handler handles the ndmp_config_get_mover_type request.
189 190 * Information about the supported mover types is returned.
190 191 *
191 192 * Parameters:
192 193 * connection (input) - connection handle.
193 194 * body (input) - request message body.
194 195 *
195 196 * Returns:
196 197 * void
197 198 */
198 199 /*ARGSUSED*/
199 200 void
200 201 ndmpd_config_get_mover_type_v2(ndmp_connection_t *connection, void *body)
201 202 {
202 203 ndmp_config_get_mover_type_reply reply;
203 204 ndmp_addr_type types[2];
204 205
205 206 types[0] = NDMP_ADDR_LOCAL;
206 207 types[1] = NDMP_ADDR_TCP;
207 208
208 209 reply.error = NDMP_NO_ERR;
209 210 reply.methods.methods_len = 2;
210 211 reply.methods.methods_val = types;
211 212
212 213 ndmp_send_reply(connection, (void *) &reply,
213 214 "sending ndmp_config_get_mover_type reply");
214 215 }
215 216
216 217
217 218
218 219 /*
219 220 * ndmpd_config_get_auth_attr_v2
220 221 *
221 222 * This handler handles the ndmp_config_get_auth_attr request.
222 223 * Authorization type specific information is returned.
223 224 *
224 225 * Parameters:
225 226 * connection (input) - connection handle.
226 227 * body (input) - request message body.
227 228 *
228 229 * Returns:
229 230 * void
230 231 */
231 232 void
232 233 ndmpd_config_get_auth_attr_v2(ndmp_connection_t *connection, void *body)
233 234 {
234 235 ndmp_config_get_auth_attr_request *request;
235 236 ndmp_config_get_auth_attr_reply reply;
236 237 ndmpd_session_t *session = ndmp_get_client_data(connection);
237 238
238 239 request = (ndmp_config_get_auth_attr_request *)body;
239 240
240 241 reply.error = NDMP_NO_ERR;
241 242 reply.server_attr.auth_type = request->auth_type;
242 243
243 244 switch (request->auth_type) {
244 245 case NDMP_AUTH_TEXT:
|
↓ open down ↓ |
59 lines elided |
↑ open up ↑ |
245 246 break;
246 247 case NDMP_AUTH_MD5:
247 248 /* Create a 64 byte random session challenge */
248 249 randomize(session->ns_challenge, MD5_CHALLENGE_SIZE);
249 250 (void) memcpy(reply.server_attr.ndmp_auth_attr_u.challenge,
250 251 session->ns_challenge, MD5_CHALLENGE_SIZE);
251 252 break;
252 253 case NDMP_AUTH_NONE:
253 254 /* FALL THROUGH */
254 255 default:
255 - NDMP_LOG(LOG_ERR, "Invalid authentication type: %d.",
256 + syslog(LOG_ERR, "Invalid authentication type: %d.",
256 257 request->auth_type);
257 - NDMP_LOG(LOG_ERR,
258 + syslog(LOG_ERR,
258 259 "Supported authentication types are md5 and cleartext.");
259 260 reply.error = NDMP_ILLEGAL_ARGS_ERR;
260 261 break;
261 262 }
262 263
263 264 ndmp_send_reply(connection, (void *) &reply,
264 265 "sending ndmp_config_get_auth_attr reply");
265 266 }
266 267
267 268
268 269 /*
269 270 * ************************************************************************
270 271 * NDMP V3 HANDLERS
271 272 * ************************************************************************
272 273 */
273 274
274 275 /*
275 276 * ndmpd_config_get_host_info_v3
276 277 *
277 278 * This handler handles the ndmp_config_get_host_info request.
278 279 * Host specific information is returned.
279 280 *
280 281 * Parameters:
281 282 * connection (input) - connection handle.
282 283 * body (input) - request message body.
283 284 *
284 285 * Returns:
285 286 * void
286 287 */
287 288 /*ARGSUSED*/
288 289 void
289 290 ndmpd_config_get_host_info_v3(ndmp_connection_t *connection, void *body)
290 291 {
291 292 ndmp_config_get_host_info_reply_v3 reply;
292 293 char buf[HOSTNAMELEN+1];
293 294 struct utsname uts;
294 295 char hostidstr[16];
295 296 ulong_t hostid;
296 297
297 298 (void) memset((void*)&reply, 0, sizeof (reply));
298 299 (void) memset(buf, 0, sizeof (buf));
299 300 (void) gethostname(buf, sizeof (buf));
|
↓ open down ↓ |
32 lines elided |
↑ open up ↑ |
300 301
301 302
302 303 reply.error = NDMP_NO_ERR;
303 304 reply.hostname = buf;
304 305 (void) uname(&uts);
305 306 reply.os_type = uts.sysname;
306 307 reply.os_vers = uts.release;
307 308
308 309 if (sysinfo(SI_HW_SERIAL, hostidstr, sizeof (hostidstr)) < 0) {
309 310
310 - NDMP_LOG(LOG_DEBUG, "sysinfo error: %m.");
311 + syslog(LOG_ERR, "sysinfo error: %m.");
311 312 reply.error = NDMP_UNDEFINED_ERR;
312 313 }
313 314
314 315 /*
315 316 * Convert the hostid to hex. The returned string must match
316 317 * the string returned by hostid(1).
317 318 */
318 319 hostid = strtoul(hostidstr, 0, 0);
319 320 (void) snprintf(hostidstr, sizeof (hostidstr), "%lx", hostid);
320 321 reply.hostid = hostidstr;
321 322
322 323 ndmp_send_reply(connection, (void *) &reply,
323 324 "sending ndmp_config_get_host_info reply");
324 325 }
325 326
326 327
327 328 /*
328 329 * ndmpd_config_get_connection_type_v3
329 330 *
330 331 * This handler handles the ndmp_config_get_connection_type_request.
331 332 * A list of supported data connection types is returned.
332 333 *
333 334 * Parameters:
334 335 * connection (input) - connection handle.
335 336 * body (input) - request message body.
336 337 *
337 338 * Returns:
338 339 * void
339 340 */
340 341 /*ARGSUSED*/
341 342 void
342 343 ndmpd_config_get_connection_type_v3(ndmp_connection_t *connection,
343 344 void *body)
344 345 {
345 346 ndmp_config_get_connection_type_reply_v3 reply;
346 347 ndmp_addr_type addr_types[2];
347 348
348 349 (void) memset((void*)&reply, 0, sizeof (reply));
349 350
350 351 reply.error = NDMP_NO_ERR;
351 352
352 353 addr_types[0] = NDMP_ADDR_LOCAL;
353 354 addr_types[1] = NDMP_ADDR_TCP;
354 355 reply.addr_types.addr_types_len = 2;
355 356 reply.addr_types.addr_types_val = addr_types;
356 357
357 358 ndmp_send_reply(connection, (void *) &reply,
358 359 "sending config_get_connection_type_v3 reply");
359 360 }
360 361
361 362
362 363
363 364 /*
364 365 * ndmpd_config_get_auth_attr_v3
365 366 *
366 367 * This handler handles the ndmp_config_get_auth_attr request.
367 368 * Authorization type specific information is returned.
368 369 *
369 370 * Parameters:
370 371 * connection (input) - connection handle.
371 372 * body (input) - request message body.
372 373 *
373 374 * Returns:
374 375 * void
375 376 */
376 377 void
377 378 ndmpd_config_get_auth_attr_v3(ndmp_connection_t *connection, void *body)
378 379 {
379 380 ndmp_config_get_auth_attr_request *request;
380 381 ndmp_config_get_auth_attr_reply reply;
381 382 ndmpd_session_t *session = ndmp_get_client_data(connection);
382 383
383 384 request = (ndmp_config_get_auth_attr_request *)body;
384 385
385 386 (void) memset((void*)&reply, 0, sizeof (reply));
386 387 reply.error = NDMP_NO_ERR;
387 388 reply.server_attr.auth_type = request->auth_type;
388 389
389 390 switch (request->auth_type) {
390 391 case NDMP_AUTH_TEXT:
|
↓ open down ↓ |
70 lines elided |
↑ open up ↑ |
391 392 break;
392 393 case NDMP_AUTH_MD5:
393 394 /* Create a 64 bytes random session challenge */
394 395 randomize(session->ns_challenge, MD5_CHALLENGE_SIZE);
395 396 (void) memcpy(reply.server_attr.ndmp_auth_attr_u.challenge,
396 397 session->ns_challenge, MD5_CHALLENGE_SIZE);
397 398 break;
398 399 case NDMP_AUTH_NONE:
399 400 /* FALL THROUGH */
400 401 default:
401 - NDMP_LOG(LOG_ERR, "Invalid authentication type: %d.",
402 + syslog(LOG_ERR, "Invalid authentication type: %d.",
402 403 request->auth_type);
403 - NDMP_LOG(LOG_ERR,
404 + syslog(LOG_ERR,
404 405 "Supported authentication types are md5 and cleartext.");
405 406 reply.error = NDMP_ILLEGAL_ARGS_ERR;
406 407 break;
407 408 }
408 409
409 410 ndmp_send_reply(connection, (void *) &reply,
410 411 "sending ndmp_config_get_auth_attr_v3 reply");
411 412 }
412 413
413 414
414 415 /*
415 416 * ndmpd_config_get_butype_info_v3
416 417 *
417 418 * This handler handles the ndmp_config_get_butype_info_request.
418 419 * Information about all supported backup types are returned.
419 420 *
420 421 * Parameters:
421 422 * connection (input) - connection handle.
422 423 * body (input) - request message body.
423 424 *
424 425 * Returns:
425 426 * void
426 427 */
427 428 /*ARGSUSED*/
428 429 void
429 430 ndmpd_config_get_butype_info_v3(ndmp_connection_t *connection, void *body)
430 431 {
431 432 ndmp_config_get_butype_info_reply_v3 reply;
432 433 ndmp_butype_info info[3];
433 434 ndmp_pval envs[8];
434 435 ulong_t attrs;
435 436 ndmp_pval *envp = envs;
436 437
437 438 ndmp_pval zfs_envs[9];
438 439 ulong_t zfs_attrs;
439 440 ndmp_pval *zfs_envp = zfs_envs;
440 441
441 442 (void) memset((void*)&reply, 0, sizeof (reply));
442 443
443 444 /*
444 445 * Supported environment variables and their default values
445 446 * for dump and tar.
446 447 *
447 448 * The environment variables for dump and tar format are the
448 449 * same, because we use the same backup engine for both.
449 450 */
450 451 NDMP_SETENV(envp, "PREFIX", "");
451 452 NDMP_SETENV(envp, "TYPE", "");
452 453 NDMP_SETENV(envp, "DIRECT", "n");
453 454 NDMP_SETENV(envp, "HIST", "n");
454 455 NDMP_SETENV(envp, "FILESYSTEM", "");
455 456 NDMP_SETENV(envp, "LEVEL", "0");
456 457 NDMP_SETENV(envp, "UPDATE", "TRUE");
457 458 NDMP_SETENV(envp, "BASE_DATE", "");
458 459
459 460 attrs = NDMP_BUTYPE_BACKUP_FILE_HISTORY |
460 461 NDMP_BUTYPE_RECOVER_FILELIST |
461 462 NDMP_BUTYPE_BACKUP_DIRECT |
462 463 NDMP_BUTYPE_BACKUP_INCREMENTAL |
463 464 NDMP_BUTYPE_BACKUP_UTF8 |
464 465 NDMP_BUTYPE_RECOVER_UTF8;
465 466
466 467 /* If DAR supported */
467 468 if (ndmp_dar_support)
468 469 attrs |= NDMP_BUTYPE_RECOVER_DIRECT;
469 470
470 471 /* tar backup type */
471 472 info[0].butype_name = "tar";
472 473 info[0].default_env.default_env_len = ARRAY_LEN(envs, ndmp_pval);
473 474 info[0].default_env.default_env_val = envs;
474 475 info[0].attrs = attrs;
475 476
476 477 /* dump backup type */
477 478 info[1].butype_name = "dump";
478 479 info[1].default_env.default_env_len = ARRAY_LEN(envs, ndmp_pval);
479 480 info[1].default_env.default_env_val = envs;
480 481 info[1].attrs = attrs;
481 482
482 483 /*
483 484 * Supported environment variables and their default values
484 485 * for type "zfs."
485 486 */
486 487
487 488 NDMP_SETENV(zfs_envp, "PREFIX", "");
488 489 NDMP_SETENV(zfs_envp, "FILESYSTEM", "");
489 490 NDMP_SETENV(zfs_envp, "TYPE", "zfs");
490 491 NDMP_SETENV(zfs_envp, "HIST", "n");
491 492 NDMP_SETENV(zfs_envp, "LEVEL", "0");
492 493 NDMP_SETENV(zfs_envp, "ZFS_MODE", "recursive");
493 494 NDMP_SETENV(zfs_envp, "ZFS_FORCE", "FALSE");
494 495 NDMP_SETENV(zfs_envp, "UPDATE", "TRUE");
495 496 NDMP_SETENV(zfs_envp, "DMP_NAME", "level");
496 497
497 498 zfs_attrs = NDMP_BUTYPE_BACKUP_UTF8 |
498 499 NDMP_BUTYPE_RECOVER_UTF8 |
499 500 NDMP_BUTYPE_BACKUP_DIRECT |
500 501 NDMP_BUTYPE_BACKUP_INCREMENTAL;
501 502
502 503 /* zfs backup type */
503 504 info[2].butype_name = "zfs";
504 505 info[2].default_env.default_env_len = ARRAY_LEN(zfs_envs, ndmp_pval);
505 506 info[2].default_env.default_env_val = zfs_envs;
506 507 info[2].attrs = zfs_attrs;
507 508
508 509 reply.error = NDMP_NO_ERR;
509 510 reply.butype_info.butype_info_len = ARRAY_LEN(info, ndmp_butype_info);
510 511 reply.butype_info.butype_info_val = info;
511 512
512 513 ndmp_send_reply(connection, (void *)&reply,
513 514 "sending ndmp_config_get_butype_info reply");
514 515 }
515 516
516 517 /*
517 518 * ndmpd_config_get_fs_info_v3
518 519 *
519 520 * This handler handles the ndmp_config_get_fs_info_request.
520 521 * Information about all mounted file systems is returned.
521 522 *
522 523 * Parameters:
523 524 * connection (input) - connection handle.
524 525 * body (input) - request message body.
525 526 *
526 527 * Returns:
527 528 * void
528 529 */
529 530 /*ARGSUSED*/
530 531 void
531 532 ndmpd_config_get_fs_info_v3(ndmp_connection_t *connection, void *body)
532 533 {
533 534 ndmp_config_get_fs_info_reply_v3 reply;
534 535 ndmp_fs_info_v3 *fsip = NULL, *fsip_save = NULL; /* FS info pointer */
535 536 int len = 0, nmnt, fd;
|
↓ open down ↓ |
122 lines elided |
↑ open up ↑ |
536 537 int log_dev_len;
537 538 FILE *fp = NULL;
538 539 struct mnttab mt, *fs;
539 540 struct statvfs64 stat_buf;
540 541 ndmp_pval *envp, *save;
541 542
542 543 (void) memset((void*)&reply, 0, sizeof (reply));
543 544 reply.error = NDMP_NO_ERR;
544 545
545 546 if ((fd = open(MNTTAB, O_RDONLY)) == -1) {
546 - NDMP_LOG(LOG_ERR, "File mnttab open error: %m.");
547 + syslog(LOG_ERR, "File mnttab open error: %m.");
547 548 reply.error = NDMP_UNDEFINED_ERR;
548 549 goto send_reply;
549 550 }
550 551
551 552 /* nothing was found, send an empty reply */
552 553 if (ioctl(fd, MNTIOC_NMNTS, &nmnt) != 0 || nmnt <= 0) {
553 554 (void) close(fd);
554 - NDMP_LOG(LOG_ERR, "No file system found.");
555 + syslog(LOG_ERR, "No file system found.");
555 556 goto send_reply;
556 557 }
557 558
558 559 fp = fdopen(fd, "r");
559 560 if (!fp) {
560 561 (void) close(fd);
561 - NDMP_LOG(LOG_ERR, "File mnttab open error: %m.");
562 + syslog(LOG_ERR, "File mnttab open error: %m.");
562 563 reply.error = NDMP_UNDEFINED_ERR;
563 564 goto send_reply;
564 565 }
565 566
566 567 fsip_save = fsip = ndmp_malloc(sizeof (ndmp_fs_info_v3) * nmnt);
567 568 if (!fsip) {
568 569 (void) fclose(fp);
569 570 reply.error = NDMP_NO_MEM_ERR;
570 571 goto send_reply;
571 572 }
572 573
573 574 /*
574 575 * Re-read the directory and set up file system information.
575 576 */
576 577 rewind(fp);
577 578 while (len < nmnt && (getmntent(fp, &mt) == 0))
578 579
579 580 {
580 581 fs = &mt;
581 582 log_dev_len = strlen(mt.mnt_mountp)+2;
582 583 if (!IS_VALID_FS(fs))
583 584 continue;
584 585
585 586 fsip->fs_logical_device = ndmp_malloc(log_dev_len);
586 587 fsip->fs_type = ndmp_malloc(MNTTYPE_LEN);
587 588 if (!fsip->fs_logical_device || !fsip->fs_type) {
588 589 free(fsip->fs_logical_device);
589 590 free(fsip->fs_type);
|
↓ open down ↓ |
18 lines elided |
↑ open up ↑ |
590 591 reply.error = NDMP_NO_MEM_ERR;
591 592 break;
592 593 }
593 594 (void) snprintf(fsip->fs_type, MNTTYPE_LEN, "%s",
594 595 fs->mnt_fstype);
595 596 (void) snprintf(fsip->fs_logical_device, log_dev_len, "%s",
596 597 fs->mnt_mountp);
597 598 fsip->invalid = 0;
598 599
599 600 if (statvfs64(fs->mnt_mountp, &stat_buf) < 0) {
600 - NDMP_LOG(LOG_DEBUG,
601 + syslog(LOG_ERR,
601 602 "statvfs(%s) error.", fs->mnt_mountp);
602 603 fsip->fs_status =
603 604 "statvfs error: unable to determine filesystem"
604 605 " attributes";
605 606 } else {
606 607 fsip->invalid = 0;
607 608 fsip->total_size =
608 609 long_long_to_quad((u_longlong_t)stat_buf.f_frsize *
609 610 (u_longlong_t)stat_buf.f_blocks);
610 611 fsip->used_size =
611 612 long_long_to_quad((u_longlong_t)stat_buf.f_frsize *
612 613 (u_longlong_t)(stat_buf.f_blocks-stat_buf.f_bfree));
613 614
614 615 fsip->avail_size =
615 616 long_long_to_quad((u_longlong_t)stat_buf.f_frsize *
616 617 (u_longlong_t)stat_buf.f_bfree);
617 618 fsip->total_inodes =
618 619 long_long_to_quad((u_longlong_t)stat_buf.f_files);
619 620 fsip->used_inodes =
620 621 long_long_to_quad((u_longlong_t)(stat_buf.f_files -
621 622 stat_buf.f_ffree));
622 623 fsip->fs_status = "";
623 624 }
624 625 save = envp = ndmp_malloc(sizeof (ndmp_pval) * V3_N_FS_ENVS);
625 626 if (!envp) {
626 627 free(fsip->fs_logical_device);
627 628 free(fsip->fs_type);
628 629 reply.error = NDMP_NO_MEM_ERR;
629 630 break;
630 631 }
631 632 (void) memset((void*)save, 0,
632 633 V3_N_FS_ENVS * sizeof (ndmp_pval));
633 634
634 635 fsip->fs_env.fs_env_val = envp;
635 636 NDMP_SETENV(envp, "LOCAL", "y");
636 637 NDMP_SETENV(envp, "TYPE", fsip->fs_type);
637 638 NDMP_SETENV(envp, "AVAILABLE_BACKUP", "tar,dump");
638 639
639 640 if (FS_READONLY(fs) == 0) {
640 641 NDMP_SETENV(envp, "AVAILABLE_RECOVERY", "tar,dump");
641 642 }
642 643
643 644 fsip->fs_env.fs_env_len = envp - save;
644 645 len++;
645 646 fsip++;
646 647 }
647 648 (void) fclose(fp);
648 649
649 650 send_reply:
650 651 if (reply.error == NDMP_NO_ERR) {
651 652 reply.fs_info.fs_info_len = len;
652 653 reply.fs_info.fs_info_val = fsip_save;
653 654 }
654 655 ndmp_send_reply(connection, (void *)&reply,
655 656 "error sending ndmp_config_get_fs_info reply");
656 657
657 658 while (fsip > fsip_save) {
658 659 fsip--;
659 660 free(fsip->fs_logical_device);
660 661 free(fsip->fs_env.fs_env_val);
661 662 free(fsip->fs_type);
662 663 }
663 664
664 665 free(fsip);
665 666 }
666 667
667 668
668 669 /*
669 670 * ndmpd_config_get_tape_info_v3
670 671 *
671 672 * This handler handles the ndmp_config_get_tape_info_request.
672 673 * Information about all connected tape drives is returned.
673 674 *
674 675 * Parameters:
675 676 * connection (input) - connection handle.
676 677 * body (input) - request message body.
677 678 *
678 679 * Returns:
679 680 * void
680 681 */
681 682 /*ARGSUSED*/
682 683 void
683 684 ndmpd_config_get_tape_info_v3(ndmp_connection_t *connection, void *body)
684 685 {
685 686 ndmp_config_get_tape_info_reply_v3 reply;
686 687 ndmp_device_info_v3 *tip, *tip_save = NULL; /* tape info pointer */
687 688 ndmp_device_capability_v3 *dcp;
688 689 ndmp_device_capability_v3 *dcp_save = NULL; /* dev capability pointer */
689 690 int i, n, max;
690 691 sasd_drive_t *sd;
691 692 scsi_link_t *sl;
692 693 ndmp_pval *envp, *envp_save = NULL;
693 694 ndmp_pval *envp_head;
694 695
695 696 (void) memset((void*)&reply, 0, sizeof (reply));
696 697 max = sasd_dev_count();
697 698
698 699 tip_save = tip = ndmp_malloc(sizeof (ndmp_device_info_v3) * max);
699 700 dcp_save = dcp = ndmp_malloc(sizeof (ndmp_device_capability_v3) * max);
700 701 envp_save = envp = ndmp_malloc(sizeof (ndmp_pval) * max * 3);
701 702 if (!tip_save || !dcp_save || !envp_save) {
702 703 free(tip_save);
703 704 free(dcp_save);
704 705 free(envp_save);
705 706 reply.error = NDMP_NO_MEM_ERR;
706 707 ndmp_send_reply(connection, (void *)&reply,
707 708 "error sending ndmp_config_get_tape_info reply");
708 709 return;
709 710 }
710 711
711 712 reply.error = NDMP_NO_ERR;
712 713
713 714 for (i = n = 0; i < max; i++) {
|
↓ open down ↓ |
103 lines elided |
↑ open up ↑ |
714 715 if (!(sl = sasd_dev_slink(i)) || !(sd = sasd_drive(i)))
715 716 continue;
716 717 if (sl->sl_type != DTYPE_SEQUENTIAL)
717 718 continue;
718 719 /*
719 720 * Don't report dead links.
720 721 */
721 722 if ((access(sd->sd_name, F_OK) == -1) && (errno == ENOENT))
722 723 continue;
723 724
724 - NDMP_LOG(LOG_DEBUG,
725 + syslog(LOG_DEBUG,
725 726 "model \"%s\" dev \"%s\"", sd->sd_id, sd->sd_name);
726 727
727 728 envp_head = envp;
728 729 NDMP_SETENV(envp, "EXECUTE_CDB", "b");
729 730 NDMP_SETENV(envp, "SERIAL_NUMBER", sd->sd_serial);
730 731 NDMP_SETENV(envp, "WORLD_WIDE_NAME", sd->sd_wwn);
731 732
732 733 tip->model = sd->sd_id; /* like "DLT7000 " */
733 734 tip->caplist.caplist_len = 1;
734 735 tip->caplist.caplist_val = dcp;
735 736 dcp->device = sd->sd_name; /* like "isp1t060" */
736 737 dcp->attr = 0;
737 738 dcp->capability.capability_len = 3;
738 739 dcp->capability.capability_val = envp_head;
739 740 tip++;
740 741 dcp++;
741 742 n++;
742 743 }
743 744
744 - NDMP_LOG(LOG_DEBUG, "n %d", n);
745 -
746 745 /*
747 746 * We should not receive the get_tape_info when three-way backup is
748 747 * running and we are acting as just data, but some clients try
749 748 * to get the Tape information anyway.
750 749 */
751 750 if (n == 0 || max <= 0) {
752 751 reply.error = NDMP_NO_DEVICE_ERR;
753 752 ndmp_send_reply(connection, (void *)&reply,
754 753 "error sending ndmp_config_get_tape_info reply");
755 754 free(tip_save); free(dcp_save); free(envp_save);
756 755 return;
757 756 }
758 757
759 758
760 759 reply.tape_info.tape_info_len = n;
761 760 reply.tape_info.tape_info_val = tip_save;
762 761
763 762 ndmp_send_reply(connection, (void *)&reply,
764 763 "error sending ndmp_config_get_tape_info reply");
765 764
766 765 free(tip_save);
767 766 free(dcp_save);
768 767 free(envp_save);
769 768 }
770 769
771 770
772 771 /*
773 772 * ndmpd_config_get_scsi_info_v3
774 773 *
775 774 * This handler handles the ndmp_config_get_tape_scsi_request.
776 775 * Information about all connected scsi tape stacker and jukeboxes
777 776 * is returned.
778 777 *
779 778 * Parameters:
780 779 * connection (input) - connection handle.
781 780 * body (input) - request message body.
782 781 *
783 782 * Returns:
784 783 * void
785 784 */
786 785 /*ARGSUSED*/
787 786 void
788 787 ndmpd_config_get_scsi_info_v3(ndmp_connection_t *connection, void *body)
789 788 {
790 789 ndmp_config_get_scsi_info_reply_v3 reply;
791 790 ndmp_device_info_v3 *sip, *sip_save;
792 791 ndmp_device_capability_v3 *dcp, *dcp_save;
793 792 int i, n, max;
794 793 sasd_drive_t *sd;
795 794 scsi_link_t *sl;
796 795 ndmp_pval *envp, *envp_save = NULL;
797 796 ndmp_pval *envp_head;
798 797
799 798 (void) memset((void*)&reply, 0, sizeof (reply));
800 799 max = sasd_dev_count();
801 800 sip_save = sip = ndmp_malloc(sizeof (ndmp_device_info_v3) * max);
802 801 dcp_save = dcp = ndmp_malloc(sizeof (ndmp_device_capability_v3) * max);
803 802 envp_save = envp = ndmp_malloc(sizeof (ndmp_pval) * max * 2);
804 803 if (!sip_save || !dcp_save || !envp_save) {
805 804 free(sip_save);
806 805 free(dcp_save);
807 806 free(envp_save);
808 807 reply.error = NDMP_NO_MEM_ERR;
809 808 ndmp_send_reply(connection, (void *)&reply,
810 809 "error sending ndmp_config_get_scsi_info reply");
811 810 return;
812 811 }
813 812
814 813 reply.error = NDMP_NO_ERR;
815 814 for (i = n = 0; i < max; i++) {
|
↓ open down ↓ |
60 lines elided |
↑ open up ↑ |
816 815 if (!(sl = sasd_dev_slink(i)) || !(sd = sasd_drive(i)))
817 816 continue;
818 817 if (sl->sl_type != DTYPE_CHANGER)
819 818 continue;
820 819 /*
821 820 * Don't report dead links.
822 821 */
823 822 if ((access(sd->sd_name, F_OK) == -1) && (errno == ENOENT))
824 823 continue;
825 824
826 - NDMP_LOG(LOG_DEBUG,
825 + syslog(LOG_DEBUG,
827 826 "model \"%s\" dev \"%s\"", sd->sd_id, sd->sd_name);
828 827
829 828 envp_head = envp;
830 829 NDMP_SETENV(envp, "SERIAL_NUMBER", sd->sd_serial);
831 830 NDMP_SETENV(envp, "WORLD_WIDE_NAME", sd->sd_wwn);
832 831
833 832 sip->model = sd->sd_id; /* like "Powerstor L200 " */
834 833 sip->caplist.caplist_len = 1;
835 834 sip->caplist.caplist_val = dcp;
836 835 dcp->device = sd->sd_name; /* like "isp1m000" */
837 836
838 837 dcp->attr = 0;
839 838 dcp->capability.capability_len = 2;
840 839 dcp->capability.capability_val = envp_head;
841 840 sip++;
842 841 dcp++;
843 842 n++;
844 843 }
845 844
846 - NDMP_LOG(LOG_DEBUG, "n %d", n);
847 -
848 845 reply.scsi_info.scsi_info_len = n;
849 846 reply.scsi_info.scsi_info_val = sip_save;
850 847
851 848 ndmp_send_reply(connection, (void *)&reply,
852 849 "error sending ndmp_config_get_scsi_info reply");
853 850
854 851 free(sip_save);
855 852 free(dcp_save);
856 853 free(envp_save);
857 854 }
858 855
859 856
860 857 /*
861 858 * ndmpd_config_get_server_info_v3
862 859 *
863 860 * This handler handles the ndmp_config_get_server_info request.
864 861 * Host specific information is returned.
865 862 *
866 863 * Parameters:
867 864 * connection (input) - connection handle.
868 865 * body (input) - request message body.
869 866 *
870 867 * Returns:
|
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
871 868 * void
872 869 */
873 870 /*ARGSUSED*/
874 871 void
875 872 ndmpd_config_get_server_info_v3(ndmp_connection_t *connection, void *body)
876 873 {
877 874 ndmp_config_get_server_info_reply_v3 reply;
878 875 ndmp_auth_type auth_types[2];
879 876 char rev_number[10];
880 877 ndmpd_session_t *session = ndmp_get_client_data(connection);
878 + char *vendor;
879 + char *product;
881 880
882 881 (void) memset((void*)&reply, 0, sizeof (reply));
883 882 reply.error = NDMP_NO_ERR;
884 883
885 884 if (connection->conn_authorized ||
886 885 session->ns_protocol_version != NDMPV4) {
887 - reply.vendor_name = VENDOR_NAME;
888 - reply.product_name = PRODUCT_NAME;
886 + if ((vendor = ndmpd_get_prop(NDMP_VENDOR_NAME)) == NULL ||
887 + *vendor == 0) {
888 + reply.vendor_name = VENDOR_NAME;
889 + } else {
890 + reply.vendor_name = vendor;
891 + }
892 + if ((product = ndmpd_get_prop(NDMP_PRODUCT_NAME)) == NULL ||
893 + *product == 0) {
894 + reply.product_name = PRODUCT_NAME;
895 + } else {
896 + reply.product_name = product;
897 + }
889 898 (void) snprintf(rev_number, sizeof (rev_number), "%d",
890 899 ndmp_ver);
891 900 reply.revision_number = rev_number;
892 901 } else {
893 902 reply.vendor_name = "\0";
894 903 reply.product_name = "\0";
895 904 reply.revision_number = "\0";
896 905 }
897 906
898 - NDMP_LOG(LOG_DEBUG,
899 - "vendor \"%s\", product \"%s\" rev \"%s\"",
900 - reply.vendor_name, reply.product_name, reply.revision_number);
901 -
902 907 auth_types[0] = NDMP_AUTH_TEXT;
903 908 auth_types[1] = NDMP_AUTH_MD5;
904 909 reply.auth_type.auth_type_len = ARRAY_LEN(auth_types, ndmp_auth_type);
905 910 reply.auth_type.auth_type_val = auth_types;
906 911
907 912 ndmp_send_reply(connection, (void *)&reply,
908 913 "error sending ndmp_config_get_server_info reply");
909 914 }
910 915
911 916
912 917
913 918 /*
914 919 * ************************************************************************
915 920 * NDMP V4 HANDLERS
916 921 * ************************************************************************
917 922 */
918 923
919 924 /*
920 925 * ndmpd_config_get_butype_info_v4
921 926 *
922 927 * This handler handles the ndmp_config_get_butype_info_request.
923 928 * Information about all supported backup types are returned.
924 929 *
925 930 * Parameters:
926 931 * connection (input) - connection handle.
927 932 * body (input) - request message body.
928 933 *
929 934 * Returns:
930 935 * void
931 936 */
932 937 /*ARGSUSED*/
933 938 void
934 939 ndmpd_config_get_butype_info_v4(ndmp_connection_t *connection, void *body)
935 940 {
936 941 ndmp_config_get_butype_info_reply_v4 reply;
937 942 ndmp_butype_info info[3];
938 943
939 944 ndmp_pval envs[12];
940 945 ulong_t attrs;
941 946 ndmp_pval *envp = envs;
942 947
943 948 ndmp_pval zfs_envs[11];
944 949 ulong_t zfs_attrs;
945 950 ndmp_pval *zfs_envp = zfs_envs;
946 951
947 952
948 953 (void) memset((void*)&reply, 0, sizeof (reply));
949 954
950 955 /*
951 956 * Supported environment variables and their default values
952 957 * for dump and tar.
953 958 *
954 959 * The environment variables for dump and tar format are the
955 960 * same, because we use the same backup engine for both.
956 961 */
957 962 NDMP_SETENV(envp, "FILESYSTEM", "");
958 963 NDMP_SETENV(envp, "DIRECT", "n");
959 964 NDMP_SETENV(envp, "RECURSIVE", "n");
960 965 NDMP_SETENV(envp, "TYPE", "");
961 966 NDMP_SETENV(envp, "USER", "");
962 967 NDMP_SETENV(envp, "HIST", "n");
963 968 NDMP_SETENV(envp, "PATHNAME_SEPARATOR", "/");
964 969 NDMP_SETENV(envp, "LEVEL", "0");
965 970 NDMP_SETENV(envp, "EXTRACT", "y");
966 971 NDMP_SETENV(envp, "UPDATE", "y");
967 972 NDMP_SETENV(envp, "CMD", "");
968 973 NDMP_SETENV(envp, "BASE_DATE", "");
969 974
970 975 attrs = NDMP_BUTYPE_RECOVER_FILELIST |
971 976 NDMP_BUTYPE_BACKUP_DIRECT |
972 977 NDMP_BUTYPE_BACKUP_INCREMENTAL |
973 978 NDMP_BUTYPE_BACKUP_UTF8 |
974 979 NDMP_BUTYPE_RECOVER_UTF8 |
975 980 NDMP_BUTYPE_BACKUP_FH_FILE |
976 981 NDMP_BUTYPE_BACKUP_FH_DIR |
977 982 NDMP_BUTYPE_RECOVER_FH_FILE |
978 983 NDMP_BUTYPE_RECOVER_FH_DIR;
979 984
980 985 /* If DAR supported */
981 986 if (ndmp_dar_support)
982 987 attrs |= NDMP_BUTYPE_RECOVER_DIRECT;
983 988
984 989 /* tar backup type */
985 990 info[0].butype_name = "tar";
986 991 info[0].default_env.default_env_len = ARRAY_LEN(envs, ndmp_pval);
987 992 info[0].default_env.default_env_val = envs;
988 993 info[0].attrs = attrs;
989 994
990 995 /* dump backup type */
991 996 info[1].butype_name = "dump";
992 997 info[1].default_env.default_env_len = ARRAY_LEN(envs, ndmp_pval);
993 998 info[1].default_env.default_env_val = envs;
994 999 info[1].attrs = attrs;
995 1000
996 1001 /*
997 1002 * Supported environment variables and their default values
998 1003 * for type "zfs."
999 1004 */
1000 1005
1001 1006 NDMP_SETENV(zfs_envp, "USER", "");
1002 1007 NDMP_SETENV(zfs_envp, "CMD", "");
1003 1008 NDMP_SETENV(zfs_envp, "FILESYSTEM", "");
1004 1009 NDMP_SETENV(zfs_envp, "PATHNAME_SEPARATOR", "/");
1005 1010 NDMP_SETENV(zfs_envp, "TYPE", "zfs");
1006 1011 NDMP_SETENV(zfs_envp, "HIST", "n");
1007 1012 NDMP_SETENV(zfs_envp, "LEVEL", "0");
1008 1013 NDMP_SETENV(zfs_envp, "ZFS_MODE", "recursive");
1009 1014 NDMP_SETENV(zfs_envp, "ZFS_FORCE", "n");
1010 1015 NDMP_SETENV(zfs_envp, "UPDATE", "y");
1011 1016 NDMP_SETENV(zfs_envp, "DMP_NAME", "level");
1012 1017
1013 1018 zfs_attrs = NDMP_BUTYPE_BACKUP_UTF8 |
1014 1019 NDMP_BUTYPE_RECOVER_UTF8 |
1015 1020 NDMP_BUTYPE_BACKUP_DIRECT |
1016 1021 NDMP_BUTYPE_BACKUP_INCREMENTAL;
1017 1022
1018 1023 /* zfs backup type */
1019 1024 info[2].butype_name = "zfs";
1020 1025 info[2].default_env.default_env_len = ARRAY_LEN(zfs_envs, ndmp_pval);
1021 1026 info[2].default_env.default_env_val = zfs_envs;
1022 1027 info[2].attrs = zfs_attrs;
1023 1028
1024 1029 reply.error = NDMP_NO_ERR;
1025 1030 reply.butype_info.butype_info_len = ARRAY_LEN(info, ndmp_butype_info);
1026 1031 reply.butype_info.butype_info_val = info;
1027 1032
1028 1033 ndmp_send_reply(connection, (void *)&reply,
1029 1034 "sending ndmp_config_get_butype_info reply");
1030 1035 }
1031 1036
1032 1037
1033 1038 /*
1034 1039 * ndmpd_config_get_ext_list_v4
1035 1040 *
1036 1041 * This handler handles the ndmpd_config_get_ext_list_v4 request.
1037 1042 *
1038 1043 * Parameters:
1039 1044 * connection (input) - connection handle.
1040 1045 * body (input) - request message body.
1041 1046 *
1042 1047 * Returns:
1043 1048 * void
1044 1049 */
1045 1050 /*ARGSUSED*/
1046 1051 void
1047 1052 ndmpd_config_get_ext_list_v4(ndmp_connection_t *connection, void *body)
|
↓ open down ↓ |
136 lines elided |
↑ open up ↑ |
1048 1053 {
1049 1054 ndmp_config_get_ext_list_reply_v4 reply;
1050 1055 ndmpd_session_t *session = ndmp_get_client_data(connection);
1051 1056
1052 1057 (void) memset((void*)&reply, 0, sizeof (reply));
1053 1058
1054 1059 if (session->ns_set_ext_list) {
1055 1060 /*
1056 1061 * Illegal request if extensions have already been selected.
1057 1062 */
1058 - NDMP_LOG(LOG_ERR, "Extensions have already been selected.");
1063 + syslog(LOG_ERR, "Extensions have already been selected.");
1059 1064 reply.error = NDMP_EXT_DANDN_ILLEGAL_ERR;
1060 1065 } else {
1061 1066 /*
1062 1067 * Reply with an empty set of extensions.
1063 1068 */
1064 1069 session->ns_get_ext_list = B_TRUE;
1065 1070 reply.error = NDMP_NO_ERR;
1066 1071 }
1067 1072
1068 1073 reply.class_list.class_list_val = NULL;
1069 1074 reply.class_list.class_list_len = 0;
1070 1075
1071 1076 ndmp_send_reply(connection, (void *)&reply,
1072 1077 "error sending ndmp_config_get_ext_list reply");
1073 1078 }
1074 1079
1075 1080 /*
1076 1081 * ndmpd_config_set_ext_list_v4
1077 1082 *
1078 1083 * This handler handles the ndmpd_config_get_ext_list_v4 request.
1079 1084 *
1080 1085 * Parameters:
1081 1086 * connection (input) - connection handle.
1082 1087 * body (input) - request message body.
1083 1088 *
1084 1089 * Returns:
1085 1090 * void
1086 1091 */
1087 1092 void
1088 1093 ndmpd_config_set_ext_list_v4(ndmp_connection_t *connection, void *body)
1089 1094 {
1090 1095 ndmp_config_set_ext_list_reply_v4 reply;
1091 1096 ndmp_config_set_ext_list_request_v4 *request;
1092 1097 ndmpd_session_t *session = ndmp_get_client_data(connection);
|
↓ open down ↓ |
24 lines elided |
↑ open up ↑ |
1093 1098
1094 1099 request = (ndmp_config_set_ext_list_request_v4 *)body;
1095 1100
1096 1101 (void) memset((void*)&reply, 0, sizeof (reply));
1097 1102
1098 1103 if (!session->ns_get_ext_list) {
1099 1104 /*
1100 1105 * The DMA is required to issue a NDMP_GET_EXT_LIST request
1101 1106 * prior sending a NDMP_SET_EXT_LIST request.
1102 1107 */
1103 - NDMP_LOG(LOG_ERR, "No prior ndmp_config_get_ext_list issued.");
1108 + syslog(LOG_ERR, "No prior ndmp_config_get_ext_list issued.");
1104 1109 reply.error = NDMP_PRECONDITION_ERR;
1105 1110 } else if (session->ns_set_ext_list) {
1106 1111 /*
1107 1112 * Illegal request if extensions have already been selected.
1108 1113 */
1109 - NDMP_LOG(LOG_ERR, "Extensions have already been selected.");
1114 + syslog(LOG_ERR, "Extensions have already been selected.");
1110 1115 reply.error = NDMP_EXT_DANDN_ILLEGAL_ERR;
1111 1116 } else {
1112 1117 /*
1113 1118 * We currently do not support any extensions, but the DMA
1114 1119 * may test NDMP_CONFIG_SET_EXT_LIST with an empty list.
1115 1120 */
1116 1121 if (request->ndmp_selected_ext.ndmp_selected_ext_len != 0) {
1117 1122 reply.error = NDMP_CLASS_NOT_SUPPORTED_ERR;
1118 1123 } else {
1119 1124 session->ns_set_ext_list = B_TRUE;
1120 1125 reply.error = NDMP_NO_ERR;
1121 1126 }
1122 1127 }
1123 1128
1124 1129 ndmp_send_reply(connection, (void *)&reply,
1125 1130 "error sending ndmp_config_set_ext_list reply");
1126 1131 }
1127 1132
1128 1133
1129 1134
1130 1135 /*
1131 1136 * ************************************************************************
1132 1137 * LOCALS
1133 1138 * ************************************************************************
1134 1139 */
1135 1140
1136 1141 /*
1137 1142 * simple_get_attrs
1138 1143 *
1139 1144 * Set the default attrs for dump mode
1140 1145 *
1141 1146 * Parameters:
1142 1147 * attributes (output) - the attributes for dump mode
1143 1148 *
1144 1149 * Returns:
1145 1150 * void
1146 1151 */
1147 1152 static void
1148 1153 simple_get_attrs(ulong_t *attributes)
1149 1154 {
1150 1155 *attributes = NDMP_NO_RECOVER_FHINFO;
1151 1156 }
|
↓ open down ↓ |
32 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX