Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
30b878b3
Commit
30b878b3
authored
Nov 01, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Compute the removable device flag on the server side.
parent
226a14a4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
22 deletions
+64
-22
server.c
dlls/ntdll/server.c
+1
-8
server_protocol.h
include/wine/server_protocol.h
+1
-2
fd.c
server/fd.c
+61
-9
protocol.def
server/protocol.def
+0
-1
trace.c
server/trace.c
+1
-2
No files found.
dlls/ntdll/server.c
View file @
30b878b3
...
...
@@ -523,20 +523,13 @@ int wine_server_handle_to_fd( obj_handle_t handle, unsigned int access, int *uni
}
assert
(
fd_handle
==
handle
);
if
(
removable
==
-
1
)
{
FILE_FS_DEVICE_INFORMATION
info
;
if
(
FILE_GetDeviceInfo
(
fd
,
&
info
)
==
STATUS_SUCCESS
)
removable
=
(
info
.
Characteristics
&
FILE_REMOVABLE_MEDIA
)
!=
0
;
}
else
if
(
removable
)
goto
done
;
/* don't cache it */
if
(
removable
)
goto
done
;
/* don't cache it */
/* and store it back into the cache */
SERVER_START_REQ
(
set_handle_fd
)
{
req
->
handle
=
fd_handle
;
req
->
fd
=
fd
;
req
->
removable
=
removable
;
if
(
!
(
ret
=
wine_server_call
(
req
)))
{
if
(
reply
->
cur_fd
!=
-
1
)
/* it has been cached */
...
...
include/wine/server_protocol.h
View file @
30b878b3
...
...
@@ -861,7 +861,6 @@ struct set_handle_fd_request
struct
request_header
__header
;
obj_handle_t
handle
;
int
fd
;
int
removable
;
};
struct
set_handle_fd_reply
{
...
...
@@ -4426,6 +4425,6 @@ union generic_reply
struct
query_symlink_reply
query_symlink_reply
;
};
#define SERVER_PROTOCOL_VERSION 25
5
#define SERVER_PROTOCOL_VERSION 25
6
#endif
/* __WINE_WINE_SERVER_PROTOCOL_H */
server/fd.c
View file @
30b878b3
...
...
@@ -37,6 +37,21 @@
#ifdef HAVE_SYS_POLL_H
#include <sys/poll.h>
#endif
#ifdef HAVE_LINUX_MAJOR_H
#include <linux/major.h>
#endif
#ifdef HAVE_SYS_STATVFS_H
#include <sys/statvfs.h>
#endif
#ifdef HAVE_SYS_VFS_H
#include <sys/vfs.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h>
#endif
#ifdef HAVE_SYS_EVENT_H
#include <sys/event.h>
#undef LIST_INIT
...
...
@@ -722,8 +737,47 @@ void main_loop(void)
static
struct
list
device_hash
[
DEVICE_HASH_SIZE
];
static
int
is_device_removable
(
dev_t
dev
,
int
unix_fd
)
{
#if defined(linux) && defined(HAVE_FSTATFS)
struct
statfs
stfs
;
/* check for floppy disk */
if
(
major
(
dev
)
==
FLOPPY_MAJOR
)
return
1
;
if
(
fstatfs
(
unix_fd
,
&
stfs
)
==
-
1
)
return
0
;
return
(
stfs
.
f_type
==
0x9660
||
/* iso9660 */
stfs
.
f_type
==
0x9fa1
||
/* supermount */
stfs
.
f_type
==
0x15013346
);
/* udf */
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__)
struct
statfs
stfs
;
if
(
fstatfs
(
unix_fd
,
&
stfs
)
==
-
1
)
return
0
;
return
(
!
strncmp
(
"cd9660"
,
stfs
.
f_fstypename
,
sizeof
(
stfs
.
f_fstypename
))
||
!
strncmp
(
"udf"
,
stfs
.
f_fstypename
,
sizeof
(
stfs
.
f_fstypename
)));
#elif defined(__NetBSD__)
struct
statvfs
stfs
;
if
(
fstatvfs
(
unix_fd
,
&
stfs
)
==
-
1
)
return
0
;
return
(
!
strncmp
(
"cd9660"
,
stfs
.
f_fstypename
,
sizeof
(
stfs
.
f_fstypename
))
||
!
strncmp
(
"udf"
,
stfs
.
f_fstypename
,
sizeof
(
stfs
.
f_fstypename
)));
#elif defined(sun)
# include <sys/dkio.h>
# include <sys/vtoc.h>
struct
dk_cinfo
dkinf
;
if
(
ioctl
(
unix_fd
,
DKIOCINFO
,
&
dkinf
)
==
-
1
)
return
0
;
return
(
dkinf
.
dki_ctype
==
DKC_CDROM
||
dkinf
.
dki_ctype
==
DKC_NCRFLOPPY
||
dkinf
.
dki_ctype
==
DKC_SMSFLOPPY
||
dkinf
.
dki_ctype
==
DKC_INTEL82072
||
dkinf
.
dki_ctype
==
DKC_INTEL82077
);
#else
return
0
;
#endif
}
/* retrieve the device object for a given fd, creating it if needed */
static
struct
device
*
get_device
(
dev_t
dev
,
int
create
)
static
struct
device
*
get_device
(
dev_t
dev
,
int
unix_fd
)
{
struct
device
*
device
;
unsigned
int
i
,
hash
=
dev
%
DEVICE_HASH_SIZE
;
...
...
@@ -737,11 +791,11 @@ static struct device *get_device( dev_t dev, int create )
/* not found, create it */
if
(
!
create
)
return
NULL
;
if
(
unix_fd
==
-
1
)
return
NULL
;
if
((
device
=
alloc_object
(
&
device_ops
)))
{
device
->
dev
=
dev
;
device
->
removable
=
-
1
;
device
->
removable
=
is_device_removable
(
dev
,
unix_fd
)
;
for
(
i
=
0
;
i
<
INODE_HASH_SIZE
;
i
++
)
list_init
(
&
device
->
inode_hash
[
i
]
);
list_add_head
(
&
device_hash
[
hash
],
&
device
->
entry
);
}
...
...
@@ -834,13 +888,13 @@ static void inode_destroy( struct object *obj )
}
/* retrieve the inode object for a given fd, creating it if needed */
static
struct
inode
*
get_inode
(
dev_t
dev
,
ino_t
ino
)
static
struct
inode
*
get_inode
(
dev_t
dev
,
ino_t
ino
,
int
unix_fd
)
{
struct
device
*
device
;
struct
inode
*
inode
;
unsigned
int
hash
=
ino
%
INODE_HASH_SIZE
;
if
(
!
(
device
=
get_device
(
dev
,
1
)))
return
NULL
;
if
(
!
(
device
=
get_device
(
dev
,
unix_fd
)))
return
NULL
;
LIST_FOR_EACH_ENTRY
(
inode
,
&
device
->
inode_hash
[
hash
],
struct
inode
,
entry
)
{
...
...
@@ -1508,7 +1562,7 @@ struct fd *open_fd( const char *name, int flags, mode_t *mode, unsigned int acce
/* only bother with an inode for normal files and directories */
if
(
S_ISREG
(
st
.
st_mode
)
||
S_ISDIR
(
st
.
st_mode
))
{
struct
inode
*
inode
=
get_inode
(
st
.
st_dev
,
st
.
st_ino
);
struct
inode
*
inode
=
get_inode
(
st
.
st_dev
,
st
.
st_ino
,
fd
->
unix_fd
);
if
(
!
inode
)
{
...
...
@@ -1808,7 +1862,7 @@ static void unmount_device( struct fd *device_fd )
return
;
}
if
(
!
(
device
=
get_device
(
st
.
st_rdev
,
0
)))
return
;
if
(
!
(
device
=
get_device
(
st
.
st_rdev
,
-
1
)))
return
;
for
(
i
=
0
;
i
<
INODE_HASH_SIZE
;
i
++
)
{
...
...
@@ -1917,8 +1971,6 @@ DECL_HANDLER(set_handle_fd)
{
struct
device
*
device
=
fd
->
inode
?
fd
->
inode
->
device
:
NULL
;
if
(
device
&&
device
->
removable
==
-
1
)
device
->
removable
=
req
->
removable
;
/* only cache the fd on non-removable devices */
if
(
!
device
||
!
device
->
removable
)
reply
->
cur_fd
=
set_handle_unix_fd
(
current
->
process
,
req
->
handle
,
req
->
fd
);
...
...
server/protocol.def
View file @
30b878b3
...
...
@@ -677,7 +677,6 @@ enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
@REQ(set_handle_fd)
obj_handle_t handle; /* handle we are interested in */
int fd; /* file descriptor */
int removable; /* is device removable? (-1 if unknown) */
@REPLY
int cur_fd; /* current file descriptor */
@END
...
...
server/trace.c
View file @
30b878b3
...
...
@@ -1116,8 +1116,7 @@ static void dump_get_handle_fd_reply( const struct get_handle_fd_reply *req )
static
void
dump_set_handle_fd_request
(
const
struct
set_handle_fd_request
*
req
)
{
fprintf
(
stderr
,
" handle=%p,"
,
req
->
handle
);
fprintf
(
stderr
,
" fd=%d,"
,
req
->
fd
);
fprintf
(
stderr
,
" removable=%d"
,
req
->
removable
);
fprintf
(
stderr
,
" fd=%d"
,
req
->
fd
);
}
static
void
dump_set_handle_fd_reply
(
const
struct
set_handle_fd_reply
*
req
)
...
...
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