All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/2] Add some comments about const-ness around iterate API
@ 2021-12-21 14:28 Kelvin Zhang via Linux-erofs
  2021-12-21 14:28 ` [PATCH v1 2/2] Add API to get on disk size of an inode Kelvin Zhang via Linux-erofs
  2021-12-22  1:44 ` [PATCH v1 1/2] Add some comments about const-ness around iterate API Gao Xiang
  0 siblings, 2 replies; 14+ messages in thread
From: Kelvin Zhang via Linux-erofs @ 2021-12-21 14:28 UTC (permalink / raw)
  To: linux-erofs mailing list, Miao Xie, Fang Wei; +Cc: Kelvin Zhang

Change-Id: I297a56ba14a37ef5eced95330a5b09109378ca44
Signed-off-by: Kelvin Zhang <zhangkelvin@google.com>
---
 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


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-01-05  0:53 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-21 14:28 [PATCH v1 1/2] Add some comments about const-ness around iterate API Kelvin Zhang via Linux-erofs
2021-12-21 14:28 ` [PATCH v1 2/2] Add API to get on disk size of an inode Kelvin Zhang via Linux-erofs
2021-12-22  1:46   ` Gao Xiang
2021-12-22  1:46     ` Kelvin Zhang via Linux-erofs
2021-12-22  1:50       ` Gao Xiang
2021-12-22  1:54         ` [PATCH v3 1/2] erofs-utils: lib: Add some comments about const-ness around iterate API Kelvin Zhang via Linux-erofs
2021-12-22  1:54           ` [PATCH v3 2/2] erofs-utils: lib: Add API to get on disk size of an inode Kelvin Zhang via Linux-erofs
2021-12-22  1:44 ` [PATCH v1 1/2] Add some comments about const-ness around iterate API Gao Xiang
2021-12-22  1:49   ` [PATCH v2 1/3] erofs-utils: lib: " Kelvin Zhang via Linux-erofs
2021-12-22  1:49     ` [PATCH v2 2/3] erofs-utils: lib: Add API to get on disk size of an inode Kelvin Zhang via Linux-erofs
2022-01-04 23:37     ` [PATCH v2 1/3] erofs-utils: lib: Add some comments about const-ness around iterate API Kelvin Zhang via Linux-erofs
2022-01-05  0:23       ` Gao Xiang
2022-01-05  0:24         ` Kelvin Zhang via Linux-erofs
2022-01-05  0:51       ` Gao Xiang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.