ANDROID: GKI: fix up sysctl_vals ABI change.

In commit 1ac6e9ee84 ("sysctl: move some boundary constants from
sysctl.c to sysctl_vals"), the sysctl_vals variable got changed, but
unfortunatly many Android vendors liked using that array.  To preserve
the ABI, put the array back the way it was and rename the new change to
be `android_gki_sysctl_vals` instead, and move the #defines to use it.

This way if any external code is rebuilt, it will use the new symbols,
but if not, the old ones will still work just as before, not requiring a
rebuild at all.

Bug: 161946584
Fixes: 1ac6e9ee84 ("sysctl: move some boundary constants from sysctl.c to sysctl_vals")
Change-Id: Ib094ae03682e11fee4f0b06af362541bbcba24d5
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman 2023-07-10 16:20:23 +00:00
parent c9606079a5
commit 44da38b39c
2 changed files with 14 additions and 11 deletions

View File

@ -26,8 +26,10 @@ static const struct file_operations proc_sys_dir_file_operations;
static const struct inode_operations proc_sys_dir_operations;
/* shared constants to be used in various sysctls */
const int sysctl_vals[] = { -1, 0, 1, 2, 4, 100, 200, 1000, 3000, INT_MAX };
const int sysctl_vals[] = { 0, 1, INT_MAX };
EXPORT_SYMBOL(sysctl_vals);
const int android_gki_sysctl_vals[] = { -1, 0, 1, 2, 4, 100, 200, 1000, 3000, INT_MAX };
EXPORT_SYMBOL(android_gki_sysctl_vals);
/* Support for permanently empty directories */

View File

@ -38,18 +38,19 @@ struct ctl_table_header;
struct ctl_dir;
/* Keep the same order as in fs/proc/proc_sysctl.c */
#define SYSCTL_NEG_ONE ((void *)&sysctl_vals[0])
#define SYSCTL_ZERO ((void *)&sysctl_vals[1])
#define SYSCTL_ONE ((void *)&sysctl_vals[2])
#define SYSCTL_TWO ((void *)&sysctl_vals[3])
#define SYSCTL_FOUR ((void *)&sysctl_vals[4])
#define SYSCTL_ONE_HUNDRED ((void *)&sysctl_vals[5])
#define SYSCTL_TWO_HUNDRED ((void *)&sysctl_vals[6])
#define SYSCTL_ONE_THOUSAND ((void *)&sysctl_vals[7])
#define SYSCTL_THREE_THOUSAND ((void *)&sysctl_vals[8])
#define SYSCTL_INT_MAX ((void *)&sysctl_vals[9])
#define SYSCTL_NEG_ONE ((void *)&android_gki_sysctl_vals[0])
#define SYSCTL_ZERO ((void *)&android_gki_sysctl_vals[1])
#define SYSCTL_ONE ((void *)&android_gki_sysctl_vals[2])
#define SYSCTL_TWO ((void *)&android_gki_sysctl_vals[3])
#define SYSCTL_FOUR ((void *)&android_gki_sysctl_vals[4])
#define SYSCTL_ONE_HUNDRED ((void *)&android_gki_sysctl_vals[5])
#define SYSCTL_TWO_HUNDRED ((void *)&android_gki_sysctl_vals[6])
#define SYSCTL_ONE_THOUSAND ((void *)&android_gki_sysctl_vals[7])
#define SYSCTL_THREE_THOUSAND ((void *)&android_gki_sysctl_vals[8])
#define SYSCTL_INT_MAX ((void *)&android_gki_sysctl_vals[9])
extern const int sysctl_vals[];
extern const int android_gki_sysctl_vals[];
typedef int proc_handler(struct ctl_table *ctl, int write, void *buffer,
size_t *lenp, loff_t *ppos);