From 06052dafcfa5b4d178fafae67a4eab5ee9cd8a9c Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 1 Aug 2005 22:10:38 +0000 Subject: [PATCH] Replaced all occurances of ENOTSUP to EOPNOTSUPP to be in better harmony with the kernel driver --- ChangeLog | 11 +++++++---- libntfs/attrib.c | 24 ++++++++++++------------ libntfs/device.c | 12 ++++++------ libntfs/mft.c | 4 ++-- libntfs/volume.c | 8 ++++---- libntfs/win32_io.c | 12 ++++++------ ntfsprogs/decrypt.c | 4 ++-- ntfsprogs/mkntfs.c | 26 +++++++++++++------------- ntfsprogs/ntfsresize.c | 2 +- 9 files changed, 53 insertions(+), 50 deletions(-) diff --git a/ChangeLog b/ChangeLog index c5643dbb..e7da835c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,8 @@ xx/xx/xxxx - 1.12.0-WIP - Fix ntfs_attr_p{read,write} to not return less bytes if trapped on unmapped runlist region. (Yura) - Make find work correctly on volumes mounted by ntfsmount. (Yura) + - Replaced all occurances of ENOTSUP to EOPNOTSUPP to be in better + harmony with the kernel driver. (Szaka) 20/07/2005 - 1.11.1 - Fix several ntfsmount bugs. @@ -475,10 +477,11 @@ xx/xx/xxxx - 1.12.0-WIP text and other little bits. - Add --disable-default-device-io-ops option to ./configure which makes for a smaller libntfs but results in ntfs_mount() always returning - error with errno set to ENOTSUP. You need to use ntfs_device_mount() - instead. This only makes sense with "make libs" and when an - application linking statically against libntfs provides its own - device io operations. (Feature requested by Christophe Grenier.) + error with errno set to EOPNOTSUPP. You need to use + ntfs_device_mount() instead. This only makes sense with "make libs" + and when an application linking statically against libntfs provides + its own device io operations. (Feature requested by + Christophe Grenier.) - Fix a duplicated free() in mkntfs. (Andras Erdei) - Fix option display in mkntfs. (Andras Erdei) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 78c6baf7..72606409 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -85,7 +85,7 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol, if (a->flags) { Dputs("Encountered non-zero attribute flags. Cannot handle " "this yet."); - errno = ENOTSUP; + errno = EOPNOTSUPP; return 0; } if (!a->non_resident) { @@ -920,7 +920,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) // TODO: Implement writing compressed attributes! (AIA) // return ntfs_attr_pwrite_compressed(ntfs_attr *na, // const s64 pos, s64 count, void *b); - errno = ENOTSUP; + errno = EOPNOTSUPP; return -1; } if (!count) @@ -1292,7 +1292,7 @@ rl_err_out: goto done; // TODO: Need to try to change initialized_size. If it // succeeds goto done, otherwise goto err_out. (AIA) - errno = ENOTSUP; + errno = EOPNOTSUPP; goto err_out; } goto done; @@ -3810,11 +3810,11 @@ put_err_out: * * Return 0 on success and -1 on error with errno set to the error code. The * following error codes are defined: - * EINVAL - Invalid arguments passed. - * EPERM - The attribute is not allowed to be resident. - * EIO - I/O error, damaged inode or bug. - * ENOSPC - There is no enough space to perform conversion. - * ENOTSUP - Requested conversion is not supported yet. + * EINVAL - Invalid arguments passed. + * EPERM - The attribute is not allowed to be resident. + * EIO - I/O error, damaged inode or bug. + * ENOSPC - There is no enough space to perform conversion. + * EOPNOTSUPP - Requested conversion is not supported yet. * * Warning: We do not set the inode dirty and we do not write out anything! * We expect the caller to do this as this is a fairly low level @@ -3870,7 +3870,7 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) Dprintf("%s(): Making compressed or encrypted files " "resident is not implemented yet.\n", __FUNCTION__); - errno = ENOTSUP; + errno = EOPNOTSUPP; return -1; } @@ -4812,8 +4812,8 @@ put_err_out: * * On success return 0 and on error return -1 with errno set to the error code. * The following error codes are defined: - * EINVAL - Invalid arguments were passed to the function. - * ENOTSUP - The desired resize is not implemented yet. + * EINVAL - Invalid arguments were passed to the function. + * EOPNOTSUPP - The desired resize is not implemented yet. */ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) { @@ -4840,7 +4840,7 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) * TODO: Implement making handling of compressed attributes. */ if (NAttrCompressed(na)) { - errno = ENOTSUP; + errno = EOPNOTSUPP; return -1; } if (NAttrNonResident(na)) { diff --git a/libntfs/device.c b/libntfs/device.c index d545b4c9..2e95bb77 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -529,7 +529,7 @@ s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size) * * The following error codes are defined: * EINVAL Input parameter error - * ENOTSUP System does not support HDIO_GETGEO ioctl + * EOPNOTSUPP System does not support HDIO_GETGEO ioctl * ENOTTY @dev is a file or a device not supporting HDIO_GETGEO */ s64 ntfs_device_partition_start_sector_get(struct ntfs_device *dev) @@ -548,7 +548,7 @@ s64 ntfs_device_partition_start_sector_get(struct ntfs_device *dev) } } #else - errno = ENOTSUP; + errno = EOPNOTSUPP; #endif return -1; } @@ -562,7 +562,7 @@ s64 ntfs_device_partition_start_sector_get(struct ntfs_device *dev) * * The following error codes are defined: * EINVAL Input parameter error - * ENOTSUP System does not support HDIO_GETGEO ioctl + * EOPNOTSUPP System does not support HDIO_GETGEO ioctl * ENOTTY @dev is a file or a device not supporting HDIO_GETGEO */ int ntfs_device_heads_get(struct ntfs_device *dev) @@ -582,7 +582,7 @@ int ntfs_device_heads_get(struct ntfs_device *dev) } } #else - errno = ENOTSUP; + errno = EOPNOTSUPP; #endif return -1; } @@ -596,7 +596,7 @@ int ntfs_device_heads_get(struct ntfs_device *dev) * * The following error codes are defined: * EINVAL Input parameter error - * ENOTSUP System does not support HDIO_GETGEO ioctl + * EOPNOTSUPP System does not support HDIO_GETGEO ioctl * ENOTTY @dev is a file or a device not supporting HDIO_GETGEO */ int ntfs_device_sectors_per_track_get(struct ntfs_device *dev) @@ -616,7 +616,7 @@ int ntfs_device_sectors_per_track_get(struct ntfs_device *dev) } } #else - errno = ENOTSUP; + errno = EOPNOTSUPP; #endif return -1; } diff --git a/libntfs/mft.c b/libntfs/mft.c index 625778db..055c581e 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -667,7 +667,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) ntfs_error(vol->sb, "Not enough space in this mft record to " "accommodate extended mft bitmap attribute " "extent. Cannot handle this yet."); - errno = ENOTSUP; + errno = EOPNOTSUPP; goto undo_alloc; } status.mp_rebuilt = 1; @@ -989,7 +989,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) ntfs_error(vol->sb, "Not enough space in this mft record to " "accommodate extended mft data attribute " "extent. Cannot handle this yet."); - errno = ENOTSUP; + errno = EOPNOTSUPP; goto undo_alloc; } mp_rebuilt = TRUE; diff --git a/libntfs/volume.c b/libntfs/volume.c index db786ef2..de62914d 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -1151,7 +1151,7 @@ ntfs_volume *ntfs_mount(const char *name __attribute__((unused)), * defined as there are no device operations available in libntfs in * this case. */ - errno = ENOTSUP; + errno = EOPNOTSUPP; return NULL; #endif } @@ -1341,8 +1341,8 @@ int ntfs_check_if_mounted(const char *file __attribute__((unused)), * Return 0 if NTFS version is supported otherwise -1 with errno set. * * The following error codes are defined: - * ENOTSUP Unknown NTFS version - * EINVAL Invalid argument + * EOPNOTSUPP - Unknown NTFS version + * EINVAL - Invalid argument */ int ntfs_version_is_supported(ntfs_volume *vol) { @@ -1365,7 +1365,7 @@ int ntfs_version_is_supported(ntfs_volume *vol) if (NTFS_V3_0(major, minor) || NTFS_V3_1(major, minor)) return 0; - errno = ENOTSUP; + errno = EOPNOTSUPP; return -1; } diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 10d5cdd2..f6406416 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -127,7 +127,7 @@ static int ntfs_w32error_to_errno(unsigned int w32error) case ERROR_NEGATIVE_SEEK: return ESPIPE; case ERROR_NOT_SUPPORTED: - return ENOTSUP; + return EOPNOTSUPP; case ERROR_BAD_NETPATH: return ENOSHARE; default: @@ -787,7 +787,7 @@ static int ntfs_device_win32_open_partition(int drive_id, "volumes are not supported in " "R/W status yet"); CloseHandle(handle); - errno = ENOTSUP; + errno = EOPNOTSUPP; return -1; } fd->vol_handle = INVALID_HANDLE_VALUE; @@ -895,7 +895,7 @@ static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset, if (fd->part_length == -1) { Dputs("win32_seek(): Error: Position relative to end " "of disk not implemented."); - errno = ENOTSUP; + errno = EOPNOTSUPP; return -1; } abs_ofs = fd->part_length + offset; @@ -1404,7 +1404,7 @@ static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, *(int *)argp = (int)(fd->part_length / 512); return 0; } - errno = ENOTSUP; + errno = EOPNOTSUPP; return -1; #endif #if defined(BLKGETSIZE64) @@ -1414,7 +1414,7 @@ static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, *(s64 *)argp = fd->part_length; return 0; } - errno = ENOTSUP; + errno = EOPNOTSUPP; return -1; #endif #ifdef HDIO_GETGEO @@ -1429,7 +1429,7 @@ static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, #endif default: Dprintf("win32_ioctl(): unimplemented ioctl %d.\n", request); - errno = ENOTSUP; + errno = EOPNOTSUPP; return -1; } } diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index 0bb6ec42..416cb94b 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -320,7 +320,7 @@ decrypt_key_open_err: fnCertFreeCertificateContext(pCert); errno = EINVAL; #else /* !defined(__CYGWIN__) */ - errno = ENOTSUP; + errno = EOPNOTSUPP; #endif /* !defined(__CYGWIN__) */ return NULL; } @@ -722,7 +722,7 @@ ntfs_decrypt_data_key *ntfs_decrypt_data_key_open(unsigned char *data, "and say that you saw this message. We will " "then implement support for DES.\n"); free(key); - errno = ENOTSUP; + errno = EOPNOTSUPP; return NULL; } if (key_size != wanted_key_size) { diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index b1b55a28..13fe6745 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -1226,7 +1226,7 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, } if (ic == IGNORE_CASE) { Eprintf("FIXME: Hit unimplemented code path #1.\n"); - err = -ENOTSUP; + err = -EOPNOTSUPP; goto err_out; } if (!ntfs_attr_lookup(type, uname, name_len, ic, 0, NULL, 0, ctx)) { @@ -1243,12 +1243,12 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, Eprintf("Compressed attributes not supported yet.\n"); // FIXME: Compress attribute into a temporary buffer, set // val accordingly and save the compressed size. - err = -ENOTSUP; + err = -EOPNOTSUPP; goto err_out; } if (flags & (ATTR_IS_ENCRYPTED || ATTR_IS_SPARSE)) { Eprintf("Encrypted/sparse attributes not supported yet.\n"); - err = -ENOTSUP; + err = -EOPNOTSUPP; goto err_out; } if (flags & ATTR_COMPRESSION_MASK) { @@ -1299,7 +1299,7 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, // record. // FIXME: the check for needing extension records should be // earlier on as it is very quick: asize > m->bytes_allocated? - err = -ENOTSUP; + err = -EOPNOTSUPP; goto err_out; } #ifdef DEBUG @@ -1341,7 +1341,7 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, a->compressed_size = cpu_to_le64(0); // FIXME: Write out the compressed data. // FIXME: err = build_mapping_pairs_compressed(); - err = -ENOTSUP; + err = -EOPNOTSUPP; } else { a->compression_unit = 0; bw = ntfs_rlwrite(vol->dev, rl, val, val_len, &inited_size); @@ -1411,7 +1411,7 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, } if (ic == IGNORE_CASE) { Eprintf("FIXME: Hit unimplemented code path #2.\n"); - err = -ENOTSUP; + err = -EOPNOTSUPP; goto err_out; } if (!ntfs_attr_lookup(type, uname, name_len, ic, 0, NULL, 0, ctx)) { @@ -1428,12 +1428,12 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, Eprintf("Compressed attributes not supported yet.\n"); // FIXME: Compress attribute into a temporary buffer, set // val accordingly and save the compressed size. - err = -ENOTSUP; + err = -EOPNOTSUPP; goto err_out; } if (flags & (ATTR_IS_ENCRYPTED || ATTR_IS_SPARSE)) { Eprintf("Encrypted/sparse attributes not supported yet.\n"); - err = -ENOTSUP; + err = -EOPNOTSUPP; goto err_out; } if (val_len) { @@ -1486,7 +1486,7 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, // record. // FIXME: the check for needing extension records should be // earlier on as it is very quick: asize > m->bytes_allocated? - err = -ENOTSUP; + err = -EOPNOTSUPP; goto err_out; } #ifdef DEBUG @@ -1531,7 +1531,7 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, a->compressed_size = cpu_to_le64(0); // FIXME: Write out the compressed data. // FIXME: err = build_mapping_pairs_compressed(); - err = -ENOTSUP; + err = -EOPNOTSUPP; } else { a->compression_unit = 0; bw = ntfs_rlwrite(vol->dev, rl, val, val_len, NULL); @@ -1600,7 +1600,7 @@ static int insert_resident_attr_in_mft_record(MFT_RECORD *m, } if (ic == IGNORE_CASE) { Eprintf("FIXME: Hit unimplemented code path #3.\n"); - err = -ENOTSUP; + err = -EOPNOTSUPP; goto err_out; } if (!ntfs_attr_lookup(type, uname, name_len, ic, 0, val, val_len, @@ -1632,7 +1632,7 @@ static int insert_resident_attr_in_mft_record(MFT_RECORD *m, // record. // FIXME: the check for needing extension records should be // earlier on as it is very quick: asize > m->bytes_allocated? - err = -ENOTSUP; + err = -EOPNOTSUPP; goto err_out; } #ifdef DEBUG @@ -2121,7 +2121,7 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, } if (ic == IGNORE_CASE) { Eprintf("FIXME: Hit unimplemented code path #4.\n"); - err = -ENOTSUP; + err = -EOPNOTSUPP; if (uname) free(uname); goto err_out; diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 10174831..6c9c27e8 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -2184,7 +2184,7 @@ static ntfs_volume *mount_volume(void) printf(corrupt_volume_msg); else if (err == EPERM) printf(hibernated_volume_msg); - else if (err == EOPNOTSUPP) /* NOTE: same as ENOTSUP !!! */ + else if (err == EOPNOTSUPP) printf(unclean_journal_msg); exit(1); }