Commit fe8af31f authored by Jacek Kalwas's avatar Jacek Kalwas Committed by Tomasz Zawadzki
Browse files

util/fd: return negative errno on spdk_fd_[set|clear]_nonblock



This unifies with general SPDK return value style and allows to give
more precise error code to the user.

Change-Id: I1254c6933d51dec9eb6185a0fb78d4c82eda73d0
Signed-off-by: default avatarJacek Kalwas <jacek.kalwas@nutanix.com>
Reviewed-on: https://review.spdk.io/c/spdk/spdk/+/26107


Reviewed-by: default avatarJim Harris <jim.harris@nvidia.com>
Tested-by: default avatarSPDK Automated Test System <spdkbot@gmail.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz@tzawadzki.com>
parent 5631eb65
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ uint32_t spdk_fd_get_blocklen(int fd);
 *
 * \param fd  File descriptor.
 *
 * \return    0 on success, negative on failure.
 * \return    0 on success, negative errno value on failure.
 */
int spdk_fd_set_nonblock(int fd);

@@ -48,7 +48,7 @@ int spdk_fd_set_nonblock(int fd);
 *
 * \param fd  File descriptor.
 *
 * \return    0 on success, negative on failure.
 * \return    0 on success, negative errno value on failure.
 */
int spdk_fd_clear_nonblock(int fd);

+2 −2
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ fd_update_nonblock(int fd, bool set)
	flag = fcntl(fd, F_GETFL);
	if (flag < 0) {
		SPDK_ERRLOG("fcntl can't get file status flag, fd: %d (%s)\n", fd, spdk_strerror(errno));
		return -1;
		return -errno;
	}

	if (set) {
@@ -115,7 +115,7 @@ fd_update_nonblock(int fd, bool set)
	if (fcntl(fd, F_SETFL, flag) < 0) {
		SPDK_ERRLOG("fcntl can't set %sblocking mode, fd: %d (%s)\n", set ? "non" : "", fd,
			    spdk_strerror(errno));
		return -1;
		return -errno;
	}

	return 0;