6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
26 */
27
28 #include <sys/param.h>
29 #include <sys/stat.h>
30 #include <errno.h>
31 #include <string.h>
32 #include <dirent.h>
33 #include "cfga_sata.h"
34
35 /*
36 * This file contains the entry points to the plug-in as defined in the
37 * config_admin(3X) man page.
38 */
39
40 /*
41 * Set the version number for the cfgadm library's use.
42 */
43 int cfga_version = CFGA_HSL_V2;
44
45 enum {
1728 {
1729 int len;
1730 char *q;
1731
1732 if (msgp == NULL || msgp->message_routine == NULL) {
1733 (void) printf("cfga_msg: NULL msgp\n");
1734 return;
1735 }
1736
1737 if ((len = strlen(str)) == 0) {
1738 (void) printf("cfga_msg: null str\n");
1739 return;
1740 }
1741
1742 if ((q = (char *)calloc(len + 1, 1)) == NULL) {
1743 perror("cfga_msg");
1744 return;
1745 }
1746
1747 (void) strcpy(q, str);
1748 (*msgp->message_routine)(msgp->appdata_ptr, q);
1749
1750 free(q);
1751 }
1752
1753 /* cfgadm entry point */
1754 /* ARGSUSED */
1755 cfga_err_t
1756 cfga_help(struct cfga_msg *msgp, const char *options, cfga_flags_t flags)
1757 {
1758 if (options != NULL) {
1759 cfga_msg(msgp, dgettext(TEXT_DOMAIN, sata_help[HELP_UNKNOWN]));
1760 cfga_msg(msgp, options);
1761 }
1762 cfga_msg(msgp, dgettext(TEXT_DOMAIN, sata_help[HELP_HEADER]));
1763 cfga_msg(msgp, sata_help[HELP_CONFIG]);
1764 cfga_msg(msgp, sata_help[HELP_RESET_PORT]);
1765 cfga_msg(msgp, sata_help[HELP_RESET_DEVICE]);
1766 cfga_msg(msgp, sata_help[HELP_RESET_ALL]);
1767 cfga_msg(msgp, sata_help[HELP_PORT_ACTIVATE]);
1768 cfga_msg(msgp, sata_help[HELP_PORT_DEACTIVATE]);
|
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
26 * Copyright (c) 2018, Joyent, Inc.
27 */
28
29 #include <sys/param.h>
30 #include <sys/stat.h>
31 #include <errno.h>
32 #include <string.h>
33 #include <dirent.h>
34 #include "cfga_sata.h"
35
36 /*
37 * This file contains the entry points to the plug-in as defined in the
38 * config_admin(3X) man page.
39 */
40
41 /*
42 * Set the version number for the cfgadm library's use.
43 */
44 int cfga_version = CFGA_HSL_V2;
45
46 enum {
1729 {
1730 int len;
1731 char *q;
1732
1733 if (msgp == NULL || msgp->message_routine == NULL) {
1734 (void) printf("cfga_msg: NULL msgp\n");
1735 return;
1736 }
1737
1738 if ((len = strlen(str)) == 0) {
1739 (void) printf("cfga_msg: null str\n");
1740 return;
1741 }
1742
1743 if ((q = (char *)calloc(len + 1, 1)) == NULL) {
1744 perror("cfga_msg");
1745 return;
1746 }
1747
1748 (void) strcpy(q, str);
1749 (void) (*msgp->message_routine)(msgp->appdata_ptr, q);
1750
1751 free(q);
1752 }
1753
1754 /* cfgadm entry point */
1755 /* ARGSUSED */
1756 cfga_err_t
1757 cfga_help(struct cfga_msg *msgp, const char *options, cfga_flags_t flags)
1758 {
1759 if (options != NULL) {
1760 cfga_msg(msgp, dgettext(TEXT_DOMAIN, sata_help[HELP_UNKNOWN]));
1761 cfga_msg(msgp, options);
1762 }
1763 cfga_msg(msgp, dgettext(TEXT_DOMAIN, sata_help[HELP_HEADER]));
1764 cfga_msg(msgp, sata_help[HELP_CONFIG]);
1765 cfga_msg(msgp, sata_help[HELP_RESET_PORT]);
1766 cfga_msg(msgp, sata_help[HELP_RESET_DEVICE]);
1767 cfga_msg(msgp, sata_help[HELP_RESET_ALL]);
1768 cfga_msg(msgp, sata_help[HELP_PORT_ACTIVATE]);
1769 cfga_msg(msgp, sata_help[HELP_PORT_DEACTIVATE]);
|