Add datasetio support#1
Conversation
|
augment review |
|
augment review |
🤖 Augment PR SummarySummary: Adds optional MVS dataset I/O support to zoslib, allowing paths with a Changes:
Technical Notes: Fixed-record datasets are reopened in binary mode for more efficient multi-record I/O, while variable/undefined formats use 🤖 Was this summary useful? React with 👍 or 👎 |
|
|
||
| // Write the formatted string to the specified file descriptor | ||
| written = write(fd, buffer, length); | ||
| written = __write_orig(fd, buffer, length); |
There was a problem hiding this comment.
| metadata->is_pds_member = entry->is_pds_member; | ||
| metadata->readonly = entry->readonly; | ||
|
|
||
| strncpy(metadata->member_name, entry->member_name, sizeof(metadata->member_name) - 1); |
There was a problem hiding this comment.
|
Great job! A few things to consider:
|
Thanks. I'll check on the thread-safety. Will also update man-page |
|
augment review |
|
augment review |
|
augment review |
|
|
||
|
|
||
| #define GET_DUMMY_FD(flags) (open("/dev/null", (flags) & (O_RDONLY | O_WRONLY | O_RDWR), 0)) | ||
| #define IS_DATASET(name) ((name) && ((name)[0] == '/') && ((name)[1] == '/')) |
There was a problem hiding this comment.
include/zos-datasetio.h:361: IS_DATASET(name) treats any path starting with // as a dataset, but POSIX paths can legitimately contain double-leading slashes (often equivalent to /). With dataset support enabled, this could misroute normal files (e.g., //tmp/foo) into open_dataset() and fail unexpectedly; consider tightening the predicate to the actual dataset syntax.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
|
augment review |
1 similar comment
|
augment review |
|
@sachintu47, if it helps, if you're able to use Augment in your workplace, I can ask if Augment Code still honour their "free for OSS" plan for general Augment IDE/CLI use (not just Review). |
Sure will check. @IgorTodorovskiIBM |
|
augment review |
|
augment review |
- Refactor DatasetEntry to support byte-stream emulation with record buffering. - Implement newline insertion/stripping and record padding for FB datasets. - Optimize FB dataset I/O by reopening in binary mode for multi-record access. - Add VB size caching to improve performance of fstat and SEEK_END. - Fix write_dataset to prevent data loss at record boundaries and add bounds checking. - Use length-safe dsio_convert_buffer for all CCSID conversions. - Consolidate entry initialization and simplify redundant size checks.
…et to prevent tools like ggrep from incorrectly identifying datasets as stdout
…os in dataset I/O
…g FB seeks. Enables runtime debug logging via ZOSLIB_DEBUG and implements size caching.
- Added ZOSLIB_ENABLE_DATASETIO compilation flag (defaults to 0). - Added __DATASET_SUPPORT environment variable for runtime control. - Consolidated DatasetEntry struct and cleaned up redundant functions. - Defaulted dataset support to disabled at both compile and runtime.
- Added ZOSLIB_ENABLE_DATASETIO option to CMakeLists.txt (default OFF). - Added -d flag to build.sh to enable dataset I/O support during build.
…tat/dsio_get_size Harden error paths: fix zos_fcntl null-deref, close_dataset write-mode check, generate_name errno, and reduce noisy debug logging.
- Enable dataset I/O by default at runtime (opt-out instead of opt-in) - Replace mutex macros with inline helper functions for better readability - Consolidate 20+ error codes into 5 categories with backward-compatible aliases - Simplify logging macros to use centralized dsio_log() function
Dataset I/O now always compiled in, controlled at runtime via ZOSLIB_DATASET_SUPPORT env var
|
/run tests |
Adapted majority of the work from https://github.com/zopencommunity/libdio.
Code changes added
Pending