Add ring buffer flush ioctl
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 23 Jun 2011 19:40:58 +0000 (15:40 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 23 Jun 2011 19:40:58 +0000 (15:40 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lib/ringbuffer/ring_buffer_vfs.c
lib/ringbuffer/vfs.h

index 9786d353cba185b696cddf61f7238bfea22443f7..60d69a929b816a8c0db1a0216688b6e73fb527d2 100644 (file)
@@ -245,6 +245,9 @@ long lib_ring_buffer_ioctl(struct file *filp, unsigned int cmd, unsigned long ar
                return put_ulong(buf->backend.array[sb_bindex]->mmap_offset,
                                 arg);
        }
+       case RING_BUFFER_FLUSH:
+               lib_ring_buffer_switch_slow(buf, SWITCH_ACTIVE);
+               return 0;
        default:
                return -ENOIOCTLCMD;
        }
@@ -355,6 +358,9 @@ long lib_ring_buffer_compat_ioctl(struct file *filp, unsigned int cmd,
                        return -EINVAL;
                return put_ulong(read_offset, arg);
        }
+       case RING_BUFFER_FLUSH:
+               lib_ring_buffer_switch_slow(buf, SWITCH_ACTIVE);
+               return 0;
        default:
                return -ENOIOCTLCMD;
        }
index 0a09637af2b37c4e036c418745132a7198689c2f..d073e4c555fe89e22b0ff78afcc22b0ba2f75c2f 100644 (file)
@@ -83,5 +83,7 @@ long lib_ring_buffer_compat_ioctl(struct file *filp, unsigned int cmd,
 #define RING_BUFFER_GET_MMAP_LEN               _IOR(0xF6, 0x0A, unsigned long)
 /* returns the offset of the subbuffer belonging to the mmap reader. */
 #define RING_BUFFER_GET_MMAP_READ_OFFSET       _IOR(0xF6, 0x0B, unsigned long)
+/* flush the current sub-buffer */
+#define RING_BUFFER_FLUSH                      _IO(0xF6, 0x0C)
 
 #endif /* _LINUX_RING_BUFFER_VFS_H */
This page took 0.026505 seconds and 4 git commands to generate.