From: David van Moolenbroek Date: Wed, 27 Jan 2010 22:59:03 +0000 (+0000) Subject: HGFS tweaks X-Git-Tag: v3.1.6~15 X-Git-Url: http://zhaoyanbai.com/repos/doxygen-warnings.log?a=commitdiff_plain;h=564e2a4368fd8ed545f615f8d3cdd85b0057b044;p=minix.git HGFS tweaks --- diff --git a/servers/hgfs/const.h b/servers/hgfs/const.h index 9d0e7677c..937554af0 100644 --- a/servers/hgfs/const.h +++ b/servers/hgfs/const.h @@ -2,7 +2,6 @@ /* Number of inodes. */ /* The following number must not exceed 16. The i_num field is only a short. */ #define NUM_INODE_BITS 8 -#define NUM_INODES ((1 << NUM_INODE_BITS) - 1) /* Number of entries in the name hashtable. */ #define NUM_HASH_SLOTS 1023 diff --git a/servers/hgfs/inode.c b/servers/hgfs/inode.c index ee3b0edbd..5f545da7e 100644 --- a/servers/hgfs/inode.c +++ b/servers/hgfs/inode.c @@ -18,6 +18,8 @@ #include "inc.h" +PRIVATE struct inode inodes[NUM_INODES]; + PRIVATE TAILQ_HEAD(free_head, inode) free_list; /*===========================================================================* @@ -32,7 +34,7 @@ PUBLIC struct inode *init_inode() TAILQ_INIT(&free_list); - dprintf(("HGFS: %d inodes, %d bytes each, equals %d bytes\n", + dprintf(("HGFS: %d inodes, %u bytes each, equals %u bytes\n", NUM_INODES, sizeof(struct inode), sizeof(inodes))); /* Mark all inodes except the root inode as free. */ @@ -69,7 +71,7 @@ ino_t ino_nr; /* Get an inode based on its inode number. Do not increase its reference count. */ struct inode *ino; - unsigned int index; + int index; /* Inode 0 (= index -1) is not a valid inode number. */ index = INODE_INDEX(ino_nr); diff --git a/servers/hgfs/inode.h b/servers/hgfs/inode.h index 37c097810..3f5c056e7 100644 --- a/servers/hgfs/inode.h +++ b/servers/hgfs/inode.h @@ -51,7 +51,7 @@ * - A CACHED or FREE inode may be reused for other purposes at any time. */ -EXTERN struct inode { +struct inode { struct inode *i_parent; /* parent inode pointer */ LIST_HEAD(child_head, inode) i_child; /* child inode anchor */ LIST_ENTRY(inode) i_next; /* sibling inode chain entry */ @@ -66,7 +66,7 @@ EXTERN struct inode { hgfs_dir_t u_dir; /* handle to open HGFS directory */ } i_u; char i_name[NAME_MAX+1]; /* entry name in parent directory */ -} inodes[NUM_INODES]; +}; #define i_free i_u.u_free #define i_file i_u.u_file diff --git a/servers/hgfs/lookup.c b/servers/hgfs/lookup.c index bee89d802..5c82bdc29 100644 --- a/servers/hgfs/lookup.c +++ b/servers/hgfs/lookup.c @@ -315,7 +315,7 @@ PUBLIC int do_lookup() assert(r != EENTERMOUNT && r != ESYMLINK); if (r == ELEAVEMOUNT) { - m_out.RES_OFFSET = (int)(last - buf); + m_out.RES_OFFSET = (int) (last - buf); m_out.RES_SYMLOOP = 0; } diff --git a/servers/hgfs/mount.c b/servers/hgfs/mount.c index 9cc3a089e..cdcd167b3 100644 --- a/servers/hgfs/mount.c +++ b/servers/hgfs/mount.c @@ -23,7 +23,7 @@ PUBLIC int do_readsuper() int r; dprintf(("HGFS: readsuper (dev %x, flags %x)\n", - m_in.REQ_DEV, m_in.REQ_FLAGS)); + (dev_t) m_in.REQ_DEV, m_in.REQ_FLAGS)); if (m_in.REQ_FLAGS & REQ_ISROOT) { printf("HGFS: attempt to mount as root device\n"); diff --git a/servers/hgfs/write.c b/servers/hgfs/write.c index 5e3088d75..05960823d 100644 --- a/servers/hgfs/write.c +++ b/servers/hgfs/write.c @@ -101,7 +101,7 @@ PUBLIC int do_write() count = m_in.REQ_NBYTES; grant = m_in.REQ_GRANT; - if (count <= 0) return EINVAL; + if (count == 0) return EINVAL; if ((r = write_file(ino, &pos, &count, &grant)) != OK) return r;