diff options
-rw-r--r-- | src/libdiskfs/part.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/libdiskfs/part.c b/src/libdiskfs/part.c index d156457d..5d447479 100644 --- a/src/libdiskfs/part.c +++ b/src/libdiskfs/part.c @@ -28,7 +28,9 @@ diskpartsync(Disk *dd) { DiskPart *d = (DiskPart*)dd; - return disksync(d->subdisk); + if(d->subdisk) + return disksync(d->subdisk); + return 0; } static void @@ -36,12 +38,13 @@ diskpartclose(Disk *dd) { DiskPart *d = (DiskPart*)dd; - diskclose(d->subdisk); + if(d->subdisk) + diskclose(d->subdisk); free(d); } Disk* -diskpart(Disk *subdisk, u64int size, u64int offset) +diskpart(Disk *subdisk, u64int offset, u64int size) { DiskPart *d; @@ -58,3 +61,11 @@ diskpart(Disk *subdisk, u64int size, u64int offset) return &d->disk; } + +void +diskpartabandon(Disk *d) +{ + if(d->_read != diskpartread) + abort(); + d->subdisk = nil; +} |