Skip to content

Commit

Permalink
Merge pull request #3994 from zowe/v3.x/feature/checkFSforNOSUID
Browse files Browse the repository at this point in the history
Support for getStatvfs
  • Loading branch information
MarkAckert authored Oct 4, 2024
2 parents f2c9ca7 + 6976f66 commit fdcdb26
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
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;

0 comments on commit fdcdb26

Please sign in to comment.