X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=ltt-debugfs-abi.c;h=4717b81e14621f43792cbf5df36d7627c7143de0;hb=0a84a57fc9409a29d63b0dec930a56da4a0a743c;hp=d08459c0dbabbdd65e3f9aa5088893b9e8495f44;hpb=305d3e421261fe854256c3bc4772d90551f2c441;p=lttng-modules.git diff --git a/ltt-debugfs-abi.c b/ltt-debugfs-abi.c index d08459c0..4717b81e 100644 --- a/ltt-debugfs-abi.c +++ b/ltt-debugfs-abi.c @@ -75,6 +75,7 @@ int lttng_abi_create_session(void) ret = PTR_ERR(session_filp); goto file_error; } + session->file = session_filp; fd_install(session_fd, session_filp); return session_fd; @@ -153,6 +154,7 @@ int lttng_abi_create_channel(struct file *session_filp, ret = -ENOMEM; goto chan_error; } + channel->file = chan_filp; chan_filp->private_data = chan; fd_install(chan_fd, chan_filp); /* The channel created holds a reference on the session */ @@ -363,6 +365,14 @@ unsigned int lttng_channel_poll(struct file *filp, poll_table *wait) } +static +int lttng_channel_release(struct inode *inode, struct file *file) +{ + struct ltt_channel *channel = file->private_data; + fput(channel->session->file); + return 0; +} + static const struct file_operations lttng_channel_fops = { .release = lttng_channel_release, .poll = lttng_channel_poll, @@ -372,6 +382,18 @@ static const struct file_operations lttng_channel_fops = { #endif } +static +int lttng_event_release(struct inode *inode, struct file *file) +{ + struct ltt_event *event = file->private_data; + fput(event->chan->file); + return 0; +} + +static const struct file_operations lttng_event_fops = { + .release = lttng_event_release, +} + static int __init ltt_debugfs_abi_init(void) { int ret = 0;