1
Notes for porting Hgfs from Solaris 9 to 10
2
===========================================
4
Note that Solaris 10 is a beta and still in development, so these notes may
5
become outdated. They are based on the headers in build 52.
9
o Now use vn_make_ops() to create vnodeops
10
int vn_make_ops(const char *, const fs_operation_def_t *, vnodeops_t **);
11
void vn_freevnodeops(vnodeops_t *);
13
o Now use vfs_makefsops()/vfs_setfsops() to create vfsops
16
o There is a new structure struct fs_operation_def_t:
18
typedef int (*fs_generic_func_p) ();
20
typedef struct fs_operation_def {
21
char *name; /* name of operation (NUL terminated) */
22
fs_generic_func_p func; /* function implementing operation */
25
The name is likely one of the VOPNAME_* macros.
27
o vnodes should only be created by calls to vn_alloc(); they may not be embedded
28
in fs-specific structures; vnodes may change size. Definitions for related
29
vnode allocation/freeing functions are:
30
vnode_t *vn_alloc(int);
31
void vn_reinit(vnode_t *);
32
void vn_free(vnode_t *);
34
Note that the vn_free() function destroys the vnode's mutex so doing so
35
yourself will crash the system.
37
o There are a quite a few new vnode manipulation functions; see vnode.h.
39
o v_vfsmountedhere member of struct vnode is private, perhaps we shouldn't touch
40
it; it is also protected by vn_vfswlock in vnode.c
42
o A number of private members were added to struct vnode -- shouldn't affect us
44
o New structure struct caller_context contains PID of caller, system ID, and
45
a caller identifier. This structure is now passed in as the last argument to:
53
o vop_shrlock now takes an additional cred_t * argument as its last argument
55
o A new vnodeop was added:
56
int (*vop_vnevent)(vnode_t *, vnevent_t);
58
This likely has to do "something" to the vnode depending on the value of
59
vnevent_t. It is likely that this is required since the vnode now stores the
60
cached path of the file in its private char *v_path member. Can we use
61
vnevent_*() for help, or do these call us? How about the new vn_setpath*(),
62
vn_path(), and vn_copypath() functions? (We should use the VN_SETPATH() macro
63
instead of calling vn_setpath() directly.)
65
o vnevent_t is a new enum with the following definition:
66
typedef enum vnevent {
67
VE_SUPPORT = 0, /* Query */
68
VE_RENAME_SRC = 1, /* Rename, with vnode as source */
69
VE_RENAME_DEST = 2, /* Rename, with vnode as target/dest */
70
VE_REMOVE = 3, /* Remove of vnode's name */
71
VE_RMDIR = 4 /* Remove of directory vnode's name */
74
o A new macro VN_SET_VFS_TYPE_DEV(vp, vfsp, type, dev) was created, but it is
77
o VN_CMP() now calls vn_getops() rather than dereferencing the vnode's vn_ops
78
member. (We should use this to access that variable too, it seems.)
80
o There is no more VN_INIT() macro, but it was trivial anyhow.
85
o Filesystems now must supply their list of vfs operations using:
86
int vfs_setfsops(int, const fs_operation_def_t *, vfsops_t **);
88
o There are also functions for filesystems to make, free, etc vfs operation
90
int vfs_makefsops(const fs_operation_def_t *, vfsops_t **);
91
void vfs_freevfsops(vfsops_t *);
92
int vfs_freevfsops_by_type(int);
93
void vfs_setops(vfs_t *, vfsops_t *);
94
vfsops_t *vfs_getops(vfs_t *vfsp);
95
<there are some more: see vfs.h>
97
The names placed in fs_operation_def_t->name are likely one of the VFSNAME_*
100
o This isn't relevant to our layer, but the vfs now keeps filesystems in
101
a double linked circular list rather than a singly linked list. There are
102
also issues with zones: each zone has a list of its own mounts.
104
o The vfs_op member of struct vfs should never be directly accessed; use the
105
accessor functions described above.
107
o There is a new function in struct vfsops:
108
int (*vfs_vnstate)(vfs_t *, vnode_t *, vntrans_t);
110
o vntrans_t is a new enum that is either VNTRANS_EXISTS, VNTRANS_IDLED,
111
VNTRANS_RECLAIMED, or VNTRANS_DESTROYED.
113
o The function pointer vsw_init member of struct vfssw now has the definition:
114
int (*vsw_init)(int, char *)
116
Also, the vsw_optproto and vsw_vfsops members are no longer pointers.
118
Since we will not be directly including this structure in our modlfs anymore
119
(see modctl.h notes), these differences probably don't matter.
121
o There is a new structure (that will be used in our modlfs now instead of
124
typedef struct vfsdef_v2 {
125
int def_version; /* structure version, must be first */
126
char *name; /* filesystem type name */
127
int (*init) (int, char *); /* init routine */
128
int flags; /* fs flags */
129
mntopts_t *optproto; /* mount options table prototype */
132
Note that build 58 contains the same structure but it is called vfsdef_v3.
134
o There are a few other additional macros and functions that likely won't matter
139
o struct modlfs now has a struct vfsdef_v3 instead of a struct vfssw
140
o other changes don't seem relevant
144
o There are no changes to struct cb_ops, struct dev_ops, or any of the command
145
enums taken by these functions.