DEV: haring: automatically use the advertised ring header size
Instead of emitting a warning, since we don't need the ring struct anymore, we can just read what we need, parse the buffer and use the advertised offset. Thus for now -f is simply ignored.
This commit is contained in:
parent
77d7c35243
commit
88e141b823
@ -44,9 +44,6 @@ int repair = 0; // repair file
|
|||||||
|
|
||||||
struct ring_v1 {
|
struct ring_v1 {
|
||||||
struct buffer buf; // storage area
|
struct buffer buf; // storage area
|
||||||
struct list waiters; // list of waiters, for now, CLI "show event"
|
|
||||||
__decl_thread(HA_RWLOCK_T lock);
|
|
||||||
int readers_count;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* display the message and exit with the code */
|
/* display the message and exit with the code */
|
||||||
@ -160,14 +157,8 @@ int dump_ring_as_buf(struct buffer buf, size_t ofs, int flags)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function dumps all events from the ring whose pointer is in <p0> into
|
/* This function dumps all events from the ring <ring> from offset <ofs> and
|
||||||
* the appctx's output buffer, and takes from <o0> the seek offset into the
|
* with flags <flags>.
|
||||||
* buffer's history (0 for oldest known event). It looks at <i0> for boolean
|
|
||||||
* options: bit0 means it must wait for new data or any key to be pressed. Bit1
|
|
||||||
* means it must seek directly to the end to wait for new contents. It returns
|
|
||||||
* 0 if the output buffer or events are missing is full and it needs to be
|
|
||||||
* called again, otherwise non-zero. It is meant to be used with
|
|
||||||
* cli_release_show_ring() to clean up.
|
|
||||||
*/
|
*/
|
||||||
int dump_ring_v1(struct ring_v1 *ring, size_t ofs, int flags)
|
int dump_ring_v1(struct ring_v1 *ring, size_t ofs, int flags)
|
||||||
{
|
{
|
||||||
@ -181,20 +172,6 @@ int dump_ring_v1(struct ring_v1 *ring, size_t ofs, int flags)
|
|||||||
* run a few checks first. After that we'll create our own buffer
|
* run a few checks first. After that we'll create our own buffer
|
||||||
* descriptor matching that area.
|
* descriptor matching that area.
|
||||||
*/
|
*/
|
||||||
if ((((long)ring->buf.area) & 4095) != sizeof(*ring)) {
|
|
||||||
if (!force) {
|
|
||||||
fprintf(stderr, "FATAL: header in file is %ld bytes long vs %ld expected!\n",
|
|
||||||
(((long)ring->buf.area) & 4095),
|
|
||||||
(long)sizeof(*ring));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fprintf(stderr, "WARNING: header in file is %ld bytes long vs %ld expected!\n",
|
|
||||||
(((long)ring->buf.area) & 4095),
|
|
||||||
(long)sizeof(*ring));
|
|
||||||
}
|
|
||||||
/* maybe we could emit a warning at least ? */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now make our own buffer pointing to that area */
|
/* Now make our own buffer pointing to that area */
|
||||||
buf = b_make(((void *)ring + (((long)ring->buf.area) & 4095)),
|
buf = b_make(((void *)ring + (((long)ring->buf.area) & 4095)),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user