Commit cb8fa61c authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

uml: arch/um/drivers formatting

Style fixes for the rest of the drivers.  arch/um/drivers should be pretty
CodingStyle-compliant now.

Except for the ubd driver, which will have to be treated separately.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: default avatarJeff Dike <jdike@linux.intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 54ae36f2
/*
/*
* Copyright (C) 2000 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com)
* Licensed under the GPL
*/
......@@ -82,17 +82,21 @@ int generic_console_write(int fd, const char *buf, int n)
if (err)
goto error;
new = save;
/* The terminal becomes a bit less raw, to handle \n also as
/*
* The terminal becomes a bit less raw, to handle \n also as
* "Carriage Return", not only as "New Line". Otherwise, the new
* line won't start at the first column.*/
* line won't start at the first column.
*/
new.c_oflag |= OPOST;
CATCH_EINTR(err = tcsetattr(fd, TCSAFLUSH, &new));
if (err)
goto error;
}
err = generic_write(fd, buf, n, NULL);
/* Restore raw mode, in any case; we *must* ignore any error apart
* EINTR, except for debug.*/
/*
* Restore raw mode, in any case; we *must* ignore any error apart
* EINTR, except for debug.
*/
if (isatty(fd))
CATCH_EINTR(tcsetattr(fd, TCSAFLUSH, &save));
return err;
......@@ -167,13 +171,13 @@ static int winch_thread(void *arg)
exit(1);
}
if(ioctl(pty_fd, TIOCSCTTY, 0) < 0){
if (ioctl(pty_fd, TIOCSCTTY, 0) < 0) {
printk(UM_KERN_ERR "winch_thread : TIOCSCTTY failed on "
"fd %d err = %d\n", pty_fd, errno);
exit(1);
}
if(tcsetpgrp(pty_fd, os_getpid()) < 0){
if (tcsetpgrp(pty_fd, os_getpid()) < 0) {
printk(UM_KERN_ERR "winch_thread : tcsetpgrp failed on "
"fd %d err = %d\n", pty_fd, errno);
exit(1);
......
This diff is collapsed.
/*
/*
* Copyright (C) 2001 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com)
* Licensed under the GPL
*/
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <termios.h>
#include <unistd.h>
#include "chan_user.h"
#include "kern_constants.h"
#include "os.h"
#include "um_malloc.h"
#include "user.h"
#include "os.h"
#include "kern_constants.h"
struct fd_chan {
int fd;
......@@ -42,7 +41,7 @@ static void *fd_init(char *str, int device, const struct chan_opts *opts)
}
data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
if(data == NULL)
if (data == NULL)
return NULL;
*data = ((struct fd_chan) { .fd = n,
......
/*
* Copyright (C) 2002 Steve Schmidtke
/*
* Copyright (C) 2002 Steve Schmidtke
* Licensed under the GPL
*/
#include "linux/fs.h"
#include "linux/module.h"
#include "linux/init.h"
#include "linux/slab.h"
#include "linux/fs.h"
#include "linux/sound.h"
#include "linux/soundcard.h"
#include "asm/uaccess.h"
#include "kern_util.h"
#include "init.h"
#include "os.h"
......@@ -25,7 +23,8 @@ struct hostmixer_state {
#define HOSTAUDIO_DEV_DSP "/dev/sound/dsp"
#define HOSTAUDIO_DEV_MIXER "/dev/sound/mixer"
/* Changed either at boot time or module load time. At boot, this is
/*
* Changed either at boot time or module load time. At boot, this is
* single-threaded; at module load, multiple modules would each have
* their own copy of these variables.
*/
......@@ -44,7 +43,7 @@ static char *mixer = HOSTAUDIO_DEV_MIXER;
static int set_dsp(char *name, int *add)
{
dsp = name;
return(0);
return 0;
}
__uml_setup("dsp=", set_dsp, "dsp=<dsp device>\n" DSP_HELP);
......@@ -52,7 +51,7 @@ __uml_setup("dsp=", set_dsp, "dsp=<dsp device>\n" DSP_HELP);
static int set_mixer(char *name, int *add)
{
mixer = name;
return(0);
return 0;
}
__uml_setup("mixer=", set_mixer, "mixer=<mixer device>\n" MIXER_HELP);
......@@ -77,23 +76,23 @@ static ssize_t hostaudio_read(struct file *file, char __user *buffer,
int err;
#ifdef DEBUG
printk("hostaudio: read called, count = %d\n", count);
printk(KERN_DEBUG "hostaudio: read called, count = %d\n", count);
#endif
kbuf = kmalloc(count, GFP_KERNEL);
if(kbuf == NULL)
return(-ENOMEM);
if (kbuf == NULL)
return -ENOMEM;
err = os_read_file(state->fd, kbuf, count);
if(err < 0)
if (err < 0)
goto out;
if(copy_to_user(buffer, kbuf, err))
if (copy_to_user(buffer, kbuf, err))
err = -EFAULT;
out:
kfree(kbuf);
return(err);
return err;
}
static ssize_t hostaudio_write(struct file *file, const char __user *buffer,
......@@ -104,40 +103,40 @@ static ssize_t hostaudio_write(struct file *file, const char __user *buffer,
int err;
#ifdef DEBUG
printk("hostaudio: write called, count = %d\n", count);
printk(KERN_DEBUG "hostaudio: write called, count = %d\n", count);
#endif
kbuf = kmalloc(count, GFP_KERNEL);
if(kbuf == NULL)
return(-ENOMEM);
if (kbuf == NULL)
return -ENOMEM;
err = -EFAULT;
if(copy_from_user(kbuf, buffer, count))
if (copy_from_user(kbuf, buffer, count))
goto out;
err = os_write_file(state->fd, kbuf, count);
if(err < 0)
if (err < 0)
goto out;
*ppos += err;
out:
kfree(kbuf);
return(err);
return err;
}
static unsigned int hostaudio_poll(struct file *file,
static unsigned int hostaudio_poll(struct file *file,
struct poll_table_struct *wait)
{
unsigned int mask = 0;
#ifdef DEBUG
printk("hostaudio: poll called (unimplemented)\n");
printk(KERN_DEBUG "hostaudio: poll called (unimplemented)\n");
#endif
return(mask);
return mask;
}
static int hostaudio_ioctl(struct inode *inode, struct file *file,
static int hostaudio_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
struct hostaudio_state *state = file->private_data;
......@@ -145,7 +144,7 @@ static int hostaudio_ioctl(struct inode *inode, struct file *file,
int err;
#ifdef DEBUG
printk("hostaudio: ioctl called, cmd = %u\n", cmd);
printk(KERN_DEBUG "hostaudio: ioctl called, cmd = %u\n", cmd);
#endif
switch(cmd){
case SNDCTL_DSP_SPEED:
......@@ -154,8 +153,8 @@ static int hostaudio_ioctl(struct inode *inode, struct file *file,
case SNDCTL_DSP_CHANNELS:
case SNDCTL_DSP_SUBDIVIDE:
case SNDCTL_DSP_SETFRAGMENT:
if(get_user(data, (int __user *) arg))
return(-EFAULT);
if (get_user(data, (int __user *) arg))
return EFAULT;
break;
default:
break;
......@@ -170,14 +169,14 @@ static int hostaudio_ioctl(struct inode *inode, struct file *file,
case SNDCTL_DSP_CHANNELS:
case SNDCTL_DSP_SUBDIVIDE:
case SNDCTL_DSP_SETFRAGMENT:
if(put_user(data, (int __user *) arg))
return(-EFAULT);
if (put_user(data, (int __user *) arg))
return -EFAULT;
break;
default:
break;
}
return(err);
return err;
}
static int hostaudio_open(struct inode *inode, struct file *file)
......@@ -187,24 +186,26 @@ static int hostaudio_open(struct inode *inode, struct file *file)
int ret;
#ifdef DEBUG
printk("hostaudio: open called (host: %s)\n", dsp);
printk(KERN_DEBUG "hostaudio: open called (host: %s)\n", dsp);
#endif
state = kmalloc(sizeof(struct hostaudio_state), GFP_KERNEL);
if(state == NULL)
return(-ENOMEM);
if (state == NULL)
return -ENOMEM;
if(file->f_mode & FMODE_READ) r = 1;
if(file->f_mode & FMODE_WRITE) w = 1;
if (file->f_mode & FMODE_READ)
r = 1;
if (file->f_mode & FMODE_WRITE)
w = 1;
ret = os_open_file(dsp, of_set_rw(OPENFLAGS(), r, w), 0);
if(ret < 0){
if (ret < 0) {
kfree(state);
return(ret);
return ret;
}
state->fd = ret;
file->private_data = state;
return(0);
return 0;
}
static int hostaudio_release(struct inode *inode, struct file *file)
......@@ -212,26 +213,26 @@ static int hostaudio_release(struct inode *inode, struct file *file)
struct hostaudio_state *state = file->private_data;
#ifdef DEBUG
printk("hostaudio: release called\n");
printk(KERN_DEBUG "hostaudio: release called\n");
#endif
os_close_file(state->fd);
kfree(state);
return(0);
return 0;
}
/* /dev/mixer file operations */
static int hostmixer_ioctl_mixdev(struct inode *inode, struct file *file,
static int hostmixer_ioctl_mixdev(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
struct hostmixer_state *state = file->private_data;
#ifdef DEBUG
printk("hostmixer: ioctl called\n");
printk(KERN_DEBUG "hostmixer: ioctl called\n");
#endif
return(os_ioctl_generic(state->fd, cmd, arg));
return os_ioctl_generic(state->fd, cmd, arg);
}
static int hostmixer_open_mixdev(struct inode *inode, struct file *file)
......@@ -241,26 +242,29 @@ static int hostmixer_open_mixdev(struct inode *inode, struct file *file)
int ret;
#ifdef DEBUG
printk("hostmixer: open called (host: %s)\n", mixer);
printk(KERN_DEBUG "hostmixer: open called (host: %s)\n", mixer);
#endif
state = kmalloc(sizeof(struct hostmixer_state), GFP_KERNEL);
if(state == NULL) return(-ENOMEM);
if (state == NULL)
return -ENOMEM;
if(file->f_mode & FMODE_READ) r = 1;
if(file->f_mode & FMODE_WRITE) w = 1;
if (file->f_mode & FMODE_READ)
r = 1;
if (file->f_mode & FMODE_WRITE)
w = 1;
ret = os_open_file(mixer, of_set_rw(OPENFLAGS(), r, w), 0);
if(ret < 0){
printk("hostaudio_open_mixdev failed to open '%s', err = %d\n",
dsp, -ret);
if (ret < 0) {
printk(KERN_ERR "hostaudio_open_mixdev failed to open '%s', "
"err = %d\n", dsp, -ret);
kfree(state);
return(ret);
return ret;
}
file->private_data = state;
return(0);
return 0;
}
static int hostmixer_release(struct inode *inode, struct file *file)
......@@ -268,13 +272,13 @@ static int hostmixer_release(struct inode *inode, struct file *file)
struct hostmixer_state *state = file->private_data;
#ifdef DEBUG
printk("hostmixer: release called\n");
printk(KERN_DEBUG "hostmixer: release called\n");
#endif
os_close_file(state->fd);
kfree(state);
return(0);
return 0;
}
/* kernel module operations */
......@@ -314,13 +318,13 @@ static int __init hostaudio_init_module(void)
dsp, mixer);
module_data.dev_audio = register_sound_dsp(&hostaudio_fops, -1);
if(module_data.dev_audio < 0){
if (module_data.dev_audio < 0) {
printk(KERN_ERR "hostaudio: couldn't register DSP device!\n");
return -ENODEV;
}
module_data.dev_mixer = register_sound_mixer(&hostmixer_fops, -1);
if(module_data.dev_mixer < 0){
if (module_data.dev_mixer < 0) {
printk(KERN_ERR "hostmixer: couldn't register mixer "
"device!\n");
unregister_sound_dsp(module_data.dev_audio);
......
/*
* Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org)
* Copyright (C) 2001 - 2003 Jeff Dike (jdike@addtoit.com)
* Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL
*/
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/un.h>
#include <unistd.h>
#include "user.h"
#include "sysdep/ptrace.h"
#include "kern_constants.h"
#include "mconsole.h"
#include "os.h"
#include "user.h"
static struct mconsole_command commands[] = {
/* With uts namespaces, uts information becomes process-specific, so
/*
* With uts namespaces, uts information becomes process-specific, so
* we need a process context. If we try handling this in interrupt
* context, we may hit an exiting process without a valid uts
* namespace.
......@@ -36,7 +33,7 @@ static struct mconsole_command commands[] = {
{ "go", mconsole_go, MCONSOLE_INTR },
{ "log", mconsole_log, MCONSOLE_INTR },
{ "proc", mconsole_proc, MCONSOLE_PROC },
{ "stack", mconsole_stack, MCONSOLE_INTR },
{ "stack", mconsole_stack, MCONSOLE_INTR },
};
/* Initialized in mconsole_init, which is an initcall */
......@@ -44,21 +41,21 @@ char mconsole_socket_name[256];
int mconsole_reply_v0(struct mc_request *req, char *reply)
{
struct iovec iov;
struct msghdr msg;
struct iovec iov;
struct msghdr msg;
iov.iov_base = reply;
iov.iov_len = strlen(reply);
iov.iov_base = reply;
iov.iov_len = strlen(reply);
msg.msg_name = &(req->origin);
msg.msg_namelen = req->originlen;
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_control = NULL;
msg.msg_controllen = 0;
msg.msg_flags = 0;
msg.msg_name = &(req->origin);
msg.msg_namelen = req->originlen;
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_control = NULL;
msg.msg_controllen = 0;
msg.msg_flags = 0;
return sendmsg(req->originating_fd, &msg, 0);
return sendmsg(req->originating_fd, &msg, 0);
}
static struct mconsole_command *mconsole_parse(struct mc_request *req)
......@@ -66,10 +63,10 @@ static struct mconsole_command *mconsole_parse(struct mc_request *req)
struct mconsole_command *cmd;
int i;
for(i = 0; i < ARRAY_SIZE(commands); i++){
for (i = 0; i < ARRAY_SIZE(commands); i++) {
cmd = &commands[i];
if(!strncmp(req->request.data, cmd->command,
strlen(cmd->command))){
if (!strncmp(req->request.data, cmd->command,
strlen(cmd->command))) {
return cmd;
}
}
......@@ -94,9 +91,9 @@ int mconsole_get_request(int fd, struct mc_request *req)
req->originating_fd = fd;
if(req->request.magic != MCONSOLE_MAGIC){
if (req->request.magic != MCONSOLE_MAGIC) {
/* Unversioned request */
len = MIN(sizeof(req->request.data) - 1,
len = MIN(sizeof(req->request.data) - 1,
strlen((char *) &req->request));
memmove(req->request.data, &req->request, len);
req->request.data[len] = '\0';
......@@ -107,32 +104,33 @@ int mconsole_get_request(int fd, struct mc_request *req)
mconsole_reply_v0(req, "ERR Version 0 mconsole clients are "
"not supported by this driver");
return(0);
return 0;
}
if(req->request.len >= MCONSOLE_MAX_DATA){
if (req->request.len >= MCONSOLE_MAX_DATA) {
mconsole_reply(req, "Request too large", 1, 0);
return(0);
return 0;
}
if(req->request.version != MCONSOLE_VERSION){
mconsole_reply(req, "This driver only supports version "
STRING(MCONSOLE_VERSION) " clients", 1, 0);
if (req->request.version != MCONSOLE_VERSION) {
mconsole_reply(req, "This driver only supports version "
STRING(MCONSOLE_VERSION) " clients", 1, 0);
}
req->request.data[req->request.len] = '\0';
req->cmd = mconsole_parse(req);
if(req->cmd == NULL){
if (req->cmd == NULL) {
mconsole_reply(req, "Unknown command", 1, 0);
return(0);
return 0;
}
return(1);
return 1;
}
int mconsole_reply_len(struct mc_request *req, const char *str, int total,
int err, int more)
{
/* XXX This is a stack consumption problem. It'd be nice to
/*
* XXX This is a stack consumption problem. It'd be nice to
* make it global and serialize access to it, but there are a
* ton of callers to this function.
*/
......@@ -147,7 +145,7 @@ int mconsole_reply_len(struct mc_request *req, const char *str, int total,
len = MIN(total, MCONSOLE_MAX_DATA - 1);
if(len == total) reply.more = more;
if (len == total) reply.more = more;
else reply.more = 1;
memcpy(reply.data, str, len);
......@@ -161,9 +159,10 @@ int mconsole_reply_len(struct mc_request *req, const char *str, int total,
n = sendto(req->originating_fd, &reply, len, 0,
(struct sockaddr *) req->origin, req->originlen);
if(n < 0) return(-errno);
} while(total > 0);
return(0);
if (n < 0)
return -errno;
} while (total > 0);
return 0;
}
int mconsole_reply(struct mc_request *req, const char *str, int err, int more)
......@@ -187,18 +186,18 @@ int mconsole_notify(char *sock_name, int type, const void *data, int len)
int n, err = 0;
lock_notify();
if(notify_sock < 0){
if (notify_sock < 0) {
notify_sock = socket(PF_UNIX, SOCK_DGRAM, 0);
if(notify_sock < 0){
if (notify_sock < 0) {
err = -errno;
printk("mconsole_notify - socket failed, errno = %d\n",
err);
printk(UM_KERN_ERR "mconsole_notify - socket failed, "
"errno = %d\n", errno);
}
}
unlock_notify();
if(err)
return(err);
if (err)
return err;
target.sun_family = AF_UNIX;
strcpy(target.sun_path, sock_name);
......@@ -212,22 +211,12 @@ int mconsole_notify(char *sock_name, int type, const void *data, int len)
err = 0;
len = sizeof(packet) + packet.len - sizeof(packet.data);
n = sendto(notify_sock, &packet, len, 0, (struct sockaddr *) &target,
n = sendto(notify_sock, &packet, len, 0, (struct sockaddr *) &target,
sizeof(target));
if(n < 0){
if (n < 0) {
err = -errno;
printk("mconsole_notify - sendto failed, errno = %d\n", errno);
printk(UM_KERN_ERR "mconsole_notify - sendto failed, "
"errno = %d\n", errno);
}
return(err);
return err;
}
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically
* adjust the settings for this buffer only. This must remain at the end
* of the file.
* ---------------------------------------------------------------------------
* Local variables:
* c-file-style: "linux"
* End:
*/
......@@ -9,27 +9,29 @@
*
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/stddef.h>
#include <linux/types.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/miscdevice.h>
#include <linux/module.h>
#include <linux/mm.h>
#include <asm/uaccess.h>
#include "mem_user.h"
/* These are set in mmapper_init, which is called at boot time */
static unsigned long mmapper_size;
static unsigned long p_buf = 0;
static char *v_buf = NULL;
static unsigned long p_buf;
static char *v_buf;
static ssize_t
mmapper_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
static ssize_t mmapper_read(struct file *file, char __user *buf, size_t count,
loff_t *ppos)
{
return simple_read_from_buffer(buf, count, ppos, v_buf, mmapper_size);
}
static ssize_t
mmapper_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
static ssize_t mmapper_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
if (*ppos > mmapper_size)
return -EINVAL;
......@@ -39,48 +41,46 @@ mmapper_write(struct file *file, const char __user *buf, size_t count, loff_t *p
if (copy_from_user(&v_buf[*ppos], buf, count))
return -EFAULT;
return count;
}
static int
mmapper_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg)
static int mmapper_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
return(-ENOIOCTLCMD);
return -ENOIOCTLCMD;
}
static int
mmapper_mmap(struct file *file, struct vm_area_struct * vma)
static int mmapper_mmap(struct file *file, struct vm_area_struct *vma)
{
int ret = -EINVAL;
int size;
if (vma->vm_pgoff != 0)
goto out;
size = vma->vm_end - vma->vm_start;
if(size > mmapper_size) return(-EFAULT);
if (size > mmapper_size)
return -EFAULT;
/* XXX A comment above remap_pfn_range says it should only be
/*
* XXX A comment above remap_pfn_range says it should only be
* called when the mm semaphore is held
*/
if (remap_pfn_range(vma, vma->vm_start, p_buf >> PAGE_SHIFT, size,
vma->vm_page_prot))
vma->vm_page_prot))
goto out;
ret = 0;
out:
return ret;
}
static int
mmapper_open(struct inode *inode, struct file *file)
static int mmapper_open(struct inode *inode, struct file *file)
{
return 0;
}
static int
mmapper_release(struct inode *inode, struct file *file)
static int mmapper_release(struct inode *inode, struct file *file)
{
return 0;
}
......@@ -95,7 +95,9 @@ static const struct file_operations mmapper_fops = {
.release = mmapper_release,
};
/* No locking needed - only used (and modified) by below initcall and exitcall. */
/*
* No locking needed - only used (and modified) by below initcall and exitcall.
*/
static struct miscdevice mmapper_dev = {
.minor = MISC_DYNAMIC_MINOR,
.name = "mmapper",
......@@ -109,13 +111,13 @@ static int __init mmapper_init(void)
printk(KERN_INFO "Mapper v0.1\n");
v_buf = (char *) find_iomem("mmapper", &mmapper_size);
if(mmapper_size == 0){
if (mmapper_size == 0) {
printk(KERN_ERR "mmapper_init - find_iomem failed\n");
goto out;
}
err = misc_register(&mmapper_dev);
if(err){
if (err) {
printk(KERN_ERR "mmapper - misc_register failed, err = %d\n",
err);
goto out;
......@@ -136,9 +138,3 @@ module_exit(mmapper_exit);
MODULE_AUTHOR("Greg Lonnon <glonnon@ridgerun.com>");
MODULE_DESCRIPTION("DSPLinux simulator mmapper driver");
/*
* ---------------------------------------------------------------------------
* Local variables:
* c-file-style: "linux"
* End:
*/
/*
/*
* Copyright (C) 2002 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com)
* Licensed under the GPL
*/
......@@ -6,8 +6,8 @@
#include <stddef.h>
#include <errno.h>
#include <fcntl.h>
#include "os.h"
#include "chan_user.h"
#include "os.h"
/* This address is used only as a unique identifer */
static int null_chan;
......
/*
/*
* Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL
*/
......@@ -6,16 +6,16 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <termios.h>
#include <sys/stat.h>
#include "chan_user.h"
#include "os.h"
#include "user.h"
#include "kern_constants.h"
#include "os.h"
#include "um_malloc.h"
#include "user.h"
struct pty_chan {
void (*announce)(char *dev_name, int dev);
......@@ -33,7 +33,7 @@ static void *pty_chan_init(char *str, int device, const struct chan_opts *opts)
if (data == NULL)
return NULL;
*data = ((struct pty_chan) { .announce = opts->announce,
*data = ((struct pty_chan) { .announce = opts->announce,
.dev = device,
.raw = opts->raw });
return data;
......@@ -101,7 +101,7 @@ static int getmaster(char *line)
*tp = 't';
err = access(line, R_OK | W_OK);
*tp = 'p';
if(!err)
if (!err)
return master;
close(master);
}
......@@ -130,7 +130,7 @@ static int pty_open(int input, int output, int primary, void *d,
return err;
}
}
if (data->announce)
(*data->announce)(dev, data->dev);
......
/*
/*
* Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL
*/
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
......@@ -96,8 +96,10 @@ static int xterm_open(int input, int output, int primary, void *d,
if (access(argv[4], X_OK) < 0)
argv[4] = "port-helper";
/* Check that DISPLAY is set, this doesn't guarantee the xterm
* will work but w/o it we can be pretty sure it won't. */
/*
* Check that DISPLAY is set, this doesn't guarantee the xterm
* will work but w/o it we can be pretty sure it won't.
*/
if (getenv("DISPLAY") == NULL) {
printk(UM_KERN_ERR "xterm_open: $DISPLAY not set.\n");
return -ENODEV;
......@@ -196,7 +198,7 @@ static int xterm_open(int input, int output, int primary, void *d,
static void xterm_close(int fd, void *d)
{
struct xterm_chan *data = d;
if (data->pid != -1)
os_kill_process(data->pid, 1);
data->pid = -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment