diff --git a/usr/Makefile b/usr/Makefile index bf37ba9f..394625b3 100644 --- a/usr/Makefile +++ b/usr/Makefile @@ -38,6 +38,7 @@ endif INCLUDES += -I. +CFLAGS += -D_FILE_OFFSET_BITS=64 CFLAGS += -D_GNU_SOURCE CFLAGS += $(INCLUDES) ifneq ($(DEBUG),) diff --git a/usr/bs_rdwr.c b/usr/bs_rdwr.c index ee5f0852..acacc3ab 100644 --- a/usr/bs_rdwr.c +++ b/usr/bs_rdwr.c @@ -78,7 +78,7 @@ static void bs_rdwr_request(struct scsi_cmd *cmd) break; } - ret = pread64(fd, tmpbuf, length, offset); + ret = pread(fd, tmpbuf, length, offset); if (ret != length) { set_medium_error(cmd); @@ -113,7 +113,7 @@ static void bs_rdwr_request(struct scsi_cmd *cmd) break; } - ret = pread64(fd, tmpbuf, length, offset); + ret = pread(fd, tmpbuf, length, offset); if (ret != length) { set_medium_error(cmd); @@ -175,7 +175,7 @@ static void bs_rdwr_request(struct scsi_cmd *cmd) length = scsi_get_out_length(cmd); write_buf = scsi_get_out_buffer(cmd); write: - ret = pwrite64(fd, write_buf, length, + ret = pwrite(fd, write_buf, length, offset); if (ret == length) { struct mode_pg *pg; @@ -233,7 +233,7 @@ static void bs_rdwr_request(struct scsi_cmd *cmd) break; } - ret = pwrite64(fd, tmpbuf, blocksize, offset); + ret = pwrite(fd, tmpbuf, blocksize, offset); if (ret != blocksize) set_medium_error(cmd); @@ -246,7 +246,7 @@ static void bs_rdwr_request(struct scsi_cmd *cmd) case READ_12: case READ_16: length = scsi_get_in_length(cmd); - ret = pread64(fd, scsi_get_in_buffer(cmd), length, + ret = pread(fd, scsi_get_in_buffer(cmd), length, offset); if (ret != length) @@ -278,7 +278,7 @@ static void bs_rdwr_request(struct scsi_cmd *cmd) break; } - ret = pread64(fd, tmpbuf, length, offset); + ret = pread(fd, tmpbuf, length, offset); if (ret != length) set_medium_error(cmd); diff --git a/usr/bs_ssc.c b/usr/bs_ssc.c index 5119163a..711541f9 100644 --- a/usr/bs_ssc.c +++ b/usr/bs_ssc.c @@ -179,7 +179,7 @@ static int append_blk(struct scsi_cmd *cmd, uint8_t *data, /* Write any data */ if (size) { - ret = pwrite64(fd, data, size, + ret = pwrite(fd, data, size, curr->curr + SSC_BLK_HDR_SIZE); if (ret != size) { eprintf("Write of data failed: %m\n"); @@ -349,7 +349,7 @@ static int resp_var_read(struct scsi_cmd *cmd, uint8_t *buf, uint32_t length, } } - ret = pread64(cmd->dev->fd, buf, length, h->curr + SSC_BLK_HDR_SIZE); + ret = pread(cmd->dev->fd, buf, length, h->curr + SSC_BLK_HDR_SIZE); if (ret != length) { sense_data_build(cmd, MEDIUM_ERROR, ASC_READ_ERROR); result = SAM_STAT_CHECK_CONDITION; @@ -404,7 +404,7 @@ static int resp_fixed_read(struct scsi_cmd *cmd, uint8_t *buf, uint32_t length, goto out; } - residue = pread64(fd, buf, block_length, + residue = pread(fd, buf, block_length, h->curr + SSC_BLK_HDR_SIZE); if (block_length != residue) { eprintf("Could only read %d bytes, not %d\n", diff --git a/usr/libssc.c b/usr/libssc.c index a31968b1..70578925 100644 --- a/usr/libssc.c +++ b/usr/libssc.c @@ -57,7 +57,7 @@ int ssc_read_mam_info(int fd, struct MAM_info *i) if (ret != sizeof(struct MAM)) return 1; - if (lseek64(fd, SSC_1ST_HDR_OFFSET, SEEK_SET) != SSC_1ST_HDR_OFFSET) + if (lseek(fd, SSC_1ST_HDR_OFFSET, SEEK_SET) != SSC_1ST_HDR_OFFSET) return 1; SSC_GET_MAM_INFO_VAL(tape_fmt_version, 32); @@ -176,7 +176,7 @@ int ssc_write_mam_info(int fd, struct MAM_info *i) if (ret != sizeof(struct MAM)) return 1; - if (lseek64(fd, SSC_1ST_HDR_OFFSET, SEEK_SET) != SSC_1ST_HDR_OFFSET) + if (lseek(fd, SSC_1ST_HDR_OFFSET, SEEK_SET) != SSC_1ST_HDR_OFFSET) return 1; return 0; @@ -188,7 +188,7 @@ int ssc_read_blkhdr(int fd, struct blk_header_info *i, loff_t offset) struct blk_header h, *m = &h; uint32_t crc = ~0; - count = pread64(fd, m, SSC_BLK_HDR_SIZE, offset); + count = pread(fd, m, SSC_BLK_HDR_SIZE, offset); if (count != SSC_BLK_HDR_SIZE) return 1; @@ -225,7 +225,7 @@ int ssc_write_blkhdr(int fd, struct blk_header_info *i, loff_t offset) crc = crc32c(crc, &m->ondisk_sz, SSC_BLK_HDR_SIZE - sizeof(m->h_csum)); *(uint32_t *)m->h_csum = ~crc; - count = pwrite64(fd, m, SSC_BLK_HDR_SIZE, offset); + count = pwrite(fd, m, SSC_BLK_HDR_SIZE, offset); if (count != SSC_BLK_HDR_SIZE) return 1; diff --git a/usr/sbc.c b/usr/sbc.c index 779dacda..2daf4e28 100644 --- a/usr/sbc.c +++ b/usr/sbc.c @@ -23,7 +23,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ -#define _FILE_OFFSET_BITS 64 #define __USE_GNU #include @@ -52,7 +51,7 @@ static unsigned int blk_shift = DEFAULT_BLK_SHIFT; static off_t find_next_data(struct scsi_lu *dev, off_t offset) { #ifdef SEEK_DATA - return lseek64(dev->fd, offset, SEEK_DATA); + return lseek(dev->fd, offset, SEEK_DATA); #else return offset; #endif @@ -60,7 +59,7 @@ static off_t find_next_data(struct scsi_lu *dev, off_t offset) static off_t find_next_hole(struct scsi_lu *dev, off_t offset) { #ifdef SEEK_HOLE - return lseek64(dev->fd, offset, SEEK_HOLE); + return lseek(dev->fd, offset, SEEK_HOLE); #else return dev->size; #endif diff --git a/usr/tgtimg.c b/usr/tgtimg.c index 1f61b940..c44df023 100644 --- a/usr/tgtimg.c +++ b/usr/tgtimg.c @@ -327,7 +327,7 @@ static int ssc_new(int op, char *path, char *barcode, char *capacity, h->blk_type = BLK_EOD; h->blk_num = 1; h->prev = 0; - h->next = lseek64(fd, 0, SEEK_CUR); + h->next = lseek(fd, 0, SEEK_CUR); h->curr = h->next; ret = ssc_write_blkhdr(fd, h, h->next); diff --git a/usr/util.c b/usr/util.c index 1500dec1..66d2e75b 100644 --- a/usr/util.c +++ b/usr/util.c @@ -85,7 +85,7 @@ int chrdev_open(char *modname, char *devpath, uint8_t minor, int *fd) int backed_file_open(char *path, int oflag, uint64_t *size, uint32_t *blksize) { int fd, err; - struct stat64 st; + struct stat st; fd = open(path, oflag); if (fd < 0) { @@ -93,7 +93,7 @@ int backed_file_open(char *path, int oflag, uint64_t *size, uint32_t *blksize) return fd; } - err = fstat64(fd, &st); + err = fstat(fd, &st); if (err < 0) { eprintf("Cannot get stat %d, %m\n", fd); goto close_fd; diff --git a/usr/util.h b/usr/util.h index 1019fc3b..2c0b1095 100644 --- a/usr/util.h +++ b/usr/util.h @@ -180,8 +180,8 @@ void concat_buf_release(struct concat_buf *b); */ static inline int unmap_file_region(int fd, off_t offset, off_t length) { - struct stat64 st; - if (fstat64(fd, &st) < 0) + struct stat st; + if (fstat(fd, &st) < 0) return -1; if (S_ISREG(st.st_mode)) { #ifdef FALLOC_FL_PUNCH_HOLE