*
*/
-#ifndef _CFS_LIB_H
-#define _CFS_LIB_H
+#ifndef _LUSTRE_LIB_H
+#define _LUSTRE_LIB_H
#include <asm/types.h>
int lustre_commit_page(struct page *page, unsigned from, unsigned to);
#endif
-
-/* macros */
-#undef MIN
-#define MIN(a,b) (((a)<(b)) ? (a): (b))
-#undef MAX
-#define MAX(a,b) (((a)>(b)) ? (a): (b))
-#define MKSTR(ptr) ((ptr))? (ptr) : ""
-
-static inline int size_round (int val)
-{
- return (val + 3) & (~0x3);
-}
-
-static inline int size_round0(int val)
-{
- if (!val)
- return 0;
- return (val + 1 + 3) & (~0x3);
-}
-
-static inline size_t round_strlen(char *fset)
-{
- return size_round(strlen(fset) + 1);
-}
-
-#ifdef __KERNEL__
-static inline char *strdup(char *str)
-{
- char *tmp = kmalloc(strlen(str) + 1, GFP_KERNEL);
- if (tmp)
- memcpy(tmp, str, strlen(str) + 1);
-
- return NULL;
-}
-#endif
-
-#ifdef __KERNEL__
-# define NTOH__u32(var) le32_to_cpu(var)
-# define NTOH__u64(var) le64_to_cpu(var)
-# define HTON__u32(var) cpu_to_le32(var)
-# define HTON__u64(var) cpu_to_le64(var)
-#else
-# include <glib.h>
-# define NTOH__u32(var) GUINT32_FROM_LE(var)
-# define NTOH__u64(var) GUINT64_FROM_LE(var)
-# define HTON__u32(var) GUINT32_TO_LE(var)
-# define HTON__u64(var) GUINT64_TO_LE(var)
-#endif
-
-/*
- * copy sizeof(type) bytes from pointer to var and move ptr forward.
- * return EFAULT if pointer goes beyond end
- */
-#define UNLOGV(var,type,ptr,end) \
-do { \
- var = *(type *)ptr; \
- ptr += sizeof(type); \
- if (ptr > end ) \
- return -EFAULT; \
-} while (0)
-
-/* the following two macros convert to little endian */
-/* type MUST be __u32 or __u64 */
-#define LUNLOGV(var,type,ptr,end) \
-do { \
- var = NTOH##type(*(type *)ptr); \
- ptr += sizeof(type); \
- if (ptr > end ) \
- return -EFAULT; \
-} while (0)
-
-/* now log values */
-#define LOGV(var,type,ptr) \
-do { \
- *((type *)ptr) = var; \
- ptr += sizeof(type); \
-} while (0)
-
-/* and in network order */
-#define LLOGV(var,type,ptr) \
-do { \
- *((type *)ptr) = HTON##type(var); \
- ptr += sizeof(type); \
-} while (0)
-
-
-/*
- * set var to point at (type *)ptr, move ptr forward with sizeof(type)
- * return from function with EFAULT if ptr goes beyond end
- */
-#define UNLOGP(var,type,ptr,end) \
-do { \
- var = (type *)ptr; \
- ptr += sizeof(type); \
- if (ptr > end ) \
- return -EFAULT; \
-} while (0)
-
-#define LOGP(var,type,ptr) \
-do { \
- memcpy(ptr, var, sizeof(type)); \
- ptr += sizeof(type); \
-} while (0)
-
-/*
- * set var to point at (char *)ptr, move ptr forward by size_round(len);
- * return from function with EFAULT if ptr goes beyond end
- */
-#define UNLOGL(var,type,len,ptr,end) \
-do { \
- if (!len) { \
- var = NULL; \
- break; \
- } \
- var = (type *)ptr; \
- ptr += size_round(len * sizeof(type)); \
- if (ptr > end ) \
- return -EFAULT; \
-} while (0)
-
-#define UNLOGL0(var,type,len,ptr,end) \
-do { \
- UNLOGL(var,type,len,ptr,end); \
- if ( *((char *)ptr - size_round(len) + len - 1) != '\0')\
- return -EFAULT; \
-} while (0)
-
-
-#define LOGL(var,len,ptr) \
-do { \
- if (!len) break; \
- memcpy((char *)ptr, (const char *)var, len); \
- ptr += size_round(len); \
-} while (0)
-
-#define LOGL0(var,len,ptr) \
-do { \
- if (!len) break; \
- memcpy((char *)ptr, (const char *)var, len); \
- *((char *)(ptr) + len) = 0; \
- ptr += size_round(len + 1); \
-} while (0)
+#include <linux/portals_lib.h>
#endif /* _LUSTRE_LIB_H */
#include <linux/autoconf.h>
#include <linux/slab.h>
+#include <linux/kp30.h>
#define obd_unlock_page(page) \
do { \
#ifdef EXT2_OBD_DEBUG
#define CMD(cmd) (( cmd == READ ) ? "read" : "write")
-/* debugging masks */
-#define D_PSDEV 0x001 /* debug information from psdev.c */
-#define D_INODE 0x002
-#define D_SUPER 0x004
-#define D_SNAP 0x008
-#define D_UNUSED4 0x010
-#define D_WARNING 0x020 /* misc warnings */
-#define D_EXT2 0x040 /* anything from ext2_debug */
-#define D_MALLOC 0x080 /* print malloc, free information */
-#define D_CACHE 0x100 /* cache-related items */
-#define D_INFO 0x200 /* general information, especially from interface.c */
-#define D_IOCTL 0x400 /* ioctl related information */
-#define D_BLOCKS 0x800 /* ext2 block allocation */
-#define D_NET 0x1000 /* network communications */
-#define D_PUNCH 0x2000
-#define D_BUFFS 0x4000 /* print network buffers */
-
-#define CDEBUG(mask, format, a...) \
- do { \
- if (obd_debug_level & mask) { \
- printk("(%s:%d):", __FUNCTION__, __LINE__); \
- printk(format, ## a); } \
- } while (0)
-
-#define ENTRY if (obd_print_entry) \
- printk(KERN_INFO "Process %d entered %s\n", current->pid, __FUNCTION__)
-
-#define EXIT if (obd_print_entry) \
- printk(KERN_INFO "Process %d leaving %s [%d]\n", current->pid, \
- __FUNCTION__, __LINE__)
-
/* Inode common information printed out (used by obdfs and ext2obd inodes) */
#define ICDEBUG(inode) { \
- CDEBUG(D_INFO, \
- "ino %ld, atm %ld, mtm %ld, ctm %ld, size %Ld, blocks %ld\n",\
- inode->i_ino, inode->i_atime, inode->i_mtime, inode->i_ctime,\
- inode->i_size, inode->i_blocks); \
+ CDEBUG(D_INFO, "ino %ld, atm %ld, mtm %ld, ctm %ld, size %Ld, " \
+ "blocks %ld\n", inode->i_ino, inode->i_atime, \
+ inode->i_mtime, inode->i_ctime, inode->i_size, \
+ inode->i_blocks); \
CDEBUG(D_INFO, "mode %o, uid %d, gid %d, nlnk %d, count %d\n", \
- inode->i_mode, inode->i_uid, inode->i_gid, inode->i_nlink,\
- atomic_read(&inode->i_count)); \
+ inode->i_mode, inode->i_uid, inode->i_gid, \
+ inode->i_nlink, atomic_read(&inode->i_count)); \
}
/* Ext2 inode information */
(obdo)->o_obdflags, (obdo)->o_nlink, (obdo)->o_valid); \
}
-
#define PDEBUG(page,msg) { \
if (page){ \
char *uptodate = (Page_Uptodate(page)) ? "upto" : "outof";\
rep->nlink = 1;
rep->atime = rep->ctime = rep->mtime = time;
rep->mode = mode;
- printk("-- new_inode: objid %lld, ino %d, mode %o\n",
+ CDEBUG(D_LLIGHT, "-- new_inode: objid %lld, ino %d, mode %o\n",
rep->objid, rep->ino, rep->mode);
inode = iget4(dir->i_sb, rep->ino, NULL, rep);
}
mode = mode | S_IFREG;
- printk("ll_create: name %s mode %o\n", dentry->d_name.name, mode);
+ CDEBUG(D_LLIGHT, "name %s mode %o\n", dentry->d_name.name, mode);
inode = ll_create_node(dir, dentry->d_name.name, dentry->d_name.len,
NULL, 0,
mode, oa.o_id);
}
memcpy(retval, value, strlen(value)+1);
- CDEBUG(D_PSDEV, "Assigned option: %s, value %s\n", opt, retval);
+ CDEBUG(D_SUPER, "Assigned option: %s, value %s\n", opt, retval);
EXIT;
return retval;
}
}
err = obd_destroy(IID(inode), oa);
- printk(__FUNCTION__ ": obd destroy of %Ld error %d\n",
- oa->o_id, err);
+ CDEBUG(D_LLIGHT, "obd destroy of %Ld error %d\n",
+ oa->o_id, err);
obdo_free(oa);
}
printk("llight request: cannot pack request %d\n", rc);
return NULL;
}
- printk("--> mds_prep_req: len %d, req %p, tgtlen %d\n",
+ CDEBUG(D_MDC, "--> mds_prep_req: len %d, req %p, tgtlen %d\n",
request->rq_reqlen, request->rq_req.mds,
request->rq_req.mds->tgtlen);
request->rq_reqhdr->opc = opcode;
/* XXX fix the race here (wait_for_event?)*/
if (peer == NULL) {
/* Local delivery */
- printk("--->> %s %d\n", __FUNCTION__, __LINE__);
+ ENTRY;
rc = mds_queue_req(req);
} else {
/* Remote delivery via portals. */
}
init_waitqueue_head(&req->rq_wait_for_rep);
- printk("-- sleeping\n");
+ CDEBUG(D_MDC, "-- sleeping\n");
interruptible_sleep_on(&req->rq_wait_for_rep);
- printk("-- done\n");
+ CDEBUG(D_MDC, "-- done\n");
rc = mds_unpack_rep(req->rq_repbuf, req->rq_replen, &req->rq_rephdr,
&req->rq_rep.mds);
}
if ( req->rq_rephdr->status == 0 )
- printk("-->mdc_queue_wait: buf %p len %d status %d\n",
+ CDEBUG(D_MDC, "--> buf %p len %d status %d\n",
req->rq_repbuf, req->rq_replen,
req->rq_rephdr->status);
goto out;
}
- printk("mds_getattr: mode: %o\n", request->rq_rep.mds->mode);
+ CDEBUG(D_MDC, "mode: %o\n", request->rq_rep.mds->mode);
if (rep) {
*rep = request->rq_rep.mds;
niobuf.addr = (__u64) (long) addr;
- printk("mdc_readpage: inode: %ld\n", ino);
+ CDEBUG(D_MDC, "inode: %ld\n", ino);
request = mds_prep_req(MDS_READPAGE, 0, NULL,
sizeof(struct niobuf), (char *)&niobuf);
goto out;
}
- printk("mdc_readpage: mode: %o\n", request->rq_rep.mds->mode);
+ CDEBUG(D_MDC, "mode: %o\n", request->rq_rep.mds->mode);
if (rep) {
*rep = request->rq_rep.mds;
return -ENOMEM;
}
- printk("---> MDS at %d %p, incoming req %p, srv_req %p\n",
+ CDEBUG(D_MDS, "---> MDS at %d %p, incoming req %p, srv_req %p\n",
__LINE__, MDS, req, srv_req);
memset(srv_req, 0, sizeof(*req));
if (inode == NULL)
return ERR_PTR(-ENOMEM);
- printk("--> mds_fid2dentry: sb %p\n", inode->i_sb);
+ CDEBUG(D_MDS, "--> mds_fid2dentry: sb %p\n", inode->i_sb);
if (is_bad_inode(inode)
|| (generation && inode->i_generation != generation)
return 0;
}
- printk("mds_readpage: ino %ld\n", de->d_inode->i_ino);
+ CDEBUG(D_MDS, "ino %ld\n", de->d_inode->i_ino);
file = dentry_open(de, mnt, O_RDONLY | O_LARGEFILE);
/* note: in case of an error, dentry_open puts dentry */
return 0;
}
- printk("mds_setattr: ino %ld\n", de->d_inode->i_ino);
+ CDEBUG(D_MDS, "ino %ld\n", de->d_inode->i_ino);
/* a _really_ horrible hack to avoid removing the data stored
in the block pointers; this data is the object id
EXIT;
return 0;
}
- printk("mds_reint_create: ino %ld\n", de->d_inode->i_ino);
+ CDEBUG(D_MDS, "ino %ld\n", de->d_inode->i_ino);
dchild = lookup_one_len(rec->ur_name, de, rec->ur_namelen - 1);
rc = PTR_ERR(dchild);
EXIT;
return 0;
}
- printk("mds_reint_create: ino %ld\n", de->d_inode->i_ino);
+ CDEBUG(D_MDS, "ino %ld\n", de->d_inode->i_ino);
dchild = lookup_one_len(rec->ur_name, de, rec->ur_namelen - 1);
rc = PTR_ERR(dchild);
}
memcpy(retval, value, strlen(value)+1);
- CDEBUG(D_PSDEV, "Assigned option: %s, value %s\n", opt, retval);
+ CDEBUG(D_SUPER, "Assigned option: %s, value %s\n", opt, retval);
return retval;
}
return -ENOMEM;
}
- printk("---> OST at %d %p, incoming req %p, srv_req %p\n",
+ CDEBUG(D_OST, "---> OST at %d %p, incoming req %p, srv_req %p\n",
__LINE__, ost, req, srv_req);
memset(srv_req, 0, sizeof(*req));
int rc;
ENTRY;
- printk("ost getattr entered\n");
conn.oc_id = req->rq_req.ost->connid;
conn.oc_dev = ost->ost_tgt;
req->rq_rep.ost->result =ost->ost_tgt->obd_type->typ_ops->o_connect(&conn);
- printk("ost_connect: rep buffer %p, id %d\n", req->rq_repbuf,
+ CDEBUG(D_OST, "ost_connect: rep buffer %p, id %d\n", req->rq_repbuf,
conn.oc_id);
req->rq_rep.ost->connid = conn.oc_id;
EXIT;
struct ptlreq_hdr *hdr;
ENTRY;
- printk("ost_handle: req at %p\n", req);
+ CDEBUG(D_OST, "req at %p\n", req);
hdr = (struct ptlreq_hdr *)req->rq_reqbuf;
if (NTOH__u32(hdr->type) != OST_TYPE_REQ) {
module_init(ptlrpc_init);
module_exit(ptlrpc_exit);
-
bin_SCRIPTS = obdcontrol
EXTRA_DIST = $(bin_SCRIPTS)
-CFLAGS:=-g -I. -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I../include -Wall
+CFLAGS:=-g -I. -I/usr/include/glib-1.2 -I$(PORTALS)/include -I/usr/lib/glib/include -I../include -Wall
KFLAGS:=
CPPFLAGS :=
LDADD := -lreadline -ltermcap # -lefence