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

Boaz Harrosh bharrosh at panasas.com
Mon Feb 23 19:05:03 CET 2009


* 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 at panasas.com>
---
 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 at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list