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
659a58e3
Commit
659a58e3
authored
May 03, 2003
by
Paul Mackerras
Committed by
David S. Miller
May 03, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PPP]: Module owners for ppp compressors.
parent
88827f0d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
55 deletions
+70
-55
drivers/net/bsd_comp.c
drivers/net/bsd_comp.c
+15
-16
drivers/net/ppp_deflate.c
drivers/net/ppp_deflate.c
+30
-28
drivers/net/ppp_generic.c
drivers/net/ppp_generic.c
+20
-11
include/linux/ppp-comp.h
include/linux/ppp-comp.h
+5
-0
No files found.
drivers/net/bsd_comp.c
View file @
659a58e3
...
@@ -348,7 +348,6 @@ static void bsd_free (void *state)
...
@@ -348,7 +348,6 @@ static void bsd_free (void *state)
* Finally release the structure itself.
* Finally release the structure itself.
*/
*/
kfree
(
db
);
kfree
(
db
);
MOD_DEC_USE_COUNT
;
}
}
}
}
...
@@ -422,7 +421,6 @@ static void *bsd_alloc (unsigned char *options, int opt_len, int decomp)
...
@@ -422,7 +421,6 @@ static void *bsd_alloc (unsigned char *options, int opt_len, int decomp)
return
NULL
;
return
NULL
;
}
}
MOD_INC_USE_COUNT
;
/*
/*
* If this is the compression buffer then there is no length data.
* If this is the compression buffer then there is no length data.
*/
*/
...
@@ -1141,20 +1139,21 @@ static int bsd_decompress (void *state, unsigned char *ibuf, int isize,
...
@@ -1141,20 +1139,21 @@ static int bsd_decompress (void *state, unsigned char *ibuf, int isize,
*************************************************************/
*************************************************************/
static
struct
compressor
ppp_bsd_compress
=
{
static
struct
compressor
ppp_bsd_compress
=
{
CI_BSD_COMPRESS
,
/* compress_proto */
.
compress_proto
=
CI_BSD_COMPRESS
,
bsd_comp_alloc
,
/* comp_alloc */
.
comp_alloc
=
bsd_comp_alloc
,
bsd_free
,
/* comp_free */
.
comp_free
=
bsd_free
,
bsd_comp_init
,
/* comp_init */
.
comp_init
=
bsd_comp_init
,
bsd_reset
,
/* comp_reset */
.
comp_reset
=
bsd_reset
,
bsd_compress
,
/* compress */
.
compress
=
bsd_compress
,
bsd_comp_stats
,
/* comp_stat */
.
comp_stat
=
bsd_comp_stats
,
bsd_decomp_alloc
,
/* decomp_alloc */
.
decomp_alloc
=
bsd_decomp_alloc
,
bsd_free
,
/* decomp_free */
.
decomp_free
=
bsd_free
,
bsd_decomp_init
,
/* decomp_init */
.
decomp_init
=
bsd_decomp_init
,
bsd_reset
,
/* decomp_reset */
.
decomp_reset
=
bsd_reset
,
bsd_decompress
,
/* decompress */
.
decompress
=
bsd_decompress
,
bsd_incomp
,
/* incomp */
.
incomp
=
bsd_incomp
,
bsd_comp_stats
/* decomp_stat */
.
decomp_stat
=
bsd_comp_stats
,
.
owner
=
THIS_MODULE
};
};
/*************************************************************
/*************************************************************
...
...
drivers/net/ppp_deflate.c
View file @
659a58e3
...
@@ -541,37 +541,39 @@ extern void ppp_unregister_compressor (struct compressor *cp);
...
@@ -541,37 +541,39 @@ extern void ppp_unregister_compressor (struct compressor *cp);
* Procedures exported to if_ppp.c.
* Procedures exported to if_ppp.c.
*/
*/
struct
compressor
ppp_deflate
=
{
struct
compressor
ppp_deflate
=
{
CI_DEFLATE
,
/* compress_proto */
.
compress_proto
=
CI_DEFLATE
,
z_comp_alloc
,
/* comp_alloc */
.
comp_alloc
=
z_comp_alloc
,
z_comp_free
,
/* comp_free */
.
comp_free
=
z_comp_free
,
z_comp_init
,
/* comp_init */
.
comp_init
=
z_comp_init
,
z_comp_reset
,
/* comp_reset */
.
comp_reset
=
z_comp_reset
,
z_compress
,
/* compress */
.
compress
=
z_compress
,
z_comp_stats
,
/* comp_stat */
.
comp_stat
=
z_comp_stats
,
z_decomp_alloc
,
/* decomp_alloc */
.
decomp_alloc
=
z_decomp_alloc
,
z_decomp_free
,
/* decomp_free */
.
decomp_free
=
z_decomp_free
,
z_decomp_init
,
/* decomp_init */
.
decomp_init
=
z_decomp_init
,
z_decomp_reset
,
/* decomp_reset */
.
decomp_reset
=
z_decomp_reset
,
z_decompress
,
/* decompress */
.
decompress
=
z_decompress
,
z_incomp
,
/* incomp */
.
incomp
=
z_incomp
,
z_comp_stats
,
/* decomp_stat */
.
decomp_stat
=
z_comp_stats
,
.
owner
=
THIS_MODULE
};
};
struct
compressor
ppp_deflate_draft
=
{
struct
compressor
ppp_deflate_draft
=
{
CI_DEFLATE_DRAFT
,
/* compress_proto */
.
compress_proto
=
CI_DEFLATE_DRAFT
,
z_comp_alloc
,
/* comp_alloc */
.
comp_alloc
=
z_comp_alloc
,
z_comp_free
,
/* comp_free */
.
comp_free
=
z_comp_free
,
z_comp_init
,
/* comp_init */
.
comp_init
=
z_comp_init
,
z_comp_reset
,
/* comp_reset */
.
comp_reset
=
z_comp_reset
,
z_compress
,
/* compress */
.
compress
=
z_compress
,
z_comp_stats
,
/* comp_stat */
.
comp_stat
=
z_comp_stats
,
z_decomp_alloc
,
/* decomp_alloc */
.
decomp_alloc
=
z_decomp_alloc
,
z_decomp_free
,
/* decomp_free */
.
decomp_free
=
z_decomp_free
,
z_decomp_init
,
/* decomp_init */
.
decomp_init
=
z_decomp_init
,
z_decomp_reset
,
/* decomp_reset */
.
decomp_reset
=
z_decomp_reset
,
z_decompress
,
/* decompress */
.
decompress
=
z_decompress
,
z_incomp
,
/* incomp */
.
incomp
=
z_incomp
,
z_comp_stats
,
/* decomp_stat */
.
decomp_stat
=
z_comp_stats
,
.
owner
=
THIS_MODULE
};
};
int
__init
deflate_init
(
void
)
int
__init
deflate_init
(
void
)
...
...
drivers/net/ppp_generic.c
View file @
659a58e3
...
@@ -1955,10 +1955,6 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg)
...
@@ -1955,10 +1955,6 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg)
#endif
/* CONFIG_KMOD */
#endif
/* CONFIG_KMOD */
if
(
cp
==
0
)
if
(
cp
==
0
)
goto
out
;
goto
out
;
/*
* XXX race: the compressor module could get unloaded between
* here and when we do the comp_alloc or decomp_alloc call below.
*/
err
=
-
ENOBUFS
;
err
=
-
ENOBUFS
;
if
(
data
.
transmit
)
{
if
(
data
.
transmit
)
{
...
@@ -1971,10 +1967,13 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg)
...
@@ -1971,10 +1967,13 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg)
ppp
->
xcomp
=
cp
;
ppp
->
xcomp
=
cp
;
ppp
->
xc_state
=
state
;
ppp
->
xc_state
=
state
;
ppp_xmit_unlock
(
ppp
);
ppp_xmit_unlock
(
ppp
);
if
(
ostate
!=
0
)
if
(
ostate
!=
0
)
{
ocomp
->
comp_free
(
ostate
);
ocomp
->
comp_free
(
ostate
);
err
=
0
;
module_put
(
ocomp
->
owner
)
;
}
}
err
=
0
;
}
else
module_put
(
cp
->
owner
);
}
else
{
}
else
{
state
=
cp
->
decomp_alloc
(
ccp_option
,
data
.
length
);
state
=
cp
->
decomp_alloc
(
ccp_option
,
data
.
length
);
...
@@ -1986,10 +1985,13 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg)
...
@@ -1986,10 +1985,13 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg)
ppp
->
rcomp
=
cp
;
ppp
->
rcomp
=
cp
;
ppp
->
rc_state
=
state
;
ppp
->
rc_state
=
state
;
ppp_recv_unlock
(
ppp
);
ppp_recv_unlock
(
ppp
);
if
(
ostate
!=
0
)
if
(
ostate
!=
0
)
{
ocomp
->
decomp_free
(
ostate
);
ocomp
->
decomp_free
(
ostate
);
err
=
0
;
module_put
(
ocomp
->
owner
)
;
}
}
err
=
0
;
}
else
module_put
(
cp
->
owner
);
}
}
out:
out:
...
@@ -2100,10 +2102,14 @@ ppp_ccp_closed(struct ppp *ppp)
...
@@ -2100,10 +2102,14 @@ ppp_ccp_closed(struct ppp *ppp)
ppp
->
rc_state
=
0
;
ppp
->
rc_state
=
0
;
ppp_unlock
(
ppp
);
ppp_unlock
(
ppp
);
if
(
xstate
)
if
(
xstate
)
{
xcomp
->
comp_free
(
xstate
);
xcomp
->
comp_free
(
xstate
);
if
(
rstate
)
module_put
(
xcomp
->
owner
);
}
if
(
rstate
)
{
rcomp
->
decomp_free
(
rstate
);
rcomp
->
decomp_free
(
rstate
);
module_put
(
rcomp
->
owner
);
}
}
}
/* List of compressors. */
/* List of compressors. */
...
@@ -2175,8 +2181,11 @@ find_compressor(int type)
...
@@ -2175,8 +2181,11 @@ find_compressor(int type)
spin_lock
(
&
compressor_list_lock
);
spin_lock
(
&
compressor_list_lock
);
ce
=
find_comp_entry
(
type
);
ce
=
find_comp_entry
(
type
);
if
(
ce
!=
0
)
if
(
ce
!=
0
)
{
cp
=
ce
->
comp
;
cp
=
ce
->
comp
;
if
(
!
try_module_get
(
cp
->
owner
))
cp
=
NULL
;
}
spin_unlock
(
&
compressor_list_lock
);
spin_unlock
(
&
compressor_list_lock
);
return
cp
;
return
cp
;
}
}
...
...
include/linux/ppp-comp.h
View file @
659a58e3
...
@@ -42,6 +42,8 @@
...
@@ -42,6 +42,8 @@
#ifndef _NET_PPP_COMP_H
#ifndef _NET_PPP_COMP_H
#define _NET_PPP_COMP_H
#define _NET_PPP_COMP_H
struct
module
;
/*
/*
* The following symbols control whether we include code for
* The following symbols control whether we include code for
* various compression methods.
* various compression methods.
...
@@ -106,6 +108,9 @@ struct compressor {
...
@@ -106,6 +108,9 @@ struct compressor {
/* Return decompression statistics */
/* Return decompression statistics */
void
(
*
decomp_stat
)
(
void
*
state
,
struct
compstat
*
stats
);
void
(
*
decomp_stat
)
(
void
*
state
,
struct
compstat
*
stats
);
/* Used in locking compressor modules */
struct
module
*
owner
;
};
};
/*
/*
...
...
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