1eda14cbcSMatt Macy /*
2eda14cbcSMatt Macy * CDDL HEADER START
3eda14cbcSMatt Macy *
4eda14cbcSMatt Macy * The contents of this file are subject to the terms of the
5eda14cbcSMatt Macy * Common Development and Distribution License (the "License").
6eda14cbcSMatt Macy * You may not use this file except in compliance with the License.
7eda14cbcSMatt Macy *
8eda14cbcSMatt Macy * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9271171e0SMartin Matuska * or https://opensource.org/licenses/CDDL-1.0.
10eda14cbcSMatt Macy * See the License for the specific language governing permissions
11eda14cbcSMatt Macy * and limitations under the License.
12eda14cbcSMatt Macy *
13eda14cbcSMatt Macy * When distributing Covered Code, include this CDDL HEADER in each
14eda14cbcSMatt Macy * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15eda14cbcSMatt Macy * If applicable, add the following below this CDDL HEADER, with the
16eda14cbcSMatt Macy * fields enclosed by brackets "[]" replaced with your own identifying
17eda14cbcSMatt Macy * information: Portions Copyright [yyyy] [name of copyright owner]
18eda14cbcSMatt Macy *
19eda14cbcSMatt Macy * CDDL HEADER END
20eda14cbcSMatt Macy */
21eda14cbcSMatt Macy
22eda14cbcSMatt Macy #include <sys/zfs_context.h>
23eda14cbcSMatt Macy #include <sys/zfs_file.h>
24eda14cbcSMatt Macy #include <sys/stat.h>
25eda14cbcSMatt Macy #include <sys/file.h>
26eda14cbcSMatt Macy #include <linux/falloc.h>
27eda14cbcSMatt Macy #include <linux/fs.h>
28eda14cbcSMatt Macy #include <linux/uaccess.h>
29eda14cbcSMatt Macy #ifdef HAVE_FDTABLE_HEADER
30eda14cbcSMatt Macy #include <linux/fdtable.h>
31eda14cbcSMatt Macy #endif
32eda14cbcSMatt Macy
33eda14cbcSMatt Macy /*
34eda14cbcSMatt Macy * Open file
35eda14cbcSMatt Macy *
36eda14cbcSMatt Macy * path - fully qualified path to file
37eda14cbcSMatt Macy * flags - file attributes O_READ / O_WRITE / O_EXCL
38eda14cbcSMatt Macy * fpp - pointer to return file pointer
39eda14cbcSMatt Macy *
40eda14cbcSMatt Macy * Returns 0 on success underlying error on failure.
41eda14cbcSMatt Macy */
42eda14cbcSMatt Macy int
zfs_file_open(const char * path,int flags,int mode,zfs_file_t ** fpp)43eda14cbcSMatt Macy zfs_file_open(const char *path, int flags, int mode, zfs_file_t **fpp)
44eda14cbcSMatt Macy {
45eda14cbcSMatt Macy struct file *filp;
46eda14cbcSMatt Macy int saved_umask;
47eda14cbcSMatt Macy
48eda14cbcSMatt Macy if (!(flags & O_CREAT) && (flags & O_WRONLY))
49eda14cbcSMatt Macy flags |= O_EXCL;
50eda14cbcSMatt Macy
51eda14cbcSMatt Macy if (flags & O_CREAT)
52eda14cbcSMatt Macy saved_umask = xchg(¤t->fs->umask, 0);
53eda14cbcSMatt Macy
54eda14cbcSMatt Macy filp = filp_open(path, flags, mode);
55eda14cbcSMatt Macy
56eda14cbcSMatt Macy if (flags & O_CREAT)
57eda14cbcSMatt Macy (void) xchg(¤t->fs->umask, saved_umask);
58eda14cbcSMatt Macy
59eda14cbcSMatt Macy if (IS_ERR(filp))
60eda14cbcSMatt Macy return (-PTR_ERR(filp));
61eda14cbcSMatt Macy
62eda14cbcSMatt Macy *fpp = filp;
63eda14cbcSMatt Macy return (0);
64eda14cbcSMatt Macy }
65eda14cbcSMatt Macy
66eda14cbcSMatt Macy void
zfs_file_close(zfs_file_t * fp)67eda14cbcSMatt Macy zfs_file_close(zfs_file_t *fp)
68eda14cbcSMatt Macy {
69eda14cbcSMatt Macy filp_close(fp, 0);
70eda14cbcSMatt Macy }
71eda14cbcSMatt Macy
72eda14cbcSMatt Macy static ssize_t
zfs_file_write_impl(zfs_file_t * fp,const void * buf,size_t count,loff_t * off)73eda14cbcSMatt Macy zfs_file_write_impl(zfs_file_t *fp, const void *buf, size_t count, loff_t *off)
74eda14cbcSMatt Macy {
75eda14cbcSMatt Macy #if defined(HAVE_KERNEL_WRITE_PPOS)
76eda14cbcSMatt Macy return (kernel_write(fp, buf, count, off));
77eda14cbcSMatt Macy #else
78eda14cbcSMatt Macy mm_segment_t saved_fs;
79eda14cbcSMatt Macy ssize_t rc;
80eda14cbcSMatt Macy
81eda14cbcSMatt Macy saved_fs = get_fs();
82eda14cbcSMatt Macy set_fs(KERNEL_DS);
83eda14cbcSMatt Macy
84eda14cbcSMatt Macy rc = vfs_write(fp, (__force const char __user __user *)buf, count, off);
85eda14cbcSMatt Macy
86eda14cbcSMatt Macy set_fs(saved_fs);
87eda14cbcSMatt Macy
88eda14cbcSMatt Macy return (rc);
89eda14cbcSMatt Macy #endif
90eda14cbcSMatt Macy }
91eda14cbcSMatt Macy
92eda14cbcSMatt Macy /*
93eda14cbcSMatt Macy * Stateful write - use os internal file pointer to determine where to
94eda14cbcSMatt Macy * write and update on successful completion.
95eda14cbcSMatt Macy *
96eda14cbcSMatt Macy * fp - pointer to file (pipe, socket, etc) to write to
97eda14cbcSMatt Macy * buf - buffer to write
98eda14cbcSMatt Macy * count - # of bytes to write
99eda14cbcSMatt Macy * resid - pointer to count of unwritten bytes (if short write)
100eda14cbcSMatt Macy *
101eda14cbcSMatt Macy * Returns 0 on success errno on failure.
102eda14cbcSMatt Macy */
103eda14cbcSMatt Macy int
zfs_file_write(zfs_file_t * fp,const void * buf,size_t count,ssize_t * resid)104eda14cbcSMatt Macy zfs_file_write(zfs_file_t *fp, const void *buf, size_t count, ssize_t *resid)
105eda14cbcSMatt Macy {
106eda14cbcSMatt Macy loff_t off = fp->f_pos;
107eda14cbcSMatt Macy ssize_t rc;
108eda14cbcSMatt Macy
109eda14cbcSMatt Macy rc = zfs_file_write_impl(fp, buf, count, &off);
110eda14cbcSMatt Macy if (rc < 0)
111eda14cbcSMatt Macy return (-rc);
112eda14cbcSMatt Macy
113eda14cbcSMatt Macy fp->f_pos = off;
114eda14cbcSMatt Macy
115eda14cbcSMatt Macy if (resid) {
116eda14cbcSMatt Macy *resid = count - rc;
117eda14cbcSMatt Macy } else if (rc != count) {
118eda14cbcSMatt Macy return (EIO);
119eda14cbcSMatt Macy }
120eda14cbcSMatt Macy
121eda14cbcSMatt Macy return (0);
122eda14cbcSMatt Macy }
123eda14cbcSMatt Macy
124eda14cbcSMatt Macy /*
125eda14cbcSMatt Macy * Stateless write - os internal file pointer is not updated.
126eda14cbcSMatt Macy *
127eda14cbcSMatt Macy * fp - pointer to file (pipe, socket, etc) to write to
128eda14cbcSMatt Macy * buf - buffer to write
129eda14cbcSMatt Macy * count - # of bytes to write
130eda14cbcSMatt Macy * off - file offset to write to (only valid for seekable types)
131eda14cbcSMatt Macy * resid - pointer to count of unwritten bytes
132eda14cbcSMatt Macy *
133eda14cbcSMatt Macy * Returns 0 on success errno on failure.
134eda14cbcSMatt Macy */
135eda14cbcSMatt Macy int
zfs_file_pwrite(zfs_file_t * fp,const void * buf,size_t count,loff_t off,ssize_t * resid)136eda14cbcSMatt Macy zfs_file_pwrite(zfs_file_t *fp, const void *buf, size_t count, loff_t off,
137eda14cbcSMatt Macy ssize_t *resid)
138eda14cbcSMatt Macy {
139eda14cbcSMatt Macy ssize_t rc;
140eda14cbcSMatt Macy
141eda14cbcSMatt Macy rc = zfs_file_write_impl(fp, buf, count, &off);
142eda14cbcSMatt Macy if (rc < 0)
143eda14cbcSMatt Macy return (-rc);
144eda14cbcSMatt Macy
145eda14cbcSMatt Macy if (resid) {
146eda14cbcSMatt Macy *resid = count - rc;
147eda14cbcSMatt Macy } else if (rc != count) {
148eda14cbcSMatt Macy return (EIO);
149eda14cbcSMatt Macy }
150eda14cbcSMatt Macy
151eda14cbcSMatt Macy return (0);
152eda14cbcSMatt Macy }
153eda14cbcSMatt Macy
154eda14cbcSMatt Macy static ssize_t
zfs_file_read_impl(zfs_file_t * fp,void * buf,size_t count,loff_t * off)155eda14cbcSMatt Macy zfs_file_read_impl(zfs_file_t *fp, void *buf, size_t count, loff_t *off)
156eda14cbcSMatt Macy {
157eda14cbcSMatt Macy #if defined(HAVE_KERNEL_READ_PPOS)
158eda14cbcSMatt Macy return (kernel_read(fp, buf, count, off));
159eda14cbcSMatt Macy #else
160eda14cbcSMatt Macy mm_segment_t saved_fs;
161eda14cbcSMatt Macy ssize_t rc;
162eda14cbcSMatt Macy
163eda14cbcSMatt Macy saved_fs = get_fs();
164eda14cbcSMatt Macy set_fs(KERNEL_DS);
165eda14cbcSMatt Macy
166eda14cbcSMatt Macy rc = vfs_read(fp, (void __user *)buf, count, off);
167eda14cbcSMatt Macy set_fs(saved_fs);
168eda14cbcSMatt Macy
169eda14cbcSMatt Macy return (rc);
170eda14cbcSMatt Macy #endif
171eda14cbcSMatt Macy }
172eda14cbcSMatt Macy
173eda14cbcSMatt Macy /*
174eda14cbcSMatt Macy * Stateful read - use os internal file pointer to determine where to
175eda14cbcSMatt Macy * read and update on successful completion.
176eda14cbcSMatt Macy *
177eda14cbcSMatt Macy * fp - pointer to file (pipe, socket, etc) to read from
178eda14cbcSMatt Macy * buf - buffer to write
179eda14cbcSMatt Macy * count - # of bytes to read
180eda14cbcSMatt Macy * resid - pointer to count of unread bytes (if short read)
181eda14cbcSMatt Macy *
182eda14cbcSMatt Macy * Returns 0 on success errno on failure.
183eda14cbcSMatt Macy */
184eda14cbcSMatt Macy int
zfs_file_read(zfs_file_t * fp,void * buf,size_t count,ssize_t * resid)185eda14cbcSMatt Macy zfs_file_read(zfs_file_t *fp, void *buf, size_t count, ssize_t *resid)
186eda14cbcSMatt Macy {
187eda14cbcSMatt Macy loff_t off = fp->f_pos;
188eda14cbcSMatt Macy ssize_t rc;
189eda14cbcSMatt Macy
190eda14cbcSMatt Macy rc = zfs_file_read_impl(fp, buf, count, &off);
191eda14cbcSMatt Macy if (rc < 0)
192eda14cbcSMatt Macy return (-rc);
193eda14cbcSMatt Macy
194eda14cbcSMatt Macy fp->f_pos = off;
195eda14cbcSMatt Macy
196eda14cbcSMatt Macy if (resid) {
197eda14cbcSMatt Macy *resid = count - rc;
198eda14cbcSMatt Macy } else if (rc != count) {
199eda14cbcSMatt Macy return (EIO);
200eda14cbcSMatt Macy }
201eda14cbcSMatt Macy
202eda14cbcSMatt Macy return (0);
203eda14cbcSMatt Macy }
204eda14cbcSMatt Macy
205eda14cbcSMatt Macy /*
206eda14cbcSMatt Macy * Stateless read - os internal file pointer is not updated.
207eda14cbcSMatt Macy *
208eda14cbcSMatt Macy * fp - pointer to file (pipe, socket, etc) to read from
209eda14cbcSMatt Macy * buf - buffer to write
210eda14cbcSMatt Macy * count - # of bytes to write
211eda14cbcSMatt Macy * off - file offset to read from (only valid for seekable types)
212eda14cbcSMatt Macy * resid - pointer to count of unwritten bytes (if short write)
213eda14cbcSMatt Macy *
214eda14cbcSMatt Macy * Returns 0 on success errno on failure.
215eda14cbcSMatt Macy */
216eda14cbcSMatt Macy int
zfs_file_pread(zfs_file_t * fp,void * buf,size_t count,loff_t off,ssize_t * resid)217eda14cbcSMatt Macy zfs_file_pread(zfs_file_t *fp, void *buf, size_t count, loff_t off,
218eda14cbcSMatt Macy ssize_t *resid)
219eda14cbcSMatt Macy {
220eda14cbcSMatt Macy ssize_t rc;
221eda14cbcSMatt Macy
222eda14cbcSMatt Macy rc = zfs_file_read_impl(fp, buf, count, &off);
223eda14cbcSMatt Macy if (rc < 0)
224eda14cbcSMatt Macy return (-rc);
225eda14cbcSMatt Macy
226eda14cbcSMatt Macy if (resid) {
227eda14cbcSMatt Macy *resid = count - rc;
228eda14cbcSMatt Macy } else if (rc != count) {
229eda14cbcSMatt Macy return (EIO);
230eda14cbcSMatt Macy }
231eda14cbcSMatt Macy
232eda14cbcSMatt Macy return (0);
233eda14cbcSMatt Macy }
234eda14cbcSMatt Macy
235eda14cbcSMatt Macy /*
236eda14cbcSMatt Macy * lseek - set / get file pointer
237eda14cbcSMatt Macy *
238eda14cbcSMatt Macy * fp - pointer to file (pipe, socket, etc) to read from
239eda14cbcSMatt Macy * offp - value to seek to, returns current value plus passed offset
240eda14cbcSMatt Macy * whence - see man pages for standard lseek whence values
241eda14cbcSMatt Macy *
242eda14cbcSMatt Macy * Returns 0 on success errno on failure (ESPIPE for non seekable types)
243eda14cbcSMatt Macy */
244eda14cbcSMatt Macy int
zfs_file_seek(zfs_file_t * fp,loff_t * offp,int whence)245eda14cbcSMatt Macy zfs_file_seek(zfs_file_t *fp, loff_t *offp, int whence)
246eda14cbcSMatt Macy {
247eda14cbcSMatt Macy loff_t rc;
248eda14cbcSMatt Macy
249*dbd5678dSMartin Matuska if (*offp < 0)
250eda14cbcSMatt Macy return (EINVAL);
251eda14cbcSMatt Macy
252eda14cbcSMatt Macy rc = vfs_llseek(fp, *offp, whence);
253eda14cbcSMatt Macy if (rc < 0)
254eda14cbcSMatt Macy return (-rc);
255eda14cbcSMatt Macy
256eda14cbcSMatt Macy *offp = rc;
257eda14cbcSMatt Macy
258eda14cbcSMatt Macy return (0);
259eda14cbcSMatt Macy }
260eda14cbcSMatt Macy
261eda14cbcSMatt Macy /*
262eda14cbcSMatt Macy * Get file attributes
263eda14cbcSMatt Macy *
264eda14cbcSMatt Macy * filp - file pointer
265eda14cbcSMatt Macy * zfattr - pointer to file attr structure
266eda14cbcSMatt Macy *
267eda14cbcSMatt Macy * Currently only used for fetching size and file mode.
268eda14cbcSMatt Macy *
269eda14cbcSMatt Macy * Returns 0 on success or error code of underlying getattr call on failure.
270eda14cbcSMatt Macy */
271eda14cbcSMatt Macy int
zfs_file_getattr(zfs_file_t * filp,zfs_file_attr_t * zfattr)272eda14cbcSMatt Macy zfs_file_getattr(zfs_file_t *filp, zfs_file_attr_t *zfattr)
273eda14cbcSMatt Macy {
274eda14cbcSMatt Macy struct kstat stat;
275eda14cbcSMatt Macy int rc;
276eda14cbcSMatt Macy
277eda14cbcSMatt Macy #if defined(HAVE_4ARGS_VFS_GETATTR)
278eda14cbcSMatt Macy rc = vfs_getattr(&filp->f_path, &stat, STATX_BASIC_STATS,
279eda14cbcSMatt Macy AT_STATX_SYNC_AS_STAT);
280eda14cbcSMatt Macy #elif defined(HAVE_2ARGS_VFS_GETATTR)
281eda14cbcSMatt Macy rc = vfs_getattr(&filp->f_path, &stat);
28216038816SMartin Matuska #elif defined(HAVE_3ARGS_VFS_GETATTR)
283eda14cbcSMatt Macy rc = vfs_getattr(filp->f_path.mnt, filp->f_dentry, &stat);
28416038816SMartin Matuska #else
28516038816SMartin Matuska #error "No available vfs_getattr()"
286eda14cbcSMatt Macy #endif
287eda14cbcSMatt Macy if (rc)
288eda14cbcSMatt Macy return (-rc);
289eda14cbcSMatt Macy
290eda14cbcSMatt Macy zfattr->zfa_size = stat.size;
291eda14cbcSMatt Macy zfattr->zfa_mode = stat.mode;
292eda14cbcSMatt Macy
293eda14cbcSMatt Macy return (0);
294eda14cbcSMatt Macy }
295eda14cbcSMatt Macy
296eda14cbcSMatt Macy /*
297eda14cbcSMatt Macy * Sync file to disk
298eda14cbcSMatt Macy *
299eda14cbcSMatt Macy * filp - file pointer
300eda14cbcSMatt Macy * flags - O_SYNC and or O_DSYNC
301eda14cbcSMatt Macy *
302eda14cbcSMatt Macy * Returns 0 on success or error code of underlying sync call on failure.
303eda14cbcSMatt Macy */
304eda14cbcSMatt Macy int
zfs_file_fsync(zfs_file_t * filp,int flags)305eda14cbcSMatt Macy zfs_file_fsync(zfs_file_t *filp, int flags)
306eda14cbcSMatt Macy {
307eda14cbcSMatt Macy int datasync = 0;
308eda14cbcSMatt Macy int error;
309eda14cbcSMatt Macy int fstrans;
310eda14cbcSMatt Macy
311eda14cbcSMatt Macy if (flags & O_DSYNC)
312eda14cbcSMatt Macy datasync = 1;
313eda14cbcSMatt Macy
314eda14cbcSMatt Macy /*
315eda14cbcSMatt Macy * May enter XFS which generates a warning when PF_FSTRANS is set.
316eda14cbcSMatt Macy * To avoid this the flag is cleared over vfs_sync() and then reset.
317eda14cbcSMatt Macy */
318eda14cbcSMatt Macy fstrans = __spl_pf_fstrans_check();
319eda14cbcSMatt Macy if (fstrans)
320eda14cbcSMatt Macy current->flags &= ~(__SPL_PF_FSTRANS);
321eda14cbcSMatt Macy
322eda14cbcSMatt Macy error = -vfs_fsync(filp, datasync);
323eda14cbcSMatt Macy
324eda14cbcSMatt Macy if (fstrans)
325eda14cbcSMatt Macy current->flags |= __SPL_PF_FSTRANS;
326eda14cbcSMatt Macy
327eda14cbcSMatt Macy return (error);
328eda14cbcSMatt Macy }
329eda14cbcSMatt Macy
330eda14cbcSMatt Macy /*
331eda14cbcSMatt Macy * fallocate - allocate or free space on disk
332eda14cbcSMatt Macy *
333eda14cbcSMatt Macy * fp - file pointer
334eda14cbcSMatt Macy * mode (non-standard options for hole punching etc)
335eda14cbcSMatt Macy * offset - offset to start allocating or freeing from
336eda14cbcSMatt Macy * len - length to free / allocate
337eda14cbcSMatt Macy *
338eda14cbcSMatt Macy * OPTIONAL
339eda14cbcSMatt Macy */
340eda14cbcSMatt Macy int
zfs_file_fallocate(zfs_file_t * fp,int mode,loff_t offset,loff_t len)341eda14cbcSMatt Macy zfs_file_fallocate(zfs_file_t *fp, int mode, loff_t offset, loff_t len)
342eda14cbcSMatt Macy {
343eda14cbcSMatt Macy /*
344eda14cbcSMatt Macy * May enter XFS which generates a warning when PF_FSTRANS is set.
345eda14cbcSMatt Macy * To avoid this the flag is cleared over vfs_sync() and then reset.
346eda14cbcSMatt Macy */
347eda14cbcSMatt Macy int fstrans = __spl_pf_fstrans_check();
348eda14cbcSMatt Macy if (fstrans)
349eda14cbcSMatt Macy current->flags &= ~(__SPL_PF_FSTRANS);
350eda14cbcSMatt Macy
351eda14cbcSMatt Macy /*
352eda14cbcSMatt Macy * When supported by the underlying file system preferentially
353eda14cbcSMatt Macy * use the fallocate() callback to preallocate the space.
354eda14cbcSMatt Macy */
355eda14cbcSMatt Macy int error = EOPNOTSUPP;
356eda14cbcSMatt Macy if (fp->f_op->fallocate)
357eda14cbcSMatt Macy error = fp->f_op->fallocate(fp, mode, offset, len);
358eda14cbcSMatt Macy
359eda14cbcSMatt Macy if (fstrans)
360eda14cbcSMatt Macy current->flags |= __SPL_PF_FSTRANS;
361eda14cbcSMatt Macy
362eda14cbcSMatt Macy return (error);
363eda14cbcSMatt Macy }
364eda14cbcSMatt Macy
365eda14cbcSMatt Macy /*
366eda14cbcSMatt Macy * Request current file pointer offset
367eda14cbcSMatt Macy *
368eda14cbcSMatt Macy * fp - pointer to file
369eda14cbcSMatt Macy *
370eda14cbcSMatt Macy * Returns current file offset.
371eda14cbcSMatt Macy */
372eda14cbcSMatt Macy loff_t
zfs_file_off(zfs_file_t * fp)373eda14cbcSMatt Macy zfs_file_off(zfs_file_t *fp)
374eda14cbcSMatt Macy {
375eda14cbcSMatt Macy return (fp->f_pos);
376eda14cbcSMatt Macy }
377eda14cbcSMatt Macy
378eda14cbcSMatt Macy /*
379eda14cbcSMatt Macy * Request file pointer private data
380eda14cbcSMatt Macy *
381eda14cbcSMatt Macy * fp - pointer to file
382eda14cbcSMatt Macy *
383eda14cbcSMatt Macy * Returns pointer to file private data.
384eda14cbcSMatt Macy */
385eda14cbcSMatt Macy void *
zfs_file_private(zfs_file_t * fp)386eda14cbcSMatt Macy zfs_file_private(zfs_file_t *fp)
387eda14cbcSMatt Macy {
388eda14cbcSMatt Macy return (fp->private_data);
389eda14cbcSMatt Macy }
390eda14cbcSMatt Macy
391eda14cbcSMatt Macy /*
392eda14cbcSMatt Macy * unlink file
393eda14cbcSMatt Macy *
394eda14cbcSMatt Macy * path - fully qualified file path
395eda14cbcSMatt Macy *
396eda14cbcSMatt Macy * Returns 0 on success.
397eda14cbcSMatt Macy *
398eda14cbcSMatt Macy * OPTIONAL
399eda14cbcSMatt Macy */
400eda14cbcSMatt Macy int
zfs_file_unlink(const char * path)401eda14cbcSMatt Macy zfs_file_unlink(const char *path)
402eda14cbcSMatt Macy {
403eda14cbcSMatt Macy return (EOPNOTSUPP);
404eda14cbcSMatt Macy }
405eda14cbcSMatt Macy
406eda14cbcSMatt Macy /*
407eda14cbcSMatt Macy * Get reference to file pointer
408eda14cbcSMatt Macy *
409eda14cbcSMatt Macy * fd - input file descriptor
410eda14cbcSMatt Macy *
4115eb61f6cSMartin Matuska * Returns pointer to file struct or NULL
412eda14cbcSMatt Macy */
4135eb61f6cSMartin Matuska zfs_file_t *
zfs_file_get(int fd)4145eb61f6cSMartin Matuska zfs_file_get(int fd)
415eda14cbcSMatt Macy {
4165eb61f6cSMartin Matuska return (fget(fd));
417eda14cbcSMatt Macy }
418eda14cbcSMatt Macy
419eda14cbcSMatt Macy /*
420eda14cbcSMatt Macy * Drop reference to file pointer
421eda14cbcSMatt Macy *
4225eb61f6cSMartin Matuska * fp - input file struct pointer
423eda14cbcSMatt Macy */
424eda14cbcSMatt Macy void
zfs_file_put(zfs_file_t * fp)4255eb61f6cSMartin Matuska zfs_file_put(zfs_file_t *fp)
426eda14cbcSMatt Macy {
427eda14cbcSMatt Macy fput(fp);
428eda14cbcSMatt Macy }
429