1.1 --- a/libfsclient/lib/src/file.cc Tue Feb 14 21:05:14 2023 +0100
1.2 +++ b/libfsclient/lib/src/file.cc Tue Feb 14 23:36:10 2023 +0100
1.3 @@ -1,7 +1,7 @@
1.4 /*
1.5 * File access convenience functions.
1.6 *
1.7 - * Copyright (C) 2021, 2022 Paul Boddie <paul@boddie.org.uk>
1.8 + * Copyright (C) 2021, 2022, 2023 Paul Boddie <paul@boddie.org.uk>
1.9 *
1.10 * This program is free software; you can redistribute it and/or
1.11 * modify it under the terms of the GNU General Public License as
1.12 @@ -190,6 +190,16 @@
1.13 return err;
1.14 }
1.15
1.16 +/* Open a new instance of a file using the given structure. */
1.17 +
1.18 +long file_reopen(file_t *file, file_t *new_file, flags_t flags)
1.19 +{
1.20 + client_File _file(file->ref);
1.21 + file_init(new_file);
1.22 + new_file->flags = flags;
1.23 + return _file.reopen(flags, &new_file->size, &new_file->ref, &new_file->object_flags);
1.24 +}
1.25 +
1.26 /* Rename an object in the filesystem. This is a convenience function invoking
1.27 file_context and file_context_rename. */
1.28