server: Move the functions to extend file to mapping.c since it's the only user.
diff --git a/server/mapping.c b/server/mapping.c
index a303111..39c7f50 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -126,6 +126,48 @@
 #define ROUND_SIZE(size)  (((size) + page_mask) & ~page_mask)
 
 
+/* extend a file beyond the current end of file */
+static int extend_file( struct file *file, file_pos_t new_size )
+{
+    static const char zero;
+    int unix_fd = get_file_unix_fd( file );
+    off_t size = new_size;
+
+    if (unix_fd == -1) return 0;
+
+    if (sizeof(new_size) > sizeof(size) && size != new_size)
+    {
+        set_error( STATUS_INVALID_PARAMETER );
+        return 0;
+    }
+    /* extend the file one byte beyond the requested size and then truncate it */
+    /* this should work around ftruncate implementations that can't extend files */
+    if (pwrite( unix_fd, &zero, 1, size ) != -1)
+    {
+        ftruncate( unix_fd, size );
+        return 1;
+    }
+    file_set_error();
+    return 0;
+}
+
+/* try to grow the file to the specified size */
+static int grow_file( struct file *file, file_pos_t size )
+{
+    struct stat st;
+    int unix_fd = get_file_unix_fd( file );
+
+    if (unix_fd == -1) return 0;
+
+    if (fstat( unix_fd, &st ) == -1)
+    {
+        file_set_error();
+        return 0;
+    }
+    if (st.st_size >= size) return 1;  /* already large enough */
+    return extend_file( file, size );
+}
+
 /* find the shared PE mapping for a given mapping */
 static struct file *get_shared_file( struct mapping *mapping )
 {