nusb/disk: adding identical partition is a no-op
This commit is contained in:
parent
de3c058efb
commit
3ceedfd1e1
1 changed files with 5 additions and 1 deletions
|
@ -75,7 +75,11 @@ addpart(Umsc *lun, char *name, vlong start, vlong end, ulong mode)
|
||||||
werrstr("bad partition boundaries");
|
werrstr("bad partition boundaries");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(lookpart(lun, name) != nil) {
|
p = lookpart(lun, name);
|
||||||
|
if(p != nil){
|
||||||
|
/* adding identical partition is no-op */
|
||||||
|
if(p->offset == start && p->length == end - start && p->mode == mode)
|
||||||
|
return 0;
|
||||||
werrstr("partition name already in use");
|
werrstr("partition name already in use");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue