#ifdef CONFIG_NOCONFIG_CHAN staticvoid *not_configged_init(char *str, int device, conststruct chan_opts *opts)
{
printk(KERN_ERR "Using a channel type which is configured out of " "UML\n"); return NULL;
}
staticint not_configged_open(int input, int output, int primary, void *data, char **dev_out)
{
printk(KERN_ERR "Using a channel type which is configured out of " "UML\n"); return -ENODEV;
}
staticvoid not_configged_close(int fd, void *data)
{
printk(KERN_ERR "Using a channel type which is configured out of " "UML\n");
}
staticint not_configged_read(int fd, u8 *c_out, void *data)
{
printk(KERN_ERR "Using a channel type which is configured out of " "UML\n"); return -EIO;
}
staticint not_configged_write(int fd, const u8 *buf, size_t len, void *data)
{
printk(KERN_ERR "Using a channel type which is configured out of " "UML\n"); return -EIO;
}
staticint not_configged_console_write(int fd, constchar *buf, int len)
{
printk(KERN_ERR "Using a channel type which is configured out of " "UML\n"); return -EIO;
}
staticint not_configged_window_size(int fd, void *data, unsignedshort *rows, unsignedshort *cols)
{
printk(KERN_ERR "Using a channel type which is configured out of " "UML\n"); return -ENODEV;
}
staticvoid not_configged_free(void *data)
{
printk(KERN_ERR "Using a channel type which is configured out of " "UML\n");
}
err = os_set_fd_block(fd, 0); if (err) goto out_close;
chan->fd_in = fd;
chan->fd_out = fd;
/* * In time-travel modes infinite-CPU and external we need to guarantee * that any writes to the output succeed immdiately from the point of * the VM. The best way to do this is to put the FD in blocking mode * and simply wait/retry until everything is written. * As every write is guaranteed to complete, we also do not need to * request an IRQ for the output. * * Note that input cannot happen in a time synchronized way. We permit * it, but time passes very quickly if anything waits for a read.
*/ if (chan->output && need_output_blocking()) {
err = os_dup_file(chan->fd_out); if (err < 0) goto out_close;
if (!line->throttled)
chan_interrupt(line, line->read_irq);
}
int enable_chan(struct line *line)
{ struct list_head *ele; struct chan *chan; int err;
INIT_DELAYED_WORK(&line->task, line_timer_cb);
list_for_each(ele, &line->chan_list) {
chan = list_entry(ele, struct chan, list);
err = open_one_chan(chan); if (err) { if (chan->primary) goto out_close;
continue;
}
if (chan->enabled) continue;
err = line_setup_irq(chan->fd_in, chan->input,
chan->output && !need_output_blocking(),
line, chan); if (err) goto out_close;
chan->enabled = 1;
}
return 0;
out_close:
close_chan(line); return err;
}
/* Items are added in IRQ context, when free_irq can't be called, and * removed in process context, when it can. * This handles interrupt sources which disappear, and which need to * be permanently disabled. This is discovered in IRQ context, but * the freeing of the IRQ must be done later.
*/ static DEFINE_RAW_SPINLOCK(irqs_to_free_lock); static LIST_HEAD(irqs_to_free);
void close_chan(struct line *line)
{ struct chan *chan;
/* Close in reverse order as open in case more than one of them * refers to the same device and they save and restore that device's * state. Then, the first one opened will have the original state, * so it must be the last closed.
*/
list_for_each_entry_reverse(chan, &line->chan_list, list) {
close_one_chan(chan, 0);
}
}
void deactivate_chan(struct chan *chan, int irq)
{ if (chan && chan->enabled)
deactivate_fd(chan->fd_in, irq);
}
int write_chan(struct chan *chan, const u8 *buf, size_t len, int write_irq)
{ int n, ret = 0;
if (len == 0 || !chan || !chan->ops->write) return 0;
n = chan->ops->write(chan->fd_out, buf, len, chan->data); if (chan->primary) {
ret = n;
} return ret;
}
int console_write_chan(struct chan *chan, constchar *buf, int len)
{ int n, ret = 0;
if (!chan || !chan->ops->console_write) return 0;
n = chan->ops->console_write(chan->fd_out, buf, len); if (chan->primary)
ret = n; return ret;
}
int console_open_chan(struct line *line, struct console *co)
{ int err;
err = open_chan(&line->chan_list); if (err) return err;
printk(KERN_INFO "Console initialized on /dev/%s%d\n", co->name,
co->index); return 0;
}
int chan_window_size(struct line *line, unsignedshort *rows_out, unsignedshort *cols_out)
{ struct chan *chan;
out = strchr(str, ','); if (out != NULL) {
in = str;
*out = '\0';
out++; new = parse_chan(line, in, device, opts, error_out); if (new == NULL) return -1;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.