1 /* $NetBSD: iso9660.c,v 1.1 2004/07/04 14:11:44 drochner Exp $ */
9 #include <isofs/cd9660/iso.h>
11 #include "mscdlabel.h"
13 #define BLKSIZ ISO_DEFAULT_BLOCK_SIZE
16 printinfo(struct iso_primary_descriptor
*vd
)
18 char label
[32 + 1], date
[] = "yyyy/mm/dd hh:mm", *d
;
20 strlcpy(label
, vd
->volume_id
, sizeof(label
));
21 /* strip trailing blanks */
22 d
= label
+ strlen(label
);
23 while (d
> label
&& *(d
- 1) == ' ')
27 d
= vd
->creation_date
;
28 memcpy(date
, d
, 4); /* year */
29 memcpy(date
+ 5, d
+ 4, 2); /* month */
30 memcpy(date
+ 8, d
+ 6, 2); /* day */
31 memcpy(date
+ 11, d
+ 8, 2); /* hour */
32 memcpy(date
+ 14, d
+ 10, 2); /* min */
33 printf("ISO filesystem, label \"%s\", creation time: %s\n",
38 check_primary_vd(int fd
, int start
, int len
)
41 struct iso_primary_descriptor
*vd
;
46 for (i
= 16; (i
< 100) && (i
< len
); i
++) {
47 res
= pread(fd
, vd
, BLKSIZ
, (start
+ i
) * BLKSIZ
);
49 warn("read CD sector %d", start
+ i
);
53 if (memcmp(vd
->id
, ISO_STANDARD_ID
, sizeof(vd
->id
)))
55 if (isonum_711(vd
->type
) == ISO_VD_PRIMARY
) {
59 } else if (isonum_711(vd
->type
) == ISO_VD_END
)