2727#include <fcntl.h>
2828#include <unistd.h>
2929
30- #if defined(__APPLE__ ) && defined(__MACH__ )
31- #define lseek64 lseek
32- #define off64_t off_t
33- #endif
34-
3530/* The inode block count for a file/directory is in units of 512 byte blocks,
3631 * _NOT_ the filesystem block size!
3732 */
@@ -88,7 +83,7 @@ static int get_fs_fixup_state(int fd)
8883 return no_write_fixup_state ;
8984 }
9085
91- lseek64 (fd , 0 , SEEK_SET );
86+ lseek (fd , 0 , SEEK_SET );
9287 len = read (fd , & magic , sizeof (magic ));
9388 if (len != sizeof (magic )) {
9489 critical_error ("cannot read fixup_state\n" );
@@ -137,7 +132,7 @@ static int set_fs_fixup_state(int fd, int state)
137132 break ;
138133 }
139134
140- lseek64 (fd , 0 , SEEK_SET );
135+ lseek (fd , 0 , SEEK_SET );
141136 len = write (fd , & magic , sizeof (magic ));
142137 if (len != sizeof (magic )) {
143138 critical_error ("cannot write fixup_state\n" );
@@ -162,7 +157,7 @@ static int set_fs_fixup_state(int fd, int state)
162157static int read_inode (int fd , unsigned int inum , struct ext4_inode * inode )
163158{
164159 unsigned int bg_num , bg_offset ;
165- off64_t inode_offset ;
160+ off_t inode_offset ;
166161 int len ;
167162
168163 bg_num = (inum - 1 ) / info .inodes_per_group ;
@@ -171,7 +166,7 @@ static int read_inode(int fd, unsigned int inum, struct ext4_inode *inode)
171166 inode_offset = ((unsigned long long )aux_info .bg_desc [bg_num ].bg_inode_table * info .block_size ) +
172167 (bg_offset * info .inode_size );
173168
174- if (lseek64 (fd , inode_offset , SEEK_SET ) < 0 ) {
169+ if (lseek (fd , inode_offset , SEEK_SET ) < 0 ) {
175170 critical_error_errno ("failed to seek to inode %d\n" , inum );
176171 }
177172
@@ -185,12 +180,12 @@ static int read_inode(int fd, unsigned int inum, struct ext4_inode *inode)
185180
186181static int read_block (int fd , unsigned long long block_num , void * block )
187182{
188- off64_t off ;
183+ off_t off ;
189184 unsigned int len ;
190185
191186 off = block_num * info .block_size ;
192187
193- if (lseek64 (fd , off , SEEK_SET ) , 0 ) {
188+ if (lseek (fd , off , SEEK_SET ) , 0 ) {
194189 critical_error_errno ("failed to seek to block %lld\n" , block_num );
195190 }
196191
@@ -204,7 +199,7 @@ static int read_block(int fd, unsigned long long block_num, void *block)
204199
205200static int write_block (int fd , unsigned long long block_num , void * block )
206201{
207- off64_t off ;
202+ off_t off ;
208203 unsigned int len ;
209204
210205 if (no_write ) {
@@ -213,7 +208,7 @@ static int write_block(int fd, unsigned long long block_num, void *block)
213208
214209 off = block_num * info .block_size ;
215210
216- if (lseek64 (fd , off , SEEK_SET ) < 0 ) {
211+ if (lseek (fd , off , SEEK_SET ) < 0 ) {
217212 critical_error_errno ("failed to seek to block %lld\n" , block_num );
218213 }
219214
@@ -259,7 +254,7 @@ static void check_inode_bitmap(int fd, unsigned int bg_num)
259254/* Update the superblock and bgdesc of the specified block group */
260255static int update_superblocks_and_bg_desc (int fd , int state )
261256{
262- off64_t ret ;
257+ off_t ret ;
263258 struct ext4_super_block sb ;
264259 unsigned int num_block_groups , total_new_inodes ;
265260 unsigned int i ;
@@ -323,7 +318,7 @@ static int update_superblocks_and_bg_desc(int fd, int state)
323318 & sb );
324319 }
325320
326- ret = lseek64 (fd , ((unsigned long long )i * info .blocks_per_group * info .block_size ) +
321+ ret = lseek (fd , ((unsigned long long )i * info .blocks_per_group * info .block_size ) +
327322 (info .block_size * (aux_info .first_data_block + 1 )), SEEK_SET );
328323 if (ret < 0 )
329324 critical_error_errno ("failed to seek to block group descriptors" );
@@ -409,7 +404,7 @@ static int get_extent_ents(struct ext4_extent_header *ext_hdr, unsigned long lon
409404{
410405 int i , j ;
411406 struct ext4_extent * extent ;
412- off64_t fs_block_num ;
407+ off_t fs_block_num ;
413408
414409 if (ext_hdr -> eh_depth != 0 ) {
415410 critical_error ("get_extent_ents called with eh_depth != 0\n" );
@@ -421,7 +416,7 @@ static int get_extent_ents(struct ext4_extent_header *ext_hdr, unsigned long lon
421416 extent = (struct ext4_extent * )(ext_hdr + 1 );
422417
423418 for (i = 0 ; i < ext_hdr -> eh_entries ; i ++ ) {
424- fs_block_num = ((off64_t )extent -> ee_start_hi << 32 ) | extent -> ee_start_lo ;
419+ fs_block_num = ((off_t )extent -> ee_start_hi << 32 ) | extent -> ee_start_lo ;
425420 for (j = 0 ; j < extent -> ee_len ; j ++ ) {
426421 block_list [extent -> ee_block + j ] = fs_block_num + j ;
427422 }
@@ -436,7 +431,7 @@ static int get_extent_idx(int fd, struct ext4_extent_header *ext_hdr, unsigned l
436431 int i ;
437432 struct ext4_extent_idx * extent_idx ;
438433 struct ext4_extent_header * tmp_ext_hdr ;
439- off64_t fs_block_num ;
434+ off_t fs_block_num ;
440435 unsigned char block [MAX_EXT4_BLOCK_SIZE ];
441436
442437 /* Sanity check */
@@ -450,7 +445,7 @@ static int get_extent_idx(int fd, struct ext4_extent_header *ext_hdr, unsigned l
450445 extent_idx = (struct ext4_extent_idx * )(ext_hdr + 1 );
451446
452447 for (i = 0 ; i < ext_hdr -> eh_entries ; i ++ ) {
453- fs_block_num = ((off64_t )extent_idx -> ei_leaf_hi << 32 ) | extent_idx -> ei_leaf_lo ;
448+ fs_block_num = ((off_t )extent_idx -> ei_leaf_hi << 32 ) | extent_idx -> ei_leaf_lo ;
454449 read_block (fd , fs_block_num , block );
455450 tmp_ext_hdr = (struct ext4_extent_header * )block ;
456451
0 commit comments