type
stringclasses
5 values
content
stringlengths
9
163k
functions
void cfq_init_icq(struct io_cq *icq) { struct cfq_io_cq *cic = icq_to_cic(icq); cic->ttime.last_end_request = jiffies; }
functions
void cfq_exit_icq(struct io_cq *icq) { struct cfq_io_cq *cic = icq_to_cic(icq); struct cfq_data *cfqd = cic_to_cfqd(cic); if (cic->cfqq[BLK_RW_ASYNC]) { cfq_exit_cfqq(cfqd, cic->cfqq[BLK_RW_ASYNC]); cic->cfqq[BLK_RW_ASYNC] = NULL; }
functions
void cfq_init_prio_data(struct cfq_queue *cfqq, struct cfq_io_cq *cic) { struct task_struct *tsk = current; int ioprio_class; if (!cfq_cfqq_prio_changed(cfqq)) return; ioprio_class = IOPRIO_PRIO_CLASS(cic->ioprio); switch (ioprio_class) { default: printk(KERN_ERR "cfq: bad prio %x\n", ioprio_class); case I...
functions
void check_ioprio_changed(struct cfq_io_cq *cic, struct bio *bio) { int ioprio = cic->icq.ioc->ioprio; struct cfq_data *cfqd = cic_to_cfqd(cic); struct cfq_queue *cfqq; /* * Check whether ioprio has changed. The condition may trigger * spuriously on a newly created cic but there's no harm. */ if (unlikely(...
functions
void cfq_init_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq, pid_t pid, bool is_sync) { RB_CLEAR_NODE(&cfqq->rb_node); RB_CLEAR_NODE(&cfqq->p_node); INIT_LIST_HEAD(&cfqq->fifo); cfqq->ref = 0; cfqq->cfqd = cfqd; cfq_mark_cfqq_prio_changed(cfqq); if (is_sync) { if (!cfq_class_idle(cfqq)) cfq_mar...
functions
void check_blkcg_changed(struct cfq_io_cq *cic, struct bio *bio) { struct cfq_data *cfqd = cic_to_cfqd(cic); struct cfq_queue *sync_cfqq; uint64_t id; rcu_read_lock(); id = bio_blkcg(bio)->id; rcu_read_unlock(); /* * Check whether blkcg has changed. The condition may trigger * spuriously on a newly create...
functions
void check_blkcg_changed(struct cfq_io_cq *cic, struct bio *bio) { }
functions
else if (gfp_mask & __GFP_WAIT) { rcu_read_unlock(); spin_unlock_irq(cfqd->queue->queue_lock); new_cfqq = kmem_cache_alloc_node(cfq_pool, gfp_mask | __GFP_ZERO, cfqd->queue->node); spin_lock_irq(cfqd->queue->queue_lock); if (new_cfqq) goto retry; else return &cfqd->oom_cfqq; }
functions
void __cfq_update_io_thinktime(struct cfq_ttime *ttime, unsigned long slice_idle) { unsigned long elapsed = jiffies - ttime->last_end_request; elapsed = min(elapsed, 2UL * slice_idle); ttime->ttime_samples = (7*ttime->ttime_samples + 256) / 8; ttime->ttime_total = (7*ttime->ttime_total + 256*elapsed) / 8; ttime->...
functions
void cfq_update_io_thinktime(struct cfq_data *cfqd, struct cfq_queue *cfqq, struct cfq_io_cq *cic) { if (cfq_cfqq_sync(cfqq)) { __cfq_update_io_thinktime(&cic->ttime, cfqd->cfq_slice_idle); __cfq_update_io_thinktime(&cfqq->service_tree->ttime, cfqd->cfq_slice_idle); }
functions
void cfq_update_io_seektime(struct cfq_data *cfqd, struct cfq_queue *cfqq, struct request *rq) { sector_t sdist = 0; sector_t n_sec = blk_rq_sectors(rq); if (cfqq->last_request_pos) { if (cfqq->last_request_pos < blk_rq_pos(rq)) sdist = blk_rq_pos(rq) - cfqq->last_request_pos; else sdist = cfqq->l...
functions
void cfq_update_idle_window(struct cfq_data *cfqd, struct cfq_queue *cfqq, struct cfq_io_cq *cic) { int old_idle, enable_idle; /* * Don't idle for async or idle io prio class */ if (!cfq_cfqq_sync(cfqq) || cfq_class_idle(cfqq)) return; enable_idle = old_idle = cfq_cfqq_idle_window(cfqq); if (cfqq...
functions
bool cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq, struct request *rq) { struct cfq_queue *cfqq; cfqq = cfqd->active_queue; if (!cfqq) return false; if (cfq_class_idle(new_cfqq)) return false; if (cfq_class_idle(cfqq)) return true; /* * Don't allow a non-RT request to pree...
functions
void cfq_preempt_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq) { enum wl_type_t old_type = cfqq_type(cfqd->active_queue); cfq_log_cfqq(cfqd, cfqq, "preempt"); cfq_slice_expired(cfqd, 1); /* * workload type is changed, don't save slice, otherwise preempt * doesn't happen */ if (old_type != cfqq_type(...
functions
void cfq_rq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq, struct request *rq) { struct cfq_io_cq *cic = RQ_CIC(rq); cfqd->rq_queued++; if (rq->cmd_flags & REQ_PRIO) cfqq->prio_pending++; cfq_update_io_thinktime(cfqd, cfqq, cic); cfq_update_io_seektime(cfqd, cfqq, rq); cfq_update_idle_window(cfqd, ...
functions
void cfq_insert_request(struct request_queue *q, struct request *rq) { struct cfq_data *cfqd = q->elevator->elevator_data; struct cfq_queue *cfqq = RQ_CFQQ(rq); cfq_log_cfqq(cfqd, cfqq, "insert_request"); cfq_init_prio_data(cfqq, RQ_CIC(rq)); rq_set_fifo_time(rq, jiffies + cfqd->cfq_fifo_expire[rq_is_sync(rq)]);...
functions
void cfq_update_hw_tag(struct cfq_data *cfqd) { struct cfq_queue *cfqq = cfqd->active_queue; if (cfqd->rq_in_driver > cfqd->hw_tag_est_depth) cfqd->hw_tag_est_depth = cfqd->rq_in_driver; if (cfqd->hw_tag == 1) return; if (cfqd->rq_queued <= CFQ_HW_QUEUE_MIN && cfqd->rq_in_driver <= CFQ_HW_QUEUE_MIN) r...
functions
bool cfq_should_wait_busy(struct cfq_data *cfqd, struct cfq_queue *cfqq) { struct cfq_io_cq *cic = cfqd->active_cic; /* If the queue already has requests, don't wait */ if (!RB_EMPTY_ROOT(&cfqq->sort_list)) return false; /* If there are other queues in the group, don't wait */ if (cfqq->cfqg->nr_cfqq > 1) re...
functions
void cfq_completed_request(struct request_queue *q, struct request *rq) { struct cfq_queue *cfqq = RQ_CFQQ(rq); struct cfq_data *cfqd = cfqq->cfqd; const int sync = rq_is_sync(rq); unsigned long now; now = jiffies; cfq_log_cfqq(cfqd, cfqq, "complete rqnoidle %d", !!(rq->cmd_flags & REQ_NOIDLE)); cfq_upd...
functions
int __cfq_may_queue(struct cfq_queue *cfqq) { if (cfq_cfqq_wait_request(cfqq) && !cfq_cfqq_must_alloc_slice(cfqq)) { cfq_mark_cfqq_must_alloc_slice(cfqq); return ELV_MQUEUE_MUST; }
functions
int cfq_may_queue(struct request_queue *q, int rw) { struct cfq_data *cfqd = q->elevator->elevator_data; struct task_struct *tsk = current; struct cfq_io_cq *cic; struct cfq_queue *cfqq; /* * don't force setup of a queue from here, as a call to may_queue * does not necessarily imply that a request actually wi...
functions
void cfq_put_request(struct request *rq) { struct cfq_queue *cfqq = RQ_CFQQ(rq); if (cfqq) { const int rw = rq_data_dir(rq); BUG_ON(!cfqq->allocated[rw]); cfqq->allocated[rw]--; /* Put down rq reference on cfqg */ cfqg_put(RQ_CFQG(rq)); rq->elv.priv[0] = NULL; rq->elv.priv[1] = NULL; cfq_put_queue...
functions
int cfq_set_request(struct request_queue *q, struct request *rq, struct bio *bio, gfp_t gfp_mask) { struct cfq_data *cfqd = q->elevator->elevator_data; struct cfq_io_cq *cic = icq_to_cic(rq->elv.icq); const int rw = rq_data_dir(rq); const bool is_sync = rq_is_sync(rq); struct cfq_queue *cfqq; might_sleep_if(gf...
functions
void cfq_kick_queue(struct work_struct *work) { struct cfq_data *cfqd = container_of(work, struct cfq_data, unplug_work); struct request_queue *q = cfqd->queue; spin_lock_irq(q->queue_lock); __blk_run_queue(cfqd->queue); spin_unlock_irq(q->queue_lock); }
functions
void cfq_idle_slice_timer(unsigned long data) { struct cfq_data *cfqd = (struct cfq_data *) data; struct cfq_queue *cfqq; unsigned long flags; int timed_out = 1; cfq_log(cfqd, "idle timer fired"); spin_lock_irqsave(cfqd->queue->queue_lock, flags); cfqq = cfqd->active_queue; if (cfqq) { timed_out = 0; /*...
functions
void cfq_shutdown_timer_wq(struct cfq_data *cfqd) { del_timer_sync(&cfqd->idle_slice_timer); cancel_work_sync(&cfqd->unplug_work); }
functions
void cfq_put_async_queues(struct cfq_data *cfqd) { int i; for (i = 0; i < IOPRIO_BE_NR; i++) { if (cfqd->async_cfqq[0][i]) cfq_put_queue(cfqd->async_cfqq[0][i]); if (cfqd->async_cfqq[1][i]) cfq_put_queue(cfqd->async_cfqq[1][i]); }
functions
void cfq_exit_queue(struct elevator_queue *e) { struct cfq_data *cfqd = e->elevator_data; struct request_queue *q = cfqd->queue; cfq_shutdown_timer_wq(cfqd); spin_lock_irq(q->queue_lock); if (cfqd->active_queue) __cfq_slice_expired(cfqd, cfqd->active_queue, 0); cfq_put_async_queues(cfqd); spin_unlock_irq(...
functions
int cfq_init_queue(struct request_queue *q, struct elevator_type *e) { struct cfq_data *cfqd; struct blkcg_gq *blkg __maybe_unused; int i, ret; struct elevator_queue *eq; eq = elevator_alloc(q, e); if (!eq) return -ENOMEM; cfqd = kzalloc_node(sizeof(*cfqd), GFP_KERNEL, q->node); if (!cfqd) { kobject_put(&...
functions
void cfq_registered_queue(struct request_queue *q) { struct elevator_queue *e = q->elevator; struct cfq_data *cfqd = e->elevator_data; /* * Default to IOPS mode with no idling for SSDs */ if (blk_queue_nonrot(q)) cfqd->cfq_slice_idle = 0; }
functions
ssize_t cfq_var_show(unsigned int var, char *page) { return sprintf(page, "%d\n", var); }
functions
ssize_t cfq_var_store(unsigned int *var, const char *page, size_t count) { char *p = (char *) page; *var = simple_strtoul(p, &p, 10); return count; }
functions
__init cfq_init(void) { int ret; /* * could be 0 on HZ < 1000 setups */ if (!cfq_slice_async) cfq_slice_async = 1; if (!cfq_slice_idle) cfq_slice_idle = 1; #ifdef CONFIG_CFQ_GROUP_IOSCHED if (!cfq_group_idle) cfq_group_idle = 1; ret = blkcg_policy_register(&blkcg_policy_cfq); if (ret) return ret; ...
functions
__exit cfq_exit(void) { #ifdef CONFIG_CFQ_GROUP_IOSCHED blkcg_policy_unregister(&blkcg_policy_cfq); #endif elv_unregister(&iosched_cfq); kmem_cache_destroy(cfq_pool); }
includes
#include <unistd.h>
includes
#include <fcntl.h>
includes
#include <signal.h>
includes
#include <time.h>
includes
#include <errno.h>
includes
#include <sys/time.h>
includes
#include <libvdeplug.h>
includes
#include <SDL.h>
includes
#include <glib.h>
defines
#define main qemu_main
defines
#define main qemu_main
defines
#define DEFAULT_RAM_SIZE 128
defines
#define MAX_VIRTIO_CONSOLES 1
defines
#define MAX_SCLP_CONSOLES 1
defines
#define HD_OPTS "media=disk"
defines
#define CDROM_OPTS "media=cdrom"
defines
#define FD_OPTS ""
defines
#define PFLASH_OPTS ""
defines
#define MTD_OPTS ""
defines
#define SD_OPTS ""
defines
#define QEMU_OPTIONS_GENERATE_HELP
defines
#define HAS_ARG 0x0001
defines
#define QEMU_OPTIONS_GENERATE_OPTIONS
structs
struct vm_change_state_entry { VMChangeStateHandler *cb; void *opaque; QLIST_ENTRY (vm_change_state_entry) entries; };
functions
void res_free(void) { if (boot_splash_filedata != NULL) { g_free(boot_splash_filedata); boot_splash_filedata = NULL; }
functions
int default_driver_check(QemuOpts *opts, void *opaque) { const char *driver = qemu_opt_get(opts, "driver"); int i; if (!driver) return 0; for (i = 0; i < ARRAY_SIZE(default_list); i++) { if (strcmp(default_list[i].driver, driver) != 0) continue; *(default_list[i].fla...
functions
bool runstate_check(RunState state) { return current_run_state == state; }
functions
void runstate_init(void) { const RunStateTransition *p; memset(&runstate_valid_transitions, 0, sizeof(runstate_valid_transitions)); for (p = &runstate_transitions_def[0]; p->from != RUN_STATE_MAX; p++) { runstate_valid_transitions[p->from][p->to] = true; }
functions
void runstate_set(RunState new_state) { assert(new_state < RUN_STATE_MAX); if (!runstate_valid_transitions[current_run_state][new_state]) { fprintf(stderr, "ERROR: invalid runstate transition: '%s' -> '%s'\n", RunState_lookup[current_run_state], RunState_lookup[new_state...
functions
int runstate_is_running(void) { return runstate_check(RUN_STATE_RUNNING); }
functions
bool runstate_needs_reset(void) { return runstate_check(RUN_STATE_INTERNAL_ERROR) || runstate_check(RUN_STATE_SHUTDOWN); }
functions
bool qemu_vmstop_requested(RunState *r) { qemu_mutex_lock(&vmstop_lock); *r = vmstop_requested; vmstop_requested = RUN_STATE_MAX; qemu_mutex_unlock(&vmstop_lock); return *r < RUN_STATE_MAX; }
functions
void qemu_system_vmstop_request_prepare(void) { qemu_mutex_lock(&vmstop_lock); }
functions
void qemu_system_vmstop_request(RunState state) { vmstop_requested = state; qemu_mutex_unlock(&vmstop_lock); qemu_notify_event(); }
functions
void vm_start(void) { RunState requested; qemu_vmstop_requested(&requested); if (runstate_is_running() && requested == RUN_STATE_MAX) { return; }
functions
void qemu_get_timedate(struct tm *tm, int offset) { time_t ti; time(&ti); ti += offset; if (rtc_date_offset == -1) { if (rtc_utc) gmtime_r(&ti, tm); else localtime_r(&ti, tm); }
functions
int qemu_timedate_diff(struct tm *tm) { time_t seconds; if (rtc_date_offset == -1) if (rtc_utc) seconds = mktimegm(tm); else { struct tm tmp = *tm; tmp.tm_isdst = -1; /* use timezone to figure it out */ seconds = mktime(&tmp); }
functions
void configure_rtc_date_offset(const char *startdate, int legacy) { time_t rtc_start_date; struct tm tm; if (!strcmp(startdate, "now") && legacy) { rtc_date_offset = -1; }
functions
void configure_rtc(QemuOpts *opts) { const char *value; value = qemu_opt_get(opts, "base"); if (value) { if (!strcmp(value, "utc")) { rtc_utc = 1; }
functions
int bt_hci_parse(const char *str) { struct HCIInfo *hci; bdaddr_t bdaddr; if (nb_hcis >= MAX_NICS) { fprintf(stderr, "qemu: Too many bluetooth HCIs (max %i).\n", MAX_NICS); return -1; }
functions
void bt_vhci_add(int vlan_id) { struct bt_scatternet_s *vlan = qemu_find_bt_vlan(vlan_id); if (!vlan->slave) fprintf(stderr, "qemu: warning: adding a VHCI to " "an empty scatternet %i\n", vlan_id); bt_vhci_init(bt_new_hci(vlan)); }
functions
int bt_parse(const char *opt) { const char *endp, *p; int vlan; if (strstart(opt, "hci", &endp)) { if (!*endp || *endp == ',') { if (*endp) if (!strstart(endp, ",vlan=", 0)) opt = endp + 1; return bt_hci_parse(opt); }
functions
int parse_sandbox(QemuOpts *opts, void *opaque) { /* FIXME: change this to true for 1.3 */ if (qemu_opt_get_bool(opts, "enable", false)) { #ifdef CONFIG_SECCOMP if (seccomp_start() < 0) { qerror_report(ERROR_CLASS_GENERIC_ERROR, "failed to install seccomp syscall fi...
functions
int parse_name(QemuOpts *opts, void *opaque) { const char *proc_name; if (qemu_opt_get(opts, "debug-threads")) { qemu_thread_naming(qemu_opt_get_bool(opts, "debug-threads", false)); }
functions
bool usb_enabled(bool default_usb) { return qemu_opt_get_bool(qemu_get_machine_opts(), "usb", has_defaults && default_usb); }
functions
int parse_add_fd(QemuOpts *opts, void *opaque) { int fd, dupfd, flags; int64_t fdset_id; const char *fd_opaque = NULL; fd = qemu_opt_get_number(opts, "fd", -1); fdset_id = qemu_opt_get_number(opts, "set", -1); fd_opaque = qemu_opt_get(opts, "opaque"); if (fd < 0) { qerror_report(ER...
functions
endif if (dupfd == -1) { qerror_report(ERROR_CLASS_GENERIC_ERROR, "Error duplicating fd: %s", strerror(errno)); return -1; }
functions
int cleanup_add_fd(QemuOpts *opts, void *opaque) { int fd; fd = qemu_opt_get_number(opts, "fd", -1); close(fd); return 0; }
functions
int drive_init_func(QemuOpts *opts, void *opaque) { BlockInterfaceType *block_default_type = opaque; return drive_new(opts, *block_default_type) == NULL; }
functions
int drive_enable_snapshot(QemuOpts *opts, void *opaque) { if (qemu_opt_get(opts, "snapshot") == NULL) { qemu_opt_set(opts, "snapshot", "on"); }
functions
void default_drive(int enable, int snapshot, BlockInterfaceType type, int index, const char *optstr) { QemuOpts *opts; DriveInfo *dinfo; if (!enable || drive_get_by_index(type, index)) { return; }
functions
void qemu_register_boot_set(QEMUBootSetHandler *func, void *opaque) { boot_set_handler = func; boot_set_opaque = opaque; }
functions
int qemu_boot_set(const char *boot_order) { if (!boot_set_handler) { return -EINVAL; }
functions
void validate_bootdevices(const char *devices) { /* We just do some generic consistency checks */ const char *p; int bitmap = 0; for (p = devices; *p != '\0'; p++) { /* Allowed boot devices are: * a-b: floppy disk drives * c-f: IDE disk drives * g-m: machine implement...
functions
void restore_boot_order(void *opaque) { char *normal_boot_order = opaque; static int first = 1; /* Restore boot order and remove ourselves after the first boot */ if (first) { first = 0; return; }
functions
void smp_parse(QemuOpts *opts) { if (opts) { unsigned cpus = qemu_opt_get_number(opts, "cpus", 0); unsigned sockets = qemu_opt_get_number(opts, "sockets", 0); unsigned cores = qemu_opt_get_number(opts, "cores", 0); unsigned threads = qemu_opt_get_number(opts, "threads", 0); ...
functions
void realtime_init(void) { if (enable_mlock) { if (os_mlock() < 0) { fprintf(stderr, "qemu: locking memory failed\n"); exit(1); }
functions
void configure_msg(QemuOpts *opts) { enable_timestamp_msg = qemu_opt_get_bool(opts, "timestamp", true); }
functions
int usb_device_add(const char *devname) { USBDevice *dev = NULL; #ifndef CONFIG_LINUX const char *p; #endif if (!usb_enabled(false)) { return -1; }
functions
int usb_device_del(const char *devname) { int bus_num, addr; const char *p; if (strstart(devname, "host:", &p)) { return -1; }
functions
int usb_parse(const char *cmdline) { int r; r = usb_device_add(cmdline); if (r < 0) { fprintf(stderr, "qemu: could not add USB device '%s'\n", cmdline); }
functions
void do_usb_add(Monitor *mon, const QDict *qdict) { const char *devname = qdict_get_str(qdict, "devname"); if (usb_device_add(devname) < 0) { error_report("could not add USB device '%s'", devname); }
functions
void do_usb_del(Monitor *mon, const QDict *qdict) { const char *devname = qdict_get_str(qdict, "devname"); if (usb_device_del(devname) < 0) { error_report("could not delete USB device '%s'", devname); }
functions
void machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); QEMUMachine *qm = data; mc->family = qm->family; mc->name = qm->name; mc->alias = qm->alias; mc->desc = qm->desc; mc->init = qm->init; mc->reset = qm->reset; mc->hot_add_cpu = qm->hot_add_cp...
functions
int qemu_register_machine(QEMUMachine *m) { char *name = g_strconcat(m->name, TYPE_MACHINE_SUFFIX, NULL); TypeInfo ti = { .name = name, .parent = TYPE_MACHINE, .class_init = machine_class_init, .class_data = (void *)m, }
functions
void qemu_del_vm_change_state_handler(VMChangeStateEntry *e) { QLIST_REMOVE (e, entries); g_free (e); }