Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!
This commit is contained in:
Linus Torvalds
2005-04-16 15:20:36 -07:00
commit 1da177e4c3
17291 changed files with 6718755 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
#
# Makefile for the linux Journalling Flash FileSystem (JFFS) routines.
#
# $Id: Makefile,v 1.11 2001/09/25 20:59:41 dwmw2 Exp $
#
obj-$(CONFIG_JFFS_FS) += jffs.o
jffs-y := jffs_fm.o intrep.o inode-v23.o
jffs-$(CONFIG_JFFS_PROC_FS) += jffs_proc.o
jffs-objs := $(jffs-y)
+1847
View File
File diff suppressed because it is too large Load Diff
+3457
View File
File diff suppressed because it is too large Load Diff
+60
View File
@@ -0,0 +1,60 @@
/*
* JFFS -- Journaling Flash File System, Linux implementation.
*
* Copyright (C) 1999, 2000 Axis Communications AB.
*
* Created by Finn Hakansson <finn@axis.com>.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* $Id: intrep.h,v 1.14 2001/09/23 23:28:37 dwmw2 Exp $
*
*/
#ifndef __LINUX_JFFS_INTREP_H__
#define __LINUX_JFFS_INTREP_H__
#include "jffs_fm.h"
struct jffs_node *jffs_alloc_node(void);
void jffs_free_node(struct jffs_node *n);
int jffs_get_node_inuse(void);
void jffs_cleanup_control(struct jffs_control *c);
int jffs_build_fs(struct super_block *sb);
int jffs_insert_node(struct jffs_control *c, struct jffs_file *f,
const struct jffs_raw_inode *raw_inode,
const char *name, struct jffs_node *node);
struct jffs_file *jffs_find_file(struct jffs_control *c, __u32 ino);
struct jffs_file *jffs_find_child(struct jffs_file *dir, const char *name, int len);
void jffs_free_node(struct jffs_node *node);
int jffs_foreach_file(struct jffs_control *c, int (*func)(struct jffs_file *));
int jffs_possibly_delete_file(struct jffs_file *f);
int jffs_insert_file_into_tree(struct jffs_file *f);
int jffs_unlink_file_from_tree(struct jffs_file *f);
int jffs_file_count(struct jffs_file *f);
int jffs_write_node(struct jffs_control *c, struct jffs_node *node,
struct jffs_raw_inode *raw_inode,
const char *name, const unsigned char *buf,
int recoverable, struct jffs_file *f);
int jffs_read_data(struct jffs_file *f, unsigned char *buf, __u32 read_offset, __u32 size);
/* Garbage collection stuff. */
int jffs_garbage_collect_thread(void *c);
void jffs_garbage_collect_trigger(struct jffs_control *c);
/* For debugging purposes. */
void jffs_print_node(struct jffs_node *n);
void jffs_print_raw_inode(struct jffs_raw_inode *raw_inode);
#if 0
int jffs_print_file(struct jffs_file *f);
#endif /* 0 */
void jffs_print_hash_table(struct jffs_control *c);
void jffs_print_tree(struct jffs_file *first_file, int indent);
#endif /* __LINUX_JFFS_INTREP_H__ */
+795
View File
File diff suppressed because it is too large Load Diff
+148
View File
@@ -0,0 +1,148 @@
/*
* JFFS -- Journaling Flash File System, Linux implementation.
*
* Copyright (C) 1999, 2000 Axis Communications AB.
*
* Created by Finn Hakansson <finn@axis.com>.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* $Id: jffs_fm.h,v 1.13 2001/01/11 12:03:25 dwmw2 Exp $
*
* Ported to Linux 2.3.x and MTD:
* Copyright (C) 2000 Alexander Larsson (alex@cendio.se), Cendio Systems AB
*
*/
#ifndef __LINUX_JFFS_FM_H__
#define __LINUX_JFFS_FM_H__
#include <linux/types.h>
#include <linux/jffs.h>
#include <linux/mtd/mtd.h>
#include <linux/config.h>
/* The alignment between two nodes in the flash memory. */
#define JFFS_ALIGN_SIZE 4
/* Mark the on-flash space as obsolete when appropriate. */
#define JFFS_MARK_OBSOLETE 0
#ifndef CONFIG_JFFS_FS_VERBOSE
#define CONFIG_JFFS_FS_VERBOSE 1
#endif
#if CONFIG_JFFS_FS_VERBOSE > 0
#define D(x) x
#define D1(x) D(x)
#else
#define D(x)
#define D1(x)
#endif
#if CONFIG_JFFS_FS_VERBOSE > 1
#define D2(x) D(x)
#else
#define D2(x)
#endif
#if CONFIG_JFFS_FS_VERBOSE > 2
#define D3(x) D(x)
#else
#define D3(x)
#endif
#define ASSERT(x) x
/* How many padding bytes should be inserted between two chunks of data
on the flash? */
#define JFFS_GET_PAD_BYTES(size) ( (JFFS_ALIGN_SIZE-1) & -(__u32)(size) )
#define JFFS_PAD(size) ( (size + (JFFS_ALIGN_SIZE-1)) & ~(JFFS_ALIGN_SIZE-1) )
struct jffs_node_ref
{
struct jffs_node *node;
struct jffs_node_ref *next;
};
/* The struct jffs_fm represents a chunk of data in the flash memory. */
struct jffs_fm
{
__u32 offset;
__u32 size;
struct jffs_fm *prev;
struct jffs_fm *next;
struct jffs_node_ref *nodes; /* USED if != 0. */
};
struct jffs_fmcontrol
{
__u32 flash_size;
__u32 used_size;
__u32 dirty_size;
__u32 free_size;
__u32 sector_size;
__u32 min_free_size; /* The minimum free space needed to be able
to perform garbage collections. */
__u32 max_chunk_size; /* The maximum size of a chunk of data. */
struct mtd_info *mtd;
struct jffs_control *c;
struct jffs_fm *head;
struct jffs_fm *tail;
struct jffs_fm *head_extra;
struct jffs_fm *tail_extra;
struct semaphore biglock;
};
/* Notice the two members head_extra and tail_extra in the jffs_control
structure above. Those are only used during the scanning of the flash
memory; while the file system is being built. If the data in the flash
memory is organized like
+----------------+------------------+----------------+
| USED / DIRTY | FREE | USED / DIRTY |
+----------------+------------------+----------------+
then the scan is split in two parts. The first scanned part of the
flash memory is organized through the members head and tail. The
second scanned part is organized with head_extra and tail_extra. When
the scan is completed, the two lists are merged together. The jffs_fm
struct that head_extra references is the logical beginning of the
flash memory so it will be referenced by the head member. */
struct jffs_fmcontrol *jffs_build_begin(struct jffs_control *c, int unit);
void jffs_build_end(struct jffs_fmcontrol *fmc);
void jffs_cleanup_fmcontrol(struct jffs_fmcontrol *fmc);
int jffs_fmalloc(struct jffs_fmcontrol *fmc, __u32 size,
struct jffs_node *node, struct jffs_fm **result);
int jffs_fmfree(struct jffs_fmcontrol *fmc, struct jffs_fm *fm,
struct jffs_node *node);
__u32 jffs_free_size1(struct jffs_fmcontrol *fmc);
__u32 jffs_free_size2(struct jffs_fmcontrol *fmc);
void jffs_sync_erase(struct jffs_fmcontrol *fmc, int erased_size);
struct jffs_fm *jffs_cut_node(struct jffs_fmcontrol *fmc, __u32 size);
struct jffs_node *jffs_get_oldest_node(struct jffs_fmcontrol *fmc);
long jffs_erasable_size(struct jffs_fmcontrol *fmc);
struct jffs_fm *jffs_fmalloced(struct jffs_fmcontrol *fmc, __u32 offset,
__u32 size, struct jffs_node *node);
int jffs_add_node(struct jffs_node *node);
void jffs_fmfree_partly(struct jffs_fmcontrol *fmc, struct jffs_fm *fm,
__u32 size);
void jffs_print_fmcontrol(struct jffs_fmcontrol *fmc);
void jffs_print_fm(struct jffs_fm *fm);
#if 0
void jffs_print_node_ref(struct jffs_node_ref *ref);
#endif /* 0 */
#endif /* __LINUX_JFFS_FM_H__ */
+261
View File
@@ -0,0 +1,261 @@
/*
* JFFS -- Journaling Flash File System, Linux implementation.
*
* Copyright (C) 2000 Axis Communications AB.
*
* Created by Simon Kagstrom <simonk@axis.com>.
*
* $Id: jffs_proc.c,v 1.5 2001/06/02 14:34:55 dwmw2 Exp $
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Overview:
* This file defines JFFS partition entries in the proc file system.
*
* TODO:
* Create some more proc files for different kinds of info, i.e. statistics
* about written and read bytes, number of calls to different routines,
* reports about failures.
*/
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/jffs.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/time.h>
#include <linux/types.h>
#include "jffs_fm.h"
#include "jffs_proc.h"
/*
* Structure for a JFFS partition in the system
*/
struct jffs_partition_dir {
struct jffs_control *c;
struct proc_dir_entry *part_root;
struct proc_dir_entry *part_info;
struct proc_dir_entry *part_layout;
struct jffs_partition_dir *next;
};
/*
* Structure for top-level entry in '/proc/fs' directory
*/
struct proc_dir_entry *jffs_proc_root;
/*
* Linked list of 'jffs_partition_dirs' to help us track
* the mounted JFFS partitions in the system
*/
static struct jffs_partition_dir *jffs_part_dirs;
/*
* Read functions for entries
*/
static int jffs_proc_info_read(char *page, char **start, off_t off,
int count, int *eof, void *data);
static int jffs_proc_layout_read (char *page, char **start, off_t off,
int count, int *eof, void *data);
/*
* Register a JFFS partition directory (called upon mount)
*/
int jffs_register_jffs_proc_dir(int mtd, struct jffs_control *c)
{
struct jffs_partition_dir *part_dir;
struct proc_dir_entry *part_info = NULL;
struct proc_dir_entry *part_layout = NULL;
struct proc_dir_entry *part_root = NULL;
char name[10];
sprintf(name, "%d", mtd);
/* Allocate structure for local JFFS partition table */
part_dir = (struct jffs_partition_dir *)
kmalloc(sizeof (struct jffs_partition_dir), GFP_KERNEL);
if (!part_dir)
goto out;
/* Create entry for this partition */
part_root = proc_mkdir(name, jffs_proc_root);
if (!part_root)
goto out1;
/* Create entry for 'info' file */
part_info = create_proc_entry ("info", 0, part_root);
if (!part_info)
goto out2;
part_info->read_proc = jffs_proc_info_read;
part_info->data = (void *) c;
/* Create entry for 'layout' file */
part_layout = create_proc_entry ("layout", 0, part_root);
if (!part_layout)
goto out3;
part_layout->read_proc = jffs_proc_layout_read;
part_layout->data = (void *) c;
/* Fill in structure for table and insert in the list */
part_dir->c = c;
part_dir->part_root = part_root;
part_dir->part_info = part_info;
part_dir->part_layout = part_layout;
part_dir->next = jffs_part_dirs;
jffs_part_dirs = part_dir;
/* Return happy */
return 0;
out3:
remove_proc_entry("info", part_root);
out2:
remove_proc_entry(name, jffs_proc_root);
out1:
kfree(part_dir);
out:
return -ENOMEM;
}
/*
* Unregister a JFFS partition directory (called at umount)
*/
int jffs_unregister_jffs_proc_dir(struct jffs_control *c)
{
struct jffs_partition_dir *part_dir = jffs_part_dirs;
struct jffs_partition_dir *prev_part_dir = NULL;
while (part_dir) {
if (part_dir->c == c) {
/* Remove entries for partition */
remove_proc_entry (part_dir->part_info->name,
part_dir->part_root);
remove_proc_entry (part_dir->part_layout->name,
part_dir->part_root);
remove_proc_entry (part_dir->part_root->name,
jffs_proc_root);
/* Remove entry from list */
if (prev_part_dir)
prev_part_dir->next = part_dir->next;
else
jffs_part_dirs = part_dir->next;
/*
* Check to see if this is the last one
* and remove the entry from '/proc/fs'
* if it is.
*/
if (jffs_part_dirs == part_dir->next)
remove_proc_entry ("jffs", proc_root_fs);
/* Free memory for entry */
kfree(part_dir);
/* Return happy */
return 0;
}
/* Move to next entry */
prev_part_dir = part_dir;
part_dir = part_dir->next;
}
/* Return unhappy */
return -1;
}
/*
* Read a JFFS partition's `info' file
*/
static int jffs_proc_info_read (char *page, char **start, off_t off,
int count, int *eof, void *data)
{
struct jffs_control *c = (struct jffs_control *) data;
int len = 0;
/* Get information on the parition */
len += sprintf (page,
"partition size: %08lX (%u)\n"
"sector size: %08lX (%u)\n"
"used size: %08lX (%u)\n"
"dirty size: %08lX (%u)\n"
"free size: %08lX (%u)\n\n",
(unsigned long) c->fmc->flash_size, c->fmc->flash_size,
(unsigned long) c->fmc->sector_size, c->fmc->sector_size,
(unsigned long) c->fmc->used_size, c->fmc->used_size,
(unsigned long) c->fmc->dirty_size, c->fmc->dirty_size,
(unsigned long) (c->fmc->flash_size -
(c->fmc->used_size + c->fmc->dirty_size)),
c->fmc->flash_size - (c->fmc->used_size + c->fmc->dirty_size));
/* We're done */
*eof = 1;
/* Return length */
return len;
}
/*
* Read a JFFS partition's `layout' file
*/
static int jffs_proc_layout_read (char *page, char **start, off_t off,
int count, int *eof, void *data)
{
struct jffs_control *c = (struct jffs_control *) data;
struct jffs_fm *fm = NULL;
struct jffs_fm *last_fm = NULL;
int len = 0;
/* Get the first item in the list */
fm = c->fmc->head;
/* Print free space */
if (fm && fm->offset) {
len += sprintf (page, "00000000 %08lX free\n",
(unsigned long) fm->offset);
}
/* Loop through all of the flash control structures */
while (fm && (len < (off + count))) {
if (fm->nodes) {
len += sprintf (page + len,
"%08lX %08lX ino=%08lX, ver=%08lX\n",
(unsigned long) fm->offset,
(unsigned long) fm->size,
(unsigned long) fm->nodes->node->ino,
(unsigned long) fm->nodes->node->version);
}
else {
len += sprintf (page + len,
"%08lX %08lX dirty\n",
(unsigned long) fm->offset,
(unsigned long) fm->size);
}
last_fm = fm;
fm = fm->next;
}
/* Print free space */
if ((len < (off + count)) && last_fm
&& (last_fm->offset < c->fmc->flash_size)) {
len += sprintf (page + len,
"%08lX %08lX free\n",
(unsigned long) last_fm->offset +
last_fm->size,
(unsigned long) (c->fmc->flash_size -
(last_fm->offset + last_fm->size)));
}
/* We're done */
*eof = 1;
/* Return length */
return len;
}
+28
View File
@@ -0,0 +1,28 @@
/*
* JFFS -- Journaling Flash File System, Linux implementation.
*
* Copyright (C) 2000 Axis Communications AB.
*
* Created by Simon Kagstrom <simonk@axis.com>.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* $Id: jffs_proc.h,v 1.2 2000/11/15 22:04:12 sjhill Exp $
*/
/* jffs_proc.h defines a structure for inclusion in the proc-file system. */
#ifndef __LINUX_JFFS_PROC_H__
#define __LINUX_JFFS_PROC_H__
#include <linux/proc_fs.h>
/* The proc_dir_entry for jffs (defined in jffs_proc.c). */
extern struct proc_dir_entry *jffs_proc_root;
int jffs_register_jffs_proc_dir(int mtd, struct jffs_control *c);
int jffs_unregister_jffs_proc_dir(struct jffs_control *c);
#endif /* __LINUX_JFFS_PROC_H__ */