Line data Source code
1 : #include "../../../shared/commands/configure/configure.h" 2 : 3 : #include "../../../platform/fd_file_util.h" 4 : 5 : #include <errno.h> 6 : #include <sys/stat.h> 7 : 8 : static void 9 0 : init( config_t const * config ) { 10 0 : if( FD_UNLIKELY( -1==fd_file_util_mkdir_all( config->paths.snapshots, config->uid, config->gid ) ) ) 11 0 : FD_LOG_ERR(( "could not create snapshots directory `%s` (%i-%s)", config->paths.snapshots, errno, fd_io_strerror( errno ) )); 12 0 : } 13 : 14 : static configure_result_t 15 0 : check( config_t const * config ) { 16 0 : struct stat st; 17 0 : if( FD_UNLIKELY( stat( config->paths.snapshots, &st ) && errno==ENOENT ) ) 18 0 : NOT_CONFIGURED( "`%s` does not exist", config->paths.snapshots ); 19 : 20 0 : CHECK( check_dir( config->paths.snapshots, config->uid, config->gid, S_IFDIR | S_IRUSR | S_IWUSR | S_IXUSR ) ); 21 0 : CONFIGURE_OK(); 22 0 : } 23 : 24 : configure_stage_t fd_cfg_stage_snapshots = { 25 : .name = "snapshots", 26 : .always_recreate = 0, 27 : .init = init, 28 : .fini = NULL, 29 : .check = check, 30 : };