5205 */
5206 static int zfs_inval();
5207 static int zfs_isdir();
5208
5209 static int
5210 zfs_inval()
5211 {
5212 return (SET_ERROR(EINVAL));
5213 }
5214
5215 static int
5216 zfs_isdir()
5217 {
5218 return (SET_ERROR(EISDIR));
5219 }
5220 /*
5221 * Directory vnode operations template
5222 */
5223 vnodeops_t *zfs_dvnodeops;
5224 const fs_operation_def_t zfs_dvnodeops_template[] = {
5225 VOPNAME_OPEN, { .vop_open = zfs_open },
5226 VOPNAME_CLOSE, { .vop_close = zfs_close },
5227 VOPNAME_READ, { .error = zfs_isdir },
5228 VOPNAME_WRITE, { .error = zfs_isdir },
5229 VOPNAME_IOCTL, { .vop_ioctl = zfs_ioctl },
5230 VOPNAME_GETATTR, { .vop_getattr = zfs_getattr },
5231 VOPNAME_SETATTR, { .vop_setattr = zfs_setattr },
5232 VOPNAME_ACCESS, { .vop_access = zfs_access },
5233 VOPNAME_LOOKUP, { .vop_lookup = zfs_lookup },
5234 VOPNAME_CREATE, { .vop_create = zfs_create },
5235 VOPNAME_REMOVE, { .vop_remove = zfs_remove },
5236 VOPNAME_LINK, { .vop_link = zfs_link },
5237 VOPNAME_RENAME, { .vop_rename = zfs_rename },
5238 VOPNAME_MKDIR, { .vop_mkdir = zfs_mkdir },
5239 VOPNAME_RMDIR, { .vop_rmdir = zfs_rmdir },
5240 VOPNAME_READDIR, { .vop_readdir = zfs_readdir },
5241 VOPNAME_SYMLINK, { .vop_symlink = zfs_symlink },
5242 VOPNAME_FSYNC, { .vop_fsync = zfs_fsync },
5243 VOPNAME_INACTIVE, { .vop_inactive = zfs_inactive },
5244 VOPNAME_FID, { .vop_fid = zfs_fid },
5245 VOPNAME_SEEK, { .vop_seek = zfs_seek },
5246 VOPNAME_PATHCONF, { .vop_pathconf = zfs_pathconf },
5247 VOPNAME_GETSECATTR, { .vop_getsecattr = zfs_getsecattr },
5248 VOPNAME_SETSECATTR, { .vop_setsecattr = zfs_setsecattr },
5249 VOPNAME_VNEVENT, { .vop_vnevent = fs_vnevent_support },
5250 NULL, NULL
5251 };
5252
5253 /*
5254 * Regular file vnode operations template
5255 */
5256 vnodeops_t *zfs_fvnodeops;
5257 const fs_operation_def_t zfs_fvnodeops_template[] = {
5258 VOPNAME_OPEN, { .vop_open = zfs_open },
5259 VOPNAME_CLOSE, { .vop_close = zfs_close },
5260 VOPNAME_READ, { .vop_read = zfs_read },
5261 VOPNAME_WRITE, { .vop_write = zfs_write },
5262 VOPNAME_IOCTL, { .vop_ioctl = zfs_ioctl },
5263 VOPNAME_GETATTR, { .vop_getattr = zfs_getattr },
5264 VOPNAME_SETATTR, { .vop_setattr = zfs_setattr },
5265 VOPNAME_ACCESS, { .vop_access = zfs_access },
5266 VOPNAME_LOOKUP, { .vop_lookup = zfs_lookup },
5267 VOPNAME_RENAME, { .vop_rename = zfs_rename },
5268 VOPNAME_FSYNC, { .vop_fsync = zfs_fsync },
5269 VOPNAME_INACTIVE, { .vop_inactive = zfs_inactive },
5270 VOPNAME_FID, { .vop_fid = zfs_fid },
5271 VOPNAME_SEEK, { .vop_seek = zfs_seek },
5272 VOPNAME_FRLOCK, { .vop_frlock = zfs_frlock },
5273 VOPNAME_SPACE, { .vop_space = zfs_space },
5274 VOPNAME_GETPAGE, { .vop_getpage = zfs_getpage },
5275 VOPNAME_PUTPAGE, { .vop_putpage = zfs_putpage },
5276 VOPNAME_MAP, { .vop_map = zfs_map },
5277 VOPNAME_ADDMAP, { .vop_addmap = zfs_addmap },
5278 VOPNAME_DELMAP, { .vop_delmap = zfs_delmap },
5279 VOPNAME_PATHCONF, { .vop_pathconf = zfs_pathconf },
5280 VOPNAME_GETSECATTR, { .vop_getsecattr = zfs_getsecattr },
5281 VOPNAME_SETSECATTR, { .vop_setsecattr = zfs_setsecattr },
5282 VOPNAME_VNEVENT, { .vop_vnevent = fs_vnevent_support },
5283 VOPNAME_REQZCBUF, { .vop_reqzcbuf = zfs_reqzcbuf },
5284 VOPNAME_RETZCBUF, { .vop_retzcbuf = zfs_retzcbuf },
5285 NULL, NULL
5286 };
5287
5288 /*
5289 * Symbolic link vnode operations template
5290 */
5291 vnodeops_t *zfs_symvnodeops;
5292 const fs_operation_def_t zfs_symvnodeops_template[] = {
5293 VOPNAME_GETATTR, { .vop_getattr = zfs_getattr },
5294 VOPNAME_SETATTR, { .vop_setattr = zfs_setattr },
5295 VOPNAME_ACCESS, { .vop_access = zfs_access },
5296 VOPNAME_RENAME, { .vop_rename = zfs_rename },
5297 VOPNAME_READLINK, { .vop_readlink = zfs_readlink },
5298 VOPNAME_INACTIVE, { .vop_inactive = zfs_inactive },
5299 VOPNAME_FID, { .vop_fid = zfs_fid },
5300 VOPNAME_PATHCONF, { .vop_pathconf = zfs_pathconf },
5301 VOPNAME_VNEVENT, { .vop_vnevent = fs_vnevent_support },
5302 NULL, NULL
5303 };
5304
5305 /*
5306 * special share hidden files vnode operations template
5307 */
5308 vnodeops_t *zfs_sharevnodeops;
5309 const fs_operation_def_t zfs_sharevnodeops_template[] = {
5310 VOPNAME_GETATTR, { .vop_getattr = zfs_getattr },
5311 VOPNAME_ACCESS, { .vop_access = zfs_access },
5312 VOPNAME_INACTIVE, { .vop_inactive = zfs_inactive },
5313 VOPNAME_FID, { .vop_fid = zfs_fid },
5314 VOPNAME_PATHCONF, { .vop_pathconf = zfs_pathconf },
5315 VOPNAME_GETSECATTR, { .vop_getsecattr = zfs_getsecattr },
5316 VOPNAME_SETSECATTR, { .vop_setsecattr = zfs_setsecattr },
5317 VOPNAME_VNEVENT, { .vop_vnevent = fs_vnevent_support },
5318 NULL, NULL
5319 };
5320
5321 /*
5322 * Extended attribute directory vnode operations template
5323 *
5324 * This template is identical to the directory vnodes
5325 * operation template except for restricted operations:
5326 * VOP_MKDIR()
5327 * VOP_SYMLINK()
5328 *
5329 * Note that there are other restrictions embedded in:
5330 * zfs_create() - restrict type to VREG
5331 * zfs_link() - no links into/out of attribute space
5332 * zfs_rename() - no moves into/out of attribute space
5333 */
5334 vnodeops_t *zfs_xdvnodeops;
5335 const fs_operation_def_t zfs_xdvnodeops_template[] = {
5336 VOPNAME_OPEN, { .vop_open = zfs_open },
5337 VOPNAME_CLOSE, { .vop_close = zfs_close },
5338 VOPNAME_IOCTL, { .vop_ioctl = zfs_ioctl },
5339 VOPNAME_GETATTR, { .vop_getattr = zfs_getattr },
5340 VOPNAME_SETATTR, { .vop_setattr = zfs_setattr },
5341 VOPNAME_ACCESS, { .vop_access = zfs_access },
5342 VOPNAME_LOOKUP, { .vop_lookup = zfs_lookup },
5343 VOPNAME_CREATE, { .vop_create = zfs_create },
5344 VOPNAME_REMOVE, { .vop_remove = zfs_remove },
5345 VOPNAME_LINK, { .vop_link = zfs_link },
5346 VOPNAME_RENAME, { .vop_rename = zfs_rename },
5347 VOPNAME_MKDIR, { .error = zfs_inval },
5348 VOPNAME_RMDIR, { .vop_rmdir = zfs_rmdir },
5349 VOPNAME_READDIR, { .vop_readdir = zfs_readdir },
5350 VOPNAME_SYMLINK, { .error = zfs_inval },
5351 VOPNAME_FSYNC, { .vop_fsync = zfs_fsync },
5352 VOPNAME_INACTIVE, { .vop_inactive = zfs_inactive },
5353 VOPNAME_FID, { .vop_fid = zfs_fid },
5354 VOPNAME_SEEK, { .vop_seek = zfs_seek },
5355 VOPNAME_PATHCONF, { .vop_pathconf = zfs_pathconf },
5356 VOPNAME_GETSECATTR, { .vop_getsecattr = zfs_getsecattr },
5357 VOPNAME_SETSECATTR, { .vop_setsecattr = zfs_setsecattr },
5358 VOPNAME_VNEVENT, { .vop_vnevent = fs_vnevent_support },
5359 NULL, NULL
5360 };
5361
5362 /*
5363 * Error vnode operations template
5364 */
5365 vnodeops_t *zfs_evnodeops;
5366 const fs_operation_def_t zfs_evnodeops_template[] = {
5367 VOPNAME_INACTIVE, { .vop_inactive = zfs_inactive },
5368 VOPNAME_PATHCONF, { .vop_pathconf = zfs_pathconf },
5369 NULL, NULL
5370 };
|
5205 */
5206 static int zfs_inval();
5207 static int zfs_isdir();
5208
5209 static int
5210 zfs_inval()
5211 {
5212 return (SET_ERROR(EINVAL));
5213 }
5214
5215 static int
5216 zfs_isdir()
5217 {
5218 return (SET_ERROR(EISDIR));
5219 }
5220 /*
5221 * Directory vnode operations template
5222 */
5223 vnodeops_t *zfs_dvnodeops;
5224 const fs_operation_def_t zfs_dvnodeops_template[] = {
5225 { VOPNAME_OPEN, { .vop_open = zfs_open } },
5226 { VOPNAME_CLOSE, { .vop_close = zfs_close } },
5227 { VOPNAME_READ, { .error = zfs_isdir } },
5228 { VOPNAME_WRITE, { .error = zfs_isdir } },
5229 { VOPNAME_IOCTL, { .vop_ioctl = zfs_ioctl } },
5230 { VOPNAME_GETATTR, { .vop_getattr = zfs_getattr } },
5231 { VOPNAME_SETATTR, { .vop_setattr = zfs_setattr } },
5232 { VOPNAME_ACCESS, { .vop_access = zfs_access } },
5233 { VOPNAME_LOOKUP, { .vop_lookup = zfs_lookup } },
5234 { VOPNAME_CREATE, { .vop_create = zfs_create } },
5235 { VOPNAME_REMOVE, { .vop_remove = zfs_remove } },
5236 { VOPNAME_LINK, { .vop_link = zfs_link } },
5237 { VOPNAME_RENAME, { .vop_rename = zfs_rename } },
5238 { VOPNAME_MKDIR, { .vop_mkdir = zfs_mkdir } },
5239 { VOPNAME_RMDIR, { .vop_rmdir = zfs_rmdir } },
5240 { VOPNAME_READDIR, { .vop_readdir = zfs_readdir } },
5241 { VOPNAME_SYMLINK, { .vop_symlink = zfs_symlink } },
5242 { VOPNAME_FSYNC, { .vop_fsync = zfs_fsync } },
5243 { VOPNAME_INACTIVE, { .vop_inactive = zfs_inactive } },
5244 { VOPNAME_FID, { .vop_fid = zfs_fid } },
5245 { VOPNAME_SEEK, { .vop_seek = zfs_seek } },
5246 { VOPNAME_PATHCONF, { .vop_pathconf = zfs_pathconf } },
5247 { VOPNAME_GETSECATTR, { .vop_getsecattr = zfs_getsecattr } },
5248 { VOPNAME_SETSECATTR, { .vop_setsecattr = zfs_setsecattr } },
5249 { VOPNAME_VNEVENT, { .vop_vnevent = fs_vnevent_support } },
5250 { NULL, { NULL } }
5251 };
5252
5253 /*
5254 * Regular file vnode operations template
5255 */
5256 vnodeops_t *zfs_fvnodeops;
5257 const fs_operation_def_t zfs_fvnodeops_template[] = {
5258 { VOPNAME_OPEN, { .vop_open = zfs_open } },
5259 { VOPNAME_CLOSE, { .vop_close = zfs_close } },
5260 { VOPNAME_READ, { .vop_read = zfs_read } },
5261 { VOPNAME_WRITE, { .vop_write = zfs_write } },
5262 { VOPNAME_IOCTL, { .vop_ioctl = zfs_ioctl } },
5263 { VOPNAME_GETATTR, { .vop_getattr = zfs_getattr } },
5264 { VOPNAME_SETATTR, { .vop_setattr = zfs_setattr } },
5265 { VOPNAME_ACCESS, { .vop_access = zfs_access } },
5266 { VOPNAME_LOOKUP, { .vop_lookup = zfs_lookup } },
5267 { VOPNAME_RENAME, { .vop_rename = zfs_rename } },
5268 { VOPNAME_FSYNC, { .vop_fsync = zfs_fsync } },
5269 { VOPNAME_INACTIVE, { .vop_inactive = zfs_inactive } },
5270 { VOPNAME_FID, { .vop_fid = zfs_fid } },
5271 { VOPNAME_SEEK, { .vop_seek = zfs_seek } },
5272 { VOPNAME_FRLOCK, { .vop_frlock = zfs_frlock } },
5273 { VOPNAME_SPACE, { .vop_space = zfs_space } },
5274 { VOPNAME_GETPAGE, { .vop_getpage = zfs_getpage } },
5275 { VOPNAME_PUTPAGE, { .vop_putpage = zfs_putpage } },
5276 { VOPNAME_MAP, { .vop_map = zfs_map } },
5277 { VOPNAME_ADDMAP, { .vop_addmap = zfs_addmap } },
5278 { VOPNAME_DELMAP, { .vop_delmap = zfs_delmap } },
5279 { VOPNAME_PATHCONF, { .vop_pathconf = zfs_pathconf } },
5280 { VOPNAME_GETSECATTR, { .vop_getsecattr = zfs_getsecattr } },
5281 { VOPNAME_SETSECATTR, { .vop_setsecattr = zfs_setsecattr } },
5282 { VOPNAME_VNEVENT, { .vop_vnevent = fs_vnevent_support } },
5283 { VOPNAME_REQZCBUF, { .vop_reqzcbuf = zfs_reqzcbuf } },
5284 { VOPNAME_RETZCBUF, { .vop_retzcbuf = zfs_retzcbuf } },
5285 { NULL, { NULL } }
5286 };
5287
5288 /*
5289 * Symbolic link vnode operations template
5290 */
5291 vnodeops_t *zfs_symvnodeops;
5292 const fs_operation_def_t zfs_symvnodeops_template[] = {
5293 { VOPNAME_GETATTR, { .vop_getattr = zfs_getattr } },
5294 { VOPNAME_SETATTR, { .vop_setattr = zfs_setattr } },
5295 { VOPNAME_ACCESS, { .vop_access = zfs_access } },
5296 { VOPNAME_RENAME, { .vop_rename = zfs_rename } },
5297 { VOPNAME_READLINK, { .vop_readlink = zfs_readlink } },
5298 { VOPNAME_INACTIVE, { .vop_inactive = zfs_inactive } },
5299 { VOPNAME_FID, { .vop_fid = zfs_fid } },
5300 { VOPNAME_PATHCONF, { .vop_pathconf = zfs_pathconf } },
5301 { VOPNAME_VNEVENT, { .vop_vnevent = fs_vnevent_support } },
5302 { NULL, { NULL } }
5303 };
5304
5305 /*
5306 * special share hidden files vnode operations template
5307 */
5308 vnodeops_t *zfs_sharevnodeops;
5309 const fs_operation_def_t zfs_sharevnodeops_template[] = {
5310 { VOPNAME_GETATTR, { .vop_getattr = zfs_getattr } },
5311 { VOPNAME_ACCESS, { .vop_access = zfs_access } },
5312 { VOPNAME_INACTIVE, { .vop_inactive = zfs_inactive } },
5313 { VOPNAME_FID, { .vop_fid = zfs_fid } },
5314 { VOPNAME_PATHCONF, { .vop_pathconf = zfs_pathconf } },
5315 { VOPNAME_GETSECATTR, { .vop_getsecattr = zfs_getsecattr } },
5316 { VOPNAME_SETSECATTR, { .vop_setsecattr = zfs_setsecattr } },
5317 { VOPNAME_VNEVENT, { .vop_vnevent = fs_vnevent_support } },
5318 { NULL, { NULL } }
5319 };
5320
5321 /*
5322 * Extended attribute directory vnode operations template
5323 *
5324 * This template is identical to the directory vnodes
5325 * operation template except for restricted operations:
5326 * VOP_MKDIR()
5327 * VOP_SYMLINK()
5328 *
5329 * Note that there are other restrictions embedded in:
5330 * zfs_create() - restrict type to VREG
5331 * zfs_link() - no links into/out of attribute space
5332 * zfs_rename() - no moves into/out of attribute space
5333 */
5334 vnodeops_t *zfs_xdvnodeops;
5335 const fs_operation_def_t zfs_xdvnodeops_template[] = {
5336 { VOPNAME_OPEN, { .vop_open = zfs_open } },
5337 { VOPNAME_CLOSE, { .vop_close = zfs_close } },
5338 { VOPNAME_IOCTL, { .vop_ioctl = zfs_ioctl } },
5339 { VOPNAME_GETATTR, { .vop_getattr = zfs_getattr } },
5340 { VOPNAME_SETATTR, { .vop_setattr = zfs_setattr } },
5341 { VOPNAME_ACCESS, { .vop_access = zfs_access } },
5342 { VOPNAME_LOOKUP, { .vop_lookup = zfs_lookup } },
5343 { VOPNAME_CREATE, { .vop_create = zfs_create } },
5344 { VOPNAME_REMOVE, { .vop_remove = zfs_remove } },
5345 { VOPNAME_LINK, { .vop_link = zfs_link } },
5346 { VOPNAME_RENAME, { .vop_rename = zfs_rename } },
5347 { VOPNAME_MKDIR, { .error = zfs_inval } },
5348 { VOPNAME_RMDIR, { .vop_rmdir = zfs_rmdir } },
5349 { VOPNAME_READDIR, { .vop_readdir = zfs_readdir } },
5350 { VOPNAME_SYMLINK, { .error = zfs_inval } },
5351 { VOPNAME_FSYNC, { .vop_fsync = zfs_fsync } },
5352 { VOPNAME_INACTIVE, { .vop_inactive = zfs_inactive } },
5353 { VOPNAME_FID, { .vop_fid = zfs_fid } },
5354 { VOPNAME_SEEK, { .vop_seek = zfs_seek } },
5355 { VOPNAME_PATHCONF, { .vop_pathconf = zfs_pathconf } },
5356 { VOPNAME_GETSECATTR, { .vop_getsecattr = zfs_getsecattr } },
5357 { VOPNAME_SETSECATTR, { .vop_setsecattr = zfs_setsecattr } },
5358 { VOPNAME_VNEVENT, { .vop_vnevent = fs_vnevent_support } },
5359 { NULL, { NULL } }
5360 };
5361
5362 /*
5363 * Error vnode operations template
5364 */
5365 vnodeops_t *zfs_evnodeops;
5366 const fs_operation_def_t zfs_evnodeops_template[] = {
5367 { VOPNAME_INACTIVE, { .vop_inactive = zfs_inactive } },
5368 { VOPNAME_PATHCONF, { .vop_pathconf = zfs_pathconf } },
5369 { NULL, { NULL } }
5370 };
|