Patchwork [Open-FCoE,7/8] fipvlan: Use fcm_write_str_to_sysfs_file from libutil

login
register
mail settings
Submitter Robert Love
Date March 5, 2013, 6:30 p.m.
Message ID <20130305183020.21625.9733.stgit@fritz>
Download mbox | patch
Permalink /patch/8/
State Accepted
Headers show

Comments

Robert Love - March 5, 2013, 6:30 p.m.
Use the shared fcm_write_str_to_sysfs_file to write to the
module's create attribute.

Signed-off-by: Robert Love <robert.w.love@intel.com>
Tested-by: Marcus Dennis <marcusx.e.dennis@intel.com>
---
 fipvlan.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Patch

diff --git a/fipvlan.c b/fipvlan.c
index 3f4fe9c..80e4190 100644
--- a/fipvlan.c
+++ b/fipvlan.c
@@ -551,18 +551,18 @@  void create_missing_vlans()
 
 int fcoe_instance_start(char *ifname)
 {
-	int fd, rc;
-	FIP_LOG_DBG("%s on %s\n", __func__, ifname);
-	fd = open(FCOE_CREATE, O_WRONLY);
-	if (fd < 0) {
+	enum fcoe_status ret = EFAIL;
+
+	ret = fcm_write_str_to_sysfs_file(FCOE_CREATE, ifname);
+	if (ret) {
 		FIP_LOG_ERRNO("Failed to open file:%s", FCOE_CREATE);
 		FIP_LOG_ERRNO("May be fcoe stack not loaded, starting"
-			       " fcoe service will fix that");
-		return fd;
+			      " fcoe service will fix that");
+
+		return EFAIL;
 	}
-	rc = write(fd, ifname, strlen(ifname));
-	close(fd);
-	return rc < 0 ? rc : 0;
+
+	return 0;
 }
 
 void start_fcoe()