PERFORCE change 92916 for review

Todd Miller millert at FreeBSD.org
Tue Mar 7 08:33:52 PST 2006


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

Change 92916 by millert at millert_ibook on 2006/03/07 16:32:57

	Fix some style nits.

Affected files ...

.. //depot/projects/trustedbsd/sedarwin7/src/darwin/xnu/osfmk/ipc/ipc_kmsg.c#9 edit
.. //depot/projects/trustedbsd/sedarwin7/src/darwin/xnu/osfmk/ipc/mach_port.c#6 edit
.. //depot/projects/trustedbsd/sedarwin7/src/darwin/xnu/osfmk/kern/task.c#5 edit

Differences ...

==== //depot/projects/trustedbsd/sedarwin7/src/darwin/xnu/osfmk/ipc/ipc_kmsg.c#9 (text+ko) ====

@@ -236,8 +236,8 @@
 
 #ifdef MAC
 	if (kmsg->ikm_sender != NULL) {
-	  labelh_release (kmsg->ikm_sender);
-	  kmsg->ikm_sender = NULL;
+		labelh_release(kmsg->ikm_sender);
+		kmsg->ikm_sender = NULL;
 	}
 #endif
 
@@ -608,8 +608,8 @@
 
 #ifdef MAC
 	if (kmsg->ikm_sender != NULL) {
-	  labelh_release (kmsg->ikm_sender);
-	  kmsg->ikm_sender = NULL;
+		labelh_release (kmsg->ikm_sender);
+		kmsg->ikm_sender = NULL;
 	}
 #endif
 }
@@ -716,12 +716,10 @@
 
 #ifdef MAC
 	task_t cur = current_thread()->top_act->task;
-	if (cur)
-	  {
-	    labelh_reference (cur->label);
-	    kmsg->ikm_sender = cur->label;
-	  }
-	else
+	if (cur) {
+		labelh_reference(cur->label);
+		kmsg->ikm_sender = cur->label;
+	} else
 		trailer->msgh_labels.sender = 0;
 #else
         trailer->msgh_labels.sender = 0;

==== //depot/projects/trustedbsd/sedarwin7/src/darwin/xnu/osfmk/ipc/mach_port.c#6 (text+ko) ====

@@ -1836,12 +1836,16 @@
 }
 
 kern_return_t
-mach_set_port_label (ipc_space_t space, mach_port_name_t name, vm_offset_t labelstr)
+mach_set_port_label(
+	ipc_space_t		space,
+	mach_port_name_t	name,
+	vm_offset_t		labelstr)
 {
 #ifdef MAC
 	ipc_entry_t entry;
 	kern_return_t kr;
 	struct label inl;
+	int rc;
 
 	if (space == IS_NULL || space->is_task == NULL)
 		return KERN_INVALID_TASK;
@@ -1849,32 +1853,33 @@
 	if (!MACH_PORT_VALID(name))
 		return KERN_INVALID_NAME;
 
-	mac_init_port_label (&inl);
-	int rc = mac_internalize_port_label (&inl, labelstr);
+	mac_init_port_label(&inl);
+	rc = mac_internalize_port_label(&inl, labelstr);
 	if (rc)
-	  return KERN_INVALID_ARGUMENT;
+		return KERN_INVALID_ARGUMENT;
 
 	kr = ipc_right_lookup_write(space, name, &entry);
 	if (kr != KERN_SUCCESS)
 		return kr;
 
-	if (IOT_PORT != io_otype(entry->ie_object)) {
-	  is_write_unlock (space);
-	  return KERN_INVALID_RIGHT;
+	if (io_otype(entry->ie_object) != IOT_PORT) {
+		is_write_unlock(space);
+		return KERN_INVALID_RIGHT;
 	}
 
 	ipc_port_t port = (ipc_port_t) entry->ie_object;
 
-	ip_lock (port);
+	ip_lock(port);
 
-	rc = mac_check_port_relabel (&space->is_task->maclabel, &port->ip_label, &inl);
+	rc = mac_check_port_relabel(&space->is_task->maclabel,
+	    &port->ip_label, &inl);
 	if (rc)
-	  kr = KERN_NO_ACCESS;
+		kr = KERN_NO_ACCESS;
 	else
-	  mac_copy_port_label (&inl, &port->ip_label);
+		mac_copy_port_label(&inl, &port->ip_label);
 
-	ip_unlock (port);
-	is_write_unlock (space);
+	ip_unlock(port);
+	is_write_unlock(space);
 	return kr;
 #else
 	return KERN_INVALID_ARGUMENT;

==== //depot/projects/trustedbsd/sedarwin7/src/darwin/xnu/osfmk/kern/task.c#5 (text+ko) ====

@@ -381,9 +381,8 @@
 	eml_task_reference(new_task, parent_task);
 
 #ifdef MAC
-	/*mutex_init(&new_task->labellock, ETAP_NO_TRACE);*/
-	new_task->label = labelh_new ();
-	mac_init_task_label (&new_task->maclabel);
+	new_task->label = labelh_new();
+	mac_init_task_label(&new_task->maclabel);
 #endif
 
 	ipc_task_init(new_task, parent_task);
@@ -471,8 +470,7 @@
 
 	task_lock(task);
 #ifdef MAC
-	/* Prevent task from being destroyed while the label is
-	   still in use */
+	/* Prevent task from being destroyed while the label is still in use */
 	tasklabel_lock(task);
 #endif
 	refs = --task->ref_count;
@@ -1806,5 +1804,4 @@
 	(*f)(&pt->maclabel, arg);
 	tasklabel_unlock(pt);
 }
-
 #endif


More information about the trustedbsd-cvs mailing list