Deleted Added
full compact
linsysfs.c (164858) linsysfs.c (167482)
1/*-
2 * Copyright (c) 2006 IronPort Systems
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2006 IronPort Systems
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/compat/linsysfs/linsysfs.c 164858 2006-12-03 21:00:31Z netchild $");
28__FBSDID("$FreeBSD: head/sys/compat/linsysfs/linsysfs.c 167482 2007-03-12 12:16:52Z des $");
29
30#include <sys/param.h>
31#include <sys/queue.h>
32#include <sys/blist.h>
33#include <sys/conf.h>
34#include <sys/exec.h>
35#include <sys/filedesc.h>
36#include <sys/kernel.h>

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

170 sprintf(device, "%s:%02x:%02x.%x",
171 prefix,
172 dinfo->cfg.bus,
173 dinfo->cfg.slot,
174 dinfo->cfg.func);
175 strcat(new_path, "/");
176 strcat(new_path, device);
177 dir = pfs_create_dir(dir, device,
29
30#include <sys/param.h>
31#include <sys/queue.h>
32#include <sys/blist.h>
33#include <sys/conf.h>
34#include <sys/exec.h>
35#include <sys/filedesc.h>
36#include <sys/kernel.h>

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

170 sprintf(device, "%s:%02x:%02x.%x",
171 prefix,
172 dinfo->cfg.bus,
173 dinfo->cfg.slot,
174 dinfo->cfg.func);
175 strcat(new_path, "/");
176 strcat(new_path, device);
177 dir = pfs_create_dir(dir, device,
178 NULL, NULL, 0);
178 NULL, NULL, NULL, 0);
179
180 if (dinfo->cfg.baseclass == PCIC_STORAGE) {
181 /* DJA only make this if needed */
182 sprintf(host, "host%d", host_number++);
183 strcat(new_path, "/");
184 strcat(new_path, host);
185 sub_dir = pfs_create_dir(dir,
179
180 if (dinfo->cfg.baseclass == PCIC_STORAGE) {
181 /* DJA only make this if needed */
182 sprintf(host, "host%d", host_number++);
183 strcat(new_path, "/");
184 strcat(new_path, host);
185 sub_dir = pfs_create_dir(dir,
186 host, NULL, NULL, 0);
186 host, NULL, NULL, NULL, 0);
187 scsi_host = malloc(sizeof(
188 struct scsi_host_queue),
189 M_DEVBUF, M_NOWAIT);
190 scsi_host->path = malloc(
191 strlen(new_path) + 1,
192 M_DEVBUF, M_NOWAIT);
193 scsi_host->path[0] = '\000';
194 bcopy(new_path, scsi_host->path,
195 strlen(new_path) + 1);
196 scsi_host->name = "unknown";
197
198 sub_dir = pfs_create_dir(scsi, host,
187 scsi_host = malloc(sizeof(
188 struct scsi_host_queue),
189 M_DEVBUF, M_NOWAIT);
190 scsi_host->path = malloc(
191 strlen(new_path) + 1,
192 M_DEVBUF, M_NOWAIT);
193 scsi_host->path[0] = '\000';
194 bcopy(new_path, scsi_host->path,
195 strlen(new_path) + 1);
196 scsi_host->name = "unknown";
197
198 sub_dir = pfs_create_dir(scsi, host,
199 NULL, NULL, 0);
199 NULL, NULL, NULL, 0);
200 pfs_create_link(sub_dir, "device",
201 &linsysfs_link_scsi_host,
200 pfs_create_link(sub_dir, "device",
201 &linsysfs_link_scsi_host,
202 NULL, NULL, 0);
202 NULL, NULL, NULL, 0);
203 pfs_create_file(sub_dir, "proc_name",
204 &linsysfs_scsiname,
203 pfs_create_file(sub_dir, "proc_name",
204 &linsysfs_scsiname,
205 NULL, NULL, PFS_RD);
205 NULL, NULL, NULL, PFS_RD);
206 scsi_host->name
207 = linux_driver_get_name_dev(dev);
208 TAILQ_INSERT_TAIL(&scsi_host_q,
209 scsi_host, scsi_host_next);
210 }
211 free(device, M_TEMP);
212 free(host, M_TEMP);
213 }

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

238 devclass_t devclass;
239 device_t dev;
240
241 TAILQ_INIT(&scsi_host_q);
242
243 root = pi->pi_root;
244
245 /* /sys/class/... */
206 scsi_host->name
207 = linux_driver_get_name_dev(dev);
208 TAILQ_INSERT_TAIL(&scsi_host_q,
209 scsi_host, scsi_host_next);
210 }
211 free(device, M_TEMP);
212 free(host, M_TEMP);
213 }

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

238 devclass_t devclass;
239 device_t dev;
240
241 TAILQ_INIT(&scsi_host_q);
242
243 root = pi->pi_root;
244
245 /* /sys/class/... */
246 scsi = pfs_create_dir(root, "class", NULL, NULL, 0);
247 scsi = pfs_create_dir(scsi, "scsi_host", NULL, NULL, 0);
246 scsi = pfs_create_dir(root, "class", NULL, NULL, NULL, 0);
247 scsi = pfs_create_dir(scsi, "scsi_host", NULL, NULL, NULL, 0);
248
249 /* /sys/device */
248
249 /* /sys/device */
250 dir = pfs_create_dir(root, "devices", NULL, NULL, 0);
250 dir = pfs_create_dir(root, "devices", NULL, NULL, NULL, 0);
251
252 /* /sys/device/pci0000:00 */
251
252 /* /sys/device/pci0000:00 */
253 pci = pfs_create_dir(dir, "pci0000:00", NULL, NULL, 0);
253 pci = pfs_create_dir(dir, "pci0000:00", NULL, NULL, NULL, 0);
254
255 devclass = devclass_find("root");
256 if (devclass == NULL) {
257 return (0);
258 }
259
260 dev = devclass_get_device(devclass, 0);
261 linsysfs_run_bus(dev, pci, scsi, "/pci0000:00", "0000");

--- 23 unchanged lines hidden ---
254
255 devclass = devclass_find("root");
256 if (devclass == NULL) {
257 return (0);
258 }
259
260 dev = devclass_get_device(devclass, 0);
261 linsysfs_run_bus(dev, pci, scsi, "/pci0000:00", "0000");

--- 23 unchanged lines hidden ---