Skip to content

Commit

Permalink
mtd: edit comments on deprecation of ioctl ECCGETLAYOUT
Browse files Browse the repository at this point in the history
There were some improvements and additions necessary in the
comments explaining of the expansion of nand_ecclayout, the
introduction of nand_ecclayout_user, and the deprecation of the
ioctl ECCGETLAYOUT.

Also, I found a better placement for the macro MTD_MAX_ECCPOS_ENTRIES;
next to the definition of MTD_MAX_OOBFREE_ENTRIES in mtd-abi.h. The macro
is really only important for the ioctl code (found in drivers/mtd/mtdchar.c)
but since there are small edits being made to the user-space header, I
figured this is a better location.

Signed-off-by: Brian Norris <[email protected]>
Signed-off-by: Artem Bityutskiy <[email protected]>
Signed-off-by: David Woodhouse <[email protected]>
  • Loading branch information
computersforpeace authored and David Woodhouse committed Oct 24, 2010
1 parent cc26c3c commit 0ceacf3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion drivers/mtd/mtdchar.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ static int shrink_ecclayout(const struct nand_ecclayout *from,

memset(to, 0, sizeof(*to));

to->eccbytes = min((int)from->eccbytes, MTD_MAX_ECCPOS_ENTRIES_OLD);
to->eccbytes = min((int)from->eccbytes, MTD_MAX_ECCPOS_ENTRIES);
for (i = 0; i < to->eccbytes; i++)
to->eccpos[i] = from->eccpos[i];

Expand Down
8 changes: 4 additions & 4 deletions include/linux/mtd/mtd.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ struct mtd_oob_ops {

#define MTD_MAX_OOBFREE_ENTRIES_LARGE 32
#define MTD_MAX_ECCPOS_ENTRIES_LARGE 448
#define MTD_MAX_ECCPOS_ENTRIES_OLD 64 /* Previous maximum */
/*
* Correct ECC layout control structure. This replaces old nand_ecclayout
* (mtd-abi.h) that is exported via ECCGETLAYOUT ioctl. It should be expandable
* in the future simply by the above macros.
* Internal ECC layout control structure. For historical reasons, there is a
* similar, smaller struct nand_ecclayout_user (in mtd-abi.h) that is retained
* for export to user-space via the ECCGETLAYOUT ioctl.
* nand_ecclayout should be expandable in the future simply by the above macros.
*/
struct nand_ecclayout {
__u32 eccbytes;
Expand Down
11 changes: 8 additions & 3 deletions include/mtd/mtd-abi.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,18 @@ struct nand_oobfree {
};

#define MTD_MAX_OOBFREE_ENTRIES 8
#define MTD_MAX_ECCPOS_ENTRIES 64
/*
* ECC layout control structure. Exported to userspace for
* diagnosis and to allow creation of raw images
* OBSOLETE: ECC layout control structure. Exported to user-space via ioctl
* ECCGETLAYOUT for backwards compatbility and should not be mistaken as a
* complete set of ECC information. The ioctl truncates the larger internal
* structure to retain binary compatibility with the static declaration of the
* ioctl. Note that the "MTD_MAX_..._ENTRIES" macros represent the max size of
* the user struct, not the MAX size of the internal struct nand_ecclayout.
*/
struct nand_ecclayout_user {
__u32 eccbytes;
__u32 eccpos[64];
__u32 eccpos[MTD_MAX_ECCPOS_ENTRIES];
__u32 oobavail;
struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES];
};
Expand Down

0 comments on commit 0ceacf3

Please sign in to comment.