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
61edcb8b
Commit
61edcb8b
authored
Oct 03, 2003
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] USB: convert usbfs to use new fs parser code.
parent
1c321b9f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
67 deletions
+76
-67
drivers/usb/core/inode.c
drivers/usb/core/inode.c
+76
-67
No files found.
drivers/usb/core/inode.c
View file @
61edcb8b
...
...
@@ -38,6 +38,7 @@
#include <linux/namei.h>
#include <linux/usbdevice_fs.h>
#include <linux/smp_lock.h>
#include <linux/parser.h>
#include <asm/byteorder.h>
static
struct
super_operations
usbfs_ops
;
...
...
@@ -62,76 +63,87 @@ static umode_t devmode = S_IWUSR | S_IRUGO;
static
umode_t
busmode
=
S_IXUGO
|
S_IRUGO
;
static
umode_t
listmode
=
S_IRUGO
;
enum
{
Opt_devuid
,
Opt_devgid
,
Opt_devmode
,
Opt_busuid
,
Opt_busgid
,
Opt_busmode
,
Opt_listuid
,
Opt_listgid
,
Opt_listmode
,
Opt_err
,
};
static
match_table_t
tokens
=
{
{
Opt_devuid
,
"devuid=%u"
},
{
Opt_devgid
,
"devgid=%u"
},
{
Opt_devmode
,
"devmode=%o"
},
{
Opt_busuid
,
"busuid=%u"
},
{
Opt_busgid
,
"busgid=%u"
},
{
Opt_busmode
,
"busmode=%o"
},
{
Opt_listuid
,
"listuid=%u"
},
{
Opt_listgid
,
"listgid=%u"
},
{
Opt_listmode
,
"listmode=%o"
},
{
Opt_err
,
NULL
}
};
static
int
parse_options
(
struct
super_block
*
s
,
char
*
data
)
{
char
*
curopt
=
NULL
,
*
value
;
char
*
p
;
int
option
;
while
((
curopt
=
strsep
(
&
data
,
","
))
!=
NULL
)
{
if
(
!*
curopt
)
while
((
p
=
strsep
(
&
data
,
","
))
!=
NULL
)
{
substring_t
args
[
MAX_OPT_ARGS
];
int
token
;
if
(
!*
p
)
continue
;
if
((
value
=
strchr
(
curopt
,
'='
))
!=
NULL
)
*
value
++
=
0
;
if
(
!
strcmp
(
curopt
,
"devuid"
))
{
if
(
!
value
||
!
value
[
0
])
return
-
EINVAL
;
devuid
=
simple_strtoul
(
value
,
&
value
,
0
);
if
(
*
value
)
return
-
EINVAL
;
}
if
(
!
strcmp
(
curopt
,
"devgid"
))
{
if
(
!
value
||
!
value
[
0
])
return
-
EINVAL
;
devgid
=
simple_strtoul
(
value
,
&
value
,
0
);
if
(
*
value
)
return
-
EINVAL
;
}
if
(
!
strcmp
(
curopt
,
"devmode"
))
{
if
(
!
value
||
!
value
[
0
])
return
-
EINVAL
;
devmode
=
simple_strtoul
(
value
,
&
value
,
0
)
&
S_IRWXUGO
;
if
(
*
value
)
return
-
EINVAL
;
}
if
(
!
strcmp
(
curopt
,
"busuid"
))
{
if
(
!
value
||
!
value
[
0
])
return
-
EINVAL
;
busuid
=
simple_strtoul
(
value
,
&
value
,
0
);
if
(
*
value
)
return
-
EINVAL
;
}
if
(
!
strcmp
(
curopt
,
"busgid"
))
{
if
(
!
value
||
!
value
[
0
])
token
=
match_token
(
p
,
tokens
,
args
);
switch
(
token
)
{
case
Opt_devuid
:
if
(
match_int
(
&
args
[
0
],
&
option
))
return
-
EINVAL
;
busgid
=
simple_strtoul
(
value
,
&
value
,
0
);
if
(
*
value
)
devuid
=
option
;
break
;
case
Opt_devgid
:
if
(
match_int
(
&
args
[
0
],
&
option
))
return
-
EINVAL
;
}
if
(
!
strcmp
(
curopt
,
"busmode"
))
{
if
(
!
value
||
!
value
[
0
])
devgid
=
option
;
break
;
case
Opt_devmode
:
if
(
match_octal
(
&
args
[
0
],
&
option
))
return
-
EINVAL
;
busmode
=
simple_strtoul
(
value
,
&
value
,
0
)
&
S_IRWXUGO
;
if
(
*
value
)
devmode
=
option
&
S_IRWXUGO
;
break
;
case
Opt_busuid
:
if
(
match_int
(
&
args
[
0
],
&
option
))
return
-
EINVAL
;
}
if
(
!
strcmp
(
curopt
,
"listuid"
))
{
if
(
!
value
||
!
value
[
0
])
busuid
=
option
;
break
;
case
Opt_busgid
:
if
(
match_int
(
&
args
[
0
],
&
option
))
return
-
EINVAL
;
listuid
=
simple_strtoul
(
value
,
&
value
,
0
);
if
(
*
value
)
busgid
=
option
;
break
;
case
Opt_busmode
:
if
(
match_octal
(
&
args
[
0
],
&
option
))
return
-
EINVAL
;
}
if
(
!
strcmp
(
curopt
,
"listgid"
))
{
if
(
!
value
||
!
value
[
0
])
busmode
=
option
&
S_IRWXUGO
;
break
;
case
Opt_listuid
:
if
(
match_int
(
&
args
[
0
],
&
option
))
return
-
EINVAL
;
listgid
=
simple_strtoul
(
value
,
&
value
,
0
);
if
(
*
value
)
listuid
=
option
;
break
;
case
Opt_listgid
:
if
(
match_int
(
&
args
[
0
],
&
option
))
return
-
EINVAL
;
}
if
(
!
strcmp
(
curopt
,
"listmode"
))
{
if
(
!
value
||
!
value
[
0
])
listgid
=
option
;
break
;
case
Opt_listmode
:
if
(
match_octal
(
&
args
[
0
],
&
option
))
return
-
EINVAL
;
listmode
=
simple_strtoul
(
value
,
&
value
,
0
)
&
S_IRWXUGO
;
if
(
*
value
)
listmode
=
option
&
S_IRWXUGO
;
break
;
default:
err
(
"usbfs: unrecognised mount option
\"
%s
\"
"
"or missing value
\n
"
,
p
);
return
-
EINVAL
;
}
}
...
...
@@ -139,9 +151,6 @@ static int parse_options(struct super_block *s, char *data)
return
0
;
}
/* --------------------------------------------------------------------- */
static
struct
inode
*
usbfs_get_inode
(
struct
super_block
*
sb
,
int
mode
,
dev_t
dev
)
{
struct
inode
*
inode
=
new_inode
(
sb
);
...
...
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