aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/ubi.h
diff options
context:
space:
mode:
authorEzequiel Garcia <elezegarcia@gmail.com>2012-11-28 07:18:30 -0500
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-12-10 06:38:59 -0500
commiteab737722ed6a5638f6251e83f0d293c2ffe549f (patch)
treeccac47deaa15cf48608352e73ded2dcf387c2737 /drivers/mtd/ubi/ubi.h
parent64575574f26d7969713ede9bde750c979da4037e (diff)
UBI: embed ubi_debug_info field in ubi_device struct
ubi_debug_info struct was dynamically allocated which is always suboptimal, for it tends to fragment memory and make the code error-prone. Fix this by embedding it in ubi_device struct. Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd/ubi/ubi.h')
-rw-r--r--drivers/mtd/ubi/ubi.h40
1 files changed, 39 insertions, 1 deletions
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h
index 7d57469723cf..8ea6297a208f 100644
--- a/drivers/mtd/ubi/ubi.h
+++ b/drivers/mtd/ubi/ubi.h
@@ -85,6 +85,13 @@
85#define UBI_UNKNOWN -1 85#define UBI_UNKNOWN -1
86 86
87/* 87/*
88 * The UBI debugfs directory name pattern and maximum name length (3 for "ubi"
89 * + 2 for the number plus 1 for the trailing zero byte.
90 */
91#define UBI_DFS_DIR_NAME "ubi%d"
92#define UBI_DFS_DIR_LEN (3 + 2 + 1)
93
94/*
88 * Error codes returned by the I/O sub-system. 95 * Error codes returned by the I/O sub-system.
89 * 96 *
90 * UBI_IO_FF: the read region of flash contains only 0xFFs 97 * UBI_IO_FF: the read region of flash contains only 0xFFs
@@ -342,6 +349,37 @@ struct ubi_volume_desc {
342struct ubi_wl_entry; 349struct ubi_wl_entry;
343 350
344/** 351/**
352 * struct ubi_debug_info - debugging information for an UBI device.
353 *
354 * @chk_gen: if UBI general extra checks are enabled
355 * @chk_io: if UBI I/O extra checks are enabled
356 * @disable_bgt: disable the background task for testing purposes
357 * @emulate_bitflips: emulate bit-flips for testing purposes
358 * @emulate_io_failures: emulate write/erase failures for testing purposes
359 * @dfs_dir_name: name of debugfs directory containing files of this UBI device
360 * @dfs_dir: direntry object of the UBI device debugfs directory
361 * @dfs_chk_gen: debugfs knob to enable UBI general extra checks
362 * @dfs_chk_io: debugfs knob to enable UBI I/O extra checks
363 * @dfs_disable_bgt: debugfs knob to disable the background task
364 * @dfs_emulate_bitflips: debugfs knob to emulate bit-flips
365 * @dfs_emulate_io_failures: debugfs knob to emulate write/erase failures
366 */
367struct ubi_debug_info {
368 unsigned int chk_gen:1;
369 unsigned int chk_io:1;
370 unsigned int disable_bgt:1;
371 unsigned int emulate_bitflips:1;
372 unsigned int emulate_io_failures:1;
373 char dfs_dir_name[UBI_DFS_DIR_LEN + 1];
374 struct dentry *dfs_dir;
375 struct dentry *dfs_chk_gen;
376 struct dentry *dfs_chk_io;
377 struct dentry *dfs_disable_bgt;
378 struct dentry *dfs_emulate_bitflips;
379 struct dentry *dfs_emulate_io_failures;
380};
381
382/**
345 * struct ubi_device - UBI device description structure 383 * struct ubi_device - UBI device description structure
346 * @dev: UBI device object to use the the Linux device model 384 * @dev: UBI device object to use the the Linux device model
347 * @cdev: character device object to create character device 385 * @cdev: character device object to create character device
@@ -545,7 +583,7 @@ struct ubi_device {
545 struct mutex buf_mutex; 583 struct mutex buf_mutex;
546 struct mutex ckvol_mutex; 584 struct mutex ckvol_mutex;
547 585
548 struct ubi_debug_info *dbg; 586 struct ubi_debug_info dbg;
549}; 587};
550 588
551/** 589/**