diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2019-11-05 00:33:37 +0000 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2019-11-05 19:55:37 +0000 |
commit | 209676c9a3d057c0eba48f633eb541b17c7d1eba (patch) | |
tree | 9d5d7aceacec020ffded275544acc3109c714a7e | |
parent | 8443e57e5ba71e462e31e3b5aad9f7dd1b4736f5 (diff) | |
download | klibc-209676c9a3d057c0eba48f633eb541b17c7d1eba.tar.gz |
[klibc] losetup: Delete fallbacks to LOOP_{GET,SET}_STATUS
The LOOP_{GET,SET}_STATUS64 ioctls were added in Linux 2.5.68, and
klibc is not intended to support old kernel versions.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | usr/utils/losetup.c | 65 |
1 files changed, 2 insertions, 63 deletions
diff --git a/usr/utils/losetup.c b/usr/utils/losetup.c index 1f50a001f9e26..5d328138f994b 100644 --- a/usr/utils/losetup.c +++ b/usr/utils/losetup.c @@ -33,39 +33,8 @@ void xstrncpy(char *dest, const char *src, size_t n) } -static int loop_info64_to_old(const struct loop_info64 *info64, struct loop_info *info) -{ - memset(info, 0, sizeof(*info)); - info->lo_number = info64->lo_number; - info->lo_device = info64->lo_device; - info->lo_inode = info64->lo_inode; - info->lo_rdevice = info64->lo_rdevice; - info->lo_offset = info64->lo_offset; - info->lo_encrypt_type = info64->lo_encrypt_type; - info->lo_encrypt_key_size = info64->lo_encrypt_key_size; - info->lo_flags = info64->lo_flags; - info->lo_init[0] = info64->lo_init[0]; - info->lo_init[1] = info64->lo_init[1]; - if (info->lo_encrypt_type == LO_CRYPT_CRYPTOAPI) - memcpy(info->lo_name, info64->lo_crypt_name, LO_NAME_SIZE); - else - memcpy(info->lo_name, info64->lo_file_name, LO_NAME_SIZE); - memcpy(info->lo_encrypt_key, info64->lo_encrypt_key, LO_KEY_SIZE); - - /* error in case values were truncated */ - if (info->lo_device != info64->lo_device || - info->lo_rdevice != info64->lo_rdevice || - info->lo_inode != info64->lo_inode || - info->lo_offset != info64->lo_offset) - return -EOVERFLOW; - - return 0; -} - - static int show_loop(char *device) { - struct loop_info loopinfo; struct loop_info64 loopinfo64; int fd, errsv; @@ -106,23 +75,6 @@ static int show_loop(char *device) return 0; } - if (ioctl(fd, LOOP_GET_STATUS, &loopinfo) == 0) { - printf ("%s: [%04x]:%ld (%s)", - device, loopinfo.lo_device, loopinfo.lo_inode, - loopinfo.lo_name); - - if (loopinfo.lo_offset) - printf(", offset %d", loopinfo.lo_offset); - - if (loopinfo.lo_encrypt_type) - printf(", encryption type %d\n", - loopinfo.lo_encrypt_type); - - printf("\n"); - close (fd); - return 0; - } - errsv = errno; fprintf(stderr, "loop: can't get info on device %s: %s\n", device, strerror (errsv)); @@ -296,21 +248,8 @@ int set_loop(const char *device, const char *file, unsigned long long offset, close (ffd); i = ioctl(fd, LOOP_SET_STATUS64, &loopinfo64); - if (i) { - struct loop_info loopinfo; - int errsv = errno; - - i = loop_info64_to_old(&loopinfo64, &loopinfo); - if (i) { - errno = errsv; - perror("ioctl: LOOP_SET_STATUS64"); - } else { - i = ioctl(fd, LOOP_SET_STATUS, &loopinfo); - if (i) - perror("ioctl: LOOP_SET_STATUS"); - } - memset(&loopinfo, 0, sizeof(loopinfo)); - } + if (i) + perror("ioctl: LOOP_SET_STATUS64"); memset(&loopinfo64, 0, sizeof(loopinfo64)); if (i) { |