uml: formatting fixes around os_{read_write}_file callers

Formatting fixes ahead of renaming os_{read_write}_file_k to
os_{read_write}_file and fixing all the callers.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Jeff Dike 2007-05-06 14:51:41 -07:00 committed by Linus Torvalds
parent fda83a99b2
commit dc764e5087
5 changed files with 89 additions and 120 deletions

View file

@ -203,14 +203,3 @@ void register_winch(int fd, struct tty_struct *tty)
}
}
}
/*
* 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:
*/

View file

@ -8,7 +8,7 @@
static inline void *cow_malloc(int size)
{
return(um_kmalloc(size));
return um_kmalloc(size);
}
static inline void cow_free(void *ptr)
@ -20,29 +20,22 @@ static inline void cow_free(void *ptr)
static inline char *cow_strdup(char *str)
{
return(uml_strdup(str));
return uml_strdup(str);
}
static inline int cow_seek_file(int fd, __u64 offset)
{
return(os_seek_file(fd, offset));
return os_seek_file(fd, offset);
}
static inline int cow_file_size(char *file, unsigned long long *size_out)
{
return(os_file_size(file, size_out));
return os_file_size(file, size_out);
}
static inline int cow_write_file(int fd, void *buf, int size)
{
return(os_write_file_k(fd, buf, size));
return os_write_file_k(fd, buf, size);
}
#endif
/*
* ---------------------------------------------------------------------------
* Local variables:
* c-file-style: "linux"
* End:
*/

View file

@ -89,7 +89,7 @@ static inline int ubd_test_bit(__u64 bit, unsigned char *data)
bits = sizeof(data[0]) * 8;
n = bit / bits;
off = bit % bits;
return((data[n] & (1 << off)) != 0);
return (data[n] & (1 << off)) != 0;
}
static inline void ubd_set_bit(__u64 bit, unsigned char *data)
@ -249,7 +249,7 @@ static void make_ide_entries(char *dev_name)
static int fake_ide_setup(char *str)
{
fake_ide = 1;
return(1);
return 1;
}
__setup("fake_ide", fake_ide_setup);
@ -267,7 +267,7 @@ static int parse_unit(char **ptr)
if(isdigit(*str)) {
n = simple_strtoul(str, &end, 0);
if(end == str)
return(-1);
return -1;
*ptr = end;
}
else if (('a' <= *str) && (*str <= 'z')) {
@ -275,7 +275,7 @@ static int parse_unit(char **ptr)
str++;
*ptr = str;
}
return(n);
return n;
}
/* If *index_out == -1 at exit, the passed option was a general one;
@ -442,7 +442,7 @@ static int udb_setup(char *str)
{
printk("udb%s specified on command line is almost certainly a ubd -> "
"udb TYPO\n", str);
return(1);
return 1;
}
__setup("udb", udb_setup);
@ -541,7 +541,7 @@ static void ubd_handler(void)
static irqreturn_t ubd_intr(int irq, void *dev)
{
ubd_handler();
return(IRQ_HANDLED);
return IRQ_HANDLED;
}
/* Only changed by ubd_init, which is an initcall. */
@ -560,7 +560,7 @@ static inline int ubd_file_size(struct ubd *ubd_dev, __u64 *size_out)
char *file;
file = ubd_dev->cow.file ? ubd_dev->cow.file : ubd_dev->file;
return(os_file_size(file, size_out));
return os_file_size(file, size_out);
}
static void ubd_close_dev(struct ubd *ubd_dev)
@ -632,10 +632,10 @@ static int ubd_open_dev(struct ubd *ubd_dev)
if(err < 0) goto error;
ubd_dev->cow.fd = err;
}
return(0);
return 0;
error:
os_close_file(ubd_dev->fd);
return(err);
return err;
}
static void ubd_device_release(struct device *dev)
@ -653,7 +653,7 @@ static int ubd_disk_register(int major, u64 size, int unit,
disk = alloc_disk(1 << UBD_SHIFT);
if(disk == NULL)
return(-ENOMEM);
return -ENOMEM;
disk->major = major;
disk->first_minor = unit << UBD_SHIFT;
@ -780,7 +780,7 @@ static int ubd_get_config(char *name, char *str, int size, char **error_out)
n = parse_unit(&name);
if((n >= MAX_DEV) || (n < 0)){
*error_out = "ubd_get_config : device number out of range";
return(-1);
return -1;
}
ubd_dev = &ubd_devs[n];
@ -801,7 +801,7 @@ static int ubd_get_config(char *name, char *str, int size, char **error_out)
out:
mutex_unlock(&ubd_lock);
return(len);
return len;
}
static int ubd_id(char **str, int *start_out, int *end_out)
@ -880,7 +880,7 @@ static int __init ubd0_init(void)
ubd_dev->file = "root_fs";
mutex_unlock(&ubd_lock);
return(0);
return 0;
}
__initcall(ubd0_init);
@ -939,7 +939,7 @@ static int __init ubd_driver_init(void){
"ubd : Failed to start I/O thread (errno = %d) - "
"falling back to synchronous I/O\n", -io_pid);
io_pid = -1;
return(0);
return 0;
}
err = um_request_irq(UBD_IRQ, thread_fd, IRQ_READ, ubd_intr,
IRQF_DISABLED, "ubd", ubd_devs);
@ -974,7 +974,7 @@ static int ubd_open(struct inode *inode, struct file *filp)
err = -EROFS;
}*/
out:
return(err);
return err;
}
static int ubd_release(struct inode * inode, struct file * file)
@ -984,7 +984,7 @@ static int ubd_release(struct inode * inode, struct file * file)
if(--ubd_dev->count == 0)
ubd_close_dev(ubd_dev);
return(0);
return 0;
}
static void cowify_bitmap(__u64 io_offset, int length, unsigned long *cow_mask,
@ -1157,21 +1157,21 @@ static int ubd_ioctl(struct inode * inode, struct file * file,
ubd_id.cyls = ubd_dev->size / (128 * 32 * 512);
if(copy_to_user((char __user *) arg, (char *) &ubd_id,
sizeof(ubd_id)))
return(-EFAULT);
return(0);
return -EFAULT;
return 0;
case CDROMVOLREAD:
if(copy_from_user(&volume, (char __user *) arg, sizeof(volume)))
return(-EFAULT);
return -EFAULT;
volume.channel0 = 255;
volume.channel1 = 255;
volume.channel2 = 255;
volume.channel3 = 255;
if(copy_to_user((char __user *) arg, &volume, sizeof(volume)))
return(-EFAULT);
return(0);
return -EFAULT;
return 0;
}
return(-EINVAL);
return -EINVAL;
}
static int path_requires_switch(char *from_cmdline, char *from_cow, char *cow)
@ -1213,14 +1213,14 @@ static int backing_file_mismatch(char *file, __u64 size, time_t mtime)
if(err < 0){
printk("Failed to get modification time of backing file "
"\"%s\", err = %d\n", file, -err);
return(err);
return err;
}
err = os_file_size(file, &actual);
if(err < 0){
printk("Failed to get size of backing file \"%s\", "
"err = %d\n", file, -err);
return(err);
return err;
}
if(actual != size){
@ -1228,14 +1228,14 @@ static int backing_file_mismatch(char *file, __u64 size, time_t mtime)
* the typecast.*/
printk("Size mismatch (%llu vs %llu) of COW header vs backing "
"file\n", (unsigned long long) size, actual);
return(-EINVAL);
return -EINVAL;
}
if(modtime != mtime){
printk("mtime mismatch (%ld vs %ld) of COW header vs backing "
"file\n", mtime, modtime);
return(-EINVAL);
return -EINVAL;
}
return(0);
return 0;
}
int read_cow_bitmap(int fd, void *buf, int offset, int len)
@ -1244,13 +1244,13 @@ int read_cow_bitmap(int fd, void *buf, int offset, int len)
err = os_seek_file(fd, offset);
if(err < 0)
return(err);
return err;
err = os_read_file_k(fd, buf, len);
err = os_read_file(fd, buf, len);
if(err < 0)
return(err);
return err;
return(0);
return 0;
}
int open_ubd_file(char *file, struct openflags *openflags, int shared,
@ -1289,7 +1289,7 @@ int open_ubd_file(char *file, struct openflags *openflags, int shared,
/* Successful return case! */
if(backing_file_out == NULL)
return(fd);
return fd;
err = read_cow_header(file_reader, &fd, &version, &backing_file, &mtime,
&size, &sectorsize, &align, bitmap_offset_out);
@ -1299,7 +1299,7 @@ int open_ubd_file(char *file, struct openflags *openflags, int shared,
goto out_close;
}
if(err)
return(fd);
return fd;
asked_switch = path_requires_switch(*backing_file_out, backing_file, file);
@ -1347,10 +1347,10 @@ int create_cow_file(char *cow_file, char *backing_file, struct openflags flags,
bitmap_offset_out, bitmap_len_out,
data_offset_out);
if(!err)
return(fd);
return fd;
os_close_file(fd);
out:
return(err);
return err;
}
static int update_bitmap(struct io_thread_req *req)
@ -1358,12 +1358,12 @@ static int update_bitmap(struct io_thread_req *req)
int n;
if(req->cow_offset == -1)
return(0);
return 0;
n = os_seek_file(req->fds[1], req->cow_offset);
if(n < 0){
printk("do_io - bitmap lseek failed : err = %d\n", -n);
return(1);
return 1;
}
n = os_write_file_k(req->fds[1], &req->bitmap_words,
@ -1371,10 +1371,10 @@ static int update_bitmap(struct io_thread_req *req)
if(n != sizeof(req->bitmap_words)){
printk("do_io - bitmap update failed, err = %d fd = %d\n", -n,
req->fds[1]);
return(1);
return 1;
}
return(0);
return 0;
}
void do_io(struct io_thread_req *req)

View file

@ -21,12 +21,20 @@ static int __init read_initrd(void)
long long size;
int err;
if(initrd == NULL) return 0;
if(initrd == NULL)
return 0;
err = os_file_size(initrd, &size);
if(err) return 0;
if(err)
return 0;
area = alloc_bootmem(size);
if(area == NULL) return 0;
if(load_initrd(initrd, area, size) == -1) return 0;
if(area == NULL)
return 0;
if(load_initrd(initrd, area, size) == -1)
return 0;
initrd_start = (unsigned long) area;
initrd_end = initrd_start + size;
return 0;
@ -53,25 +61,15 @@ int load_initrd(char *filename, void *buf, int size)
fd = os_open_file(filename, of_read(OPENFLAGS()), 0);
if(fd < 0){
printk("Opening '%s' failed - err = %d\n", filename, -fd);
return(-1);
return -1;
}
n = os_read_file_k(fd, buf, size);
if(n != size){
printk("Read of %d bytes from '%s' failed, err = %d\n", size,
filename, -n);
return(-1);
return -1;
}
os_close_file(fd);
return(0);
return 0;
}
/*
* 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:
*/

View file

@ -89,7 +89,7 @@ static int idle_proc(void *cpup)
cpu_set(cpu, cpu_online_map);
default_idle();
return(0);
return 0;
}
static struct task_struct *idle_thread(int cpu)
@ -111,7 +111,7 @@ static struct task_struct *idle_thread(int cpu)
CHOOSE_MODE(os_write_file_k(new_task->thread.mode.tt.switch_pipe[1], &c,
sizeof(c)),
({ panic("skas mode doesn't support SMP"); }));
return(new_task);
return new_task;
}
void smp_prepare_cpus(unsigned int maxcpus)
@ -162,13 +162,13 @@ int __cpu_up(unsigned int cpu)
cpu_set(cpu, smp_commenced_mask);
while (!cpu_isset(cpu, cpu_online_map))
mb();
return(0);
return 0;
}
int setup_profiling_timer(unsigned int multiplier)
{
printk(KERN_INFO "setup_profiling_timer\n");
return(0);
return 0;
}
void smp_call_function_slave(int cpu);
@ -204,7 +204,7 @@ void IPI_handler(int cpu)
int hard_smp_processor_id(void)
{
return(pid_to_processor_id(os_getpid()));
return pid_to_processor_id(os_getpid());
}
static DEFINE_SPINLOCK(call_lock);
@ -253,14 +253,3 @@ int smp_call_function(void (*_func)(void *info), void *_info, int nonatomic,
}
#endif
/*
* 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:
*/