return chan->finalized;
}
+static inline
+int lib_ring_buffer_channel_is_disabled(const struct channel *chan)
+{
+ return atomic_read(&chan->record_disabled);
+}
+
static inline
unsigned long lib_ring_buffer_get_read_data_size(
const struct lib_ring_buffer_config *config,
struct lib_ring_buffer *buf = filp->private_data;
struct channel *chan = buf->backend.chan;
const struct lib_ring_buffer_config *config = chan->backend.config;
- int finalized;
+ int finalized, disabled;
if (filp->f_mode & FMODE_READ) {
init_poll_funcptr(wait, wrapper_pollwait_exclusive);
poll_wait(filp, &buf->read_wait, wait);
finalized = lib_ring_buffer_is_finalized(config, buf);
+ disabled = lib_ring_buffer_channel_is_disabled(chan);
+
/*
* lib_ring_buffer_is_finalized() contains a smp_rmb() ordering
* finalized load before offsets loads.
*/
WARN_ON(atomic_long_read(&buf->active_readers) != 1);
retry:
+ if (disabled)
+ return POLLERR;
+
if (subbuf_trunc(lib_ring_buffer_get_offset(config, buf), chan)
- subbuf_trunc(lib_ring_buffer_get_consumed(config, buf), chan)
== 0) {
struct channel *chan = buf->backend.chan;
const struct lib_ring_buffer_config *config = chan->backend.config;
+ if (lib_ring_buffer_channel_is_disabled(chan))
+ return -EIO;
+
switch (cmd) {
case RING_BUFFER_SNAPSHOT:
return lib_ring_buffer_snapshot(buf, &buf->cons_snapshot,
struct channel *chan = buf->backend.chan;
const struct lib_ring_buffer_config *config = chan->backend.config;
+ if (lib_ring_buffer_channel_is_disabled(chan))
+ return -EIO;
+
switch (cmd) {
case RING_BUFFER_SNAPSHOT:
return lib_ring_buffer_snapshot(buf, &buf->cons_snapshot,
poll_wait(file, channel->ops->get_hp_wait_queue(channel->chan),
wait);
+ if (channel->ops->is_disabled(channel->chan))
+ return POLLERR;
if (channel->ops->is_finalized(channel->chan))
return POLLHUP;
else
wait_queue_head_t *(*get_reader_wait_queue)(struct channel *chan);
wait_queue_head_t *(*get_hp_wait_queue)(struct channel *chan);
int (*is_finalized)(struct channel *chan);
+ int (*is_disabled)(struct channel *chan);
};
struct ltt_channel {
return lib_ring_buffer_channel_is_finalized(chan);
}
+static
+int ltt_is_disabled(struct channel *chan)
+{
+ return lib_ring_buffer_channel_is_disabled(chan);
+}
+
static struct ltt_transport ltt_relay_transport = {
.name = "relay-" RING_BUFFER_MODE_TEMPLATE_STRING,
.owner = THIS_MODULE,
.get_reader_wait_queue = ltt_get_reader_wait_queue,
.get_hp_wait_queue = ltt_get_hp_wait_queue,
.is_finalized = ltt_is_finalized,
+ .is_disabled = ltt_is_disabled,
},
};
return lib_ring_buffer_channel_is_finalized(chan);
}
+static
+int ltt_is_disabled(struct channel *chan)
+{
+ return lib_ring_buffer_channel_is_disabled(chan);
+}
+
static struct ltt_transport ltt_relay_transport = {
.name = "relay-" RING_BUFFER_MODE_TEMPLATE_STRING,
.owner = THIS_MODULE,
.get_reader_wait_queue = ltt_get_reader_wait_queue,
.get_hp_wait_queue = ltt_get_hp_wait_queue,
.is_finalized = ltt_is_finalized,
+ .is_disabled = ltt_is_disabled,
},
};