3 void free_extent(struct dir_extent
*e
) {
11 /* Free the contents of an inode dir entry, but not the pointer itself. */
12 void free_inode_dir_entry(struct inode_dir_entry
*e
) {
20 struct buf
* read_extent_block(struct dir_extent
*e
, size_t block
) {
21 size_t block_id
= get_extent_absolute_block_id(e
, block
);
24 if (block_id
== 0 || block_id
>= v_pri
.volume_space_size_l
)
27 if(lmfs_get_block(&bp
, fs_dev
, block_id
, NORMAL
) != OK
)
33 size_t get_extent_absolute_block_id(struct dir_extent
*e
, size_t block
) {
34 size_t extent_offset
= 0;
35 block
/= v_pri
.logical_block_size_l
;
40 /* Retrieve the extent on which the block lies. */
41 while(block
>= extent_offset
+ e
->length
) {
45 extent_offset
+= e
->length
;
49 return e
->location
+ block
- extent_offset
;
52 time_t date7_to_time_t(const u8_t
*date
) {
54 * This function converts from the ISO 9660 7-byte time format to a
58 signed char time_zone
= (signed char)date
[6];
60 ltime
.tm_year
= date
[0];
61 ltime
.tm_mon
= date
[1] - 1;
62 ltime
.tm_mday
= date
[2];
63 ltime
.tm_hour
= date
[3];
64 ltime
.tm_min
= date
[4];
65 ltime
.tm_sec
= date
[5];
68 /* Offset from Greenwich Mean Time */
69 if (time_zone
>= -52 && time_zone
<= 52)
70 ltime
.tm_hour
+= time_zone
;
72 return mktime(<ime
);
75 void* alloc_mem(size_t s
) {
76 void *ptr
= calloc(1, s
);