Browse Source

Make "struct buffer"s reusable between sessions.

tags/v0.9.3
Michael Brown 19 years ago
parent
commit
73429d6da1
2 changed files with 9 additions and 10 deletions
  1. 5
    8
      src/core/buffer.c
  2. 4
    2
      src/include/buffer.h

+ 5
- 8
src/core/buffer.c View File

@@ -32,15 +32,12 @@
32 32
  * Initialise a buffer
33 33
  *
34 34
  */
35
-void init_buffer ( struct buffer *buffer, physaddr_t start, size_t len ) {
36
-	buffer->start = start;
37
-	buffer->end = start + len;
38
-	buffer->fill = 0;
35
+void init_buffer ( struct buffer *buffer ) {
36
+	char tail = 1;
39 37
 
40
-	if ( len ) {
41
-		char tail = 1;
42
-		copy_to_phys ( start, &tail, sizeof ( tail ) );
43
-	}
38
+	buffer->fill = 0;
39
+	if ( buffer->end != buffer->start )
40
+		copy_to_phys ( buffer->start, &tail, sizeof ( tail ) );
44 41
 
45 42
 	DBG ( "BUFFER [%x,%x) initialised\n", buffer->start, buffer->end );
46 43
 }

+ 4
- 2
src/include/buffer.h View File

@@ -33,10 +33,12 @@ struct buffer_free_block {
33 33
 	physaddr_t	end;
34 34
 } __attribute__ (( packed ));
35 35
 
36
+/* This must be provided by the architecture-dependent load_buffer.c */
37
+extern struct buffer load_buffer;
38
+
36 39
 /* Functions in buffer.c */
37 40
 
38
-extern void init_buffer ( struct buffer *buffer, physaddr_t start,
39
-			  size_t len );
41
+extern void init_buffer ( struct buffer *buffer );
40 42
 extern int fill_buffer ( struct buffer *buffer, void *data,
41 43
 			 off_t offset, size_t len );
42 44
 

Loading…
Cancel
Save