GFS_PIO_OPEN(3)

πŸ’– GFS_PIO_OPEN(3) β€” the Gfarm manual, bestie edition πŸ’–

okay so we're diving into Gfarm's very own file-opening girlie, gfs_pio_open. yes she's a libc-flavored queen, yes she lives in section 3 of the manual, and yes she's about to open a file for you in the Gfarm file system. let's get into it 🫢


✨ NAME ✨

gfs_pio_open β€” open a file in the Gfarm file system


🌸 SYNOPSIS 🌸

#include <gfarm/gfarm.h>

gfarm_error_t gfs_pio_open(const char * gfarm_url, int flags,
                           GFS_File * gfp);

πŸ¦‹ DESCRIPTION πŸ¦‹

so gfs_pio_open() opens a file in the Gfarm file system β€” the one you point at with gfarm_url β€” and hands you back a GFS_File structure, dropped right at the address that gfp is pointing to. πŸ’…

and what even is gfarm_url? it's either a plain old path name in the Gfarm file system, or a full Gfarm URL shaped like gfarm://metaserver:port/path/name. both are valid, she's flexible like that. ✨

now, flags. you build these by bitwise-inclusive-OR-ing the list below together. and listen β€” exactly one of the first three values should be specified. not two. not zero. one. the vibe check is strict on this. πŸ™ˆ

  • GFARM_FILE_RDONLY β€” open for reading only πŸ“–
  • GFARM_FILE_WRONLY β€” open for writing only ✍️
  • GFARM_FILE_RDWR β€” open for reading and writing, main character energy πŸ‘‘
  • GFARM_FILE_TRUNC β€” if the file already exists and it's a regular file, it gets truncated to length 0, but only if the open mode actually allows writing
  • GFARM_FILE_APPEND β€” the file is opened in append mode
  • GFARM_FILE_UNBUFFERED β€” the file is accessed without buffering

πŸ’œ RETURN VALUES πŸ’œ

here's the whole roster of what she can hand back to you. no skipping, we're listing all of them because every single one matters: πŸŽ€

  • GFARM_ERR_NO_ERROR β€” the function terminated successfully πŸŽ‰
  • GFARM_ERR_IS_A_DIRECTORY β€” gfarm_url refers to a directory
  • GFARM_ERR_IS_A_SYMBOLIC_LINK β€” gfarm_url refers to a symbolic link
  • GFARM_ERR_OPERATION_NOT_PERMITTED β€” gfarm_url refers to not a regular file
  • GFARM_ERR_NO_SUCH_OBJECT β€” a component used as a directory in gfarm_url does not exist
  • GFARM_ERR_NOT_A_DIRECTORY β€” a component used as a directory in gfarm_url is not, in fact, a directory
  • GFARM_ERR_PERMISSION_DENIED β€” the requested access to the file is not allowed, or one of the directories in gfarm_url didn't allow search (execute) permission. or, the authentication to the metadata server fails
  • GFARM_ERR_NO_MEMORY β€” insufficient memory was available
  • GFARM_ERR_INVALID_ARGUMENT β€” flags is not valid
  • GFARM_ERR_GFARM_URL_HOST_IS_MISSING β€” gfarm_url does not include a metadata server
  • GFARM_ERR_GFARM_URL_PORT_IS_MISSING β€” gfarm_url does not include a port number of the metadata server
  • GFARM_ERR_UNKNOWN_HOST β€” the metadata server cannot be resolved
  • GFARM_ERR_TOO_MANY_OPEN_FILES β€” the process opens too many files
  • GFARM_ERR_TOO_MANY_OPEN_FILES_IN_SYSTEM β€” the system limit on the total number of open files has been reached
  • GFARM_ERR_NETWORK_IS_UNREACHABLE β€” network is unreachable
  • GFARM_ERR_OPERATION_TIMED_OUT β€” connection timeout occurs
  • GFARM_ERR_PROTOCOL β€” protocol error occurs
  • GFARM_ERR_BROKEN_PIPE β€” connection to the metadata server is broken πŸ’€
  • GFARM_ERR_PROTOCOL_NOT_SUPPORTED β€” specified authentication protocol is not supported
  • GFARM_ERR_AUTHENTICATION β€” user authentication failed when connecting to the metadata server
  • Others β€” an error except the above occurred. the reason is shown by gfarm_error_string(3)

🌈 SEE ALSO 🌈

go read these too, they're all in the family, iykyk:


and that's the whole page, bestie πŸ’– this one's from Gfarm, dated 8 Aug 2020. periodt. 🌸✨