[PROTO] redesign lock handler events. add new subtype 98/27698/2
authorVitaliy Cherepanov <v.cherepanov@samsung.com>
Wed, 17 Sep 2014 13:18:25 +0000 (17:18 +0400)
committerDmitry Kovalenko <d.kovalenko@samsung.com>
Thu, 25 Sep 2014 07:23:06 +0000 (00:23 -0700)
id  event
14: lock_ack_start
15: lock_ack_end
16: lock_release

Change-Id: I375df27b13b36c82a8e4db67e11c76ee0c8c1f51
Signed-off-by: Vitaliy Cherepanov <v.cherepanov@samsung.com>
ks_features/file_ops.c

index 500d01e..dfc64d0 100644 (file)
@@ -37,8 +37,9 @@ enum {
        FOPS_RECV               = 10,
        FOPS_OPTION             = 11,
        FOPS_MANAGE             = 12,
-       FOPS_LOCK               = 14, /* 13 */
-       FOPS_UNLOCK             = 15
+       FOPS_LOCK_START         = 14, /* 13 */
+       FOPS_LOCK_END           = 15,
+       FOPS_LOCK_RELEASE       = 16
 };
 
 struct file_probe {
@@ -565,8 +566,8 @@ static int lock_entry_handler(struct kretprobe_instance *ri,
                        filepath = fops_fpath(file, buf, PATH_LEN);
 
                        if (lock_arg_init(fprobe->id, regs, &arg) == 0) {
-                               subtype = (arg.type == F_UNLCK ? FOPS_UNLOCK:
-                                                                FOPS_LOCK);
+                               subtype = (arg.type == F_UNLCK ? FOPS_LOCK_RELEASE:
+                                                                FOPS_LOCK_START);
 
                                custom_entry_event(F_ADDR(rp), regs, PT_FILE,
                                                   subtype, "Sxddxx",
@@ -598,9 +599,16 @@ static int lock_ret_handler(struct kretprobe_instance *ri,
        struct kretprobe *rp = ri->rp;
        struct flock_private *priv = (struct flock_private *)ri->data;
 
-       if (rp && priv->dentry)
+       if (rp && priv->dentry) {
+               int subtype;
+               if (priv->subtype == FOPS_LOCK_START)
+                       subtype = FOPS_LOCK_END; /* lock ret marked as lock_end */
+               else
+                       subtype = priv->subtype;
+
                custom_exit_event(F_ADDR(rp), R_ADDR(ri), regs,
-                                 PT_FILE, priv->subtype, "x");
+                                 PT_FILE, subtype, "x");
+       }
 
        return 0;
 }