Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /* Error injection handling.
0003  *
0004  * Copyright (C) 2021 Red Hat, Inc. All Rights Reserved.
0005  * Written by David Howells (dhowells@redhat.com)
0006  */
0007 
0008 #include <linux/sysctl.h>
0009 #include "internal.h"
0010 
0011 unsigned int cachefiles_error_injection_state;
0012 
0013 static struct ctl_table_header *cachefiles_sysctl;
0014 static struct ctl_table cachefiles_sysctls[] = {
0015     {
0016         .procname   = "error_injection",
0017         .data       = &cachefiles_error_injection_state,
0018         .maxlen     = sizeof(unsigned int),
0019         .mode       = 0644,
0020         .proc_handler   = proc_douintvec,
0021     },
0022     {}
0023 };
0024 
0025 static struct ctl_table cachefiles_sysctls_root[] = {
0026     {
0027         .procname   = "cachefiles",
0028         .mode       = 0555,
0029         .child      = cachefiles_sysctls,
0030     },
0031     {}
0032 };
0033 
0034 int __init cachefiles_register_error_injection(void)
0035 {
0036     cachefiles_sysctl = register_sysctl_table(cachefiles_sysctls_root);
0037     if (!cachefiles_sysctl)
0038         return -ENOMEM;
0039     return 0;
0040 
0041 }
0042 
0043 void cachefiles_unregister_error_injection(void)
0044 {
0045     unregister_sysctl_table(cachefiles_sysctl);
0046 }