Lines Matching refs:fh
87 int ovl_check_fh_len(struct ovl_fh *fh, int fh_len) in ovl_check_fh_len() argument
89 if (fh_len < sizeof(struct ovl_fh) || fh_len < fh->len) in ovl_check_fh_len()
92 if (fh->magic != OVL_FH_MAGIC) in ovl_check_fh_len()
96 if (fh->version > OVL_FH_VERSION || fh->flags & ~OVL_FH_FLAG_ALL) in ovl_check_fh_len()
100 if (!(fh->flags & OVL_FH_FLAG_ANY_ENDIAN) && in ovl_check_fh_len()
101 (fh->flags & OVL_FH_FLAG_BIG_ENDIAN) != OVL_FH_FLAG_CPU_ENDIAN) in ovl_check_fh_len()
111 struct ovl_fh *fh = NULL; in ovl_get_fh() local
123 fh = kzalloc(res, GFP_KERNEL); in ovl_get_fh()
124 if (!fh) in ovl_get_fh()
127 res = ovl_do_vfs_getxattr(dentry, name, fh, res); in ovl_get_fh()
131 err = ovl_check_fh_len(fh, res); in ovl_get_fh()
138 return fh; in ovl_get_fh()
141 kfree(fh); in ovl_get_fh()
149 (int)res, fh); in ovl_get_fh()
153 struct dentry *ovl_decode_real_fh(struct ovl_fh *fh, struct vfsmount *mnt, in ovl_decode_real_fh() argument
163 if (!uuid_equal(&fh->uuid, &mnt->mnt_sb->s_uuid)) in ovl_decode_real_fh()
166 bytes = (fh->len - offsetof(struct ovl_fh, fid)); in ovl_decode_real_fh()
167 real = exportfs_decode_fh(mnt, (struct fid *)fh->fid, in ovl_decode_real_fh()
168 bytes >> 2, (int)fh->type, in ovl_decode_real_fh()
178 !(fh->flags & OVL_FH_FLAG_PATH_UPPER)) in ovl_decode_real_fh()
323 int ovl_check_origin_fh(struct ovl_fs *ofs, struct ovl_fh *fh, bool connected, in ovl_check_origin_fh() argument
338 origin = ovl_decode_real_fh(fh, ofs->lower_layers[i].mnt, in ovl_check_origin_fh()
377 struct ovl_fh *fh = ovl_get_fh(upperdentry, OVL_XATTR_ORIGIN); in ovl_check_origin() local
380 if (IS_ERR_OR_NULL(fh)) in ovl_check_origin()
381 return PTR_ERR(fh); in ovl_check_origin()
383 err = ovl_check_origin_fh(ofs, fh, false, upperdentry, stackp); in ovl_check_origin()
384 kfree(fh); in ovl_check_origin()
404 const struct ovl_fh *fh) in ovl_verify_fh() argument
415 if (fh->len != ofh->len || memcmp(fh, ofh, fh->len)) in ovl_verify_fh()
434 struct ovl_fh *fh; in ovl_verify_set_fh() local
437 fh = ovl_encode_real_fh(real, is_upper); in ovl_verify_set_fh()
438 err = PTR_ERR(fh); in ovl_verify_set_fh()
439 if (IS_ERR(fh)) { in ovl_verify_set_fh()
440 fh = NULL; in ovl_verify_set_fh()
444 err = ovl_verify_fh(dentry, name, fh); in ovl_verify_set_fh()
446 err = ovl_do_setxattr(dentry, name, fh, fh->len, 0); in ovl_verify_set_fh()
451 kfree(fh); in ovl_verify_set_fh()
465 struct ovl_fh *fh; in ovl_index_upper() local
471 fh = ovl_get_fh(index, OVL_XATTR_UPPER); in ovl_index_upper()
472 if (IS_ERR_OR_NULL(fh)) in ovl_index_upper()
473 return ERR_CAST(fh); in ovl_index_upper()
475 upper = ovl_decode_real_fh(fh, ofs->upper_mnt, true); in ovl_index_upper()
476 kfree(fh); in ovl_index_upper()
504 struct ovl_fh *fh = NULL; in ovl_verify_index() local
525 fh = kzalloc(len, GFP_KERNEL); in ovl_verify_index()
526 if (!fh) in ovl_verify_index()
530 if (hex2bin((u8 *)fh, index->d_name.name, len)) in ovl_verify_index()
533 err = ovl_check_fh_len(fh, len); in ovl_verify_index()
575 err = ovl_verify_fh(upper, OVL_XATTR_ORIGIN, fh); in ovl_verify_index()
582 err = ovl_check_origin_fh(ofs, fh, false, index, &stack); in ovl_verify_index()
592 kfree(fh); in ovl_verify_index()
608 static int ovl_get_index_name_fh(struct ovl_fh *fh, struct qstr *name) in ovl_get_index_name_fh() argument
612 n = kcalloc(fh->len, 2, GFP_KERNEL); in ovl_get_index_name_fh()
616 s = bin2hex(n, fh, fh->len); in ovl_get_index_name_fh()
640 struct ovl_fh *fh; in ovl_get_index_name() local
643 fh = ovl_encode_real_fh(origin, false); in ovl_get_index_name()
644 if (IS_ERR(fh)) in ovl_get_index_name()
645 return PTR_ERR(fh); in ovl_get_index_name()
647 err = ovl_get_index_name_fh(fh, name); in ovl_get_index_name()
649 kfree(fh); in ovl_get_index_name()
654 struct dentry *ovl_get_index_fh(struct ovl_fs *ofs, struct ovl_fh *fh) in ovl_get_index_fh() argument
660 err = ovl_get_index_name_fh(fh, &name); in ovl_get_index_fh()