|
11 | 11 | import nl.gmta.btrfs.structure.stream.BtrfsAttributeType; |
12 | 12 | import nl.gmta.btrfs.structure.stream.BtrfsChmodCommand; |
13 | 13 | import nl.gmta.btrfs.structure.stream.BtrfsChownCommand; |
| 14 | +import nl.gmta.btrfs.structure.stream.BtrfsCommandHeader; |
14 | 15 | import nl.gmta.btrfs.structure.stream.BtrfsCommandType; |
15 | 16 | import nl.gmta.btrfs.structure.stream.BtrfsEndCommand; |
16 | 17 | import nl.gmta.btrfs.structure.stream.BtrfsInodeCommand; |
|
23 | 24 | import nl.gmta.btrfs.structure.stream.BtrfsRenameCommand; |
24 | 25 | import nl.gmta.btrfs.structure.stream.BtrfsSnapshotCommand; |
25 | 26 | import nl.gmta.btrfs.structure.stream.BtrfsStreamCommand; |
26 | | -import nl.gmta.btrfs.structure.stream.BtrfsCommandHeader; |
27 | 27 | import nl.gmta.btrfs.structure.stream.BtrfsStreamElement; |
28 | 28 | import nl.gmta.btrfs.structure.stream.BtrfsStreamHeader; |
| 29 | +import nl.gmta.btrfs.structure.stream.BtrfsSubvolCommand; |
29 | 30 | import nl.gmta.btrfs.structure.stream.BtrfsSymlinkCommand; |
30 | 31 | import nl.gmta.btrfs.structure.stream.BtrfsTimespec; |
31 | 32 | import nl.gmta.btrfs.structure.stream.BtrfsTruncateCommand; |
@@ -64,7 +65,7 @@ private Object readAttribute(BtrfsAttributeType type) throws IOException { |
64 | 65 | // Read and verify attribute type |
65 | 66 | int readType = this.reader.readLE16(); |
66 | 67 | if (readType != type.getId()) { |
67 | | - throw new BtrfsStructureException(String.format("Expected attribute type %04X but got %04X", type.getId(), readType)); |
| 68 | + throw new BtrfsStructureException(String.format("Expected attribute type %04x but got %04x", type.getId(), readType)); |
68 | 69 | } |
69 | 70 |
|
70 | 71 | // Read attribute value |
@@ -128,6 +129,8 @@ private BtrfsStreamCommand readCommand() throws IOException { |
128 | 129 | return this.readRenameCommand(header); |
129 | 130 | case SNAPSHOT: |
130 | 131 | return this.readSnapshotCommand(header); |
| 132 | + case SUBVOL: |
| 133 | + return this.readSubvolCommand(header); |
131 | 134 | case TRUNCATE: |
132 | 135 | return this.readTruncateCommand(header); |
133 | 136 | case UPDATE_EXTENT: |
@@ -270,6 +273,14 @@ private BtrfsSnapshotCommand readSnapshotCommand(BtrfsCommandHeader header) thro |
270 | 273 | return new BtrfsSnapshotCommand(header, path, UUID, CTransID, cloneUUID, cloneCTransID); |
271 | 274 | } |
272 | 275 |
|
| 276 | + private BtrfsSubvolCommand readSubvolCommand(BtrfsCommandHeader header) throws IOException { |
| 277 | + String path = (String) this.readAttribute(BtrfsAttributeType.PATH); |
| 278 | + UUID UUID = (UUID) this.readAttribute(BtrfsAttributeType.UUID); |
| 279 | + long CTransID = (Long) this.readAttribute(BtrfsAttributeType.CTRANSID); |
| 280 | + |
| 281 | + return new BtrfsSubvolCommand(header, path, UUID, CTransID); |
| 282 | + } |
| 283 | + |
273 | 284 | private BtrfsTruncateCommand readTruncateCommand(BtrfsCommandHeader header) throws IOException { |
274 | 285 | String path = (String) this.readAttribute(BtrfsAttributeType.PATH); |
275 | 286 | long size = (Long) this.readAttribute(BtrfsAttributeType.SIZE); |
|
0 commit comments