Re: difference between DECLARE_* and DEFINE_* macro namespaces ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2022-09-21 at 13:33 -0600, jim.cromie@xxxxxxxxx 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
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux