Ejemplo n.º 1
0
/*
 * Allocate a new memory page for file structures and
 * insert the new structures into the global list.
 * Returns 0, if there is no more memory, 1 otherwise.
 */
static int grow_files(void)
{
	struct file * file;
	int i;

	/*
	 * We don't have to clear the page because we only look into
	 * f_count, f_prev and f_next and they get initialized in
	 * insert_file_free.  The rest of the file structure is cleared
	 * by get_empty_filp before it is returned.
	 */
	file = (struct file *) __get_free_page(GFP_KERNEL);

	if (!file)
		return 0;

	nr_files += i = PAGE_SIZE/sizeof(struct file);

	if (!first_file)
		file->f_count = 0,
		file->f_next = file->f_prev = first_file = file++,
		i--;

	for (; i ; i--)
		insert_file_free(file++);

	return 1;
}
Ejemplo n.º 2
0
void grow_files(void) {

	struct file * file;
	int i;

	//file = (struct file *) get_free_page(GFP_KERNEL);
	if (!file)
		return;

	nr_files+=i= PAGE_SIZE/sizeof(struct file);

	if (!first_file)
		file->f_next = file->f_prev = first_file = file++, i--;

	for (; i ; i--)
		insert_file_free(file++);
}