Commit b3f14e00 authored by Philip Carns's avatar Philip Carns
Browse files

return ENOENT if trying to attach missing target

parent 252b566c
......@@ -55,16 +55,14 @@ int bake_provider_register(margo_instance_id mid,
int bake_provider_deregister(bake_provider_t provider);
/**
* Makes the provider start managing a target.
* The target must have been previously created with bake_makepool,
* and it should not be managed by another provider (whether in this
* proccess or another).
* Makes the provider start managing a target. The target must have already
* been created in the past.
*
* @param provider Bake provider
* @param target_name path to pmem target
* @param target_id resulting id identifying the target
*
* @return 0 on success, -1 on failure
* @return BAKE_SUCCESS or BAKE_ERR*
*/
int bake_provider_attach_target(bake_provider_t provider,
const char* target_name,
......
......@@ -55,7 +55,9 @@ typedef struct {
#define BAKE_ERR_FORBIDDEN (-12) /* Forbidden operation */
#define BAKE_ERR_BACKEND_TYPE (-13) /* Unknown backend type */
#define BAKE_ERR_IO (-14) /* Back-end I/O error */
#define BAKE_ERR_END (-15) /* End of valid bake error codes */
#define BAKE_ERR_NOENT (-15) /* entry does not exist */
#define BAKE_ERR_EXIST (-16) /* entry already exists */
#define BAKE_ERR_END (-17) /* End of valid bake error codes */
/**
* Print bake errors in human-friendly form
......
......@@ -215,7 +215,7 @@ static int bake_file_backend_initialize(bake_provider_t provider,
if (new_entry->log_fd < 0) {
BAKE_ERROR(provider->mid, "open(): %s on %s",
strerror(-new_entry->log_fd), path);
ret = BAKE_ERR_IO;
ret = BAKE_ERR_NOENT;
goto error_cleanup;
}
......
......@@ -106,7 +106,7 @@ static int bake_pmem_backend_initialize(bake_provider_t provider,
free(new_context->filename);
free(new_context->root);
free(new_context);
return BAKE_ERR_PMEM;
return BAKE_ERR_NOENT;
}
/* check to make sure the root is properly set */
......
......@@ -51,6 +51,12 @@ static char* bake_err_str(int ret)
case BAKE_ERR_OP_UNSUPPORTED:
return "Operation not supported";
break;
case BAKE_ERR_NOENT:
return "Entry does not exist";
break;
case BAKE_ERR_EXIST:
return "Entry already exists";
break;
default:
return "Unknown error";
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment