提交 98870ab0 编写于 作者: D David Howells 提交者: James Morris

CRED: Documentation

Document credentials and the new credentials API.
Signed-off-by: NDavid Howells <dhowells@redhat.com>
Signed-off-by: NJames Morris <jmorris@namei.org>
上级 d76b0d9b
此差异已折叠。
/* Credentials management /* Credentials management - see Documentation/credentials.txt
* *
* Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -169,6 +169,12 @@ static inline struct cred *get_new_cred(struct cred *cred) ...@@ -169,6 +169,12 @@ static inline struct cred *get_new_cred(struct cred *cred)
* *
* Get a reference on the specified set of credentials. The caller must * Get a reference on the specified set of credentials. The caller must
* release the reference. * release the reference.
*
* This is used to deal with a committed set of credentials. Although the
* pointer is const, this will temporarily discard the const and increment the
* usage count. The purpose of this is to attempt to catch at compile time the
* accidental alteration of a set of credentials that should be considered
* immutable.
*/ */
static inline const struct cred *get_cred(const struct cred *cred) static inline const struct cred *get_cred(const struct cred *cred)
{ {
...@@ -181,6 +187,10 @@ static inline const struct cred *get_cred(const struct cred *cred) ...@@ -181,6 +187,10 @@ static inline const struct cred *get_cred(const struct cred *cred)
* *
* Release a reference to a set of credentials, deleting them when the last ref * Release a reference to a set of credentials, deleting them when the last ref
* is released. * is released.
*
* This takes a const pointer to a set of credentials because the credentials
* on task_struct are attached by const pointers to prevent accidental
* alteration of otherwise immutable credential sets.
*/ */
static inline void put_cred(const struct cred *_cred) static inline void put_cred(const struct cred *_cred)
{ {
......
/* Task credentials management /* Task credentials management - see Documentation/credentials.txt
* *
* Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册