Commit 1bbc994c authored by Pavel Emelyanov's avatar Pavel Emelyanov

sysctl: Remove dead CTL_PRINT|_SHOW code

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 58b3ef0e
...@@ -12,8 +12,6 @@ extern int sysctl_op(struct sysctl_req *req, int op); ...@@ -12,8 +12,6 @@ extern int sysctl_op(struct sysctl_req *req, int op);
enum { enum {
CTL_READ, CTL_READ,
CTL_WRITE, CTL_WRITE,
CTL_PRINT,
CTL_SHOW,
}; };
#define CTL_SHIFT 4 /* Up to 16 types */ #define CTL_SHIFT 4 /* Up to 16 types */
......
...@@ -908,8 +908,6 @@ static int prepare_ipc_var(int pid) ...@@ -908,8 +908,6 @@ static int prepare_ipc_var(int pid)
return -EFAULT; return -EFAULT;
} }
ipc_sysctl_req(var, CTL_PRINT);
ret = ipc_sysctl_req(var, CTL_WRITE); ret = ipc_sysctl_req(var, CTL_WRITE);
ipc_var_entry__free_unpacked(var, NULL); ipc_var_entry__free_unpacked(var, NULL);
......
...@@ -18,14 +18,6 @@ do { \ ...@@ -18,14 +18,6 @@ do { \
__ret = sysctl_write_##__type(__fd, __req, \ __ret = sysctl_write_##__type(__fd, __req, \
(__type *)(__req)->arg, \ (__type *)(__req)->arg, \
__nr); \ __nr); \
else if (__op == CTL_PRINT) \
__ret = sysctl_print_##__type(__fd, __req, \
(__type *)(__req)->arg, \
__nr); \
else if (__op == CTL_PRINT) \
__ret = sysctl_show_##__type(__fd, __req, \
(__type *)(__req)->arg, \
__nr); \
else \ else \
__ret = -1; \ __ret = -1; \
} while (0) } while (0)
...@@ -99,37 +91,6 @@ err: \ ...@@ -99,37 +91,6 @@ err: \
return ret; \ return ret; \
} }
#define GEN_SYSCTL_PRINT_FUNC(__type, __fmt) \
static int sysctl_print_##__type(int fd, \
struct sysctl_req *req, \
__type *arg, \
int nr) \
{ \
char msg[PAGE_SIZE]; \
int i, off = 0; \
for (i = 0; i < nr; i++) \
off += snprintf(msg + off, sizeof(msg) - off, \
__fmt, arg[i]); \
pr_info("sysctl: <%s> = <%s>\n", req->name, msg); \
\
return 0; \
}
#define GEN_SYSCTL_SHOW_FUNC(__type, __fmt) \
static int sysctl_show_##__type(int fd, \
struct sysctl_req *req, \
__type *arg, \
int nr) \
{ \
int i; \
pr_msg("sysctl: <%s> = <", req->name); \
for (i = 0; i < nr; i++) \
pr_msg(__fmt, arg[i]); \
pr_msg(">\n"); \
\
return 0; \
}
GEN_SYSCTL_READ_FUNC(u32, strtoul); GEN_SYSCTL_READ_FUNC(u32, strtoul);
GEN_SYSCTL_READ_FUNC(u64, strtoull); GEN_SYSCTL_READ_FUNC(u64, strtoull);
GEN_SYSCTL_READ_FUNC(s32, strtol); GEN_SYSCTL_READ_FUNC(s32, strtol);
...@@ -138,16 +99,6 @@ GEN_SYSCTL_WRITE_FUNC(u32, "%u "); ...@@ -138,16 +99,6 @@ GEN_SYSCTL_WRITE_FUNC(u32, "%u ");
GEN_SYSCTL_WRITE_FUNC(u64, "%"PRIu64" "); GEN_SYSCTL_WRITE_FUNC(u64, "%"PRIu64" ");
GEN_SYSCTL_WRITE_FUNC(s32, "%d "); GEN_SYSCTL_WRITE_FUNC(s32, "%d ");
GEN_SYSCTL_PRINT_FUNC(u32, "%u ");
GEN_SYSCTL_PRINT_FUNC(u64, "%"PRIu64" ");
GEN_SYSCTL_PRINT_FUNC(char, "%c");
GEN_SYSCTL_PRINT_FUNC(s32, "%d ");
GEN_SYSCTL_SHOW_FUNC(u32, "%u ");
GEN_SYSCTL_SHOW_FUNC(u64, "%"PRIu64" ");
GEN_SYSCTL_SHOW_FUNC(char, "%c");
GEN_SYSCTL_SHOW_FUNC(s32, "%d ");
static int static int
sysctl_write_char(int fd, struct sysctl_req *req, char *arg, int nr) sysctl_write_char(int fd, struct sysctl_req *req, char *arg, int nr)
{ {
...@@ -177,12 +128,7 @@ err: ...@@ -177,12 +128,7 @@ err:
static int __sysctl_op(int dir, struct sysctl_req *req, int op) static int __sysctl_op(int dir, struct sysctl_req *req, int op)
{ {
int fd = -1; int fd, ret = -1, nr = 1, flags;
int ret = -1;
int nr = 1;
if (dir >= 0) {
int flags;
if (op == CTL_READ) if (op == CTL_READ)
flags = O_RDONLY; flags = O_RDONLY;
...@@ -194,7 +140,6 @@ static int __sysctl_op(int dir, struct sysctl_req *req, int op) ...@@ -194,7 +140,6 @@ static int __sysctl_op(int dir, struct sysctl_req *req, int op)
pr_perror("Can't open sysctl %s", req->name); pr_perror("Can't open sysctl %s", req->name);
return -1; return -1;
} }
}
switch (CTL_TYPE(req->type)) { switch (CTL_TYPE(req->type)) {
case __CTL_U32A: case __CTL_U32A:
...@@ -226,13 +171,11 @@ int sysctl_op(struct sysctl_req *req, int op) ...@@ -226,13 +171,11 @@ int sysctl_op(struct sysctl_req *req, int op)
int ret = 0; int ret = 0;
int dir = -1; int dir = -1;
if (op != CTL_PRINT && op != CTL_SHOW) {
dir = open("/proc/sys", O_RDONLY); dir = open("/proc/sys", O_RDONLY);
if (dir < 0) { if (dir < 0) {
pr_perror("Can't open sysctl dir"); pr_perror("Can't open sysctl dir");
return -1; return -1;
} }
}
while (req->name) { while (req->name) {
ret = __sysctl_op(dir, req, op); ret = __sysctl_op(dir, req, op);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment