Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Feb 2014 16:17:38 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r261935 - projects/arm64/sys/boot/efi/libefi
Message-ID:  <201402151617.s1FGHcQx091952@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Sat Feb 15 16:17:38 2014
New Revision: 261935
URL: http://svnweb.freebsd.org/changeset/base/261935

Log:
  Implement seek for the EFI Simple FS

Modified:
  projects/arm64/sys/boot/efi/libefi/efisimplefs.c

Modified: projects/arm64/sys/boot/efi/libefi/efisimplefs.c
==============================================================================
--- projects/arm64/sys/boot/efi/libefi/efisimplefs.c	Sat Feb 15 14:56:50 2014	(r261934)
+++ projects/arm64/sys/boot/efi/libefi/efisimplefs.c	Sat Feb 15 16:17:38 2014	(r261935)
@@ -165,9 +165,35 @@ efifs_write(struct open_file *f, void *b
 static off_t
 efifs_seek(struct open_file *f, off_t offset, int where)
 {
-	printf("efifs_seek\n");
+	EFI_STATUS status;
+	EFI_FILE *file;
+	uint64_t pos;
+
+	file = f->f_fsdata;
+	if (file == NULL)
+		return (-1);
+
+	switch(where) {
+	case SEEK_SET:
+		pos = 0;
+		break;
+	case SEEK_CUR:
+		/* Read the current position first */
+		status = file->GetPosition(file, &pos);
+		if (EFI_ERROR(status))
+			return (-1);
+		break;
+	case SEEK_END:
+	default:
+		return (-1);
+	}
+
+	pos += offset;
+	status = file->SetPosition(file, pos);
+	if (EFI_ERROR(status))
+		return (-1);
 
-	return (EINVAL);
+	return (pos);
 }
 
 static int



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201402151617.s1FGHcQx091952>