Commit c1325424 authored by Alexandre Julliard's avatar Alexandre Julliard

Renamed fd to unix_fd in the closed_fd structure to make the code a

bit clearer.
parent 88e3669b
...@@ -126,7 +126,7 @@ static inline int epoll_wait( int epfd, struct epoll_event *events, int maxevent ...@@ -126,7 +126,7 @@ static inline int epoll_wait( int epfd, struct epoll_event *events, int maxevent
struct closed_fd struct closed_fd
{ {
struct list entry; /* entry in inode closed list */ struct list entry; /* entry in inode closed list */
int fd; /* the unix file descriptor */ int unix_fd; /* the unix file descriptor */
char unlink[1]; /* name to unlink on close (if any) */ char unlink[1]; /* name to unlink on close (if any) */
}; };
...@@ -560,10 +560,10 @@ static void inode_close_pending( struct inode *inode ) ...@@ -560,10 +560,10 @@ static void inode_close_pending( struct inode *inode )
struct closed_fd *fd = LIST_ENTRY( ptr, struct closed_fd, entry ); struct closed_fd *fd = LIST_ENTRY( ptr, struct closed_fd, entry );
struct list *next = list_next( &inode->closed, ptr ); struct list *next = list_next( &inode->closed, ptr );
if (fd->fd != -1) if (fd->unix_fd != -1)
{ {
close( fd->fd ); close( fd->unix_fd );
fd->fd = -1; fd->unix_fd = -1;
} }
if (!fd->unlink) /* get rid of it unless there's an unlink pending on that file */ if (!fd->unlink) /* get rid of it unless there's an unlink pending on that file */
{ {
...@@ -599,7 +599,7 @@ static void inode_destroy( struct object *obj ) ...@@ -599,7 +599,7 @@ static void inode_destroy( struct object *obj )
{ {
struct closed_fd *fd = LIST_ENTRY( ptr, struct closed_fd, entry ); struct closed_fd *fd = LIST_ENTRY( ptr, struct closed_fd, entry );
list_remove( ptr ); list_remove( ptr );
if (fd->fd != -1) close( fd->fd ); if (fd->unix_fd != -1) close( fd->unix_fd );
if (fd->unlink[0]) if (fd->unlink[0])
{ {
/* make sure it is still the same file */ /* make sure it is still the same file */
...@@ -646,7 +646,7 @@ static struct inode *get_inode( dev_t dev, ino_t ino ) ...@@ -646,7 +646,7 @@ static struct inode *get_inode( dev_t dev, ino_t ino )
return inode; return inode;
} }
/* add fd to the indoe list of file descriptors to close */ /* add fd to the inode list of file descriptors to close */
static void inode_add_closed_fd( struct inode *inode, struct closed_fd *fd ) static void inode_add_closed_fd( struct inode *inode, struct closed_fd *fd )
{ {
if (!list_empty( &inode->locks )) if (!list_empty( &inode->locks ))
...@@ -655,13 +655,13 @@ static void inode_add_closed_fd( struct inode *inode, struct closed_fd *fd ) ...@@ -655,13 +655,13 @@ static void inode_add_closed_fd( struct inode *inode, struct closed_fd *fd )
} }
else if (fd->unlink[0]) /* close the fd but keep the structure around for unlink */ else if (fd->unlink[0]) /* close the fd but keep the structure around for unlink */
{ {
close( fd->fd ); if (fd->unix_fd != -1) close( fd->unix_fd );
fd->fd = -1; fd->unix_fd = -1;
list_add_head( &inode->closed, &fd->entry ); list_add_head( &inode->closed, &fd->entry );
} }
else /* no locks on this inode and no unlink, get rid of the fd */ else /* no locks on this inode and no unlink, get rid of the fd */
{ {
close( fd->fd ); if (fd->unix_fd != -1) close( fd->unix_fd );
free( fd ); free( fd );
} }
} }
...@@ -1217,7 +1217,7 @@ struct fd *open_fd( struct fd *fd, const char *name, int flags, mode_t *mode, ...@@ -1217,7 +1217,7 @@ struct fd *open_fd( struct fd *fd, const char *name, int flags, mode_t *mode,
free( closed_fd ); free( closed_fd );
return NULL; return NULL;
} }
closed_fd->fd = fd->unix_fd; closed_fd->unix_fd = fd->unix_fd;
closed_fd->unlink[0] = 0; closed_fd->unlink[0] = 0;
fstat( fd->unix_fd, &st ); fstat( fd->unix_fd, &st );
*mode = st.st_mode; *mode = st.st_mode;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment