Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5134d8fe authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds
Browse files

uml: style fixes in arch/um/os-Linux



Style changes under arch/um/os-Linux:
	include trimming
	CodingStyle fixes
	some printks needed severity indicators

make_tempfile turns out not to be used outside of mem.c, so it is now static.
Its declaration in tempfile.h is no longer needed, and tempfile.h itself is no
longer needed.

create_tmp_file was also made static.

checkpatch moans about an EXPORT_SYMBOL in user_syms.c which is part of a
macro definition - this is copying a bit of kernel infrastructure into the
libc side of UML because the kernel headers can't be included there.

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 536788fe
Loading
Loading
Loading
Loading

arch/um/include/tempfile.h

deleted100644 → 0
+0 −11
Original line number Diff line number Diff line
/* 
 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
 * Licensed under the GPL
 */

#ifndef __TEMPFILE_H__
#define __TEMPFILE_H__

extern int make_tempfile(const char *template, char **tempname, int do_unlink);

#endif
+4 −4
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
 * Licensed under the GPL.
 */

#include "linux/init.h"
#include <linux/init.h>
#include <linux/netdevice.h>
#include "etap.h"
#include "net_kern.h"
@@ -30,10 +30,10 @@ static void etap_init(struct net_device *dev, void *data)
	epri->control_fd = -1;
	epri->dev = dev;

	printk("ethertap backend - %s", epri->dev_name);
	printk(KERN_INFO "ethertap backend - %s", epri->dev_name);
	if (epri->gate_addr != NULL)
		printk(", IP = %s", epri->gate_addr);
	printk("\n");
		printk(KERN_CONT ", IP = %s", epri->gate_addr);
	printk(KERN_CONT "\n");
}

static int etap_read(int fd, struct sk_buff *skb, struct uml_net_private *lp)
+3 −3
Original line number Diff line number Diff line
@@ -29,10 +29,10 @@ static void tuntap_init(struct net_device *dev, void *data)
	tpri->fd = -1;
	tpri->dev = dev;

	printk("TUN/TAP backend - ");
	printk(KERN_INFO "TUN/TAP backend - ");
	if (tpri->gate_addr != NULL)
		printk("IP = %s", tpri->gate_addr);
	printk("\n");
		printk(KERN_CONT "IP = %s", tpri->gate_addr);
	printk(KERN_CONT "\n");
}

static int tuntap_read(int fd, struct sk_buff *skb, struct uml_net_private *lp)
+1 −12
Original line number Diff line number Diff line
/* 
 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
 * Licensed under the GPL
 */

@@ -9,14 +9,3 @@
#define DEV_NULL "/dev/null"

#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:
 */
+50 −51
Original line number Diff line number Diff line
/*
 * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
 * Licensed under the GPL
 */

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdarg.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/statfs.h>
#include "user.h"
#include "mem_user.h"
#include <sys/param.h>
#include "init.h"
#include "os.h"
#include "tempfile.h"
#include "kern_constants.h"

#include <sys/param.h>
#include "os.h"
#include "user.h"

/* Modified by which_tmpdir, which is called during early boot */
static char *default_tmpdir = "/tmp";
@@ -33,7 +32,8 @@ static void __init find_tempdir(void)
	int i;
	char *dir = NULL;

	if(tempdir != NULL) /* We've already been called */
	if (tempdir != NULL)
		/* We've already been called */
		return;
	for (i = 0; dirs[i]; i++) {
		dir = getenv(dirs[i]);
@@ -53,7 +53,8 @@ static void __init find_tempdir(void)
	strcat(tempdir, "/");
}

/* This will return 1, with the first character in buf being the
/*
 * This will return 1, with the first character in buf being the
 * character following the next instance of c in the file.  This will
 * read the file as needed.  If there's an error, -errno is returned;
 * if the end of the file is reached, 0 is returned.
@@ -78,7 +79,8 @@ static int next(int fd, char *buf, size_t size, char c)
	len = strlen(ptr);
	memmove(buf, ptr, len + 1);

	/* Refill the buffer so that if there's a partial string that we care
	/*
	 * Refill the buffer so that if there's a partial string that we care
	 * about, it will be completed, and we can recognize it.
	 */
	n = read(fd, &buf[len], size - len - 1);
@@ -92,7 +94,8 @@ static int next(int fd, char *buf, size_t size, char c)
/* which_tmpdir is called only during early boot */
static int checked_tmpdir = 0;

/* Look for a tmpfs mounted at /dev/shm.  I couldn't find a cleaner
/*
 * Look for a tmpfs mounted at /dev/shm.  I couldn't find a cleaner
 * way to do this than to parse /proc/mounts.  statfs will return the
 * same filesystem magic number and fs id for both /dev and /dev/shm
 * when they are both tmpfs, so you can't tell if they are different
@@ -164,7 +167,7 @@ static void which_tmpdir(void)
 * (file: kernel/tt/ptproxy/proxy.c, proc: start_debugger).
 * So it isn't 'static' yet.
 */
int __init make_tempfile(const char *template, char **out_tempname,
static int __init make_tempfile(const char *template, char **out_tempname,
				int do_unlink)
{
	char *tempname;
@@ -204,19 +207,14 @@ int __init make_tempfile(const char *template, char **out_tempname,

#define TEMPNAME_TEMPLATE "vm_file-XXXXXX"

/*
 * This proc is used in start_up.c
 * So it isn't 'static'.
 */
int __init create_tmp_file(unsigned long long len)
static int __init create_tmp_file(unsigned long long len)
{
	int fd, err;
	char zero;

	fd = make_tempfile(TEMPNAME_TEMPLATE, NULL, 1);
	if(fd < 0) {
	if (fd < 0)
		exit(1);
	}

	err = fchmod(fd, 0777);
	if (err < 0) {
@@ -224,7 +222,8 @@ int __init create_tmp_file(unsigned long long len)
		exit(1);
	}

	/* Seek to len - 1 because writing a character there will
	/*
	 * Seek to len - 1 because writing a character there will
	 * increase the file size by one byte, to the desired length.
	 */
	if (lseek64(fd, len - 1, SEEK_SET) < 0) {
Loading