if (fd_empty(f)) return -EBADF; return inode_storage_delete(file_inode(fd_file(f)), map);
}
/* *gfp_flags* is a hidden argument provided by the verifier */
BPF_CALL_5(bpf_inode_storage_get, struct bpf_map *, map, struct inode *, inode, void *, value, u64, flags, gfp_t, gfp_flags)
{ struct bpf_local_storage_data *sdata;
WARN_ON_ONCE(!bpf_rcu_lock_held()); if (flags & ~(BPF_LOCAL_STORAGE_GET_F_CREATE)) return (unsignedlong)NULL;
/* explicitly check that the inode_storage_ptr is not * NULL as inode_storage_lookup returns NULL in this case and * bpf_local_storage_update expects the owner to have a * valid storage pointer.
*/ if (!inode || !inode_storage_ptr(inode)) return (unsignedlong)NULL;
sdata = inode_storage_lookup(inode, map, true); if (sdata) return (unsignedlong)sdata->data;
/* This helper must only called from where the inode is guaranteed * to have a refcount and cannot be freed.
*/ if (flags & BPF_LOCAL_STORAGE_GET_F_CREATE) {
sdata = bpf_local_storage_update(
inode, (struct bpf_local_storage_map *)map, value,
BPF_NOEXIST, false, gfp_flags); return IS_ERR(sdata) ? (unsignedlong)NULL :
(unsignedlong)sdata->data;
}
/* This helper must only called from where the inode is guaranteed * to have a refcount and cannot be freed.
*/ return inode_storage_delete(inode, map);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.