]>
git.proxmox.com Git - mirror_zfs.git/blob - module/spl/spl-kobj.c
2 * This file is part of the SPL: Solaris Porting Layer.
4 * Copyright (c) 2008 Lawrence Livermore National Security, LLC.
5 * Produced at Lawrence Livermore National Laboratory
7 * Brian Behlendorf <behlendorf1@llnl.gov>,
8 * Herb Wartens <wartens2@llnl.gov>,
9 * Jim Garlick <garlick@llnl.gov>
12 * This is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This is distributed in the hope that it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 #ifdef DEBUG_SUBSYSTEM
30 #undef DEBUG_SUBSYSTEM
33 #define DEBUG_SUBSYSTEM S_KOBJ
36 kobj_open_file(const char *name
)
43 file
= kmalloc(sizeof(_buf_t
), GFP_KERNEL
);
45 RETURN((_buf_t
*)-1UL);
47 if ((rc
= vn_open(name
, UIO_SYSSPACE
, FREAD
, 0644, &vp
, 0, 0))) {
49 RETURN((_buf_t
*)-1UL);
55 } /* kobj_open_file() */
56 EXPORT_SYMBOL(kobj_open_file
);
59 kobj_close_file(struct _buf
*file
)
62 VOP_CLOSE(file
->vp
, 0, 0, 0, 0, 0);
66 } /* kobj_close_file() */
67 EXPORT_SYMBOL(kobj_close_file
);
70 kobj_read_file(struct _buf
*file
, char *buf
, ssize_t size
, offset_t off
)
73 RETURN(vn_rdwr(UIO_READ
, file
->vp
, buf
, size
, off
,
74 UIO_SYSSPACE
, 0, RLIM64_INFINITY
, 0, NULL
));
75 } /* kobj_read_file() */
76 EXPORT_SYMBOL(kobj_read_file
);
79 kobj_get_filesize(struct _buf
*file
, uint64_t *size
)
85 rc
= VOP_GETATTR(file
->vp
, &vap
, 0, 0, NULL
);
92 } /* kobj_get_filesize() */
93 EXPORT_SYMBOL(kobj_get_filesize
);