/* user-type.h: User-defined key type1*2* Copyright (C) 2005 Red Hat, Inc. All Rights Reserved.3* Written by David Howells ([email protected])4*5* This program is free software; you can redistribute it and/or6* modify it under the terms of the GNU General Public License7* as published by the Free Software Foundation; either version8* 2 of the License, or (at your option) any later version.9*/1011#ifndef _KEYS_USER_TYPE_H12#define _KEYS_USER_TYPE_H1314#include <linux/key.h>15#include <linux/rcupdate.h>1617/*****************************************************************************/18/*19* the payload for a key of type "user"20* - once filled in and attached to a key:21* - the payload struct is invariant may not be changed, only replaced22* - the payload must be read with RCU procedures or with the key semaphore23* held24* - the payload may only be replaced with the key semaphore write-locked25* - the key's data length is the size of the actual data, not including the26* payload wrapper27*/28struct user_key_payload {29struct rcu_head rcu; /* RCU destructor */30unsigned short datalen; /* length of this data */31char data[0]; /* actual data */32};3334extern struct key_type key_type_user;3536extern int user_instantiate(struct key *key, const void *data, size_t datalen);37extern int user_update(struct key *key, const void *data, size_t datalen);38extern int user_match(const struct key *key, const void *criterion);39extern void user_revoke(struct key *key);40extern void user_destroy(struct key *key);41extern void user_describe(const struct key *user, struct seq_file *m);42extern long user_read(const struct key *key,43char __user *buffer, size_t buflen);444546#endif /* _KEYS_USER_TYPE_H */474849