[PATCH 08/14] tgt: BSD support - Services that are unavailable in BSD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* ipc_perm - Let in any request. credential checks are turned
             off in BSD.

* oom_adjust - Not available as is on BSD

* ioctl(, BLKGETSIZE64) - is not available. FIXME: How to do on BSD

Signed-off-by: Boaz Harrosh <bharrosh@xxxxxxxxxxx>
---
 usr/mgmt.c |    3 ++-
 usr/tgtd.c |    2 ++
 usr/util.c |    5 +++++
 3 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/usr/mgmt.c b/usr/mgmt.c
index 5351b2c..03560c8 100644
--- a/usr/mgmt.c
+++ b/usr/mgmt.c
@@ -381,6 +381,7 @@ static int ipc_accept(int accept_fd)
 
 static int ipc_perm(int fd)
 {
+#ifndef __MAKE_TGT_ON_BSD__
 	struct ucred cred;
 	socklen_t len;
 	int err;
@@ -394,7 +395,7 @@ static int ipc_perm(int fd)
 
 	if (cred.uid || cred.gid)
 		return -EPERM;
-
+#endif /* ndef __MAKE_TGT_ON_BSD__ */
 	return 0;
 }
 
diff --git a/usr/tgtd.c b/usr/tgtd.c
index 8569d41..56f7d93 100644
--- a/usr/tgtd.c
+++ b/usr/tgtd.c
@@ -78,6 +78,7 @@ static void signal_catch(int signo) {
 
 static int oom_adjust(void)
 {
+#ifndef __MAKE_TGT_ON_BSD__
 	int fd, err;
 	char path[64];
 
@@ -94,6 +95,7 @@ static int oom_adjust(void)
 		return errno;
 	}
 	close(fd);
+#endif /* ndef __MAKE_TGT_ON_BSD__ */
 	return 0;
 }
 
diff --git a/usr/util.c b/usr/util.c
index 2f4f488..0fd006d 100644
--- a/usr/util.c
+++ b/usr/util.c
@@ -101,11 +101,16 @@ int backed_file_open(char *path, int oflag, uint64_t *size)
 	if (S_ISREG(st.st_mode))
 		*size = st.st_size;
 	else if (S_ISBLK(st.st_mode)) {
+#ifndef __MAKE_TGT_ON_BSD__
 		err = ioctl(fd, BLKGETSIZE64, size);
 		if (err < 0) {
 			eprintf("Cannot get size, %m\n");
 			goto close_fd;
 		}
+#else
+		/*FIXME:*/
+		*size = ~0LLU;
+#endif
 	} else {
 		eprintf("Cannot use this mode %x\n", st.st_mode);
 		err = -EINVAL;
-- 
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux