+#ifdef UMOUNT_LOG
+int print_link_list=0;
+#ifndef CONFIG_SMP
+ preempt_disable();
+#endif
+
+ if (strcmp(UMOUNT_Partition,mnt->mnt_devname)==0)
+ {
+ //if (strcmp("mobile_log_d",current->comm)!=0)
+ {
+ //if (current->pid < 100) //((current->pid < 70) && (current->pid > 60))
+ {
+ //printk("Ahsin n=%d current->pid=%d name=%s \n",n,current->pid,current->comm);
+ spin_lock(&mnt_id_lock);
+ if (ref_head == NULL) //linked list head (start)
+ {
+ printk("Ahsin link list init mnt_get_count=%d \n",mnt_get_count(mnt));
+
+ ref_current = kmalloc(sizeof(struct record_ref_count), GFP_KERNEL);
+ if (ref_current == NULL)
+ printk("Ahsin can't allocate memory for ref_current /n");
+
+ ref_current->next = NULL;
+ ref_current->pid = current->pid;
+ strncpy(ref_current->name, current->comm, TASK_COMM_LEN -1);
+ ref_current->name[TASK_COMM_LEN -1] = '\0';
+ ref_current->count = n;
+ s_total_count = s_total_count + n;
+ ref_head = ref_current;
+
+ printk("Ahsin ref_head == NULL pid=%d name=%s counter=%d n=%d \n",ref_current->pid,ref_current->name,ref_current->count,n);
+ }
+ else //check exist first and then add linked list or modify counter
+ {
+ ref_prev = ref_head;
+ while(ref_prev != NULL)
+ {
+ //printk("Ahsin PID= %d, Name= %s, Count= %d n=%d current->pid=%d \n", ref_prev->pid, ref_prev->name, ref_prev->count,n,current->pid);
+ if (strcmp(ref_prev->name,current->comm)==0) //(ref_prev->pid==current->pid)//exist and find, modify counter
+ {
+ ref_prev->count = ref_prev->count + n;
+ s_total_count = s_total_count + n;
+ //printk("Ahsin (ref_prev->name,current->comm) pid=%d name=%s counter=%d n=%d \n",ref_prev->pid,ref_prev->name,ref_prev->count,n);
+ break;
+ }
+ else
+ {
+ if (ref_prev->next != NULL)
+ ref_prev = ref_prev->next;
+ else
+ { // end of link list
+ ref_current = kmalloc(sizeof(struct record_ref_count), GFP_KERNEL);
+ if (ref_current == NULL)
+ printk("Ahsin can't allocate memory for ref_prev /n");
+
+ ref_current->next = NULL;
+ ref_current->pid = current->pid;
+ strncpy(ref_current->name, current->comm, TASK_COMM_LEN -1);
+ ref_current->name[TASK_COMM_LEN -1] = '\0';
+ ref_current->count = n;
+ s_total_count = s_total_count + n;
+ ref_prev->next = ref_current;
+ //printk("Ahsin new node(end of link list) pid=%d name=%s counter=%d n=%d \n",ref_current->pid,ref_current->name,ref_current->count,n);
+ break;
+
+ }
+ }
+ }
+ }
+ spin_unlock(&mnt_id_lock);
+ }
+ }
+ }
+
+#ifndef CONFIG_SMP
+ preempt_enable();
+#endif
+#endif