Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /* AFS caching stuff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Written by David Howells (dhowells@redhat.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include "internal.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) static enum fscache_checkaux afs_vnode_cache_check_aux(void *cookie_netfs_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 						       const void *buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 						       uint16_t buflen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 						       loff_t object_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct fscache_netfs afs_cache_netfs = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	.name			= "afs",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	.version		= 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) struct fscache_cookie_def afs_cell_cache_index_def = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	.name		= "AFS.cell",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	.type		= FSCACHE_COOKIE_TYPE_INDEX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) struct fscache_cookie_def afs_volume_cache_index_def = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	.name		= "AFS.volume",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	.type		= FSCACHE_COOKIE_TYPE_INDEX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) struct fscache_cookie_def afs_vnode_cache_index_def = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	.name		= "AFS.vnode",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	.type		= FSCACHE_COOKIE_TYPE_DATAFILE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	.check_aux	= afs_vnode_cache_check_aux,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)  * check that the auxiliary data indicates that the entry is still valid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) static enum fscache_checkaux afs_vnode_cache_check_aux(void *cookie_netfs_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 						       const void *buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 						       uint16_t buflen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 						       loff_t object_size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	struct afs_vnode *vnode = cookie_netfs_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	struct afs_vnode_cache_aux aux;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	_enter("{%llx,%x,%llx},%p,%u",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	       vnode->fid.vnode, vnode->fid.unique, vnode->status.data_version,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	       buffer, buflen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	memcpy(&aux, buffer, sizeof(aux));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	/* check the size of the data is what we're expecting */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	if (buflen != sizeof(aux)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 		_leave(" = OBSOLETE [len %hx != %zx]", buflen, sizeof(aux));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 		return FSCACHE_CHECKAUX_OBSOLETE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	if (vnode->status.data_version != aux.data_version) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 		_leave(" = OBSOLETE [vers %llx != %llx]",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 		       aux.data_version, vnode->status.data_version);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 		return FSCACHE_CHECKAUX_OBSOLETE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 	_leave(" = SUCCESS");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 	return FSCACHE_CHECKAUX_OKAY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) }