Skip to content

Commit 2aa9663

Browse files
committed
udftune: Drop pvd- and iuvd-related code
1 parent 9654642 commit 2aa9663

File tree

1 file changed

+2
-68
lines changed

1 file changed

+2
-68
lines changed

udftune/main.c

Lines changed: 2 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,13 @@ int main(int argc, char *argv[])
5050
int fd;
5151
int flags;
5252
char buf[256];
53-
dstring new_lvid[128];
5453
dstring new_vid[32];
5554
dstring new_fsid[32];
5655
int mark_ro = 0;
5756
int mark_rw = 0;
5857
int force = 0;
5958
int update = 0;
60-
int update_pvd = 0;
6159
int update_lvd = 0;
62-
int update_iuvd = 0;
6360
int update_fsd = 0;
6461

6562
if (fcntl(0, F_GETFL) < 0 && open("/dev/null", O_RDONLY) < 0)
@@ -85,11 +82,9 @@ int main(int argc, char *argv[])
8582
disc.tail = disc.head;
8683
disc.head->space_type = USPACE;
8784

88-
memset(new_lvid, 0, sizeof(new_lvid));
8985
memset(new_vid, 0, sizeof(new_vid));
9086
memset(new_fsid, 0, sizeof(new_fsid));
9187

92-
new_lvid[0] = 0xFF;
9388
new_vid[0] = 0xFF;
9489
new_fsid[0] = 0xFF;
9590

@@ -104,7 +99,7 @@ int main(int argc, char *argv[])
10499
update_fsd = 1;
105100
}
106101

107-
if (update_pvd || update_lvd || update_iuvd || update_fsd)
102+
if (update_lvd || update_fsd)
108103
update = 1;
109104

110105
if (update && !(disc.flags & FLAG_NO_WRITE))
@@ -175,12 +170,6 @@ int main(int argc, char *argv[])
175170

176171
printf("Updating device: %s\n", filename);
177172

178-
if (!disc.udf_lvid || le32_to_cpu(disc.udf_lvid->integrityType) != LVID_INTEGRITY_TYPE_CLOSE)
179-
{
180-
fprintf(stderr, "%s: Error: Logical Volume is in inconsistent state\n", appname);
181-
exit(1);
182-
}
183-
184173
if (disc.udf_write_rev > 0x0260)
185174
{
186175
fprintf(stderr, "%s: Error: Minimal UDF Write Revision is %"PRIx16".%02"PRIx16", but udflabel supports only 2.60\n", appname, disc.udf_write_rev >> 8, disc.udf_write_rev & 0xFF);
@@ -246,7 +235,7 @@ int main(int argc, char *argv[])
246235
}
247236

248237
/* TODO: VAT mode */
249-
if ((le32_to_cpu(pd->accessType) == PD_ACCESS_TYPE_WRITE_ONCE && !force) || (disc.vat && (new_lvid[0] != 0xFF || new_fsid[0] != 0xFF)))
238+
if ((le32_to_cpu(pd->accessType) == PD_ACCESS_TYPE_WRITE_ONCE && !force) || (disc.vat && (new_fsid[0] != 0xFF)))
250239
{
251240
fprintf(stderr, "%s: Error: Updating Virtual Allocation Table is not supported yet\n", appname);
252241
exit(1);
@@ -293,20 +282,6 @@ int main(int argc, char *argv[])
293282
}
294283
}
295284

296-
if (update_pvd)
297-
{
298-
if (!disc.udf_pvd[0] || !check_desc(disc.udf_pvd[0], sizeof(*disc.udf_pvd[0])))
299-
{
300-
fprintf(stderr, "%s: Error: Main Primary Volume Descriptor is damaged\n", appname);
301-
exit(1);
302-
}
303-
if (!disc.udf_pvd[1] || !check_desc(disc.udf_pvd[1], sizeof(*disc.udf_pvd[1])))
304-
{
305-
fprintf(stderr, "%s: Error: Reserve Primary Volume Descriptor is damaged\n", appname);
306-
exit(1);
307-
}
308-
}
309-
310285
if (update_lvd)
311286
{
312287
if (!disc.udf_lvd[0] || !check_desc(disc.udf_lvd[0], sizeof(*disc.udf_lvd[0]) + le32_to_cpu(disc.udf_lvd[0]->mapTableLength)))
@@ -364,68 +339,27 @@ int main(int argc, char *argv[])
364339
dis->domainFlags &= DOMAIN_FLAGS_SOFT_WRITE_PROTECT;
365340
}
366341

367-
if (update_pvd)
368-
{
369-
printf("Updating Main Primary Volume Descriptor...\n");
370-
update_desc(disc.udf_pvd[0], sizeof(*disc.udf_pvd[0]));
371-
write_desc(fd, &disc, MVDS, TAG_IDENT_PVD, disc.udf_pvd[0]);
372-
}
373-
374342
if (update_lvd)
375343
{
376344
printf("Updating Main Logical Volume Descriptor...\n");
377345
update_desc(disc.udf_lvd[0], sizeof(*disc.udf_lvd[0]) + le32_to_cpu(disc.udf_lvd[0]->mapTableLength));
378346
write_desc(fd, &disc, MVDS, TAG_IDENT_LVD, disc.udf_lvd[0]);
379347
}
380348

381-
if (update_iuvd)
382-
{
383-
printf("Updating Main Implementation Use Volume Descriptor...\n");
384-
update_desc(disc.udf_iuvd[0], sizeof(*disc.udf_iuvd[0]));
385-
write_desc(fd, &disc, MVDS, TAG_IDENT_IUVD, disc.udf_iuvd[0]);
386-
}
387-
388-
if (update_pvd || update_lvd || update_iuvd)
389-
{
390-
printf("Synchronizing...\n");
391-
if (!(disc.flags & FLAG_NO_WRITE))
392-
{
393-
if (fdatasync(fd) != 0)
394-
{
395-
fprintf(stderr, "%s: Error: Synchronization to device '%s' failed: %s\n", appname, filename, strerror(errno));
396-
exit(1);
397-
}
398-
}
399-
}
400-
401349
if (update_fsd)
402350
{
403351
printf("Updating File Set Descriptor...\n");
404352
update_desc(disc.udf_fsd, sizeof(*disc.udf_fsd));
405353
write_desc(fd, &disc, PSPACE, TAG_IDENT_FSD, disc.udf_fsd);
406354
}
407355

408-
if (update_pvd && disc.udf_pvd[1] != disc.udf_pvd[0])
409-
{
410-
printf("Updating Reserve Primary Volume Descriptor...\n");
411-
update_desc(disc.udf_pvd[1], sizeof(*disc.udf_pvd[1]));
412-
write_desc(fd, &disc, RVDS, TAG_IDENT_PVD, disc.udf_pvd[1]);
413-
}
414-
415356
if (update_lvd && disc.udf_lvd[1] != disc.udf_lvd[0])
416357
{
417358
printf("Updating Reserve Logical Volume Descriptor...\n");
418359
update_desc(disc.udf_lvd[1], sizeof(*disc.udf_lvd[1]) + le32_to_cpu(disc.udf_lvd[1]->mapTableLength));
419360
write_desc(fd, &disc, RVDS, TAG_IDENT_LVD, disc.udf_lvd[1]);
420361
}
421362

422-
if (update_iuvd && disc.udf_iuvd[1] != disc.udf_iuvd[0])
423-
{
424-
printf("Updating Reserve Implementation Use Volume Descriptor...\n");
425-
update_desc(disc.udf_iuvd[1], sizeof(*disc.udf_iuvd[1]));
426-
write_desc(fd, &disc, RVDS, TAG_IDENT_IUVD, disc.udf_iuvd[1]);
427-
}
428-
429363
printf("Synchronizing...\n");
430364
if (!(disc.flags & FLAG_NO_WRITE))
431365
{

0 commit comments

Comments
 (0)