2015-10-29 02:54:56 +08:00
|
|
|
/*
|
|
|
|
* Copyright: Matias Bjorling <mb@bjorling.me>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License version
|
|
|
|
* 2 as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GENNVM_H_
|
|
|
|
#define GENNVM_H_
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/vmalloc.h>
|
|
|
|
|
|
|
|
#include <linux/lightnvm.h>
|
|
|
|
|
2016-07-07 15:54:15 +08:00
|
|
|
struct gen_dev {
|
2015-11-16 22:34:37 +08:00
|
|
|
struct nvm_dev *dev;
|
|
|
|
|
2015-10-29 02:54:56 +08:00
|
|
|
int nr_luns;
|
2016-11-29 05:39:04 +08:00
|
|
|
struct nvm_lun *luns;
|
2016-03-03 22:06:37 +08:00
|
|
|
struct list_head area_list;
|
2016-07-07 15:54:16 +08:00
|
|
|
|
|
|
|
struct mutex lock;
|
|
|
|
struct list_head targets;
|
2015-10-29 02:54:56 +08:00
|
|
|
};
|
|
|
|
|
2016-07-07 15:54:15 +08:00
|
|
|
struct gen_area {
|
2016-03-03 22:06:37 +08:00
|
|
|
struct list_head list;
|
|
|
|
sector_t begin;
|
|
|
|
sector_t end; /* end is excluded */
|
|
|
|
};
|
2016-07-07 15:54:15 +08:00
|
|
|
|
|
|
|
#define gen_for_each_lun(bm, lun, i) \
|
2015-10-29 02:54:56 +08:00
|
|
|
for ((i) = 0, lun = &(bm)->luns[0]; \
|
|
|
|
(i) < (bm)->nr_luns; (i)++, lun = &(bm)->luns[(i)])
|
|
|
|
|
|
|
|
#endif /* GENNVM_H_ */
|