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

Commit e4e0fadc authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/shaggy/jfs-2.6:
  jfs: remove DIRENTSIZ
  JFS: diAlloc() should return -EIO rather than EIO
  JFS: skip bad iput() call in error path
  JFS: switch to seq_files
  JFS: 0 is not valid errno value so return NULL from jfs_lookup
parents 14351760 ec1aef33
Loading
Loading
Loading
Loading
+28 −34
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@
#include <linux/ctype.h>
#include <linux/ctype.h>
#include <linux/module.h>
#include <linux/module.h>
#include <linux/proc_fs.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include "jfs_incore.h"
#include "jfs_incore.h"
#include "jfs_filsys.h"
#include "jfs_filsys.h"
@@ -30,29 +31,19 @@


static struct proc_dir_entry *base;
static struct proc_dir_entry *base;
#ifdef CONFIG_JFS_DEBUG
#ifdef CONFIG_JFS_DEBUG
static int loglevel_read(char *page, char **start, off_t off,
static int jfs_loglevel_proc_show(struct seq_file *m, void *v)
			 int count, int *eof, void *data)
{
{
	int len;
	seq_printf(m, "%d\n", jfsloglevel);

	return 0;
	len = sprintf(page, "%d\n", jfsloglevel);
}

	len -= off;
	*start = page + off;

	if (len > count)
		len = count;
	else
		*eof = 1;

	if (len < 0)
		len = 0;


	return len;
static int jfs_loglevel_proc_open(struct inode *inode, struct file *file)
{
	return single_open(file, jfs_loglevel_proc_show, NULL);
}
}


static int loglevel_write(struct file *file, const char __user *buffer,
static ssize_t jfs_loglevel_proc_write(struct file *file,
			unsigned long count, void *data)
		const char __user *buffer, size_t count, loff_t *ppos)
{
{
	char c;
	char c;


@@ -65,22 +56,30 @@ static int loglevel_write(struct file *file, const char __user *buffer,
	jfsloglevel = c - '0';
	jfsloglevel = c - '0';
	return count;
	return count;
}
}

static const struct file_operations jfs_loglevel_proc_fops = {
	.owner		= THIS_MODULE,
	.open		= jfs_loglevel_proc_open,
	.read		= seq_read,
	.llseek		= seq_lseek,
	.release	= single_release,
	.write		= jfs_loglevel_proc_write,
};
#endif
#endif


static struct {
static struct {
	const char	*name;
	const char	*name;
	read_proc_t	*read_fn;
	const struct file_operations *proc_fops;
	write_proc_t	*write_fn;
} Entries[] = {
} Entries[] = {
#ifdef CONFIG_JFS_STATISTICS
#ifdef CONFIG_JFS_STATISTICS
	{ "lmstats",	jfs_lmstats_read, },
	{ "lmstats",	&jfs_lmstats_proc_fops, },
	{ "txstats",	jfs_txstats_read, },
	{ "txstats",	&jfs_txstats_proc_fops, },
	{ "xtstat",	jfs_xtstat_read, },
	{ "xtstat",	&jfs_xtstat_proc_fops, },
	{ "mpstat",	jfs_mpstat_read, },
	{ "mpstat",	&jfs_mpstat_proc_fops, },
#endif
#endif
#ifdef CONFIG_JFS_DEBUG
#ifdef CONFIG_JFS_DEBUG
	{ "TxAnchor",	jfs_txanchor_read, },
	{ "TxAnchor",	&jfs_txanchor_proc_fops, },
	{ "loglevel",	loglevel_read, loglevel_write }
	{ "loglevel",	&jfs_loglevel_proc_fops }
#endif
#endif
};
};
#define NPROCENT	ARRAY_SIZE(Entries)
#define NPROCENT	ARRAY_SIZE(Entries)
@@ -93,13 +92,8 @@ void jfs_proc_init(void)
		return;
		return;
	base->owner = THIS_MODULE;
	base->owner = THIS_MODULE;


	for (i = 0; i < NPROCENT; i++) {
	for (i = 0; i < NPROCENT; i++)
		struct proc_dir_entry *p;
		proc_create(Entries[i].name, 0, base, Entries[i].proc_fops);
		if ((p = create_proc_entry(Entries[i].name, 0, base))) {
			p->read_proc = Entries[i].read_fn;
			p->write_proc = Entries[i].write_fn;
		}
	}
}
}


void jfs_proc_clean(void)
void jfs_proc_clean(void)
+5 −5
Original line number Original line Diff line number Diff line
@@ -62,7 +62,7 @@ extern void jfs_proc_clean(void);


extern int jfsloglevel;
extern int jfsloglevel;


extern int jfs_txanchor_read(char *, char **, off_t, int, int *, void *);
extern const struct file_operations jfs_txanchor_proc_fops;


/* information message: e.g., configuration, major event */
/* information message: e.g., configuration, major event */
#define jfs_info(fmt, arg...) do {			\
#define jfs_info(fmt, arg...) do {			\
@@ -105,10 +105,10 @@ extern int jfs_txanchor_read(char *, char **, off_t, int, int *, void *);
 *	----------
 *	----------
 */
 */
#ifdef	CONFIG_JFS_STATISTICS
#ifdef	CONFIG_JFS_STATISTICS
extern int jfs_lmstats_read(char *, char **, off_t, int, int *, void *);
extern const struct file_operations jfs_lmstats_proc_fops;
extern int jfs_txstats_read(char *, char **, off_t, int, int *, void *);
extern const struct file_operations jfs_txstats_proc_fops;
extern int jfs_mpstat_read(char *, char **, off_t, int, int *, void *);
extern const struct file_operations jfs_mpstat_proc_fops;
extern int jfs_xtstat_read(char *, char **, off_t, int, int *, void *);
extern const struct file_operations jfs_xtstat_proc_fops;


#define	INCREMENT(x)		((x)++)
#define	INCREMENT(x)		((x)++)
#define	DECREMENT(x)		((x)--)
#define	DECREMENT(x)		((x)--)
+0 −3
Original line number Original line Diff line number Diff line
@@ -243,9 +243,6 @@ typedef union {
#define JFS_REMOVE 3
#define JFS_REMOVE 3
#define JFS_RENAME 4
#define JFS_RENAME 4


#define DIRENTSIZ(namlen) \
    ( (sizeof(struct dirent) - 2*(JFS_NAME_MAX+1) + 2*((namlen)+1) + 3) &~ 3 )

/*
/*
 * Maximum file offset for directories.
 * Maximum file offset for directories.
 */
 */
+1 −1
Original line number Original line Diff line number Diff line
@@ -1520,7 +1520,7 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip)
					jfs_error(ip->i_sb,
					jfs_error(ip->i_sb,
						  "diAlloc: can't find free bit "
						  "diAlloc: can't find free bit "
						  "in wmap");
						  "in wmap");
					return EIO;
					return -EIO;
				}
				}


				/* determine the inode number within the
				/* determine the inode number within the
+16 −19
Original line number Original line Diff line number Diff line
@@ -69,6 +69,7 @@
#include <linux/freezer.h>
#include <linux/freezer.h>
#include <linux/delay.h>
#include <linux/delay.h>
#include <linux/mutex.h>
#include <linux/mutex.h>
#include <linux/seq_file.h>
#include "jfs_incore.h"
#include "jfs_incore.h"
#include "jfs_filsys.h"
#include "jfs_filsys.h"
#include "jfs_metapage.h"
#include "jfs_metapage.h"
@@ -2503,13 +2504,9 @@ exit:
}
}


#ifdef CONFIG_JFS_STATISTICS
#ifdef CONFIG_JFS_STATISTICS
int jfs_lmstats_read(char *buffer, char **start, off_t offset, int length,
static int jfs_lmstats_proc_show(struct seq_file *m, void *v)
		      int *eof, void *data)
{
{
	int len = 0;
	seq_printf(m,
	off_t begin;

	len += sprintf(buffer,
		       "JFS Logmgr stats\n"
		       "JFS Logmgr stats\n"
		       "================\n"
		       "================\n"
		       "commits = %d\n"
		       "commits = %d\n"
@@ -2522,19 +2519,19 @@ int jfs_lmstats_read(char *buffer, char **start, off_t offset, int length,
		       lmStat.pagedone,
		       lmStat.pagedone,
		       lmStat.full_page,
		       lmStat.full_page,
		       lmStat.partial_page);
		       lmStat.partial_page);
	return 0;
}


	begin = offset;
static int jfs_lmstats_proc_open(struct inode *inode, struct file *file)
	*start = buffer + begin;
{
	len -= begin;
	return single_open(file, jfs_lmstats_proc_show, NULL);

	if (len > length)
		len = length;
	else
		*eof = 1;

	if (len < 0)
		len = 0;

	return len;
}
}

const struct file_operations jfs_lmstats_proc_fops = {
	.owner		= THIS_MODULE,
	.open		= jfs_lmstats_proc_open,
	.read		= seq_read,
	.llseek		= seq_lseek,
	.release	= single_release,
};
#endif /* CONFIG_JFS_STATISTICS */
#endif /* CONFIG_JFS_STATISTICS */
Loading