1 | /* $Id: vboxfs_vnode.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox File System for Solaris Guests, VNode header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-2024 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * The contents of this file may alternatively be used under the terms
|
---|
26 | * of the Common Development and Distribution License Version 1.0
|
---|
27 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
28 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
29 | * CDDL are applicable instead of those of the GPL.
|
---|
30 | *
|
---|
31 | * You may elect to license modified versions of this file under the
|
---|
32 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
33 | *
|
---|
34 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
35 | */
|
---|
36 |
|
---|
37 | #ifndef GA_INCLUDED_SRC_solaris_SharedFolders_vboxfs_vnode_h
|
---|
38 | #define GA_INCLUDED_SRC_solaris_SharedFolders_vboxfs_vnode_h
|
---|
39 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
40 | # pragma once
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | #include <sys/t_lock.h>
|
---|
44 | #include <sys/avl.h>
|
---|
45 | #include <vm/seg.h>
|
---|
46 | #include <vm/seg_vn.h>
|
---|
47 |
|
---|
48 | #ifdef __cplusplus
|
---|
49 | extern "C" {
|
---|
50 | #endif
|
---|
51 |
|
---|
52 | /*
|
---|
53 | * sfnode is the file system dependent vnode data for vboxsf.
|
---|
54 | * sfnode's also track all files ever accessed, both open and closed.
|
---|
55 | * It duplicates some of the information in vnode, since it holds
|
---|
56 | * information for files that may have been completely closed.
|
---|
57 | *
|
---|
58 | * The sfnode_t's are stored in an AVL tree sorted by:
|
---|
59 | * sf_sffs, sf_path
|
---|
60 | */
|
---|
61 | typedef struct sfnode {
|
---|
62 | avl_node_t sf_linkage; /* AVL tree linkage */
|
---|
63 | struct sffs_data *sf_sffs; /* containing mounted file system */
|
---|
64 | char *sf_path; /* full pathname to file or dir */
|
---|
65 | uint64_t sf_ino; /* assigned unique ID number */
|
---|
66 | vnode_t *sf_vnode; /* vnode if active */
|
---|
67 | sfp_file_t *sf_file; /* non NULL if open */
|
---|
68 | int sf_flag; /* last opened file-mode. */
|
---|
69 | struct sfnode *sf_parent; /* parent sfnode of this one */
|
---|
70 | uint16_t sf_children; /* number of children sfnodes */
|
---|
71 | uint8_t sf_type; /* VDIR or VREG */
|
---|
72 | uint8_t sf_is_stale; /* this is stale and should be purged */
|
---|
73 | sffs_stat_t sf_stat; /* cached file attrs for this node */
|
---|
74 | uint64_t sf_stat_time; /* last-modified time of sf_stat */
|
---|
75 | sffs_dirents_t *sf_dir_list; /* list of entries for this directory */
|
---|
76 | } sfnode_t;
|
---|
77 |
|
---|
78 | #define VN2SFN(vp) ((sfnode_t *)(vp)->v_data)
|
---|
79 |
|
---|
80 | #ifdef _KERNEL
|
---|
81 | extern int sffs_vnode_init(void);
|
---|
82 | extern void sffs_vnode_fini(void);
|
---|
83 | extern sfnode_t *sfnode_make(struct sffs_data *, char *, vtype_t, sfp_file_t *,
|
---|
84 | sfnode_t *parent, sffs_stat_t *, uint64_t stat_time);
|
---|
85 | extern vnode_t *sfnode_get_vnode(sfnode_t *);
|
---|
86 |
|
---|
87 | /*
|
---|
88 | * Purge all cached information about a shared file system at unmount
|
---|
89 | */
|
---|
90 | extern int sffs_purge(struct sffs_data *);
|
---|
91 |
|
---|
92 | extern kmutex_t sffs_lock;
|
---|
93 | #endif /* _KERNEL */
|
---|
94 |
|
---|
95 | #ifdef __cplusplus
|
---|
96 | }
|
---|
97 | #endif
|
---|
98 |
|
---|
99 | #endif /* !GA_INCLUDED_SRC_solaris_SharedFolders_vboxfs_vnode_h */
|
---|