endif
AM_CFLAGS=$(LLCFLAGS)
-AM_CPPFLAGS=$(LLCPPFLAGS) -DLUSTRE_UTILS=1
+AM_CPPFLAGS=$(LLCPPFLAGS) -DLUSTRE_UTILS=1 -D_FILE_OFFSET_BITS=64
AM_LDFLAGS := -L$(top_builddir)/lnet/utils
LIBPTLCTL := $(top_builddir)/lnet/utils/libptlctl.a \
lr_reader_SOURCES = lr_reader.c
mount_lustre_SOURCES = mount_lustre.c mount_utils.c mount_utils.h
+mount_lustre_CPPFLAGS = $(AM_CPPFLAGS)
mount_lustre_LDADD := $(LIBPTLCTL)
mount_lustre_DEPENDENCIES := $(LIBPTLCTL)
if LDISKFS_ENABLED
endif
if ZFS_ENABLED
mount_lustre_SOURCES += mount_utils_zfs.c
-mount_lustre_CPPFLAGS = -DHAVE_IOCTL_IN_UNISTD_H
+mount_lustre_CPPFLAGS += -DHAVE_IOCTL_IN_UNISTD_H
mount_lustre_CPPFLAGS += $(EXTRA_LIBZFS_INCLUDE)
mount_lustre_LDFLAGS = -pthread -rdynamic -ldl
endif
return size >> 10;
}
-int file_create(char *path, int size)
+int file_create(char *path, __u64 size)
{
+ __u64 size_max;
int ret;
int fd;
+ /*
+ * Since "size" is in KB, the file offset it represents could overflow
+ * off_t.
+ */
+ size_max = (off_t)1 << (_FILE_OFFSET_BITS - 1 - 10);
+ if (size >= size_max) {
+ fprintf(stderr, "%s: %llu KB: Backing store size must be "
+ "smaller than %llu KB\n", progname, size, size_max);
+ return EFBIG;
+ }
+
ret = access(path, F_OK);
if (ret == 0) {
ret = unlink(path);
int is_lustre_target(struct mkfs_opts *mop);
/* loopback helper functions */
-int file_create(char *path, int size);
+int file_create(char *path, __u64 size);
int loop_format(struct mkfs_opts *mop);
int loop_setup(struct mkfs_opts *mop);
int loop_cleanup(struct mkfs_opts *mop);