Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
f144c7fc
Commit
f144c7fc
authored
Oct 29, 2002
by
Jeff Garzik
Browse files
Options
Browse Files
Download
Plain Diff
Merge redhat.com:/home/jgarzik/repo/linus-2.5
into redhat.com:/home/jgarzik/repo/misc-2.5
parents
22dda8bf
697eaec7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
37 deletions
+90
-37
fs/proc/proc_misc.c
fs/proc/proc_misc.c
+13
-8
mm/swapfile.c
mm/swapfile.c
+77
-29
No files found.
fs/proc/proc_misc.c
View file @
f144c7fc
...
@@ -296,6 +296,18 @@ static struct file_operations proc_partitions_operations = {
...
@@ -296,6 +296,18 @@ static struct file_operations proc_partitions_operations = {
.
release
=
seq_release
,
.
release
=
seq_release
,
};
};
extern
struct
seq_operations
swaps_op
;
static
int
swaps_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
seq_open
(
file
,
&
swaps_op
);
}
static
struct
file_operations
proc_swaps_operations
=
{
.
open
=
swaps_open
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
seq_release
,
};
#ifdef CONFIG_MODULES
#ifdef CONFIG_MODULES
extern
struct
seq_operations
modules_op
;
extern
struct
seq_operations
modules_op
;
static
int
modules_open
(
struct
inode
*
inode
,
struct
file
*
file
)
static
int
modules_open
(
struct
inode
*
inode
,
struct
file
*
file
)
...
@@ -508,13 +520,6 @@ static int execdomains_read_proc(char *page, char **start, off_t off,
...
@@ -508,13 +520,6 @@ static int execdomains_read_proc(char *page, char **start, off_t off,
return
proc_calc_metrics
(
page
,
start
,
off
,
count
,
eof
,
len
);
return
proc_calc_metrics
(
page
,
start
,
off
,
count
,
eof
,
len
);
}
}
static
int
swaps_read_proc
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
int
len
=
get_swaparea_info
(
page
);
return
proc_calc_metrics
(
page
,
start
,
off
,
count
,
eof
,
len
);
}
static
int
memory_read_proc
(
char
*
page
,
char
**
start
,
off_t
off
,
static
int
memory_read_proc
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
int
count
,
int
*
eof
,
void
*
data
)
{
{
...
@@ -621,7 +626,6 @@ void __init proc_misc_init(void)
...
@@ -621,7 +626,6 @@ void __init proc_misc_init(void)
{
"rtc"
,
ds1286_read_proc
},
{
"rtc"
,
ds1286_read_proc
},
#endif
#endif
{
"locks"
,
locks_read_proc
},
{
"locks"
,
locks_read_proc
},
{
"swaps"
,
swaps_read_proc
},
{
"iomem"
,
memory_read_proc
},
{
"iomem"
,
memory_read_proc
},
{
"execdomains"
,
execdomains_read_proc
},
{
"execdomains"
,
execdomains_read_proc
},
{
NULL
,}
{
NULL
,}
...
@@ -637,6 +641,7 @@ void __init proc_misc_init(void)
...
@@ -637,6 +641,7 @@ void __init proc_misc_init(void)
entry
->
proc_fops
=
&
proc_kmsg_operations
;
entry
->
proc_fops
=
&
proc_kmsg_operations
;
create_seq_entry
(
"cpuinfo"
,
0
,
&
proc_cpuinfo_operations
);
create_seq_entry
(
"cpuinfo"
,
0
,
&
proc_cpuinfo_operations
);
create_seq_entry
(
"partitions"
,
0
,
&
proc_partitions_operations
);
create_seq_entry
(
"partitions"
,
0
,
&
proc_partitions_operations
);
create_seq_entry
(
"swaps"
,
0
,
&
proc_swaps_operations
);
#if !defined(CONFIG_ARCH_S390)
#if !defined(CONFIG_ARCH_S390)
create_seq_entry
(
"interrupts"
,
0
,
&
proc_interrupts_operations
);
create_seq_entry
(
"interrupts"
,
0
,
&
proc_interrupts_operations
);
#endif
#endif
...
...
mm/swapfile.c
View file @
f144c7fc
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
* Swap reorganised 29.12.95, Stephen Tweedie
* Swap reorganised 29.12.95, Stephen Tweedie
*/
*/
#include <linux/config.h>
#include <linux/mm.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/kernel_stat.h>
#include <linux/kernel_stat.h>
...
@@ -15,6 +16,7 @@
...
@@ -15,6 +16,7 @@
#include <linux/shm.h>
#include <linux/shm.h>
#include <linux/blkdev.h>
#include <linux/blkdev.h>
#include <linux/buffer_head.h>
#include <linux/buffer_head.h>
#include <linux/seq_file.h>
#include <asm/pgtable.h>
#include <asm/pgtable.h>
#include <linux/swapops.h>
#include <linux/swapops.h>
...
@@ -1041,46 +1043,92 @@ asmlinkage long sys_swapoff(const char * specialfile)
...
@@ -1041,46 +1043,92 @@ asmlinkage long sys_swapoff(const char * specialfile)
return
err
;
return
err
;
}
}
int
get_swaparea_info
(
char
*
buf
)
#ifdef CONFIG_PROC_FS
/* iterator */
static
void
*
swap_start
(
struct
seq_file
*
swap
,
loff_t
*
pos
)
{
{
char
*
page
=
(
char
*
)
__get_free_page
(
GFP_KERNEL
);
struct
swap_info_struct
*
ptr
=
swap_info
;
struct
swap_info_struct
*
ptr
=
swap_info
;
int
i
,
len
;
int
i
;
loff_t
l
=
*
pos
;
char
*
page
=
(
char
*
)
__get_free_page
(
GFP_KERNEL
);
if
(
!
page
)
swap
->
private
=
page
;
/* save for swap_show */
return
-
ENOMEM
;
swap_list_lock
()
;
len
=
sprintf
(
buf
,
"Filename
\t\t\t\t
Type
\t\t
Size
\t
Used
\t
Priority
\n
"
);
if
(
!
page
)
for
(
i
=
0
;
i
<
nr_swapfiles
;
i
++
,
ptr
++
)
{
return
ERR_PTR
(
-
ENOMEM
);
int
j
,
usedswap
;
struct
file
*
file
;
char
*
path
;
for
(
i
=
0
;
i
<
nr_swapfiles
;
i
++
,
ptr
++
)
{
if
(
!
(
ptr
->
flags
&
SWP_USED
)
||
!
ptr
->
swap_map
)
if
(
!
(
ptr
->
flags
&
SWP_USED
)
||
!
ptr
->
swap_map
)
continue
;
continue
;
if
(
!
l
--
)
return
ptr
;
}
file
=
ptr
->
swap_file
;
return
NULL
;
path
=
d_path
(
file
->
f_dentry
,
file
->
f_vfsmnt
,
page
,
PAGE_SIZE
);
}
for
(
j
=
0
,
usedswap
=
0
;
j
<
ptr
->
max
;
++
j
)
switch
(
ptr
->
swap_map
[
j
])
{
static
void
*
swap_next
(
struct
seq_file
*
swap
,
void
*
v
,
loff_t
*
pos
)
case
SWAP_MAP_BAD
:
{
case
0
:
struct
swap_info_struct
*
ptr
=
v
;
continue
;
void
*
endptr
=
(
void
*
)
swap_info
+
nr_swapfiles
*
sizeof
(
struct
swap_info_struct
);
default:
usedswap
++
;
for
(
++
ptr
;
ptr
<
(
struct
swap_info_struct
*
)
endptr
;
ptr
++
)
{
}
if
(
!
(
ptr
->
flags
&
SWP_USED
)
||
!
ptr
->
swap_map
)
len
+=
sprintf
(
buf
+
len
,
"%-39s %s
\t
%d
\t
%d
\t
%d
\n
"
,
continue
;
path
,
++*
pos
;
S_ISBLK
(
file
->
f_dentry
->
d_inode
->
i_mode
)
?
return
ptr
;
"partition"
:
"file
\t
"
,
ptr
->
pages
<<
(
PAGE_SHIFT
-
10
),
usedswap
<<
(
PAGE_SHIFT
-
10
),
ptr
->
prio
);
}
}
free_page
((
unsigned
long
)
page
);
return
len
;
return
NULL
;
}
}
static
void
swap_stop
(
struct
seq_file
*
swap
,
void
*
v
)
{
swap_list_unlock
();
free_page
((
unsigned
long
)
swap
->
private
);
swap
->
private
=
NULL
;
}
static
int
swap_show
(
struct
seq_file
*
swap
,
void
*
v
)
{
struct
swap_info_struct
*
ptr
=
v
;
int
j
,
usedswap
;
struct
file
*
file
;
char
*
path
;
if
(
v
==
swap_info
)
seq_puts
(
swap
,
"Filename
\t\t\t\t
Type
\t\t
Size
\t
Used
\t
Priority
\n
"
);
file
=
ptr
->
swap_file
;
path
=
d_path
(
file
->
f_dentry
,
file
->
f_vfsmnt
,
swap
->
private
,
PAGE_SIZE
);
for
(
j
=
0
,
usedswap
=
0
;
j
<
ptr
->
max
;
++
j
)
switch
(
ptr
->
swap_map
[
j
])
{
case
SWAP_MAP_BAD
:
case
0
:
continue
;
default:
usedswap
++
;
}
seq_printf
(
swap
,
"%-39s %s
\t
%d
\t
%d
\t
%d
\n
"
,
path
,
S_ISBLK
(
file
->
f_dentry
->
d_inode
->
i_mode
)
?
"partition"
:
"file
\t
"
,
ptr
->
pages
<<
(
PAGE_SHIFT
-
10
),
usedswap
<<
(
PAGE_SHIFT
-
10
),
ptr
->
prio
);
return
0
;
}
struct
seq_operations
swaps_op
=
{
.
start
=
swap_start
,
.
next
=
swap_next
,
.
stop
=
swap_stop
,
.
show
=
swap_show
};
#endif
/* CONFIG_PROC_FS */
/*
/*
* Written 01/25/92 by Simmule Turner, heavily changed by Linus.
* Written 01/25/92 by Simmule Turner, heavily changed by Linus.
*
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment