proc.c (b7629ce6f492eb2d48b9ee1dab5980c7278514c1) proc.c (72b44f6577f15f37fe964c8dcc42a7c5736e604c)
1// SPDX-License-Identifier: GPL-2.0
2/* drivers/nubus/proc.c: Proc FS interface for NuBus.
3
4 By David Huggins-Daines <dhd@debian.org>
5
6 Much code and many ideas from drivers/pci/proc.c:
7 Copyright (c) 1997, 1998 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
8

--- 41 unchanged lines hidden (view full) ---

50/*
51 * /proc/bus/nubus/x/ stuff
52 */
53
54struct proc_dir_entry *nubus_proc_add_board(struct nubus_board *board)
55{
56 char name[2];
57
1// SPDX-License-Identifier: GPL-2.0
2/* drivers/nubus/proc.c: Proc FS interface for NuBus.
3
4 By David Huggins-Daines <dhd@debian.org>
5
6 Much code and many ideas from drivers/pci/proc.c:
7 Copyright (c) 1997, 1998 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
8

--- 41 unchanged lines hidden (view full) ---

50/*
51 * /proc/bus/nubus/x/ stuff
52 */
53
54struct proc_dir_entry *nubus_proc_add_board(struct nubus_board *board)
55{
56 char name[2];
57
58 if (!proc_bus_nubus_dir)
58 if (!proc_bus_nubus_dir || !nubus_populate_procfs)
59 return NULL;
60 snprintf(name, sizeof(name), "%x", board->slot);
61 return proc_mkdir(name, proc_bus_nubus_dir);
62}
63
64/* The PDE private data for any directory under /proc/bus/nubus/x/
65 * is the bytelanes value for the board in slot x.
66 */
67
68struct proc_dir_entry *nubus_proc_add_rsrc_dir(struct proc_dir_entry *procdir,
69 const struct nubus_dirent *ent,
70 struct nubus_board *board)
71{
72 char name[9];
73 int lanes = board->lanes;
74
59 return NULL;
60 snprintf(name, sizeof(name), "%x", board->slot);
61 return proc_mkdir(name, proc_bus_nubus_dir);
62}
63
64/* The PDE private data for any directory under /proc/bus/nubus/x/
65 * is the bytelanes value for the board in slot x.
66 */
67
68struct proc_dir_entry *nubus_proc_add_rsrc_dir(struct proc_dir_entry *procdir,
69 const struct nubus_dirent *ent,
70 struct nubus_board *board)
71{
72 char name[9];
73 int lanes = board->lanes;
74
75 if (!procdir)
75 if (!procdir || !nubus_populate_procfs)
76 return NULL;
77 snprintf(name, sizeof(name), "%x", ent->type);
78 remove_proc_subtree(name, procdir);
79 return proc_mkdir_data(name, 0555, procdir, (void *)lanes);
80}
81
82/* The PDE private data for a file under /proc/bus/nubus/x/ is a pointer to
83 * an instance of the following structure, which gives the location and size

--- 68 unchanged lines hidden (view full) ---

152
153void nubus_proc_add_rsrc_mem(struct proc_dir_entry *procdir,
154 const struct nubus_dirent *ent,
155 unsigned int size)
156{
157 char name[9];
158 struct nubus_proc_pde_data *pded;
159
76 return NULL;
77 snprintf(name, sizeof(name), "%x", ent->type);
78 remove_proc_subtree(name, procdir);
79 return proc_mkdir_data(name, 0555, procdir, (void *)lanes);
80}
81
82/* The PDE private data for a file under /proc/bus/nubus/x/ is a pointer to
83 * an instance of the following structure, which gives the location and size

--- 68 unchanged lines hidden (view full) ---

152
153void nubus_proc_add_rsrc_mem(struct proc_dir_entry *procdir,
154 const struct nubus_dirent *ent,
155 unsigned int size)
156{
157 char name[9];
158 struct nubus_proc_pde_data *pded;
159
160 if (!procdir)
160 if (!procdir || !nubus_populate_procfs)
161 return;
162
163 snprintf(name, sizeof(name), "%x", ent->type);
164 if (size)
165 pded = nubus_proc_alloc_pde_data(nubus_dirptr(ent), size);
166 else
167 pded = NULL;
168 remove_proc_subtree(name, procdir);
169 proc_create_data(name, S_IFREG | 0444, procdir,
170 &nubus_rsrc_proc_ops, pded);
171}
172
173void nubus_proc_add_rsrc(struct proc_dir_entry *procdir,
174 const struct nubus_dirent *ent)
175{
176 char name[9];
177 unsigned char *data = (unsigned char *)ent->data;
178
161 return;
162
163 snprintf(name, sizeof(name), "%x", ent->type);
164 if (size)
165 pded = nubus_proc_alloc_pde_data(nubus_dirptr(ent), size);
166 else
167 pded = NULL;
168 remove_proc_subtree(name, procdir);
169 proc_create_data(name, S_IFREG | 0444, procdir,
170 &nubus_rsrc_proc_ops, pded);
171}
172
173void nubus_proc_add_rsrc(struct proc_dir_entry *procdir,
174 const struct nubus_dirent *ent)
175{
176 char name[9];
177 unsigned char *data = (unsigned char *)ent->data;
178
179 if (!procdir)
179 if (!procdir || !nubus_populate_procfs)
180 return;
181
182 snprintf(name, sizeof(name), "%x", ent->type);
183 remove_proc_subtree(name, procdir);
184 proc_create_data(name, S_IFREG | 0444, procdir,
185 &nubus_rsrc_proc_ops,
186 nubus_proc_alloc_pde_data(data, 0));
187}

--- 14 unchanged lines hidden ---
180 return;
181
182 snprintf(name, sizeof(name), "%x", ent->type);
183 remove_proc_subtree(name, procdir);
184 proc_create_data(name, S_IFREG | 0444, procdir,
185 &nubus_rsrc_proc_ops,
186 nubus_proc_alloc_pde_data(data, 0));
187}

--- 14 unchanged lines hidden ---