Commit 87653883 authored by Jan Harkes's avatar Jan Harkes Committed by Linus Torvalds

[PATCH] Coda updates [1/5]

  - Remove unused functions and variables.
  - Be a bit more strict with the definition of various types that are
    shared between kernel and userspace.
  - Included a couple of cleanups from Maximilian Attems and Stephen
    Hemminger.
parent 7140df08
......@@ -13,16 +13,7 @@
inline int coda_fideq(ViceFid *fid1, ViceFid *fid2)
{
if (fid1->Vnode != fid2->Vnode) return 0;
if (fid1->Volume != fid2->Volume) return 0;
if (fid1->Unique != fid2->Unique) return 0;
return 1;
}
inline int coda_isnullfid(ViceFid *fid)
{
if (fid->Vnode || fid->Volume || fid->Unique) return 0;
return 1;
return memcmp(fid1, fid2, sizeof(*fid1)) == 0;
}
static struct inode_operations coda_symlink_inode_operations = {
......
......@@ -28,7 +28,7 @@ int coda_fake_statfs;
char * coda_f2s(ViceFid *f)
{
static char s[60];
sprintf(s, "(%-#lx.%-#lx.%-#lx)", f->Volume, f->Vnode, f->Unique);
sprintf(s, "(%-#x.%-#x.%-#x)", f->Volume, f->Vnode, f->Unique);
return s;
}
......@@ -215,58 +215,3 @@ void coda_iattr_to_vattr(struct iattr *iattr, struct coda_vattr *vattr)
}
}
void print_vattr(struct coda_vattr *attr)
{
char *typestr;
switch (attr->va_type) {
case C_VNON:
typestr = "C_VNON";
break;
case C_VREG:
typestr = "C_VREG";
break;
case C_VDIR:
typestr = "C_VDIR";
break;
case C_VBLK:
typestr = "C_VBLK";
break;
case C_VCHR:
typestr = "C_VCHR";
break;
case C_VLNK:
typestr = "C_VLNK";
break;
case C_VSOCK:
typestr = "C_VSCK";
break;
case C_VFIFO:
typestr = "C_VFFO";
break;
case C_VBAD:
typestr = "C_VBAD";
break;
default:
typestr = "????";
break;
}
printk("attr: type %s (%o) mode %o uid %d gid %d rdev %d\n",
typestr, (int)attr->va_type, (int)attr->va_mode,
(int)attr->va_uid, (int)attr->va_gid, (int)attr->va_rdev);
printk(" fileid %d nlink %d size %d blocksize %d bytes %d\n",
(int)attr->va_fileid, (int)attr->va_nlink,
(int)attr->va_size,
(int)attr->va_blocksize,(int)attr->va_bytes);
printk(" gen %ld flags %ld\n",
attr->va_gen, attr->va_flags);
printk(" atime sec %d nsec %d\n",
(int)attr->va_atime.tv_sec, (int)attr->va_atime.tv_nsec);
printk(" mtime sec %d nsec %d\n",
(int)attr->va_mtime.tv_sec, (int)attr->va_mtime.tv_nsec);
printk(" ctime sec %d nsec %d\n",
(int)attr->va_ctime.tv_sec, (int)attr->va_ctime.tv_nsec);
}
......@@ -588,8 +588,7 @@ static int coda_venus_readdir(struct file *filp, filldir_t filldir,
break;
}
/* validate whether the directory file actually makes sense */
if (vdir->d_reclen < vdir_size + vdir->d_namlen ||
vdir->d_namlen > CODA_MAXNAMLEN) {
if (vdir->d_reclen < vdir_size + vdir->d_namlen) {
printk("coda_venus_readdir: Invalid dir: %ld\n",
filp->f_dentry->d_inode->i_ino);
ret = -EBADF;
......
......@@ -169,7 +169,6 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)
vc->vc_sb = sb;
sbi->sbi_sb = sb;
sbi->sbi_vcomm = vc;
INIT_LIST_HEAD(&sbi->sbi_cihead);
......
......@@ -61,7 +61,6 @@ unsigned long coda_timeout = 30; /* .. secs, then signals will dequeue */
struct venus_comm coda_comms[MAX_CODADEVS];
kmem_cache_t *cii_cache, *cred_cache, *upc_cache;
/*
* Device operations
......@@ -126,13 +125,13 @@ static ssize_t coda_psdev_write(struct file *file, const char *buf,
}
if ( nbytes < sizeof(struct coda_out_hdr) ) {
printk("coda_downcall opc %ld uniq %ld, not enough!\n",
printk("coda_downcall opc %d uniq %d, not enough!\n",
hdr.opcode, hdr.unique);
count = nbytes;
goto out;
}
if ( nbytes > size ) {
printk("Coda: downcall opc %ld, uniq %ld, too much!",
printk("Coda: downcall opc %d, uniq %d, too much!",
hdr.opcode, hdr.unique);
nbytes = size;
}
......@@ -171,7 +170,7 @@ static ssize_t coda_psdev_write(struct file *file, const char *buf,
unlock_kernel();
if (!req) {
printk("psdev_write: msg (%ld, %ld) not found\n",
printk("psdev_write: msg (%d, %d) not found\n",
hdr.opcode, hdr.unique);
retval = -ESRCH;
goto out;
......@@ -179,7 +178,7 @@ static ssize_t coda_psdev_write(struct file *file, const char *buf,
/* move data into response buffer. */
if (req->uc_outSize < nbytes) {
printk("psdev_write: too much cnt: %d, cnt: %ld, opc: %ld, uniq: %ld.\n",
printk("psdev_write: too much cnt: %d, cnt: %ld, opc: %d, uniq: %d.\n",
req->uc_outSize, (long)nbytes, hdr.opcode, hdr.unique);
nbytes = req->uc_outSize; /* don't have more space! */
}
......@@ -325,10 +324,7 @@ static int coda_psdev_release(struct inode * inode, struct file * file)
}
/* Wakeup clients so they can return. */
lh = vcp->vc_pending.next;
next = lh;
while ( (lh = next) != &vcp->vc_pending) {
next = lh->next;
list_for_each_safe(lh, next, &vcp->vc_pending) {
req = list_entry(lh, struct upc_req, uc_chain);
/* Async requests need to be freed here */
if (req->uc_flags & REQ_ASYNC) {
......@@ -340,9 +336,7 @@ static int coda_psdev_release(struct inode * inode, struct file * file)
wake_up(&req->uc_sleep);
}
lh = &vcp->vc_processing;
while ( (lh = lh->next) != &vcp->vc_processing) {
req = list_entry(lh, struct upc_req, uc_chain);
list_for_each_entry(req, &vcp->vc_processing, uc_chain) {
req->uc_flags |= REQ_ABORT;
wake_up(&req->uc_sleep);
}
......
......@@ -163,11 +163,11 @@ typedef unsigned int u_int32_t;
#ifndef _VENUS_DIRENT_T_
#define _VENUS_DIRENT_T_ 1
struct venus_dirent {
unsigned long d_fileno; /* file number of entry */
unsigned short d_reclen; /* length of this record */
unsigned char d_type; /* file type, see below */
unsigned char d_namlen; /* length of string in d_name */
char d_name[CODA_MAXNAMLEN + 1];/* name must be no longer than this */
u_int32_t d_fileno; /* file number of entry */
u_int16_t d_reclen; /* length of this record */
u_int8_t d_type; /* file type, see below */
u_int8_t d_namlen; /* length of string in d_name */
char d_name[CODA_MAXNAMLEN + 1];/* name must be no longer than this */
};
#undef DIRSIZ
#define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \
......@@ -196,10 +196,10 @@ struct venus_dirent {
#ifndef _FID_T_
#define _FID_T_ 1
typedef u_long VolumeId;
typedef u_long VnodeId;
typedef u_long Unique_t;
typedef u_long FileVersion;
typedef u_int32_t VolumeId;
typedef u_int32_t VnodeId;
typedef u_int32_t Unique_t;
typedef u_int32_t FileVersion;
#endif
#ifndef _VICEFID_T_
......@@ -336,19 +336,19 @@ struct coda_statfs {
* Venus <-> Coda RPC arguments
*/
struct coda_in_hdr {
unsigned long opcode;
unsigned long unique; /* Keep multiple outstanding msgs distinct */
u_short pid; /* Common to all */
u_short pgid; /* Common to all */
u_short sid; /* Common to all */
struct coda_cred cred; /* Common to all */
u_int32_t opcode;
u_int32_t unique; /* Keep multiple outstanding msgs distinct */
u_int16_t pid; /* Common to all */
u_int16_t pgid; /* Common to all */
u_int16_t sid; /* Common to all */
struct coda_cred cred; /* Common to all */
};
/* Really important that opcode and unique are 1st two fields! */
struct coda_out_hdr {
unsigned long opcode;
unsigned long unique;
unsigned long result;
u_int32_t opcode;
u_int32_t unique;
u_int32_t result;
};
/* coda_root: NO_IN */
......@@ -633,14 +633,6 @@ struct coda_zapdir_out {
ViceFid CodaFid;
};
/* coda_zapnode: */
/* CODA_ZAPVNODE is a venus->kernel call */
struct coda_zapvnode_out {
struct coda_out_hdr oh;
struct coda_cred cred;
ViceFid VFid;
};
/* coda_purgefid: */
/* CODA_PURGEFID is a venus->kernel call */
struct coda_purgefid_out {
......@@ -741,7 +733,6 @@ union outputArgs {
struct coda_purgeuser_out coda_purgeuser;
struct coda_zapfile_out coda_zapfile;
struct coda_zapdir_out coda_zapdir;
struct coda_zapvnode_out coda_zapvnode;
struct coda_purgefid_out coda_purgefid;
struct coda_replace_out coda_replace;
struct coda_open_by_fd_out coda_open_by_fd;
......@@ -755,7 +746,6 @@ union coda_downcalls {
struct coda_purgeuser_out purgeuser;
struct coda_zapfile_out zapfile;
struct coda_zapdir_out zapdir;
struct coda_zapvnode_out zapvnode;
struct coda_purgefid_out purgefid;
struct coda_replace_out replace;
};
......@@ -778,18 +768,9 @@ struct PioctlData {
struct ViceIoctl vi;
};
#define CODA_CONTROL ".CONTROL"
#define CODA_CONTROLLEN 8
#define CTL_VOL -1
#define CTL_VNO -1
#define CTL_UNI -1
#define CTL_INO -1
#define CTL_FILE "/coda/.CONTROL"
#define IS_CTL_FID(fidp) ((fidp)->Volume == CTL_VOL &&\
(fidp)->Vnode == CTL_VNO &&\
(fidp)->Unique == CTL_UNI)
#define CODA_CONTROL ".CONTROL"
#define CODA_CONTROLLEN 8
#define CTL_INO -1
/* Data passed to mount */
......
......@@ -42,7 +42,6 @@ int coda_permission(struct inode *inode, int mask, struct nameidata *nd);
int coda_revalidate_inode(struct dentry *);
int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *);
int coda_setattr(struct dentry *, struct iattr *);
int coda_isnullfid(ViceFid *fid);
/* global variables */
extern int coda_fake_statfs;
......@@ -59,7 +58,6 @@ void coda_load_creds(struct coda_cred *cred);
void coda_vattr_to_iattr(struct inode *, struct coda_vattr *);
void coda_iattr_to_vattr(struct iattr *, struct coda_vattr *);
unsigned short coda_flags_to_cflags(unsigned short);
void print_vattr( struct coda_vattr *attr );
int coda_cred_ok(struct coda_cred *cred);
int coda_cred_eq(struct coda_cred *cred1, struct coda_cred *cred2);
......
......@@ -6,12 +6,11 @@
#define CODA_SUPER_MAGIC 0x73757245
struct statfs;
struct kstatfs;
struct coda_sb_info
{
struct venus_comm * sbi_vcomm;
struct super_block *sbi_sb;
struct venus_comm *sbi_vcomm;
struct list_head sbi_cihead;
};
......
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