mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
Rebase against 7f1623bc626d3ca2411c1a3088512d8ef461252b.
This commit is contained in:
parent
1a3b158f0b
commit
260734214e
@ -1,28 +0,0 @@
|
||||
From ff92a7d4d6430af59d5ed8d0f33b3bf958eb8726 Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Wed, 23 Jun 2021 18:19:29 -0500
|
||||
Subject: [PATCH] wined3d: Report a byte count of 1 for WINED3DFMT_UNKNOWN.
|
||||
|
||||
Allow things like wined3d_format_copy_data() to work on buffers.
|
||||
|
||||
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
---
|
||||
dlls/wined3d/utils.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
|
||||
index 4019dd4d812..83d939e291f 100644
|
||||
--- a/dlls/wined3d/utils.c
|
||||
+++ b/dlls/wined3d/utils.c
|
||||
@@ -83,7 +83,7 @@ static const struct wined3d_format_channels formats[] =
|
||||
{
|
||||
/* size offset
|
||||
* format id r g b a r g b a bpp depth stencil */
|
||||
- {WINED3DFMT_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
+ {WINED3DFMT_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
|
||||
/* FourCC formats */
|
||||
{WINED3DFMT_UYVY, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
|
||||
{WINED3DFMT_YUY2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,114 +0,0 @@
|
||||
From fbb780271175048fb723ec19a9a6c24d0b6dcf81 Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Thu, 17 Jun 2021 21:56:24 -0500
|
||||
Subject: [PATCH] wined3d: Use wined3d_buffer_copy_bo_address() in
|
||||
wined3d_cs_exec_update_sub_resource().
|
||||
|
||||
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
---
|
||||
dlls/wined3d/buffer.c | 21 +--------------------
|
||||
dlls/wined3d/cs.c | 15 ++++-----------
|
||||
dlls/wined3d/wined3d_private.h | 4 ++--
|
||||
3 files changed, 7 insertions(+), 33 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
|
||||
index 00d219a49f2..7fc150878f0 100644
|
||||
--- a/dlls/wined3d/buffer.c
|
||||
+++ b/dlls/wined3d/buffer.c
|
||||
@@ -108,7 +108,7 @@ static void wined3d_buffer_validate_location(struct wined3d_buffer *buffer, DWOR
|
||||
TRACE("New locations flags are %s.\n", wined3d_debug_location(buffer->locations));
|
||||
}
|
||||
|
||||
-static void wined3d_buffer_invalidate_range(struct wined3d_buffer *buffer, DWORD location,
|
||||
+void wined3d_buffer_invalidate_range(struct wined3d_buffer *buffer, DWORD location,
|
||||
unsigned int offset, unsigned int size)
|
||||
{
|
||||
TRACE("buffer %p, location %s, offset %u, size %u.\n",
|
||||
@@ -1054,25 +1054,6 @@ void wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_off
|
||||
context_release(context);
|
||||
}
|
||||
|
||||
-void wined3d_buffer_upload_data(struct wined3d_buffer *buffer, struct wined3d_context *context,
|
||||
- const struct wined3d_box *box, const void *data)
|
||||
-{
|
||||
- struct wined3d_range range;
|
||||
-
|
||||
- if (box)
|
||||
- {
|
||||
- range.offset = box->left;
|
||||
- range.size = box->right - box->left;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- range.offset = 0;
|
||||
- range.size = buffer->resource.size;
|
||||
- }
|
||||
-
|
||||
- buffer->buffer_ops->buffer_upload_ranges(buffer, context, data, range.offset, 1, &range);
|
||||
-}
|
||||
-
|
||||
static void wined3d_buffer_init_data(struct wined3d_buffer *buffer,
|
||||
struct wined3d_device *device, const struct wined3d_sub_resource_data *data)
|
||||
{
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index 4adfa18f5f7..022c0acbd0a 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -2613,18 +2613,14 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
|
||||
|
||||
context = context_acquire(cs->c.device, NULL, 0);
|
||||
|
||||
+ addr.buffer_object = 0;
|
||||
+ addr.addr = op->data.data;
|
||||
+
|
||||
if (resource->type == WINED3D_RTYPE_BUFFER)
|
||||
{
|
||||
struct wined3d_buffer *buffer = buffer_from_resource(resource);
|
||||
|
||||
- if (!wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_BUFFER))
|
||||
- {
|
||||
- ERR("Failed to load buffer location.\n");
|
||||
- goto done;
|
||||
- }
|
||||
-
|
||||
- wined3d_buffer_upload_data(buffer, context, box, op->data.data);
|
||||
- wined3d_buffer_invalidate_location(buffer, ~WINED3D_LOCATION_BUFFER);
|
||||
+ wined3d_buffer_copy_bo_address(buffer, context, box->left, &addr, box->right - box->left);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -2635,9 +2631,6 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
|
||||
height = wined3d_texture_get_level_height(texture, level);
|
||||
depth = wined3d_texture_get_level_depth(texture, level);
|
||||
|
||||
- addr.buffer_object = 0;
|
||||
- addr.addr = op->data.data;
|
||||
-
|
||||
/* Only load the sub-resource for partial updates. */
|
||||
if (!box->left && !box->top && !box->front
|
||||
&& box->right == width && box->bottom == height && box->back == depth)
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 6700302b481..87c83d555e4 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -4919,6 +4919,8 @@ void wined3d_buffer_copy_bo_address(struct wined3d_buffer *dst_buffer, struct wi
|
||||
DWORD wined3d_buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *context,
|
||||
struct wined3d_bo_address *data) DECLSPEC_HIDDEN;
|
||||
void wined3d_buffer_invalidate_location(struct wined3d_buffer *buffer, DWORD location) DECLSPEC_HIDDEN;
|
||||
+void wined3d_buffer_invalidate_range(struct wined3d_buffer *buffer, DWORD location,
|
||||
+ unsigned int offset, unsigned int size) DECLSPEC_HIDDEN;
|
||||
void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *context,
|
||||
const struct wined3d_state *state) DECLSPEC_HIDDEN;
|
||||
BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer,
|
||||
@@ -4926,8 +4928,6 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer,
|
||||
BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) DECLSPEC_HIDDEN;
|
||||
BOOL wined3d_buffer_prepare_location(struct wined3d_buffer *buffer,
|
||||
struct wined3d_context *context, unsigned int location) DECLSPEC_HIDDEN;
|
||||
-void wined3d_buffer_upload_data(struct wined3d_buffer *buffer, struct wined3d_context *context,
|
||||
- const struct wined3d_box *box, const void *data) DECLSPEC_HIDDEN;
|
||||
|
||||
HRESULT wined3d_buffer_no3d_init(struct wined3d_buffer *buffer_no3d, struct wined3d_device *device,
|
||||
const struct wined3d_buffer_desc *desc, const struct wined3d_sub_resource_data *data,
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,76 +0,0 @@
|
||||
From 5188d3e4779ee56dc8d7a9b07074095a41a4331b Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Thu, 17 Jun 2021 22:14:58 -0500
|
||||
Subject: [PATCH] wined3d: Pass a wined3d_const_bo_address to
|
||||
wined3d_cs_exec_update_sub_resource().
|
||||
|
||||
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
---
|
||||
dlls/wined3d/cs.c | 20 +++++++++-----------
|
||||
1 file changed, 9 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index 022c0acbd0a..47bc36d4cc0 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -489,7 +489,8 @@ struct wined3d_cs_update_sub_resource
|
||||
struct wined3d_resource *resource;
|
||||
unsigned int sub_resource_idx;
|
||||
struct wined3d_box box;
|
||||
- struct wined3d_sub_resource_data data;
|
||||
+ struct wined3d_const_bo_address addr;
|
||||
+ unsigned int row_pitch, slice_pitch;
|
||||
};
|
||||
|
||||
struct wined3d_cs_add_dirty_texture_region
|
||||
@@ -2606,21 +2607,17 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
|
||||
struct wined3d_resource *resource = op->resource;
|
||||
const struct wined3d_box *box = &op->box;
|
||||
unsigned int width, height, depth, level;
|
||||
- struct wined3d_const_bo_address addr;
|
||||
struct wined3d_context *context;
|
||||
struct wined3d_texture *texture;
|
||||
struct wined3d_box src_box;
|
||||
|
||||
context = context_acquire(cs->c.device, NULL, 0);
|
||||
|
||||
- addr.buffer_object = 0;
|
||||
- addr.addr = op->data.data;
|
||||
-
|
||||
if (resource->type == WINED3D_RTYPE_BUFFER)
|
||||
{
|
||||
struct wined3d_buffer *buffer = buffer_from_resource(resource);
|
||||
|
||||
- wined3d_buffer_copy_bo_address(buffer, context, box->left, &addr, box->right - box->left);
|
||||
+ wined3d_buffer_copy_bo_address(buffer, context, box->left, &op->addr, box->right - box->left);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -2639,8 +2636,8 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
|
||||
wined3d_texture_load_location(texture, op->sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
|
||||
wined3d_box_set(&src_box, 0, 0, box->right - box->left, box->bottom - box->top, 0, box->back - box->front);
|
||||
- texture->texture_ops->texture_upload_data(context, &addr, texture->resource.format, &src_box,
|
||||
- op->data.row_pitch, op->data.slice_pitch, texture, op->sub_resource_idx,
|
||||
+ texture->texture_ops->texture_upload_data(context, &op->addr, texture->resource.format, &src_box,
|
||||
+ op->row_pitch, op->slice_pitch, texture, op->sub_resource_idx,
|
||||
WINED3D_LOCATION_TEXTURE_RGB, box->left, box->top, box->front);
|
||||
|
||||
wined3d_texture_validate_location(texture, op->sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
@@ -2665,9 +2662,10 @@ static void wined3d_cs_update_sub_resource(struct wined3d_device_context *contex
|
||||
op->resource = resource;
|
||||
op->sub_resource_idx = sub_resource_idx;
|
||||
op->box = *box;
|
||||
- op->data.row_pitch = row_pitch;
|
||||
- op->data.slice_pitch = slice_pitch;
|
||||
- op->data.data = data;
|
||||
+ op->addr.buffer_object = 0;
|
||||
+ op->addr.addr = data;
|
||||
+ op->row_pitch = row_pitch;
|
||||
+ op->slice_pitch = slice_pitch;
|
||||
|
||||
wined3d_device_context_acquire_resource(context, resource);
|
||||
|
||||
--
|
||||
2.30.2
|
||||
|
@ -51,7 +51,7 @@ usage()
|
||||
# Get the upstream commit sha
|
||||
upstream_commit()
|
||||
{
|
||||
echo "362eed3ae30e17da64888407140334925499071c"
|
||||
echo "7f1623bc626d3ca2411c1a3088512d8ef461252b"
|
||||
}
|
||||
|
||||
# Show version information
|
||||
@ -188,7 +188,6 @@ patch_enable_all ()
|
||||
enable_riched20_Class_Tests="$1"
|
||||
enable_riched20_IText_Interface="$1"
|
||||
enable_secur32_InitializeSecurityContextW="$1"
|
||||
enable_server_FileEndOfFileInformation="$1"
|
||||
enable_server_File_Permissions="$1"
|
||||
enable_server_Key_State="$1"
|
||||
enable_server_PeekMessage="$1"
|
||||
@ -607,9 +606,6 @@ patch_enable ()
|
||||
secur32-InitializeSecurityContextW)
|
||||
enable_secur32_InitializeSecurityContextW="$2"
|
||||
;;
|
||||
server-FileEndOfFileInformation)
|
||||
enable_server_FileEndOfFileInformation="$2"
|
||||
;;
|
||||
server-File_Permissions)
|
||||
enable_server_File_Permissions="$2"
|
||||
;;
|
||||
@ -1615,12 +1611,9 @@ fi
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/d3d11/device.c, dlls/d3d11/tests/d3d11.c, dlls/wined3d/buffer.c, dlls/wined3d/cs.c, dlls/wined3d/device.c,
|
||||
# | dlls/wined3d/resource.c, dlls/wined3d/texture.c, dlls/wined3d/utils.c, dlls/wined3d/wined3d_private.h
|
||||
# | dlls/wined3d/resource.c, dlls/wined3d/texture.c, dlls/wined3d/wined3d_private.h
|
||||
# |
|
||||
if test "$enable_d3d11_Deferred_Context" -eq 1; then
|
||||
patch_apply d3d11-Deferred_Context/0003-wined3d-Report-a-byte-count-of-1-for-WINED3DFMT_UNKN.patch
|
||||
patch_apply d3d11-Deferred_Context/0004-wined3d-Use-wined3d_buffer_copy_bo_address-in-wined3.patch
|
||||
patch_apply d3d11-Deferred_Context/0005-wined3d-Pass-a-wined3d_const_bo_address-to-wined3d_c.patch
|
||||
patch_apply d3d11-Deferred_Context/0006-wined3d-Introduce-a-prepare_upload_bo-device-context.patch
|
||||
patch_apply d3d11-Deferred_Context/0007-wined3d-Implement-wined3d_deferred_context_prepare_u.patch
|
||||
patch_apply d3d11-Deferred_Context/0008-d3d11-Forbid-map-types-other-than-DISCARD-and-NOOVER.patch
|
||||
@ -3085,16 +3078,6 @@ if test "$enable_secur32_InitializeSecurityContextW" -eq 1; then
|
||||
patch_apply secur32-InitializeSecurityContextW/0001-secur32-Input-Parameter-should-be-NULL-on-first-call.patch
|
||||
fi
|
||||
|
||||
# Patchset server-FileEndOfFileInformation
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/ntdll/unix/file.c, server/fd.c, server/protocol.def
|
||||
# |
|
||||
if test "$enable_server_FileEndOfFileInformation" -eq 1; then
|
||||
patch_apply server-FileEndOfFileInformation/0001-ntdll-Set-EOF-on-file-which-has-a-memory-mapping-sho.patch
|
||||
patch_apply server-FileEndOfFileInformation/0002-server-Growing-files-which-are-mapped-to-memory-shou.patch
|
||||
fi
|
||||
|
||||
# Patchset server-File_Permissions
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
|
@ -1,141 +0,0 @@
|
||||
From b956b7f35f07153aa61a9a57a1b5bb7f2f9d1e8b Mon Sep 17 00:00:00 2001
|
||||
From: Qian Hong <qhong@codeweavers.com>
|
||||
Date: Fri, 21 Aug 2015 21:58:51 +0800
|
||||
Subject: [PATCH] ntdll: Set EOF on file which has a memory mapping should
|
||||
fail.
|
||||
|
||||
---
|
||||
dlls/ntdll/unix/file.c | 23 ++++--------------
|
||||
server/fd.c | 55 ++++++++++++++++++++++++++++++++++++++++++
|
||||
server/protocol.def | 7 ++++++
|
||||
3 files changed, 67 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
|
||||
index d39ca8cd635..b0ec1ff3f5f 100644
|
||||
--- a/dlls/ntdll/unix/file.c
|
||||
+++ b/dlls/ntdll/unix/file.c
|
||||
@@ -4038,28 +4038,15 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
|
||||
case FileEndOfFileInformation:
|
||||
if (len >= sizeof(FILE_END_OF_FILE_INFORMATION))
|
||||
{
|
||||
- struct stat st;
|
||||
const FILE_END_OF_FILE_INFORMATION *info = ptr;
|
||||
|
||||
- if ((io->u.Status = server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, NULL )))
|
||||
- return io->u.Status;
|
||||
-
|
||||
- /* first try normal truncate */
|
||||
- if (ftruncate( fd, (off_t)info->EndOfFile.QuadPart ) != -1) break;
|
||||
-
|
||||
- /* now check for the need to extend the file */
|
||||
- if (fstat( fd, &st ) != -1 && (off_t)info->EndOfFile.QuadPart > st.st_size)
|
||||
+ SERVER_START_REQ( set_fd_eof_info )
|
||||
{
|
||||
- static const char zero;
|
||||
-
|
||||
- /* 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( fd, &zero, 1, (off_t)info->EndOfFile.QuadPart ) != -1 &&
|
||||
- ftruncate( fd, (off_t)info->EndOfFile.QuadPart ) != -1) break;
|
||||
+ req->handle = wine_server_obj_handle( handle );
|
||||
+ req->eof = info->EndOfFile.QuadPart;
|
||||
+ io->u.Status = wine_server_call( req );
|
||||
}
|
||||
- io->u.Status = errno_to_status( errno );
|
||||
-
|
||||
- if (needs_close) close( fd );
|
||||
+ SERVER_END_REQ;
|
||||
}
|
||||
else io->u.Status = STATUS_INVALID_PARAMETER_3;
|
||||
break;
|
||||
diff --git a/server/fd.c b/server/fd.c
|
||||
index 7ea8ac273e5..3a92ca5fd48 100644
|
||||
--- a/server/fd.c
|
||||
+++ b/server/fd.c
|
||||
@@ -2574,6 +2574,50 @@ failed:
|
||||
free( name );
|
||||
}
|
||||
|
||||
+static void set_fd_eof( struct fd *fd, file_pos_t eof )
|
||||
+{
|
||||
+ static const char zero;
|
||||
+ struct stat st;
|
||||
+ struct list *ptr;
|
||||
+
|
||||
+ if (!fd->inode)
|
||||
+ {
|
||||
+ set_error( STATUS_OBJECT_TYPE_MISMATCH );
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (fd->unix_fd == -1)
|
||||
+ {
|
||||
+ set_error( fd->no_fd_status );
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* can't set eof of files which are mapped to memory */
|
||||
+ LIST_FOR_EACH( ptr, &fd->inode->open )
|
||||
+ {
|
||||
+ struct fd *fd_ptr = LIST_ENTRY( ptr, struct fd, inode_entry );
|
||||
+ if (fd_ptr != fd && (fd_ptr->access & FILE_MAPPING_ACCESS))
|
||||
+ {
|
||||
+ set_error( STATUS_USER_MAPPED_FILE );
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* first try normal truncate */
|
||||
+ if (ftruncate( fd->unix_fd, eof ) != -1) return;
|
||||
+
|
||||
+ /* now check for the need to extend the file */
|
||||
+ if (fstat( fd->unix_fd, &st ) != -1 && eof > st.st_size)
|
||||
+ {
|
||||
+ /* 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( fd->unix_fd, &zero, 1, eof ) != -1 &&
|
||||
+ ftruncate( fd->unix_fd, eof) != -1) return;
|
||||
+ }
|
||||
+
|
||||
+ file_set_error();
|
||||
+}
|
||||
+
|
||||
struct completion *fd_get_completion( struct fd *fd, apc_param_t *p_key )
|
||||
{
|
||||
*p_key = fd->comp_key;
|
||||
@@ -2852,3 +2896,14 @@ DECL_HANDLER(set_fd_name_info)
|
||||
}
|
||||
if (root_fd) release_object( root_fd );
|
||||
}
|
||||
+
|
||||
+/* set fd eof information */
|
||||
+DECL_HANDLER(set_fd_eof_info)
|
||||
+{
|
||||
+ struct fd *fd = get_handle_fd_obj( current->process, req->handle, 0 );
|
||||
+ if (fd)
|
||||
+ {
|
||||
+ set_fd_eof( fd, req->eof );
|
||||
+ release_object( fd );
|
||||
+ }
|
||||
+}
|
||||
diff --git a/server/protocol.def b/server/protocol.def
|
||||
index c3442c06e9b..80ca76f9271 100644
|
||||
--- a/server/protocol.def
|
||||
+++ b/server/protocol.def
|
||||
@@ -3822,6 +3822,13 @@ struct handle_info
|
||||
@END
|
||||
|
||||
|
||||
+/* set fd eof information */
|
||||
+@REQ(set_fd_eof_info)
|
||||
+ obj_handle_t handle; /* handle to a file or directory */
|
||||
+ file_pos_t eof; /* offset of eof of file */
|
||||
+@END
|
||||
+
|
||||
+
|
||||
/* Retrieve layered info for a window */
|
||||
@REQ(get_window_layered_info)
|
||||
user_handle_t handle; /* handle to the window */
|
||||
--
|
||||
2.27.0
|
||||
|
@ -1,55 +0,0 @@
|
||||
From 70e97a724ec17b2e78333eb79d25a443defca13c Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sat, 31 Oct 2015 21:11:23 +0100
|
||||
Subject: server: Growing files which are mapped to memory should still work.
|
||||
|
||||
---
|
||||
server/fd.c | 23 ++++++++++++++++-------
|
||||
1 file changed, 16 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/server/fd.c b/server/fd.c
|
||||
index f91659d..144f04a 100644
|
||||
--- a/server/fd.c
|
||||
+++ b/server/fd.c
|
||||
@@ -2366,14 +2366,23 @@ static void set_fd_eof( struct fd *fd, file_pos_t eof )
|
||||
return;
|
||||
}
|
||||
|
||||
- /* can't set eof of files which are mapped to memory */
|
||||
- LIST_FOR_EACH( ptr, &fd->inode->open )
|
||||
+ if (fstat( fd->unix_fd, &st ) == -1)
|
||||
{
|
||||
- struct fd *fd_ptr = LIST_ENTRY( ptr, struct fd, inode_entry );
|
||||
- if (fd_ptr != fd && (fd_ptr->access & FILE_MAPPING_ACCESS))
|
||||
+ file_set_error();
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* can't truncate files which are mapped to memory */
|
||||
+ if (eof < st.st_size)
|
||||
+ {
|
||||
+ LIST_FOR_EACH( ptr, &fd->inode->open )
|
||||
{
|
||||
- set_error( STATUS_USER_MAPPED_FILE );
|
||||
- return;
|
||||
+ struct fd *fd_ptr = LIST_ENTRY( ptr, struct fd, inode_entry );
|
||||
+ if (fd_ptr != fd && (fd_ptr->access & FILE_MAPPING_ACCESS))
|
||||
+ {
|
||||
+ set_error( STATUS_USER_MAPPED_FILE );
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2381,7 +2390,7 @@ static void set_fd_eof( struct fd *fd, file_pos_t eof )
|
||||
if (ftruncate( fd->unix_fd, eof ) != -1) return;
|
||||
|
||||
/* now check for the need to extend the file */
|
||||
- if (fstat( fd->unix_fd, &st ) != -1 && eof > st.st_size)
|
||||
+ if (eof > st.st_size)
|
||||
{
|
||||
/* extend the file one byte beyond the requested size and then truncate it */
|
||||
/* this should work around ftruncate implementations that can't extend files */
|
||||
--
|
||||
2.6.1
|
||||
|
@ -1 +0,0 @@
|
||||
Fixes: Set EOF on file which has a memory mapping should fail
|
@ -1 +1 @@
|
||||
362eed3ae30e17da64888407140334925499071c
|
||||
7f1623bc626d3ca2411c1a3088512d8ef461252b
|
||||
|
Loading…
x
Reference in New Issue
Block a user