Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct data{
- struct data *next;
- struct msghdr *msg;
- size_t len;
- }
- struct data *head = NULL;
- void add_to_end(struct data *newData){
- struct data *temp1;
- if (head == NULL){
- head = (struct data *)kmalloc(sizeof(struct data),GFP_KERNEL);
- head = newData;
- } else {
- temp1 = (struct data *)kmalloc(sizeof(struct data),GFP_KERNEL);
- temp1 = head;
- while(temp1->next!=NULL) {
- temp1 = temp->next;
- }
- temp1->next = newData;
- }
- }
- struct data *temp;
- temp = (struct data *)kmalloc(sizeof(struct data),GFP_KERNEL);
- temp->next = NULL;
- temp->msg = (struct msghdr *)kmalloc(sizeof(struct msghdr),GFP_KERNEL);
- temp->msg = message;
- temp->len = length;
- add_to_end(temp);
- temp->msg = (struct msghdr *)kmalloc(sizeof(struct msghdr),GFP_KERNEL);
- // temp->msg = message;
- memcpy(temp->msg, message, sizeof(struct msghdr));
- DEFINE_RAW_SPINLOCK(mylock);
- LIST_HEAD(vm_list);
- ....
- my_function() {
- ....
- raw_spin_lock(&kvm_lock);
- list_for_each_entry(kvm, &vm_list, vm_list)
- *val += *(u32 *)((void *)kvm + offset);
- raw_spin_unlock(&kvm_lock);
- }
- head = (struct data *)kmalloc(sizeof(struct data),GFP_KERNEL);
- head = newData;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement