return platform_check_mount(name, block, s, flags);
}
-int
-platform_set_blocksize(int fd, char *path, dev_t device, int blocksize, int fatal)
+void
+platform_set_blocksize(int fd, char *path, dev_t device, int blocksize,
+ bool fatal)
{
- int error = 0;
-
- if (major(device) != RAMDISK_MAJOR) {
- if ((error = ioctl(fd, BLKBSZSET, &blocksize)) < 0) {
- fprintf(stderr, _("%s: %s - cannot set blocksize "
- "%d on block device %s: %s\n"),
- progname, fatal ? "error": "warning",
- blocksize, path, strerror(errno));
- }
+ int error;
+
+ if (major(device) == RAMDISK_MAJOR)
+ return;
+ error = ioctl(fd, BLKBSZSET, &blocksize);
+ if (error < 0) {
+ fprintf(stderr, _("%s: %s - cannot set blocksize "
+ "%d on block device %s: %s\n"),
+ progname, fatal ? "error": "warning",
+ blocksize, path, strerror(errno));
+ if (fatal)
+ exit(1);
}
- return error;
}
/*
int platform_check_ismounted(char *path, char *block, struct stat *sptr,
int verbose);
int platform_check_iswritable(char *path, char *block, struct stat *sptr);
-int platform_set_blocksize(int fd, char *path, dev_t device, int bsz,
- int fatal);
+void platform_set_blocksize(int fd, char *path, dev_t device, int bsz,
+ bool fatal);
int platform_flush_device(int fd, dev_t device);
int platform_direct_blockdev(void);
int platform_align_blockdev(void);
}
if (!readonly && setblksize && (statb.st_mode & S_IFMT) == S_IFBLK) {
- if (dio) {
- /* try to use the given explicit blocksize */
- (void)platform_set_blocksize(fd, path, statb.st_rdev,
- setblksize, 0);
- } else {
- /* given an explicit blocksize to use */
- if (platform_set_blocksize(fd, path, statb.st_rdev, setblksize, 1))
- exit(1);
- }
+ /*
+ * Try to use the given explicit blocksize. Failure to set the
+ * block size is only fatal for direct I/O.
+ */
+ platform_set_blocksize(fd, path, statb.st_rdev, setblksize,
+ dio);
}
/*