Reject path which isn't by-id link

Check if path passed to core adding or cache starting is by-id link
otherwise do not allow to use it except it is exported object's path.
Do not resolve device's by-id path during core addition or cache starting.

Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
This commit is contained in:
Slawomir Jankowski
2020-12-07 16:29:54 +01:00
committed by Robert Baldyga
parent 4799a2e788
commit 10e5e017c1
2 changed files with 127 additions and 109 deletions

View File

@@ -298,6 +298,17 @@ void print_err(int error_code);
*/
int get_dev_path(const char* disk, char* buf, size_t num);
/**
* @brief make sure device link is unique and write sanitized version to \a dest_path
*
* @param[in] src_path link to device
* @param[in] src_len length of \a src_path
* @param[in] dest_len max length of \a dest_path
* @param[out] dest_path sanitized absolute path
* @return 0 on success, nonzero on failure
*/
int set_device_path(char *dest_path, size_t dest_len, const char *src_path, size_t src_len);
/**
* @brief convert string to int
*/