diff --git a/libisofs/aaip-os-linux.c b/libisofs/aaip-os-linux.c index dc0582e..41ee8a4 100644 --- a/libisofs/aaip-os-linux.c +++ b/libisofs/aaip-os-linux.c @@ -541,7 +541,9 @@ ex:; the FS_*_FL bits 4= ok, ENOTTY from FS_IOC_GETFLAGS 0= local flag retrieval not enabled at compile time - <0 error with system calls + <0 error with system calls: + -1= error with open(2) + -2= error with ioctl(2), not pardoned by bit0 */ int aaip_get_lfa_flags(char *path, uint64_t *lfa_flags, int *max_bit, int *os_errno, int flag) @@ -582,7 +584,7 @@ int aaip_get_lfa_flags(char *path, uint64_t *lfa_flags, int *max_bit, if(!(flag & 4)) aaip_local_error("ioctl(FS_IOC_GETFLAGS)", path, errno, 0); *os_errno= errno; - return(-1); + return(-2); } *lfa_flags= ioctl_result; if(*lfa_flags < 1 << 24) @@ -902,6 +904,14 @@ ex:; @param flag Bitfield for control purposes. bit2= do not issue own error messages with operating system errors + @return 1= ok, all lfa_flags bits were written + 2= ok, but some FS_*_FL bits could not be mapped to + local flags + 0= local flags setting not enabled at compile time + <0 error with system calls or with max_bit: + -1= error with open(2) + -2= error with ioctl(2) + -3= error with max_bit */ int aaip_set_lfa_flags(char *path, uint64_t lfa_flags, int max_bit, int *os_errno, int flag) @@ -920,7 +930,7 @@ int aaip_set_lfa_flags(char *path, uint64_t lfa_flags, int max_bit, if(max_bit > (int) sizeof(long) * 8 - 1) { aaip_local_error("ioctl(FS_IOC_SETFLAGS) with too many bits", path, 0, 0); - return(-1); + return(-3); } fd= open(path, O_RDONLY | O_NDELAY); @@ -940,7 +950,7 @@ int aaip_set_lfa_flags(char *path, uint64_t lfa_flags, int max_bit, if(!(flag & 4)) aaip_local_error("ioctl(FS_IOC_SETFLAGS)", path, errno, 0); *os_errno= errno; - return(-1); + return(-2); } ret= 1; diff --git a/libisofs/aaip_0_2.h b/libisofs/aaip_0_2.h index efa4e93..1d54c5c 100644 --- a/libisofs/aaip_0_2.h +++ b/libisofs/aaip_0_2.h @@ -246,12 +246,20 @@ int aaip_get_attr_list(char *path, size_t *num_attrs, char ***names, @param max_bit Will tell the highest bit that is possibly set (-1 = surely no bit is valid) @param os_errno Will get filled with errno if a system call fails - @param flag Bitfield for control purposes. Submit 0. + @param flag Bitfield for control purposes. + bit0= consider ENOTTY from FS_IOC_GETFLAGS an error + (else return 4 on ENOTTY) + bit2= do not issue own error messages with operating + system errors + bit7= Ignore non-settable flags @return 1= ok, all local attribute flags are in lfa_flags 2= ok, but some local flags could not be mapped to the FS_*_FL bits + 4= ok, ENOTTY from FS_IOC_GETFLAGS 0= local flags retrieval not enabled at compile time - <0 error with system calls + <0 error with system calls: + -1= error with open(2) + -2= error with ioctl(2), not pardoned by bit0 */ int aaip_get_lfa_flags(char *path, uint64_t *lfa_flags, int *max_bit, int *os_errno, int flag); @@ -567,12 +575,17 @@ int aaip_set_attr_list(char *path, size_t num_attrs, char **names, (-1 = surely no bit is valid) On Linux this must be smaller than sizeof(long) * 8. @param os_errno Will get filled with errno if a system call fails - @param flag Bitfield for control purposes. Submit 0. + @param flag Bitfield for control purposes: + bit2= do not issue own error messages with operating + system errors @return 1= ok, all lfa_flags bits were written 2= ok, but some FS_*_FL bits could not be mapped to local flags 0= local flags setting not enabled at compile time - <0 error with system calls or with max_bit + <0 error with system calls or with max_bit: + -1= error with open(2) + -2= error with ioctl(2) + -3= error with max_bit */ int aaip_set_lfa_flags(char *path, uint64_t lfa_flags, int max_bit, int *os_errno, int flag); diff --git a/libisofs/fs_local.c b/libisofs/fs_local.c index d3c569c..536dddb 100644 --- a/libisofs/fs_local.c +++ b/libisofs/fs_local.c @@ -984,6 +984,8 @@ int iso_local_get_lfa_flags(char *disk_path, uint64_t *lfa_flags, int *max_bit, flag & (4 | (1 << 7))); if(ret == 0) return ISO_LFA_NOT_ENABLED; + if(ret == -1) + return ISO_LFA_NO_OPEN_LOCAL; if(ret < 0) return ISO_LFA_NO_SET_LOCAL; return ret; @@ -1030,6 +1032,8 @@ int iso_local_set_lfa_flags(char *disk_path, uint64_t lfa_flags, int max_bit, flag & 4); if (ret == 0) return ISO_LFA_NOT_ENABLED; + if (ret == -1) + return ISO_LFA_NO_OPEN_LOCAL; if (ret < 0) return ISO_LFA_NO_GET_LOCAL; eff_flags &= ~change_mask; @@ -1038,6 +1042,8 @@ int iso_local_set_lfa_flags(char *disk_path, uint64_t lfa_flags, int max_bit, ret= aaip_set_lfa_flags(disk_path, eff_flags, max_bit, os_errno, flag & 4); if(ret == 0) return ISO_LFA_NOT_ENABLED; + if (ret == -1) + return ISO_LFA_NO_OPEN_LOCAL; if(ret < 0) return ISO_LFA_NO_SET_LOCAL; return ret; diff --git a/libisofs/libisofs.h b/libisofs/libisofs.h index f229751..777f36a 100644 --- a/libisofs/libisofs.h +++ b/libisofs/libisofs.h @@ -9732,6 +9732,11 @@ int iso_conv_name_chars(IsoWriteOpts *opts, char *name, size_t name_len, (SORRY,HIGH, -434) */ #define ISO_LFA_NO_SET_LOCAL 0xE030FE4E +/** Failure to open local file for setting Linux-like file attributes + (SORRY,HIGH, -435) */ +#define ISO_LFA_NO_OPEN_LOCAL 0xE030FE4D + + /* Internal developer note: Place new error codes directly above this comment. diff --git a/libisofs/messages.c b/libisofs/messages.c index 2b6f8c0..7d8a525 100644 --- a/libisofs/messages.c +++ b/libisofs/messages.c @@ -583,6 +583,8 @@ const char *iso_error_to_msg(int errcode) return "Error with getting Linux-like file attributes of local file"; case ISO_LFA_NO_SET_LOCAL: return "Error with setting Linux-like file attributes of local file"; + case ISO_LFA_NO_OPEN_LOCAL: + return "Failure to open local file for Linux-like file attributes"; default: return "Unknown error"; }