Mercurial > illumos > illumos-gate
changeset 2727:fa06bd58f0f9
6469453 invalid assert in ioctl.c:ldlinux_check()
6469929 brand handle should be an opaque handle as defined in PSARC/2004/413
author | edp |
---|---|
date | Thu, 14 Sep 2006 00:52:01 -0700 |
parents | e5cd8a9c8b0d |
children | ad0dcd72aedc |
files | usr/src/cmd/zlogin/zlogin.c usr/src/cmd/zoneadm/zoneadm.c usr/src/cmd/zoneadmd/vplat.c usr/src/cmd/zoneadmd/zoneadmd.c usr/src/cmd/zonecfg/zonecfg.c usr/src/lib/brand/lx/lx_brand/common/ioctl.c usr/src/lib/libbrand/common/libbrand.c usr/src/lib/libbrand/common/libbrand.h usr/src/lib/libzonecfg/common/libzonecfg.c |
diffstat | 9 files changed, 154 insertions(+), 138 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/zlogin/zlogin.c Wed Sep 13 22:35:49 2006 -0700 +++ b/usr/src/cmd/zlogin/zlogin.c Thu Sep 14 00:52:01 2006 -0700 @@ -751,7 +751,7 @@ } static char ** -zone_login_cmd(brand_handle_t *bhp, const char *login) +zone_login_cmd(brand_handle_t bh, const char *login) { static char result_buf[ARG_MAX]; char **new_argv, *ptr, *lasts; @@ -759,7 +759,7 @@ /* Get the login command for the target zone. */ bzero(result_buf, sizeof (result_buf)); - if (brand_get_login_cmd(bhp, login, + if (brand_get_login_cmd(bh, login, result_buf, sizeof (result_buf)) != 0) return (NULL); @@ -816,7 +816,7 @@ * checks). */ static char ** -prep_args(brand_handle_t *bhp, const char *login, char **argv) +prep_args(brand_handle_t bh, const char *login, char **argv) { int argc = 0, a = 0, i, n = -1; char **new_argv; @@ -866,7 +866,7 @@ new_argv[a++] = NULL; assert(n == a); } else { - new_argv = zone_login_cmd(bhp, login); + new_argv = zone_login_cmd(bh, login); } } @@ -1381,7 +1381,7 @@ char zonebrand[MAXNAMELEN]; struct stat sb; char kernzone[ZONENAME_MAX]; - brand_handle_t *bhp; + brand_handle_t bh; (void) setlocale(LC_ALL, ""); (void) textdomain(TEXT_DOMAIN); @@ -1598,16 +1598,16 @@ /* Get a handle to the brand info for this zone */ if ((zone_get_brand(zonename, zonebrand, sizeof (zonebrand)) != Z_OK) || - ((bhp = brand_open(zonebrand)) == NULL)) { + ((bh = brand_open(zonebrand)) == NULL)) { zerror(gettext("could not get brand for zone %s"), zonename); return (1); } - if ((new_args = prep_args(bhp, login, proc_args)) == NULL) { + if ((new_args = prep_args(bh, login, proc_args)) == NULL) { zperror(gettext("could not assemble new arguments")); - brand_close(bhp); + brand_close(bh); return (1); } - brand_close(bhp); + brand_close(bh); if ((new_env = prep_env()) == NULL) { zperror(gettext("could not assemble new environment"));
--- a/usr/src/cmd/zoneadm/zoneadm.c Wed Sep 13 22:35:49 2006 -0700 +++ b/usr/src/cmd/zoneadm/zoneadm.c Thu Sep 14 00:52:01 2006 -0700 @@ -2057,7 +2057,7 @@ char cmdbuf[MAXPATHLEN]; int err; char zonepath[MAXPATHLEN]; - brand_handle_t *bhp = NULL; + brand_handle_t bh = NULL; int status; /* @@ -2071,7 +2071,7 @@ zperror(cmd_to_str(CMD_VERIFY), B_TRUE); return (Z_ERR); } - if ((bhp = brand_open(target_brand)) == NULL) { + if ((bh = brand_open(target_brand)) == NULL) { zerror(gettext("missing or invalid brand")); return (Z_ERR); } @@ -2080,9 +2080,9 @@ * If the brand has its own verification routine, execute it now. */ (void) strcpy(cmdbuf, EXEC_PREFIX); - err = brand_get_verify_adm(bhp, target_zone, zonepath, + err = brand_get_verify_adm(bh, target_zone, zonepath, cmdbuf + EXEC_LEN, sizeof (cmdbuf) - EXEC_LEN, 0, NULL); - brand_close(bhp); + brand_close(bh); if (err == 0 && strlen(cmdbuf) > EXEC_LEN) { status = do_subproc_interactive(cmdbuf); err = subproc_status(gettext("brand-specific verification"), @@ -2884,7 +2884,7 @@ int lockfd; int arg, err, subproc_err; char zonepath[MAXPATHLEN]; - brand_handle_t *bhp = NULL; + brand_handle_t bh = NULL; int status; boolean_t nodataset = B_FALSE; char opts[128]; @@ -2907,16 +2907,16 @@ } /* Fetch the install command from the brand configuration. */ - if ((bhp = brand_open(target_brand)) == NULL) { + if ((bh = brand_open(target_brand)) == NULL) { zerror(gettext("missing or invalid brand")); return (Z_ERR); } (void) strcpy(cmdbuf, EXEC_PREFIX); - if (brand_get_install(bhp, target_zone, zonepath, cmdbuf + EXEC_LEN, + if (brand_get_install(bh, target_zone, zonepath, cmdbuf + EXEC_LEN, sizeof (cmdbuf) - EXEC_LEN, 0, NULL) != 0) { zerror("invalid brand configuration: missing install resource"); - brand_close(bhp); + brand_close(bh); return (Z_ERR); } @@ -2926,15 +2926,15 @@ * Fetch the list of recognized command-line options from * the brand configuration file. */ - if (brand_get_installopts(bhp, opts + strlen(opts), + if (brand_get_installopts(bh, opts + strlen(opts), sizeof (opts) - strlen(opts)) != 0) { zerror("invalid brand configuration: missing " "install options resource"); - brand_close(bhp); + brand_close(bh); return (Z_ERR); } } - brand_close(bhp); + brand_close(bh); optind = 0; while ((arg = getopt(argc, argv, opts)) != EOF) { @@ -3414,7 +3414,7 @@ static int valid_brand_clone(char *source_zone, char *target_zone) { - brand_handle_t *bhp; + brand_handle_t bh; char source_brand[MAXNAMELEN]; if ((zone_get_brand(source_zone, source_brand, @@ -3431,11 +3431,11 @@ return (Z_ERR); } - if ((bhp = brand_open(target_brand)) == NULL) { + if ((bh = brand_open(target_brand)) == NULL) { zerror(gettext("missing or invalid brand")); return (Z_ERR); } - brand_close(bhp); + brand_close(bh); return (Z_OK); } @@ -3541,21 +3541,21 @@ { char cmdbuf[MAXPATHLEN]; int status; - brand_handle_t *bhp; + brand_handle_t bh; int err = Z_OK; /* * Fetch the post-clone command, if any, from the brand * configuration. */ - if ((bhp = brand_open(target_brand)) == NULL) { + if ((bh = brand_open(target_brand)) == NULL) { zerror(gettext("missing or invalid brand")); return (Z_ERR); } (void) strcpy(cmdbuf, EXEC_PREFIX); - err = brand_get_postclone(bhp, target_zone, zonepath, cmdbuf + EXEC_LEN, + err = brand_get_postclone(bh, target_zone, zonepath, cmdbuf + EXEC_LEN, sizeof (cmdbuf) - EXEC_LEN, 0, NULL); - brand_close(bhp); + brand_close(bh); if (err == 0 && strlen(cmdbuf) > EXEC_LEN) { status = do_subproc(cmdbuf);
--- a/usr/src/cmd/zoneadmd/vplat.c Wed Sep 13 22:35:49 2006 -0700 +++ b/usr/src/cmd/zoneadmd/vplat.c Thu Sep 14 00:52:01 2006 -0700 @@ -980,7 +980,7 @@ { char brand[MAXNAMELEN]; zone_dochandle_t handle = NULL; - brand_handle_t *bhp = NULL; + brand_handle_t bh = NULL; struct zone_devtab ztab; di_prof_t prof = NULL; int err; @@ -993,18 +993,18 @@ /* Get a handle to the brand info for this zone */ if ((zone_get_brand(zone_name, brand, sizeof (brand)) != Z_OK) || - (bhp = brand_open(brand)) == NULL) { + (bh = brand_open(brand)) == NULL) { zerror(zlogp, B_FALSE, "unable to determine zone brand"); goto cleanup; } - if (brand_platform_iter_devices(bhp, zone_name, + if (brand_platform_iter_devices(bh, zone_name, mount_one_dev_device_cb, prof) != 0) { zerror(zlogp, B_TRUE, "failed to add standard device"); goto cleanup; } - if (brand_platform_iter_link(bhp, + if (brand_platform_iter_link(bh, mount_one_dev_symlink_cb, prof) != 0) { zerror(zlogp, B_TRUE, "failed to add standard symlink"); goto cleanup; @@ -1043,8 +1043,8 @@ retval = 0; cleanup: - if (bhp != NULL) - brand_close(bhp); + if (bh != NULL) + brand_close(bh); if (handle) zonecfg_fini_handle(handle); if (prof) @@ -1531,7 +1531,7 @@ struct zone_fstab *fs_ptr = NULL; zone_dochandle_t handle = NULL; zone_state_t zstate; - brand_handle_t *bhp; + brand_handle_t bh; plat_gmount_cb_data_t cb; if (zone_get_state(zone_name, &zstate) != Z_OK || @@ -1565,7 +1565,7 @@ /* Get a handle to the brand info for this zone */ if ((zone_get_brand(zone_name, brand, sizeof (brand)) != Z_OK) || - (bhp = brand_open(brand)) == NULL) { + (bh = brand_open(brand)) == NULL) { zerror(zlogp, B_FALSE, "unable to determine zone brand"); return (-1); } @@ -1577,13 +1577,13 @@ cb.pgcd_zlogp = zlogp; cb.pgcd_fs_tab = &fs_ptr; cb.pgcd_num_fs = &num_fs; - if (brand_platform_iter_gmounts(bhp, zonepath, + if (brand_platform_iter_gmounts(bh, zonepath, plat_gmount_cb, &cb) != 0) { zerror(zlogp, B_FALSE, "unable to mount filesystems"); - brand_close(bhp); + brand_close(bh); return (-1); } - brand_close(bhp); + brand_close(bh); /* * Iterate through the rest of the filesystems, first the IPDs, then @@ -3490,7 +3490,7 @@ char rootpath[MAXPATHLEN]; char modname[MAXPATHLEN]; struct brand_attr attr; - brand_handle_t *bhp; + brand_handle_t bh; char *rctlbuf = NULL; size_t rctlbufsz = 0; char *zfsbuf = NULL; @@ -3642,7 +3642,7 @@ if ((zone_get_brand(zone_name, attr.ba_brandname, MAXNAMELEN) != Z_OK) || - (bhp = brand_open(attr.ba_brandname)) == NULL) { + (bh = brand_open(attr.ba_brandname)) == NULL) { zerror(zlogp, B_FALSE, "unable to determine brand name"); return (-1); } @@ -3651,7 +3651,7 @@ * If this brand requires any kernel support, now is the time to * get it loaded and initialized. */ - if (brand_get_modname(bhp, modname, MAXPATHLEN) < 0) { + if (brand_get_modname(bh, modname, MAXPATHLEN) < 0) { zerror(zlogp, B_FALSE, "unable to determine brand kernel " "module"); return (-1); @@ -3883,7 +3883,7 @@ char zroot[MAXPATHLEN]; char cmdbuf[MAXPATHLEN]; char brand[MAXNAMELEN]; - brand_handle_t *bhp = NULL; + brand_handle_t bh = NULL; kzone = zone_name; if (zonecfg_in_alt_root()) { @@ -3924,7 +3924,7 @@ /* Get a handle to the brand info for this zone */ if ((zone_get_brand(zone_name, brand, sizeof (brand)) != Z_OK) || - (bhp = brand_open(brand)) == NULL) { + (bh = brand_open(brand)) == NULL) { zerror(zlogp, B_FALSE, "unable to determine zone brand"); return (-1); } @@ -3933,14 +3933,14 @@ * brand a chance to cleanup any custom configuration. */ (void) strcpy(cmdbuf, EXEC_PREFIX); - if (brand_get_halt(bhp, zone_name, zroot, cmdbuf + EXEC_LEN, + if (brand_get_halt(bh, zone_name, zroot, cmdbuf + EXEC_LEN, sizeof (cmdbuf) - EXEC_LEN, 0, NULL) < 0) { - brand_close(bhp); + brand_close(bh); zerror(zlogp, B_FALSE, "unable to determine branded zone's " "halt callback."); goto error; } - brand_close(bhp); + brand_close(bh); if ((strlen(cmdbuf) > EXEC_LEN) && (do_subproc(zlogp, cmdbuf) != Z_OK)) {
--- a/usr/src/cmd/zoneadmd/zoneadmd.c Wed Sep 13 22:35:49 2006 -0700 +++ b/usr/src/cmd/zoneadmd/zoneadmd.c Thu Sep 14 00:52:01 2006 -0700 @@ -622,7 +622,7 @@ char nbootargs[BOOTARGS_MAX]; char cmdbuf[MAXPATHLEN]; fs_callback_t cb; - brand_handle_t *bhp; + brand_handle_t bh; int err; if (init_console_slave(zlogp) != 0) @@ -638,7 +638,7 @@ cb.zoneid = zoneid; /* Get a handle to the brand info for this zone */ - if ((bhp = brand_open(brand_name)) == NULL) { + if ((bh = brand_open(brand_name)) == NULL) { zerror(zlogp, B_FALSE, "unable to determine zone brand"); return (-1); } @@ -649,9 +649,9 @@ * enter the zone, so they are done from within the context of the * zone. */ - if (brand_platform_iter_mounts(bhp, mount_early_fs, &cb) != 0) { + if (brand_platform_iter_mounts(bh, mount_early_fs, &cb) != 0) { zerror(zlogp, B_FALSE, "unable to mount filesystems"); - brand_close(bhp); + brand_close(bh); return (-1); } @@ -663,23 +663,23 @@ return (-1); } (void) strcpy(cmdbuf, EXEC_PREFIX); - if (brand_get_boot(bhp, zone_name, zroot, cmdbuf + EXEC_LEN, + if (brand_get_boot(bh, zone_name, zroot, cmdbuf + EXEC_LEN, sizeof (cmdbuf) - EXEC_LEN, 0, NULL) != 0) { zerror(zlogp, B_FALSE, "unable to determine branded zone's boot callback"); - brand_close(bhp); + brand_close(bh); return (-1); } /* Get the path for this zone's init(1M) (or equivalent) process. */ - if (brand_get_initname(bhp, init_file, MAXPATHLEN) != 0) { + if (brand_get_initname(bh, init_file, MAXPATHLEN) != 0) { zerror(zlogp, B_FALSE, "unable to determine zone's init(1M) location"); - brand_close(bhp); + brand_close(bh); return (-1); } - brand_close(bhp); + brand_close(bh); err = filter_bootargs(zlogp, bootargs, nbootargs, init_file, bad_boot_arg); @@ -829,7 +829,7 @@ zone_cmd_rval_t *rvalp; size_t rlen = getpagesize(); /* conservative */ fs_callback_t cb; - brand_handle_t *bhp; + brand_handle_t bh; /* LINTED E_BAD_PTR_CAST_ALIGN */ zargp = (zone_cmd_arg_t *)args; @@ -1037,7 +1037,7 @@ eventstream_write(Z_EVT_ZONE_READIED); /* Get a handle to the brand info for this zone */ - if ((bhp = brand_open(brand_name)) == NULL) { + if ((bh = brand_open(brand_name)) == NULL) { rval = -1; break; } @@ -1050,10 +1050,10 @@ */ cb.zlogp = zlogp; cb.zoneid = zone_id; - rval = brand_platform_iter_mounts(bhp, + rval = brand_platform_iter_mounts(bh, mount_early_fs, &cb); - brand_close(bhp); + brand_close(bh); /* * Ordinarily, /dev/fd would be mounted inside the zone @@ -1376,7 +1376,7 @@ priv_set_t *privset; zone_state_t zstate; char parents_locale[MAXPATHLEN]; - brand_handle_t *bhp; + brand_handle_t bh; int err; pid_t pid; @@ -1488,12 +1488,12 @@ /* Get a handle to the brand info for this zone */ if ((zone_get_brand(zone_name, brand_name, sizeof (brand_name)) - != Z_OK) || (bhp = brand_open(brand_name)) == NULL) { + != Z_OK) || (bh = brand_open(brand_name)) == NULL) { zerror(zlogp, B_FALSE, "unable to determine zone brand"); return (1); } - zone_isnative = brand_is_native(bhp); - brand_close(bhp); + zone_isnative = brand_is_native(bh); + brand_close(bh); /* * Check that we have all privileges. It would be nice to pare
--- a/usr/src/cmd/zonecfg/zonecfg.c Wed Sep 13 22:35:49 2006 -0700 +++ b/usr/src/cmd/zonecfg/zonecfg.c Thu Sep 14 00:52:01 2006 -0700 @@ -379,7 +379,7 @@ static char revert_zone[ZONENAME_MAX]; /* global brand operations */ -static brand_handle_t *brand; +static brand_handle_t brand; /* set in modifying functions, checked in read_input() */ static bool need_to_commit = FALSE; @@ -3689,7 +3689,7 @@ { char *xml_file = "/tmp/zonecfg_verify.XXXXXX"; char cmdbuf[MAX_CMD_LEN]; - brand_handle_t *bhp; + brand_handle_t bh; char brand[MAXNAMELEN]; int err; @@ -3697,7 +3697,7 @@ zerr("%s: %s\n", zone, gettext("could not get zone brand")); return (Z_INVALID_DOCUMENT); } - if ((bhp = brand_open(brand)) == NULL) { + if ((bh = brand_open(brand)) == NULL) { zerr("%s: %s\n", zone, gettext("unknown brand.")); return (Z_INVALID_DOCUMENT); } @@ -3707,9 +3707,9 @@ * and build the command line to execute it. */ strcpy(cmdbuf, EXEC_PREFIX); - err = brand_get_verify_cfg(bhp, cmdbuf + EXEC_LEN, + err = brand_get_verify_cfg(bh, cmdbuf + EXEC_LEN, sizeof (cmdbuf) - (EXEC_LEN + (strlen(xml_file) + 1))); - brand_close(bhp); + brand_close(bh); if (err != Z_OK) { zerr("%s: %s\n", zone, gettext("could not get brand verification command"));
--- a/usr/src/lib/brand/lx/lx_brand/common/ioctl.c Wed Sep 13 22:35:49 2006 -0700 +++ b/usr/src/lib/brand/lx/lx_brand/common/ioctl.c Thu Sep 14 00:52:01 2006 -0700 @@ -251,14 +251,12 @@ } static int -ldlinux_check(int fd, struct stat *stat) +ldlinux_check(int fd) { struct str_mlist mlist[MAX_STRMODS]; struct str_list strlist; int i; - assert((stat->st_mode & S_IFMT) == S_IFCHR); - /* Get the number of modules on the stream. */ lx_debug("\tioctl(%d, 0x%x - %s, ...)", fd, I_LIST, "I_LIST"); @@ -1087,7 +1085,7 @@ * ldlinux strmod. So make sure the module exists on the * target stream before we invoke the ioctl. */ - if ((ldlinux = ldlinux_check(fd, stat)) < 0) + if ((ldlinux = ldlinux_check(fd)) < 0) return (ldlinux); if (ldlinux == 1) { @@ -1124,7 +1122,7 @@ * ldlinux strmod. So make sure the module exists on the * target stream before we invoke the ioctl. */ - if ((ldlinux = ldlinux_check(fd, stat)) < 0) + if ((ldlinux = ldlinux_check(fd)) < 0) return (ldlinux); if (ldlinux == 1) { @@ -1259,7 +1257,7 @@ assert(cmd == LX_TCGETS); - if ((ldlinux = ldlinux_check(fd, stat)) < 0) + if ((ldlinux = ldlinux_check(fd)) < 0) return (ldlinux); lx_debug("\tioctl(%d, 0x%x - %s, ...)", @@ -1308,7 +1306,7 @@ assert(cmd == LX_TCGETA); - if ((ldlinux = ldlinux_check(fd, stat)) < 0) + if ((ldlinux = ldlinux_check(fd)) < 0) return (ldlinux); lx_debug("\tioctl(%d, 0x%x - %s, ...)",
--- a/usr/src/lib/libbrand/common/libbrand.c Wed Sep 13 22:35:49 2006 -0700 +++ b/usr/src/lib/libbrand/common/libbrand.c Thu Sep 14 00:52:01 2006 -0700 @@ -200,10 +200,10 @@ * Returns a handle to the named brand, which is used for all subsequent brand * interaction, or NULL if unable to open or initialize the brand. */ -brand_handle_t * +brand_handle_t brand_open(const char *name) { - brand_handle_t *bhp; + struct brand_handle *bhp; char path[MAXPATHLEN]; xmlNodePtr node; xmlChar *property; @@ -226,9 +226,9 @@ /* * Allocate brand handle */ - if ((bhp = malloc(sizeof (brand_handle_t))) == NULL) + if ((bhp = malloc(sizeof (struct brand_handle))) == NULL) return (NULL); - bzero(bhp, sizeof (brand_handle_t)); + bzero(bhp, sizeof (struct brand_handle)); (void) strcpy(bhp->bh_name, name); @@ -238,7 +238,7 @@ (void) snprintf(path, sizeof (path), "%s/%s/%s", BRAND_DIR, name, BRAND_CONFIG); if ((bhp->bh_config = open_xml_file(path)) == NULL) { - brand_close(bhp); + brand_close((brand_handle_t)bhp); return (NULL); } @@ -247,23 +247,23 @@ * is installed. */ if ((node = xmlDocGetRootElement(bhp->bh_config)) == NULL) { - brand_close(bhp); + brand_close((brand_handle_t)bhp); return (NULL); } if (xmlStrcmp(node->name, DTD_ELEM_BRAND) != 0) { - brand_close(bhp); + brand_close((brand_handle_t)bhp); return (NULL); } if ((property = xmlGetProp(node, DTD_ATTR_NAME)) == NULL) { - brand_close(bhp); + brand_close((brand_handle_t)bhp); return (NULL); } if (strcmp((char *)property, name) != 0) { xmlFree(property); - brand_close(bhp); + brand_close((brand_handle_t)bhp); return (NULL); } xmlFree(property); @@ -274,19 +274,20 @@ (void) snprintf(path, sizeof (path), "%s/%s/%s", BRAND_DIR, name, BRAND_PLATFORM); if ((bhp->bh_platform = open_xml_file(path)) == NULL) { - brand_close(bhp); + brand_close((brand_handle_t)bhp); return (NULL); } - return (bhp); + return ((brand_handle_t)bhp); } /* * Closes the given brand handle */ void -brand_close(brand_handle_t *bhp) +brand_close(brand_handle_t bh) { + struct brand_handle *bhp = (struct brand_handle *)bh; if (bhp->bh_platform != NULL) xmlFreeDoc(bhp->bh_platform); if (bhp->bh_config != NULL) @@ -372,7 +373,7 @@ * Returns 0 on success, -1 on failure. */ static int -brand_get_value(brand_handle_t *bhp, const char *zonename, +brand_get_value(struct brand_handle *bhp, const char *zonename, const char *zoneroot, const char *username, const char *curr_zone, char *buf, size_t len, int argc, char **argv, const xmlChar *tagname, boolean_t substitute, boolean_t optional) @@ -432,16 +433,18 @@ } int -brand_get_boot(brand_handle_t *bhp, const char *zonename, +brand_get_boot(brand_handle_t bh, const char *zonename, const char *zoneroot, char *buf, size_t len, int argc, char **argv) { + struct brand_handle *bhp = (struct brand_handle *)bh; return (brand_get_value(bhp, zonename, zoneroot, NULL, NULL, buf, len, argc, argv, DTD_ELEM_BOOT, B_TRUE, B_TRUE)); } int -brand_get_brandname(brand_handle_t *bhp, char *buf, size_t len) +brand_get_brandname(brand_handle_t bh, char *buf, size_t len) { + struct brand_handle *bhp = (struct brand_handle *)bh; if (len <= strlen(bhp->bh_name)) return (-1); @@ -451,77 +454,87 @@ } int -brand_get_halt(brand_handle_t *bhp, const char *zonename, +brand_get_halt(brand_handle_t bh, const char *zonename, const char *zoneroot, char *buf, size_t len, int argc, char **argv) { + struct brand_handle *bhp = (struct brand_handle *)bh; return (brand_get_value(bhp, zonename, zoneroot, NULL, NULL, buf, len, argc, argv, DTD_ELEM_HALT, B_TRUE, B_TRUE)); } int -brand_get_initname(brand_handle_t *bhp, char *buf, size_t len) +brand_get_initname(brand_handle_t bh, char *buf, size_t len) { + struct brand_handle *bhp = (struct brand_handle *)bh; return (brand_get_value(bhp, NULL, NULL, NULL, NULL, buf, len, 0, NULL, DTD_ELEM_INITNAME, B_FALSE, B_FALSE)); } int -brand_get_login_cmd(brand_handle_t *bhp, const char *username, +brand_get_login_cmd(brand_handle_t bh, const char *username, char *buf, size_t len) { + struct brand_handle *bhp = (struct brand_handle *)bh; const char *curr_zone = get_curr_zone(); return (brand_get_value(bhp, NULL, NULL, username, curr_zone, buf, len, 0, NULL, DTD_ELEM_LOGIN_CMD, B_TRUE, B_FALSE)); } int -brand_get_install(brand_handle_t *bhp, const char *zonename, +brand_get_install(brand_handle_t bh, const char *zonename, const char *zoneroot, char *buf, size_t len, int argc, char **argv) { + struct brand_handle *bhp = (struct brand_handle *)bh; return (brand_get_value(bhp, zonename, zoneroot, NULL, NULL, buf, len, argc, argv, DTD_ELEM_INSTALL, B_TRUE, B_FALSE)); } int -brand_get_installopts(brand_handle_t *bhp, char *buf, size_t len) +brand_get_installopts(brand_handle_t bh, char *buf, size_t len) { + struct brand_handle *bhp = (struct brand_handle *)bh; return (brand_get_value(bhp, NULL, NULL, NULL, NULL, buf, len, 0, NULL, DTD_ELEM_INSTALLOPTS, B_FALSE, B_TRUE)); } int -brand_get_modname(brand_handle_t *bhp, char *buf, size_t len) +brand_get_modname(brand_handle_t bh, char *buf, size_t len) { + struct brand_handle *bhp = (struct brand_handle *)bh; return (brand_get_value(bhp, NULL, NULL, NULL, NULL, buf, len, 0, NULL, DTD_ELEM_MODNAME, B_FALSE, B_TRUE)); } int -brand_get_postclone(brand_handle_t *bhp, const char *zonename, +brand_get_postclone(brand_handle_t bh, const char *zonename, const char *zoneroot, char *buf, size_t len, int argc, char **argv) { + struct brand_handle *bhp = (struct brand_handle *)bh; return (brand_get_value(bhp, zonename, zoneroot, NULL, NULL, buf, len, argc, argv, DTD_ELEM_POSTCLONE, B_TRUE, B_TRUE)); } int -brand_get_verify_cfg(brand_handle_t *bhp, char *buf, size_t len) +brand_get_verify_cfg(brand_handle_t bh, char *buf, size_t len) { + struct brand_handle *bhp = (struct brand_handle *)bh; return (brand_get_value(bhp, NULL, NULL, NULL, NULL, buf, len, 0, NULL, DTD_ELEM_VERIFY_CFG, B_FALSE, B_TRUE)); } int -brand_get_verify_adm(brand_handle_t *bhp, const char *zonename, +brand_get_verify_adm(brand_handle_t bh, const char *zonename, const char *zoneroot, char *buf, size_t len, int argc, char **argv) { + struct brand_handle *bhp = (struct brand_handle *)bh; return (brand_get_value(bhp, zonename, zoneroot, NULL, NULL, buf, len, argc, argv, DTD_ELEM_VERIFY_ADM, B_TRUE, B_TRUE)); } int -brand_is_native(brand_handle_t *bhp) +brand_is_native(brand_handle_t bh) { + struct brand_handle *bhp = (struct brand_handle *)bh; return ((strcmp(bhp->bh_name, NATIVE_BRAND_NAME) == 0) ? 1 : 0); } @@ -532,9 +545,10 @@ * specified callback for each. Returns 0 on success, or -1 on failure. */ int -brand_config_iter_privilege(brand_handle_t *bhp, int (*func)(void *, +brand_config_iter_privilege(brand_handle_t bh, int (*func)(void *, const char *, const char *), void *data) { + struct brand_handle *bhp = (struct brand_handle *)bh; xmlNodePtr node; xmlChar *name, *set; int ret; @@ -571,7 +585,7 @@ } static int -i_brand_platform_iter_mounts(brand_handle_t *bhp, const char *zoneroot, +i_brand_platform_iter_mounts(struct brand_handle *bhp, const char *zoneroot, int (*func)(void *, const char *, const char *, const char *, const char *), void *data, const xmlChar *mount_type) { @@ -646,10 +660,11 @@ * %R Root of zone */ int -brand_platform_iter_gmounts(brand_handle_t *bhp, const char *zoneroot, +brand_platform_iter_gmounts(brand_handle_t bh, const char *zoneroot, int (*func)(void *, const char *, const char *, const char *, const char *), void *data) { + struct brand_handle *bhp = (struct brand_handle *)bh; return (i_brand_platform_iter_mounts(bhp, zoneroot, func, data, DTD_ELEM_GLOBAL_MOUNT)); } @@ -661,9 +676,10 @@ * specified callback for each. Returns 0 on success, or -1 on failure. */ int -brand_platform_iter_mounts(brand_handle_t *bhp, int (*func)(void *, +brand_platform_iter_mounts(brand_handle_t bh, int (*func)(void *, const char *, const char *, const char *, const char *), void *data) { + struct brand_handle *bhp = (struct brand_handle *)bh; return (i_brand_platform_iter_mounts(bhp, NULL, func, data, DTD_ELEM_MOUNT)); } @@ -675,9 +691,10 @@ * specified callback for each. Returns 0 on success, or -1 on failure. */ int -brand_platform_iter_link(brand_handle_t *bhp, +brand_platform_iter_link(brand_handle_t bh, int (*func)(void *, const char *, const char *), void *data) { + struct brand_handle *bhp = (struct brand_handle *)bh; xmlNodePtr node; xmlChar *source, *target; int ret; @@ -720,15 +737,16 @@ * specified callback for each. Returns 0 on success, or -1 on failure. */ int -brand_platform_iter_devices(brand_handle_t *bhp, const char *zonename, +brand_platform_iter_devices(brand_handle_t bh, const char *zonename, int (*func)(void *, const char *, const char *), void *data) { - const char *curr_arch = get_curr_arch(); - xmlNodePtr node; - xmlChar *match, *name, *arch; - char match_exp[MAXPATHLEN]; - boolean_t err = B_FALSE; - int ret = 0; + struct brand_handle *bhp = (struct brand_handle *)bh; + const char *curr_arch = get_curr_arch(); + xmlNodePtr node; + xmlChar *match, *name, *arch; + char match_exp[MAXPATHLEN]; + boolean_t err = B_FALSE; + int ret = 0; assert(bhp != NULL);
--- a/usr/src/lib/libbrand/common/libbrand.h Wed Sep 13 22:35:49 2006 -0700 +++ b/usr/src/lib/libbrand/common/libbrand.h Thu Sep 14 00:52:01 2006 -0700 @@ -35,41 +35,41 @@ #include <sys/types.h> -typedef struct brand_handle brand_handle_t; +typedef struct __brand_handle *brand_handle_t; -extern brand_handle_t *brand_open(const char *); -extern void brand_close(brand_handle_t *); +extern brand_handle_t brand_open(const char *); +extern void brand_close(brand_handle_t); -extern int brand_is_native(brand_handle_t *); +extern int brand_is_native(brand_handle_t); -extern int brand_get_boot(brand_handle_t *, const char *, const char *, +extern int brand_get_boot(brand_handle_t, const char *, const char *, char *, size_t, int, char **); -extern int brand_get_brandname(brand_handle_t *, char *, size_t); -extern int brand_get_halt(brand_handle_t *, const char *, const char *, +extern int brand_get_brandname(brand_handle_t, char *, size_t); +extern int brand_get_halt(brand_handle_t, const char *, const char *, char *, size_t, int, char **); -extern int brand_get_initname(brand_handle_t *, char *, size_t); -extern int brand_get_install(brand_handle_t *, const char *, const char *, +extern int brand_get_initname(brand_handle_t, char *, size_t); +extern int brand_get_install(brand_handle_t, const char *, const char *, char *, size_t, int, char **); -extern int brand_get_installopts(brand_handle_t *, char *, size_t); -extern int brand_get_login_cmd(brand_handle_t *, const char *, char *, size_t); -extern int brand_get_modname(brand_handle_t *, char *, size_t); -extern int brand_get_postclone(brand_handle_t *, const char *, const char *, +extern int brand_get_installopts(brand_handle_t, char *, size_t); +extern int brand_get_login_cmd(brand_handle_t, const char *, char *, size_t); +extern int brand_get_modname(brand_handle_t, char *, size_t); +extern int brand_get_postclone(brand_handle_t, const char *, const char *, char *, size_t, int, char **); -extern int brand_get_verify_cfg(brand_handle_t *, char *, size_t); -extern int brand_get_verify_adm(brand_handle_t *, const char *, const char *, +extern int brand_get_verify_cfg(brand_handle_t, char *, size_t); +extern int brand_get_verify_adm(brand_handle_t, const char *, const char *, char *, size_t, int, char **); -extern int brand_config_iter_privilege(brand_handle_t *, +extern int brand_config_iter_privilege(brand_handle_t, int (*func)(void *, const char *, const char *), void *); -extern int brand_platform_iter_devices(brand_handle_t *, const char *, +extern int brand_platform_iter_devices(brand_handle_t, const char *, int (*)(void *, const char *, const char *), void *); -extern int brand_platform_iter_gmounts(brand_handle_t *, const char *, +extern int brand_platform_iter_gmounts(brand_handle_t, const char *, int (*)(void *, const char *, const char *, const char *, const char *), void *); -extern int brand_platform_iter_link(brand_handle_t *, int (*)(void *, +extern int brand_platform_iter_link(brand_handle_t, int (*)(void *, const char *, const char *), void *); -extern int brand_platform_iter_mounts(brand_handle_t *, int (*)(void *, +extern int brand_platform_iter_mounts(brand_handle_t, int (*)(void *, const char *, const char *, const char *, const char *), void *); #ifdef __cplusplus
--- a/usr/src/lib/libzonecfg/common/libzonecfg.c Wed Sep 13 22:35:49 2006 -0700 +++ b/usr/src/lib/libzonecfg/common/libzonecfg.c Thu Sep 14 00:52:01 2006 -0700 @@ -3528,7 +3528,7 @@ priv_lists_create(zone_dochandle_t handle, priv_lists_t **plpp) { priv_lists_t *plp; - brand_handle_t *bhp; + brand_handle_t bh; char brand[MAXNAMELEN]; if (handle != NULL) { @@ -3538,22 +3538,22 @@ (void) strlcpy(brand, NATIVE_BRAND_NAME, MAXNAMELEN); } - if ((bhp = brand_open(brand)) == NULL) + if ((bh = brand_open(brand)) == NULL) return (Z_BRAND_ERROR); if ((plp = calloc(1, sizeof (priv_lists_t))) == NULL) { - brand_close(bhp); + brand_close(bh); return (Z_NOMEM); } /* construct the privilege lists */ - if (brand_config_iter_privilege(bhp, priv_lists_cb, plp) != 0) { + if (brand_config_iter_privilege(bh, priv_lists_cb, plp) != 0) { priv_lists_destroy(plp); - brand_close(bhp); + brand_close(bh); return (Z_BRAND_ERROR); } - brand_close(bhp); + brand_close(bh); *plpp = plp; return (Z_OK); }