On Wed, 2022-09-21 at 13:33 -0600, [email protected] wrote:
> difference between DECLARE_* and DEFINE_* macro namespaces ?

I am not sure there is a clear difference any more nowadays.

Both DECLARE_* and DEFINE_* seem to be used for both defining
a type and declaring an (often initialized) instance of that type.

For example, DEFINE_SPINLOCK creates an unlocked spinlock:

#define DEFINE_SPINLOCK(x)      spinlock_t x = __SPIN_LOCK_UNLOCKED(x)

Meanwhile, DECLARE_RWSEM does the exact same thing, but for
the rw_semaphore:

#define DECLARE_RWSEM(name) \
        struct rw_semaphore name = __RWSEM_INITIALIZER(name)

-- 
All Rights Reversed.

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Kernelnewbies mailing list
[email protected]
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Reply via email to