memset and atomic_set difference

I am new to learning C and C kernel programming, so please excuse me if the below question is not properly related.

I have seen use of both memset for initializing a value for a certain memory location such as below

iscsitarget-    memset(p, 0, padding);
iscsitarget-    memset(ctx, 0, sizeof(*ctx));
iscsitarget- memset(session, 0, sizeof(*session));
iscsitarget- memset(&info, 0x0, sizeof(info));
iscsitarget-   memset(&msg, 0, sizeof(msg));
iscsitarget-   memset(&msg, 0, sizeof(msg));

and recently I came across atomic_set, which again initializes a memory location with certain value such as

atomic_set(&tio_work->error, error);

So My question is

What is the difference between the two (memset and atomic_set)? Are they related?

Source: New Questions

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.