PERFORCE change 106680 for review

Roman Divacky rdivacky at FreeBSD.org
Mon Sep 25 12:39:09 PDT 2006


http://perforce.freebsd.org/chv.cgi?CH=106680

Change 106680 by rdivacky at rdivacky_witten on 2006/09/25 19:38:40

	Style fixes.
	
	Submitted by: Li, Xiao <intron at intron.ac>

Affected files ...

.. //depot/projects/linuxolator/src/sys/compat/linux/linux_aio.c#6 edit
.. //depot/projects/linuxolator/src/sys/compat/linux/linux_aio.h#3 edit

Differences ...

==== //depot/projects/linuxolator/src/sys/compat/linux/linux_aio.c#6 (text+ko) ====

@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2006 Intron <intron at intron.ac>.  All rights reserved.
+ * Copyright (c) 2006 Li, Xiao <intron at intron.ac>.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -23,7 +23,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: src/linuxaio/linux_aio.c,v 1.91 2006/09/25 19:12:31 admin Exp $");
 
 #include "opt_compat.h"
 
@@ -269,7 +269,7 @@
 			break;
 	}
 
-	return nerr;
+	return (nerr);
 }
 
 /* Allocate memory in user space */
@@ -298,7 +298,7 @@
 
 	td->td_retval[0] = r;
 
-	return nerr;
+	return (nerr);
 }
 
 /* Free memory in user space */
@@ -318,7 +318,7 @@
 	td->td_retval[0] = r;
 	DPPRINTF("%lu bytes at %p", (unsigned long)s, p);
 
-	return nerr;
+	return (nerr);
 }
 
 #ifdef	LINUX_AIO_DEBUG
@@ -356,8 +356,6 @@
 		DPPRINTF("aio_sigevent.sigev_signo: %d",
 			       	pcb->aio_sigevent.sigev_signo);
 	}
-
-	return;
 }
 
 #define	DUMP_FREEBSD_AIOCB(p, isu)    linux_aio_dump_freebsd_aiocb((p), (isu));
@@ -413,29 +411,28 @@
 	if (nerr != 0) {
 	        DPPRINTF("Unsupported aio_lio_opcode: %u",
 	                        (unsigned)plnx->aio_lio_opcode);
-	        return nerr;
+	        return (nerr);
 	}
 	pbsd->aio_reqprio = plnx->aio_reqprio;        /* Request priority */
 	pbsd->aio_sigevent.sigev_notify = SIGEV_NONE; /* No signal to deliver */
 	pbsd->aio_sigevent.sigev_signo = 0;           /* No signal to deliver */
 
-	return nerr;
+	return (nerr);
 }
 
 static int link_to_native_aio_module(struct thread *td)
 {
 	int nerr;
 
-	if (native_aio_module_handle != NULL)
-	{ /* Linking has been done successfully. */
-		
-		return 0;
+	if (native_aio_module_handle != NULL) {
+	/* Linking has been done successfully. */
+		return (0);
 	}
 
 	nerr = linker_reference_module(NATIVE_AIO_MODULE_NAME,
 			&native_aio_module_depend, &native_aio_module_handle);
 	if (nerr)
-		return nerr;
+		return (nerr);
 
 	do {
 		nerr = EINVAL;
@@ -453,18 +450,17 @@
 		nerr = 0;
 	} while (0);
 
-	if (nerr)
-	{
+	if (nerr) {
 		linker_release_module(NULL, NULL, native_aio_module_handle);
 		native_aio_module_handle = NULL;
 		
 		printf(LMSG("Unable to link to the native module \""
 				NATIVE_AIO_MODULE_NAME "\" correctly."));
 		
-		return nerr;
+		return (nerr);
 	}
 
-	return 0;
+	return (0);
 }
 
 #define	LINK_TO_NATIVE_AIO_MODULE()					\
@@ -473,7 +469,7 @@
 			NATIVE_AIO_MODULE_NAME "\" correctly "		\
 			"to provide FreeBSD "				\
 			"native Asynchronous I/O support."));		\
-		return ENOSYS;						\
+		return (ENOSYS);						\
 }
 
 static int mirror_native_aio_sysctl(struct thread *td)
@@ -486,21 +482,21 @@
 			&native_aio_capacity_proc, &l, NULL, 0,
 			NULL ,0);
 	if (nerr)
-		return nerr;
+		return (nerr);
 
 	l = sizeof(native_aio_capacity_sys);
 	nerr = kernel_sysctlbyname(td, NATIVE_AIO_SYSCTL_CAPACITY_SYS,
 			&native_aio_capacity_sys, &l, NULL, 0,
 			NULL ,0);
 	if (nerr)
-		return nerr;
+		return (nerr);
 
 	DPRINTF(NATIVE_AIO_SYSCTL_CAPACITY_PROC "=%d, "
 			NATIVE_AIO_SYSCTL_CAPACITY_SYS "=%d",
 			native_aio_capacity_proc,
 			native_aio_capacity_sys);
 
-	return nerr;
+	return (nerr);
 }
 
 /* Linux system call io_setup(2) */
@@ -515,44 +511,42 @@
 	DARGPRINTF("%u, %p", args->nr_reqs, args->ctxp);
 	LINK_TO_NATIVE_AIO_MODULE();
 	nerr = mirror_native_aio_sysctl(td);
-	if (nerr)
-	{
+	if (nerr) {
 		printf(LMSG("linux_io_setup(): Unable to query sysctls "
 			       NATIVE_AIO_SYSCTL_CAPACITY_PROC
 			       " and/or " NATIVE_AIO_SYSCTL_CAPACITY_SYS
 			       " ."));
-		return nerr;
+		return (nerr);
 	}
 
 	/* Signed integer is a little safer than unsigned */
 	arg_nr_reqs = args->nr_reqs;
 	if (arg_nr_reqs <= 0)
-		return EINVAL;
+		return (EINVAL);
 
 	if (arg_nr_reqs > native_aio_capacity_proc
-			|| arg_nr_reqs > native_aio_capacity_sys)
-	{
+			|| arg_nr_reqs > native_aio_capacity_sys) {
 		printf(LMSG("linux_io_setup(): Please increase sysctls "
 			       NATIVE_AIO_SYSCTL_CAPACITY_PROC
 			       " and/or " NATIVE_AIO_SYSCTL_CAPACITY_SYS
 			       " ."));
-		return ENOMEM;
+		return (ENOMEM);
 	}
 
 	nerr = user_mem_rw_verify(args->ctxp, sizeof(*(args->ctxp)));
 	if (nerr != 0)
-		return nerr;
+		return (nerr);
 
 	copyin(args->ctxp, &ctx_id, sizeof(ctx_id));
 	if (ctx_id != 0) /* "Not initialized", described by io_setup(2) */
-		return EINVAL;
+		return (EINVAL);
 
 	p = td->td_proc;
 
 	/* Get a new "ring" */
 	nerr = user_malloc(td, (void **)&pring, sizeof(*pring));
 	if (nerr != 0)
-		return nerr;
+		return (nerr);
 
 	/* Get a new context */
 	pctx = uma_zalloc(linux_aio_context_zone, M_WAITOK);
@@ -591,7 +585,7 @@
 		DPRINTF("Free context %p", pctx);
 		uma_zfree(linux_aio_context_zone, pctx);
 		user_free(td, pring, sizeof(*pring));
-		return ENOMEM;
+		return (ENOMEM);
 	}
 
 	/* Initialize the new context */
@@ -625,7 +619,7 @@
 	copyout(&ctx_id, args->ctxp, sizeof(ctx_id));
 	DPRINTF("returned context: %lx -> %p", (unsigned long)ctx_id, pctx);
 
-	return nerr;
+	return (nerr);
 }
 
 /* Linux system call io_destroy(2) */
@@ -671,7 +665,7 @@
 	/* Unable to find the context */
 	if (pctx == NULL) {
 		LINUX_AIO_UNLOCK(p);
-		return EINVAL;
+		return (EINVAL);
 	}
 
 	DPRINTF("Found the context: %lx -> %p", (unsigned long)args->ctx, pctx);
@@ -738,7 +732,7 @@
 	/* Free destroyed context */
 	uma_zfree(linux_aio_context_zone, pctx);
 
-	return nerr;
+	return (nerr);
 }
 
 /* Linux system call io_getevents(2) */
@@ -764,20 +758,20 @@
 	LINK_TO_NATIVE_AIO_MODULE();
 
 	if (args->nr <= 0)
-		return EINVAL;
+		return (EINVAL);
 
 	if (args->min_nr < 0)
-		return EINVAL;
+		return (EINVAL);
 
 	nerr = user_mem_rw_verify(args->events,
 			sizeof(*(args->events)) * args->nr);
 	if (nerr != 0)
-		return nerr;
+		return (nerr);
 
 	if (args->timeout != NULL) {
 		nerr = copyin(args->timeout, &l_timeout, sizeof(l_timeout));
 		if (nerr != 0)
-			return nerr;
+			return (nerr);
 		timeout.tv_sec = l_timeout.tv_sec;
 		timeout.tv_nsec = l_timeout.tv_nsec;
 		DUMP_TIMESPEC("User specified timeout: ", &timeout, "");
@@ -813,7 +807,7 @@
 	/* Unable to find the context */
 	if (pctx == NULL) {
 		LINUX_AIO_UNLOCK(p);
-		return EINVAL;
+		return (EINVAL);
 	}
 
 	DPRINTF("Found the context: %lx -> %p", (unsigned long)args->ctx_id, pctx);
@@ -1020,7 +1014,7 @@
 
 	LINUX_AIO_CTX_UNLOCK(pctx);
 
-	return nerr;
+	return (nerr);
 }
 
 /* Linux system call io_submit(2) */
@@ -1037,8 +1031,8 @@
 			(long)args->nr, args->iocbpp);
 	LINK_TO_NATIVE_AIO_MODULE();
 
-	if(args->nr <= 0)
-		return EINVAL;
+	if (args->nr <= 0)
+		return (EINVAL);
 
 	p = td->td_proc;
 
@@ -1070,7 +1064,7 @@
 	/* Unable to find the context */
 	if (pctx == NULL) {
 		LINUX_AIO_UNLOCK(p);
-		return EINVAL;
+		return (EINVAL);
 	}
 
 	DPRINTF("Found the context: %lx -> %p", (unsigned long)args->ctx_id, pctx);
@@ -1132,7 +1126,7 @@
 	if (i == 0 && nerr == 0)
 		nerr = EAGAIN; /* No request is successfully submitted */
 
-	return nerr;
+	return (nerr);
 }
 
 /* Linux system call io_cancel(2) */
@@ -1152,11 +1146,11 @@
 
 	nerr = copyin(args->iocb, &lcb, sizeof(lcb));
 	if (nerr != 0)
-		return nerr;
+		return (nerr);
 
 	nerr = user_mem_rw_verify(args->result, sizeof(*(args->result)));
 	if (nerr != 0)
-		return nerr;
+		return (nerr);
 
 	p = td->td_proc;
 
@@ -1188,7 +1182,7 @@
 	/* Unable to find the context */
 	if (pctx == NULL) {
 		LINUX_AIO_UNLOCK(p);
-		return EINVAL;
+		return (EINVAL);
 	}
 
 	DPRINTF("Found the context: %lx -> %p", (unsigned long)args->ctx_id, pctx);
@@ -1247,7 +1241,7 @@
 
 	LINUX_AIO_CTX_UNLOCK(pctx);
 
-	return nerr;
+	return (nerr);
 }
 
 static void linux_aio_proc_rundown(void *arg, struct proc *p)
@@ -1289,8 +1283,6 @@
 	}
 
 	LINUX_AIO_CTX_LIST_UNLOCK();
-
-	return;
 }
 
 /*
@@ -1330,8 +1322,7 @@
 		mtx_destroy(&linux_aio_context_list_mtx);
 		uma_zdestroy(linux_aio_request_zone);
 		uma_zdestroy(linux_aio_context_zone);
-		if (native_aio_module_handle != NULL)
-		{
+		if (native_aio_module_handle != NULL) {
 			/*
 			 * linker_release_module() cannot be used here.
 			 * It tries to hold "kld_sx", conflicting against

==== //depot/projects/linuxolator/src/sys/compat/linux/linux_aio.h#3 (text+ko) ====

@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2006 Intron <intron at intron.ac>.  All rights reserved.
+ * Copyright (c) 2006 Li, Xiao <intron at intron.ac>.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -22,7 +22,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD$
+ * $FreeBSD: src/linuxaio/linux_aio.h,v 1.8 2006/09/25 19:12:31 admin Exp $
  */
 
 /*


More information about the p4-projects mailing list