static void intel_155f40(struct bregs *regs) { regs->ax = 0x005f; regs->cl = GET_GLOBAL(IntelDisplayId); set_success(regs); }
// APM Get Capabilities static void handle_155310(struct bregs *regs) { regs->bl = 0; regs->cx = 0; set_success(regs); }
bool AsyncResult::execute() { bool should_call = false; { Lock::scoped_lock locker(lock_); if (status_ == WAIT) { should_call = true; status_ = RUNNING; } } if (should_call) { try { task_(*this); set_success(); } catch (AvalonException& err) { set_error(&err); } catch (boost::thread_interrupted) { set_interrupt(); throw; } catch (...) { set_error(); } } return should_call; }
MODULE_RAII(){ Poseidon::enqueue_async_job([]{ const auto promise = boost::make_shared<Poseidon::JobPromise>(); promise->set_success(); Poseidon::JobDispatcher::yield(promise); }); }
// APM Driver Version static void handle_15530e(struct bregs *regs) { regs->ah = 1; regs->al = 2; set_success(regs); }
static void intel_155f50(struct bregs *regs) { /* Mandatory hook on some Dell laptops */ regs->ax = 0x005f; set_success(regs); }
static void via_155f01(struct bregs *regs) { regs->eax = 0x5f; regs->cl = 2; // panel type = 2 = 1024 * 768 set_success(regs); dprintf(1, "Warning: VGA panel type is hardcoded\n"); }
static void smi_157f14(struct bregs *regs) { /* ReduceOn support default status */ regs->ax = 0x007f; regs->bl = 0x00; set_success(regs); }
static void smi_157f02(struct bregs *regs) { /* Boot Display Device Override */ regs->ax = 0x007f; regs->bl = GET_GLOBAL(SmiBootDisplay); set_success(regs); }
static void via_155f02(struct bregs *regs) { regs->eax = 0x5f; regs->bx = 2; regs->cx = 0x401; // PAL + crt only regs->dx = 0; // TV Layout - default set_success(regs); dprintf(1, "Warning: VGA TV/CRT output type is hardcoded\n"); }
// APM 16 bit protected mode interface connect static void handle_155302(struct bregs *regs) { regs->bx = (u32)apm16protected_entry; regs->ax = SEG_BIOS; // 16 bit code segment base regs->si = 0xfff0; // 16 bit code segment size regs->cx = SEG_BIOS; // data segment address regs->di = 0xfff0; // data segment length set_success(regs); }
// APM Set Power State static void handle_155307(struct bregs *regs) { if (regs->bx != 1) { set_success(regs); return; } switch (regs->cx) { case 1: out_str("Standby"); break; case 2: out_str("Suspend"); break; case 3: apm_shutdown(); break; } set_success(regs); }
// Get Power Status static void handle_15530a(struct bregs *regs) { regs->bh = 0x01; // on line regs->bl = 0xff; // unknown battery status regs->ch = 0x80; // no system battery regs->cl = 0xff; // unknown remaining time regs->dx = 0xffff; // unknown remaining time regs->si = 0x00; // zero battery set_success(regs); }
// APM installation check static void handle_155300(struct bregs *regs) { regs->ah = 1; // APM major version regs->al = 2; // APM minor version regs->bh = 'P'; regs->bl = 'M'; // bit 0 : 16 bit interface supported // bit 1 : 32 bit interface supported regs->cx = 0x03; set_success(regs); }
folly::Future<std::unique_ptr<ResumeResponse>> TreadmillFB303::future_resume2( std::unique_ptr<ResumeRequest> req) { // Get the phase name being super paranoid. auto phaseName = req != nullptr ? req->get_phaseName() : "UNKNOWN_PHASE"; LOG(INFO) << "TreadmillHandler::resume2 with phase " << phaseName; scheduler_.setPhase(phaseName); auto resp = std::make_unique<ResumeResponse>(); auto running = scheduler_.resume(); LOG(INFO) << "Scheduler is currently " << (running ? "Running" : "Not Running"); resp->set_success(running); return folly::makeFuture(std::move(resp)); }
static void via_155f18(struct bregs *regs) { int fbsize = GET_GLOBAL(ViaFBsize), ramspeed = GET_GLOBAL(ViaRamSpeed); if (fbsize < 0 || ramspeed < 0) { set_code_invalid(regs, RET_EUNSUPPORTED); return; } regs->eax = 0x5f; regs->ebx = 0x500 | (ramspeed << 4) | fbsize; regs->ecx = 0x060; set_success(regs); }
// APM 32 bit protected mode interface connect static void handle_155303(struct bregs *regs) { regs->ax = SEG_BIOS; // 32 bit code segment base regs->ebx = (u32)apm32protected_entry; regs->cx = SEG_BIOS; // 16 bit code segment base // 32 bit code segment size (low 16 bits) // 16 bit code segment size (high 16 bits) regs->esi = 0xfff0fff0; regs->dx = SEG_BIOS; // data segment address regs->di = 0xfff0; // data segment length set_success(regs); }
/** \brief Implements the get_cluster_name command * * Just return the current cluster name */ static void cluster_get_cluster_name(int thr_nb, void *dummy, cl_error_desc_t *err_desc) { if (!adm_cluster.created) { set_error(err_desc, -EXA_ERR_ADMIND_NOCONFIG, exa_error_msg(-EXA_ERR_ADMIND_NOCONFIG)); return; } send_payload_str(adm_cluster.name); set_success(err_desc); }
/** \brief Implements the get_nodedisks command * * return availavble disks for cluster */ static void cluster_get_nodedisks(int thr_nb, void *dummy, cl_error_desc_t *err_desc) { char *buffer = NULL; buffer = rdev_get_path_list(err_desc); if (err_desc->code != EXA_SUCCESS) return; send_payload_str(buffer); os_free(buffer); set_success(err_desc); }
static void set_calibration_status (CalibArea *area) { GtkIconTheme *icon_theme; GtkIconInfo *icon_info; GdkRGBA white; icon_theme = gtk_icon_theme_get_default (); icon_info = gtk_icon_theme_lookup_icon (icon_theme, ICON_SUCCESS, ICON_SIZE, GTK_ICON_LOOKUP_USE_BUILTIN); if (icon_info == NULL) { g_warning ("Failed to find icon \"%s\"", ICON_SUCCESS); goto out; } gdk_rgba_parse (&white, "White"); area->icon_success = gtk_icon_info_load_symbolic (icon_info, &white, NULL, NULL, NULL, NULL, NULL); g_object_unref (icon_info); if (!area->icon_success) g_warning ("Failed to load icon \"%s\"", ICON_SUCCESS); out: area->success = finish (&area->calibrator, &area->axis, &area->swap); if (area->success && area->icon_success) { set_success (area); g_timeout_add (END_TIME, (GSourceFunc) draw_success_end_wait_callback, area); } else { on_delete_event (NULL, NULL, area); } }
static void cluster_get_license(int thr_nb, void *dummy, cl_error_desc_t *err_desc) { char *buffer; char path[OS_PATH_MAX]; exalog_debug("getlicense"); exa_env_make_path(path, sizeof(path), exa_env_cachedir(), ADM_LICENSE_FILE); buffer = adm_file_read_to_str(path, err_desc); if (buffer == NULL) return; send_payload_str(buffer); os_free(buffer); set_success(err_desc); }
/** * Return a new allocated array of list of paths allowed to be used on the * node or NULL if file is not found or an error occured while reading. * * WARNING this function allocates memory, and the returned buffer * MUST be freed by caller with os_free. * * @param[in:out] err_desc an error descriptor for output. * * @return a rdev_path_t array of NBMAX_DISKS_PER_NODE elements. */ static rdev_path_t *rdev_read_disk_conf_file(cl_error_desc_t *err_desc) { /* file is opened read only because the code in here is not supposed to * modify it. The only way to modify the RDEV_FILE is via an administative * action (edit the file) */ FILE *disk_list; rdev_path_t *disk_array = NULL, *it = NULL; char disk_conf_file[OS_PATH_MAX]; char line[EXA_MAXSIZE_DEVPATH + 2]; /* likely ends '\n\0' */ const char *conf_dir = NULL; OS_ASSERT(err_desc != NULL); /* note that conf_dir is afforded to end with FILE_SEP */ conf_dir = exa_env_nodeconfdir(); if (conf_dir == NULL) { set_error(err_desc, -EXA_ERR_BAD_INSTALL, "Environment key 'EXANODES_NODE_CONF_DIR' not set."); return NULL; } if (os_snprintf(disk_conf_file, sizeof(disk_conf_file), "%s" RDEV_FILE, conf_dir) >= sizeof(disk_conf_file)) { set_error(err_desc, -EXA_ERR_BAD_INSTALL, "Environment key 'EXANODES_NODE_CONF_DIR' too long."); return NULL; } disk_list = fopen(disk_conf_file, "r"); if (disk_list == NULL) { /* A non-existent file is not an error */ if (errno == ENOENT) set_success(err_desc); else set_error(err_desc, -errno, "File " RDEV_FILE " cannot be read: %s (%d)", os_strerror(errno), -errno); return NULL; } /* prepare array */ disk_array = os_malloc(sizeof(rdev_path_t) * NBMAX_DISKS_PER_NODE); for (it = disk_array; it < disk_array + NBMAX_DISKS_PER_NODE; it++) it->path[0] = '\0'; for (it = disk_array; it < disk_array + NBMAX_DISKS_PER_NODE; it++) { char *ptr = fgets(line, sizeof(line), disk_list); size_t len; if (ptr == NULL) break; /* remove final '\n'*/ len = strlen(line); if (line[len - 1] == '\n') line[len - 1] = '\0'; os_str_trim_right(line); /* FIXME no check if disk name is truncated here */ os_strlcpy(it->path, line, EXA_MAXSIZE_DEVPATH + 1); } /* too many lines in the file -> error */ if (it == disk_array + NBMAX_DISKS_PER_NODE && fgets(line, sizeof(line), disk_list) != NULL) { os_free(disk_array); fclose(disk_list); set_error(err_desc, -EINVAL, "Too many entries in " RDEV_FILE "."); return NULL; } fclose(disk_list); set_success(err_desc); return disk_array; }
/** \brief Implements the fscreate command * * - Set nodes started and stopped. * - Set nodes mounted and unmounted. * - Add it to the config tree with status NOK * - This command runs the FS-specific check and create command: creation * of new volumes is done through specific FS function * - Update status to OK in the config file. */ static void cluster_fscreate(int thr_nb, void *data, cl_error_desc_t *err_desc) { struct fscreate_params *fs_param = data; int error_val = EXA_SUCCESS, error_delete; struct adm_volume *volume; struct adm_group *group; fs_data_t new_fs; const fs_definition_t *fs_definition; struct vrt_volume_info volume_info; exalog_info("received fscreate '%s:%s' " "--mountpoint='%s' --type='%s' --size=%" PRIu64 " --rg-size=%" PRIu64, fs_param->group_name, fs_param->volume_name, fs_param->mountpoint, fs_param->type, fs_param->sizeKB, fs_param->rg_sizeM); /* Check the license status to send warnings/errors */ cmd_check_license_status(); /* This is a workaround for bug #4600. */ if (fs_param->sizeKB % 4 != 0) { set_error(err_desc, -EXA_ERR_INVALID_PARAM, "Size must be a multiple of 4KiB"); return; } group = adm_group_get_group_by_name(fs_param->group_name); if (group == NULL) { set_error(err_desc, -ADMIND_ERR_UNKNOWN_GROUPNAME, NULL, fs_param->group_name); return; } /* The volume MUST NOT exist */ if (adm_cluster_get_volume_by_name(group->name, fs_param->volume_name)) { set_error(err_desc, -EXA_ERR_INVALID_PARAM, "A file system or a volume with this name already exists"); return; } fs_definition = fs_get_definition(fs_param->type); if (!fs_definition) { set_error(err_desc, -EXA_ERR_INVALID_PARAM, "Unknown file system type"); return; } /* FIXME use cluster_vlcreate in place of vrt_master_volume_create */ error_val = vrt_master_volume_create(thr_nb, group, fs_param->volume_name, EXPORT_BDEV, fs_param->sizeKB, fs_definition->is_volume_private(), adm_cluster_get_param_int("default_readahead")); if (error_val != EXA_SUCCESS) goto volume_delete; /* get the newly create volume */ volume = adm_group_get_volume_by_name(group, fs_param->volume_name); /* Ask the vrt for the real size because "-s max" uses a size of "0" */ if ((error_val = vrt_client_volume_info(adm_wt_get_localmb(), &group->uuid, &volume->uuid, &volume_info)) != EXA_SUCCESS) { goto volume_delete; } /* fill the structure with informations retrieved from the vrt */ memset(&new_fs, 0, sizeof(new_fs)); strlcpy(new_fs.fstype, fs_param->type, sizeof(new_fs.fstype)); strlcpy(new_fs.mountpoint, fs_param->mountpoint, sizeof(new_fs.mountpoint)); new_fs.sizeKB = volume_info.size; new_fs.volume_uuid = volume->uuid; new_fs.transaction = 0; adm_volume_path(new_fs.devpath, sizeof(new_fs.devpath), group->name, volume->name); /* Parse the filesystem-specific command parameters */ if (fs_definition->parse_fscreate_parameters) { error_val = fs_definition->parse_fscreate_parameters(&new_fs, fs_param->sfs_nb_logs, fs_param->rg_sizeM); if (error_val != EXA_SUCCESS) goto volume_delete; } /* Write to tree, with INPROGRESS status */ error_val = fs_update_tree(thr_nb, &new_fs); if (error_val != EXA_SUCCESS) goto volume_delete; exalog_debug("Set FS tree to NOK successfully"); /* Perform clustered preparation specific to fs type */ if (fs_definition->pre_create_fs) { error_val = fs_definition->pre_create_fs(thr_nb, &new_fs); if (error_val != EXA_SUCCESS) goto volume_delete; } /* Really create */ error_val = pre_local_create_fs(thr_nb, &new_fs); if (error_val != EXA_SUCCESS) goto volume_delete; exalog_debug("Created FS successfully"); /* Set transaction to COMMITTED */ new_fs.transaction = 1; error_val = fs_update_tree(thr_nb, &new_fs); if (error_val != EXA_SUCCESS) goto volume_delete; exalog_debug("Set FS tree to COMMITTED successfully"); set_success(err_desc); return; volume_delete: /* retrieve the volume the was supposed to be created */ volume = adm_group_get_volume_by_name(group, fs_param->volume_name); if (error_val == -ADMIND_ERR_NODE_DOWN || error_val == -ADMIND_ERR_METADATA_CORRUPTION || !volume) { set_error(err_desc, error_val, NULL); return; } /* Try to remove the volume in the config file. If this fails * for any reason, silently ignore the error: the FS is rolled * back to an invalid status and cannot be started. The only way * out is to fsdelete it. */ error_delete = vrt_master_volume_delete(thr_nb, volume, false); if (error_delete != EXA_SUCCESS) { exalog_error("Cannot delete file system: %s", exa_error_msg(error_delete)); } set_error(err_desc, error_val, NULL); return; }
// APM cpu idle static void handle_155305(struct bregs *regs) { wait_irq(); set_success(regs); }
// APM interface disconnect static void handle_155304(struct bregs *regs) { set_success(regs); }