Discussion:
[pcp] PCP Updates: Expand PCP File I/O Layer
Dave Brolley
2017-06-30 18:59:39 UTC
Permalink
*** not ready for merge ***

The following changes expand on mgoodwin's initial file I/O layer. The
initial intention is for this abstraction to be used to implement
seamless (de)compression of PCP archives, however, the abstraction
could, in theory, be used for any PCP file for the same purpose, or
other purposes, as appropriate.

Many places in PCP (libpcp and several privileged tools) pass archive
file handles around with no other context. In order to avoid
over-complicating the implementation, all three archive files are now
declared as (__pmFILE *) and will use this I/O layer. Those which are
not immediately to support seamless (de)compression will use the stdio
handler of the abstraction. This change changes pmloglabel(1),
pmlogrewrite(1), pmlogextract(1) and pmlogreduce(1) to use this I/O
layer for all archive-related I/O.

libpcp has not yet been converted. In order to maintain the code in a
compilable and working state, __pmFILE is temporarily declared as

typedef FILE __pmFILE;

Similarly, all of the I/O layer API functions are currently simple pass
throughs to the original stdio and POSIX API functions. Once we have all
of the call sites converted, we can finish the implement a proper stdio
handler for the abstraction and switch __pmFILE back to the definition
initially provided by mgoodwin. From there we can work on implementing
the decompressing handler.

Dave

-------------------------------------------------------------------------------------------------------------

Changes committed to git://git.pcp.io/brolley/pcp decompress

Dave Brolley (2):
pmlogreduce(1): Remove unused _pmLogGet().
Expand on mgoodwin's initial file I/O layer.

qa/pmlogconv/logio.c | 13 +--
qa/pmlogconv/pmlogconv.c | 30 +++----
qa/src/chkputlogresult.c | 9 +-
src/include/pcp/impl.h | 38 +++++----
src/libpcp/src/check-statics | 4 -
src/libpcp/src/exports | 12 +++
src/libpcp/src/io.c | 77 +++++++++++++++++---
src/libpcp/src/io_stdio.c | 3
src/libpcp/src/io_xz.c | 2
src/pmlogextract/logio.c | 13 +--
src/pmlogextract/pmlogextract.c | 56 +++++++-------
src/pmloglabel/pmloglabel.c | 25 +++---
src/pmlogreduce/indom.c | 2
src/pmlogreduce/logio.c | 154
----------------------------------------
src/pmlogreduce/pmlogreduce.c | 10 +-
src/pmlogrewrite/indom.c | 4 -
src/pmlogrewrite/logio.c | 13 +--
src/pmlogrewrite/metric.c | 3
src/pmlogrewrite/pmlogrewrite.c | 60 +++++++--------
src/pmlogrewrite/result.c | 5 -
20 files changed, 235 insertions(+), 298 deletions(-)

Details ...

commit 2322bdf7bd5fd8f852dd2f5a3ee4a4c117713844
Author: Dave Brolley <***@redhat.com>
Date: Fri Jun 30 14:38:15 2017 -0400

Expand on mgoodwin's initial file I/O layer.

Replace more file I/O calls on archive-related files with
__pm* equivalents. The current set of functions in the I/O layer
are:

PCP_CALL extern __pmFILE *__pmFopen(const char *, const char *);
PCP_CALL extern int __pmFseek(__pmFILE *, long, int);
PCP_CALL extern void __pmRewind(__pmFILE *);
PCP_CALL extern long __pmFtell(__pmFILE *);
PCP_CALL extern size_t __pmFread(void *, size_t, size_t, __pmFILE *);
PCP_CALL extern int __pmFflush(__pmFILE *);
PCP_CALL extern int __pmFsync(__pmFILE *);
PCP_CALL extern off_t __pmLseek(__pmFILE *, off_t, int);
PCP_CALL extern int __pmFstat(__pmFILE *, struct stat *);
PCP_CALL extern int __pmFclose(__pmFILE *);

pmloglabel(1), pmlogrewrite(1), pmlogextract(1) and pmlogreduce(1)
now use this API for all archive file I/O.

All three archive files (l_mfp, l_mdfp, l_tifp) are now (__pmFILE *).
__pmFILE is temporarily typedefed as

typedef FILE __pmFILE;

until we can get all of the call sites converted.

commit 4124c71af315715ea04851a94a19c4bf65d53d73
Author: Dave Brolley <***@redhat.com>
Date: Tue Jun 27 12:14:14 2017 -0400

pmlogreduce(1): Remove unused _pmLogGet().


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links:

You receive all messages sent to this group.

View/Reply Online (#16158): https://groups.io/g/pcp/message/16158
View All Messages In Topic (1): https://groups.io/g/pcp/topic/5433430
Mute This Topic: https://groups.io/mt/5433430/174549
New Topic: https://groups.io/g/pcp/post
-=-=-
pcp mailing list
***@groups.io
https://groups.io/g/pcp/messages
-=-=-
Change Your Subscription: https://groups.io/g/pcp/editsub/174549
Group Home: https://groups.io/g/pcp
Contact Group Owner: pcp+***@groups.io
Terms of Service: https://groups.io/static/tos
Unsubscribe: https://groups.io/g/pcp/leave/354206/1187008340/xyzzy
-=-=-=-=-=-=-=-=-=-=-=-
Dave Brolley
2017-07-13 18:19:46 UTC
Permalink
Some more work in this area. More calls converted to use I/O layer APIs.

Changes committed to git://git.pcp.io/brolley/pcp decompress

Dave Brolley (3):
pmlogger(1): Replace file I/O calls on archive-related files with
__pm* equivalents.
libpcp_import: Replace file I/O calls on archive-related files
with __pm* equivalents.
libpcp: Replace file I/O calls on archive-related files with
__pm* equivalents.

src/include/pcp/impl.h | 2
src/libpcp/src/context.c | 8 -
src/libpcp/src/exports | 2
src/libpcp/src/interp.c | 32 +++----
src/libpcp/src/io.c | 12 ++
src/libpcp/src/logmeta.c | 28 +++---
src/libpcp/src/logutil.c | 182
++++++++++++++++++++--------------------
src/libpcp_import/src/archive.c | 5 -
src/libpcp_import/src/import.c | 4
src/pmlogger/src/callback.c | 32 +++----
src/pmlogger/src/dopdu.c | 4
src/pmlogger/src/pmlogger.c | 10 +-
src/pmlogger/src/preamble.c | 9 +
13 files changed, 174 insertions(+), 156 deletions(-)

Details ...

commit a73bc02cc708506baf587a63c0af007c6a9c9c14
Author: Dave Brolley <***@redhat.com>
Date: Wed Jul 12 17:41:40 2017 -0400

libpcp: Replace file I/O calls on archive-related files with __pm*
equivalents.

commit 29f2692a007973043241ff84abd18fc992252cf5
Author: Dave Brolley <***@redhat.com>
Date: Wed Jul 12 16:45:29 2017 -0400

libpcp_import: Replace file I/O calls on archive-related files with
__pm* equivalents.

commit c9ef7fc7ffe23183c9b62c9f178f588734182548
Author: Dave Brolley <***@redhat.com>
Date: Tue Jul 11 13:48:02 2017 -0400

pmlogger(1): Replace file I/O calls on archive-related files with
__pm* equivalents.



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links:

You receive all messages sent to this group.

View/Reply Online (#16217): https://groups.io/g/pcp/message/16217
View All Messages In Topic (2): https://groups.io/g/pcp/topic/5433430
Mute This Topic: https://groups.io/mt/5433430/174549
New Topic: https://groups.io/g/pcp/post
-=-=-
pcp mailing list
***@groups.io
https://groups.io/g/pcp/messages
-=-=-
Change Your Subscription: https://groups.io/g/pcp/editsub/174549
Group Home: https://groups.io/g/pcp
Contact Group Owner: pcp+***@groups.io
Terms of Service: https://groups.io/static/tos
Unsubscribe: https://groups.io/g/pcp/leave/354206/1187008340/xyzzy
-=-=-=-=-=-=-=-=-=-=-=-
Dave Brolley
2017-07-17 15:58:42 UTC
Permalink
This branch may now be considered for merging if there are no problems
with the approach. The branch passes qa with no regressions on my
development machine.

There are a few more places in archive-related tools that need to be
converted to using the new I/O API. I'll be working on that next.

Dave

-------------------------------------------------------------------------------------------------------------------

Changes committed to git://git.pcp.io/brolley/pcp decompress

Dave Brolley (1):
Re-enable __pmFILE interface for archive I/O.

qa/src/chkputlogresult.c | 4 -
src/include/pcp/impl.h | 39 ++++++----
src/libpcp/src/check-statics | 2
src/libpcp/src/exports | 5 +
src/libpcp/src/interp.c | 2
src/libpcp/src/io.c | 118 ++++++++++++++++++++++-----------
src/libpcp/src/io_stdio.c | 143
++++++++++++++++++++++++++++------------
src/libpcp/src/logmeta.c | 36 +++++-----
src/libpcp/src/logutil.c | 82 +++++++++++-----------
src/pmlogextract/logger.h | 2
src/pmlogextract/logio.c | 10 +-
src/pmlogextract/pmlogextract.c | 4 -
src/pmlogger/src/callback.c | 8 +-
src/pmlogger/src/pmlogger.c | 2
src/pmlogger/src/preamble.c | 4 -
src/pmloglabel/pmloglabel.c | 12 +--
src/pmlogreduce/logio.c | 8 +-
src/pmlogreduce/pmlogreduce.h | 2
src/pmlogrewrite/logio.c | 4 -
src/pmlogrewrite/pmlogrewrite.c | 10 +-
20 files changed, 310 insertions(+), 187 deletions(-)

Details ...

commit 6fa34e47c5aa4b486963b146dd61f949c6abc9c5
Author: Dave Brolley <***@redhat.com>
Date: Mon Jul 17 11:51:27 2017 -0400

Re-enable __pmFILE interface for archive I/O.

This re-introduces mgoodwin's __pmFILE interface for archive
I/O. __pmFILE is no longer the same as FILE.

This exposed some un-converted I/O calls as well as the need for
a few more stdio-like API functions. The stdio-handler implementation
of the I/O layer has also been fleshed out.



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links:

You receive all messages sent to this group.

View/Reply Online (#16230): https://groups.io/g/pcp/message/16230
View All Messages In Topic (3): https://groups.io/g/pcp/topic/5433430
Mute This Topic: https://groups.io/mt/5433430/174549
New Topic: https://groups.io/g/pcp/post
-=-=-
pcp mailing list
***@groups.io
https://groups.io/g/pcp/messages
-=-=-
Change Your Subscription: https://groups.io/g/pcp/editsub/174549
Group Home: https://groups.io/g/pcp
Contact Group Owner: pcp+***@groups.io
Terms of Service: https://groups.io/static/tos
Unsubscribe: https://groups.io/g/pcp/leave/354206/1187008340/xyzzy
-=-=-=-=-=-=-=-=-=-=-=-
Dave Brolley
2017-07-19 19:11:11 UTC
Permalink
One final tool, pmlogcheck(1), was doing its own direct file I/O on PCP
archives, bypassing even the __pmLogCtl mechanism.

This exposed one additional stdio-like API to implement, which was fgetc().

---------------------------------------------------------------------------------------------

Changes committed to git://git.pcp.io/brolley/pcp decompress

Dave Brolley (1):
pmlogcheck(1): Use libpcp file I/O layer for archive I/O.

src/include/pcp/impl.h | 2 ++
src/libpcp/src/exports | 1 +
src/libpcp/src/io.c | 6 ++++++
src/libpcp/src/io_stdio.c | 8 ++++++++
src/pmlogcheck/pass0.c | 27 ++++++++++++++-------------
5 files changed, 31 insertions(+), 13 deletions(-)

Details ...

commit 6d58a5d3a83e38e91a133243895651a6e8d70cfa
Author: Dave Brolley <***@redhat.com>
Date: Wed Jul 19 14:58:24 2017 -0400

pmlogcheck(1): Use libpcp file I/O layer for archive I/O.



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links:

You receive all messages sent to this group.

View/Reply Online (#16243): https://groups.io/g/pcp/message/16243
View All Messages In Topic (4): https://groups.io/g/pcp/topic/5433430
Mute This Topic: https://groups.io/mt/5433430/174549
New Topic: https://groups.io/g/pcp/post
-=-=-
pcp mailing list
***@groups.io
https://groups.io/g/pcp/messages
-=-=-
Change Your Subscription: https://groups.io/g/pcp/editsub/174549
Group Home: https://groups.io/g/pcp
Contact Group Owner: pcp+***@groups.io
Terms of Service: https://groups.io/static/tos
Unsubscribe: https://groups.io/g/pcp/leave/354206/1187008340/xyzzy
-=-=-=-=-=-=-=-=-=-=-=-

Loading...