diff options
author | ambrisko <ambrisko@FreeBSD.org> | 2006-05-05 16:10:45 +0000 |
---|---|---|
committer | ambrisko <ambrisko@FreeBSD.org> | 2006-05-05 16:10:45 +0000 |
commit | 31b22ce0171d5f314ab71ecfdc903cd5b4abff7c (patch) | |
tree | c811b5cf32301e6302a0ae1c83535f7a7e3ba038 /sys/compat/linprocfs | |
parent | 1075788769bc1869a86b8413188a63dca0c3f9ad (diff) | |
download | FreeBSD-src-31b22ce0171d5f314ab71ecfdc903cd5b4abff7c.zip FreeBSD-src-31b22ce0171d5f314ab71ecfdc903cd5b4abff7c.tar.gz |
Enhance the Linux emulation layer to make MegaRAID SAS managements tool happy.
Add back in a scheme to emulate old type major/minor numbers via hooks into
stat, linprocfs to return major/minors that Linux app's expect. Currently
only /dev/null is always registered. Drivers can register via the Linux
type shim similar to the ioctl shim but by using
linux_device_register_handler/linux_device_unregister_handler functions.
The structure is:
struct linux_device_handler {
char *bsd_driver_name;
char *linux_driver_name;
char *bsd_device_name;
char *linux_device_name;
int linux_major;
int linux_minor;
int linux_char_device;
};
Linprocfs uses this to display the major number of the driver. The
soon to be available linsysfs will use it to fill in the driver name.
Linux_stat uses it to translate the major/minor into Linux type values.
Note major numbers are dynamically assigned via passing in a -1 for
the major number so we don't need to keep track of them.
This is somewhat needed due to us switching to our devfs. MegaCli
will not run until I add in the linsysfs and mfi Linux compat changes.
Sponsored by: IronPort Systems
Diffstat (limited to 'sys/compat/linprocfs')
-rw-r--r-- | sys/compat/linprocfs/linprocfs.c | 48 |
1 files changed, 37 insertions, 11 deletions
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index b1d0f8a..049f36c 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -388,8 +388,13 @@ linprocfs_domtab(PFS_FILL_ARGS) else if (strcmp(fstype, "procfs") == 0) continue; - sbuf_printf(sb, "%s %s %s %s", mntfrom, mntto, fstype, - mp->mnt_stat.f_flags & MNT_RDONLY ? "ro" : "rw"); + if (strcmp(fstype, "linsysfs") == 0) { + sbuf_printf(sb, "/sys %s sysfs %s", mntto, + mp->mnt_stat.f_flags & MNT_RDONLY ? "ro" : "rw"); + } else { + sbuf_printf(sb, "%s %s %s %s", mntfrom, mntto, fstype, + mp->mnt_stat.f_flags & MNT_RDONLY ? "ro" : "rw"); + } #define ADD_OPTION(opt, name) \ if (mp->mnt_stat.f_flags & (opt)) sbuf_printf(sb, "," name); ADD_OPTION(MNT_SYNCHRONOUS, "sync"); @@ -952,7 +957,24 @@ linprocfs_donetdev(PFS_FILL_ARGS) return (0); } -#if 0 +/* + * Filler function for proc/scsi/device_info + */ +static int +linprocfs_doscsidevinfo(PFS_FILL_ARGS) +{ + return (0); +} + +/* + * Filler function for proc/scsi/scsi + */ +static int +linprocfs_doscsiscsi(PFS_FILL_ARGS) +{ + return (0); +} + extern struct cdevsw *cdevsw[]; /* @@ -961,19 +983,17 @@ extern struct cdevsw *cdevsw[]; static int linprocfs_dodevices(PFS_FILL_ARGS) { - int i; - + char *char_devices; sbuf_printf(sb, "Character devices:\n"); - for (i = 0; i < NUMCDEVSW; i++) - if (cdevsw[i] != NULL) - sbuf_printf(sb, "%3d %s\n", i, cdevsw[i]->d_name); + char_devices = linux_get_char_devices(); + sbuf_printf(sb, "%s", char_devices); + linux_free_get_char_devices(char_devices); sbuf_printf(sb, "\nBlock devices:\n"); return (0); } -#endif /* * Filler function for proc/cmdline @@ -1019,10 +1039,8 @@ linprocfs_init(PFS_INIT_ARGS) NULL, NULL, PFS_RD); pfs_create_file(root, "cpuinfo", &linprocfs_docpuinfo, NULL, NULL, PFS_RD); -#if 0 pfs_create_file(root, "devices", &linprocfs_dodevices, NULL, NULL, PFS_RD); -#endif pfs_create_file(root, "loadavg", &linprocfs_doloadavg, NULL, NULL, PFS_RD); pfs_create_file(root, "meminfo", &linprocfs_domeminfo, @@ -1031,6 +1049,8 @@ linprocfs_init(PFS_INIT_ARGS) pfs_create_file(root, "modules", &linprocfs_domodules, NULL, NULL, PFS_RD); #endif + pfs_create_file(root, "mounts", &linprocfs_domtab, + NULL, NULL, PFS_RD); pfs_create_file(root, "mtab", &linprocfs_domtab, NULL, NULL, PFS_RD); pfs_create_link(root, "self", &procfs_docurproc, @@ -1070,6 +1090,12 @@ linprocfs_init(PFS_INIT_ARGS) pfs_create_file(dir, "status", &linprocfs_doprocstatus, NULL, NULL, PFS_RD); + /* /proc/scsi/... */ + dir = pfs_create_dir(root, "scsi", NULL, NULL, 0); + pfs_create_file(dir, "device_info", &linprocfs_doscsidevinfo, + NULL, NULL, PFS_RD); + pfs_create_file(dir, "scsi", &linprocfs_doscsiscsi, + NULL, NULL, PFS_RD); return (0); } |