From: Richard Weinberger <richard@nod.at>
To: Rickard X Andersson <rickard.andersson@axis.com>
Cc: chengzhihao1 <chengzhihao1@huawei.com>,
linux-mtd <linux-mtd@lists.infradead.org>,
rickard314 andersson <rickard314.andersson@gmail.com>,
kernel <kernel@axis.com>
Subject: Re: [PATCH 1/2] ubi: Expose interface for detailed erase counters
Date: Mon, 25 Nov 2024 16:44:54 +0100 (CET) [thread overview]
Message-ID: <1924178924.70981051.1732549494294.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <20241125134820.560648-1-rickard.andersson@axis.com>
----- Ursprüngliche Mail -----
> Von: "Rickard X Andersson" <rickard.andersson@axis.com>
> +/**
> + * struct ubi_ecinfo_req - a data structure used in UBI device erase count
> + * information requests and responses.
> + *
> + * @start_ec_req: first erase counter block in range to read
> + * @end_ec_req: last erase counter block in the half-open range
> + * @end_ec_res: last erase counter block that was actually read
> + * @erase_counters: array of erase counter values
> + * @padding: reserved for future, not used, has to be zeroed
> + *
> + * Erase counters are read in range @start_ec_req to @end_ec_req. Range is
> half-open
> + * i.e erase counter of end_ec_req is not actually included.
> + * The read erase counters are placed in @erase_counters. If a block is bad or
> if the
> + * erase counter is unknown the value of the block will be set to -1.
> + */
> +struct ubi_ecinfo_req {
> + __s32 start_ec_req;
> + __s32 end_ec_req;
> + __s32 end_ec_res;
> + __s32 erase_counters[1000];
There is no need to have a limited number. Just use a flexible array.
If userspace asks for more entries than the provided buffer can hold, __put_user()
will fail anyways.
Have a look at fibmap, I think you can the model the API the same way.
Thanks,
//richard
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2024-11-25 15:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-25 13:48 [PATCH 1/2] ubi: Expose interface for detailed erase counters Rickard Andersson
2024-11-25 13:48 ` [PATCH 2/2] ubi: Implement ioctl " Rickard Andersson
2024-11-25 15:44 ` Richard Weinberger [this message]
2024-11-25 15:45 ` [PATCH 1/2] ubi: Expose interface " Richard Weinberger
2024-11-26 5:09 ` Zhihao Cheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1924178924.70981051.1732549494294.JavaMail.zimbra@nod.at \
--to=richard@nod.at \
--cc=chengzhihao1@huawei.com \
--cc=kernel@axis.com \
--cc=linux-mtd@lists.infradead.org \
--cc=rickard.andersson@axis.com \
--cc=rickard314.andersson@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox