Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 9251
b: refs/heads/master
c: fac97ae
h: refs/heads/master
i:
  9249: aa44437
  9247: c512290
v: v3
  • Loading branch information
Paolo 'Blaisorblade' Giarrusso authored and Linus Torvalds committed Sep 23, 2005
1 parent cdbc5d6 commit 8eafb29
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 79ae2cb856ed6a8c48f455d52d5ed5960c671e67
refs/heads/master: fac97ae0b1a206e2952baf1f9eb46305d673adc6
58 changes: 42 additions & 16 deletions trunk/arch/um/drivers/chan_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,69 +19,95 @@
#include "line.h"
#include "os.h"

#ifdef CONFIG_NOCONFIG_CHAN
/* XXX: could well be moved to somewhere else, if needed. */
static int my_printf(const char * fmt, ...)
__attribute__ ((format (printf, 1, 2)));

static int my_printf(const char * fmt, ...)
{
/* Yes, can be called on atomic context.*/
char *buf = kmalloc(4096, GFP_ATOMIC);
va_list args;
int r;

if (!buf) {
/* We print directly fmt.
* Yes, yes, yes, feel free to complain. */
r = strlen(fmt);
} else {
va_start(args, fmt);
r = vsprintf(buf, fmt, args);
va_end(args);
fmt = buf;
}

/* The printk's here are wrong because we are complaining that there is no
* output device, but printk is printing to that output device. The user will
* never see the error. printf would be better, except it can't run on a
* kernel stack because it will overflow it.
* Use printk for now since that will avoid crashing.
*/
if (r)
r = os_write_file(1, fmt, r);
return r;

}

#ifdef CONFIG_NOCONFIG_CHAN
/* Despite its name, there's no added trailing newline. */
static int my_puts(const char * buf)
{
return os_write_file(1, buf, strlen(buf));
}

static void *not_configged_init(char *str, int device, struct chan_opts *opts)
{
printk(KERN_ERR "Using a channel type which is configured out of "
my_puts("Using a channel type which is configured out of "
"UML\n");
return(NULL);
}

static int 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 "
my_puts("Using a channel type which is configured out of "
"UML\n");
return(-ENODEV);
}

static void not_configged_close(int fd, void *data)
{
printk(KERN_ERR "Using a channel type which is configured out of "
my_puts("Using a channel type which is configured out of "
"UML\n");
}

static int not_configged_read(int fd, char *c_out, void *data)
{
printk(KERN_ERR "Using a channel type which is configured out of "
my_puts("Using a channel type which is configured out of "
"UML\n");
return(-EIO);
}

static int not_configged_write(int fd, const char *buf, int len, void *data)
{
printk(KERN_ERR "Using a channel type which is configured out of "
my_puts("Using a channel type which is configured out of "
"UML\n");
return(-EIO);
}

static int not_configged_console_write(int fd, const char *buf, int len,
void *data)
{
printk(KERN_ERR "Using a channel type which is configured out of "
my_puts("Using a channel type which is configured out of "
"UML\n");
return(-EIO);
}

static int not_configged_window_size(int fd, void *data, unsigned short *rows,
unsigned short *cols)
{
printk(KERN_ERR "Using a channel type which is configured out of "
my_puts("Using a channel type which is configured out of "
"UML\n");
return(-ENODEV);
}

static void not_configged_free(void *data)
{
printf(KERN_ERR "Using a channel type which is configured out of "
my_puts("Using a channel type which is configured out of "
"UML\n");
}

Expand Down Expand Up @@ -457,7 +483,7 @@ static struct chan *parse_chan(char *str, int pri, int device,
}
}
if(ops == NULL){
printk(KERN_ERR "parse_chan couldn't parse \"%s\"\n",
my_printf("parse_chan couldn't parse \"%s\"\n",
str);
return(NULL);
}
Expand Down

0 comments on commit 8eafb29

Please sign in to comment.