svn commit: r226717 - head/sbin/geom/class/eli

Pawel Jakub Dawidek pjd at FreeBSD.org
Tue Oct 25 07:32:43 UTC 2011


Author: pjd
Date: Tue Oct 25 07:32:43 2011
New Revision: 226717
URL: http://svn.freebsd.org/changeset/base/226717

Log:
  Simplify eli_is_attached() function and make it return boot instead of int.
  
  MFC after:	3 days

Modified:
  head/sbin/geom/class/eli/geom_eli.c

Modified: head/sbin/geom/class/eli/geom_eli.c
==============================================================================
--- head/sbin/geom/class/eli/geom_eli.c	Tue Oct 25 07:31:13 2011	(r226716)
+++ head/sbin/geom/class/eli/geom_eli.c	Tue Oct 25 07:32:43 2011	(r226717)
@@ -333,11 +333,10 @@ arc4rand(unsigned char *buf, size_t size
 		buf[i] = arc4random() % 0xff;
 }
 
-static int
+static bool
 eli_is_attached(const char *prov)
 {
 	char name[MAXPATHLEN];
-	unsigned secsize;
 
 	/*
 	 * Not the best way to do it, but the easiest.
@@ -345,10 +344,7 @@ eli_is_attached(const char *prov)
 	 * by asking about its sectorsize.
 	 */
 	snprintf(name, sizeof(name), "%s%s", prov, G_ELI_SUFFIX);
-	secsize = g_get_sectorsize(name);
-	if (secsize > 0)
-		return (1);
-	return (0);
+	return (g_get_sectorsize(name) > 0);
 }
 
 static int


More information about the svn-src-head mailing list