[gpfsug-discuss] GPFS API

Jonathan Buzzard jonathan.buzzard at strath.ac.uk
Mon Dec 17 16:46:32 GMT 2018


On Mon, 2018-12-17 at 10:47 -0500, Marc A Kaplan wrote:
> Look in gps.h.... I think the comment for acl_buffer_len is clear
> enough!  
> 

I guess everyone does not read header files by default looking for
comments on the structure ;-)

One thing to watch out for is to check the return from gpfs_getacl, and
if you get an ENOSPC error then your buffer is not big enough to hold
the ACL and the first four bytes are set to the size you need. SO you
need to do something like the following to safely get the ACL.

	acl = malloc(1024);
	acl->acl_len = 1024;
	acl->acl_level = 0;
	acl->acl_version = 0;
	acl->acl_type = 0;
	acl->acl_nace = 0;

	err = gpfs_getacl(fpath, GPFS_GETACL_STRUCT, acl);
	if ((err==-1) && (errno=ENOSPC)) {
		int acl_size = acl->acl_len;
		free(acl);
		acl = malloc(acl_size);
		acl->acl_len = acl_size;
		acl->acl_level = 0;
		acl->acl_version = 0;
		acl->acl_type = 0;
		acl->acl_nace = 0;
		err = gpfs_getacl(fpath, GPFS_GETACL_STRUCT, acl);
	}

Noting that unless you have some monster ACL 1KB is going to be more
than enough. It is less than 16 bytes per ACL.

What is not clear is the following in the gpfs_acl struct.

v4Level1_t     v4Level1;  /* when GPFS_ACL_LEVEL_V4FLAGS */

What's that about, because there is zero documentation on it.

JAB.

-- 
Jonathan A. Buzzard                         Tel: +44141-5483420
HPC System Administrator, ARCHIE-WeSt.
University of Strathclyde, John Anderson Building, Glasgow. G4 0NG





More information about the gpfsug-discuss mailing list