[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <131869.1680011531@warthog.procyon.org.uk>
Date: Tue, 28 Mar 2023 14:52:11 +0100
From: David Howells <dhowells@...hat.com>
To: Jia Zhu <zhujia.zj@...edance.com>
Cc: dhowells@...hat.com, linux-cachefs@...hat.com,
linux-erofs@...ts.ozlabs.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, Xin Yin <yinxin.x@...edance.com>,
Jingbo Xu <jefflexu@...ux.alibaba.com>
Subject: Re: [PATCH V4 1/5] cachefiles: introduce object ondemand state
Jia Zhu <zhujia.zj@...edance.com> wrote:
> +enum cachefiles_object_state {
> + CACHEFILES_ONDEMAND_OBJSTATE_close, /* Anonymous fd closed by daemon or initial state */
> + CACHEFILES_ONDEMAND_OBJSTATE_open, /* Anonymous fd associated with object is available */
That looks weird. Maybe make them all-lowercase?
> @@ -296,6 +302,21 @@ extern void cachefiles_ondemand_clean_object(struct cachefiles_object *object);
> extern int cachefiles_ondemand_read(struct cachefiles_object *object,
> loff_t pos, size_t len);
>
> +#define CACHEFILES_OBJECT_STATE_FUNCS(_state) \
> +static inline bool \
> +cachefiles_ondemand_object_is_##_state(const struct cachefiles_object *object) \
> +{ \
> + return object->state == CACHEFILES_ONDEMAND_OBJSTATE_##_state; \
> +} \
> + \
> +static inline void \
> +cachefiles_ondemand_set_object_##_state(struct cachefiles_object *object) \
> +{ \
> + object->state = CACHEFILES_ONDEMAND_OBJSTATE_##_state; \
> +}
> +
> +CACHEFILES_OBJECT_STATE_FUNCS(open);
> +CACHEFILES_OBJECT_STATE_FUNCS(close);
Or just get rid of the macroisation? If there are only two states, it doesn't
save you that much and it means that "make TAGS" won't generate refs for those
functions and grep won't find them.
David
Powered by blists - more mailing lists