From: Thomas Veerman Date: Fri, 28 May 2010 09:39:18 +0000 (+0000) Subject: Clean up PFS X-Git-Tag: v3.1.7~25 X-Git-Url: http://zhaoyanbai.com/repos/doxygen-warnings.log?a=commitdiff_plain;h=5d78cefaf242492724438ac636d54c706cfeff39;p=minix.git Clean up PFS --- diff --git a/include/minix/const.h b/include/minix/const.h index d7e8c2ea3..3099ca03b 100644 --- a/include/minix/const.h +++ b/include/minix/const.h @@ -157,6 +157,7 @@ #define NO_ENTRY ((ino_t) 0) /* absence of a dir entry */ #define NO_ZONE ((zone_t) 0) /* absence of a zone number */ #define NO_DEV ((dev_t) 0) /* absence of a device numb */ +#define NO_LINK ((nlink_t) 0) /* absence of incoming links */ #define SERVARNAME "cttyline" diff --git a/include/minix/types.h b/include/minix/types.h index 8740ae0d0..65c1173e4 100644 --- a/include/minix/types.h +++ b/include/minix/types.h @@ -34,7 +34,7 @@ typedef struct { /* some Minix specific types that do not conflict with posix */ typedef u32_t zone_t; /* zone number */ typedef u32_t block_t; /* block number */ -typedef u32_t bit_t; /* bit number in a bit map */ +typedef u32_t bit_t; /* bit number in a bit map */ typedef u16_t zone1_t; /* zone number for V1 file systems */ typedef u16_t bitchunk_t; /* collection of bits in a bitmap */ diff --git a/include/sys/stat.h b/include/sys/stat.h index 785039a68..0f65f88a2 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -14,7 +14,7 @@ struct stat { dev_t st_dev; /* major/minor device number */ ino_t st_ino; /* i-node number */ mode_t st_mode; /* file mode, protection bits, etc. */ - short int st_nlink; /* # links; TEMPORARY HACK: should be nlink_t*/ + nlink_t st_nlink; /* # links; */ uid_t st_uid; /* uid of the file's owner */ short int st_gid; /* gid; TEMPORARY HACK: should be gid_t */ dev_t st_rdev; diff --git a/servers/pfs/Makefile b/servers/pfs/Makefile index f07350e60..a5129e310 100644 --- a/servers/pfs/Makefile +++ b/servers/pfs/Makefile @@ -11,7 +11,4 @@ MAN= BINDIR?= /usr/sbin INSTALLFLAGS+= -S 128k -NR_BUFS= 256 -CPPFLAGS+= -DNR_BUFS=${NR_BUFS} - .include diff --git a/servers/pfs/buf.h b/servers/pfs/buf.h index c25ac55b0..8e847bac7 100644 --- a/servers/pfs/buf.h +++ b/servers/pfs/buf.h @@ -1,3 +1,6 @@ +#ifndef __PFS_BUF_H__ +#define __PFS_BUF_H__ + /* Buffer (block) cache. */ @@ -17,9 +20,7 @@ struct buf { /* A block is free if b_dev == NO_DEV. */ -#define BUFHASH(b) ((b) % NR_BUFS) - EXTERN struct buf *front; /* points to least recently used free block */ EXTERN struct buf *rear; /* points to most recently used free block */ -EXTERN int bufs_in_use; /* # bufs currently in use (not on free list)*/ +#endif diff --git a/servers/pfs/buffer.c b/servers/pfs/buffer.c index 6215e436a..e745e419e 100644 --- a/servers/pfs/buffer.c +++ b/servers/pfs/buffer.c @@ -3,9 +3,9 @@ #include "inode.h" #include #include -#include #include +FORWARD _PROTOTYPE( struct buf *new_block, (dev_t dev, ino_t inum) ); /*===========================================================================* * buf_pool * @@ -43,7 +43,7 @@ PUBLIC struct buf *get_block(dev_t dev, ino_t inum) /*===========================================================================* * new_block * *===========================================================================*/ -PUBLIC struct buf *new_block(dev_t dev, ino_t inum) +PRIVATE struct buf *new_block(dev_t dev, ino_t inum) { /* Allocate a new buffer and add it to the double linked buffer list */ struct buf *bp; diff --git a/servers/pfs/const.h b/servers/pfs/const.h index 75bbb3705..25c5bc83a 100644 --- a/servers/pfs/const.h +++ b/servers/pfs/const.h @@ -1,16 +1,11 @@ -/* Tables sizes */ -#define V1_NR_DZONES 7 /* # direct zone numbers in a V1 inode */ -#define V1_NR_TZONES 9 /* total # zone numbers in a V1 inode */ -#define V2_NR_DZONES 7 /* # direct zone numbers in a V2 inode */ -#define V2_NR_TZONES 10 /* total # zone numbers in a V2 inode */ +#ifndef __PFS_CONST_H__ +#define __PFS_CONST_H__ #define NR_INODES 256 /* # slots in "in core" inode table */ -#define GETDENTS_BUFSIZ 257 #define INODE_HASH_LOG2 7 /* 2 based logarithm of the inode hash size */ #define INODE_HASH_SIZE ((unsigned long)1< /* MUST be first */ #include /* MUST be second */ @@ -25,3 +26,5 @@ #include "const.h" #include "proto.h" #include "glo.h" + +#endif diff --git a/servers/pfs/glo.h b/servers/pfs/glo.h index 202331025..9b4eeeb8e 100644 --- a/servers/pfs/glo.h +++ b/servers/pfs/glo.h @@ -1,3 +1,6 @@ +#ifndef __PFS_GLO_H__ +#define __PFS_GLO_H__ + /* EXTERN should be extern except for the table file */ #ifdef _TABLE #undef EXTERN @@ -9,9 +12,7 @@ /* The following variables are used for returning results to the caller. */ EXTERN int err_code; /* temporary storage for error number */ -EXTERN int cch[NR_INODES]; - -extern _PROTOTYPE (int (*fs_call_vec[]), (void) ); /* fs call table */ +EXTERN _PROTOTYPE (int (*fs_call_vec[]), (void) ); /* fs call table */ EXTERN message fs_m_in; EXTERN message fs_m_out; @@ -25,3 +26,5 @@ EXTERN int busy; /* Inode map. */ EXTERN bitchunk_t inodemap[FS_BITMAP_CHUNKS(NR_INODES)]; + +#endif diff --git a/servers/pfs/inode.c b/servers/pfs/inode.c index 254c786a9..bbb799c51 100644 --- a/servers/pfs/inode.c +++ b/servers/pfs/inode.c @@ -19,8 +19,8 @@ #include "inode.h" #include -FORWARD _PROTOTYPE( int addhash_inode, (struct inode *node) ); -FORWARD _PROTOTYPE( int unhash_inode, (struct inode *node) ); +FORWARD _PROTOTYPE( void addhash_inode, (struct inode * const node) ); +FORWARD _PROTOTYPE( void unhash_inode, (struct inode * const node) ); /*===========================================================================* @@ -35,11 +35,11 @@ PUBLIC int fs_putnode() dev_t dev; ino_t inum; - rip = find_inode(fs_m_in.REQ_INODE_NR); + rip = find_inode( (ino_t) fs_m_in.REQ_INODE_NR); if(!rip) { - printf("%s:%d put_inode: inode #%d dev: %d not found\n", __FILE__, - __LINE__, fs_m_in.REQ_INODE_NR, fs_m_in.REQ_DEV); + printf("%s:%d put_inode: inode #%ld dev: %d not found\n", __FILE__, + __LINE__, fs_m_in.REQ_INODE_NR, (dev_t) fs_m_in.REQ_DEV); panic("fs_putnode failed"); } @@ -82,7 +82,7 @@ PUBLIC void init_inode_cache() /* add free inodes to unused/free list */ for (rip = &inode[0]; rip < &inode[NR_INODES]; ++rip) { - rip->i_num = 0; + rip->i_num = NO_ENTRY; TAILQ_INSERT_HEAD(&unused_inodes, rip, i_unused); } @@ -95,24 +95,22 @@ PUBLIC void init_inode_cache() /*===========================================================================* * addhash_inode * *===========================================================================*/ -PRIVATE int addhash_inode(struct inode *node) +PRIVATE void addhash_inode(struct inode * const node) { - int hashi = node->i_num & INODE_HASH_MASK; + int hashi = (int) (node->i_num & INODE_HASH_MASK); /* insert into hash table */ LIST_INSERT_HEAD(&hash_inodes[hashi], node, i_hash); - return(OK); } /*===========================================================================* * unhash_inode * *===========================================================================*/ -PRIVATE int unhash_inode(struct inode *node) +PRIVATE void unhash_inode(struct inode * const node) { /* remove from hash table */ LIST_REMOVE(node, i_hash); - return(OK); } @@ -121,7 +119,7 @@ PRIVATE int unhash_inode(struct inode *node) *===========================================================================*/ PUBLIC struct inode *get_inode( dev_t dev, /* device on which inode resides */ - int numb /* inode number (ANSI: may not be unshort) */ + ino_t numb /* inode number */ ) { /* Find the inode in the hash table. If it is not there, get a free inode @@ -130,7 +128,7 @@ PUBLIC struct inode *get_inode( register struct inode *rip; int hashi; - hashi = numb & INODE_HASH_MASK; + hashi = (int) (numb & INODE_HASH_MASK); /* Search inode in the hash table */ LIST_FOREACH(rip, &hash_inodes[hashi], i_hash) { @@ -153,7 +151,7 @@ PUBLIC struct inode *get_inode( rip = TAILQ_FIRST(&unused_inodes); /* If not free unhash it */ - if (rip->i_num != 0) unhash_inode(rip); + if (rip->i_num != NO_ENTRY) unhash_inode(rip); /* Inode is not unused any more */ TAILQ_REMOVE(&unused_inodes, rip, i_unused); @@ -176,14 +174,14 @@ PUBLIC struct inode *get_inode( * find_inode * *===========================================================================*/ PUBLIC struct inode *find_inode(numb) -int numb; /* inode number (ANSI: may not be unshort) */ +ino_t numb; /* inode number */ { /* Find the inode specified by the inode and device number. */ struct inode *rip; int hashi; - hashi = numb & INODE_HASH_MASK; + hashi = (int) (numb & INODE_HASH_MASK); /* Search inode in the hash table */ LIST_FOREACH(rip, &hash_inodes[hashi], i_hash) { @@ -200,7 +198,7 @@ int numb; /* inode number (ANSI: may not be unshort) */ * put_inode * *===========================================================================*/ PUBLIC void put_inode(rip) -register struct inode *rip; /* pointer to inode to be released */ +struct inode *rip; /* pointer to inode to be released */ { /* The caller is no longer using this inode. If no one else is using it either * write it back to the disk immediately. If it has no links, truncate it and @@ -213,19 +211,19 @@ register struct inode *rip; /* pointer to inode to be released */ panic("put_inode: i_count already below 1: %d", rip->i_count); if (--rip->i_count == 0) { /* i_count == 0 means no one is using it now */ - if (rip->i_nlinks == 0) { - /* i_nlinks == 0 means free the inode. */ + if (rip->i_nlinks == NO_LINK) { /* Are there links to this file? */ + /* no links, free the inode. */ truncate_inode(rip, 0); /* return all the disk blocks */ rip->i_mode = I_NOT_ALLOC; /* clear I_TYPE field */ free_inode(rip); } else { - truncate_inode(rip, 0); + truncate_inode(rip, (off_t) 0); } - if (rip->i_nlinks == 0) { + if (rip->i_nlinks == NO_LINK) { /* free, put at the front of the LRU list */ unhash_inode(rip); - rip->i_num = 0; + rip->i_num = NO_ENTRY; rip->i_dev = NO_DEV; rip->i_rdev = NO_DEV; TAILQ_INSERT_HEAD(&unused_inodes, rip, i_unused); @@ -265,7 +263,7 @@ PUBLIC struct inode *alloc_inode(dev_t dev, mode_t bits) /* An inode slot is available. */ rip->i_mode = bits; /* set up RWX bits */ - rip->i_nlinks = 0; /* initial no links */ + rip->i_nlinks = NO_LINK; /* initial no links */ rip->i_uid = caller_uid; /* file's uid is owner's */ rip->i_gid = caller_gid; /* ditto group id */ @@ -285,7 +283,7 @@ PUBLIC struct inode *alloc_inode(dev_t dev, mode_t bits) * wipe_inode * *===========================================================================*/ PUBLIC void wipe_inode(rip) -register struct inode *rip; /* the inode to be erased */ +struct inode *rip; /* the inode to be erased */ { /* Erase some fields in the inode. This function is called from alloc_inode() * when a new inode is to be allocated, and from truncate(), when an existing @@ -307,8 +305,8 @@ struct inode *rip; bit_t b; - if (rip->i_num <= 0 || rip->i_num >= NR_INODES) return; - b = rip->i_num; + if (rip->i_num <= (ino_t) 0 || rip->i_num >= (ino_t) NR_INODES) return; + b = (bit_t) rip->i_num; free_bit(b); } @@ -317,7 +315,7 @@ struct inode *rip; * update_times * *===========================================================================*/ PUBLIC void update_times(rip) -register struct inode *rip; /* pointer to inode to be read/written */ +struct inode *rip; /* pointer to inode to be read/written */ { /* Various system calls are required by the standard to update atime, ctime, * or mtime. Since updating a time requires sending a message to the clock diff --git a/servers/pfs/inode.h b/servers/pfs/inode.h index 06590fbcf..8614aa0f7 100644 --- a/servers/pfs/inode.h +++ b/servers/pfs/inode.h @@ -1,3 +1,6 @@ +#ifndef __PFS_INODE_H__ +#define __PFS_INODE_H__ + /* Inode table. This table holds inodes that are currently in use. */ @@ -33,3 +36,4 @@ EXTERN TAILQ_HEAD(unused_inodes_t, inode) unused_inodes; EXTERN LIST_HEAD(inodelist, inode) hash_inodes[INODE_HASH_SIZE]; +#endif diff --git a/servers/pfs/link.c b/servers/pfs/link.c index da71594f7..d6b9ba9ed 100644 --- a/servers/pfs/link.c +++ b/servers/pfs/link.c @@ -1,5 +1,4 @@ #include "fs.h" -#include #include "buf.h" #include "inode.h" #include @@ -13,7 +12,7 @@ PUBLIC int fs_ftrunc(void) off_t start, end; ino_t inumb; - inumb = fs_m_in.REQ_INODE_NR; + inumb = (ino_t) fs_m_in.REQ_INODE_NR; if( (rip = find_inode(inumb)) == NULL) return(EINVAL); diff --git a/servers/pfs/main.c b/servers/pfs/main.c index d944089fb..d3c1da514 100644 --- a/servers/pfs/main.c +++ b/servers/pfs/main.c @@ -6,7 +6,6 @@ #include #include "buf.h" #include "inode.h" -#include "drivers.h" FORWARD _PROTOTYPE(void get_work, (message *m_in) ); @@ -38,19 +37,19 @@ PUBLIC int main(int argc, char *argv[]) src = fs_m_in.m_source; error = OK; - caller_uid = -1; /* To trap errors */ - caller_gid = -1; + caller_uid = INVAL_UID; /* To trap errors */ + caller_gid = INVAL_GID; req_nr = fs_m_in.m_type; if (req_nr < VFS_BASE) { fs_m_in.m_type += VFS_BASE; req_nr = fs_m_in.m_type; + printf("PFS: bad request (no VFS_BASE) %d\n", req_nr); } ind = req_nr - VFS_BASE; if (ind < 0 || ind >= NREQS) { printf("pfs: bad request %d\n", req_nr); - printf("ind = %d\n", ind); error = EINVAL; } else { error = (*fs_call_vec[ind])(); @@ -96,15 +95,10 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) /* Init inode table */ for (i = 0; i < NR_INODES; ++i) { inode[i].i_count = 0; - cch[i] = 0; } init_inode_cache(); - /* Init driver mapping */ - for (i = 0; i < NR_DEVICES; ++i) - driver_endpoints[i].driver_e = NONE; - SELF_E = getprocnr(); buf_pool(); @@ -148,7 +142,7 @@ message *m_in; /* pointer to message */ * reply * *===========================================================================*/ PUBLIC void reply(who, m_out) -int who; +endpoint_t who; message *m_out; /* report result */ { if (OK != send(who, m_out)) /* send the message */ diff --git a/servers/pfs/misc.c b/servers/pfs/misc.c index efb0245fa..e460113ac 100644 --- a/servers/pfs/misc.c +++ b/servers/pfs/misc.c @@ -1,8 +1,4 @@ #include "fs.h" -#include -#include -#include "buf.h" -#include "inode.h" /*===========================================================================* diff --git a/servers/pfs/open.c b/servers/pfs/open.c index f015ea1f7..ca512bb3f 100644 --- a/servers/pfs/open.c +++ b/servers/pfs/open.c @@ -1,8 +1,5 @@ #include "fs.h" #include -#include -#include -#include #include "buf.h" #include "inode.h" #include @@ -18,10 +15,10 @@ PUBLIC int fs_newnode() struct inode *rip; dev_t dev; - caller_uid = fs_m_in.REQ_UID; - caller_gid = fs_m_in.REQ_GID; - bits = fs_m_in.REQ_MODE; - dev = fs_m_in.REQ_DEV; + caller_uid = (uid_t) fs_m_in.REQ_UID; + caller_gid = (gid_t) fs_m_in.REQ_GID; + bits = (mode_t) fs_m_in.REQ_MODE; + dev = (dev_t) fs_m_in.REQ_DEV; /* Try to allocate the inode */ if( (rip = alloc_inode(dev, bits) ) == NULL) return(err_code); diff --git a/servers/pfs/proto.h b/servers/pfs/proto.h index 9e57652fd..b0b7578c8 100644 --- a/servers/pfs/proto.h +++ b/servers/pfs/proto.h @@ -1,13 +1,14 @@ +#ifndef __PFS_PROTO_H__ +#define __PFS_PROTO_H__ + /* Function prototypes. */ /* Structs used in prototypes must be declared as such first. */ struct buf; -struct filp; struct inode; /* buffer.c */ _PROTOTYPE( struct buf *get_block, (dev_t dev, ino_t inum) ); -_PROTOTYPE( struct buf *new_block, (dev_t dev, ino_t inum) ); _PROTOTYPE( void put_block, (dev_t dev, ino_t inum) ); /* cache.c */ @@ -16,11 +17,11 @@ _PROTOTYPE( void buf_pool, (void) ); /* inode.c */ _PROTOTYPE( struct inode *alloc_inode, (dev_t dev, mode_t mode) ); _PROTOTYPE( void dup_inode, (struct inode *ip) ); -_PROTOTYPE( struct inode *find_inode, (int numb) ); +_PROTOTYPE( struct inode *find_inode, (ino_t numb) ); _PROTOTYPE( void free_inode, (struct inode *rip) ); _PROTOTYPE( int fs_putnode, (void) ); _PROTOTYPE( void init_inode_cache, (void) ); -_PROTOTYPE( struct inode *get_inode, (dev_t dev, int numb) ); +_PROTOTYPE( struct inode *get_inode, (dev_t dev, ino_t numb) ); _PROTOTYPE( void put_inode, (struct inode *rip) ); _PROTOTYPE( void update_times, (struct inode *rip) ); _PROTOTYPE( void wipe_inode, (struct inode *rip) ); @@ -31,7 +32,7 @@ _PROTOTYPE( int truncate_inode, (struct inode *rip, off_t newsize) ); /* main.c */ -_PROTOTYPE( void reply, (int who, message *m_out) ); +_PROTOTYPE( void reply, (endpoint_t who, message *m_out) ); /* misc.c */ _PROTOTYPE( int fs_sync, (void) ); @@ -41,8 +42,6 @@ _PROTOTYPE( int fs_newnode, (void) ); /* read.c */ _PROTOTYPE( int fs_readwrite, (void) ); -_PROTOTYPE( block_t read_map, (struct inode *rip, off_t pos) ); -_PROTOTYPE( int read_write, (int rw_flag) ); /* utility.c */ _PROTOTYPE( time_t clock_time, (void) ); @@ -54,3 +53,5 @@ _PROTOTYPE( int fs_stat, (void) ); /* super.c */ _PROTOTYPE( bit_t alloc_bit, (void) ); _PROTOTYPE( void free_bit, (bit_t bit_returned) ); + +#endif diff --git a/servers/pfs/read.c b/servers/pfs/read.c index c2ee12b75..00f99eaa9 100644 --- a/servers/pfs/read.c +++ b/servers/pfs/read.c @@ -1,8 +1,6 @@ #include "fs.h" #include "buf.h" #include -#include -#include #include "inode.h" @@ -22,8 +20,7 @@ PUBLIC int fs_readwrite(void) r = OK; cum_io = 0; - inumb = fs_m_in.REQ_INODE_NR; - rw_flag = (fs_m_in.m_type == REQ_READ ? READING : WRITING); + inumb = (ino_t) fs_m_in.REQ_INODE_NR; /* Find the inode referred */ if ((rip = find_inode(inumb)) == NULL) return(EINVAL); @@ -34,13 +31,18 @@ PUBLIC int fs_readwrite(void) /* Get the values from the request message */ rw_flag = (fs_m_in.m_type == REQ_READ ? READING : WRITING); - gid = fs_m_in.REQ_GRANT; + gid = (cp_grant_id_t) fs_m_in.REQ_GRANT; position = fs_m_in.REQ_SEEK_POS_LO; nrbytes = (unsigned) fs_m_in.REQ_NBYTES; + + /* We can't read beyond the max file position */ + if (nrbytes > MAX_FILE_POS) return(EFBIG); if (rw_flag == WRITING) { /* Check in advance to see if file will grow too big. */ - if (position > PIPE_BUF - nrbytes) return(EFBIG); + /* Casting nrbytes to signed is safe, because it's guaranteed not to + be beyond max signed value (i.e., MAX_FILE_POS). */ + if (position > PIPE_BUF - (signed) nrbytes) return(EFBIG); } /* Mark inode in use */ @@ -49,16 +51,16 @@ PUBLIC int fs_readwrite(void) if (rw_flag == READING) { /* Copy a chunk from the block buffer to user space. */ - r = sys_safecopyto(FS_PROC_NR, gid, 0, - (vir_bytes) (bp->b_data+position), (phys_bytes) nrbytes, D); + r = sys_safecopyto(FS_PROC_NR, gid, (vir_bytes) 0, + (vir_bytes) (bp->b_data+position), (size_t) nrbytes, D); } else { /* Copy a chunk from user space to the block buffer. */ - r = sys_safecopyfrom(FS_PROC_NR, gid, 0, - (vir_bytes) (bp->b_data+position), (phys_bytes) nrbytes, D); + r = sys_safecopyfrom(FS_PROC_NR, gid, (vir_bytes) 0, + (vir_bytes) (bp->b_data+position), (size_t) nrbytes, D); } if (r == OK) { - position += nrbytes; /* Update position */ + position += (signed) nrbytes; /* Update position */ cum_io += nrbytes; } @@ -79,7 +81,7 @@ PUBLIC int fs_readwrite(void) bp->b_bytes = position; if (rw_flag == READING) rip->i_update |= ATIME; if (rw_flag == WRITING) rip->i_update |= CTIME | MTIME; - fs_m_out.RES_NBYTES = cum_io; + fs_m_out.RES_NBYTES = (size_t) cum_io; put_inode(rip); put_block(rip->i_dev, rip->i_num); diff --git a/servers/pfs/stadir.c b/servers/pfs/stadir.c index bd6a267cf..2b0e49661 100644 --- a/servers/pfs/stadir.c +++ b/servers/pfs/stadir.c @@ -28,7 +28,7 @@ PRIVATE int stat_inode( statbuf.st_mode = rip->i_mode; statbuf.st_nlink = rip->i_nlinks; statbuf.st_uid = rip->i_uid; - statbuf.st_gid = rip->i_gid; + statbuf.st_gid = (short int) rip->i_gid; statbuf.st_rdev = (dev_t) (s ? rip->i_rdev : NO_DEV); statbuf.st_size = rip->i_size; if (!s) statbuf.st_mode &= ~I_REGULAR;/* wipe out I_REGULAR bit for pipes */ @@ -37,8 +37,8 @@ PRIVATE int stat_inode( statbuf.st_ctime = rip->i_ctime; /* Copy the struct to user space. */ - r = sys_safecopyto(who_e, gid, 0, (vir_bytes) &statbuf, - (phys_bytes) sizeof(statbuf), D); + r = sys_safecopyto(who_e, gid, (vir_bytes) 0, (vir_bytes) &statbuf, + (size_t) sizeof(statbuf), D); return(r); } @@ -54,7 +54,7 @@ PUBLIC int fs_stat() if( (rip = find_inode(fs_m_in.REQ_INODE_NR)) == NULL) return(EINVAL); get_inode(rip->i_dev, rip->i_num); /* mark inode in use */ - r = stat_inode(rip, fs_m_in.m_source, fs_m_in.REQ_GRANT); + r = stat_inode(rip, fs_m_in.m_source, (cp_grant_id_t) fs_m_in.REQ_GRANT); put_inode(rip); /* release the inode */ return(r); } diff --git a/servers/pfs/super.c b/servers/pfs/super.c index 845af9f43..84559cc1c 100644 --- a/servers/pfs/super.c +++ b/servers/pfs/super.c @@ -9,9 +9,6 @@ */ #include "fs.h" -#include -#include -#include #include "buf.h" #include "inode.h" #include "const.h" @@ -25,7 +22,7 @@ PUBLIC bit_t alloc_bit(void) /* Allocate a bit from a bit map and return its bit number. */ bitchunk_t *wptr, *wlim; bit_t b; - int i, bcount; + unsigned int i, bcount; bcount = FS_BITMAP_CHUNKS(NR_INODES); /* Inode map has this many chunks. */ wlim = &inodemap[bcount]; /* Point to last chunk in inodemap. */ @@ -38,7 +35,7 @@ PUBLIC bit_t alloc_bit(void) for (i = 0; (*wptr & (1 << i)) != 0; ++i) {} /* Get inode number */ - b = (wptr - &inodemap[0]) * FS_BITCHUNK_BITS + i; + b = (bit_t) ((wptr - &inodemap[0]) * FS_BITCHUNK_BITS + i); /* Don't allocate bits beyond end of map. */ if (b >= NR_INODES) break; @@ -66,12 +63,12 @@ bit_t bit_returned; /* number of bit to insert into the inode map*/ unsigned word; /* Get word offset and bit within offset */ - word = bit_returned / FS_BITCHUNK_BITS; - bit = bit_returned % FS_BITCHUNK_BITS; + word = (unsigned) (bit_returned / (bit_t) FS_BITCHUNK_BITS); + bit = bit_returned % (bit_t) FS_BITCHUNK_BITS; /* Unset bit */ k = &inodemap[word]; - mask = 1 << bit; + mask = (unsigned) 1 << bit; *k &= ~mask; busy--; /* One inode less in use. */ diff --git a/servers/pfs/table.c b/servers/pfs/table.c index ddc269f20..da3e03ccf 100644 --- a/servers/pfs/table.c +++ b/servers/pfs/table.c @@ -6,11 +6,8 @@ #define _TABLE #include "fs.h" -#include -#include #include "inode.h" #include "buf.h" -#include "drivers.h" PUBLIC _PROTOTYPE (int (*fs_call_vec[]), (void) ) = { no_sys, /* 0 not used */ diff --git a/servers/pfs/utility.c b/servers/pfs/utility.c index e18a88255..7c3296154 100644 --- a/servers/pfs/utility.c +++ b/servers/pfs/utility.c @@ -23,9 +23,10 @@ PUBLIC time_t clock_time() */ int r; - clock_t uptime, boottime; + clock_t uptime; /* Uptime in ticks */ + time_t boottime; - if ((r = getuptime2(&uptime,&boottime)) != OK) + if ((r = getuptime2(&uptime, &boottime)) != OK) panic("clock_time: getuptme2 failed: %d", r); return( (time_t) (boottime + (uptime/sys_hz())));