-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Factor out non-portable vnode_t usage
On FreeBSD file offset state is maintained in struct file. A given vnode can be referenced from many different struct file *. As a consequence, FreeBSD's SPL doesn't support vn_rdwr with the FAPPEND flag. This change replaces the non-portable vnode_t with the portable file_t in the common code. Signed-off-by: Matt Macy <[email protected]>
- Loading branch information
Showing
14 changed files
with
196 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* CDDL HEADER START | ||
* | ||
* The contents of this file are subject to the terms of the | ||
* Common Development and Distribution License (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* | ||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | ||
* or http://www.opensolaris.org/os/licensing. | ||
* See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
* | ||
* When distributing Covered Code, include this CDDL HEADER in each | ||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE. | ||
* If applicable, add the following below this CDDL HEADER, with the | ||
* fields enclosed by brackets "[]" replaced with your own identifying | ||
* information: Portions Copyright [yyyy] [name of copyright owner] | ||
* | ||
* CDDL HEADER END | ||
*/ | ||
|
||
#ifndef _SYS_ZFS_FILE_H | ||
#define _SYS_ZFS_FILE_H | ||
|
||
int zfs_file_write(file_t *, const void *, size_t, loff_t *, ssize_t *); | ||
loff_t zfs_file_seek(file_t *, loff_t, int); | ||
|
||
#endif /* _SYS_ZFS_FILE_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* CDDL HEADER START | ||
* | ||
* The contents of this file are subject to the terms of the | ||
* Common Development and Distribution License (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* | ||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | ||
* or http://www.opensolaris.org/os/licensing. | ||
* See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
* | ||
* When distributing Covered Code, include this CDDL HEADER in each | ||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE. | ||
* If applicable, add the following below this CDDL HEADER, with the | ||
* fields enclosed by brackets "[]" replaced with your own identifying | ||
* information: Portions Copyright [yyyy] [name of copyright owner] | ||
* | ||
* CDDL HEADER END | ||
*/ | ||
|
||
#include <sys/dmu.h> | ||
#include <sys/dmu_impl.h> | ||
#include <sys/dmu_recv.h> | ||
#include <sys/dmu_tx.h> | ||
#include <sys/dbuf.h> | ||
#include <sys/dnode.h> | ||
#include <sys/zfs_context.h> | ||
#include <sys/dmu_objset.h> | ||
#include <sys/dmu_traverse.h> | ||
#include <sys/dsl_dataset.h> | ||
#include <sys/dsl_dir.h> | ||
#include <sys/dsl_pool.h> | ||
#include <sys/dsl_synctask.h> | ||
#include <sys/zfs_ioctl.h> | ||
#include <sys/zap.h> | ||
#include <sys/zio_checksum.h> | ||
#include <sys/zfs_znode.h> | ||
#include <sys/zfs_file.h> | ||
|
||
/* | ||
* zfs_file_open -> filp_open | ||
* zfs_file_close -> filp_close | ||
* zfs_file_seek -> vfs_llseek | ||
* zfs_file_sync -> spl_filp_fsync | ||
* zfs_file_pwrite -> spl_kernel_write | ||
* zfs_file_pread -> spl_kernel_read | ||
* zfs_file_stat -> vfs_getattr | ||
* zfs_file_unlink -> vfs_unlink | ||
* zfs_file_get -> fget | ||
* zfs_file_put -> fput | ||
*/ | ||
|
||
#ifdef _KERNEL | ||
#define FILE2FP(file) ((file)->f_file) | ||
#else | ||
#define FILE2FP(file) (file) | ||
#endif | ||
|
||
int | ||
zfs_file_write(file_t *file, const void *buf, size_t count, loff_t *offp, | ||
ssize_t *resid) | ||
{ | ||
ssize_t rc; | ||
struct file *fp; | ||
|
||
fp = FILE2FP(file); | ||
rc = spl_kernel_write(fp, buf, count, offp); | ||
if (rc < 0) | ||
return ((int)-rc); | ||
*resid = rc; | ||
return (0); | ||
} | ||
|
||
loff_t | ||
zfs_file_seek(file_t *file, loff_t off, int whence) | ||
{ | ||
struct file *fp; | ||
|
||
fp = FILE2FP(file); | ||
return (vfs_llseek(fp, off, whence)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.