Browse Source

Add strlen_user() (will be needed for PXE API extensions)

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
f660e8ef58
1 changed files with 12 additions and 0 deletions
  1. 12
    0
      src/arch/i386/include/librm.h

+ 12
- 0
src/arch/i386/include/librm.h View File

@@ -193,6 +193,18 @@ memset_user ( userptr_t buffer, off_t offset, int c, size_t len ) {
193 193
 	memset ( ( ( void * ) buffer + offset ), c, len );
194 194
 }
195 195
 
196
+/**
197
+ * Find length of NUL-terminated string in user buffer
198
+ *
199
+ * @v buffer		User buffer
200
+ * @v offset		Offset within buffer
201
+ * @ret len		Length of string (excluding NUL)
202
+ */
203
+static inline __attribute__ (( always_inline )) size_t
204
+strlen_user ( userptr_t buffer, off_t offset ) {
205
+	return strlen ( ( void * ) buffer + offset );
206
+}
207
+
196 208
 /**
197 209
  * Convert virtual address to user buffer
198 210
  *

Loading…
Cancel
Save