/usr/include/libstoragemgmt/libstoragemgmt_plug_interface.h is in libstoragemgmt-dev 1.2.3-1.
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 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 | /*
* Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*
* Author: tasleson
*/
#ifndef LIBSTORAGEMGMT_PLUG_INTERFACE_H
#define LIBSTORAGEMGMT_PLUG_INTERFACE_H
#include "libstoragemgmt_common.h"
#include "libstoragemgmt_accessgroups.h"
#include "libstoragemgmt_blockrange.h"
#include "libstoragemgmt_capabilities.h"
#include "libstoragemgmt_error.h"
#include "libstoragemgmt_fs.h"
#include "libstoragemgmt_nfsexport.h"
#include "libstoragemgmt_hash.h"
#include "libstoragemgmt_pool.h"
#include "libstoragemgmt_snapshot.h"
#include "libstoragemgmt_systems.h"
#include "libstoragemgmt_volumes.h"
#include "libstoragemgmt_disk.h"
#ifdef __cplusplus
extern "C" {
#endif
/** @file libstoragemgmt_plug_interface.h */
/** \enum lsm_data_type What type of data structure we have */
typedef enum {
LSM_DATA_TYPE_UNKNOWN = -1, /**< Unknown */
LSM_DATA_TYPE_NONE, /**< None */
LSM_DATA_TYPE_ACCESS_GROUP, /**< Access group */
LSM_DATA_TYPE_BLOCK_RANGE, /**< Block range */
LSM_DATA_TYPE_FS, /**< File system */
LSM_DATA_TYPE_NFS_EXPORT, /**< NFS export */
LSM_DATA_TYPE_POOL, /**< Pool */
LSM_DATA_TYPE_SS, /**< Snap shot */
LSM_DATA_TYPE_STRING_LIST, /**< String list */
LSM_DATA_TYPE_SYSTEM, /**< System */
LSM_DATA_TYPE_VOLUME, /**< Volume */
LSM_DATA_TYPE_DISK /**< Disk */
} lsm_data_type;
/**
* Opaque data type for plug-ins
*/
typedef struct _lsm_plugin lsm_plugin;
/**
* Typedef for pointer type
*/
typedef lsm_plugin *lsm_plugin_ptr;
/**
* Plug-in register callback function signature.
* @param c Valid lsm plugin pointer
* @param uri Connection URI
* @param password Plain text password
* @param timeout Plug-in timeout to array
* @param flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plugin_register) (lsm_plugin_ptr c, const char *uri,
const char *password,
uint32_t timeout, lsm_flag flags);
/**
* Plug-in unregister callback function signature
* @param c Valid lsm plugin pointer
* @param flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plugin_unregister) (lsm_plugin_ptr c, lsm_flag flags);
/**
* Set plug-in time-out value callback function signature
* @param c Valid lsm plug-in pointer
* @param timeout timeout value in milliseconds
* @param flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_tmo_set) (lsm_plugin_ptr c, uint32_t timeout,
lsm_flag flags);
/**
* Get the plug-in time-out value callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[out] timeout Time-out value
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_tmo_get) (lsm_plugin_ptr c, uint32_t *timeout,
lsm_flag flags);
/**
* Retrieve the plug-in capabilities callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] sys System to interrogate
* @param[out] cap Capabilities
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_capabilities) (lsm_plugin_ptr c,
lsm_system *sys,
lsm_storage_capabilities **cap,
lsm_flag flags);
/**
* Retrieve the job status callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] job Job identifier
* @param[out] status Enumerated value representing status
* @param[out] percent_complete How far completed
* @param[out] type Type of result
* @param[out] value Value of result
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_Job_status) (lsm_plugin_ptr c, const char *job,
lsm_job_status *status,
uint8_t *percent_complete,
lsm_data_type *type, void **value,
lsm_flag flags);
/**
* Instructs the plug-in to release the memory for the specified job id,
* callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] job_id Job ID to free memory for
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_job_free) (lsm_plugin_ptr c, char *job_id,
lsm_flag flags);
/**
* Retrieves a list of pools callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] search_key Search key
* @param[in] search_value Search value
* @param[out] pool_array List of pools
* @param[out] count Number of items in array
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_pool_list) (lsm_plugin_ptr c,
const char *search_key,
const char *search_value,
lsm_pool **pool_array[],
uint32_t *count, lsm_flag flags);
/**
* Retrieve a list of systems, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[out] systems List of systems
* @param[out] system_count Number of systems
* @param[out] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_system_list) (lsm_plugin_ptr c,
lsm_system **systems[],
uint32_t *system_count,
lsm_flag flags);
/** \struct lsm_mgmt_ops_v1
* \brief Callback functions for management operations */
struct lsm_mgmt_ops_v1 {
lsm_plug_tmo_set tmo_set; /**< tmo set callback */
lsm_plug_tmo_get tmo_get; /**< tmo get callback */
lsm_plug_capabilities capablities; /**< capabilities callback */
lsm_plug_Job_status job_status; /**< status of job */
lsm_plug_job_free job_free; /**< Free a job */
lsm_plug_pool_list pool_list; /**< List of pools */
lsm_plug_system_list system_list; /**< List of systems */
};
/**
* Retrieve a list of volumes.
* @param[in] c Valid lsm plug-in pointer
* @param[in] search_key Search key
* @param[in] search_value Search value
* @param[out] vol_array Array of volumes
* @param[out] count Number of volumes
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_volume_list) (lsm_plugin_ptr c,
const char *search_key,
const char *search_val,
lsm_volume **vol_array[],
uint32_t *count, lsm_flag flags);
/**
* Retrieve a list of volumes.
* @param[in] c Valid lsm plug-in pointer
* @param[in] search_key Search key
* @param[in] search_value Search value
* @param[out] disk_array Array of disk pointers
* @param[out] count Number of disks
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_disk_list) (lsm_plugin_ptr c,
const char *search_key,
const char *search_value,
lsm_disk **disk_array[],
uint32_t *count, lsm_flag flags);
/**
* Retrieve a list of target ports.
* @param[in] c Valid lsm plugin-in pointer
* @param[in] search_key Search key
* @param[in] search_value Search value
* @param[out] target_port_array Array of target port pointers
* @param[out] count Number of target ports
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_target_port_list)
(lsm_plugin_ptr c, const char *search_key, const char *search_value,
lsm_target_port **target_port_array[], uint32_t *count, lsm_flag flags);
/**
* Creates a volume, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] pool Pool to allocated storage from
* @param[in] volume_name Name of new volume
* @param[in] size Size of volume in bytes
* @param[in] provisioning How provisioned
* @param[out] new_volume Information on newly created volume
* @param[out] job Job ID
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_volume_create) (lsm_plugin_ptr c,
lsm_pool *pool,
const char *volume_name,
uint64_t size,
lsm_volume_provision_type provisioning,
lsm_volume **new_volume,
char **job, lsm_flag flags);
/**
* Volume replicate, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] pool Pool to allocated replicant from (optional)
* @param[in] rep_type Replication type
* @param[in] volume_src Source of the replication
* @param[in] name Name of newly replicated volume
* @param[out] new_replicant Newly replicated volume
* @param job
* @param flags
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_volume_replicate) (lsm_plugin_ptr c,
lsm_pool *pool,
lsm_replication_type rep_type,
lsm_volume *volume_src,
const char *name,
lsm_volume **new_replicant,
char **job, lsm_flag flags);
/**
* Return the block size of a replicated block range.
* @param[in] c Valid lsm plug-in pointer
* @param[in] system System to query against
* @param[out] bs Block size
* @param[out] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_volume_replicate_range_block_size)
(lsm_plugin_ptr c, lsm_system * system, uint32_t *bs, lsm_flag flags);
/**
* Replicate a range of a volume to the same volume or different volume.
* @param[in] c Valid lsm plug-in pointer
* @param[in] rep_type What type of replication
* @param[in] source Source of the replication
* @param[in] dest Destination of the replication, can be
* same as source
* @param[in] ranges An array of ranges
* @param[in] num_ranges Number of items in array
* @param[out] job Job ID
* @param flags
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_volume_replicate_range) (lsm_plugin_ptr c,
lsm_replication_type rep_type,
lsm_volume *source,
lsm_volume *dest,
lsm_block_range **ranges,
uint32_t num_ranges,
char **job, lsm_flag flags);
/**
* Re-size a volume, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] volume Volume to be re-sized
* @param[in] new_size New size of volume in bytes
* @param[in] resized_volume Information about newly re-sized volume
* @param[out] job The job ID
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_volume_resize) (lsm_plugin_ptr c,
lsm_volume *volume,
uint64_t new_size,
lsm_volume **resized_volume,
char **job, lsm_flag flags);
/**
* Delete a volume, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] volume Volume to be deleted
* @param[out] job Job ID
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_volume_delete) (lsm_plugin_ptr c,
lsm_volume *volume, char **job,
lsm_flag flags);
/**
* Place a volume online, callback function signature.
* @param[in] c Valid lsm plug-in pointer
* @param[in] v Volume to place online
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_volume_enable) (lsm_plugin_ptr c,
lsm_volume *v, lsm_flag flags);
/**
* Take a volume offline, callback function signature.
* @param[in] c Valid lsm plug-in pointer
* @param v
* @param flags
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_volume_disable) (lsm_plugin_ptr c,
lsm_volume *v, lsm_flag flags);
/**
* Setup the cap authentication for the specified initiator, callback
* function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] init_id Initiator to set chap authentication for
* @param[in] in_user CHAP inbound username
* @param[in] in_password CHAP inbound password
* @param[in] out_user CHAP outbound user name
* @param[in] out_password CHAP outbound user name
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_iscsi_chap_auth) (lsm_plugin_ptr c,
const char *init_id,
const char *in_user,
const char *in_password,
const char *out_user,
const char *out_password,
lsm_flag flags);
/**
* Retrieve a list of access groups, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] search_key Field to search on
* @param[in] search_value Field value
* @param[out] groups Array of groups
* @param[out] group_count Number of groups
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_access_group_list) (lsm_plugin_ptr c,
const char *search_key,
const char *search_value,
lsm_access_group **groups[],
uint32_t *group_count,
lsm_flag flags);
/**
* Creates an access group, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] name Name of access group
* @param[in] initiator_id Initiator to be added to group
* @param[in] id_type Initiator type
* @param[in] system System to create group for
* @param[out] access_group Newly created access group
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_access_group_create)
(lsm_plugin_ptr c, const char *name, const char *initiator_id,
lsm_access_group_init_type init_type, lsm_system *system,
lsm_access_group **access_group, lsm_flag flags);
/**
* Deletes an access group, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] group Access group to be deleted
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_access_group_delete) (lsm_plugin_ptr c,
lsm_access_group *group,
lsm_flag flags);
/**
* Add an initiator to an access group, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] access_group Group to add initiator to
* @param[in] initiator_id Initiator to add to group
* @param[in] id_type Initiator type
* @param[out] updated_access_group Updated access group
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_access_group_initiator_add)
(lsm_plugin_ptr c, lsm_access_group *access_group,
const char *initiator_id, lsm_access_group_init_type id_type,
lsm_access_group **updated_access_group, lsm_flag flags);
/**
* Remove an initiator from an access group, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] access_group Group to remove initiator from
* @param[in] initiator_id Initiator to remove
* @param[in] id_type Initiator type
* @param[out] updated_access_group Updated access group
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_access_group_initiator_delete)
(lsm_plugin_ptr c, lsm_access_group *access_group,
const char *initiator_id, lsm_access_group_init_type id_type,
lsm_access_group **updated_access_group, lsm_flag flags);
/**
* Grants access to a volume for the specified access group, callback function
* signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] group Group to be granted access
* @param[in] volume Volume to be given access too
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_volume_mask) (lsm_plugin_ptr c,
lsm_access_group *group,
lsm_volume *volume, lsm_flag flags);
/**
* Revokes access to a volume for a specified access group, callback function
* signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] group Group to revoke access for
* @param[in] volume Volume to which will no longer be
* accessible by group
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_volume_unmask) (lsm_plugin_ptr c,
lsm_access_group * group,
lsm_volume *volume, lsm_flag flags);
/**
* Retrieve an array of volumes which are accessible by access group, callback
* function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] group Group to find volumes for
* @param[out] volumes Array of volumes
* @param[out] count Number of volumes
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_volumes_accessible_by_access_group)
(lsm_plugin_ptr c, lsm_access_group *group, lsm_volume **volumes[],
uint32_t *count, lsm_flag flags);
/**
* Retrieve a list of access groups that have access to the specified volume,
* callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] volume Volume to query
* @param[out] groups Array of access groups
* @param[out] group_count Number of access groups
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_access_groups_granted_to_volume)
(lsm_plugin_ptr c, lsm_volume *volume, lsm_access_group **groups[],
uint32_t *group_count, lsm_flag flags);
/**
* Determine if a volume has child dependencies, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] volume Volume to query
* @param[out] yes Boolean
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_volume_child_dependency)
(lsm_plugin_ptr c, lsm_volume *volume, uint8_t *yes, lsm_flag flags);
/**
* Remove dependencies from a volume, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] volume Volume to remove dependency for
* @param[out] job Job ID
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_volume_child_dependency_delete)
(lsm_plugin_ptr c, lsm_volume *volume, char **job, lsm_flag flags);
/**
* File system list, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] search_key Search key
* @param[in] search_value Search value
* @param[out] fs An array of file systems
* @param[out] fs_count Number of file systems
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_fs_list) (lsm_plugin_ptr c,
const char *search_key,
const char *search_value,
lsm_fs **fs[], uint32_t *fs_count,
lsm_flag flags);
/**
* Create a file system, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] pool Pool to create file system from
* @param[in] name Name of file system
* @param[in] size_bytes Size of the file system in bytes
* @param[out] fs Newly created file system
* @param[out] job Job ID
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_fs_create) (lsm_plugin_ptr c, lsm_pool *pool,
const char *name,
uint64_t size_bytes, lsm_fs **fs,
char **job, lsm_flag flags);
/**
* Delete a file system, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] fs File system to delete
* @param[out] job Job ID
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_fs_delete) (lsm_plugin_ptr c, lsm_fs *fs,
char **job, lsm_flag flags);
/**
* Clone a file system, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] dest_fs_name Clone fs name
* @param[out] cloned_fs New clone
* @param[in] optional_snapshot Basis of clone
* @param[out] job Job ID
* @param[in] flags reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_fs_clone) (lsm_plugin_ptr c, lsm_fs *src_fs,
const char *dest_fs_name,
lsm_fs **cloned_fs,
lsm_fs_ss *optional_snapshot,
char **job, lsm_flag flags);
/**
* Determine if a file system has child dependencies, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] fs File system to check
* @param[in] files Specific files to check
* @param[out] yes Boolean
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_fs_child_dependency) (lsm_plugin_ptr c,
lsm_fs *fs,
lsm_string_list *files,
uint8_t *yes);
/**
* Remove dependencies from a file system, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] fs File system to remove dependencies for
* @param[in] files Specific files to remove dependencies for
* @param[out] job Job ID
* @param[out] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_fs_child_dependency_delete) (lsm_plugin_ptr c,
lsm_fs *fs,
lsm_string_list * files,
char **job,
lsm_flag flags);
/**
* Re-size a file system, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] fs File system to re-size
* @param[in] new_size_bytes New size of file system
* @param[out] rfs Re-sized file system
* @param[out] job Job ID
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_fs_resize) (lsm_plugin_ptr c, lsm_fs *fs,
uint64_t new_size_bytes,
lsm_fs ** rfs, char **job,
lsm_flag flags);
/**
* Clone an individual file on a file system, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] fs File system which contains the file to clone
* @param[in] src_file_name Source file name and path
* @param[in] dest_file_name Destination file and path
* @param[in] snapshot Optional backing snapshot
* @param[out] job Job ID
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_fs_file_clone) (lsm_plugin_ptr c, lsm_fs *fs,
const char *src_file_name,
const char *dest_file_name,
lsm_fs_ss *snapshot,
char **job, lsm_flag flags);
/**
* Retrieve a list of fs snapshots for a file system, callback function
* signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] fs File system
* @param[out] ss Array of snap shots
* @param[out] ss_count Count of snapshots
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_fs_ss_list) (lsm_plugin_ptr c, lsm_fs *fs,
lsm_fs_ss **ss[],
uint32_t *ss_count, lsm_flag flags);
/**
* Create a fs snapshot of the specified file system and optionally constrain
* it to a list of files, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] fs File system to create snapshot for
* @param[in] name Snap shot name
* @param[out] snapshot Newly created snapshot
* @param[out] job Job ID
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_fs_ss_create) (lsm_plugin_ptr c, lsm_fs *fs,
const char *name,
lsm_fs_ss **snapshot,
char **job, lsm_flag flags);
/**
* Delete a fs snapshot, callback function signature, callback function
* signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] fs File system to delete snapshot for
* @param[in] ss Snapshot to delete
* @param[out] job Job ID
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_fs_ss_delete) (lsm_plugin_ptr c, lsm_fs *fs,
lsm_fs_ss *ss, char **job,
lsm_flag flags);
/**
* Revert the state of a file system or specific files to a previous state,
* callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] fs File system of interest
* @param[in] files Optional list of files
* @param[in] restore_files Optional path and name of restored files
* @param[in] all_files boolean to indicate all files should be
* restored
* @param[out] job Job ID
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_fs_ss_restore) (lsm_plugin_ptr c, lsm_fs *fs,
lsm_fs_ss *ss,
lsm_string_list *files,
lsm_string_list *restore_files,
int all_files, char **job,
lsm_flag flags);
/**
* Get a list of NFS client authentication types, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[out] types List of authtication types
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_nfs_auth_types) (lsm_plugin_ptr c,
lsm_string_list **types,
lsm_flag flags);
/**
* Retrieve a list of NFS exports, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] search_key Search key
* @param[in] search_value Search value
* @param[out] exports An array of exported file systems
* @param[out] count Number of exported file systems
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_nfs_list) (lsm_plugin_ptr c,
const char *search_key,
const char *search_value,
lsm_nfs_export **exports[],
uint32_t *count, lsm_flag flags);
/**
* Exports a file system via NFS, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] fs_id File system id to export
* @param[in] export_path NFS export path
* @param[in] root_list List of servers with root access
* @param[in] rw_list List of servers with read/write access
* @param[in] ro_list List of servers with read only access
* @param[in] anon_uid UID to be mapped to anonymous
* @param[in] anon_gid GID to be mapped to anonymous
* @param[in] auth_type Client authentication type
* @param[in] options Options
* @param[out] exported Newly created export
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_nfs_export_fs) (lsm_plugin_ptr c,
const char *fs_id,
const char *export_path,
lsm_string_list *root_list,
lsm_string_list *rw_list,
lsm_string_list *ro_list,
uint64_t anon_uid,
uint64_t anon_gid,
const char *auth_type,
const char *options,
lsm_nfs_export **exported,
lsm_flag flags);
/**
* Removes a NFS export, callback function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] e Export to remove
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_nfs_export_remove) (lsm_plugin_ptr c,
lsm_nfs_export *e,
lsm_flag flags);
/** \struct lsm_san_ops_v1
* \brief Block array oriented functions (callback functions)
* NOTE: This structure cannot change as we need to maintain backwards
* compatibility
*/
struct lsm_san_ops_v1 {
lsm_plug_volume_list vol_get;
/**^ retrieving volumes */
lsm_plug_disk_list disk_get;
/**^ retrieve disks */
lsm_plug_volume_create vol_create;
/**^ creating a lun */
lsm_plug_volume_replicate vol_replicate;
/**^ replicating lun */
lsm_plug_volume_replicate_range_block_size vol_rep_range_bs;
/**^ volume replication range block size */
lsm_plug_volume_replicate_range vol_rep_range;
/**^ volume replication range */
lsm_plug_volume_resize vol_resize;
/**^ resizing a volume */
lsm_plug_volume_delete vol_delete;
/**^ deleting a volume */
lsm_plug_volume_enable vol_enable;
/**^ volume is accessible */
lsm_plug_volume_disable vol_disable;
/**^ volume is unaccessible */
lsm_plug_iscsi_chap_auth iscsi_chap_auth;
/**^ iscsi chap authentication */
lsm_plug_access_group_list ag_list;
/**^ access groups */
lsm_plug_access_group_create ag_create;
/**^ access group create */
lsm_plug_access_group_delete ag_delete;
/**^ access group delete */
lsm_plug_access_group_initiator_add ag_add_initiator;
/**^ adding an initiator to an access group */
lsm_plug_access_group_initiator_delete ag_del_initiator;
/**^ deleting an initiator from an access group */
lsm_plug_volume_mask ag_grant;
/**^ acess group grant */
lsm_plug_volume_unmask ag_revoke;
/**^ access group revoke */
lsm_plug_volumes_accessible_by_access_group vol_accessible_by_ag;
/**^ volumes accessible by access group */
lsm_plug_access_groups_granted_to_volume ag_granted_to_vol;
/**^ access groups granted to a volume */
lsm_plug_volume_child_dependency vol_child_depends;
/**^ volume child dependencies */
lsm_plug_volume_child_dependency_delete vol_child_depends_rm;
/**^Callback to remove volume child dependencies */
lsm_plug_target_port_list target_port_list;
/**^ Callback to get list of target ports */
};
/** \struct lsm_fs_ops_v1
* \brief File system oriented functionality
* NOTE: This structure cannot change as we need to maintain backwards
* compatibility
*/
struct lsm_fs_ops_v1 {
lsm_plug_fs_list fs_list;
/**^ list file systems */
lsm_plug_fs_create fs_create;
/**^ create a file system */
lsm_plug_fs_delete fs_delete;
/**^ delete a file system */
lsm_plug_fs_resize fs_resize;
/**^ resize a file system */
lsm_plug_fs_clone fs_clone;
/**^ clone a file system */
lsm_plug_fs_file_clone fs_file_clone;
/**^ clone files on a file system */
lsm_plug_fs_child_dependency fs_child_dependency;
/**^ check file system child dependencies */
lsm_plug_fs_child_dependency_delete fs_child_dependency_rm;
/**^ remove file system child dependencies */
lsm_plug_fs_ss_list fs_ss_list;
/**^ list snapshots */
lsm_plug_fs_ss_create fs_ss_create;
/**^ create a snapshot */
lsm_plug_fs_ss_delete fs_ss_delete;
/**^ delete a snapshot */
lsm_plug_fs_ss_restore fs_ss_restore;
/**^ restore a snapshot */
};
/** \struct lsm_nas_ops_v1
* \brief NAS system oriented functionality call back functions
* NOTE: This structure cannot change as we need to maintain backwards
* compatibility
*/
struct lsm_nas_ops_v1 {
lsm_plug_nfs_auth_types nfs_auth_types;
/**^ List nfs authentication types */
lsm_plug_nfs_list nfs_list;
/**^ List nfs exports */
lsm_plug_nfs_export_fs nfs_export;
/**^ Export a file system */
lsm_plug_nfs_export_remove nfs_export_remove;
/**^ Remove a file export */
};
/**
* Query the RAID information of a volume
* @param[in] c Valid lsm plug-in pointer
* @param[in] volume Volume to be deleted
* @param[out] raid_type Enum of lsm_volume_raid_type
* @param[out] strip_size Size of the strip on each disk or other
* storage extent.
* @param[out] disk_count Count of of disks of RAID group(s) where this
* volume allocated from.
* @param[out] min_io_size Minimum I/O size, also the preferred I/O size
* of random I/O.
* @param[out] opt_io_size Optimal I/O size, also the preferred I/O size
* of sequential I/O.
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
typedef int (*lsm_plug_volume_raid_info) (lsm_plugin_ptr c,
lsm_volume *volume,
lsm_volume_raid_type *raid_type,
uint32_t *strip_size,
uint32_t *disk_count,
uint32_t *min_io_size,
uint32_t *opt_io_size,
lsm_flag flags);
/**
* Retrieves the membership of given pool. New in version 1.2.
* @param[in] c Valid lsm plug-in pointer
* @param[in] pool The lsm_pool ptr.
* @param[out] raid_type
* Enum of lsm_volume_raid_type.
* @param[out] member_type
* Enum of lsm_pool_member_type.
* @param[out] member_ids
* The pointer of lsm_string_list pointer.
* When 'member_type' is LSM_POOL_MEMBER_TYPE_POOL,
* the 'member_ids' will contain a list of parent Pool
* IDs.
* When 'member_type' is LSM_POOL_MEMBER_TYPE_DISK,
* the 'member_ids' will contain a list of disk IDs.
* When 'member_type' is LSM_POOL_MEMBER_TYPE_OTHER or
* LSM_POOL_MEMBER_TYPE_UNKNOWN, the member_ids should
* be NULL.
* @param[in] flags Reserved, set to 0
* @return LSM_ERR_OK on success else error reason.
*/
typedef int (*lsm_plug_pool_member_info) (lsm_plugin_ptr c, lsm_pool *pool,
lsm_volume_raid_type *raid_type,
lsm_pool_member_type *member_type,
lsm_string_list **member_ids,
lsm_flag flags);
/**
* Query all supported RAID types and strip sizes which could be used
* in lsm_volume_raid_create() functions.
* New in version 1.2, only available for hardware RAID cards.
* @param[in] c Valid lsm plug-in pointer
* @param[in] system
* The lsm_sys type.
* @param[out] supported_raid_types
* The pointer of uint32_t array. Containing
* lsm_volume_raid_type values.
* @param[out] supported_raid_type_count
* The pointer of uint32_t. Indicate the item count of
* supported_raid_types array.
* @param[out] supported_strip_sizes
* The pointer of uint32_t array. Containing
* all supported strip sizes.
* @param[out] supported_strip_size_count
* The pointer of uint32_t. Indicate the item count of
* supported_strip_sizes array.
* @param[in] flags Reserved, set to 0
* @return LSM_ERR_OK on success else error reason.
*/
typedef int (*lsm_plug_volume_raid_create_cap_get)
(lsm_plugin_ptr c, lsm_system *system, uint32_t **supported_raid_types,
uint32_t *supported_raid_type_count, uint32_t **supported_strip_sizes,
uint32_t *supported_strip_size_count, lsm_flag flags);
/**
* Create a disk RAID pool and allocate entire full space to new volume.
* New in version 1.2, only available for hardware RAID cards.
* @param[in] c Valid lsm plug-in pointer
* @param[in] name String. Name for the new volume. It might be ignored or
* altered on some hardwardware raid cards in order to fit
* their limitation.
* @param[in] raid_type
* Enum of lsm_volume_raid_type.
* @param[in] disks
* An array of lsm_disk types
* @param[in] disk_count
* The count of lsm_disk in 'disks' argument.
* @param[in] strip_size
* uint32_t. The strip size in bytes.
* @param[out] new_volume
* Newly created volume, Pointer to the lsm_volume type
* pointer.
* @param[in] flags Reserved, set to 0
* @return LSM_ERR_OK on success else error reason.
*/
typedef int (*lsm_plug_volume_raid_create) (lsm_plugin_ptr c,
const char *name,
lsm_volume_raid_type raid_type,
lsm_disk * disks[],
uint32_t disk_count,
uint32_t strip_size,
lsm_volume ** new_volume,
lsm_flag flags);
/** \struct lsm_ops_v1_2
* \brief Functions added in version 1.2
* NOTE: This structure will change during the developement util version 1.2
* released.
*/
struct lsm_ops_v1_2 {
lsm_plug_volume_raid_info vol_raid_info;
/**^ Query volume RAID information*/
lsm_plug_pool_member_info pool_member_info;
lsm_plug_volume_raid_create_cap_get vol_create_raid_cap_get;
lsm_plug_volume_raid_create vol_create_raid;
};
/**
* Copies the memory pointed to by item with given type t.
* @param t Type of item to copy
* @param item Pointer to src
* @return Null, else copy of item.
*/
void LSM_DLL_EXPORT *lsm_data_type_copy(lsm_data_type t, void *item);
/**
* Initializes the plug-in.
* @param argc Command line argument count
* @param argv Command line arguments
* @param reg Registration function
* @param unreg Un-Registration function
* @param desc Plug-in description
* @param version Plug-in version
* @return exit code for plug-in
*/
int LSM_DLL_EXPORT lsm_plugin_init_v1(int argc, char *argv[],
lsm_plugin_register reg,
lsm_plugin_unregister unreg,
const char *desc,
const char *version);
/**
* Used to register all the data needed for the plug-in operation.
* @param plug Pointer provided by the framework
* @param private_data Private data to be used for whatever the plug-in needs
* @param mgm_ops Function pointers for management operations
* @param san_ops Function pointers for SAN operations
* @param fs_ops Function pointers for file system operations
* @param nas_ops Function pointers for NAS operations
* @return LSM_ERR_OK on success, else error reason.
*/
int LSM_DLL_EXPORT lsm_register_plugin_v1(lsm_plugin_ptr plug,
void *private_data,
struct lsm_mgmt_ops_v1 *mgm_ops,
struct lsm_san_ops_v1 *san_ops,
struct lsm_fs_ops_v1 *fs_ops,
struct lsm_nas_ops_v1 *nas_ops);
/**
* Used to register version 1.2 APIs plug-in operation.
* @param plug Pointer provided by the framework
* @param private_data Private data to be used for whatever the plug-in
* needs
* @param mgm_ops Function pointers for struct lsm_mgmt_ops_v1
* @param san_ops Function pointers for struct lsm_san_ops_v1
* @param fs_ops Function pointers for struct lsm_fs_ops_v1
* @param nas_ops Function pointers for struct lsm_nas_ops_v1
* @param ops_v1_2 Function pointers for struct lsm_ops_v1_2
* @return LSM_ERR_OK on success, else error reason.
*/
int LSM_DLL_EXPORT lsm_register_plugin_v1_2(lsm_plugin_ptr plug,
void *private_data,
struct lsm_mgmt_ops_v1 *mgm_ops,
struct lsm_san_ops_v1 *san_ops,
struct lsm_fs_ops_v1 *fs_ops,
struct lsm_nas_ops_v1 *nas_ops,
struct lsm_ops_v1_2 *ops_v1_2);
/**
* Used to retrieve private data for plug-in operation.
* @param plug Opaque plug-in pointer.
*/
void LSM_DLL_EXPORT *lsm_private_data_get(lsm_plugin_ptr plug);
/**
* Logs an error with the plug-in
* @param plug Plug-in pointer
* @param code Error code to return
* @param msg String message
* @return returns code
*/
int LSM_DLL_EXPORT lsm_log_error_basic(lsm_plugin_ptr plug,
lsm_error_number code,
const char *msg);
/**
* Return an error with the plug-in
* @param plug Opaque plug-in
* @param error Error to associate.
* @return LSM_ERR_OK, else error reason.
*/
int LSM_DLL_EXPORT lsm_plugin_error_log(lsm_plugin_ptr plug,
lsm_error_ptr error);
/**
* Creates an error record.
* @param code
* @param msg
* @param exception
* @param debug
* @param debug_data
* @param debug_data_size
* @return Null on error, else valid error error record.
*/
lsm_error_ptr LSM_DLL_EXPORT lsm_error_create(lsm_error_number code,
const char *msg,
const char *exception,
const char *debug,
const void *debug_data,
uint32_t debug_data_size);
/**
* Plug-in macros for creating errors
*/
#define LSM_ERROR_CREATE_PLUGIN_MSG(code, msg) \
lsm_error_create(code, msg, NULL, NULL, NULL, 0)
#define LSM_ERROR_CREATE_PLUGIN_EXCEPTION(code, msg, exception) \
lsm_error_create((code), (msg), (exception), NULL, NULL, 0)
#define LSM_ERROR_CREATE_PLUGIN_DEBUG(code, msg, exception, debug, \
debug_data, debug_len) \
lsm_error_create((code), (msg), (exception), (debug), \
(debug_data), debug_len)
/**
* Helper function to create an array of lsm_pool *
* @param size Number of elements
* @return Valid pointer or NULL on error.
*/
lsm_pool LSM_DLL_EXPORT **lsm_pool_record_array_alloc(uint32_t size);
/**
* Used to set the free space on a pool record
* @param p Pool to modify
* @param free_space New free space value
*/
void LSM_DLL_EXPORT lsm_pool_free_space_set(lsm_pool *p,
uint64_t free_space);
/**
* Helper function to allocate a pool record.
* @param id System unique identifier
* @param name Human readable name
* @param element_type A bit field which states what the pool can be used to
* create
* @param unsupported_actions Things you cannot do with this pool
* @param total_space Total space
* @param free_space Space available
* @param status Pool status, bit field (See LSM_POOL_STATUS_XXXX
* constants)
* @param status_info Additional textual information on status
* @param system_id System id
* @param plugin_data Reserved for plugin writer use
* @return LSM_ERR_OK on success, else error reason.
*/
lsm_pool LSM_DLL_EXPORT *lsm_pool_record_alloc(const char *id,
const char *name,
uint64_t element_type,
uint64_t unsupported_actions,
uint64_t total_space,
uint64_t free_space,
uint64_t status,
const char *status_info,
const char *system_id,
const char *plugin_data);
/**
* Used to retrieve the plugin-private data for a specfic pool
* @param p Pool to retrieve plugin private data for
* @return NULL if donesn't exists, else data.
*/
const char LSM_DLL_EXPORT *lsm_pool_plugin_data_get(lsm_pool *p);
/**
* Allocate the storage needed for and array of Volume records.
* @param size Number of elements.
* @return Allocated memory or NULL on error.
*/
lsm_volume LSM_DLL_EXPORT **lsm_volume_record_array_alloc(uint32_t size);
/**
* Allocate the storage needed for tan array of disk records.
* @param size Number of elements
* @return Allocated memory or null on error.
*/
lsm_disk LSM_DLL_EXPORT **lsm_disk_record_array_alloc(uint32_t size);
/**
* Allocate a disk record.
* @param id Identification
* @param name Human readable name
* @param disk_type Enumerated disk type
* @param block_size Number of bytes per logical block
* @param block_count Number of blocks for disk
* @param disk_status Status
* @param system_id System id this disk resides in
* @return Pointer to allocated disk record or NULL on memory error.
*/
lsm_disk LSM_DLL_EXPORT *lsm_disk_record_alloc(const char *id,
const char *name,
lsm_disk_type disk_type,
uint64_t block_size,
uint64_t block_count,
uint64_t disk_status,
const char *system_id);
/**
* Allocated the storage needed for one volume record.
* @param id ID
* @param name Name
* @param vpd83 SCSI vpd 83 id
* @param block_size Volume block size
* @param number_of_blocks Volume number of blocks
* @param status Volume status
* @param system_id System id
* @param pool_id Pool id this volume is created from
* @param plugin_data Private data for plugin use
* @return Allocated memory or NULL on error.
*/
lsm_volume LSM_DLL_EXPORT *lsm_volume_record_alloc(const char *id,
const char *name,
const char *vpd83,
uint64_t block_size,
uint64_t number_of_blocks,
uint32_t status,
const char *system_id,
const char *pool_id,
const char *plugin_data);
/**
* Retrieve the private plug-in data from the volume record.
* @param v Volume pointer
* @return Private data, else NULL if it doesn't exist.
*/
const char LSM_DLL_EXPORT *lsm_volume_plugin_data_get(lsm_volume *v);
/**
* Allocate the storage needed for and array of System records.
* @param size Number of elements.
* @return Allocated memory or NULL on error.
*/
lsm_system LSM_DLL_EXPORT **lsm_system_record_array_alloc(uint32_t size);
/**
* Allocates the storage for one system record.
* @param[in] id Id
* @param[in] name System name (human readable)
* @param[in] status Status of the system
* @param[in] status_info Additional text for status
* @param[in] plugin_data Private plugin data
* @return Allocated memory or NULL on error.
*/
lsm_system LSM_DLL_EXPORT *lsm_system_record_alloc(const char *id,
const char *name,
uint32_t status,
const char *status_info,
const char *plugin_data);
/**
* Retrieve plugin private data
* @param s System
* @return Optional data, NULL if none exist
*/
const char LSM_DLL_EXPORT *lsm_system_plugin_data_get(lsm_system *s);
/**
* Allocates storage for Access_group array
* @param size Number of elements to store.
* @return NULL on error, else pointer to array for use.
*/
lsm_access_group LSM_DLL_EXPORT **
lsm_access_group_record_array_alloc(uint32_t size);
/**
* Allocates storage for single Access_group
* @param id ID of access group
* @param name Name of access group
* @param initiators List of initiators, can be NULL
* @param init_type Initiator group type
* @param system_id System id
* @param plugin_data Reserved for plug-in use only
* @return NULL on error, else valid lsm_access_group pointer.
*/
lsm_access_group LSM_DLL_EXPORT *
lsm_access_group_record_alloc(const char *id, const char *name,
lsm_string_list *initiators,
lsm_access_group_init_type init_type,
const char *system_id,
const char *plugin_data);
/**
* Use to change the list of initiators associated with an access group.
* @param group Access group to change initiators for
* @param il String list of initiators.
*/
void LSM_DLL_EXPORT lsm_access_group_initiator_id_set(lsm_access_group *group,
lsm_string_list *il);
/**
* Allocates memory for a file system record
* @param id ID of file system
* @param name Name of file system
* @param total_space Total space
* @param free_space Free space
* @param pool_id Pool id
* @param system_id System id
* @param plugin_data Reserved for plug-in use only
* @return lsm_fs, NULL on error
*/
lsm_fs LSM_DLL_EXPORT *lsm_fs_record_alloc(const char *id,
const char *name,
uint64_t total_space,
uint64_t free_space,
const char *pool_id,
const char *system_id,
const char *plugin_data);
/**
* Allocates the memory for the array of file system records.
* @param size Number of elements
* @return Allocated memory, NULL on error
*/
lsm_fs LSM_DLL_EXPORT **lsm_fs_record_array_alloc(uint32_t size);
/**
* Used to retrieve the plug-in private data for a specific pool
* @param fs FS to retrieve plug-in private data for
* @return NULL if doesn't exist, else data.
*/
const char LSM_DLL_EXPORT *lsm_fs_plugin_data_get(lsm_fs *fs);
/**
* Allocates the memory for single snap shot record.
* @param id ID
* @param name Name
* @param ts Epoch time stamp when snapshot was created
* @param plugin_data Private plugin data
* @return Allocated memory, NULL on error
*/
lsm_fs_ss LSM_DLL_EXPORT *lsm_fs_ss_record_alloc(const char *id,
const char *name,
uint64_t ts,
const char *plugin_data);
/**
* Allocates the memory for an array of snapshot records.
* @param size Number of elements
* @return Allocated memory, NULL on error
*/
lsm_fs_ss LSM_DLL_EXPORT **lsm_fs_ss_record_array_alloc(uint32_t size);
/**
* Retrieve private data from fs_ss.
* @param fs_ss Valid fs_ss record
* @return Private data, else NULL
*/
const char LSM_DLL_EXPORT *lsm_fs_ss_plugin_data_get(lsm_fs_ss * fs_ss);
/**
* Set a capability
* @param cap Valid capability pointer
* @param t Which capability to set
* @param v Value of the capability
* @return LSM_ERR_OK on success, else error reason.
*/
int LSM_DLL_EXPORT lsm_capability_set(lsm_storage_capabilities * cap,
lsm_capability_type t,
lsm_capability_value_type v);
/**
* Sets 1 or more capabilities with the same value v
* @param cap Valid capability pointer
* @param v The value to set capabilities to
* @param ... Which capabilites to set (Make sure to terminate list
* with a -1)
* @return LSM_ERR_OK on success, else error reason
*/
int LSM_DLL_EXPORT lsm_capability_set_n(lsm_storage_capabilities * cap,
lsm_capability_value_type v, ...);
/**
* Allocated storage for capabilities
* @param value Set to NULL, used during serialization otherwise.
* @return Allocated record, or NULL on memory allocation failure.
*/
lsm_storage_capabilities LSM_DLL_EXPORT
* lsm_capability_record_alloc(char const *value);
/**
* Convenience function for plug-in writer.
* Note: Make sure to free returned items to prevent memory leaks.
* @param[in] uri URI to parse
* @param[out] scheme returned scheme
* @param[out] user returned user
* @param[out] server returned server
* @param[out] port returned port
* @param[out] path returned path
* @param[out] query_params returned query params
* @return LSM_ERR_OK on successful parse, else error reason.
*/
int LSM_DLL_EXPORT lsm_uri_parse(const char *uri, char **scheme,
char **user, char **server, int *port,
char **path, lsm_hash **query_params);
/**
* Provides for volume filtering when an array doesn't support this natively.
* Note: Filters in place removing and freeing those that don't match.
* @param search_key Search field
* @param search_value Search value
* @param[in,out] vols Array to filter
* @param[in,out] count Number of volumes to filter, number remain
*/
void LSM_DLL_EXPORT lsm_plug_volume_search_filter(const char *search_key,
const char *search_value,
lsm_volume *vols[],
uint32_t *count);
/**
* Provides for pool filtering when an array doesn't support this natively.
* Note: Filters in place removing and freeing those that don't match.
* @param search_key Search field
* @param search_value Search value
* @param[in,out] pools Array to filter
* @param[in,out] count Number of pools to filter, number remain
*/
void LSM_DLL_EXPORT lsm_plug_pool_search_filter(const char *search_key,
const char *search_value,
lsm_pool *pools[],
uint32_t *count);
/**
* Provides for disk filtering when an array doesn't support this natively.
* Note: Filters in place removing and freeing those that don't match.
* @param search_key Search field
* @param search_value Search value
* @param[in,out] disks Array to filter
* @param[in,out] count Number of disks to filter, number remain
*/
void LSM_DLL_EXPORT lsm_plug_disk_search_filter(const char *search_key,
const char *search_value,
lsm_disk *disks[],
uint32_t *count);
/**
* Provides for access group filtering when an array doesn't support this
* natively.
* Note: Filters in place removing and freeing those that don't match.
* @param search_key Search field
* @param search_value Search value
* @param[in,out] ag Array to filter
* @param[in,out] count Number of access groups to filter, number remain
*/
void LSM_DLL_EXPORT
lsm_plug_access_group_search_filter(const char *search_key,
const char *search_value,
lsm_access_group *ag[],
uint32_t *count);
/**
* Provides for fs filtering when an array doesn't support this natively.
* Note: Filters in place removing and freeing those that don't match.
* @param search_key Search field
* @param search_value Search value
* @param[in,out] fs Array to filter
* @param[in,out] count Number of file systems to filter, number remain
*/
void LSM_DLL_EXPORT lsm_plug_fs_search_filter(const char *search_key,
const char *search_value,
lsm_fs *fs[], uint32_t *count);
/**
* Provides for nfs filtering when an array doesn't support this natively.
* Note: Filters in place removing and freeing those that don't match.
* @param search_key Search field
* @param search_value Search value
* @param[in,out] exports Array to filter
* @param[in,out] count Number of nfs exports to filter, number remain
*/
void LSM_DLL_EXPORT
lsm_plug_nfs_export_search_filter(const char *search_key,
const char *search_value,
lsm_nfs_export *exports[],
uint32_t *count);
/**
* Retrieve private data from nfs export record.
* @param exp Valid nfs export record
* @return Private data, else NULL
*/
const char LSM_DLL_EXPORT *
lsm_nfs_export_plugin_data_get(lsm_nfs_export *exp);
/**
* Allocate a target port
* @param id ID of target port
* @param port_type Port type
* @param service_address Service address
* @param network_address Network Address
* @param physical_address Physical address
* @param physical_name Physical name
* @param system_id System ID
* @param plugin_data Plug-in data
* @return valid lsm_target_port, else NULL on memory allocation failure
*/
lsm_target_port LSM_DLL_EXPORT *
lsm_target_port_record_alloc(const char *id,
lsm_target_port_type port_type,
const char *service_address,
const char *network_address,
const char *physical_address,
const char *physical_name,
const char *system_id,
const char *plugin_data);
/**
* Retrieve the plug-in private data pointer
* @param tp Valid target port pointer
* @return Character pointer to string, NULL on error
*/
const char LSM_DLL_EXPORT *
lsm_target_port_plugin_data_get(lsm_target_port *tp);
/**
* Allocated an array of target pointers
* @param size Number of pointers to store
* @return Allocated memory, NULL on allocation errors
*/
lsm_target_port LSM_DLL_EXPORT **
lsm_target_port_record_array_alloc(uint32_t size);
/**
* Provides for target port filtering when an array doesn't support this
* natively.
* Note: Filters in place removing and freeing those that don't match.
* @param search_key Search field
* @param search_value Search value
* @param[in,out] tp Array to filter
* @param[in,out] count Number of target ports to filter, number remain
*/
void LSM_DLL_EXPORT
lsm_plug_target_port_search_filter(const char *search_key,
const char *search_value,
lsm_target_port *tp[],
uint32_t *count);
#ifdef __cplusplus
}
#endif
#endif /* LIBSTORAGEMGMT_PLUG_INTERFACE_H */
|