lkml.org 
[lkml]   [1998]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject(patch) coda 64-bit-ness corrections for alpha
Date
When compiling coda (2.1.120-pre3) under Alpha, gcc spits out a
buttload of warnings relating to pointer size assumptions (yuck!) and
the like.

In general,
ino_t can be safely cast to an int, and
pointers can NOT be safely cast to an int, and
size_t can be safely upcast to a long

Most of these changes simply get rid of warnings. A few are actual
bugs under 64-bit platforms. upcall.c contains the only meaningful (ie.
non-printk) changes.

Summary of changes (in order of importance):
fs/coda/upcall.c - correct 64-bit-ness bugs, printk's
include/linux/coda.h - corrected mode type
include/linux/coda_linux.h - corrected printk's, formatted CODA_FREE
fs/coda/cnode.c - corrected printk's, debugging printk's
fs/coda/file.c - corrected printk's, debugging printk's
fs/coda/dir.c - corrected debugging printk's
fs/coda/inode.c - corrected printk's
fs/coda/psdev.c - corrected printk's, debugging printk's

Jeff




diff -r -c -b linux-2.1.119/fs/coda/cnode.c linux/fs/coda/cnode.c
*** linux-2.1.119/fs/coda/cnode.c Fri Jul 10 18:33:37 1998
--- linux/fs/coda/cnode.c Fri Sep 4 14:22:52 1998
***************
*** 101,111 ****
/* fill in the inode attributes */
if ( coda_f2i(fid) != ino ) {
if ( !coda_fid_is_weird(fid) )
! printk("Coda: unknown weird fid: ino %ld, fid %s."
! "Tell Peter.\n", ino, coda_f2s(&cnp->c_fid));
list_add(&cnp->c_volrootlist, &sbi->sbi_volroothead);
! CDEBUG(D_UPCALL, "Added %ld ,%s to volroothead\n",
! ino, coda_f2s(&cnp->c_fid));
}

coda_fill_inode(*inode, &attr);
--- 101,112 ----
/* fill in the inode attributes */
if ( coda_f2i(fid) != ino ) {
if ( !coda_fid_is_weird(fid) )
! printk("Coda: unknown weird fid: ino %u, fid %s."
! "Tell Peter.\n",
! (unsigned int) ino, coda_f2s(&cnp->c_fid));
list_add(&cnp->c_volrootlist, &sbi->sbi_volroothead);
! CDEBUG(D_UPCALL, "Added %u ,%s to volroothead\n",
! (unsigned int)ino, coda_f2s(&cnp->c_fid));
}

coda_fill_inode(*inode, &attr);
***************
*** 180,187 ****
nr = coda_f2i(fid);
inode = iget(sb, nr);
if ( !inode ) {
! printk("coda_fid_to_inode: null from iget, sb %p, nr %ld.\n",
! sb, nr);
return NULL;
}

--- 181,188 ----
nr = coda_f2i(fid);
inode = iget(sb, nr);
if ( !inode ) {
! printk("coda_fid_to_inode: null from iget, sb %p, nr %u.\n",
! sb, (unsigned int) nr);
return NULL;
}

diff -r -c -b linux-2.1.119/fs/coda/dir.c linux/fs/coda/dir.c
*** linux-2.1.119/fs/coda/dir.c Mon Aug 24 16:02:44 1998
--- linux/fs/coda/dir.c Fri Sep 4 15:01:57 1998
***************
*** 119,126 ****
size_t length = entry->d_name.len;

ENTRY;
! CDEBUG(D_INODE, "name %s, len %d in ino %ld\n",
! name, length, dir->i_ino);

if (!dir || !S_ISDIR(dir->i_mode)) {
printk("coda_lookup: inode is NULL or not a directory\n");
--- 119,126 ----
size_t length = entry->d_name.len;

ENTRY;
! CDEBUG(D_INODE, "name %s, len %lu in ino %u\n",
! name, (unsigned long)length, (unsigned int)dir->i_ino);

if (!dir || !S_ISDIR(dir->i_mode)) {
printk("coda_lookup: inode is NULL or not a directory\n");
***************
*** 699,711 ****

error = venus_open(i->i_sb, &(cnp->c_fid), coda_flags, &ino, &dev);
if (error) {
! CDEBUG(D_FILE, "venus: dev %d, inode %ld, out->result %d\n",
! dev, ino, error);
return error;
}

/* coda_upcall returns ino number of cached object, get inode */
! CDEBUG(D_FILE, "cache file dev %d, ino %ld\n", dev, ino);
error = coda_inode_grab(dev, ino, &cont_inode);

if ( error || !cont_inode ){
--- 699,711 ----

error = venus_open(i->i_sb, &(cnp->c_fid), coda_flags, &ino, &dev);
if (error) {
! CDEBUG(D_FILE, "venus: dev %d, inode %d, out->result %d\n",
! dev, (int)ino, error);
return error;
}

/* coda_upcall returns ino number of cached object, get inode */
! CDEBUG(D_FILE, "cache file dev %d, ino %d\n", dev, (int)ino);
error = coda_inode_grab(dev, ino, &cont_inode);

if ( error || !cont_inode ){
***************
*** 724,732 ****

CDEBUG(D_FILE, "result %d, coda i->i_count is %d for ino %ld\n",
error, i->i_count, i->i_ino);
! CDEBUG(D_FILE, "cache ino: %ld, count %d, ops %x\n",
! cnp->c_ovp->i_ino, cnp->c_ovp->i_count,
! (int)(cnp->c_ovp->i_op));
EXIT;
return 0;
}
--- 724,732 ----

CDEBUG(D_FILE, "result %d, coda i->i_count is %d for ino %ld\n",
error, i->i_count, i->i_ino);
! CDEBUG(D_FILE, "cache ino: %u, count %d, ops %p\n",
! (unsigned int)cnp->c_ovp->i_ino, cnp->c_ovp->i_count,
! cnp->c_ovp->i_op);
EXIT;
return 0;
}
diff -r -c -b linux-2.1.119/fs/coda/file.c linux/fs/coda/file.c
*** linux-2.1.119/fs/coda/file.c Mon Aug 24 16:02:44 1998
--- linux/fs/coda/file.c Fri Sep 4 14:59:11 1998
***************
*** 155,162 ****
result = cont_file.f_op->read(&cont_file , buff, count,
&(cont_file.f_pos));

! CDEBUG(D_FILE, "ops at %x result %d, count %d, position: %d\n",
! (int)cont_file.f_op, result, count, (int)cont_file.f_pos);

coda_restore_codafile(coda_inode, coda_file, cont_inode, &cont_file);
return result;
--- 155,162 ----
result = cont_file.f_op->read(&cont_file , buff, count,
&(cont_file.f_pos));

! CDEBUG(D_FILE, "ops at %p result %d, count %d, position: %d\n",
! cont_file.f_op, result, count, (int)cont_file.f_pos);

coda_restore_codafile(coda_inode, coda_file, cont_inode, &cont_file);
return result;
***************
*** 291,301 ****
*ind = iget(sbptr, ino);

if ( *ind == NULL ) {
! printk("coda_inode_grab: iget(dev: %d, ino: %ld)
! returns NULL.\n", dev, ino);
return -ENOENT;
}
! CDEBUG(D_FILE, "ino: %ld, ops at %x\n", ino, (int)(*ind)->i_op);
return 0;
}

--- 291,301 ----
*ind = iget(sbptr, ino);

if ( *ind == NULL ) {
! printk("coda_inode_grab: iget(dev: %d, ino: %d)
! returns NULL.\n", dev, (int)ino);
return -ENOENT;
}
! CDEBUG(D_FILE, "ino: %d, ops at %p\n", (int)ino, (*ind)->i_op);
return 0;
}

diff -r -c -b linux-2.1.119/fs/coda/inode.c linux/fs/coda/inode.c
*** linux-2.1.119/fs/coda/inode.c Fri Jul 10 18:33:37 1998
--- linux/fs/coda/inode.c Fri Sep 4 14:43:08 1998
***************
*** 329,336 ****
psdev_path = data;
ent = namei((char *) *psdev_path);
if (IS_ERR(ent)) {
! printk("namei error %ld for %d\n", PTR_ERR(ent),
! (int) psdev_path);
return 1;
}
psdev = ent->d_inode;
--- 329,336 ----
psdev_path = data;
ent = namei((char *) *psdev_path);
if (IS_ERR(ent)) {
! printk("namei error %ld for %p\n", PTR_ERR(ent),
! psdev_path);
return 1;
}
psdev = ent->d_inode;
diff -r -c -b linux-2.1.119/fs/coda/psdev.c linux/fs/coda/psdev.c
*** linux-2.1.119/fs/coda/psdev.c Mon Aug 24 16:14:10 1998
--- linux/fs/coda/psdev.c Fri Sep 4 14:14:44 1998
***************
*** 224,231 ****

/* move data into response buffer. */
if (vmp->vm_outSize < count) {
! printk("psdev_write: too much cnt: %d, cnt: %d, opc: %ld, uniq: %ld.\n",
! vmp->vm_outSize, count, opcode, uniq);
count = vmp->vm_outSize; /* don't have more space! */
}
if (copy_from_user(vmp->vm_data, buf, count))
--- 224,231 ----

/* move data into response buffer. */
if (vmp->vm_outSize < count) {
! printk("psdev_write: too much cnt: %d, cnt: %lu, opc: %lu, uniq: %lu.\n",
! vmp->vm_outSize, (unsigned long) count, opcode, uniq);
count = vmp->vm_outSize; /* don't have more space! */
}
if (copy_from_user(vmp->vm_data, buf, count))
***************
*** 236,243 ****
vmp->vm_flags |= VM_WRITE;

CDEBUG(D_PSDEV,
! "Found! Count %d for (opc,uniq)=(%ld,%ld), vmsg at %x\n",
! count, opcode, uniq, (int)&vmp);

wake_up(&vmp->vm_sleep);
return(count);
--- 236,243 ----
vmp->vm_flags |= VM_WRITE;

CDEBUG(D_PSDEV,
! "Found! Count %lu for (opc,uniq)=(%ld,%ld), vmsg at %lx\n",
! (unsigned long)count, opcode, uniq, (long)&vmp);

wake_up(&vmp->vm_sleep);
return(count);
***************
*** 270,277 ****
result = vmp->vm_inSize;

if (count < vmp->vm_inSize) {
! printk ("psdev_read: Venus read %d bytes of %d in message\n",
! count, vmp->vm_inSize);
}

if ( copy_to_user(buf, vmp->vm_data, result))
--- 270,277 ----
result = vmp->vm_inSize;

if (count < vmp->vm_inSize) {
! printk ("psdev_read: Venus read %lu bytes of %d in message\n",
! (unsigned long)count, vmp->vm_inSize);
}

if ( copy_to_user(buf, vmp->vm_data, result))
diff -r -c -b linux-2.1.119/fs/coda/upcall.c linux/fs/coda/upcall.c
*** linux-2.1.119/fs/coda/upcall.c Fri Jul 31 19:22:12 1998
--- linux/fs/coda/upcall.c Fri Sep 4 14:26:30 1998
***************
*** 388,394 ****
if ( retlen > *length )
retlen = *length;
*length = retlen;
! result = (char *)outp + (int)outp->cfs_readlink.data;
memcpy(buffer, result, retlen);
*(buffer + retlen) = '\0';
}
--- 388,394 ----
if ( retlen > *length )
retlen = *length;
*length = retlen;
! result = (char *)outp + (long)outp->cfs_readlink.data;
memcpy(buffer, result, retlen);
*(buffer + retlen) = '\0';
}
***************
*** 538,547 ****

/* get the data out of user space */
#ifdef L20
! memcpy_fromfs((char*)inp + (int)inp->cfs_ioctl.data,
data->vi.in, data->vi.in_size);
#else
! if ( copy_from_user((char*)inp + (int)inp->cfs_ioctl.data,
data->vi.in, data->vi.in_size) ) {
error = EINVAL;
goto exit;
--- 538,547 ----

/* get the data out of user space */
#ifdef L20
! memcpy_fromfs((char*)inp + (long)inp->cfs_ioctl.data,
data->vi.in, data->vi.in_size);
#else
! if ( copy_from_user((char*)inp + (long)inp->cfs_ioctl.data,
data->vi.in, data->vi.in_size) ) {
error = EINVAL;
goto exit;
***************
*** 571,577 ****
data->vi.out_size);
#else
if (copy_to_user(data->vi.out,
! (char *)outp + (int)outp->cfs_ioctl.data,
data->vi.out_size)) {
error = EINVAL;
goto exit;
--- 571,577 ----
data->vi.out_size);
#else
if (copy_to_user(data->vi.out,
! (char *)outp + (long)outp->cfs_ioctl.data,
data->vi.out_size)) {
error = EINVAL;
goto exit;
***************
*** 678,685 ****
/* Append msg to pending queue and poke Venus. */
coda_q_insert(&(vmp->vm_chain), &(vcommp->vc_pending));
CDEBUG(D_UPCALL,
! "Proc %d wake Venus for(opc,uniq) =(%d,%d) msg at %x.zzz.\n",
! current->pid, vmp->vm_opcode, vmp->vm_unique, (int)vmp);

wake_up_interruptible(&vcommp->vc_waitq);
/* We can be interrupted while we wait for Venus to process
--- 678,685 ----
/* Append msg to pending queue and poke Venus. */
coda_q_insert(&(vmp->vm_chain), &(vcommp->vc_pending));
CDEBUG(D_UPCALL,
! "Proc %d wake Venus for(opc,uniq) =(%d,%d) msg at %p.zzz.\n",
! current->pid, vmp->vm_opcode, vmp->vm_unique, vmp);

wake_up_interruptible(&vcommp->vc_waitq);
/* We can be interrupted while we wait for Venus to process
***************
*** 699,706 ****
vmp->vm_opcode, jiffies - vmp->vm_posttime,
vmp->vm_unique, vmp->vm_outSize);
CDEBUG(D_UPCALL,
! "..process %d woken up by Venus for vmp at 0x%x, data at %x\n",
! current->pid, (int)vmp, (int)vmp->vm_data);
if (vcomm_open(vcommp)) { /* i.e. Venus is still alive */
/* Op went through, interrupt or not... */
if (vmp->vm_flags & VM_WRITE) {
--- 699,706 ----
vmp->vm_opcode, jiffies - vmp->vm_posttime,
vmp->vm_unique, vmp->vm_outSize);
CDEBUG(D_UPCALL,
! "..process %d woken up by Venus for vmp at %p, data at %p\n",
! current->pid, vmp, vmp->vm_data);
if (vcomm_open(vcommp)) { /* i.e. Venus is still alive */
/* Op went through, interrupt or not... */
if (vmp->vm_flags & VM_WRITE) {
diff -r -c -b linux-2.1.119/include/linux/coda.h linux/include/linux/coda.h
*** linux-2.1.119/include/linux/coda.h Fri Jul 10 18:33:37 1998
--- linux/include/linux/coda.h Fri Sep 4 14:30:27 1998
***************
*** 173,179 ****

struct coda_vattr {
enum coda_vtype va_type; /* vnode type (for create) */
! u_short va_mode; /* files access mode and type */
short va_nlink; /* number of references to file */
vuid_t va_uid; /* owner user id */
vgid_t va_gid; /* owner group id */
--- 173,179 ----

struct coda_vattr {
enum coda_vtype va_type; /* vnode type (for create) */
! umode_t va_mode; /* files access mode and type */
short va_nlink; /* number of references to file */
vuid_t va_uid; /* owner user id */
vgid_t va_gid; /* owner group id */
diff -r -c -b linux-2.1.119/include/linux/coda_linux.h linux/include/linux/coda_linux.h
*** linux-2.1.119/include/linux/coda_linux.h Thu Jun 4 18:53:19 1998
--- linux/include/linux/coda_linux.h Fri Sep 4 14:41:34 1998
***************
*** 104,113 ****
do { \
if (size < 3000) { \
ptr = (cast)kmalloc((unsigned long) size, GFP_KERNEL); \
! CDEBUG(D_MALLOC, "kmalloced: %x at %x.\n", (int) size, (int) ptr);\
} else { \
ptr = (cast)vmalloc((unsigned long) size); \
! CDEBUG(D_MALLOC, "vmalloced: %x at %x.\n", (int) size, (int) ptr);}\
if (ptr == 0) { \
printk("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \
} \
--- 104,113 ----
do { \
if (size < 3000) { \
ptr = (cast)kmalloc((unsigned long) size, GFP_KERNEL); \
! CDEBUG(D_MALLOC, "kmalloced: %d at %p.\n", (int) size, ptr);\
} else { \
ptr = (cast)vmalloc((unsigned long) size); \
! CDEBUG(D_MALLOC, "vmalloced: %d at %p.\n", (int) size, ptr);}\
if (ptr == 0) { \
printk("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \
} \
***************
*** 115,121 ****
} while (0)


! #define CODA_FREE(ptr,size) do {if (size < 3000) { kfree_s((ptr), (size)); CDEBUG(D_MALLOC, "kfreed: %x at %x.\n", (int) size, (int) ptr); } else { vfree((ptr)); CDEBUG(D_MALLOC, "vfreed: %x at %x.\n", (int) size, (int) ptr);} } while (0)

/* inode to cnode */

--- 115,130 ----
} while (0)


! #define CODA_FREE(ptr,size) \
! do { \
! if (size < 3000) { \
! kfree_s((ptr), (size)); \
! CDEBUG(D_MALLOC, "kfreed: %d at %p.\n", (int) size, ptr); \
! } else { \
! vfree((ptr)); \
! CDEBUG(D_MALLOC, "vfreed: %d at %p.\n", (int) size, ptr); \
! } \
! } while (0)

/* inode to cnode */


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/faq.html

\
 
 \ /
  Last update: 2005-03-22 13:44    [W:0.037 / U:0.960 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site