156055Srwatson/*
256055Srwatson * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
356055Srwatson *
456055Srwatson * Copyright (C) 2002-2011 Aleph One Ltd.
556055Srwatson *   for Toby Churchill Ltd and Brightstar Engineering
656055Srwatson *
756055Srwatson * Created by Charles Manning <charles@aleph1.co.uk>
856055Srwatson *
956055Srwatson * This program is free software; you can redistribute it and/or modify
1056055Srwatson * it under the terms of the GNU Lesser General Public License version 2.1 as
1156055Srwatson * published by the Free Software Foundation.
1256055Srwatson *
1356055Srwatson * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
1456055Srwatson */
1556055Srwatson
1656055Srwatson#ifndef __YAFFS_GETBLOCKINFO_H__
1756055Srwatson#define __YAFFS_GETBLOCKINFO_H__
1856055Srwatson
1956055Srwatson#include "yaffs_guts.h"
2056055Srwatson#include "yaffs_trace.h"
2156055Srwatson
2256055Srwatson/* Function to manipulate block info */
2356055Srwatsonstatic inline struct yaffs_block_info *yaffs_get_block_info(struct yaffs_dev
2456055Srwatson							      *dev, int blk)
2556055Srwatson{
2656055Srwatson	if (blk < dev->internal_start_block || blk > dev->internal_end_block) {
2756055Srwatson		yaffs_trace(YAFFS_TRACE_ERROR,
2856055Srwatson			"**>> yaffs: get_block_info block %d is not valid",
2956055Srwatson			blk);
3056055Srwatson		BUG();
3156055Srwatson	}
3256055Srwatson	return &dev->block_info[blk - dev->internal_start_block];
3356055Srwatson}
3456055Srwatson
3556055Srwatson#endif
3656055Srwatson