mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-30 03:47:05 -05:00
Get the UUID from the imported file or directory
This commit is contained in:
parent
18aa07be36
commit
ae8a89ec25
1 changed files with 7 additions and 9 deletions
|
|
@ -671,7 +671,6 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
|
||||||
char device[PATH_MAX];
|
char device[PATH_MAX];
|
||||||
char* split_map[SPLIT_MAX + 1];
|
char* split_map[SPLIT_MAX + 1];
|
||||||
unsigned split_mac;
|
unsigned split_mac;
|
||||||
char* slash;
|
|
||||||
uint64_t dev;
|
uint64_t dev;
|
||||||
int skip_access;
|
int skip_access;
|
||||||
|
|
||||||
|
|
@ -717,16 +716,15 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
|
||||||
|
|
||||||
/* get the device of the directory containing the parity file */
|
/* get the device of the directory containing the parity file */
|
||||||
pathimport(device, sizeof(device), split_map[s]);
|
pathimport(device, sizeof(device), split_map[s]);
|
||||||
slash = strrchr(device, '/');
|
|
||||||
if (slash)
|
/* use only the dir, as the parity file may not exist yet */
|
||||||
slash[1] = 0;
|
pathcut(device);
|
||||||
else
|
|
||||||
pathcpy(device, sizeof(device), ".");
|
|
||||||
if (stat(device, &st) == 0) {
|
if (stat(device, &st) == 0) {
|
||||||
dev = st.st_dev;
|
dev = st.st_dev;
|
||||||
|
|
||||||
/* read the uuid, if unsupported use an empty one */
|
/* read the uuid, if unsupported use an empty one */
|
||||||
if (devuuid(dev, split_map[s], uuid, sizeof(uuid)) != 0) {
|
if (devuuid(dev, device, uuid, sizeof(uuid)) != 0) {
|
||||||
*uuid = 0;
|
*uuid = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -964,7 +962,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
|
||||||
dev = st.st_dev;
|
dev = st.st_dev;
|
||||||
|
|
||||||
/* read the uuid, if unsupported use an empty one */
|
/* read the uuid, if unsupported use an empty one */
|
||||||
if (devuuid(dev, dir, uuid, sizeof(uuid)) != 0) {
|
if (devuuid(dev, device, uuid, sizeof(uuid)) != 0) {
|
||||||
*uuid = 0;
|
*uuid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1065,7 +1063,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
|
||||||
dev = st.st_dev;
|
dev = st.st_dev;
|
||||||
|
|
||||||
/* read the uuid, if unsupported use an empty one */
|
/* read the uuid, if unsupported use an empty one */
|
||||||
if (devuuid(dev, dir, uuid, sizeof(uuid)) != 0) {
|
if (devuuid(dev, device, uuid, sizeof(uuid)) != 0) {
|
||||||
*uuid = 0;
|
*uuid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue