[PATCH v1 1/2] Add some comments about const-ness around iterate API
Gao Xiang
hsiangkao at linux.alibaba.com
Wed Dec 22 12:44:32 AEDT 2021
Hi Kelvin,
On Tue, Dec 21, 2021 at 06:28:28AM -0800, Kelvin Zhang wrote:
> Change-Id: I297a56ba14a37ef5eced95330a5b09109378ca44
> Signed-off-by: Kelvin Zhang <zhangkelvin at google.com>
Would you mind add "erofs-utils: lib: " to the subject prefix,
also drop the "Change-Id:" field so I could apply it.
Adding some commit message is better, even it's trivial and
simple.
Thanks,
Gao Xiang
> ---
> include/erofs/dir.h | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/include/erofs/dir.h b/include/erofs/dir.h
> index 77656ca..59bd40d 100644
> --- a/include/erofs/dir.h
> +++ b/include/erofs/dir.h
> @@ -39,6 +39,14 @@ typedef int (*erofs_readdir_cb)(struct erofs_dir_context *);
> * the callback context. |de_namelen| is the exact dirent name length.
> */
> struct erofs_dir_context {
> + /* During execution of |erofs_iterate_dir|, the function needs
> + * to read the values inside |erofs_inode* dir|. So it is important
> + * that the callback function does not modify stuct pointed by
> + * |dir|. It is OK to repoint |dir| to other objects.
> + * Unfortunately, it's not possible to enforce this restriction
> + * with const keyword, as |erofs_iterate_dir| needs to modify
> + * struct pointed by |dir|.
> + */
> struct erofs_inode *dir;
> erofs_readdir_cb cb;
> erofs_nid_t pnid; /* optional */
> --
> 2.34.1.307.g9b7440fafd-goog
More information about the Linux-erofs
mailing list