Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for getStatvfs #3994

Merged
merged 6 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

All notable changes to the Zowe Installer will be documented in this file.

## `3.0.1`
- Enhancement: new javascript funtion `getStatvfs()` to obtain information about the file sysytem [#3994](https://github.com/zowe/zowe-install-packaging/pull/3994)

## `3.0.0`

### Breaking Changes
Expand Down
29 changes: 29 additions & 0 deletions bin/libs/zos-fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,32 @@ export function ensureFileEncoding(file: string, expectedSample: string, expecte
common.printTrace(`- Failed to detect encoding of ${file}.`);
}
}

export type fileSystemFlagsReturn = {
rc: number,
exported?: boolean,
rdonly?: boolean,
nosuid?: boolean,
nosecurity?: boolean,
};

export function getFileSystemFlags(path: string): fileSystemFlagsReturn {
const ST_OEEXPORTED = 0x40000000
const ST_RDONLY = 0x00000001
const ST_NOSUID = 0x00000002
const ST_NOSECURITY = 0x00000004
let flags : fileSystemFlagsReturn = { rc: 1 };
if (path) {
const result = zos.getStatvfs(path);
if (result[1] == 0) {
flags = {
rc: 0,
exported: !!(result[0].flag & ST_OEEXPORTED),
rdonly: !!(result[0].flag & ST_RDONLY),
nosuid: !!(result[0].flag & ST_NOSUID),
nosecurity: !!(result[0].flag & ST_NOSECURITY)
}
}
}
return flags;
}
19 changes: 19 additions & 0 deletions build/zwe/types/@qjstypes/zos.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,29 @@ export type ZStat = {
ccsid: number;
};

export type Statvfs = {
bsize: number;
blocks: number;
bavail: number;
fsid: number;
flag: number;
frsize: number;
bfree: number;
files: number;
ffree: number;
favail: number;
namemax: number;
OEmaxfilesizehw: number;
OEmaxfilesizelw: number;
OEusedspace: number;
OEinvarsec: number;
}

export function getEsm(): string;
export function getZosVersion(): number;
export function changeTag(path:string, ccsid:number):number;
export function changeExtAttr(path: string, extattr:number, onOff:boolean):number;
export function zstat(path:string):[ZStat, number];
export function getStatvfs(path: string): [Statvfs, number];
export var EXTATTR_SHARELIB:number;
export var EXTATTR_PROGCTL:number;
Loading