linprocfs.c (2694019753ab64ef9bd910886d932c9222ffeb59) | linprocfs.c (060e48824720626ae71cbff2328ec91f4aab1839) |
---|---|
1/*- 2 * Copyright (c) 2000 Dag-Erling Co�dan Sm�rgrav 3 * Copyright (c) 1999 Pierre Beyssac 4 * Copyright (c) 1993 Jan-Simon Pendry 5 * Copyright (c) 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by --- 374 unchanged lines hidden (view full) --- 383 384 /* determine fs type */ 385 fstype = mp->mnt_stat.f_fstypename; 386 if (strcmp(fstype, pn->pn_info->pi_name) == 0) 387 mntfrom = fstype = "proc"; 388 else if (strcmp(fstype, "procfs") == 0) 389 continue; 390 | 1/*- 2 * Copyright (c) 2000 Dag-Erling Co�dan Sm�rgrav 3 * Copyright (c) 1999 Pierre Beyssac 4 * Copyright (c) 1993 Jan-Simon Pendry 5 * Copyright (c) 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by --- 374 unchanged lines hidden (view full) --- 383 384 /* determine fs type */ 385 fstype = mp->mnt_stat.f_fstypename; 386 if (strcmp(fstype, pn->pn_info->pi_name) == 0) 387 mntfrom = fstype = "proc"; 388 else if (strcmp(fstype, "procfs") == 0) 389 continue; 390 |
391 sbuf_printf(sb, "%s %s %s %s", mntfrom, mntto, fstype, 392 mp->mnt_stat.f_flags & MNT_RDONLY ? "ro" : "rw"); | 391 if (strcmp(fstype, "linsysfs") == 0) { 392 sbuf_printf(sb, "/sys %s sysfs %s", mntto, 393 mp->mnt_stat.f_flags & MNT_RDONLY ? "ro" : "rw"); 394 } else { 395 sbuf_printf(sb, "%s %s %s %s", mntfrom, mntto, fstype, 396 mp->mnt_stat.f_flags & MNT_RDONLY ? "ro" : "rw"); 397 } |
393#define ADD_OPTION(opt, name) \ 394 if (mp->mnt_stat.f_flags & (opt)) sbuf_printf(sb, "," name); 395 ADD_OPTION(MNT_SYNCHRONOUS, "sync"); 396 ADD_OPTION(MNT_NOEXEC, "noexec"); 397 ADD_OPTION(MNT_NOSUID, "nosuid"); 398 ADD_OPTION(MNT_UNION, "union"); 399 ADD_OPTION(MNT_ASYNC, "async"); 400 ADD_OPTION(MNT_SUIDDIR, "suiddir"); --- 546 unchanged lines hidden (view full) --- 947 sbuf_printf(sb, "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n", 948 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL); 949 } 950 IFNET_RUNLOCK(); 951 952 return (0); 953} 954 | 398#define ADD_OPTION(opt, name) \ 399 if (mp->mnt_stat.f_flags & (opt)) sbuf_printf(sb, "," name); 400 ADD_OPTION(MNT_SYNCHRONOUS, "sync"); 401 ADD_OPTION(MNT_NOEXEC, "noexec"); 402 ADD_OPTION(MNT_NOSUID, "nosuid"); 403 ADD_OPTION(MNT_UNION, "union"); 404 ADD_OPTION(MNT_ASYNC, "async"); 405 ADD_OPTION(MNT_SUIDDIR, "suiddir"); --- 546 unchanged lines hidden (view full) --- 952 sbuf_printf(sb, "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n", 953 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL); 954 } 955 IFNET_RUNLOCK(); 956 957 return (0); 958} 959 |
955#if 0 | 960/* 961 * Filler function for proc/scsi/device_info 962 */ 963static int 964linprocfs_doscsidevinfo(PFS_FILL_ARGS) 965{ 966 return (0); 967} 968 969/* 970 * Filler function for proc/scsi/scsi 971 */ 972static int 973linprocfs_doscsiscsi(PFS_FILL_ARGS) 974{ 975 return (0); 976} 977 |
956extern struct cdevsw *cdevsw[]; 957 958/* 959 * Filler function for proc/devices 960 */ 961static int 962linprocfs_dodevices(PFS_FILL_ARGS) 963{ | 978extern struct cdevsw *cdevsw[]; 979 980/* 981 * Filler function for proc/devices 982 */ 983static int 984linprocfs_dodevices(PFS_FILL_ARGS) 985{ |
964 int i; 965 | 986 char *char_devices; |
966 sbuf_printf(sb, "Character devices:\n"); 967 | 987 sbuf_printf(sb, "Character devices:\n"); 988 |
968 for (i = 0; i < NUMCDEVSW; i++) 969 if (cdevsw[i] != NULL) 970 sbuf_printf(sb, "%3d %s\n", i, cdevsw[i]->d_name); | 989 char_devices = linux_get_char_devices(); 990 sbuf_printf(sb, "%s", char_devices); 991 linux_free_get_char_devices(char_devices); |
971 972 sbuf_printf(sb, "\nBlock devices:\n"); 973 974 return (0); 975} | 992 993 sbuf_printf(sb, "\nBlock devices:\n"); 994 995 return (0); 996} |
976#endif | |
977 978/* 979 * Filler function for proc/cmdline 980 */ 981static int 982linprocfs_docmdline(PFS_FILL_ARGS) 983{ 984 sbuf_printf(sb, "BOOT_IMAGE=%s", kernelname); --- 29 unchanged lines hidden (view full) --- 1014 1015 root = pi->pi_root; 1016 1017 /* /proc/... */ 1018 pfs_create_file(root, "cmdline", &linprocfs_docmdline, 1019 NULL, NULL, PFS_RD); 1020 pfs_create_file(root, "cpuinfo", &linprocfs_docpuinfo, 1021 NULL, NULL, PFS_RD); | 997 998/* 999 * Filler function for proc/cmdline 1000 */ 1001static int 1002linprocfs_docmdline(PFS_FILL_ARGS) 1003{ 1004 sbuf_printf(sb, "BOOT_IMAGE=%s", kernelname); --- 29 unchanged lines hidden (view full) --- 1034 1035 root = pi->pi_root; 1036 1037 /* /proc/... */ 1038 pfs_create_file(root, "cmdline", &linprocfs_docmdline, 1039 NULL, NULL, PFS_RD); 1040 pfs_create_file(root, "cpuinfo", &linprocfs_docpuinfo, 1041 NULL, NULL, PFS_RD); |
1022#if 0 | |
1023 pfs_create_file(root, "devices", &linprocfs_dodevices, 1024 NULL, NULL, PFS_RD); | 1042 pfs_create_file(root, "devices", &linprocfs_dodevices, 1043 NULL, NULL, PFS_RD); |
1025#endif | |
1026 pfs_create_file(root, "loadavg", &linprocfs_doloadavg, 1027 NULL, NULL, PFS_RD); 1028 pfs_create_file(root, "meminfo", &linprocfs_domeminfo, 1029 NULL, NULL, PFS_RD); 1030#if 0 1031 pfs_create_file(root, "modules", &linprocfs_domodules, 1032 NULL, NULL, PFS_RD); 1033#endif | 1044 pfs_create_file(root, "loadavg", &linprocfs_doloadavg, 1045 NULL, NULL, PFS_RD); 1046 pfs_create_file(root, "meminfo", &linprocfs_domeminfo, 1047 NULL, NULL, PFS_RD); 1048#if 0 1049 pfs_create_file(root, "modules", &linprocfs_domodules, 1050 NULL, NULL, PFS_RD); 1051#endif |
1052 pfs_create_file(root, "mounts", &linprocfs_domtab, 1053 NULL, NULL, PFS_RD); |
|
1034 pfs_create_file(root, "mtab", &linprocfs_domtab, 1035 NULL, NULL, PFS_RD); 1036 pfs_create_link(root, "self", &procfs_docurproc, 1037 NULL, NULL, 0); 1038 pfs_create_file(root, "stat", &linprocfs_dostat, 1039 NULL, NULL, PFS_RD); 1040 pfs_create_file(root, "uptime", &linprocfs_douptime, 1041 NULL, NULL, PFS_RD); --- 23 unchanged lines hidden (view full) --- 1065 NULL, NULL, 0); 1066 pfs_create_file(dir, "stat", &linprocfs_doprocstat, 1067 NULL, NULL, PFS_RD); 1068 pfs_create_file(dir, "statm", &linprocfs_doprocstatm, 1069 NULL, NULL, PFS_RD); 1070 pfs_create_file(dir, "status", &linprocfs_doprocstatus, 1071 NULL, NULL, PFS_RD); 1072 | 1054 pfs_create_file(root, "mtab", &linprocfs_domtab, 1055 NULL, NULL, PFS_RD); 1056 pfs_create_link(root, "self", &procfs_docurproc, 1057 NULL, NULL, 0); 1058 pfs_create_file(root, "stat", &linprocfs_dostat, 1059 NULL, NULL, PFS_RD); 1060 pfs_create_file(root, "uptime", &linprocfs_douptime, 1061 NULL, NULL, PFS_RD); --- 23 unchanged lines hidden (view full) --- 1085 NULL, NULL, 0); 1086 pfs_create_file(dir, "stat", &linprocfs_doprocstat, 1087 NULL, NULL, PFS_RD); 1088 pfs_create_file(dir, "statm", &linprocfs_doprocstatm, 1089 NULL, NULL, PFS_RD); 1090 pfs_create_file(dir, "status", &linprocfs_doprocstatus, 1091 NULL, NULL, PFS_RD); 1092 |
1093 /* /proc/scsi/... */ 1094 dir = pfs_create_dir(root, "scsi", NULL, NULL, 0); 1095 pfs_create_file(dir, "device_info", &linprocfs_doscsidevinfo, 1096 NULL, NULL, PFS_RD); 1097 pfs_create_file(dir, "scsi", &linprocfs_doscsiscsi, 1098 NULL, NULL, PFS_RD); |
|
1073 return (0); 1074} 1075 1076/* 1077 * Destructor 1078 */ 1079static int 1080linprocfs_uninit(PFS_INIT_ARGS) 1081{ 1082 1083 /* nothing to do, pseudofs will GC */ 1084 return (0); 1085} 1086 1087PSEUDOFS(linprocfs, 1); 1088MODULE_DEPEND(linprocfs, linux, 1, 1, 1); 1089MODULE_DEPEND(linprocfs, procfs, 1, 1, 1); | 1099 return (0); 1100} 1101 1102/* 1103 * Destructor 1104 */ 1105static int 1106linprocfs_uninit(PFS_INIT_ARGS) 1107{ 1108 1109 /* nothing to do, pseudofs will GC */ 1110 return (0); 1111} 1112 1113PSEUDOFS(linprocfs, 1); 1114MODULE_DEPEND(linprocfs, linux, 1, 1, 1); 1115MODULE_DEPEND(linprocfs, procfs, 1, 1, 1); |