cregit-Linux how code gets into the kernel

Release 4.12 include/crypto/scatterwalk.h

Directory: include/crypto
/*
 * Cryptographic scatter and gather helpers.
 *
 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
 * Copyright (c) 2002 Adam J. Richter <adam@yggdrasil.com>
 * Copyright (c) 2004 Jean-Luc Cooke <jlcooke@certainkey.com>
 * Copyright (c) 2007 Herbert Xu <herbert@gondor.apana.org.au>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 2 of the License, or (at your option)
 * any later version.
 *
 */

#ifndef _CRYPTO_SCATTERWALK_H

#define _CRYPTO_SCATTERWALK_H

#include <crypto/algapi.h>
#include <linux/highmem.h>
#include <linux/kernel.h>
#include <linux/scatterlist.h>


static inline void scatterwalk_crypto_chain(struct scatterlist *head, struct scatterlist *sg, int chain, int num) { if (chain) { head->length += sg->length; sg = sg_next(sg); } if (sg) sg_chain(head, num, sg); else sg_mark_end(head); }

Contributors

PersonTokensPropCommitsCommitProp
Steffen Klassert6095.24%125.00%
Dan J Williams11.59%125.00%
Cristian Stoica11.59%125.00%
Herbert Xu11.59%125.00%
Total63100.00%4100.00%


static inline unsigned long scatterwalk_samebuf(struct scatter_walk *walk_in, struct scatter_walk *walk_out) { return !(((sg_page(walk_in->sg) - sg_page(walk_out->sg)) << PAGE_SHIFT) + (int)(walk_in->offset - walk_out->offset)); }

Contributors

PersonTokensPropCommitsCommitProp
Herbert Xu2341.82%125.00%
Andrew Morton2240.00%125.00%
Jens Axboe610.91%125.00%
Christophe Saout47.27%125.00%
Total55100.00%4100.00%


static inline unsigned int scatterwalk_pagelen(struct scatter_walk *walk) { unsigned int len = walk->sg->offset + walk->sg->length - walk->offset; unsigned int len_this_page = offset_in_page(~walk->offset) + 1; return len_this_page > len ? len : len_this_page; }

Contributors

PersonTokensPropCommitsCommitProp
Herbert Xu5496.43%150.00%
Andrew Morton23.57%150.00%
Total56100.00%2100.00%


static inline unsigned int scatterwalk_clamp(struct scatter_walk *walk, unsigned int nbytes) { unsigned int len_this_page = scatterwalk_pagelen(walk); return nbytes > len_this_page ? len_this_page : nbytes; }

Contributors

PersonTokensPropCommitsCommitProp
Herbert Xu2571.43%375.00%
Andrew Morton1028.57%125.00%
Total35100.00%4100.00%


static inline void scatterwalk_advance(struct scatter_walk *walk, unsigned int nbytes) { walk->offset += nbytes; }

Contributors

PersonTokensPropCommitsCommitProp
Herbert Xu22100.00%1100.00%
Total22100.00%1100.00%


static inline unsigned int scatterwalk_aligned(struct scatter_walk *walk, unsigned int alignmask) { return !(walk->offset & alignmask); }

Contributors

PersonTokensPropCommitsCommitProp
Herbert Xu27100.00%1100.00%
Total27100.00%1100.00%


static inline struct page *scatterwalk_page(struct scatter_walk *walk) { return sg_page(walk->sg) + (walk->offset >> PAGE_SHIFT); }

Contributors

PersonTokensPropCommitsCommitProp
Herbert Xu2790.00%150.00%
Jens Axboe310.00%150.00%
Total30100.00%2100.00%


static inline void scatterwalk_unmap(void *vaddr) { kunmap_atomic(vaddr); }

Contributors

PersonTokensPropCommitsCommitProp
Herbert Xu1593.75%150.00%
Américo Wang16.25%150.00%
Total16100.00%2100.00%


static inline void scatterwalk_start(struct scatter_walk *walk, struct scatterlist *sg) { walk->sg = sg; walk->offset = sg->offset; }

Contributors

PersonTokensPropCommitsCommitProp
Herbert Xu1858.06%150.00%
Andrew Morton1341.94%150.00%
Total31100.00%2100.00%


static inline void *scatterwalk_map(struct scatter_walk *walk) { return kmap_atomic(scatterwalk_page(walk)) + offset_in_page(walk->offset); }

Contributors

PersonTokensPropCommitsCommitProp
Herbert Xu2896.55%266.67%
Andrew Morton13.45%133.33%
Total29100.00%3100.00%


static inline void scatterwalk_pagedone(struct scatter_walk *walk, int out, unsigned int more) { if (out) { struct page *page; page = sg_page(walk->sg) + ((walk->offset - 1) >> PAGE_SHIFT); /* Test ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE first as * PageSlab cannot be optimised away per se due to * use of volatile pointer. */ if (ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE && !PageSlab(page)) flush_dcache_page(page); } if (more && walk->offset >= walk->sg->offset + walk->sg->length) scatterwalk_start(walk, sg_next(walk->sg)); }

Contributors

PersonTokensPropCommitsCommitProp
Herbert Xu9696.97%150.00%
Andrew Morton33.03%150.00%
Total99100.00%2100.00%


static inline void scatterwalk_done(struct scatter_walk *walk, int out, int more) { if (!more || walk->offset >= walk->sg->offset + walk->sg->length || !(walk->offset & (PAGE_SIZE - 1))) scatterwalk_pagedone(walk, out, more); }

Contributors

PersonTokensPropCommitsCommitProp
Herbert Xu5386.89%150.00%
Andrew Morton813.11%150.00%
Total61100.00%2100.00%

void scatterwalk_copychunks(void *buf, struct scatter_walk *walk, size_t nbytes, int out); void *scatterwalk_map(struct scatter_walk *walk); void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg, unsigned int start, unsigned int nbytes, int out); struct scatterlist *scatterwalk_ffwd(struct scatterlist dst[2], struct scatterlist *src, unsigned int len); #endif /* _CRYPTO_SCATTERWALK_H */

Overall Contributors

PersonTokensPropCommitsCommitProp
Herbert Xu45973.91%952.94%
Andrew Morton8613.85%211.76%
Steffen Klassert609.66%15.88%
Jens Axboe91.45%15.88%
Christophe Saout40.64%15.88%
Américo Wang10.16%15.88%
Dan J Williams10.16%15.88%
Cristian Stoica10.16%15.88%
Total621100.00%17100.00%
Directory: include/crypto
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.